From b4aa2e9c37881197fa939d8ee29d21dfdc962e40 Mon Sep 17 00:00:00 2001 From: Ruchi Kandoi Date: Wed, 30 Mar 2016 12:07:31 -0700 Subject: [PATCH] PowerManager: Adds isSustainedPerformanceModeSupported() isSustainedPerformanceModeSupported() returns true if the device supports the mode. It checks for the boolean config "config_sustainedPerformanceModeSupported" to be set. Bug: 22864186 Change-Id: I0f9f0bcbb8c02b19f37e9c87570d88e8f78f7992 Signed-off-by: Ruchi Kandoi --- api/current.txt | 1 + api/system-current.txt | 1 + api/test-current.txt | 1 + core/java/android/os/PowerManager.java | 10 ++++++++++ core/res/res/values/config.xml | 3 +++ core/res/res/values/symbols.xml | 2 ++ 6 files changed, 18 insertions(+) diff --git a/api/current.txt b/api/current.txt index 1b331ac3f07d6..051ad92630f8f 100644 --- a/api/current.txt +++ b/api/current.txt @@ -29074,6 +29074,7 @@ package android.os { method public boolean isInteractive(); method public boolean isPowerSaveMode(); method public deprecated boolean isScreenOn(); + method public boolean isSustainedPerformanceModeSupported(); method public boolean isWakeLockLevelSupported(int); method public android.os.PowerManager.WakeLock newWakeLock(int, java.lang.String); method public void reboot(java.lang.String); diff --git a/api/system-current.txt b/api/system-current.txt index 867675c337ee5..b21a7842eba5e 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -31307,6 +31307,7 @@ package android.os { method public boolean isPowerSaveMode(); method public boolean isScreenBrightnessBoosted(); method public deprecated boolean isScreenOn(); + method public boolean isSustainedPerformanceModeSupported(); method public boolean isWakeLockLevelSupported(int); method public android.os.PowerManager.WakeLock newWakeLock(int, java.lang.String); method public void reboot(java.lang.String); diff --git a/api/test-current.txt b/api/test-current.txt index f60aab14c1723..2165b327f6cf6 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -29139,6 +29139,7 @@ package android.os { method public boolean isInteractive(); method public boolean isPowerSaveMode(); method public deprecated boolean isScreenOn(); + method public boolean isSustainedPerformanceModeSupported(); method public boolean isWakeLockLevelSupported(int); method public android.os.PowerManager.WakeLock newWakeLock(int, java.lang.String); method public void reboot(java.lang.String); diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java index a0a16f1a89305..ce176a3691867 100644 --- a/core/java/android/os/PowerManager.java +++ b/core/java/android/os/PowerManager.java @@ -1030,6 +1030,16 @@ public final class PowerManager { } } + /** + * Returns True if the device supports Sustained Performance Mode. + * Applications Should check if the device supports this mode, before + * using {@link #SUSTAINED_PERFORMANCE_WAKE_LOCK}. + */ + public boolean isSustainedPerformanceModeSupported() { + return mContext.getResources().getBoolean( + com.android.internal.R.bool.config_sustainedPerformanceModeSupported); + } + /** * Intent that is broadcast when the state of {@link #isPowerSaveMode()} changes. * This broadcast is only sent to registered receivers. diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index dbe3dcaa6344e..cae04adfb8b21 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -2504,4 +2504,7 @@ false + + + false diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 7d19e99f65eb7..1e10f863f0fbe 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2542,4 +2542,6 @@ + +