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

Commit 764a7901 authored by Philip P. Moltmann's avatar Philip P. Moltmann Committed by android-build-merger
Browse files

Do not write if apply() did not change the file. am: 1f99f81b

am: 331a4bb8

Change-Id: I068dcbfcdaffff85379d422a9c53aafe7caa01c2
parents 0aa51388 331a4bb8
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -592,20 +592,20 @@ final class SharedPreferencesImpl implements SharedPreferences {
        if (mFile.exists()) {
            boolean needsWrite = false;

            if (isFromSyncCommit) {
            // Only need to write if the disk state is older than this commit
            if (mDiskStateGeneration < mcr.memoryStateGeneration) {
                if (isFromSyncCommit) {
                    needsWrite = true;
                }
                } else {
                    synchronized (this) {
                    // No need to persist intermediate states. Just wait for the latest state to be
                    // persisted.
                        // No need to persist intermediate states. Just wait for the latest state to
                        // be persisted.
                        if (mCurrentMemoryStateGeneration == mcr.memoryStateGeneration) {
                            needsWrite = true;
                        }
                    }
                }
            }

            if (!needsWrite) {
                if (DEBUG) {