summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Miller <jaggies@google.com>2011-01-26 21:58:28 -0800
committerJim Miller <jaggies@google.com>2011-01-26 21:58:28 -0800
commitb92e18e2dfa4f5b791a53b9c963cf2b9e1f1f25c (patch)
tree8c2565a72d4d6c69b739ea66ec4aa30f23b930ce
parentee37ab8dce5fe60d9a2af411ae9e38e3e44589ed (diff)
downloadframeworks_base-b92e18e2dfa4f5b791a53b9c963cf2b9e1f1f25c.zip
frameworks_base-b92e18e2dfa4f5b791a53b9c963cf2b9e1f1f25c.tar.gz
frameworks_base-b92e18e2dfa4f5b791a53b9c963cf2b9e1f1f25c.tar.bz2
Fix 3388705: Explicitly check for low battery level
This fixes a bug in StatusView believed to be caused by seeing "invalid charger" update from BatteryService. The code normally relies on "interesting events", as determined by KeyguardUpdateMonitor. I believe something else is triggering an update (perhaps a SimStateChanged event) that updates the status without also updating StatusView.mShowingBatteryInfo and mPluggedIn. The safer way to do this is to explicitly check the battery level before telling the user the device needs to be charged. Change-Id: Ic39ed86c78a157dc9fbdef4d76a9c3db39ccafca
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java2
-rw-r--r--policy/src/com/android/internal/policy/impl/StatusView.java7
2 files changed, 6 insertions, 3 deletions
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
index b225e56..e775dac 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
@@ -62,7 +62,7 @@ public class KeyguardUpdateMonitor {
static private final String TAG = "KeyguardUpdateMonitor";
static private final boolean DEBUG = false;
- private static final int LOW_BATTERY_THRESHOLD = 20;
+ /* package */ static final int LOW_BATTERY_THRESHOLD = 20;
private final Context mContext;
diff --git a/policy/src/com/android/internal/policy/impl/StatusView.java b/policy/src/com/android/internal/policy/impl/StatusView.java
index 4b91b65..1732adb 100644
--- a/policy/src/com/android/internal/policy/impl/StatusView.java
+++ b/policy/src/com/android/internal/policy/impl/StatusView.java
@@ -193,12 +193,15 @@ class StatusView {
mBatteryLevel));
}
mStatus1.setCompoundDrawablesWithIntrinsicBounds(CHARGING_ICON, 0, 0, 0);
- } else {
+ mStatus1.setVisibility(View.VISIBLE);
+ } else if (mBatteryLevel < KeyguardUpdateMonitor.LOW_BATTERY_THRESHOLD) {
// Battery is low
mStatus1.setText(getContext().getString(R.string.lockscreen_low_battery));
mStatus1.setCompoundDrawablesWithIntrinsicBounds(BATTERY_LOW_ICON, 0, 0, 0);
+ mStatus1.setVisibility(View.VISIBLE);
+ } else {
+ mStatus1.setVisibility(View.INVISIBLE);
}
- mStatus1.setVisibility(View.VISIBLE);
} else {
// nothing specific to show; show help message and icon, if provided
if (mHelpMessageId != 0) {