Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +17 −16 Original line number Original line Diff line number Diff line Loading @@ -8903,17 +8903,17 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { } } @Override @Override public ComponentName getProfileOwnerAsUser(int userHandle) { public ComponentName getProfileOwnerAsUser(int userId) { if (!mHasFeature) { if (!mHasFeature) { return null; return null; } } Preconditions.checkArgumentNonnegative(userHandle, "Invalid userId"); Preconditions.checkArgumentNonnegative(userId, "Invalid userId"); final CallerIdentity caller = getCallerIdentity(); CallerIdentity caller = getCallerIdentity(); Preconditions.checkCallAuthorization(hasCrossUsersPermission(caller, userHandle)); Preconditions.checkCallAuthorization(hasCrossUsersPermission(caller, userId)); synchronized (getLockObject()) { synchronized (getLockObject()) { return mOwners.getProfileOwnerComponent(userHandle); return mOwners.getProfileOwnerComponent(userId); } } } } Loading Loading @@ -9357,8 +9357,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { public List<UserHandle> listForegroundAffiliatedUsers() { public List<UserHandle> listForegroundAffiliatedUsers() { checkIsDeviceOwner(getCallerIdentity()); checkIsDeviceOwner(getCallerIdentity()); int userId = mInjector.binderWithCleanCallingIdentity(() -> getCurrentForegroundUserId()); return mInjector.binderWithCleanCallingIdentity(() -> { int userId = getCurrentForegroundUserId(); boolean isAffiliated; boolean isAffiliated; synchronized (getLockObject()) { synchronized (getLockObject()) { isAffiliated = isUserAffiliatedWithDeviceLocked(userId); isAffiliated = isUserAffiliatedWithDeviceLocked(userId); Loading @@ -9370,6 +9370,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { users.add(UserHandle.of(userId)); users.add(UserHandle.of(userId)); return users; return users; }); } } protected int getProfileParentId(int userHandle) { protected int getProfileParentId(int userHandle) { Loading Loading @@ -14129,7 +14130,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { } } } } private boolean isUserAffiliatedWithDeviceLocked(int userId) { private boolean isUserAffiliatedWithDeviceLocked(@UserIdInt int userId) { if (!mOwners.hasDeviceOwner()) { if (!mOwners.hasDeviceOwner()) { return false; return false; } } Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +17 −16 Original line number Original line Diff line number Diff line Loading @@ -8903,17 +8903,17 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { } } @Override @Override public ComponentName getProfileOwnerAsUser(int userHandle) { public ComponentName getProfileOwnerAsUser(int userId) { if (!mHasFeature) { if (!mHasFeature) { return null; return null; } } Preconditions.checkArgumentNonnegative(userHandle, "Invalid userId"); Preconditions.checkArgumentNonnegative(userId, "Invalid userId"); final CallerIdentity caller = getCallerIdentity(); CallerIdentity caller = getCallerIdentity(); Preconditions.checkCallAuthorization(hasCrossUsersPermission(caller, userHandle)); Preconditions.checkCallAuthorization(hasCrossUsersPermission(caller, userId)); synchronized (getLockObject()) { synchronized (getLockObject()) { return mOwners.getProfileOwnerComponent(userHandle); return mOwners.getProfileOwnerComponent(userId); } } } } Loading Loading @@ -9357,8 +9357,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { public List<UserHandle> listForegroundAffiliatedUsers() { public List<UserHandle> listForegroundAffiliatedUsers() { checkIsDeviceOwner(getCallerIdentity()); checkIsDeviceOwner(getCallerIdentity()); int userId = mInjector.binderWithCleanCallingIdentity(() -> getCurrentForegroundUserId()); return mInjector.binderWithCleanCallingIdentity(() -> { int userId = getCurrentForegroundUserId(); boolean isAffiliated; boolean isAffiliated; synchronized (getLockObject()) { synchronized (getLockObject()) { isAffiliated = isUserAffiliatedWithDeviceLocked(userId); isAffiliated = isUserAffiliatedWithDeviceLocked(userId); Loading @@ -9370,6 +9370,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { users.add(UserHandle.of(userId)); users.add(UserHandle.of(userId)); return users; return users; }); } } protected int getProfileParentId(int userHandle) { protected int getProfileParentId(int userHandle) { Loading Loading @@ -14129,7 +14130,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { } } } } private boolean isUserAffiliatedWithDeviceLocked(int userId) { private boolean isUserAffiliatedWithDeviceLocked(@UserIdInt int userId) { if (!mOwners.hasDeviceOwner()) { if (!mOwners.hasDeviceOwner()) { return false; return false; } }