Loading core/java/android/app/admin/DevicePolicyEventLogger.java +1 −1 Original line number Diff line number Diff line Loading @@ -178,7 +178,7 @@ public final class DevicePolicyEventLogger { } /** * Retrieves the package name of the admin application from the {@link ComponentName}. * Sets the package name of the admin application from the {@link ComponentName}. */ public DevicePolicyEventLogger setAdmin(@Nullable ComponentName componentName) { mAdminPackageName = (componentName != null ? componentName.getPackageName() : null); Loading core/proto/android/stats/devicepolicy/device_policy_enums.proto +4 −2 Original line number Diff line number Diff line Loading @@ -136,11 +136,13 @@ enum EventId { SEPARATE_PROFILE_CHALLENGE_CHANGED = 110; SET_GLOBAL_SETTING = 111; PM_IS_INSTALLER_DEVICE_OWNER_OR_AFFILIATED_PROFILE_OWNER = 112; PM_UNINSTALL = 113; INSTALL_PACKAGE = 112; UNINSTALL_PACKAGE = 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; SET_NETWORK_LOGGING_ENABLED = 119; RETRIEVE_NETWORK_LOGS = 120; } services/core/java/com/android/server/pm/PackageInstallerService.java +6 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.app.Notification; import android.app.NotificationManager; import android.app.PackageDeleteObserver; import android.app.PackageInstallObserver; import android.app.admin.DevicePolicyEventLogger; import android.app.admin.DevicePolicyManagerInternal; import android.content.Context; import android.content.Intent; Loading Loading @@ -59,6 +60,7 @@ import android.os.RemoteException; import android.os.SELinux; import android.os.UserManager; import android.os.storage.StorageManager; import android.stats.devicepolicy.DevicePolicyEnums; import android.system.ErrnoException; import android.system.Os; import android.text.TextUtils; Loading Loading @@ -810,6 +812,10 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements } finally { Binder.restoreCallingIdentity(ident); } DevicePolicyEventLogger .createEvent(DevicePolicyEnums.UNINSTALL_PACKAGE) .setAdmin(callerPackageName) .write(); } else { ApplicationInfo appInfo = mPm.getApplicationInfo(callerPackageName, 0, userId); if (appInfo.targetSdkVersion >= Build.VERSION_CODES.P) { Loading services/core/java/com/android/server/pm/PackageInstallerSession.java +8 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import static com.android.server.pm.PackageInstallerService.prepareStageDir; import android.Manifest; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.admin.DevicePolicyEventLogger; import android.app.admin.DevicePolicyManagerInternal; import android.content.Context; import android.content.IIntentReceiver; Loading Loading @@ -82,6 +83,7 @@ import android.os.RevocableFileDescriptor; import android.os.SystemProperties; import android.os.UserHandle; import android.os.storage.StorageManager; import android.stats.devicepolicy.DevicePolicyEnums; import android.system.ErrnoException; import android.system.Int64Ref; import android.system.Os; Loading Loading @@ -1072,6 +1074,12 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { } private void handleCommit() { if (isInstallerDeviceOwnerOrAffiliatedProfileOwnerLocked()) { DevicePolicyEventLogger .createEvent(DevicePolicyEnums.INSTALL_PACKAGE) .setAdmin(mInstallerPackageName) .write(); } if (params.isStaged) { try { mStagingManager.commitSession(this); Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +19 −3 Original line number Diff line number Diff line Loading @@ -5912,10 +5912,13 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { delegateReceiver = resolveDelegateReceiver(DELEGATION_CERT_SELECTION, DeviceAdminReceiver.ACTION_CHOOSE_PRIVATE_KEY_ALIAS, caller.getIdentifier()); final boolean isDelegate; if (delegateReceiver != null) { intent.setComponent(delegateReceiver); isDelegate = true; } else { intent.setComponent(aliasChooser); isDelegate = false; } final long id = mInjector.binderClearCallingIdentity(); Loading @@ -5927,11 +5930,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { 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) .setAdmin(intent.getComponent()) .setBoolean(isDelegate) .write(); } finally { mInjector.binderRestoreCallingIdentity(id); Loading Loading @@ -13091,6 +13093,14 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { saveSettingsLocked(mInjector.userHandleGetCallingUserId()); setNetworkLoggingActiveInternal(enabled); final boolean isDelegate = (admin == null); DevicePolicyEventLogger .createEvent(DevicePolicyEnums.SET_NETWORK_LOGGING_ENABLED) .setAdmin(packageName) .setBoolean(isDelegate) .setInt(enabled ? 1 : 0) .write(); } } Loading Loading @@ -13222,6 +13232,12 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { || !isNetworkLoggingEnabledInternalLocked()) { return null; } final boolean isDelegate = (admin == null); DevicePolicyEventLogger .createEvent(DevicePolicyEnums.RETRIEVE_NETWORK_LOGS) .setAdmin(packageName) .setBoolean(isDelegate) .write(); final long currentTime = System.currentTimeMillis(); DevicePolicyData policyData = getUserData(UserHandle.USER_SYSTEM); Loading
core/java/android/app/admin/DevicePolicyEventLogger.java +1 −1 Original line number Diff line number Diff line Loading @@ -178,7 +178,7 @@ public final class DevicePolicyEventLogger { } /** * Retrieves the package name of the admin application from the {@link ComponentName}. * Sets the package name of the admin application from the {@link ComponentName}. */ public DevicePolicyEventLogger setAdmin(@Nullable ComponentName componentName) { mAdminPackageName = (componentName != null ? componentName.getPackageName() : null); Loading
core/proto/android/stats/devicepolicy/device_policy_enums.proto +4 −2 Original line number Diff line number Diff line Loading @@ -136,11 +136,13 @@ enum EventId { SEPARATE_PROFILE_CHALLENGE_CHANGED = 110; SET_GLOBAL_SETTING = 111; PM_IS_INSTALLER_DEVICE_OWNER_OR_AFFILIATED_PROFILE_OWNER = 112; PM_UNINSTALL = 113; INSTALL_PACKAGE = 112; UNINSTALL_PACKAGE = 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; SET_NETWORK_LOGGING_ENABLED = 119; RETRIEVE_NETWORK_LOGS = 120; }
services/core/java/com/android/server/pm/PackageInstallerService.java +6 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.app.Notification; import android.app.NotificationManager; import android.app.PackageDeleteObserver; import android.app.PackageInstallObserver; import android.app.admin.DevicePolicyEventLogger; import android.app.admin.DevicePolicyManagerInternal; import android.content.Context; import android.content.Intent; Loading Loading @@ -59,6 +60,7 @@ import android.os.RemoteException; import android.os.SELinux; import android.os.UserManager; import android.os.storage.StorageManager; import android.stats.devicepolicy.DevicePolicyEnums; import android.system.ErrnoException; import android.system.Os; import android.text.TextUtils; Loading Loading @@ -810,6 +812,10 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements } finally { Binder.restoreCallingIdentity(ident); } DevicePolicyEventLogger .createEvent(DevicePolicyEnums.UNINSTALL_PACKAGE) .setAdmin(callerPackageName) .write(); } else { ApplicationInfo appInfo = mPm.getApplicationInfo(callerPackageName, 0, userId); if (appInfo.targetSdkVersion >= Build.VERSION_CODES.P) { Loading
services/core/java/com/android/server/pm/PackageInstallerSession.java +8 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import static com.android.server.pm.PackageInstallerService.prepareStageDir; import android.Manifest; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.admin.DevicePolicyEventLogger; import android.app.admin.DevicePolicyManagerInternal; import android.content.Context; import android.content.IIntentReceiver; Loading Loading @@ -82,6 +83,7 @@ import android.os.RevocableFileDescriptor; import android.os.SystemProperties; import android.os.UserHandle; import android.os.storage.StorageManager; import android.stats.devicepolicy.DevicePolicyEnums; import android.system.ErrnoException; import android.system.Int64Ref; import android.system.Os; Loading Loading @@ -1072,6 +1074,12 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { } private void handleCommit() { if (isInstallerDeviceOwnerOrAffiliatedProfileOwnerLocked()) { DevicePolicyEventLogger .createEvent(DevicePolicyEnums.INSTALL_PACKAGE) .setAdmin(mInstallerPackageName) .write(); } if (params.isStaged) { try { mStagingManager.commitSession(this); Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +19 −3 Original line number Diff line number Diff line Loading @@ -5912,10 +5912,13 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { delegateReceiver = resolveDelegateReceiver(DELEGATION_CERT_SELECTION, DeviceAdminReceiver.ACTION_CHOOSE_PRIVATE_KEY_ALIAS, caller.getIdentifier()); final boolean isDelegate; if (delegateReceiver != null) { intent.setComponent(delegateReceiver); isDelegate = true; } else { intent.setComponent(aliasChooser); isDelegate = false; } final long id = mInjector.binderClearCallingIdentity(); Loading @@ -5927,11 +5930,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { 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) .setAdmin(intent.getComponent()) .setBoolean(isDelegate) .write(); } finally { mInjector.binderRestoreCallingIdentity(id); Loading Loading @@ -13091,6 +13093,14 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { saveSettingsLocked(mInjector.userHandleGetCallingUserId()); setNetworkLoggingActiveInternal(enabled); final boolean isDelegate = (admin == null); DevicePolicyEventLogger .createEvent(DevicePolicyEnums.SET_NETWORK_LOGGING_ENABLED) .setAdmin(packageName) .setBoolean(isDelegate) .setInt(enabled ? 1 : 0) .write(); } } Loading Loading @@ -13222,6 +13232,12 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { || !isNetworkLoggingEnabledInternalLocked()) { return null; } final boolean isDelegate = (admin == null); DevicePolicyEventLogger .createEvent(DevicePolicyEnums.RETRIEVE_NETWORK_LOGS) .setAdmin(packageName) .setBoolean(isDelegate) .write(); final long currentTime = System.currentTimeMillis(); DevicePolicyData policyData = getUserData(UserHandle.USER_SYSTEM);