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

Commit 08a517e2 authored by Michael Wachenschwanz's avatar Michael Wachenschwanz Committed by Android (Google) Code Review
Browse files

Merge "Persist Standby Buckets after System defaults set"

parents 6b69dab5 d1d8aa66
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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 {
+8 −1
Original line number Diff line number Diff line
@@ -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);
        }
    }