summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2012-11-30 07:27:36 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-11-30 07:27:36 -0800
commit386165a3ae09b150165e8e7c310e194231071271 (patch)
treef22995e0bfff6a1fe3d970ec299000cd2188ae51 /packages
parenta4f67a88f421c454cb07a59e9ce5b0b720df55fc (diff)
parentfe0e1e445fe697d59baf5736da20356a4e548fc9 (diff)
downloadframeworks_base-386165a3ae09b150165e8e7c310e194231071271.zip
frameworks_base-386165a3ae09b150165e8e7c310e194231071271.tar.gz
frameworks_base-386165a3ae09b150165e8e7c310e194231071271.tar.bz2
Merge "Only show "charging" if the battery is really charging." into jb-mr1.1-dev
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java
index 7f9bcac..716341f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java
@@ -68,9 +68,20 @@ public class BatteryController extends BroadcastReceiver {
final String action = intent.getAction();
if (action.equals(Intent.ACTION_BATTERY_CHANGED)) {
final int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0);
- final boolean plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0) != 0;
- final int icon = plugged ? R.drawable.stat_sys_battery_charge
+ final int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS,
+ BatteryManager.BATTERY_STATUS_UNKNOWN);
+
+ boolean plugged = false;
+ switch (status) {
+ case BatteryManager.BATTERY_STATUS_CHARGING:
+ case BatteryManager.BATTERY_STATUS_FULL:
+ plugged = true;
+ break;
+ }
+
+ final int icon = plugged ? R.drawable.stat_sys_battery_charge
: R.drawable.stat_sys_battery;
+
int N = mIconViews.size();
for (int i=0; i<N; i++) {
ImageView v = mIconViews.get(i);