Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -6851,6 +6851,7 @@ package android.app.admin { method public boolean setKeyPairCertificate(@Nullable android.content.ComponentName, @NonNull String, @NonNull java.util.List<java.security.cert.Certificate>, boolean); method public boolean setKeyguardDisabled(@NonNull android.content.ComponentName, boolean); method public void setKeyguardDisabledFeatures(@NonNull android.content.ComponentName, int); method public void setLocationEnabled(@NonNull android.content.ComponentName, boolean); method public void setLockTaskFeatures(@NonNull android.content.ComponentName, int); method public void setLockTaskPackages(@NonNull android.content.ComponentName, @NonNull String[]) throws java.lang.SecurityException; method public void setLogoutEnabled(@NonNull android.content.ComponentName, boolean); core/java/android/app/admin/DevicePolicyManager.java +23 −0 Original line number Diff line number Diff line Loading @@ -8350,6 +8350,24 @@ public class DevicePolicyManager { return false; } /** * Called by device owners to set the user's master location setting. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with * @param locationEnabled whether location should be enabled or disabled * @throws SecurityException if {@code admin} is not a device owner. */ public void setLocationEnabled(@NonNull ComponentName admin, boolean locationEnabled) { throwIfParentInstance("setLocationEnabled"); if (mService != null) { try { mService.setLocationEnabled(admin, locationEnabled); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } } /** * Called by profile or device owners to update {@link android.provider.Settings.Secure} * settings. Validation that the value of the setting is in the correct form for the setting Loading Loading @@ -8379,6 +8397,11 @@ public class DevicePolicyManager { * all users. * </strong> * * <strong>Note: Starting from Android R, apps should no longer call this method with the * setting {@link android.provider.Settings.Secure#LOCATION_MODE}, which is deprecated. Instead, * device owners should call {@link #setLocationEnabled(ComponentName, boolean)}. * </strong> * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param setting The name of the setting to update. * @param value The value to update the setting to. Loading core/java/android/app/admin/IDevicePolicyManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -258,6 +258,8 @@ interface IDevicePolicyManager { void setSystemSetting(in ComponentName who, in String setting, in String value); void setSecureSetting(in ComponentName who, in String setting, in String value); void setLocationEnabled(in ComponentName who, boolean locationEnabled); boolean setTime(in ComponentName who, long millis); boolean setTimeZone(in ComponentName who, String timeZone); Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +35 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,7 @@ import android.database.ContentObserver; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.Color; import android.location.LocationManager; import android.media.AudioManager; import android.media.IAudioService; import android.net.ConnectivityManager; Loading Loading @@ -1959,6 +1960,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { return mContext.getSystemService(ConnectivityManager.class); } LocationManager getLocationManager() { return mContext.getSystemService(LocationManager.class); } IWindowManager getIWindowManager() { return IWindowManager.Stub .asInterface(ServiceManager.getService(Context.WINDOW_SERVICE)); Loading Loading @@ -10898,6 +10903,36 @@ 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); if (!isDeviceOwner(who, userId) && !isCurrentUserDemo()) { throw new SecurityException( "Permission denial: Profile owners cannot update location settings"); } } long ident = mInjector.binderClearCallingIdentity(); try { mInjector.getLocationManager().setLocationEnabledForUser( locationEnabled, UserHandle.of(userId)); DevicePolicyEventLogger .createEvent(DevicePolicyEnums.SET_SECURE_SETTING) .setAdmin(who) .setStrings(Settings.Secure.LOCATION_MODE, Integer.toString( locationEnabled ? Settings.Secure.LOCATION_MODE_ON : Settings.Secure.LOCATION_MODE_OFF)) .write(); } finally { mInjector.binderRestoreCallingIdentity(ident); } } @Override public boolean setTime(ComponentName who, long millis) { Preconditions.checkNotNull(who, "ComponentName is null in setTime"); Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -6851,6 +6851,7 @@ package android.app.admin { method public boolean setKeyPairCertificate(@Nullable android.content.ComponentName, @NonNull String, @NonNull java.util.List<java.security.cert.Certificate>, boolean); method public boolean setKeyguardDisabled(@NonNull android.content.ComponentName, boolean); method public void setKeyguardDisabledFeatures(@NonNull android.content.ComponentName, int); method public void setLocationEnabled(@NonNull android.content.ComponentName, boolean); method public void setLockTaskFeatures(@NonNull android.content.ComponentName, int); method public void setLockTaskPackages(@NonNull android.content.ComponentName, @NonNull String[]) throws java.lang.SecurityException; method public void setLogoutEnabled(@NonNull android.content.ComponentName, boolean);
core/java/android/app/admin/DevicePolicyManager.java +23 −0 Original line number Diff line number Diff line Loading @@ -8350,6 +8350,24 @@ public class DevicePolicyManager { return false; } /** * Called by device owners to set the user's master location setting. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with * @param locationEnabled whether location should be enabled or disabled * @throws SecurityException if {@code admin} is not a device owner. */ public void setLocationEnabled(@NonNull ComponentName admin, boolean locationEnabled) { throwIfParentInstance("setLocationEnabled"); if (mService != null) { try { mService.setLocationEnabled(admin, locationEnabled); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } } /** * Called by profile or device owners to update {@link android.provider.Settings.Secure} * settings. Validation that the value of the setting is in the correct form for the setting Loading Loading @@ -8379,6 +8397,11 @@ public class DevicePolicyManager { * all users. * </strong> * * <strong>Note: Starting from Android R, apps should no longer call this method with the * setting {@link android.provider.Settings.Secure#LOCATION_MODE}, which is deprecated. Instead, * device owners should call {@link #setLocationEnabled(ComponentName, boolean)}. * </strong> * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param setting The name of the setting to update. * @param value The value to update the setting to. Loading
core/java/android/app/admin/IDevicePolicyManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -258,6 +258,8 @@ interface IDevicePolicyManager { void setSystemSetting(in ComponentName who, in String setting, in String value); void setSecureSetting(in ComponentName who, in String setting, in String value); void setLocationEnabled(in ComponentName who, boolean locationEnabled); boolean setTime(in ComponentName who, long millis); boolean setTimeZone(in ComponentName who, String timeZone); Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +35 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,7 @@ import android.database.ContentObserver; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.Color; import android.location.LocationManager; import android.media.AudioManager; import android.media.IAudioService; import android.net.ConnectivityManager; Loading Loading @@ -1959,6 +1960,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { return mContext.getSystemService(ConnectivityManager.class); } LocationManager getLocationManager() { return mContext.getSystemService(LocationManager.class); } IWindowManager getIWindowManager() { return IWindowManager.Stub .asInterface(ServiceManager.getService(Context.WINDOW_SERVICE)); Loading Loading @@ -10898,6 +10903,36 @@ 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); if (!isDeviceOwner(who, userId) && !isCurrentUserDemo()) { throw new SecurityException( "Permission denial: Profile owners cannot update location settings"); } } long ident = mInjector.binderClearCallingIdentity(); try { mInjector.getLocationManager().setLocationEnabledForUser( locationEnabled, UserHandle.of(userId)); DevicePolicyEventLogger .createEvent(DevicePolicyEnums.SET_SECURE_SETTING) .setAdmin(who) .setStrings(Settings.Secure.LOCATION_MODE, Integer.toString( locationEnabled ? Settings.Secure.LOCATION_MODE_ON : Settings.Secure.LOCATION_MODE_OFF)) .write(); } finally { mInjector.binderRestoreCallingIdentity(ident); } } @Override public boolean setTime(ComponentName who, long millis) { Preconditions.checkNotNull(who, "ComponentName is null in setTime"); Loading