Drive-by clean-up: remove redundant operation

markProfileOwnerOnOrganizationOwnedDeviceUncheckedLocked sets
DISALLOW_REMOVE_MANAGED_PROFILE restriction on parent profil,
so doing it again in restrictRemovalOfManagedProfile is
unnecessary.

Bug: 162815601
Test: enroll TestDPC into COPE from SuW, check the profile cannot be
      removed.
Change-Id: Ie50c0cfa8affad58759ad3dd01963bb7edccf720
This commit is contained in:
Pavel Grafov
2021-04-23 12:23:49 +01:00
parent 1b2c66567e
commit 5ee3398bb9

View File

@@ -16774,7 +16774,9 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
provisioningParams.isKeepAccountMigrated(), callerPackage);
if (provisioningParams.isOrganizationOwnedProvisioning()) {
setProfileOwnerOnOrgOwnedDeviceState(admin, userInfo.id, caller.getUserId());
synchronized (getLockObject()) {
markProfileOwnerOnOrganizationOwnedDeviceUncheckedLocked(admin, userInfo.id);
}
}
return userInfo.getUserHandle();
@@ -17006,22 +17008,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
}
}
private void setProfileOwnerOnOrgOwnedDeviceState(
ComponentName admin, @UserIdInt int profileId, @UserIdInt int parentUserId) {
synchronized (getLockObject()) {
markProfileOwnerOnOrganizationOwnedDeviceUncheckedLocked(admin, profileId);
}
restrictRemovalOfManagedProfile(parentUserId);
}
private void restrictRemovalOfManagedProfile(@UserIdInt int parentUserId) {
final UserHandle parentUserHandle = UserHandle.of(parentUserId);
mUserManager.setUserRestriction(
UserManager.DISALLOW_REMOVE_MANAGED_PROFILE,
/* value= */ true,
parentUserHandle);
}
@Override
public void provisionFullyManagedDevice(
@NonNull FullyManagedDeviceProvisioningParams provisioningParams,