Loading core/java/android/os/BatteryStats.java +12 −5 Original line number Original line Diff line number Diff line Loading @@ -228,6 +228,7 @@ public abstract class BatteryStats implements Parcelable { // BATTERY_STATS_CHECKIN_VERSION, uid, which, "wl", name, // BATTERY_STATS_CHECKIN_VERSION, uid, which, "wl", name, // full totalTime, 'f', count, current duration, max duration, total duration, // full totalTime, 'f', count, current duration, max duration, total duration, // partial totalTime, 'p', count, current duration, max duration, total duration, // partial totalTime, 'p', count, current duration, max duration, total duration, // bg partial totalTime, 'bp', count, current duration, max duration, total duration, // window totalTime, 'w', count, current duration, max duration, total duration // window totalTime, 'w', count, current duration, max duration, total duration // [Currently, full and window wakelocks have durations current = max = total = -1] // [Currently, full and window wakelocks have durations current = max = total = -1] private static final String WAKELOCK_DATA = "wl"; private static final String WAKELOCK_DATA = "wl"; Loading Loading @@ -3500,8 +3501,11 @@ public abstract class BatteryStats implements Parcelable { sb.setLength(0); sb.setLength(0); linePrefix = printWakeLockCheckin(sb, wl.getWakeTime(WAKE_TYPE_FULL), linePrefix = printWakeLockCheckin(sb, wl.getWakeTime(WAKE_TYPE_FULL), rawRealtime, "f", which, linePrefix); rawRealtime, "f", which, linePrefix); linePrefix = printWakeLockCheckin(sb, wl.getWakeTime(WAKE_TYPE_PARTIAL), final Timer pTimer = wl.getWakeTime(WAKE_TYPE_PARTIAL); linePrefix = printWakeLockCheckin(sb, pTimer, rawRealtime, "p", which, linePrefix); rawRealtime, "p", which, linePrefix); linePrefix = printWakeLockCheckin(sb, pTimer != null ? pTimer.getSubTimer() : null, rawRealtime, "bp", which, linePrefix); linePrefix = printWakeLockCheckin(sb, wl.getWakeTime(WAKE_TYPE_WINDOW), linePrefix = printWakeLockCheckin(sb, wl.getWakeTime(WAKE_TYPE_WINDOW), rawRealtime, "w", which, linePrefix); rawRealtime, "w", which, linePrefix); Loading Loading @@ -4787,8 +4791,11 @@ public abstract class BatteryStats implements Parcelable { sb.append(wakelocks.keyAt(iw)); sb.append(wakelocks.keyAt(iw)); linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_FULL), rawRealtime, linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_FULL), rawRealtime, "full", which, linePrefix); "full", which, linePrefix); linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_PARTIAL), rawRealtime, final Timer pTimer = wl.getWakeTime(WAKE_TYPE_PARTIAL); linePrefix = printWakeLock(sb, pTimer, rawRealtime, "partial", which, linePrefix); "partial", which, linePrefix); linePrefix = printWakeLock(sb, pTimer != null ? pTimer.getSubTimer() : null, rawRealtime, "background partial", which, linePrefix); linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_WINDOW), rawRealtime, linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_WINDOW), rawRealtime, "window", which, linePrefix); "window", which, linePrefix); linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_DRAW), rawRealtime, linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_DRAW), rawRealtime, Loading core/java/com/android/internal/os/BatteryStatsImpl.java +65 −58 Original line number Original line Diff line number Diff line Loading @@ -116,7 +116,7 @@ public class BatteryStatsImpl extends BatteryStats { private static final int MAGIC = 0xBA757475; // 'BATSTATS' private static final int MAGIC = 0xBA757475; // 'BATSTATS' // Current on-disk Parcel version // Current on-disk Parcel version private static final int VERSION = 158 + (USE_OLD_HISTORY ? 1000 : 0); private static final int VERSION = 159 + (USE_OLD_HISTORY ? 1000 : 0); // Maximum number of items we will record in the history. // Maximum number of items we will record in the history. private static final int MAX_HISTORY_ITEMS = 2000; private static final int MAX_HISTORY_ITEMS = 2000; Loading Loading @@ -7114,7 +7114,8 @@ public class BatteryStatsImpl extends BatteryStats { for (int j = 0; j < numWakelocks; j++) { for (int j = 0; j < numWakelocks; j++) { String wakelockName = in.readString(); String wakelockName = in.readString(); Uid.Wakelock wakelock = new Wakelock(mBsi, this); Uid.Wakelock wakelock = new Wakelock(mBsi, this); wakelock.readFromParcelLocked(timeBase, screenOffTimeBase, in); wakelock.readFromParcelLocked( timeBase, screenOffTimeBase, mOnBatteryScreenOffBackgroundTimeBase, in); mWakelockStats.add(wakelockName, wakelock); mWakelockStats.add(wakelockName, wakelock); } } Loading Loading @@ -7391,8 +7392,9 @@ public class BatteryStatsImpl extends BatteryStats { /** /** * How long (in ms) this uid has been keeping the device partially awake. * How long (in ms) this uid has been keeping the device partially awake. * Tracks both the total time and the time while the app was in the background. */ */ DurationTimer mTimerPartial; DualTimer mTimerPartial; /** /** * How long (in ms) this uid has been keeping the device fully awake. * How long (in ms) this uid has been keeping the device fully awake. Loading Loading @@ -7437,13 +7439,13 @@ public class BatteryStatsImpl extends BatteryStats { * @param in the Parcel to be read from. * @param in the Parcel to be read from. * return a new Timer, or null. * return a new Timer, or null. */ */ private DurationTimer readDurationTimerFromParcel(int type, private DualTimer readDualTimerFromParcel(int type, ArrayList<StopwatchTimer> pool, ArrayList<StopwatchTimer> pool, TimeBase timeBase, Parcel in) { TimeBase timeBase, TimeBase bgTimeBase, Parcel in) { if (in.readInt() == 0) { if (in.readInt() == 0) { return null; return null; } } return new DurationTimer(mBsi.mClocks, mUid, type, pool, timeBase, in); return new DualTimer(mBsi.mClocks, mUid, type, pool, timeBase, bgTimeBase, in); } } boolean reset() { boolean reset() { Loading Loading @@ -7481,9 +7483,10 @@ public class BatteryStatsImpl extends BatteryStats { return !wlactive; return !wlactive; } } void readFromParcelLocked(TimeBase timeBase, TimeBase screenOffTimeBase, Parcel in) { void readFromParcelLocked(TimeBase timeBase, TimeBase screenOffTimeBase, mTimerPartial = readDurationTimerFromParcel(WAKE_TYPE_PARTIAL, TimeBase screenOffBgTimeBase, Parcel in) { mBsi.mPartialTimers, screenOffTimeBase, in); mTimerPartial = readDualTimerFromParcel(WAKE_TYPE_PARTIAL, mBsi.mPartialTimers, screenOffTimeBase, screenOffBgTimeBase, in); mTimerFull = readStopwatchTimerFromParcel(WAKE_TYPE_FULL, mTimerFull = readStopwatchTimerFromParcel(WAKE_TYPE_FULL, mBsi.mFullTimers, timeBase, in); mBsi.mFullTimers, timeBase, in); mTimerWindow = readStopwatchTimerFromParcel(WAKE_TYPE_WINDOW, mTimerWindow = readStopwatchTimerFromParcel(WAKE_TYPE_WINDOW, Loading @@ -7509,49 +7512,6 @@ public class BatteryStatsImpl extends BatteryStats { default: throw new IllegalArgumentException("type = " + type); default: throw new IllegalArgumentException("type = " + type); } } } } public StopwatchTimer getStopwatchTimer(int type) { switch (type) { case WAKE_TYPE_PARTIAL: { DurationTimer t = mTimerPartial; if (t == null) { t = new DurationTimer(mBsi.mClocks, mUid, WAKE_TYPE_PARTIAL, mBsi.mPartialTimers, mBsi.mOnBatteryScreenOffTimeBase); mTimerPartial = t; } return t; } case WAKE_TYPE_FULL: { StopwatchTimer t = mTimerFull; if (t == null) { t = new StopwatchTimer(mBsi.mClocks, mUid, WAKE_TYPE_FULL, mBsi.mFullTimers, mBsi.mOnBatteryTimeBase); mTimerFull = t; } return t; } case WAKE_TYPE_WINDOW: { StopwatchTimer t = mTimerWindow; if (t == null) { t = new StopwatchTimer(mBsi.mClocks, mUid, WAKE_TYPE_WINDOW, mBsi.mWindowTimers, mBsi.mOnBatteryTimeBase); mTimerWindow = t; } return t; } case WAKE_TYPE_DRAW: { StopwatchTimer t = mTimerDraw; if (t == null) { t = new StopwatchTimer(mBsi.mClocks, mUid, WAKE_TYPE_DRAW, mBsi.mDrawTimers, mBsi.mOnBatteryTimeBase); mTimerDraw = t; } return t; } default: throw new IllegalArgumentException("type=" + type); } } } } public static class Sensor extends BatteryStats.Uid.Sensor { public static class Sensor extends BatteryStats.Uid.Sensor { Loading Loading @@ -8444,16 +8404,16 @@ public class BatteryStatsImpl extends BatteryStats { Wakelock wl = new Wakelock(mBsi, this); Wakelock wl = new Wakelock(mBsi, this); mWakelockStats.add(wlName, wl); mWakelockStats.add(wlName, wl); if (in.readInt() != 0) { if (in.readInt() != 0) { wl.getStopwatchTimer(WAKE_TYPE_FULL).readSummaryFromParcelLocked(in); getWakelockTimerLocked(wl, WAKE_TYPE_FULL).readSummaryFromParcelLocked(in); } } if (in.readInt() != 0) { if (in.readInt() != 0) { wl.getStopwatchTimer(WAKE_TYPE_PARTIAL).readSummaryFromParcelLocked(in); getWakelockTimerLocked(wl, WAKE_TYPE_PARTIAL).readSummaryFromParcelLocked(in); } } if (in.readInt() != 0) { if (in.readInt() != 0) { wl.getStopwatchTimer(WAKE_TYPE_WINDOW).readSummaryFromParcelLocked(in); getWakelockTimerLocked(wl, WAKE_TYPE_WINDOW).readSummaryFromParcelLocked(in); } } if (in.readInt() != 0) { if (in.readInt() != 0) { wl.getStopwatchTimer(WAKE_TYPE_DRAW).readSummaryFromParcelLocked(in); getWakelockTimerLocked(wl, WAKE_TYPE_DRAW).readSummaryFromParcelLocked(in); } } } } Loading Loading @@ -8509,10 +8469,57 @@ public class BatteryStatsImpl extends BatteryStats { } } } } public StopwatchTimer getWakelockTimerLocked(Wakelock wl, int type) { if (wl == null) { return null; } switch (type) { case WAKE_TYPE_PARTIAL: { DualTimer t = wl.mTimerPartial; if (t == null) { t = new DualTimer(mBsi.mClocks, this, WAKE_TYPE_PARTIAL, mBsi.mPartialTimers, mBsi.mOnBatteryScreenOffTimeBase, mOnBatteryScreenOffBackgroundTimeBase); wl.mTimerPartial = t; } return t; } case WAKE_TYPE_FULL: { StopwatchTimer t = wl.mTimerFull; if (t == null) { t = new StopwatchTimer(mBsi.mClocks, this, WAKE_TYPE_FULL, mBsi.mFullTimers, mBsi.mOnBatteryTimeBase); wl.mTimerFull = t; } return t; } case WAKE_TYPE_WINDOW: { StopwatchTimer t = wl.mTimerWindow; if (t == null) { t = new StopwatchTimer(mBsi.mClocks, this, WAKE_TYPE_WINDOW, mBsi.mWindowTimers, mBsi.mOnBatteryTimeBase); wl.mTimerWindow = t; } return t; } case WAKE_TYPE_DRAW: { StopwatchTimer t = wl.mTimerDraw; if (t == null) { t = new StopwatchTimer(mBsi.mClocks, this, WAKE_TYPE_DRAW, mBsi.mDrawTimers, mBsi.mOnBatteryTimeBase); wl.mTimerDraw = t; } return t; } default: throw new IllegalArgumentException("type=" + type); } } public void noteStartWakeLocked(int pid, String name, int type, long elapsedRealtimeMs) { public void noteStartWakeLocked(int pid, String name, int type, long elapsedRealtimeMs) { Wakelock wl = mWakelockStats.startObject(name); Wakelock wl = mWakelockStats.startObject(name); if (wl != null) { if (wl != null) { wl.getStopwatchTimer(type).startRunningLocked(elapsedRealtimeMs); getWakelockTimerLocked(wl, type).startRunningLocked(elapsedRealtimeMs); } } if (type == WAKE_TYPE_PARTIAL) { if (type == WAKE_TYPE_PARTIAL) { createAggregatedPartialWakelockTimerLocked().startRunningLocked(elapsedRealtimeMs); createAggregatedPartialWakelockTimerLocked().startRunningLocked(elapsedRealtimeMs); Loading @@ -8528,7 +8535,7 @@ public class BatteryStatsImpl extends BatteryStats { public void noteStopWakeLocked(int pid, String name, int type, long elapsedRealtimeMs) { public void noteStopWakeLocked(int pid, String name, int type, long elapsedRealtimeMs) { Wakelock wl = mWakelockStats.stopObject(name); Wakelock wl = mWakelockStats.stopObject(name); if (wl != null) { if (wl != null) { wl.getStopwatchTimer(type).stopRunningLocked(elapsedRealtimeMs); getWakelockTimerLocked(wl, type).stopRunningLocked(elapsedRealtimeMs); } } if (type == WAKE_TYPE_PARTIAL) { if (type == WAKE_TYPE_PARTIAL) { if (mAggregatedPartialWakelockTimer != null) { if (mAggregatedPartialWakelockTimer != null) { Loading Loading
core/java/android/os/BatteryStats.java +12 −5 Original line number Original line Diff line number Diff line Loading @@ -228,6 +228,7 @@ public abstract class BatteryStats implements Parcelable { // BATTERY_STATS_CHECKIN_VERSION, uid, which, "wl", name, // BATTERY_STATS_CHECKIN_VERSION, uid, which, "wl", name, // full totalTime, 'f', count, current duration, max duration, total duration, // full totalTime, 'f', count, current duration, max duration, total duration, // partial totalTime, 'p', count, current duration, max duration, total duration, // partial totalTime, 'p', count, current duration, max duration, total duration, // bg partial totalTime, 'bp', count, current duration, max duration, total duration, // window totalTime, 'w', count, current duration, max duration, total duration // window totalTime, 'w', count, current duration, max duration, total duration // [Currently, full and window wakelocks have durations current = max = total = -1] // [Currently, full and window wakelocks have durations current = max = total = -1] private static final String WAKELOCK_DATA = "wl"; private static final String WAKELOCK_DATA = "wl"; Loading Loading @@ -3500,8 +3501,11 @@ public abstract class BatteryStats implements Parcelable { sb.setLength(0); sb.setLength(0); linePrefix = printWakeLockCheckin(sb, wl.getWakeTime(WAKE_TYPE_FULL), linePrefix = printWakeLockCheckin(sb, wl.getWakeTime(WAKE_TYPE_FULL), rawRealtime, "f", which, linePrefix); rawRealtime, "f", which, linePrefix); linePrefix = printWakeLockCheckin(sb, wl.getWakeTime(WAKE_TYPE_PARTIAL), final Timer pTimer = wl.getWakeTime(WAKE_TYPE_PARTIAL); linePrefix = printWakeLockCheckin(sb, pTimer, rawRealtime, "p", which, linePrefix); rawRealtime, "p", which, linePrefix); linePrefix = printWakeLockCheckin(sb, pTimer != null ? pTimer.getSubTimer() : null, rawRealtime, "bp", which, linePrefix); linePrefix = printWakeLockCheckin(sb, wl.getWakeTime(WAKE_TYPE_WINDOW), linePrefix = printWakeLockCheckin(sb, wl.getWakeTime(WAKE_TYPE_WINDOW), rawRealtime, "w", which, linePrefix); rawRealtime, "w", which, linePrefix); Loading Loading @@ -4787,8 +4791,11 @@ public abstract class BatteryStats implements Parcelable { sb.append(wakelocks.keyAt(iw)); sb.append(wakelocks.keyAt(iw)); linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_FULL), rawRealtime, linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_FULL), rawRealtime, "full", which, linePrefix); "full", which, linePrefix); linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_PARTIAL), rawRealtime, final Timer pTimer = wl.getWakeTime(WAKE_TYPE_PARTIAL); linePrefix = printWakeLock(sb, pTimer, rawRealtime, "partial", which, linePrefix); "partial", which, linePrefix); linePrefix = printWakeLock(sb, pTimer != null ? pTimer.getSubTimer() : null, rawRealtime, "background partial", which, linePrefix); linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_WINDOW), rawRealtime, linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_WINDOW), rawRealtime, "window", which, linePrefix); "window", which, linePrefix); linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_DRAW), rawRealtime, linePrefix = printWakeLock(sb, wl.getWakeTime(WAKE_TYPE_DRAW), rawRealtime, Loading
core/java/com/android/internal/os/BatteryStatsImpl.java +65 −58 Original line number Original line Diff line number Diff line Loading @@ -116,7 +116,7 @@ public class BatteryStatsImpl extends BatteryStats { private static final int MAGIC = 0xBA757475; // 'BATSTATS' private static final int MAGIC = 0xBA757475; // 'BATSTATS' // Current on-disk Parcel version // Current on-disk Parcel version private static final int VERSION = 158 + (USE_OLD_HISTORY ? 1000 : 0); private static final int VERSION = 159 + (USE_OLD_HISTORY ? 1000 : 0); // Maximum number of items we will record in the history. // Maximum number of items we will record in the history. private static final int MAX_HISTORY_ITEMS = 2000; private static final int MAX_HISTORY_ITEMS = 2000; Loading Loading @@ -7114,7 +7114,8 @@ public class BatteryStatsImpl extends BatteryStats { for (int j = 0; j < numWakelocks; j++) { for (int j = 0; j < numWakelocks; j++) { String wakelockName = in.readString(); String wakelockName = in.readString(); Uid.Wakelock wakelock = new Wakelock(mBsi, this); Uid.Wakelock wakelock = new Wakelock(mBsi, this); wakelock.readFromParcelLocked(timeBase, screenOffTimeBase, in); wakelock.readFromParcelLocked( timeBase, screenOffTimeBase, mOnBatteryScreenOffBackgroundTimeBase, in); mWakelockStats.add(wakelockName, wakelock); mWakelockStats.add(wakelockName, wakelock); } } Loading Loading @@ -7391,8 +7392,9 @@ public class BatteryStatsImpl extends BatteryStats { /** /** * How long (in ms) this uid has been keeping the device partially awake. * How long (in ms) this uid has been keeping the device partially awake. * Tracks both the total time and the time while the app was in the background. */ */ DurationTimer mTimerPartial; DualTimer mTimerPartial; /** /** * How long (in ms) this uid has been keeping the device fully awake. * How long (in ms) this uid has been keeping the device fully awake. Loading Loading @@ -7437,13 +7439,13 @@ public class BatteryStatsImpl extends BatteryStats { * @param in the Parcel to be read from. * @param in the Parcel to be read from. * return a new Timer, or null. * return a new Timer, or null. */ */ private DurationTimer readDurationTimerFromParcel(int type, private DualTimer readDualTimerFromParcel(int type, ArrayList<StopwatchTimer> pool, ArrayList<StopwatchTimer> pool, TimeBase timeBase, Parcel in) { TimeBase timeBase, TimeBase bgTimeBase, Parcel in) { if (in.readInt() == 0) { if (in.readInt() == 0) { return null; return null; } } return new DurationTimer(mBsi.mClocks, mUid, type, pool, timeBase, in); return new DualTimer(mBsi.mClocks, mUid, type, pool, timeBase, bgTimeBase, in); } } boolean reset() { boolean reset() { Loading Loading @@ -7481,9 +7483,10 @@ public class BatteryStatsImpl extends BatteryStats { return !wlactive; return !wlactive; } } void readFromParcelLocked(TimeBase timeBase, TimeBase screenOffTimeBase, Parcel in) { void readFromParcelLocked(TimeBase timeBase, TimeBase screenOffTimeBase, mTimerPartial = readDurationTimerFromParcel(WAKE_TYPE_PARTIAL, TimeBase screenOffBgTimeBase, Parcel in) { mBsi.mPartialTimers, screenOffTimeBase, in); mTimerPartial = readDualTimerFromParcel(WAKE_TYPE_PARTIAL, mBsi.mPartialTimers, screenOffTimeBase, screenOffBgTimeBase, in); mTimerFull = readStopwatchTimerFromParcel(WAKE_TYPE_FULL, mTimerFull = readStopwatchTimerFromParcel(WAKE_TYPE_FULL, mBsi.mFullTimers, timeBase, in); mBsi.mFullTimers, timeBase, in); mTimerWindow = readStopwatchTimerFromParcel(WAKE_TYPE_WINDOW, mTimerWindow = readStopwatchTimerFromParcel(WAKE_TYPE_WINDOW, Loading @@ -7509,49 +7512,6 @@ public class BatteryStatsImpl extends BatteryStats { default: throw new IllegalArgumentException("type = " + type); default: throw new IllegalArgumentException("type = " + type); } } } } public StopwatchTimer getStopwatchTimer(int type) { switch (type) { case WAKE_TYPE_PARTIAL: { DurationTimer t = mTimerPartial; if (t == null) { t = new DurationTimer(mBsi.mClocks, mUid, WAKE_TYPE_PARTIAL, mBsi.mPartialTimers, mBsi.mOnBatteryScreenOffTimeBase); mTimerPartial = t; } return t; } case WAKE_TYPE_FULL: { StopwatchTimer t = mTimerFull; if (t == null) { t = new StopwatchTimer(mBsi.mClocks, mUid, WAKE_TYPE_FULL, mBsi.mFullTimers, mBsi.mOnBatteryTimeBase); mTimerFull = t; } return t; } case WAKE_TYPE_WINDOW: { StopwatchTimer t = mTimerWindow; if (t == null) { t = new StopwatchTimer(mBsi.mClocks, mUid, WAKE_TYPE_WINDOW, mBsi.mWindowTimers, mBsi.mOnBatteryTimeBase); mTimerWindow = t; } return t; } case WAKE_TYPE_DRAW: { StopwatchTimer t = mTimerDraw; if (t == null) { t = new StopwatchTimer(mBsi.mClocks, mUid, WAKE_TYPE_DRAW, mBsi.mDrawTimers, mBsi.mOnBatteryTimeBase); mTimerDraw = t; } return t; } default: throw new IllegalArgumentException("type=" + type); } } } } public static class Sensor extends BatteryStats.Uid.Sensor { public static class Sensor extends BatteryStats.Uid.Sensor { Loading Loading @@ -8444,16 +8404,16 @@ public class BatteryStatsImpl extends BatteryStats { Wakelock wl = new Wakelock(mBsi, this); Wakelock wl = new Wakelock(mBsi, this); mWakelockStats.add(wlName, wl); mWakelockStats.add(wlName, wl); if (in.readInt() != 0) { if (in.readInt() != 0) { wl.getStopwatchTimer(WAKE_TYPE_FULL).readSummaryFromParcelLocked(in); getWakelockTimerLocked(wl, WAKE_TYPE_FULL).readSummaryFromParcelLocked(in); } } if (in.readInt() != 0) { if (in.readInt() != 0) { wl.getStopwatchTimer(WAKE_TYPE_PARTIAL).readSummaryFromParcelLocked(in); getWakelockTimerLocked(wl, WAKE_TYPE_PARTIAL).readSummaryFromParcelLocked(in); } } if (in.readInt() != 0) { if (in.readInt() != 0) { wl.getStopwatchTimer(WAKE_TYPE_WINDOW).readSummaryFromParcelLocked(in); getWakelockTimerLocked(wl, WAKE_TYPE_WINDOW).readSummaryFromParcelLocked(in); } } if (in.readInt() != 0) { if (in.readInt() != 0) { wl.getStopwatchTimer(WAKE_TYPE_DRAW).readSummaryFromParcelLocked(in); getWakelockTimerLocked(wl, WAKE_TYPE_DRAW).readSummaryFromParcelLocked(in); } } } } Loading Loading @@ -8509,10 +8469,57 @@ public class BatteryStatsImpl extends BatteryStats { } } } } public StopwatchTimer getWakelockTimerLocked(Wakelock wl, int type) { if (wl == null) { return null; } switch (type) { case WAKE_TYPE_PARTIAL: { DualTimer t = wl.mTimerPartial; if (t == null) { t = new DualTimer(mBsi.mClocks, this, WAKE_TYPE_PARTIAL, mBsi.mPartialTimers, mBsi.mOnBatteryScreenOffTimeBase, mOnBatteryScreenOffBackgroundTimeBase); wl.mTimerPartial = t; } return t; } case WAKE_TYPE_FULL: { StopwatchTimer t = wl.mTimerFull; if (t == null) { t = new StopwatchTimer(mBsi.mClocks, this, WAKE_TYPE_FULL, mBsi.mFullTimers, mBsi.mOnBatteryTimeBase); wl.mTimerFull = t; } return t; } case WAKE_TYPE_WINDOW: { StopwatchTimer t = wl.mTimerWindow; if (t == null) { t = new StopwatchTimer(mBsi.mClocks, this, WAKE_TYPE_WINDOW, mBsi.mWindowTimers, mBsi.mOnBatteryTimeBase); wl.mTimerWindow = t; } return t; } case WAKE_TYPE_DRAW: { StopwatchTimer t = wl.mTimerDraw; if (t == null) { t = new StopwatchTimer(mBsi.mClocks, this, WAKE_TYPE_DRAW, mBsi.mDrawTimers, mBsi.mOnBatteryTimeBase); wl.mTimerDraw = t; } return t; } default: throw new IllegalArgumentException("type=" + type); } } public void noteStartWakeLocked(int pid, String name, int type, long elapsedRealtimeMs) { public void noteStartWakeLocked(int pid, String name, int type, long elapsedRealtimeMs) { Wakelock wl = mWakelockStats.startObject(name); Wakelock wl = mWakelockStats.startObject(name); if (wl != null) { if (wl != null) { wl.getStopwatchTimer(type).startRunningLocked(elapsedRealtimeMs); getWakelockTimerLocked(wl, type).startRunningLocked(elapsedRealtimeMs); } } if (type == WAKE_TYPE_PARTIAL) { if (type == WAKE_TYPE_PARTIAL) { createAggregatedPartialWakelockTimerLocked().startRunningLocked(elapsedRealtimeMs); createAggregatedPartialWakelockTimerLocked().startRunningLocked(elapsedRealtimeMs); Loading @@ -8528,7 +8535,7 @@ public class BatteryStatsImpl extends BatteryStats { public void noteStopWakeLocked(int pid, String name, int type, long elapsedRealtimeMs) { public void noteStopWakeLocked(int pid, String name, int type, long elapsedRealtimeMs) { Wakelock wl = mWakelockStats.stopObject(name); Wakelock wl = mWakelockStats.stopObject(name); if (wl != null) { if (wl != null) { wl.getStopwatchTimer(type).stopRunningLocked(elapsedRealtimeMs); getWakelockTimerLocked(wl, type).stopRunningLocked(elapsedRealtimeMs); } } if (type == WAKE_TYPE_PARTIAL) { if (type == WAKE_TYPE_PARTIAL) { if (mAggregatedPartialWakelockTimer != null) { if (mAggregatedPartialWakelockTimer != null) { Loading