Merge branch 'master' into kivarsha/connectivityManager
This commit is contained in:
Коммит
ce7347ad81
|
@ -1,4 +1,4 @@
|
|||
include_directories( . ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include/public ${CMAKE_CURRENT_SOURCE_DIR}/include/public ${CMAKE_CURRENT_SOURCE_DIR}/include/mat ${CMAKE_CURRENT_SOURCE_DIR}/pal ${CMAKE_CURRENT_SOURCE_DIR}/utils ${CMAKE_CURRENT_SOURCE_DIR}/modules/exp ${CMAKE_CURRENT_SOURCE_DIR}/modules/dataviewer ${CMAKE_CURRENT_SOURCE_DIR}/modules/privacyguard ${CMAKE_CURRENT_SOURCE_DIR}/../third_party/Reachability ${CMAKE_CURRENT_SOURCE_DIR}/modules/cds /usr/local/include )
|
||||
include_directories( . ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include/public ${CMAKE_CURRENT_SOURCE_DIR}/include/public ${CMAKE_CURRENT_SOURCE_DIR}/include/mat ${CMAKE_CURRENT_SOURCE_DIR}/pal ${CMAKE_CURRENT_SOURCE_DIR}/utils ${CMAKE_CURRENT_SOURCE_DIR}/modules/exp ${CMAKE_CURRENT_SOURCE_DIR}/modules/dataviewer ${CMAKE_CURRENT_SOURCE_DIR}/modules/privacyguard ${CMAKE_CURRENT_SOURCE_DIR}/../third_party/Reachability ${CMAKE_CURRENT_SOURCE_DIR}/modules/cds /usr/local/include )
|
||||
|
||||
set(SRCS decorators/BaseDecorator.cpp
|
||||
packager/BondSplicer.cpp
|
||||
|
@ -82,6 +82,7 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/privacyguard/ AND BUILD_PRIVACYGUA
|
|||
list(APPEND SRCS
|
||||
modules/privacyguard/PrivacyGuard.cpp
|
||||
modules/privacyguard/RegisteredFileTypes.cpp
|
||||
modules/privacyguard/SummaryStatistics.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@ endif()
|
|||
if(EXISTS ${SDK_ROOT}/lib/modules/privacyguard/ AND BUILD_PRIVACYGUARD)
|
||||
list(APPEND SRCS
|
||||
${SDK_ROOT}/lib/jni/PrivacyGuard_jni.cpp
|
||||
${SDK_ROOT}/lib/modules/privacyguard/SummaryStatistics.cpp
|
||||
${SDK_ROOT}/lib/modules/privacyguard/PrivacyGuard.cpp
|
||||
${SDK_ROOT}/lib/modules/privacyguard/RegisteredFileTypes.cpp
|
||||
)
|
||||
|
|
|
@ -402,7 +402,7 @@ namespace MAT_NS_BEGIN
|
|||
m_httpClient = nullptr;
|
||||
m_taskDispatcher = nullptr;
|
||||
m_dataViewer = nullptr;
|
||||
m_dataInspector = nullptr;
|
||||
ClearDataInspectors();
|
||||
|
||||
m_filters.UnregisterAllFilters();
|
||||
|
||||
|
@ -525,9 +525,9 @@ namespace MAT_NS_BEGIN
|
|||
m_context.SetCustomField(name, prop);
|
||||
{
|
||||
LOCKGUARD(m_dataInspectorGuard);
|
||||
if (m_dataInspector)
|
||||
for(const auto& dataInspector : m_dataInspectors)
|
||||
{
|
||||
m_dataInspector->InspectSemanticContext(name, value, /*isGlobalContext: */ true, std::string{});
|
||||
dataInspector->InspectSemanticContext(name, value, /*isGlobalContext: */ true, std::string{});
|
||||
}
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
|
@ -603,9 +603,9 @@ namespace MAT_NS_BEGIN
|
|||
m_context.SetCustomField(name, prop);
|
||||
{
|
||||
LOCKGUARD(m_dataInspectorGuard);
|
||||
if (m_dataInspector)
|
||||
for(const auto& dataInspector : m_dataInspectors)
|
||||
{
|
||||
m_dataInspector->InspectSemanticContext(name, value, /*isGlobalContext: */ true, std::string{});
|
||||
dataInspector->InspectSemanticContext(name, value, /*isGlobalContext: */ true, std::string{});
|
||||
}
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
|
@ -710,9 +710,9 @@ namespace MAT_NS_BEGIN
|
|||
{
|
||||
LOCKGUARD(m_dataInspectorGuard);
|
||||
|
||||
if (m_dataInspector)
|
||||
for (const auto& dataInspector : m_dataInspectors)
|
||||
{
|
||||
m_dataInspector->InspectRecord(*(event->source));
|
||||
dataInspector->InspectRecord(*(event->source));
|
||||
}
|
||||
}
|
||||
GetSystem()->sendEvent(event);
|
||||
|
@ -807,12 +807,53 @@ namespace MAT_NS_BEGIN
|
|||
void LogManagerImpl::SetDataInspector(const std::shared_ptr<IDataInspector>& dataInspector)
|
||||
{
|
||||
LOCKGUARD(m_dataInspectorGuard);
|
||||
m_dataInspector = dataInspector;
|
||||
if(dataInspector == nullptr)
|
||||
{
|
||||
LOG_WARN("Attempting to set nullptr as DataInspector");
|
||||
return;
|
||||
}
|
||||
|
||||
auto itDataInspector = std::find_if(m_dataInspectors.begin(), m_dataInspectors.end(), [&dataInspector](const std::shared_ptr<IDataInspector>& currentInspector)
|
||||
{
|
||||
return strcmp(dataInspector->GetName(), currentInspector->GetName()) == 0;
|
||||
});
|
||||
|
||||
if (itDataInspector != m_dataInspectors.end())
|
||||
{
|
||||
LOG_WARN("Replacing specified IDataInspector with passed in inspector");
|
||||
m_dataInspectors.erase(itDataInspector);
|
||||
}
|
||||
|
||||
m_dataInspectors.push_back(dataInspector);
|
||||
}
|
||||
|
||||
std::shared_ptr<IDataInspector> LogManagerImpl::GetDataInspector() noexcept
|
||||
void LogManagerImpl::ClearDataInspectors()
|
||||
{
|
||||
return m_dataInspector;
|
||||
LOCKGUARD(m_dataInspectorGuard);
|
||||
std::vector<std::shared_ptr<IDataInspector>>{}.swap(m_dataInspectors);
|
||||
}
|
||||
|
||||
void LogManagerImpl::RemoveDataInspector(const std::string& name)
|
||||
{
|
||||
LOCKGUARD(m_dataInspectorGuard);
|
||||
auto itDataInspector = std::find_if(m_dataInspectors.begin(), m_dataInspectors.end(), [&name](const std::shared_ptr<IDataInspector>& inspector){
|
||||
return strcmp(inspector->GetName(), name.c_str()) == 0;
|
||||
});
|
||||
|
||||
if (itDataInspector != m_dataInspectors.end())
|
||||
{
|
||||
m_dataInspectors.erase(itDataInspector);
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<IDataInspector> LogManagerImpl::GetDataInspector(const std::string& name) noexcept
|
||||
{
|
||||
LOCKGUARD(m_dataInspectorGuard);
|
||||
auto it = std::find_if(m_dataInspectors.begin(), m_dataInspectors.end(), [&name](const std::shared_ptr<IDataInspector>& inspector){
|
||||
return strcmp(inspector->GetName(), name.c_str()) == 0;
|
||||
});
|
||||
|
||||
return it != m_dataInspectors.end() ? *it : nullptr;
|
||||
}
|
||||
|
||||
status_t LogManagerImpl::DeleteData()
|
||||
|
|
|
@ -297,8 +297,9 @@ namespace MAT_NS_BEGIN
|
|||
static size_t GetDeadLoggerCount();
|
||||
|
||||
virtual void SetDataInspector(const std::shared_ptr<IDataInspector>& dataInspector) override;
|
||||
|
||||
virtual std::shared_ptr<IDataInspector> GetDataInspector() noexcept override;
|
||||
virtual void ClearDataInspectors() override;
|
||||
virtual void RemoveDataInspector(const std::string& name) override;
|
||||
virtual std::shared_ptr<IDataInspector> GetDataInspector(const std::string& name) noexcept override;
|
||||
|
||||
protected:
|
||||
std::unique_ptr<ITelemetrySystem>& GetSystem();
|
||||
|
@ -337,7 +338,7 @@ namespace MAT_NS_BEGIN
|
|||
EventFilterCollection m_filters;
|
||||
std::vector<std::unique_ptr<IModule>> m_modules;
|
||||
DataViewerCollection m_dataViewerCollection;
|
||||
std::shared_ptr<IDataInspector> m_dataInspector;
|
||||
std::vector<std::shared_ptr<IDataInspector>> m_dataInspectors;
|
||||
std::recursive_mutex m_dataInspectorGuard;
|
||||
};
|
||||
|
||||
|
|
|
@ -15,52 +15,6 @@
|
|||
|
||||
namespace MAT_NS_BEGIN
|
||||
{
|
||||
/// <summary>
|
||||
/// Common Privacy Contexts to inspect in the data
|
||||
/// </summary>
|
||||
struct CommonDataContexts final
|
||||
{
|
||||
/// <summary>
|
||||
/// Domain Name for the current machine
|
||||
/// </summary>
|
||||
std::string DomainName;
|
||||
|
||||
/// <summary>
|
||||
/// Friendly Machine Name
|
||||
/// </summary>
|
||||
std::string MachineName;
|
||||
|
||||
/// <summary>
|
||||
/// Unique UserName such as the log-in name
|
||||
/// </summary>
|
||||
std::string UserName;
|
||||
|
||||
/// <summary>
|
||||
/// Unique User Alias, if different than UserName
|
||||
/// </summary>
|
||||
std::string UserAlias;
|
||||
|
||||
/// <summary>
|
||||
/// IP Addresses for local network ports such as IPv4, IPv6, etc.
|
||||
/// </summary>
|
||||
std::vector<std::string> IpAddresses;
|
||||
|
||||
/// <summary>
|
||||
/// Collection of Language identifiers
|
||||
/// </summary>
|
||||
std::vector<std::string> LanguageIdentifiers;
|
||||
|
||||
/// <summary>
|
||||
/// Collection of Machine ID such as Machine Name, Motherboard ID, MAC Address, etc.
|
||||
/// </summary>
|
||||
std::vector<std::string> MachineIds;
|
||||
|
||||
/// <summary>
|
||||
/// Collection of OutOfScope Identifiers such as SQM_ID, Client_ID, etc.
|
||||
/// </summary>
|
||||
std::vector<std::string> OutOfScopeIdentifiers;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows SDK users to register a data inspector
|
||||
/// that will inspect the data being uploaded by the SDK.
|
||||
|
@ -93,14 +47,6 @@ namespace MAT_NS_BEGIN
|
|||
/// <returns>Always returns true.</returns>
|
||||
virtual bool InspectRecord(::CsProtocol::Record& record) noexcept = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Set Common Data Context after initialization.
|
||||
/// <b>Note:</b> Data that may have been sent before this method was called
|
||||
/// will not be inspected.
|
||||
/// </summary>
|
||||
/// <param name="freshCommonPrivacyContext">Unique Ptr for Common Privacy Contexts. If the param is nullptr, this method is no-op.</param>
|
||||
virtual void AppendCommonDataContext(std::unique_ptr<CommonDataContexts>&& freshCommonDataContext) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Inspect an ISemanticContext value.
|
||||
/// </summary>
|
||||
|
@ -118,6 +64,12 @@ namespace MAT_NS_BEGIN
|
|||
/// <param name="isGlobalContext">Whether this is a global/logmanager Context or local ILogger context</param>
|
||||
/// <param name="associatedTenant">(Optional) Tenant associated with the Context</param>
|
||||
virtual void InspectSemanticContext(const std::string& contextName, GUID_t contextValue, bool isGlobalContext, const std::string& associatedTenant) noexcept = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Returns unique name for current Data Inspector
|
||||
/// </summary>
|
||||
/// <returns>Name of Data Inspector</returns>
|
||||
virtual const char* GetName() const noexcept { return ""; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -380,10 +380,28 @@ namespace MAT_NS_BEGIN
|
|||
virtual void SetDataInspector(const std::shared_ptr<IDataInspector>& dataInspector) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Get the current instance of IDataInspector
|
||||
/// Clears all IDataInspectors
|
||||
/// </summary>
|
||||
/// <returns>Current instance of IDataInspector if set, nullptr otherwise.</returns>
|
||||
virtual std::shared_ptr<IDataInspector> GetDataInspector() noexcept = 0;
|
||||
virtual void ClearDataInspectors() = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Removes specified IDataInspector
|
||||
/// </summary>
|
||||
/// <param name="name">String name that identifies IDataInspector</param>
|
||||
virtual void RemoveDataInspector(const std::string& name) = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Get the current instance of IDataInspector specified by the name
|
||||
/// </summary>
|
||||
/// <param name="name">String name that identifies IDataInspector</param>
|
||||
/// <returns>Selected instance of IDataInspector if available, nullptr otherwise.</returns>
|
||||
virtual std::shared_ptr<IDataInspector> GetDataInspector(const std::string& name) noexcept = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Get the current instance of IDataInspector specified by an empty string
|
||||
/// </summary>
|
||||
/// <returns>Selected instance of IDataInspector if available, nullptr otherwise.</returns>
|
||||
virtual std::shared_ptr<IDataInspector> GetDataInspector() noexcept { return GetDataInspector(std::string{}); }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -370,7 +370,11 @@ namespace MAT_NS_BEGIN
|
|||
|
||||
void SetDataInspector(const std::shared_ptr<IDataInspector>& /*dataInspector*/) override {}
|
||||
|
||||
std::shared_ptr<IDataInspector> GetDataInspector() noexcept override
|
||||
void RemoveDataInspector(const std::string& /*name*/) override {}
|
||||
|
||||
void ClearDataInspectors() override {}
|
||||
|
||||
std::shared_ptr<IDataInspector> GetDataInspector(const std::string& /*name*/) noexcept override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -6,34 +6,19 @@
|
|||
#define MAT_VERSION_HPP
|
||||
// WARNING: DO NOT MODIFY THIS FILE!
|
||||
// This file has been automatically generated, manual changes will be lost.
|
||||
#define BUILD_VERSION_STR "3.5.57.1"
|
||||
#define BUILD_VERSION 3,5,57,1
|
||||
#define BUILD_VERSION_STR "3.5.60.1"
|
||||
#define BUILD_VERSION 3,5,60,1
|
||||
|
||||
#ifndef RESOURCE_COMPILER_INVOKED
|
||||
#include <ctmacros.hpp>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef HAVE_MAT_SHORT_NS
|
||||
#define MAT_NS_BEGIN MAT
|
||||
#define MAT_NS_END
|
||||
#define PAL_NS_BEGIN PAL
|
||||
#define PAL_NS_END
|
||||
#else
|
||||
#define MAT_NS_BEGIN Microsoft { namespace Applications { namespace Events
|
||||
#define MAT_NS_END }}
|
||||
#define MAT ::Microsoft::Applications::Events
|
||||
#define PAL_NS_BEGIN Microsoft { namespace Applications { namespace Events { namespace PlatformAbstraction
|
||||
#define PAL_NS_END }}}
|
||||
#define PAL ::Microsoft::Applications::Events::PlatformAbstraction
|
||||
#endif
|
||||
|
||||
#define MAT_v1 ::Microsoft::Applications::Telemetry
|
||||
|
||||
namespace MAT_NS_BEGIN {
|
||||
|
||||
uint64_t const Version =
|
||||
((uint64_t)3 << 48) |
|
||||
((uint64_t)5 << 32) |
|
||||
((uint64_t)57 << 16) |
|
||||
((uint64_t)60 << 16) |
|
||||
((uint64_t)1);
|
||||
|
||||
} MAT_NS_END
|
||||
|
@ -43,3 +28,4 @@ namespace PAL_NS_BEGIN { } PAL_NS_END
|
|||
#endif // RESOURCE_COMPILER_INVOKED
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -10,24 +10,9 @@
|
|||
#define BUILD_VERSION @BUILD_VERSION_MAJOR@,@BUILD_VERSION_MINOR@,@BUILD_VERSION_PATCH@,@BUILD_NUMBER@
|
||||
|
||||
#ifndef RESOURCE_COMPILER_INVOKED
|
||||
#include <ctmacros.hpp>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef HAVE_MAT_SHORT_NS
|
||||
#define MAT_NS_BEGIN MAT
|
||||
#define MAT_NS_END
|
||||
#define PAL_NS_BEGIN PAL
|
||||
#define PAL_NS_END
|
||||
#else
|
||||
#define MAT_NS_BEGIN Microsoft { namespace Applications { namespace Events
|
||||
#define MAT_NS_END }}
|
||||
#define MAT ::Microsoft::Applications::Events
|
||||
#define PAL_NS_BEGIN Microsoft { namespace Applications { namespace Events { namespace PlatformAbstraction
|
||||
#define PAL_NS_END }}}
|
||||
#define PAL ::Microsoft::Applications::Events::PlatformAbstraction
|
||||
#endif
|
||||
|
||||
#define MAT_v1 ::Microsoft::Applications::Telemetry
|
||||
|
||||
namespace MAT_NS_BEGIN {
|
||||
|
||||
uint64_t const Version =
|
||||
|
@ -41,5 +26,4 @@ uint64_t const Version =
|
|||
namespace PAL_NS_BEGIN { } PAL_NS_END
|
||||
|
||||
#endif // RESOURCE_COMPILER_INVOKED
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -198,26 +198,5 @@ std::vector<std::string> ConvertJObjectArrayToStdStringVector(JNIEnv* env, const
|
|||
return stringVector;
|
||||
}
|
||||
|
||||
CommonDataContexts GenerateCommonDataContextObject(JNIEnv *env,
|
||||
jstring domainName,
|
||||
jstring machineName,
|
||||
jstring userName,
|
||||
jstring userAlias,
|
||||
jobjectArray ipAddresses,
|
||||
jobjectArray languageIdentifiers,
|
||||
jobjectArray machineIds,
|
||||
jobjectArray outOfScopeIdentifiers) {
|
||||
CommonDataContexts cdc;
|
||||
cdc.DomainName = JStringToStdString(env, domainName);
|
||||
cdc.MachineName = JStringToStdString(env, machineName);
|
||||
cdc.UserName = JStringToStdString(env, userName);
|
||||
cdc.UserAlias = JStringToStdString(env, userAlias);
|
||||
cdc.IpAddresses = ConvertJObjectArrayToStdStringVector(env, ipAddresses);
|
||||
cdc.LanguageIdentifiers = ConvertJObjectArrayToStdStringVector(env, languageIdentifiers);
|
||||
cdc.MachineIds = ConvertJObjectArrayToStdStringVector(env, machineIds);
|
||||
cdc.OutOfScopeIdentifiers = ConvertJObjectArrayToStdStringVector(env, outOfScopeIdentifiers);
|
||||
return cdc;
|
||||
}
|
||||
|
||||
} MAT_NS_END
|
||||
|
||||
|
|
|
@ -40,15 +40,5 @@ namespace MAT_NS_BEGIN
|
|||
*/
|
||||
std::vector<std::string> ConvertJObjectArrayToStdStringVector(JNIEnv* env, const jobjectArray& jArray);
|
||||
|
||||
CommonDataContexts GenerateCommonDataContextObject(JNIEnv *env,
|
||||
jstring domainName,
|
||||
jstring machineName,
|
||||
jstring userName,
|
||||
jstring userAlias,
|
||||
jobjectArray ipAddresses,
|
||||
jobjectArray languageIdentifiers,
|
||||
jobjectArray machineIds,
|
||||
jobjectArray outOfScopeIdentifiers);
|
||||
|
||||
} MAT_NS_END
|
||||
|
||||
|
|
|
@ -8,6 +8,28 @@
|
|||
|
||||
using namespace MAT;
|
||||
|
||||
CommonDataContext GenerateCommonDataContextObject(JNIEnv* env,
|
||||
jstring domainName,
|
||||
jstring machineName,
|
||||
jstring userName,
|
||||
jstring userAlias,
|
||||
jobjectArray ipAddresses,
|
||||
jobjectArray languageIdentifiers,
|
||||
jobjectArray machineIds,
|
||||
jobjectArray outOfScopeIdentifiers)
|
||||
{
|
||||
CommonDataContext cdc;
|
||||
cdc.DomainName = JStringToStdString(env, domainName);
|
||||
cdc.MachineName = JStringToStdString(env, machineName);
|
||||
cdc.UserName = JStringToStdString(env, userName);
|
||||
cdc.UserAlias = JStringToStdString(env, userAlias);
|
||||
cdc.IpAddresses = ConvertJObjectArrayToStdStringVector(env, ipAddresses);
|
||||
cdc.LanguageIdentifiers = ConvertJObjectArrayToStdStringVector(env, languageIdentifiers);
|
||||
cdc.MachineIds = ConvertJObjectArrayToStdStringVector(env, machineIds);
|
||||
cdc.OutOfScopeIdentifiers = ConvertJObjectArrayToStdStringVector(env, outOfScopeIdentifiers);
|
||||
return cdc;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
std::shared_ptr<PrivacyGuard> spPrivacyGuard;
|
||||
|
@ -19,8 +41,9 @@ Java_com_microsoft_applications_events_PrivacyGuard_nativeInitializePrivacyGuard
|
|||
return false;
|
||||
}
|
||||
|
||||
auto logger = reinterpret_cast<ILogger *>(iLoggerNativePtr);
|
||||
spPrivacyGuard = std::make_shared<PrivacyGuard>(logger, nullptr);
|
||||
InitializationConfiguration config;
|
||||
config.LoggerInstance = reinterpret_cast<ILogger*>(iLoggerNativePtr);
|
||||
spPrivacyGuard = std::make_shared<PrivacyGuard>(config);
|
||||
WrapperLogManager::GetInstance()->SetDataInspector(spPrivacyGuard);
|
||||
return true;
|
||||
}
|
||||
|
@ -40,18 +63,19 @@ Java_com_microsoft_applications_events_PrivacyGuard_nativeInitializePrivacyGuard
|
|||
return false;
|
||||
}
|
||||
|
||||
auto logger = reinterpret_cast<ILogger *>(iLoggerNativePtr);
|
||||
auto cdc = std::make_unique<CommonDataContexts>(GenerateCommonDataContextObject(env,
|
||||
domainName,
|
||||
machineName,
|
||||
userName,
|
||||
userAlias,
|
||||
ipAddresses,
|
||||
languageIdentifiers,
|
||||
machineIds,
|
||||
outOfScopeIdentifiers));
|
||||
InitializationConfiguration config;
|
||||
config.CommonContext = GenerateCommonDataContextObject(env,
|
||||
domainName,
|
||||
machineName,
|
||||
userName,
|
||||
userAlias,
|
||||
ipAddresses,
|
||||
languageIdentifiers,
|
||||
machineIds,
|
||||
outOfScopeIdentifiers);
|
||||
|
||||
spPrivacyGuard = std::make_shared<PrivacyGuard>(logger, std::move(cdc));
|
||||
config.LoggerInstance = reinterpret_cast<ILogger *>(iLoggerNativePtr);
|
||||
spPrivacyGuard = std::make_shared<PrivacyGuard>(config);
|
||||
WrapperLogManager::GetInstance()->SetDataInspector(spPrivacyGuard);
|
||||
return true;
|
||||
}
|
||||
|
@ -100,17 +124,15 @@ Java_com_microsoft_applications_events_PrivacyGuard_nativeAppendCommonDataContex
|
|||
return false;
|
||||
}
|
||||
|
||||
auto cdc = std::make_unique<CommonDataContexts>(GenerateCommonDataContextObject(env,
|
||||
domainName,
|
||||
machineName,
|
||||
userName,
|
||||
userAlias,
|
||||
ipAddresses,
|
||||
languageIdentifiers,
|
||||
machineIds,
|
||||
outOfScopeIdentifiers));
|
||||
|
||||
spPrivacyGuard->AppendCommonDataContext(std::move(cdc));
|
||||
spPrivacyGuard->AppendCommonDataContext(GenerateCommonDataContextObject(env,
|
||||
domainName,
|
||||
machineName,
|
||||
userName,
|
||||
userAlias,
|
||||
ipAddresses,
|
||||
languageIdentifiers,
|
||||
machineIds,
|
||||
outOfScopeIdentifiers));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 6ae76064652d5d75eca207aa930bb8e8422cd3d1
|
||||
Subproject commit ece116cfd3f9d2929e851c84f45cb866eeb015db
|
|
@ -65,7 +65,7 @@ void EventDecoderListener::OnDebugEvent(DebugEvent &evt)
|
|||
{
|
||||
auto PrintEvent = [](const char *lbl, const DebugEvent &e)
|
||||
{
|
||||
printf("%20s: seq=%llu, ts=%llu, type=0x%08x, p1=%zu, p2=%zu\n", lbl, e.seq, e.ts, e.type, e.param1, e.param2);
|
||||
printf("%20s: seq=%llu, ts=%llu, type=0x%08x, p1=%zu, p2=%zu\n", lbl, static_cast<unsigned long long>(e.seq), static_cast<unsigned long long>(e.ts), e.type, e.param1, e.param2);
|
||||
};
|
||||
|
||||
// lock for the duration of the print, so that we don't mess up the prints
|
||||
|
|
|
@ -204,14 +204,16 @@ TEST_F(MultipleLogManagersTests, PrivacyGuardSharedWithTwoInstancesCoexist)
|
|||
{
|
||||
MockLogger mockLogger;
|
||||
auto privacyConcernLogCount = 0;
|
||||
mockLogger.m_logEventOverride = [&privacyConcernLogCount](const EventProperties& properties) {
|
||||
if (equalsIgnoreCase(properties.GetName(), PrivacyGuard::PrivacyConcernEventName))
|
||||
InitializationConfiguration config;
|
||||
config.LoggerInstance = &mockLogger;
|
||||
const auto privacyGuard = std::make_shared<PrivacyGuard>(config);
|
||||
mockLogger.m_logEventOverride = [&privacyConcernLogCount, &privacyGuard](const EventProperties& properties) {
|
||||
if (equalsIgnoreCase(properties.GetName(), privacyGuard->GetNotificationEventName()))
|
||||
{
|
||||
privacyConcernLogCount++;
|
||||
}
|
||||
};
|
||||
|
||||
const std::shared_ptr<IDataInspector> privacyGuard = std::make_shared<PrivacyGuard>(&mockLogger, nullptr);
|
||||
std::unique_ptr<ILogManager> lm1(LogManagerFactory::Create(config1));
|
||||
std::unique_ptr<ILogManager> lm2(LogManagerFactory::Create(config2));
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include <stdexcept>
|
||||
#include "ILogger.hpp"
|
||||
#include "LogManager.hpp"
|
||||
#include "IDataInspector.hpp"
|
||||
#include "PrivacyGuard.hpp"
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "ODWLogConfiguration.h"
|
||||
|
@ -18,9 +17,9 @@ using namespace MAT;
|
|||
|
||||
std::shared_ptr<PrivacyGuard> _privacyGuardPtr;
|
||||
|
||||
+(CommonDataContexts)convertToNativeCommonDataContexts:(ODWCommonDataContext *)odwCDC
|
||||
+(CommonDataContext)convertToNativeCommonDataContexts:(ODWCommonDataContext *)odwCDC
|
||||
{
|
||||
CommonDataContexts cdc;
|
||||
CommonDataContext cdc;
|
||||
if([ [odwCDC DomainName] length] != 0)
|
||||
{
|
||||
cdc.DomainName = [[odwCDC DomainName] UTF8String];
|
||||
|
@ -78,9 +77,10 @@ std::shared_ptr<PrivacyGuard> _privacyGuardPtr;
|
|||
|
||||
+(void)initializePrivacyGuard:(ILogger *)logger withODWCommonDataContext:(ODWCommonDataContext *)commonDataContextsObject
|
||||
{
|
||||
auto cdc = std::make_unique<CommonDataContexts>([ODWPrivacyGuard convertToNativeCommonDataContexts:commonDataContextsObject]);
|
||||
|
||||
_privacyGuardPtr = std::make_shared<PrivacyGuard> (logger, std::move(cdc));
|
||||
InitializationConfiguration config;
|
||||
config.LoggerInstance = logger;
|
||||
config.CommonContext = [ODWPrivacyGuard convertToNativeCommonDataContexts:commonDataContextsObject];
|
||||
_privacyGuardPtr = std::make_shared<PrivacyGuard>(config);
|
||||
LogManager::GetInstance()->SetDataInspector(_privacyGuardPtr);
|
||||
}
|
||||
|
||||
|
@ -99,9 +99,7 @@ std::shared_ptr<PrivacyGuard> _privacyGuardPtr;
|
|||
|
||||
+(void)appendCommonDataContext:(ODWCommonDataContext *) freshCommonDataContexts
|
||||
{
|
||||
auto cdc = std::make_unique<CommonDataContexts>([ODWPrivacyGuard convertToNativeCommonDataContexts:freshCommonDataContexts]);
|
||||
|
||||
_privacyGuardPtr->AppendCommonDataContext(std::move(cdc));
|
||||
_privacyGuardPtr->AppendCommonDataContext([ODWPrivacyGuard convertToNativeCommonDataContexts:freshCommonDataContexts]);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
Загрузка…
Ссылка в новой задаче