Merge changes I0863b40a,I4810f5e3
* changes:
Add metrics for DevicePolicyManagerService methods (Part 2)
Add additional event ids for DevicePolicyEvent atom.
diff --git a/core/proto/android/stats/devicepolicy/device_policy_enums.proto b/core/proto/android/stats/devicepolicy/device_policy_enums.proto
index c7a6b68..82460ec 100644
--- a/core/proto/android/stats/devicepolicy/device_policy_enums.proto
+++ b/core/proto/android/stats/devicepolicy/device_policy_enums.proto
@@ -141,4 +141,7 @@
PM_UNINSTALL = 113;
WIFI_SERVICE_ADD_NETWORK_SUGGESTIONS = 114;
WIFI_SERVICE_ADD_OR_UPDATE_NETWORK = 115;
+ QUERY_SUMMARY_FOR_DEVICE = 116;
+ REMOVE_CROSS_PROFILE_WIDGET_PROVIDER = 117;
+ ESTABLISH_VPN = 118;
}
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 7186cdf..fc5ed2a 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -478,7 +478,8 @@
/**
* Strings logged with {@link
- * com.android.internal.logging.nano.MetricsProto.MetricsEvent#PROVISIONING_ENTRY_POINT_ADB}.
+ * com.android.internal.logging.nano.MetricsProto.MetricsEvent#PROVISIONING_ENTRY_POINT_ADB}
+ * and {@link DevicePolicyEnums#PROVISIONING_ENTRY_POINT_ADB}.
*/
private static final String LOG_TAG_PROFILE_OWNER = "profile-owner";
private static final String LOG_TAG_DEVICE_OWNER = "device-owner";
@@ -4328,6 +4329,11 @@
}
}
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.ADD_CROSS_PROFILE_WIDGET_PROVIDER)
+ .setAdmin(admin)
+ .write();
+
if (changedProviders != null) {
mLocalService.notifyCrossProfileProvidersChanged(userId, changedProviders);
return true;
@@ -4355,6 +4361,11 @@
}
}
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.REMOVE_CROSS_PROFILE_WIDGET_PROVIDER)
+ .setAdmin(admin)
+ .write();
+
if (changedProviders != null) {
mLocalService.notifyCrossProfileProvidersChanged(userId, changedProviders);
return true;
@@ -5491,6 +5502,12 @@
final long id = mInjector.binderClearCallingIdentity();
try {
mCertificateMonitor.uninstallCaCerts(UserHandle.of(userId), aliases);
+ final boolean isDelegate = (admin == null);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.UNINSTALL_CA_CERTS)
+ .setAdmin(callerPackage)
+ .setBoolean(isDelegate)
+ .write();
} finally {
mInjector.binderRestoreCallingIdentity(id);
}
@@ -5556,7 +5573,14 @@
final KeyChainConnection keyChainConnection = KeyChain.bindAsUser(mContext, userHandle);
try {
IKeyChainService keyChain = keyChainConnection.getService();
- return keyChain.removeKeyPair(alias);
+ final boolean result = keyChain.removeKeyPair(alias);
+ final boolean isDelegate = (who == null);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.REMOVE_KEY_PAIR)
+ .setAdmin(callerPackage)
+ .setBoolean(isDelegate)
+ .write();
+ return result;
} catch (RemoteException e) {
Log.e(LOG_TAG, "Removing keypair", e);
} finally {
@@ -5740,6 +5764,14 @@
return false;
}
}
+ final boolean isDelegate = (who == null);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.GENERATE_KEY_PAIR)
+ .setAdmin(callerPackage)
+ .setBoolean(isDelegate)
+ .setInt(idAttestationFlags)
+ .setStrings(algorithm)
+ .write();
return true;
}
} catch (RemoteException e) {
@@ -5768,6 +5800,12 @@
return false;
}
keyChain.setUserSelectable(alias, isUserSelectable);
+ final boolean isDelegate = (who == null);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_KEY_PAIR_CERTIFICATE)
+ .setAdmin(callerPackage)
+ .setBoolean(isDelegate)
+ .write();
return true;
} catch (InterruptedException e) {
Log.w(LOG_TAG, "Interrupted while setting keypair certificate", e);
@@ -5830,6 +5868,12 @@
sendPrivateKeyAliasResponse(chosenAlias, response);
}
}, null, Activity.RESULT_OK, null, null);
+ final String adminPackageName =
+ (aliasChooser != null ? aliasChooser.getPackageName() : null);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.CHOOSE_PRIVATE_KEY_ALIAS)
+ .setAdmin(adminPackageName)
+ .write();
} finally {
mInjector.binderRestoreCallingIdentity(id);
}
@@ -6219,6 +6263,11 @@
public void setCertInstallerPackage(ComponentName who, String installerPackage)
throws SecurityException {
setDelegatedScopePreO(who, installerPackage, DELEGATION_CERT_INSTALL);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_CERT_INSTALLER_PACKAGE)
+ .setAdmin(who)
+ .setStrings(installerPackage)
+ .write();
}
@Override
@@ -6250,6 +6299,13 @@
if (!connectivityManager.setAlwaysOnVpnPackageForUser(userId, vpnPackage, lockdown)) {
throw new UnsupportedOperationException();
}
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_ALWAYS_ON_VPN_PACKAGE)
+ .setAdmin(admin)
+ .setStrings(vpnPackage)
+ .setBoolean(lockdown)
+ .setInt(/* number of vpn packages */ 0)
+ .write();
} finally {
mInjector.binderRestoreCallingIdentity(token);
}
@@ -6965,6 +7021,11 @@
updateScreenCaptureDisabled(userHandle, disabled);
}
}
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_SCREEN_CAPTURE_DISABLED)
+ .setAdmin(who)
+ .setBoolean(disabled)
+ .write();
}
/**
@@ -7036,6 +7097,11 @@
mInjector.binderRestoreCallingIdentity(ident);
}
}
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_AUTO_TIME_REQUIRED)
+ .setAdmin(who)
+ .setBoolean(required)
+ .write();
}
/**
@@ -7167,6 +7233,10 @@
DevicePolicyManager.NOTIFICATION_BUGREPORT_STARTED), UserHandle.ALL);
mHandler.postDelayed(mRemoteBugreportTimeoutRunnable,
RemoteBugreportUtils.REMOTE_BUGREPORT_TIMEOUT_MILLIS);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.REQUEST_BUGREPORT)
+ .setAdmin(who)
+ .write();
return true;
} catch (RemoteException re) {
// should never happen
@@ -7377,6 +7447,11 @@
}
// Tell the user manager that the restrictions have changed.
pushUserRestrictions(userHandle);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_CAMERA_DISABLED)
+ .setAdmin(who)
+ .setBoolean(disabled)
+ .write();
}
/**
@@ -7528,6 +7603,13 @@
// Notify package manager.
mInjector.getPackageManagerInternal().setKeepUninstalledPackages(packageList);
}
+ final boolean isDelegate = (who == null);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_KEEP_UNINSTALLED_PACKAGES)
+ .setAdmin(callerPackage)
+ .setBoolean(isDelegate)
+ .setStrings(packageList.toArray(new String[0]))
+ .write();
}
@Override
@@ -7585,6 +7667,11 @@
if (isAdb()) {
// Log device owner provisioning was started using adb.
MetricsLogger.action(mContext, PROVISIONING_ENTRY_POINT_ADB, LOG_TAG_DEVICE_OWNER);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.PROVISIONING_ENTRY_POINT_ADB)
+ .setAdmin(admin)
+ .setStrings(LOG_TAG_DEVICE_OWNER)
+ .write();
}
mOwners.setDeviceOwner(admin, ownerName, userId);
@@ -7854,6 +7941,11 @@
if (isAdb()) {
// Log profile owner provisioning was started using adb.
MetricsLogger.action(mContext, PROVISIONING_ENTRY_POINT_ADB, LOG_TAG_PROFILE_OWNER);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.PROVISIONING_ENTRY_POINT_ADB)
+ .setAdmin(who)
+ .setStrings(LOG_TAG_PROFILE_OWNER)
+ .write();
}
mOwners.setProfileOwner(who, ownerName, userHandle);
@@ -7941,6 +8033,10 @@
mInjector.binderRestoreCallingIdentity(token);
}
}
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_DEVICE_OWNER_LOCK_SCREEN_INFO)
+ .setAdmin(who)
+ .write();
}
@Override
@@ -8127,6 +8223,10 @@
final long id = mInjector.binderClearCallingIdentity();
try {
mUserManager.setUserName(userId, profileName);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_PROFILE_NAME)
+ .setAdmin(who)
+ .write();
} finally {
mInjector.binderRestoreCallingIdentity(id);
}
@@ -8601,6 +8701,13 @@
mInjector.binderRestoreCallingIdentity(id);
}
}
+ final String activityPackage =
+ (activity != null ? activity.getPackageName() : null);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.ADD_PERSISTENT_PREFERRED_ACTIVITY)
+ .setAdmin(who)
+ .setStrings(activityPackage, getIntentFilterActions(filter))
+ .write();
}
@Override
@@ -8664,6 +8771,13 @@
final long id = mInjector.binderClearCallingIdentity();
try {
mUserManager.setApplicationRestrictions(packageName, settings, userHandle);
+ final boolean isDelegate = (who == null);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_APPLICATION_RESTRICTIONS)
+ .setAdmin(callerPackage)
+ .setBoolean(isDelegate)
+ .setStrings(packageName)
+ .write();
} finally {
mInjector.binderRestoreCallingIdentity(id);
}
@@ -8795,6 +8909,24 @@
mInjector.binderRestoreCallingIdentity(id);
}
}
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.ADD_CROSS_PROFILE_INTENT_FILTER)
+ .setAdmin(who)
+ .setStrings(getIntentFilterActions(filter))
+ .setInt(flags)
+ .write();
+ }
+
+ private static String[] getIntentFilterActions(IntentFilter filter) {
+ if (filter == null) {
+ return null;
+ }
+ final int actionsCount = filter.countActions();
+ final String[] actions = new String[actionsCount];
+ for (int i = 0; i < actionsCount; i++) {
+ actions[i] = filter.getAction(i);
+ }
+ return actions;
}
@Override
@@ -8914,6 +9046,13 @@
admin.permittedAccessiblityServices = packageList;
saveSettingsLocked(UserHandle.getCallingUserId());
}
+ final String[] packageArray =
+ packageList != null ? ((List<String>) packageList).toArray(new String[0]) : null;
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_PERMITTED_ACCESSIBILITY_SERVICES)
+ .setAdmin(who)
+ .setStrings(packageArray)
+ .write();
return true;
}
@@ -9088,6 +9227,13 @@
admin.permittedInputMethods = packageList;
saveSettingsLocked(callingUserId);
}
+ final String[] packageArray =
+ packageList != null ? ((List<String>) packageList).toArray(new String[0]) : null;
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_PERMITTED_INPUT_METHODS)
+ .setAdmin(who)
+ .setStrings(packageArray)
+ .write();
return true;
}
@@ -9628,6 +9774,7 @@
public String[] setPackagesSuspended(ComponentName who, String callerPackage,
String[] packageNames, boolean suspended) {
int callingUserId = UserHandle.getCallingUserId();
+ String[] result = null;
synchronized (getLockObject()) {
// Ensure the caller is a DO/PO or a package access delegate.
enforceCanManageScope(who, callerPackage, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER,
@@ -9635,7 +9782,8 @@
long id = mInjector.binderClearCallingIdentity();
try {
- return mIPackageManager.setPackagesSuspendedAsUser(packageNames, suspended,
+ result = mIPackageManager
+ .setPackagesSuspendedAsUser(packageNames, suspended,
null, null, null, PLATFORM_PACKAGE_NAME, callingUserId);
} catch (RemoteException re) {
// Shouldn't happen.
@@ -9643,8 +9791,18 @@
} finally {
mInjector.binderRestoreCallingIdentity(id);
}
- return packageNames;
}
+ final boolean isDelegate = (who == null);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_PACKAGES_SUSPENDED)
+ .setAdmin(callerPackage)
+ .setBoolean(isDelegate)
+ .setStrings(packageNames)
+ .write();
+ if (result != null) {
+ return result;
+ }
+ return packageNames;
}
@Override
@@ -9781,6 +9939,7 @@
public boolean setApplicationHidden(ComponentName who, String callerPackage, String packageName,
boolean hidden) {
int callingUserId = UserHandle.getCallingUserId();
+ boolean result = false;
synchronized (getLockObject()) {
// Ensure the caller is a DO/PO or a package access delegate.
enforceCanManageScope(who, callerPackage, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER,
@@ -9788,16 +9947,23 @@
long id = mInjector.binderClearCallingIdentity();
try {
- return mIPackageManager.setApplicationHiddenSettingAsUser(
- packageName, hidden, callingUserId);
+ result = mIPackageManager
+ .setApplicationHiddenSettingAsUser(packageName, hidden, callingUserId);
} catch (RemoteException re) {
// shouldn't happen
Slog.e(LOG_TAG, "Failed to setApplicationHiddenSetting", re);
} finally {
mInjector.binderRestoreCallingIdentity(id);
}
- return false;
}
+ final boolean isDelegate = (who == null);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_APPLICATION_HIDDEN)
+ .setAdmin(callerPackage)
+ .setBoolean(isDelegate)
+ .setStrings(packageName, hidden ? "hidden" : "not_hidden")
+ .write();
+ return result;
}
@Override
@@ -9862,10 +10028,18 @@
mInjector.binderRestoreCallingIdentity(id);
}
}
+ final boolean isDelegate = (who == null);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.ENABLE_SYSTEM_APP)
+ .setAdmin(callerPackage)
+ .setBoolean(isDelegate)
+ .setStrings(packageName)
+ .write();
}
@Override
public int enableSystemAppWithIntent(ComponentName who, String callerPackage, Intent intent) {
+ int numberOfAppsInstalled = 0;
synchronized (getLockObject()) {
// Ensure the caller is a DO/PO or an enable system app delegate.
enforceCanManageScope(who, callerPackage, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER,
@@ -9887,7 +10061,6 @@
if (VERBOSE_LOG) {
Slog.d(LOG_TAG, "Enabling system activities: " + activitiesToEnable);
}
- int numberOfAppsInstalled = 0;
if (activitiesToEnable != null) {
for (ResolveInfo info : activitiesToEnable) {
if (info.activityInfo != null) {
@@ -9903,7 +10076,6 @@
}
}
}
- return numberOfAppsInstalled;
} catch (RemoteException e) {
// shouldn't happen
Slog.wtf(LOG_TAG, "Failed to resolve intent for: " + intent);
@@ -9912,6 +10084,14 @@
mInjector.binderRestoreCallingIdentity(id);
}
}
+ final boolean isDelegate = (who == null);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.ENABLE_SYSTEM_APP_WITH_INTENT)
+ .setAdmin(callerPackage)
+ .setBoolean(isDelegate)
+ .setStrings(intent.getAction())
+ .write();
+ return numberOfAppsInstalled;
}
private boolean isSystemApp(IPackageManager pm, String packageName, int userId)
@@ -9928,6 +10108,7 @@
@Override
public boolean installExistingPackage(ComponentName who, String callerPackage,
String packageName) {
+ boolean result;
synchronized (getLockObject()) {
// Ensure the caller is a PO or an install existing package delegate
enforceCanManageScope(who, callerPackage, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER,
@@ -9946,7 +10127,8 @@
}
// Install the package.
- return mIPackageManager.installExistingPackageAsUser(packageName, callingUserId,
+ result = mIPackageManager
+ .installExistingPackageAsUser(packageName, callingUserId,
0 /*installFlags*/, PackageManager.INSTALL_REASON_POLICY)
== PackageManager.INSTALL_SUCCEEDED;
} catch (RemoteException re) {
@@ -9956,6 +10138,16 @@
mInjector.binderRestoreCallingIdentity(id);
}
}
+ if (result) {
+ final boolean isDelegate = (who == null);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.INSTALL_EXISTING_PACKAGE)
+ .setAdmin(callerPackage)
+ .setBoolean(isDelegate)
+ .setStrings(packageName)
+ .write();
+ }
+ return result;
}
@Override
@@ -10019,6 +10211,13 @@
mInjector.binderRestoreCallingIdentity(id);
}
}
+ final boolean isDelegate = (who == null);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_UNINSTALL_BLOCKED)
+ .setAdmin(callerPackage)
+ .setBoolean(isDelegate)
+ .setStrings(packageName)
+ .write();
}
@Override
@@ -10060,6 +10259,11 @@
saveSettingsLocked(mInjector.userHandleGetCallingUserId());
}
}
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_CROSS_PROFILE_CALLER_ID_DISABLED)
+ .setAdmin(who)
+ .setBoolean(disabled)
+ .write();
}
@Override
@@ -10098,6 +10302,11 @@
saveSettingsLocked(mInjector.userHandleGetCallingUserId());
}
}
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_CROSS_PROFILE_CONTACTS_SEARCH_DISABLED)
+ .setAdmin(who)
+ .setBoolean(disabled)
+ .write();
}
@Override
@@ -10197,6 +10406,11 @@
saveSettingsLocked(UserHandle.getCallingUserId());
}
}
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_BLUETOOTH_CONTACT_SHARING_DISABLED)
+ .setAdmin(who)
+ .setBoolean(disabled)
+ .write();
}
@Override
@@ -10356,6 +10570,12 @@
} else {
sendAdminCommandLocked(admin, DeviceAdminReceiver.ACTION_LOCK_TASK_EXITING);
}
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_LOCKTASK_MODE_ENABLED)
+ .setAdmin(admin.info.getPackageName())
+ .setBoolean(isEnabled)
+ .setStrings(pkg)
+ .write();
}
}
}
@@ -10524,6 +10744,11 @@
synchronized (getLockObject()) {
getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
setUserRestriction(who, UserManager.DISALLOW_UNMUTE_DEVICE, on);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_MASTER_VOLUME_MUTED)
+ .setAdmin(who)
+ .setBoolean(on)
+ .write();
}
}
@@ -10553,6 +10778,10 @@
mInjector.binderRestoreCallingIdentity(id);
}
}
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_USER_ICON)
+ .setAdmin(who)
+ .write();
}
@Override
@@ -10578,6 +10807,11 @@
}
mLockPatternUtils.setLockScreenDisabled(disabled, userId);
mInjector.getIWindowManager().dismissKeyguard(null /* callback */, null /* message */);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_KEYGUARD_DISABLED)
+ .setAdmin(who)
+ .setBoolean(disabled)
+ .write();
} catch (RemoteException e) {
// Same process, does not happen.
} finally {
@@ -10616,6 +10850,11 @@
saveSettingsLocked(userId);
}
}
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_STATUS_BAR_DISABLED)
+ .setAdmin(who)
+ .setBoolean(disabled)
+ .write();
return true;
}
@@ -11036,6 +11275,11 @@
mContext.sendBroadcastAsUser(
new Intent(DevicePolicyManager.ACTION_SYSTEM_UPDATE_POLICY_CHANGED),
UserHandle.SYSTEM);
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_SYSTEM_UPDATE_POLICY)
+ .setAdmin(who)
+ .setInt(policy != null ? policy.getPolicyType() : 0)
+ .write();
}
@Override
@@ -11588,7 +11832,12 @@
if (wifiInfo == null) {
return null;
}
- return wifiInfo.hasRealMacAddress() ? wifiInfo.getMacAddress() : null;
+ final String result = wifiInfo.hasRealMacAddress() ? wifiInfo.getMacAddress() : null;
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.GET_WIFI_MAC_ADDRESS)
+ .setAdmin(admin)
+ .write();
+ return result;
} finally {
mInjector.binderRestoreCallingIdentity(ident);
}
@@ -11634,6 +11883,10 @@
if (mTelephonyManager.getCallState() != TelephonyManager.CALL_STATE_IDLE) {
throw new IllegalStateException("Cannot be called with ongoing call on the device");
}
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.REBOOT)
+ .setAdmin(admin)
+ .write();
mInjector.powerManagerReboot(PowerManager.REBOOT_REQUESTED_BY_DEVICE_OWNER);
} finally {
mInjector.binderRestoreCallingIdentity(ident);
@@ -11655,6 +11908,10 @@
saveSettingsLocked(userHandle);
}
}
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_SHORT_SUPPORT_MESSAGE)
+ .setAdmin(who)
+ .write();
}
@Override
@@ -11685,6 +11942,10 @@
saveSettingsLocked(userHandle);
}
}
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_LONG_SUPPORT_MESSAGE)
+ .setAdmin(who)
+ .write();
}
@Override
@@ -11750,6 +12011,10 @@
admin.organizationColor = color;
saveSettingsLocked(userHandle);
}
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.SET_ORGANIZATION_COLOR)
+ .setAdmin(who)
+ .write();
}
@Override
@@ -13153,6 +13418,7 @@
}
final long id = mInjector.binderClearCallingIdentity();
+ String ownerType = null;
try {
synchronized (getLockObject()) {
/*
@@ -13173,6 +13439,7 @@
bundle = new PersistableBundle();
}
if (isProfileOwner(admin, callingUserId)) {
+ ownerType = ADMIN_TYPE_PROFILE_OWNER;
prepareTransfer(admin, target, bundle, callingUserId,
ADMIN_TYPE_PROFILE_OWNER);
transferProfileOwnershipLocked(admin, target, callingUserId);
@@ -13183,6 +13450,7 @@
notifyAffiliatedProfileTransferOwnershipComplete(callingUserId);
}
} else if (isDeviceOwner(admin, callingUserId)) {
+ ownerType = ADMIN_TYPE_DEVICE_OWNER;
prepareTransfer(admin, target, bundle, callingUserId,
ADMIN_TYPE_DEVICE_OWNER);
transferDeviceOwnershipLocked(admin, target, callingUserId);
@@ -13194,6 +13462,11 @@
} finally {
mInjector.binderRestoreCallingIdentity(id);
}
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.TRANSFER_OWNERSHIP)
+ .setAdmin(admin)
+ .setStrings(target.getPackageName(), ownerType)
+ .write();
}
private void prepareTransfer(ComponentName admin, ComponentName target,
@@ -13669,6 +13942,11 @@
mContext, updateFileDescriptor, callback, mInjector, mConstants);
}
updateInstaller.startInstallUpdate();
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.INSTALL_SYSTEM_UPDATE)
+ .setAdmin(admin)
+ .setBoolean(isDeviceAB())
+ .write();
} finally {
mInjector.binderRestoreCallingIdentity(id);
}
@@ -13694,6 +13972,11 @@
saveSettingsLocked(mInjector.userHandleGetCallingUserId());
}
}
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.ADD_CROSS_PROFILE_CALENDAR_PACKAGE)
+ .setAdmin(who)
+ .setStrings(packageName)
+ .write();
}
@Override
@@ -13713,6 +13996,13 @@
saveSettingsLocked(mInjector.userHandleGetCallingUserId());
}
}
+ if (isRemoved) {
+ DevicePolicyEventLogger
+ .createEvent(DevicePolicyEnums.REMOVE_CROSS_PROFILE_CALENDAR_PACKAGE)
+ .setAdmin(who)
+ .setStrings(packageName)
+ .write();
+ }
return isRemoved;
}