Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +12 −23 Original line number Diff line number Diff line Loading @@ -10993,21 +10993,13 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { @Override public void setLocationEnabled(ComponentName who, boolean locationEnabled) { Preconditions.checkNotNull(who, "ComponentName is null"); int userId = mInjector.userHandleGetCallingUserId(); synchronized (getLockObject()) { getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER); enforceDeviceOwner(who); if (!isDeviceOwner(who, userId) && !isCurrentUserDemo()) { throw new SecurityException( "Permission denial: Profile owners cannot update location settings"); } } UserHandle userHandle = mInjector.binderGetCallingUserHandle(); mInjector.binderWithCleanCallingIdentity( () -> mInjector.getLocationManager().setLocationEnabledForUser(locationEnabled, userHandle)); long ident = mInjector.binderClearCallingIdentity(); try { mInjector.getLocationManager().setLocationEnabledForUser( locationEnabled, UserHandle.of(userId)); DevicePolicyEventLogger .createEvent(DevicePolicyEnums.SET_SECURE_SETTING) .setAdmin(who) Loading @@ -11015,9 +11007,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { locationEnabled ? Settings.Secure.LOCATION_MODE_ON : Settings.Secure.LOCATION_MODE_OFF)) .write(); } finally { mInjector.binderRestoreCallingIdentity(ident); } } @Override Loading Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +12 −23 Original line number Diff line number Diff line Loading @@ -10993,21 +10993,13 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { @Override public void setLocationEnabled(ComponentName who, boolean locationEnabled) { Preconditions.checkNotNull(who, "ComponentName is null"); int userId = mInjector.userHandleGetCallingUserId(); synchronized (getLockObject()) { getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER); enforceDeviceOwner(who); if (!isDeviceOwner(who, userId) && !isCurrentUserDemo()) { throw new SecurityException( "Permission denial: Profile owners cannot update location settings"); } } UserHandle userHandle = mInjector.binderGetCallingUserHandle(); mInjector.binderWithCleanCallingIdentity( () -> mInjector.getLocationManager().setLocationEnabledForUser(locationEnabled, userHandle)); long ident = mInjector.binderClearCallingIdentity(); try { mInjector.getLocationManager().setLocationEnabledForUser( locationEnabled, UserHandle.of(userId)); DevicePolicyEventLogger .createEvent(DevicePolicyEnums.SET_SECURE_SETTING) .setAdmin(who) Loading @@ -11015,9 +11007,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { locationEnabled ? Settings.Secure.LOCATION_MODE_ON : Settings.Secure.LOCATION_MODE_OFF)) .write(); } finally { mInjector.binderRestoreCallingIdentity(ident); } } @Override Loading