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

Commit da5e6213 authored by Danny Baumann's avatar Danny Baumann Committed by Gerrit Code Review
Browse files

Merge "Factor out preference-in-storage check to overridable method." into cm-10.2

parents 08b3a5c1 2f85e4a4
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -1312,10 +1312,18 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis
        mDefaultValue = defaultValue;
    }
    
    /**
     * Returns whether the preference can be found in persistent storage
     * @hide
     */
    protected boolean isPersisted() {
        return getSharedPreferences().contains(mKey);
    }

    private void dispatchSetInitialValue() {
        // By now, we know if we are persistent.
        final boolean shouldPersist = shouldPersist();
        if (!shouldPersist || !getSharedPreferences().contains(mKey)) {
        if (!shouldPersist || !isPersisted()) {
            if (mDefaultValue != null) {
                onSetInitialValue(false, mDefaultValue);
            }