Loading core/java/android/os/BatteryStats.java +27 −4 Original line number Diff line number Diff line Loading @@ -183,8 +183,10 @@ public abstract class BatteryStats implements Parcelable { * - Wakelock data (wl) gets current and max times. * New in version 20: * - Background timers and counters for: Sensor, BluetoothScan, WifiScan, Jobs, Syncs. * New in version 21: * - Actual (not just apportioned) Wakelock time is also recorded. */ static final String CHECKIN_VERSION = "20"; static final String CHECKIN_VERSION = "21"; /** * Old version, we hit 9 and ran out of room, need to remove. Loading @@ -205,6 +207,12 @@ public abstract class BatteryStats implements Parcelable { private static final String VIBRATOR_DATA = "vib"; private static final String FOREGROUND_DATA = "fg"; private static final String STATE_TIME_DATA = "st"; // wl line is: // BATTERY_STATS_CHECKIN_VERSION, uid, which, "wl", name, // full totalTime, 'f', count, current duration, max duration, total duration, // partial totalTime, 'p', 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] private static final String WAKELOCK_DATA = "wl"; private static final String SYNC_DATA = "sy"; private static final String JOB_DATA = "jb"; Loading Loading @@ -2659,6 +2667,12 @@ public abstract class BatteryStats implements Parcelable { sb.append(" max="); sb.append(maxDurationMs); } // Put actual time if it is available and different from totalTimeMillis. final long totalDurMs = timer.getTotalDurationMsLocked(elapsedRealtimeUs/1000); if (totalDurMs > totalTimeMillis) { sb.append(" actual="); sb.append(totalDurMs); } if (timer.isRunningLocked()) { final long currentMs = timer.getCurrentDurationMsLocked(elapsedRealtimeUs/1000); if (currentMs >= 0) { Loading Loading @@ -2744,11 +2758,13 @@ public abstract class BatteryStats implements Parcelable { int count = 0; long max = -1; long current = -1; long totalDuration = -1; if (timer != null) { totalTimeMicros = timer.getTotalTimeLocked(elapsedRealtimeUs, which); count = timer.getCountLocked(which); current = timer.getCurrentDurationMsLocked(elapsedRealtimeUs/1000); max = timer.getMaxDurationMsLocked(elapsedRealtimeUs/1000); totalDuration = timer.getTotalDurationMsLocked(elapsedRealtimeUs/1000); } sb.append(linePrefix); sb.append((totalTimeMicros + 500) / 1000); // microseconds to milliseconds with rounding Loading @@ -2759,6 +2775,13 @@ public abstract class BatteryStats implements Parcelable { sb.append(current); sb.append(','); sb.append(max); // Partial, full, and window wakelocks are pooled, so totalDuration is meaningful (albeit // not always tracked). Kernel wakelocks (which have name == null) have no notion of // totalDuration independent of totalTimeMicros (since they are not pooled). if (name != null) { sb.append(','); sb.append(totalDuration); } return ","; } Loading Loading
core/java/android/os/BatteryStats.java +27 −4 Original line number Diff line number Diff line Loading @@ -183,8 +183,10 @@ public abstract class BatteryStats implements Parcelable { * - Wakelock data (wl) gets current and max times. * New in version 20: * - Background timers and counters for: Sensor, BluetoothScan, WifiScan, Jobs, Syncs. * New in version 21: * - Actual (not just apportioned) Wakelock time is also recorded. */ static final String CHECKIN_VERSION = "20"; static final String CHECKIN_VERSION = "21"; /** * Old version, we hit 9 and ran out of room, need to remove. Loading @@ -205,6 +207,12 @@ public abstract class BatteryStats implements Parcelable { private static final String VIBRATOR_DATA = "vib"; private static final String FOREGROUND_DATA = "fg"; private static final String STATE_TIME_DATA = "st"; // wl line is: // BATTERY_STATS_CHECKIN_VERSION, uid, which, "wl", name, // full totalTime, 'f', count, current duration, max duration, total duration, // partial totalTime, 'p', 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] private static final String WAKELOCK_DATA = "wl"; private static final String SYNC_DATA = "sy"; private static final String JOB_DATA = "jb"; Loading Loading @@ -2659,6 +2667,12 @@ public abstract class BatteryStats implements Parcelable { sb.append(" max="); sb.append(maxDurationMs); } // Put actual time if it is available and different from totalTimeMillis. final long totalDurMs = timer.getTotalDurationMsLocked(elapsedRealtimeUs/1000); if (totalDurMs > totalTimeMillis) { sb.append(" actual="); sb.append(totalDurMs); } if (timer.isRunningLocked()) { final long currentMs = timer.getCurrentDurationMsLocked(elapsedRealtimeUs/1000); if (currentMs >= 0) { Loading Loading @@ -2744,11 +2758,13 @@ public abstract class BatteryStats implements Parcelable { int count = 0; long max = -1; long current = -1; long totalDuration = -1; if (timer != null) { totalTimeMicros = timer.getTotalTimeLocked(elapsedRealtimeUs, which); count = timer.getCountLocked(which); current = timer.getCurrentDurationMsLocked(elapsedRealtimeUs/1000); max = timer.getMaxDurationMsLocked(elapsedRealtimeUs/1000); totalDuration = timer.getTotalDurationMsLocked(elapsedRealtimeUs/1000); } sb.append(linePrefix); sb.append((totalTimeMicros + 500) / 1000); // microseconds to milliseconds with rounding Loading @@ -2759,6 +2775,13 @@ public abstract class BatteryStats implements Parcelable { sb.append(current); sb.append(','); sb.append(max); // Partial, full, and window wakelocks are pooled, so totalDuration is meaningful (albeit // not always tracked). Kernel wakelocks (which have name == null) have no notion of // totalDuration independent of totalTimeMicros (since they are not pooled). if (name != null) { sb.append(','); sb.append(totalDuration); } return ","; } Loading