Postpone headless app caching to after boot.
Moving the headless app cache loading to the background thread still affects boot time. Moving the loading to after boot has completed means that it will no longer impact boot time. Bug: 159057406 Bug: 159434503 Test: atest CtsUsageStatsTestCases:UsageStatsTest Test: atest FrameworksServicesTests:AppIdleHistoryTests Test: atest FrameworksServicesTests:AppStandbyControllerTests Test: Confirm SystemServerTiming_OnBootPhase_500_com.android.server.BinderCallsStatsService$LifeCycle timing decreases Change-Id: Ib79939ed15f9886d4fea02f7eda172b8cc82b674
This commit is contained in:
@@ -463,9 +463,6 @@ public class AppStandbyController implements AppStandbyInternal {
|
||||
userFileExists = mAppIdleHistory.userFileExists(UserHandle.USER_SYSTEM);
|
||||
}
|
||||
|
||||
// Offload to handler thread to avoid boottime impact.
|
||||
mHandler.post(this::loadHeadlessSystemAppCache);
|
||||
|
||||
if (mPendingInitializeDefaults || !userFileExists) {
|
||||
initializeDefaultsForSystemApps(UserHandle.USER_SYSTEM);
|
||||
}
|
||||
@@ -475,6 +472,10 @@ public class AppStandbyController implements AppStandbyInternal {
|
||||
}
|
||||
} else if (phase == PHASE_BOOT_COMPLETED) {
|
||||
setChargingState(mInjector.isCharging());
|
||||
|
||||
// Offload to handler thread after boot completed to avoid boot time impact. This means
|
||||
// that headless system apps may be put in a lower bucket until boot has completed.
|
||||
mHandler.post(this::loadHeadlessSystemAppCache);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user