Disable screensavers if below first battery warning level.
Don't activate on sleep if below the threshold, and quit any currently
running dream when the threshold is reached.
Bug:6999949
Change-Id: I961b350d24ee6f95e502228aaa57312b0ffbadc1
diff --git a/services/java/com/android/server/BatteryService.java b/services/java/com/android/server/BatteryService.java
index 6ae16a4..4192a93 100644
--- a/services/java/com/android/server/BatteryService.java
+++ b/services/java/com/android/server/BatteryService.java
@@ -204,6 +204,11 @@
return mBatteryLevel;
}
+ // true if battery level is below the first warning threshold
+ public final boolean isBatteryLow() {
+ return mBatteryPresent && mBatteryLevel <= mLowBatteryWarningLevel;
+ }
+
void systemReady() {
// check our power situation now that it is safe to display the shutdown dialog.
shutdownIfNoPower();