OSDN Git Service

Send BATTERY_CHANGED if maxChargingCurrent changes
authorAdrian Roos <roosa@google.com>
Tue, 21 Jul 2015 23:20:36 +0000 (16:20 -0700)
committerAdrian Roos <roosa@google.com>
Tue, 21 Jul 2015 23:20:39 +0000 (16:20 -0700)
Fixes a bug where the charging current on Keyguard was stale
on devices that don't immediately set the charging current.

Follow-up to I2e5c21dd7ec028ce47fb03ab71e74f7fccaa9e36

Bug: 8099739
Change-Id: I4b5b3b1231b1372310206941386dba743d5f88f4

packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
services/core/java/com/android/server/BatteryService.java

index d4de56d..e7d55b4 100644 (file)
@@ -1232,6 +1232,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
         if (!nowPluggedIn && current.isBatteryLow() && current.level != old.level) {
             return true;
         }
+
+        // change in charging current while plugged in
+        if (nowPluggedIn && current.maxChargingCurrent != old.maxChargingCurrent) {
+            return true;
+        }
+
         return false;
     }
 
index fc2b1ec..31c94f7 100644 (file)
@@ -164,7 +164,7 @@ public class KeyguardIndicationController {
         if (mPowerPluggedIn) {
             String indication = computePowerIndication();
             if (DEBUG_CHARGING_CURRENT) {
-                indication = indication + mChargingCurrent;
+                indication += ",  " + (mChargingCurrent / 1000) + " mA";
             }
             return indication;
         }
index 5160ddf..2eeaec9 100644 (file)
@@ -120,6 +120,7 @@ public final class BatteryService extends SystemService {
     private int mLastBatteryVoltage;
     private int mLastBatteryTemperature;
     private boolean mLastBatteryLevelCritical;
+    private int mLastMaxChargingCurrent;
 
     private int mInvalidCharger;
     private int mLastInvalidCharger;
@@ -354,6 +355,7 @@ public final class BatteryService extends SystemService {
                 mPlugType != mLastPlugType ||
                 mBatteryProps.batteryVoltage != mLastBatteryVoltage ||
                 mBatteryProps.batteryTemperature != mLastBatteryTemperature ||
+                mBatteryProps.maxChargingCurrent != mLastMaxChargingCurrent ||
                 mInvalidCharger != mLastInvalidCharger)) {
 
             if (mPlugType != mLastPlugType) {
@@ -480,6 +482,7 @@ public final class BatteryService extends SystemService {
             mLastPlugType = mPlugType;
             mLastBatteryVoltage = mBatteryProps.batteryVoltage;
             mLastBatteryTemperature = mBatteryProps.batteryTemperature;
+            mLastMaxChargingCurrent = mBatteryProps.maxChargingCurrent;
             mLastBatteryLevelCritical = mBatteryLevelCritical;
             mLastInvalidCharger = mInvalidCharger;
         }