Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +10 −0 Original line number Original line Diff line number Diff line Loading @@ -3093,6 +3093,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { // If admin is a device or profile owner tidy that up first. // If admin is a device or profile owner tidy that up first. if (isDeviceOwner(adminReceiver, userHandle)) { if (isDeviceOwner(adminReceiver, userHandle)) { clearDeviceOwnerLocked(getDeviceOwnerAdminLocked(), userHandle); clearDeviceOwnerLocked(getDeviceOwnerAdminLocked(), userHandle); clearDeviceOwnerUserRestrictionLocked(UserHandle.of(userHandle)); } } if (isProfileOwner(adminReceiver, userHandle)) { if (isProfileOwner(adminReceiver, userHandle)) { final ActiveAdmin admin = getActiveAdminUncheckedLocked(adminReceiver, final ActiveAdmin admin = getActiveAdminUncheckedLocked(adminReceiver, Loading @@ -3108,6 +3109,15 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } } } } // It's temporary solution to clear DISALLOW_ADD_USER after CTS // TODO: b/31952368 when the restriction is moved from system to the device owner, // it can be removed. private void clearDeviceOwnerUserRestrictionLocked(UserHandle userHandle) { if (mUserManager.hasUserRestriction(UserManager.DISALLOW_ADD_USER, userHandle)) { mUserManager.setUserRestriction(UserManager.DISALLOW_ADD_USER, false, userHandle); } } /** /** * Return if a given package has testOnly="true", in which case we'll relax certain rules * Return if a given package has testOnly="true", in which case we'll relax certain rules * for CTS. * for CTS. Loading Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +10 −0 Original line number Original line Diff line number Diff line Loading @@ -3093,6 +3093,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { // If admin is a device or profile owner tidy that up first. // If admin is a device or profile owner tidy that up first. if (isDeviceOwner(adminReceiver, userHandle)) { if (isDeviceOwner(adminReceiver, userHandle)) { clearDeviceOwnerLocked(getDeviceOwnerAdminLocked(), userHandle); clearDeviceOwnerLocked(getDeviceOwnerAdminLocked(), userHandle); clearDeviceOwnerUserRestrictionLocked(UserHandle.of(userHandle)); } } if (isProfileOwner(adminReceiver, userHandle)) { if (isProfileOwner(adminReceiver, userHandle)) { final ActiveAdmin admin = getActiveAdminUncheckedLocked(adminReceiver, final ActiveAdmin admin = getActiveAdminUncheckedLocked(adminReceiver, Loading @@ -3108,6 +3109,15 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } } } } // It's temporary solution to clear DISALLOW_ADD_USER after CTS // TODO: b/31952368 when the restriction is moved from system to the device owner, // it can be removed. private void clearDeviceOwnerUserRestrictionLocked(UserHandle userHandle) { if (mUserManager.hasUserRestriction(UserManager.DISALLOW_ADD_USER, userHandle)) { mUserManager.setUserRestriction(UserManager.DISALLOW_ADD_USER, false, userHandle); } } /** /** * Return if a given package has testOnly="true", in which case we'll relax certain rules * Return if a given package has testOnly="true", in which case we'll relax certain rules * for CTS. * for CTS. Loading