Merge "Move isAdminTestOnlyLocked inside synchronized block"

This commit is contained in:
Alex Johnston
2020-11-12 08:55:53 +00:00
committed by Android (Google) Code Review

View File

@@ -10431,12 +10431,12 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
Preconditions.checkCallAuthorization(!isManagedProfile(caller.getUserId()),
"User %d is not allowed to call setSecondaryLockscreenEnabled",
caller.getUserId());
// Allow testOnly admins to bypass supervision config requirement.
Preconditions.checkCallAuthorization(isAdminTestOnlyLocked(who, caller.getUserId())
|| isDefaultSupervisor(caller), "Admin %s is not the "
+ "default supervision component", caller.getComponentName());
synchronized (getLockObject()) {
// Allow testOnly admins to bypass supervision config requirement.
Preconditions.checkCallAuthorization(isAdminTestOnlyLocked(who, caller.getUserId())
|| isDefaultSupervisor(caller), "Admin %s is not the "
+ "default supervision component", caller.getComponentName());
DevicePolicyData policy = getUserData(caller.getUserId());
policy.mSecondaryLockscreenEnabled = enabled;
saveSettingsLocked(caller.getUserId());