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

Commit fb224c59 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[SettingsProvider] do not crash the system if config settings files are...

Merge "[SettingsProvider] do not crash the system if config settings files are broken" into udc-qpr-dev
parents 03aae8eb 9455659b
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -1125,8 +1125,11 @@ final class SettingsState {
        } catch (FileNotFoundException fnfe) {
            final String message = "No fallback file found for: " + mStatePersistFile;
            Slog.wtf(LOG_TAG, message);
            if (!isConfigSettingsKey(mKey)) {
                // Allow partially deserialized config settings because they can be updated later
                throw new IllegalStateException(message);
            }
        }
        if (parseStateFromXmlStreamLocked(in)) {
            // Parsed state from fallback file. Restore original file with fallback file
            try {
@@ -1137,9 +1140,12 @@ final class SettingsState {
        } else {
            final String message = "Failed parsing settings file: " + mStatePersistFile;
            Slog.wtf(LOG_TAG, message);
            if (!isConfigSettingsKey(mKey)) {
                // Allow partially deserialized config settings because they can be updated later
                throw new IllegalStateException(message);
            }
        }
    }

    @GuardedBy("mLock")
    private boolean parseStateFromXmlStreamLocked(FileInputStream in) {