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

Commit 60b98d39 authored by Philip P. Moltmann's avatar Philip P. Moltmann Committed by Android (Google) Code Review
Browse files

Merge "Do not write if apply() did not change the file."

parents 162ea7f0 46771b90
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) {