Loading core/java/android/os/BatteryStats.java +2 −2 Original line number Diff line number Diff line Loading @@ -7787,7 +7787,7 @@ public abstract class BatteryStats { // This is called from BatteryStatsService. @SuppressWarnings("unused") public void dumpCheckin(Context context, PrintWriter pw, List<ApplicationInfo> apps, int flags, long histStart, BatteryStatsDumpHelper dumpHelper) { long histStart, BatteryStatsDumpHelper dumpHelper, long monotonicCheckinStartTime) { synchronized (this) { prepareForDumpLocked(); Loading @@ -7797,7 +7797,7 @@ public abstract class BatteryStats { } if ((flags & (DUMP_INCLUDE_HISTORY | DUMP_HISTORY_ONLY)) != 0) { dumpHistory(pw, flags, histStart, true, 0); dumpHistory(pw, flags, histStart, true, monotonicCheckinStartTime); } if ((flags & DUMP_HISTORY_ONLY) != 0) { Loading core/res/res/values/config_battery_stats.xml +5 −0 Original line number Diff line number Diff line Loading @@ -66,4 +66,9 @@ It only affects the `dumpsys batterystats -a` command --> <integer name="config_batteryHistoryDumpWindowSize">86400000</integer> <!-- Time span of battery history dump, in milliseconds, default value is 0 milliseconds. It only affects the `dumpsys batterystats -c` command, The checkin Format --> <integer name="config_batteryHistoryDumpCheckinWindowSize">0</integer> </resources> core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -5466,6 +5466,7 @@ <java-symbol type="integer" name="config_accumulatedBatteryUsageStatsSpanSize" /> <java-symbol type="integer" name="config_batteryHistoryStorageSize" /> <java-symbol type="integer" name="config_batteryHistoryDumpWindowSize" /> <java-symbol type="integer" name="config_batteryHistoryDumpCheckinWindowSize" /> <!--Dynamic Tokens--> <java-symbol name="system_accent1_0_light" type="color"/> Loading services/core/java/com/android/server/am/BatteryStatsService.java +21 −6 Original line number Diff line number Diff line Loading @@ -3134,6 +3134,18 @@ public final class BatteryStatsService extends IBatteryStats.Stub } else if ("-c".equals(arg)) { useCheckinFormat = true; flags |= BatteryStats.DUMP_INCLUDE_HISTORY; if (Flags.checkinHistoryStartTime()) { long checkinDurationLimit = mContext.getResources().getInteger( com.android.internal.R.integer .config_batteryHistoryDumpCheckinWindowSize); if (checkinDurationLimit > 0) { monotonicClockStartTime = mMonotonicClock.monotonicTime() - checkinDurationLimit; if (monotonicClockStartTime < 0) { monotonicClockStartTime = 0; } } } } else if ("--proto".equals(arg)) { toProto = true; } else if ("--charged".equals(arg)) { Loading Loading @@ -3238,12 +3250,14 @@ public final class BatteryStatsService extends IBatteryStats.Stub return; } else if ("-a".equals(arg)) { flags |= BatteryStats.DUMP_VERBOSE; monotonicClockStartTime = mMonotonicClock.monotonicTime() - mContext.getResources().getInteger( long durationLimit = mContext.getResources().getInteger( com.android.internal.R.integer.config_batteryHistoryDumpWindowSize); if (durationLimit > 0) { monotonicClockStartTime = mMonotonicClock.monotonicTime() - durationLimit; if (monotonicClockStartTime < 0) { monotonicClockStartTime = 0; } } } else if ("-v".equals(arg)) { flags |= BatteryStats.DUMP_VERBOSE; } else if ("--sync".equals(arg)) { Loading Loading @@ -3364,7 +3378,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub checkinStats.readSummaryFromParcel(in); in.recycle(); checkinStats.dumpCheckin(mContext, pw, apps, flags, historyStart, mDumpHelper); historyStart, mDumpHelper, monotonicClockStartTime); mStats.mCheckinFile.delete(); return; } Loading @@ -3377,7 +3391,8 @@ public final class BatteryStatsService extends IBatteryStats.Stub } if (DBG) Slog.d(TAG, "begin dumpCheckin from UID " + Binder.getCallingUid()); awaitCompletion(); mStats.dumpCheckin(mContext, pw, apps, flags, historyStart, mDumpHelper); mStats.dumpCheckin(mContext, pw, apps, flags, historyStart, mDumpHelper, monotonicClockStartTime); if (writeData) { mStats.writeAsyncLocked(); } Loading services/core/java/com/android/server/power/stats/flags.aconfig +8 −0 Original line number Diff line number Diff line Loading @@ -38,3 +38,11 @@ flag { bug: "364350206" is_fixed_read_only: true } flag { namespace: "backstage_power" name: "checkin_history_start_time" description: "Add duration limit to battery stats check in (csv) format" bug: "403599628" is_fixed_read_only: true } Loading
core/java/android/os/BatteryStats.java +2 −2 Original line number Diff line number Diff line Loading @@ -7787,7 +7787,7 @@ public abstract class BatteryStats { // This is called from BatteryStatsService. @SuppressWarnings("unused") public void dumpCheckin(Context context, PrintWriter pw, List<ApplicationInfo> apps, int flags, long histStart, BatteryStatsDumpHelper dumpHelper) { long histStart, BatteryStatsDumpHelper dumpHelper, long monotonicCheckinStartTime) { synchronized (this) { prepareForDumpLocked(); Loading @@ -7797,7 +7797,7 @@ public abstract class BatteryStats { } if ((flags & (DUMP_INCLUDE_HISTORY | DUMP_HISTORY_ONLY)) != 0) { dumpHistory(pw, flags, histStart, true, 0); dumpHistory(pw, flags, histStart, true, monotonicCheckinStartTime); } if ((flags & DUMP_HISTORY_ONLY) != 0) { Loading
core/res/res/values/config_battery_stats.xml +5 −0 Original line number Diff line number Diff line Loading @@ -66,4 +66,9 @@ It only affects the `dumpsys batterystats -a` command --> <integer name="config_batteryHistoryDumpWindowSize">86400000</integer> <!-- Time span of battery history dump, in milliseconds, default value is 0 milliseconds. It only affects the `dumpsys batterystats -c` command, The checkin Format --> <integer name="config_batteryHistoryDumpCheckinWindowSize">0</integer> </resources>
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -5466,6 +5466,7 @@ <java-symbol type="integer" name="config_accumulatedBatteryUsageStatsSpanSize" /> <java-symbol type="integer" name="config_batteryHistoryStorageSize" /> <java-symbol type="integer" name="config_batteryHistoryDumpWindowSize" /> <java-symbol type="integer" name="config_batteryHistoryDumpCheckinWindowSize" /> <!--Dynamic Tokens--> <java-symbol name="system_accent1_0_light" type="color"/> Loading
services/core/java/com/android/server/am/BatteryStatsService.java +21 −6 Original line number Diff line number Diff line Loading @@ -3134,6 +3134,18 @@ public final class BatteryStatsService extends IBatteryStats.Stub } else if ("-c".equals(arg)) { useCheckinFormat = true; flags |= BatteryStats.DUMP_INCLUDE_HISTORY; if (Flags.checkinHistoryStartTime()) { long checkinDurationLimit = mContext.getResources().getInteger( com.android.internal.R.integer .config_batteryHistoryDumpCheckinWindowSize); if (checkinDurationLimit > 0) { monotonicClockStartTime = mMonotonicClock.monotonicTime() - checkinDurationLimit; if (monotonicClockStartTime < 0) { monotonicClockStartTime = 0; } } } } else if ("--proto".equals(arg)) { toProto = true; } else if ("--charged".equals(arg)) { Loading Loading @@ -3238,12 +3250,14 @@ public final class BatteryStatsService extends IBatteryStats.Stub return; } else if ("-a".equals(arg)) { flags |= BatteryStats.DUMP_VERBOSE; monotonicClockStartTime = mMonotonicClock.monotonicTime() - mContext.getResources().getInteger( long durationLimit = mContext.getResources().getInteger( com.android.internal.R.integer.config_batteryHistoryDumpWindowSize); if (durationLimit > 0) { monotonicClockStartTime = mMonotonicClock.monotonicTime() - durationLimit; if (monotonicClockStartTime < 0) { monotonicClockStartTime = 0; } } } else if ("-v".equals(arg)) { flags |= BatteryStats.DUMP_VERBOSE; } else if ("--sync".equals(arg)) { Loading Loading @@ -3364,7 +3378,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub checkinStats.readSummaryFromParcel(in); in.recycle(); checkinStats.dumpCheckin(mContext, pw, apps, flags, historyStart, mDumpHelper); historyStart, mDumpHelper, monotonicClockStartTime); mStats.mCheckinFile.delete(); return; } Loading @@ -3377,7 +3391,8 @@ public final class BatteryStatsService extends IBatteryStats.Stub } if (DBG) Slog.d(TAG, "begin dumpCheckin from UID " + Binder.getCallingUid()); awaitCompletion(); mStats.dumpCheckin(mContext, pw, apps, flags, historyStart, mDumpHelper); mStats.dumpCheckin(mContext, pw, apps, flags, historyStart, mDumpHelper, monotonicClockStartTime); if (writeData) { mStats.writeAsyncLocked(); } Loading
services/core/java/com/android/server/power/stats/flags.aconfig +8 −0 Original line number Diff line number Diff line Loading @@ -38,3 +38,11 @@ flag { bug: "364350206" is_fixed_read_only: true } flag { namespace: "backstage_power" name: "checkin_history_start_time" description: "Add duration limit to battery stats check in (csv) format" bug: "403599628" is_fixed_read_only: true }