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

Commit 128fb2f8 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 broken" into main

parents a6646529 2ba72c06
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -1110,8 +1110,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 {
@@ -1122,9 +1125,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) {