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

Commit 5dd8f6c0 authored by Dhavalkumar Chaudhary's avatar Dhavalkumar Chaudhary
Browse files

Add duration limit for batterystats real checkin format

Bug: 415832345

Test: presubmit
Flag: com.android.server.power.optimization.real_checkin_history_start_time
Change-Id: Ie088af23ce6691c8da035060317bc1c3f8bb093b
parent eb831e34
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -64,5 +64,9 @@
    It only affects the `dumpsys batterystats -c` command, The checkin Format -->
    <integer name="config_batteryHistoryDumpCheckinWindowSize">0</integer>

    <!-- Time span of battery history dump, in milliseconds, default value is 24 hours in millis.
    It only affects the `dumpsys batterystats -\-checkin` command, The real checkin Format -->
    <integer name="config_batteryHistoryDumpRealCheckinWindowSize">86400000</integer>


</resources>
+1 −0
Original line number Diff line number Diff line
@@ -5462,6 +5462,7 @@
  <java-symbol type="integer" name="config_batteryHistoryStorageSize" />
  <java-symbol type="integer" name="config_batteryHistoryDumpWindowSize" />
  <java-symbol type="integer" name="config_batteryHistoryDumpCheckinWindowSize" />
  <java-symbol type="integer" name="config_batteryHistoryDumpRealCheckinWindowSize" />

  <!--Dynamic Tokens-->
  <java-symbol name="system_accent1_0_light" type="color"/>
+12 −0
Original line number Diff line number Diff line
@@ -3114,6 +3114,18 @@ public final class BatteryStatsService extends IBatteryStats.Stub
                if ("--checkin".equals(arg)) {
                    useCheckinFormat = true;
                    isRealCheckin = true;
                    if (Flags.realCheckinHistoryStartTime()) {
                        long realCheckinDurationLimit = mContext.getResources().getInteger(
                                com.android.internal.R.integer
                                .config_batteryHistoryDumpRealCheckinWindowSize);
                        if (realCheckinDurationLimit > 0) {
                            monotonicClockStartTime =
                                mMonotonicClock.monotonicTime() - realCheckinDurationLimit;
                            if (monotonicClockStartTime < 0) {
                                monotonicClockStartTime = 0;
                            }
                        }
                    }
                } else if ("--history".equals(arg)) {
                    flags |= BatteryStats.DUMP_HISTORY_ONLY;
                } else if ("--history-start".equals(arg)) {
+8 −0
Original line number Diff line number Diff line
@@ -46,3 +46,11 @@ flag {
     bug: "403599628"
     is_fixed_read_only: true
}

flag {
     namespace: "backstage_power"
     name: "real_checkin_history_start_time"
     description: "Add duration limit to battery stats real check in (csv) format"
     bug: "403599628"
     is_fixed_read_only: true
}