diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index fdbd85a77a5bc..3e51b7506dffd 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -8421,7 +8421,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { return null; } Preconditions.checkCallAuthorization(canManageUsers(getCallerIdentity())); + return getProfileOwnerNameUnchecked(userHandle); + } + private String getProfileOwnerNameUnchecked(int userHandle) { ComponentName profileOwner = getProfileOwnerAsUser(userHandle); if (profileOwner == null) { return null; @@ -9731,7 +9734,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { // Set admin. setActiveAdmin(profileOwner, /* refreshing= */ true, userId); - final String ownerName = getProfileOwnerName(Process.myUserHandle().getIdentifier()); + final String ownerName = getProfileOwnerNameUnchecked( + Process.myUserHandle().getIdentifier()); setProfileOwner(profileOwner, ownerName, userId); synchronized (getLockObject()) {