diff options
Diffstat (limited to 'core/java/android/os/PowerManager.java')
| -rw-r--r-- | core/java/android/os/PowerManager.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java index 7f4254e29aaa..0441ba27dcd4 100644 --- a/core/java/android/os/PowerManager.java +++ b/core/java/android/os/PowerManager.java @@ -640,6 +640,9 @@ public final class PowerManager { */ public static final int LOCATION_MODE_FOREGROUND_ONLY = 3; + static final int MIN_LOCATION_MODE = LOCATION_MODE_NO_CHANGE; + static final int MAX_LOCATION_MODE = LOCATION_MODE_FOREGROUND_ONLY; + /** * @hide */ @@ -1272,6 +1275,48 @@ public final class PowerManager { } /** + * Sets the policy for adaptive power save. + * + * @return true if there was an effectual change. If full battery saver is enabled or the + * adaptive policy is not enabled, then this will return false. + * + * @hide + */ + @SystemApi + @RequiresPermission(anyOf = { + android.Manifest.permission.DEVICE_POWER, + android.Manifest.permission.POWER_SAVER + }) + public boolean setAdaptivePowerSavePolicy(@NonNull BatterySaverPolicyConfig config) { + try { + return mService.setAdaptivePowerSavePolicy(config); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** + * Enables or disables adaptive power save. + * + * @return true if there was an effectual change. If full battery saver is enabled, then this + * will return false. + * + * @hide + */ + @SystemApi + @RequiresPermission(anyOf = { + android.Manifest.permission.DEVICE_POWER, + android.Manifest.permission.POWER_SAVER + }) + public boolean setAdaptivePowerSaveEnabled(boolean enabled) { + try { + return mService.setAdaptivePowerSaveEnabled(enabled); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** * Indicates automatic battery saver toggling by the system will be based on percentage. * * @see PowerManager#getPowerSaveMode() |
