Loading core/java/android/os/BatteryStats.java +9 −2 Original line number Diff line number Diff line Loading @@ -206,8 +206,15 @@ public abstract class BatteryStats implements Parcelable { * - CPU frequency time per uid * New in version 22: * - BLE scan result background count, BLE unoptimized scan time */ static final String CHECKIN_VERSION = "24"; * - Background partial wakelock time & count * New in version 23: * - Logging smeared power model values * New in version 24: * - Fixed bugs in background timers and BLE scan time * New in version 25: * - Package wakeup alarms are now on screen-off timebase */ static final String CHECKIN_VERSION = "25"; /** * Old version, we hit 9 and ran out of room, need to remove. Loading core/java/com/android/internal/os/BatteryStatsImpl.java +5 −4 Original line number Diff line number Diff line Loading @@ -119,7 +119,7 @@ public class BatteryStatsImpl extends BatteryStats { private static final int MAGIC = 0xBA757475; // 'BATSTATS' // Current on-disk Parcel version private static final int VERSION = 162 + (USE_OLD_HISTORY ? 1000 : 0); private static final int VERSION = 163 + (USE_OLD_HISTORY ? 1000 : 0); // Maximum number of items we will record in the history. private static final int MAX_HISTORY_ITEMS; Loading Loading @@ -8043,6 +8043,7 @@ public class BatteryStatsImpl extends BatteryStats { /** * Number of times wakeup alarms have occurred for this app. * On screen-off timebase starting in report v25. */ ArrayMap<String, Counter> mWakeupAlarms = new ArrayMap<>(); Loading Loading @@ -8071,7 +8072,7 @@ public class BatteryStatsImpl extends BatteryStats { mWakeupAlarms.clear(); for (int i=0; i<numWA; i++) { String tag = in.readString(); mWakeupAlarms.put(tag, new Counter(mBsi.mOnBatteryTimeBase, in)); mWakeupAlarms.put(tag, new Counter(mBsi.mOnBatteryScreenOffTimeBase, in)); } int numServs = in.readInt(); Loading Loading @@ -8110,7 +8111,7 @@ public class BatteryStatsImpl extends BatteryStats { public void noteWakeupAlarmLocked(String tag) { Counter c = mWakeupAlarms.get(tag); if (c == null) { c = new Counter(mBsi.mOnBatteryTimeBase); c = new Counter(mBsi.mOnBatteryScreenOffTimeBase); mWakeupAlarms.put(tag, c); } c.stepAtomic(); Loading Loading @@ -11867,7 +11868,7 @@ public class BatteryStatsImpl extends BatteryStats { p.mWakeupAlarms.clear(); for (int iwa=0; iwa<NWA; iwa++) { String tag = in.readString(); Counter c = new Counter(mOnBatteryTimeBase); Counter c = new Counter(mOnBatteryScreenOffTimeBase); c.readSummaryFromParcelLocked(in); p.mWakeupAlarms.put(tag, c); } Loading core/tests/coretests/src/com/android/internal/os/BatteryStatsSensorTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -488,7 +488,7 @@ public class BatteryStatsSensorTest extends TestCase { bi.noteStartSensorLocked(UID, SENSOR_ID); clocks.realtime += 111; clocks.uptime += 1111; clocks.uptime += 111; // Timebase and timer was on so times have increased. assertEquals(111_000, timer.getTotalTimeLocked(1000*clocks.realtime, which)); Loading Loading
core/java/android/os/BatteryStats.java +9 −2 Original line number Diff line number Diff line Loading @@ -206,8 +206,15 @@ public abstract class BatteryStats implements Parcelable { * - CPU frequency time per uid * New in version 22: * - BLE scan result background count, BLE unoptimized scan time */ static final String CHECKIN_VERSION = "24"; * - Background partial wakelock time & count * New in version 23: * - Logging smeared power model values * New in version 24: * - Fixed bugs in background timers and BLE scan time * New in version 25: * - Package wakeup alarms are now on screen-off timebase */ static final String CHECKIN_VERSION = "25"; /** * Old version, we hit 9 and ran out of room, need to remove. Loading
core/java/com/android/internal/os/BatteryStatsImpl.java +5 −4 Original line number Diff line number Diff line Loading @@ -119,7 +119,7 @@ public class BatteryStatsImpl extends BatteryStats { private static final int MAGIC = 0xBA757475; // 'BATSTATS' // Current on-disk Parcel version private static final int VERSION = 162 + (USE_OLD_HISTORY ? 1000 : 0); private static final int VERSION = 163 + (USE_OLD_HISTORY ? 1000 : 0); // Maximum number of items we will record in the history. private static final int MAX_HISTORY_ITEMS; Loading Loading @@ -8043,6 +8043,7 @@ public class BatteryStatsImpl extends BatteryStats { /** * Number of times wakeup alarms have occurred for this app. * On screen-off timebase starting in report v25. */ ArrayMap<String, Counter> mWakeupAlarms = new ArrayMap<>(); Loading Loading @@ -8071,7 +8072,7 @@ public class BatteryStatsImpl extends BatteryStats { mWakeupAlarms.clear(); for (int i=0; i<numWA; i++) { String tag = in.readString(); mWakeupAlarms.put(tag, new Counter(mBsi.mOnBatteryTimeBase, in)); mWakeupAlarms.put(tag, new Counter(mBsi.mOnBatteryScreenOffTimeBase, in)); } int numServs = in.readInt(); Loading Loading @@ -8110,7 +8111,7 @@ public class BatteryStatsImpl extends BatteryStats { public void noteWakeupAlarmLocked(String tag) { Counter c = mWakeupAlarms.get(tag); if (c == null) { c = new Counter(mBsi.mOnBatteryTimeBase); c = new Counter(mBsi.mOnBatteryScreenOffTimeBase); mWakeupAlarms.put(tag, c); } c.stepAtomic(); Loading Loading @@ -11867,7 +11868,7 @@ public class BatteryStatsImpl extends BatteryStats { p.mWakeupAlarms.clear(); for (int iwa=0; iwa<NWA; iwa++) { String tag = in.readString(); Counter c = new Counter(mOnBatteryTimeBase); Counter c = new Counter(mOnBatteryScreenOffTimeBase); c.readSummaryFromParcelLocked(in); p.mWakeupAlarms.put(tag, c); } Loading
core/tests/coretests/src/com/android/internal/os/BatteryStatsSensorTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -488,7 +488,7 @@ public class BatteryStatsSensorTest extends TestCase { bi.noteStartSensorLocked(UID, SENSOR_ID); clocks.realtime += 111; clocks.uptime += 1111; clocks.uptime += 111; // Timebase and timer was on so times have increased. assertEquals(111_000, timer.getTotalTimeLocked(1000*clocks.realtime, which)); Loading