Merge "Clear user restriction for managed profiles when the user is deleted." into udc-dev am: 472e038e4e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21911053

Change-Id: I6574070c0796b879521dfa9453d16f5e59d04378
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
TreeHugger Robot
2023-03-11 21:20:41 +00:00
committed by Automerger Merge Worker

View File

@@ -2237,6 +2237,16 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
isOrgOwned = mOwners.isProfileOwnerOfOrganizationOwnedDevice(userHandle);
// Clear any restrictions set by the a profile owner and the parent admin.
final ActiveAdmin admin = getProfileOwnerLocked(userHandle);
if (admin != null) {
admin.userRestrictions = null;
final ActiveAdmin parentAdmin = admin.getParentActiveAdmin();
if (parentAdmin != null) {
parentAdmin.userRestrictions = null;
}
pushUserRestrictions(userHandle);
}
mOwners.removeProfileOwner(userHandle);
mOwners.writeProfileOwner(userHandle);
pushScreenCapturePolicy(userHandle);