Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0a1ae1bc authored by Adam Bookatz's avatar Adam Bookatz Committed by Android (Google) Code Review
Browse files

Merge "Package wakeup alarms are now on screen-off timebase" into oc-mr1-dev

parents cb921c1e 98d4d5cf
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -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.
+5 −4
Original line number Diff line number Diff line
@@ -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;
@@ -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<>();

@@ -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();
@@ -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();
@@ -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);
                }
+1 −1
Original line number Diff line number Diff line
@@ -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));