Update callback delay when constant changes.

Update the delay of the ACTION_CHARGING/DISCHARGING broadcast whenever
the delay constant is updated to ensure that tests can run smoothly.

Bug: 214599394
Test: atest --rerun-until-failure 25 CtsJobSchedulerTestCases:BatteryConstraintTest
Test: atest --rerun-until-failure 25 CtsJobSchedulerTestCases:JobThrottlingTest
Change-Id: Ic664fa58edb3cab9980759baf356457158f66ead
This commit is contained in:
Kweku Adams
2022-01-28 23:10:32 +00:00
parent 4ab2c3c602
commit 87f7b33534

View File

@@ -16109,6 +16109,11 @@ public class BatteryStatsImpl extends BatteryStats {
BATTERY_CHARGED_DELAY_MS = delay >= 0 ? delay : mParser.getInt(
KEY_BATTERY_CHARGED_DELAY_MS,
DEFAULT_BATTERY_CHARGED_DELAY_MS);
if (mHandler.hasCallbacks(mDeferSetCharging)) {
mHandler.removeCallbacks(mDeferSetCharging);
mHandler.postDelayed(mDeferSetCharging, BATTERY_CHARGED_DELAY_MS);
}
}
private void updateKernelUidReadersThrottleTime(long oldTimeMs, long newTimeMs) {