Merge "Add getProfileOwnerNameUnchecked private method and use in manageUserUnchecked"

This commit is contained in:
Yan Zhu
2021-01-11 20:18:47 +00:00
committed by Android (Google) Code Review

View File

@@ -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()) {