Add Java files.
This commit is contained in:
Родитель
c6d899735d
Коммит
3bf7bfe785
|
@ -0,0 +1,46 @@
|
|||
package com.microsoft.applications.events;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
public class CommonDataContext {
|
||||
/**
|
||||
* Domain Name for the current machine
|
||||
*/
|
||||
public String DomainName;
|
||||
|
||||
/**
|
||||
* Friendly Machine Name
|
||||
*/
|
||||
public String MachineName;
|
||||
|
||||
/**
|
||||
* Unique UserName such as the log-in name
|
||||
*/
|
||||
public String UserName;
|
||||
|
||||
/**
|
||||
* Unique User Alias, if different than UserName
|
||||
*/
|
||||
public String UserAlias;
|
||||
|
||||
/**
|
||||
* IP Addresses for local network ports such as IPv4, IPv6, etc.
|
||||
*/
|
||||
Vector<String> IpAddresses;
|
||||
|
||||
/**
|
||||
* Collection of Language identifiers
|
||||
*/
|
||||
Vector<String> LanguageIdentifiers;
|
||||
|
||||
/**
|
||||
* Collection of Machine ID such as Machine Name, Motherboard ID, MAC Address, etc.
|
||||
*/
|
||||
Vector<String> MachineIds;
|
||||
|
||||
/**
|
||||
* Collection of OutOfScope Identifiers such as SQM_ID, Client_ID, etc.
|
||||
*/
|
||||
Vector<String> OutOfScopeIdentifiers;
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
package com.microsoft.applications.events;
|
||||
|
||||
public enum DataConcernType {
|
||||
/**
|
||||
* DefaultValue
|
||||
*/
|
||||
None(0),
|
||||
|
||||
/**
|
||||
* Formatted text: HTML, MIME, RTF, Xml, etc.
|
||||
*/
|
||||
Content(1),
|
||||
/**
|
||||
* Country/region
|
||||
*/
|
||||
DemographicInfoCountryRegion(2),
|
||||
/**
|
||||
* The users language ID. Example: En-Us
|
||||
*/
|
||||
DemographicInfoLanguage(3),
|
||||
/**
|
||||
* Any directory or file share
|
||||
*/
|
||||
Directory(4),
|
||||
/**
|
||||
* SMTP not ending in <span>microsoft.com</span>
|
||||
*/
|
||||
ExternalEmailAddress(5),
|
||||
/**
|
||||
* Field name sounds like location data
|
||||
*/
|
||||
FieldNameImpliesLocation(6),
|
||||
/**
|
||||
* A file extension from the reportable list of extensions (ignores code files)
|
||||
*/
|
||||
FileNameOrExtension(7),
|
||||
/**
|
||||
* A URL referencing a common file-sharing site or service.
|
||||
*/
|
||||
FileSharingUrl(8),
|
||||
/**
|
||||
* EUPI. Any authenticated identifier of the same types used for DSR.
|
||||
*/
|
||||
InScopeIdentifier(9),
|
||||
/**
|
||||
* The current users EUPI for DSR
|
||||
*/
|
||||
InScopeIdentifierActiveUser(10),
|
||||
/**
|
||||
* SMTP ending with <span>microsoft.com</span>
|
||||
*/
|
||||
InternalEmailAddress(11),
|
||||
/**
|
||||
* Machine's current IP address
|
||||
*/
|
||||
IpAddress(12),
|
||||
/**
|
||||
* Data appears to specify a location in the real world
|
||||
*/
|
||||
Location(13),
|
||||
/**
|
||||
* Machine name
|
||||
*/
|
||||
MachineName(14),
|
||||
/**
|
||||
* Client Id for OXO telemetry from the registry
|
||||
*/
|
||||
OutOfScopeIdentifier(15),
|
||||
/**
|
||||
* Product key
|
||||
*/
|
||||
PIDKey(16),
|
||||
/**
|
||||
* A URL containing parameters "access_token", "password", etc.
|
||||
*/
|
||||
Security(17),
|
||||
/**
|
||||
* Any URL
|
||||
*/
|
||||
Url(18),
|
||||
/**
|
||||
* Current user's alias
|
||||
*/
|
||||
UserAlias(19),
|
||||
/**
|
||||
* User/Machine domain
|
||||
*/
|
||||
UserDomain(20),
|
||||
/**
|
||||
* Current user's name or part of it.
|
||||
*/
|
||||
UserName(21);
|
||||
|
||||
private final int m_value;
|
||||
|
||||
DataConcernType(int value) {
|
||||
m_value = value;
|
||||
}
|
||||
|
||||
int getValue() {
|
||||
return m_value;
|
||||
}
|
||||
}
|
|
@ -1375,6 +1375,11 @@ class Logger implements ILogger {
|
|||
clearNative();
|
||||
}
|
||||
|
||||
public void InitializePrivacyGuard(CommonDataContext dataContext)
|
||||
{
|
||||
PrivacyGuard.InitializePrivacyGuard(m_nativePtr, dataContext);
|
||||
}
|
||||
|
||||
public synchronized void clearNative() {
|
||||
m_nativePtr = 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,93 @@
|
|||
package com.microsoft.applications.events;
|
||||
|
||||
import com.microsoft.applications.events.CommonDataContext;
|
||||
import com.microsoft.applications.events.DataConcernType;
|
||||
import com.microsoft.applications.events.Logger;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
public class PrivacyGuard {
|
||||
|
||||
private static String[] vectorToStringArray(Vector<String> vectorToConvert)
|
||||
{
|
||||
String[] strings = new String[vectorToConvert.size()];
|
||||
int index = 0;
|
||||
for(String str : vectorToConvert)
|
||||
{
|
||||
strings[index++] = str;
|
||||
}
|
||||
|
||||
return strings;
|
||||
}
|
||||
|
||||
//Initialize PG
|
||||
private static native void nativeInitializePrivacyGuard(
|
||||
long iLoggerNativePtr,
|
||||
String domainName,
|
||||
String machineName,
|
||||
String userName,
|
||||
String userAlias,
|
||||
String[] ipAddresses,
|
||||
String[] languageIdentifiers,
|
||||
String[] machineIds,
|
||||
String[] outOfScopeIdentifiers);
|
||||
|
||||
public static void InitializePrivacyGuard(long loggerNativePtr, CommonDataContext dataContext)
|
||||
{
|
||||
nativeInitializePrivacyGuard(loggerNativePtr,
|
||||
dataContext.DomainName,
|
||||
dataContext.MachineName,
|
||||
dataContext.UserName,
|
||||
dataContext.UserAlias,
|
||||
vectorToStringArray(dataContext.IpAddresses),
|
||||
vectorToStringArray(dataContext.LanguageIdentifiers),
|
||||
vectorToStringArray(dataContext.MachineIds),
|
||||
vectorToStringArray(dataContext.OutOfScopeIdentifiers));
|
||||
|
||||
}
|
||||
|
||||
//SetEnabled
|
||||
private static native void nativeSetEnabled(boolean isEnabled);
|
||||
public static void SetEnabled(boolean isEnabled)
|
||||
{
|
||||
nativeSetEnabled(isEnabled);
|
||||
}
|
||||
|
||||
//IsEnabled
|
||||
private static native boolean nativeIsEnabled();
|
||||
public static boolean IsEnabled()
|
||||
{
|
||||
return nativeIsEnabled();
|
||||
}
|
||||
//AppendCommonDataContext
|
||||
private static native void nativeAppendCommonDataContext(
|
||||
String domainName,
|
||||
String machineName,
|
||||
String userName,
|
||||
String userAlias,
|
||||
String[] ipAddresses,
|
||||
String[] languageIdentifiers,
|
||||
String[] machineIds,
|
||||
String[] outOfScopeIdentifiers);
|
||||
|
||||
public static void AppendCommonDataContext(CommonDataContext dataContext)
|
||||
{
|
||||
nativeAppendCommonDataContext(
|
||||
dataContext.DomainName,
|
||||
dataContext.MachineName,
|
||||
dataContext.UserName,
|
||||
dataContext.UserAlias,
|
||||
vectorToStringArray(dataContext.IpAddresses),
|
||||
vectorToStringArray(dataContext.LanguageIdentifiers),
|
||||
vectorToStringArray(dataContext.MachineIds),
|
||||
vectorToStringArray(dataContext.OutOfScopeIdentifiers));
|
||||
}
|
||||
|
||||
//AddIgnoredConcern
|
||||
private static native void nativeAddIgnoredConcern(String eventName, String fieldName, int dataConcern);
|
||||
|
||||
public static void AddIgnoredConcern(String eventName, String fieldName, DataConcernType dataConcern)
|
||||
{
|
||||
nativeAddIgnoredConcern(eventName, fieldName, dataConcern.getValue());
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче