Merge "Persist Standby Buckets after System defaults set"
This commit is contained in:
committed by
Android (Google) Code Review
commit
08a517e2a9
@@ -508,6 +508,16 @@ public class AppIdleHistory {
|
||||
Integer.toString(userId)), APP_IDLE_FILENAME);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if App Idle File exists on disk
|
||||
* @param userId
|
||||
* @return true if file exists
|
||||
*/
|
||||
public boolean userFileExists(int userId) {
|
||||
return getUserFile(userId).exists();
|
||||
}
|
||||
|
||||
private void readAppIdleTimes(int userId, ArrayMap<String, AppUsageHistory> userHistory) {
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
|
||||
@@ -377,7 +377,12 @@ public class AppStandbyController {
|
||||
|
||||
mSystemServicesReady = true;
|
||||
|
||||
if (mPendingInitializeDefaults) {
|
||||
boolean userFileExists;
|
||||
synchronized (mAppIdleLock) {
|
||||
userFileExists = mAppIdleHistory.userFileExists(UserHandle.USER_SYSTEM);
|
||||
}
|
||||
|
||||
if (mPendingInitializeDefaults || !userFileExists) {
|
||||
initializeDefaultsForSystemApps(UserHandle.USER_SYSTEM);
|
||||
}
|
||||
|
||||
@@ -1435,6 +1440,8 @@ public class AppStandbyController {
|
||||
elapsedRealtime + mSystemUpdateUsageTimeoutMillis);
|
||||
}
|
||||
}
|
||||
// Immediately persist defaults to disk
|
||||
mAppIdleHistory.writeAppIdleTimes(userId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user