Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -23419,6 +23419,7 @@ package android.os { public final class PowerManager { method public boolean isDeviceIdleMode(); method public boolean isIgnoringBatteryOptimizations(java.lang.String); method public boolean isInteractive(); method public boolean isPowerSaveMode(); method public deprecated boolean isScreenOn(); api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -25341,6 +25341,7 @@ package android.os { public final class PowerManager { method public boolean isDeviceIdleMode(); method public boolean isIgnoringBatteryOptimizations(java.lang.String); method public boolean isInteractive(); method public boolean isPowerSaveMode(); method public boolean isScreenBrightnessBoosted(); core/java/android/content/Context.java +8 −0 Original line number Diff line number Diff line Loading @@ -2248,6 +2248,7 @@ public abstract class Context { //@hide: VOICE_INTERACTION_MANAGER_SERVICE, //@hide: BACKUP_SERVICE, DROPBOX_SERVICE, //@hide: DEVICE_IDLE_CONTROLLER, DEVICE_POLICY_SERVICE, UI_MODE_SERVICE, DOWNLOAD_SERVICE, Loading Loading @@ -2873,6 +2874,13 @@ public abstract class Context { */ public static final String DROPBOX_SERVICE = "dropbox"; /** * System service name for the DeviceIdleController. There is no Java API for this. * @see #getSystemService * @hide */ public static final String DEVICE_IDLE_CONTROLLER = "deviceidle"; /** * Use with {@link #getSystemService} to retrieve a * {@link android.app.admin.DevicePolicyManager} for working with global Loading core/java/android/os/PowerManager.java +21 −0 Original line number Diff line number Diff line Loading @@ -392,6 +392,8 @@ public final class PowerManager { final IPowerManager mService; final Handler mHandler; IDeviceIdleController mIDeviceIdleController; /** * {@hide} */ Loading Loading @@ -891,6 +893,25 @@ public final class PowerManager { } } /** * Return whether the given application package name is on the device's power whitelist. * Apps can be placed on the whitelist through the settings UI invoked by * {@link android.provider.Settings#ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS}. */ public boolean isIgnoringBatteryOptimizations(String packageName) { synchronized (this) { if (mIDeviceIdleController == null) { mIDeviceIdleController = IDeviceIdleController.Stub.asInterface( ServiceManager.getService(Context.DEVICE_IDLE_CONTROLLER)); } } try { return mIDeviceIdleController.isPowerSaveWhitelistApp(packageName); } catch (RemoteException e) { return false; } } /** * Turn off the device. * Loading core/java/android/provider/Settings.java +5 −4 Original line number Diff line number Diff line Loading @@ -579,13 +579,14 @@ public final class Settings { /** * Activity Action: Show screen for controlling which apps can ignore battery optimizations. * <p> * In some cases, a matching Activity may not exist, so ensure you * safeguard against this. * <p> * Input: The Intent's data URI specifies the application package name * Input: Optionally, the Intent's data URI specifies the application package name * to be shown, with the "package" scheme. That is "package:com.my.app". * <p> * Output: Nothing. * <p> * You can use {@link android.os.PowerManager#isIgnoringBatteryOptimizations * PowerManager.isIgnoringBatteryOptimizations()} to determine if an application is * already ignoring optimizations. */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS = Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -23419,6 +23419,7 @@ package android.os { public final class PowerManager { method public boolean isDeviceIdleMode(); method public boolean isIgnoringBatteryOptimizations(java.lang.String); method public boolean isInteractive(); method public boolean isPowerSaveMode(); method public deprecated boolean isScreenOn();
api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -25341,6 +25341,7 @@ package android.os { public final class PowerManager { method public boolean isDeviceIdleMode(); method public boolean isIgnoringBatteryOptimizations(java.lang.String); method public boolean isInteractive(); method public boolean isPowerSaveMode(); method public boolean isScreenBrightnessBoosted();
core/java/android/content/Context.java +8 −0 Original line number Diff line number Diff line Loading @@ -2248,6 +2248,7 @@ public abstract class Context { //@hide: VOICE_INTERACTION_MANAGER_SERVICE, //@hide: BACKUP_SERVICE, DROPBOX_SERVICE, //@hide: DEVICE_IDLE_CONTROLLER, DEVICE_POLICY_SERVICE, UI_MODE_SERVICE, DOWNLOAD_SERVICE, Loading Loading @@ -2873,6 +2874,13 @@ public abstract class Context { */ public static final String DROPBOX_SERVICE = "dropbox"; /** * System service name for the DeviceIdleController. There is no Java API for this. * @see #getSystemService * @hide */ public static final String DEVICE_IDLE_CONTROLLER = "deviceidle"; /** * Use with {@link #getSystemService} to retrieve a * {@link android.app.admin.DevicePolicyManager} for working with global Loading
core/java/android/os/PowerManager.java +21 −0 Original line number Diff line number Diff line Loading @@ -392,6 +392,8 @@ public final class PowerManager { final IPowerManager mService; final Handler mHandler; IDeviceIdleController mIDeviceIdleController; /** * {@hide} */ Loading Loading @@ -891,6 +893,25 @@ public final class PowerManager { } } /** * Return whether the given application package name is on the device's power whitelist. * Apps can be placed on the whitelist through the settings UI invoked by * {@link android.provider.Settings#ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS}. */ public boolean isIgnoringBatteryOptimizations(String packageName) { synchronized (this) { if (mIDeviceIdleController == null) { mIDeviceIdleController = IDeviceIdleController.Stub.asInterface( ServiceManager.getService(Context.DEVICE_IDLE_CONTROLLER)); } } try { return mIDeviceIdleController.isPowerSaveWhitelistApp(packageName); } catch (RemoteException e) { return false; } } /** * Turn off the device. * Loading
core/java/android/provider/Settings.java +5 −4 Original line number Diff line number Diff line Loading @@ -579,13 +579,14 @@ public final class Settings { /** * Activity Action: Show screen for controlling which apps can ignore battery optimizations. * <p> * In some cases, a matching Activity may not exist, so ensure you * safeguard against this. * <p> * Input: The Intent's data URI specifies the application package name * Input: Optionally, the Intent's data URI specifies the application package name * to be shown, with the "package" scheme. That is "package:com.my.app". * <p> * Output: Nothing. * <p> * You can use {@link android.os.PowerManager#isIgnoringBatteryOptimizations * PowerManager.isIgnoringBatteryOptimizations()} to determine if an application is * already ignoring optimizations. */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS = Loading