Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8d23b6be authored by Rubin Xu's avatar Rubin Xu
Browse files

Clear no_remove_managed_profile retriction when removing test PO

Bug: 149898237
Test: atest com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest
Change-Id: I719ee98c7dda5e256e5c8e45b52888a130d6ff5a
parent abdeaee8
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -4405,6 +4405,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                    clearDeviceOwnerLocked(getDeviceOwnerAdminLocked(), userHandle);
                }
                if (isProfileOwner(adminReceiver, userHandle)) {
                    if (isProfileOwnerOfOrganizationOwnedDevice(userHandle)) {
                        mUserManager.setUserRestriction(UserManager.DISALLOW_REMOVE_MANAGED_PROFILE,
                                false,
                                UserHandle.of(getProfileParentId(userHandle)));
                    }
                    final ActiveAdmin admin = getActiveAdminUncheckedLocked(adminReceiver,
                            userHandle, /* parent */ false);
                    clearProfileOwnerLocked(admin, userHandle);