Avoid calling postOneTimeCheckIdleStates on boot.
When we used Settings flags, we didn't call postOneTimeCheckIdleStates()
on boot. Remove it from the boot path when using DeviceConfig to avoid
unnecessary work.
Bug: 172193270
Test: atest AppStandbyControllerTests
Change-Id: I6b05eb4a6565e49c051d3a2ca41986d873acf4e8
diff --git a/apex/jobscheduler/service/java/com/android/server/usage/AppStandbyController.java b/apex/jobscheduler/service/java/com/android/server/usage/AppStandbyController.java
index 6f7dde2..1157ee9 100644
--- a/apex/jobscheduler/service/java/com/android/server/usage/AppStandbyController.java
+++ b/apex/jobscheduler/service/java/com/android/server/usage/AppStandbyController.java
@@ -2390,7 +2390,8 @@
false, this);
mInjector.registerDeviceConfigPropertiesChangedListener(this);
// Load all the constants.
- onPropertiesChanged(mInjector.getDeviceConfigProperties());
+ // postOneTimeCheckIdleStates() doesn't need to be called on boot.
+ processProperties(mInjector.getDeviceConfigProperties());
updateSettings();
}
@@ -2402,6 +2403,11 @@
@Override
public void onPropertiesChanged(DeviceConfig.Properties properties) {
+ processProperties(properties);
+ postOneTimeCheckIdleStates();
+ }
+
+ private void processProperties(DeviceConfig.Properties properties) {
boolean timeThresholdsUpdated = false;
synchronized (mAppIdleLock) {
for (String name : properties.getKeyset()) {
@@ -2482,7 +2488,6 @@
}
}
}
- postOneTimeCheckIdleStates();
}
private void updateTimeThresholds() {