Loading api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -5970,6 +5970,8 @@ package android.app.admin { method public void onReceive(android.content.Context, android.content.Intent); method public void onSecurityLogsAvailable(android.content.Context, android.content.Intent); method public void onSystemUpdatePending(android.content.Context, android.content.Intent, long); method public void onUserAdded(android.content.Context, android.content.Intent, android.os.UserHandle); method public void onUserRemoved(android.content.Context, android.content.Intent, android.os.UserHandle); field public static final java.lang.String ACTION_DEVICE_ADMIN_DISABLED = "android.app.action.DEVICE_ADMIN_DISABLED"; field public static final java.lang.String ACTION_DEVICE_ADMIN_DISABLE_REQUESTED = "android.app.action.DEVICE_ADMIN_DISABLE_REQUESTED"; field public static final java.lang.String ACTION_DEVICE_ADMIN_ENABLED = "android.app.action.DEVICE_ADMIN_ENABLED"; api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -6142,6 +6142,8 @@ package android.app.admin { method public void onReceive(android.content.Context, android.content.Intent); method public void onSecurityLogsAvailable(android.content.Context, android.content.Intent); method public void onSystemUpdatePending(android.content.Context, android.content.Intent, long); method public void onUserAdded(android.content.Context, android.content.Intent, android.os.UserHandle); method public void onUserRemoved(android.content.Context, android.content.Intent, android.os.UserHandle); field public static final java.lang.String ACTION_DEVICE_ADMIN_DISABLED = "android.app.action.DEVICE_ADMIN_DISABLED"; field public static final java.lang.String ACTION_DEVICE_ADMIN_DISABLE_REQUESTED = "android.app.action.DEVICE_ADMIN_DISABLE_REQUESTED"; field public static final java.lang.String ACTION_DEVICE_ADMIN_ENABLED = "android.app.action.DEVICE_ADMIN_ENABLED"; api/test-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -5987,6 +5987,8 @@ package android.app.admin { method public void onReceive(android.content.Context, android.content.Intent); method public void onSecurityLogsAvailable(android.content.Context, android.content.Intent); method public void onSystemUpdatePending(android.content.Context, android.content.Intent, long); method public void onUserAdded(android.content.Context, android.content.Intent, android.os.UserHandle); method public void onUserRemoved(android.content.Context, android.content.Intent, android.os.UserHandle); field public static final java.lang.String ACTION_DEVICE_ADMIN_DISABLED = "android.app.action.DEVICE_ADMIN_DISABLED"; field public static final java.lang.String ACTION_DEVICE_ADMIN_DISABLE_REQUESTED = "android.app.action.DEVICE_ADMIN_DISABLE_REQUESTED"; field public static final java.lang.String ACTION_DEVICE_ADMIN_ENABLED = "android.app.action.DEVICE_ADMIN_ENABLED"; core/java/android/app/admin/DeviceAdminReceiver.java +47 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.os.UserHandle; import android.security.KeyChain; import java.lang.annotation.Retention; Loading Loading @@ -305,6 +306,24 @@ public class DeviceAdminReceiver extends BroadcastReceiver { public static final String EXTRA_NETWORK_LOGS_COUNT = "android.app.extra.EXTRA_NETWORK_LOGS_COUNT"; /** * Broadcast action: notify the device owner that a user or profile has been added. * Carries an extra {@link Intent#EXTRA_USER} that has the {@link UserHandle} of * the new user. * @hide */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_USER_ADDED = "android.app.action.USER_ADDED"; /** * Broadcast action: notify the device owner that a user or profile has been removed. * Carries an extra {@link Intent#EXTRA_USER} that has the {@link UserHandle} of * the new user. * @hide */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_USER_REMOVED = "android.app.action.USER_REMOVED"; /** * A string containing the SHA-256 hash of the bugreport file. * Loading Loading @@ -690,6 +709,30 @@ public class DeviceAdminReceiver extends BroadcastReceiver { int networkLogsCount) { } /** * Called when a user or profile is created. * * <p>This callback is only applicable to device owners. * * @param context The running context as per {@link #onReceive}. * @param intent The received intent as per {@link #onReceive}. * @param newUser The {@link UserHandle} of the user that has just been added. */ public void onUserAdded(Context context, Intent intent, UserHandle newUser) { } /** * Called when a user or profile is removed. * * <p>This callback is only applicable to device owners. * * @param context The running context as per {@link #onReceive}. * @param intent The received intent as per {@link #onReceive}. * @param removedUser The {@link UserHandle} of the user that has just been removed. */ public void onUserRemoved(Context context, Intent intent, UserHandle removedUser) { } /** * Intercept standard device administrator broadcasts. Implementations * should not override this method; it is better to implement the Loading Loading @@ -748,6 +791,10 @@ public class DeviceAdminReceiver extends BroadcastReceiver { long batchToken = intent.getLongExtra(EXTRA_NETWORK_LOGS_TOKEN, -1); int networkLogsCount = intent.getIntExtra(EXTRA_NETWORK_LOGS_COUNT, 0); onNetworkLogsAvailable(context, intent, batchToken, networkLogsCount); } else if (ACTION_USER_ADDED.equals(action)) { onUserAdded(context, intent, intent.getParcelableExtra(Intent.EXTRA_USER)); } else if (ACTION_USER_REMOVED.equals(action)) { onUserRemoved(context, intent, intent.getParcelableExtra(Intent.EXTRA_USER)); } } } services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +13 −0 Original line number Diff line number Diff line Loading @@ -544,8 +544,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { new MonitoringCertNotificationTask().execute(userId); } if (Intent.ACTION_USER_ADDED.equals(action)) { sendUserAddedOrRemovedCommand(DeviceAdminReceiver.ACTION_USER_ADDED, userHandle); disableDeviceOwnerManagedSingleUserFeaturesIfNeeded(); } else if (Intent.ACTION_USER_REMOVED.equals(action)) { sendUserAddedOrRemovedCommand(DeviceAdminReceiver.ACTION_USER_REMOVED, userHandle); disableDeviceOwnerManagedSingleUserFeaturesIfNeeded(); removeUserData(userHandle); } else if (Intent.ACTION_USER_STARTED.equals(action)) { Loading @@ -568,6 +570,17 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { clearWipeProfileNotification(); } } private void sendUserAddedOrRemovedCommand(String action, int userHandle) { synchronized (DevicePolicyManagerService.this) { ActiveAdmin deviceOwner = getDeviceOwnerAdminLocked(); if (deviceOwner != null) { Bundle extras = new Bundle(); extras.putParcelable(Intent.EXTRA_USER, UserHandle.of(userHandle)); sendAdminCommandLocked(deviceOwner, action, extras, null); } } } }; static class ActiveAdmin { Loading Loading
api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -5970,6 +5970,8 @@ package android.app.admin { method public void onReceive(android.content.Context, android.content.Intent); method public void onSecurityLogsAvailable(android.content.Context, android.content.Intent); method public void onSystemUpdatePending(android.content.Context, android.content.Intent, long); method public void onUserAdded(android.content.Context, android.content.Intent, android.os.UserHandle); method public void onUserRemoved(android.content.Context, android.content.Intent, android.os.UserHandle); field public static final java.lang.String ACTION_DEVICE_ADMIN_DISABLED = "android.app.action.DEVICE_ADMIN_DISABLED"; field public static final java.lang.String ACTION_DEVICE_ADMIN_DISABLE_REQUESTED = "android.app.action.DEVICE_ADMIN_DISABLE_REQUESTED"; field public static final java.lang.String ACTION_DEVICE_ADMIN_ENABLED = "android.app.action.DEVICE_ADMIN_ENABLED";
api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -6142,6 +6142,8 @@ package android.app.admin { method public void onReceive(android.content.Context, android.content.Intent); method public void onSecurityLogsAvailable(android.content.Context, android.content.Intent); method public void onSystemUpdatePending(android.content.Context, android.content.Intent, long); method public void onUserAdded(android.content.Context, android.content.Intent, android.os.UserHandle); method public void onUserRemoved(android.content.Context, android.content.Intent, android.os.UserHandle); field public static final java.lang.String ACTION_DEVICE_ADMIN_DISABLED = "android.app.action.DEVICE_ADMIN_DISABLED"; field public static final java.lang.String ACTION_DEVICE_ADMIN_DISABLE_REQUESTED = "android.app.action.DEVICE_ADMIN_DISABLE_REQUESTED"; field public static final java.lang.String ACTION_DEVICE_ADMIN_ENABLED = "android.app.action.DEVICE_ADMIN_ENABLED";
api/test-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -5987,6 +5987,8 @@ package android.app.admin { method public void onReceive(android.content.Context, android.content.Intent); method public void onSecurityLogsAvailable(android.content.Context, android.content.Intent); method public void onSystemUpdatePending(android.content.Context, android.content.Intent, long); method public void onUserAdded(android.content.Context, android.content.Intent, android.os.UserHandle); method public void onUserRemoved(android.content.Context, android.content.Intent, android.os.UserHandle); field public static final java.lang.String ACTION_DEVICE_ADMIN_DISABLED = "android.app.action.DEVICE_ADMIN_DISABLED"; field public static final java.lang.String ACTION_DEVICE_ADMIN_DISABLE_REQUESTED = "android.app.action.DEVICE_ADMIN_DISABLE_REQUESTED"; field public static final java.lang.String ACTION_DEVICE_ADMIN_ENABLED = "android.app.action.DEVICE_ADMIN_ENABLED";
core/java/android/app/admin/DeviceAdminReceiver.java +47 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.os.UserHandle; import android.security.KeyChain; import java.lang.annotation.Retention; Loading Loading @@ -305,6 +306,24 @@ public class DeviceAdminReceiver extends BroadcastReceiver { public static final String EXTRA_NETWORK_LOGS_COUNT = "android.app.extra.EXTRA_NETWORK_LOGS_COUNT"; /** * Broadcast action: notify the device owner that a user or profile has been added. * Carries an extra {@link Intent#EXTRA_USER} that has the {@link UserHandle} of * the new user. * @hide */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_USER_ADDED = "android.app.action.USER_ADDED"; /** * Broadcast action: notify the device owner that a user or profile has been removed. * Carries an extra {@link Intent#EXTRA_USER} that has the {@link UserHandle} of * the new user. * @hide */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_USER_REMOVED = "android.app.action.USER_REMOVED"; /** * A string containing the SHA-256 hash of the bugreport file. * Loading Loading @@ -690,6 +709,30 @@ public class DeviceAdminReceiver extends BroadcastReceiver { int networkLogsCount) { } /** * Called when a user or profile is created. * * <p>This callback is only applicable to device owners. * * @param context The running context as per {@link #onReceive}. * @param intent The received intent as per {@link #onReceive}. * @param newUser The {@link UserHandle} of the user that has just been added. */ public void onUserAdded(Context context, Intent intent, UserHandle newUser) { } /** * Called when a user or profile is removed. * * <p>This callback is only applicable to device owners. * * @param context The running context as per {@link #onReceive}. * @param intent The received intent as per {@link #onReceive}. * @param removedUser The {@link UserHandle} of the user that has just been removed. */ public void onUserRemoved(Context context, Intent intent, UserHandle removedUser) { } /** * Intercept standard device administrator broadcasts. Implementations * should not override this method; it is better to implement the Loading Loading @@ -748,6 +791,10 @@ public class DeviceAdminReceiver extends BroadcastReceiver { long batchToken = intent.getLongExtra(EXTRA_NETWORK_LOGS_TOKEN, -1); int networkLogsCount = intent.getIntExtra(EXTRA_NETWORK_LOGS_COUNT, 0); onNetworkLogsAvailable(context, intent, batchToken, networkLogsCount); } else if (ACTION_USER_ADDED.equals(action)) { onUserAdded(context, intent, intent.getParcelableExtra(Intent.EXTRA_USER)); } else if (ACTION_USER_REMOVED.equals(action)) { onUserRemoved(context, intent, intent.getParcelableExtra(Intent.EXTRA_USER)); } } }
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +13 −0 Original line number Diff line number Diff line Loading @@ -544,8 +544,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { new MonitoringCertNotificationTask().execute(userId); } if (Intent.ACTION_USER_ADDED.equals(action)) { sendUserAddedOrRemovedCommand(DeviceAdminReceiver.ACTION_USER_ADDED, userHandle); disableDeviceOwnerManagedSingleUserFeaturesIfNeeded(); } else if (Intent.ACTION_USER_REMOVED.equals(action)) { sendUserAddedOrRemovedCommand(DeviceAdminReceiver.ACTION_USER_REMOVED, userHandle); disableDeviceOwnerManagedSingleUserFeaturesIfNeeded(); removeUserData(userHandle); } else if (Intent.ACTION_USER_STARTED.equals(action)) { Loading @@ -568,6 +570,17 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { clearWipeProfileNotification(); } } private void sendUserAddedOrRemovedCommand(String action, int userHandle) { synchronized (DevicePolicyManagerService.this) { ActiveAdmin deviceOwner = getDeviceOwnerAdminLocked(); if (deviceOwner != null) { Bundle extras = new Bundle(); extras.putParcelable(Intent.EXTRA_USER, UserHandle.of(userHandle)); sendAdminCommandLocked(deviceOwner, action, extras, null); } } } }; static class ActiveAdmin { Loading