batstats: fix wake lock tracking, service bug
- Fix bug I introduced in handling wake lock changes where
we weren't iterating over the new work sources correctly.
- Fix bug in ActiveServices that would wtf too much.
- Prepare to start tracking uptime in the battery history.
Change-Id: Ia94316be51bc6eab7b02f214a5c40c08e99cc3b1
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index 7db4ac2..b0d94d5 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -570,13 +570,15 @@
public static final int STATE_PHONE_IN_CALL_FLAG = 1<<18;
public static final int STATE_WIFI_ON_FLAG = 1<<17;
public static final int STATE_BLUETOOTH_ON_FLAG = 1<<16;
-
+
public static final int MOST_INTERESTING_STATES =
STATE_BATTERY_PLUGGED_FLAG | STATE_SCREEN_ON_FLAG
| STATE_GPS_ON_FLAG | STATE_PHONE_IN_CALL_FLAG;
public int states;
+ public int states2;
+
// The wake lock that was acquired at this point.
public HistoryTag wakelockTag;
@@ -1216,6 +1218,11 @@
public abstract int getHighDischargeAmountSinceCharge();
/**
+ * Retrieve the discharge amount over the selected discharge period <var>which</var>.
+ */
+ public abstract int getDischargeAmount(int which);
+
+ /**
* Get the amount the battery has discharged while the screen was on,
* since the last time power was unplugged.
*/