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

Commit ab6c2737 authored by Manjeet Rulhania's avatar Manjeet Rulhania Committed by Android (Google) Code Review
Browse files

Merge "Close file stream during app ops migration" into main

parents 3e8e34d7 d36042c3
Loading
Loading
Loading
Loading
+4 −9
Original line number Original line Diff line number Diff line
@@ -49,15 +49,7 @@ class LegacyAppOpStateParser {
     */
     */
    public int readState(AtomicFile file, SparseArray<SparseIntArray> uidModes,
    public int readState(AtomicFile file, SparseArray<SparseIntArray> uidModes,
            SparseArray<ArrayMap<String, SparseIntArray>> userPackageModes) {
            SparseArray<ArrayMap<String, SparseIntArray>> userPackageModes) {
        FileInputStream stream;
        try (FileInputStream stream = file.openRead()) {
        try {
            stream = file.openRead();
        } catch (FileNotFoundException e) {
            Slog.i(TAG, "No existing app ops " + file.getBaseFile() + "; starting empty");
            return NO_FILE_VERSION;
        }

        try {
            TypedXmlPullParser parser = Xml.resolvePullParser(stream);
            TypedXmlPullParser parser = Xml.resolvePullParser(stream);
            int type;
            int type;
            while ((type = parser.next()) != XmlPullParser.START_TAG
            while ((type = parser.next()) != XmlPullParser.START_TAG
@@ -95,6 +87,9 @@ class LegacyAppOpStateParser {
                }
                }
            }
            }
            return versionAtBoot;
            return versionAtBoot;
        } catch (FileNotFoundException e) {
            Slog.i(TAG, "No existing app ops " + file.getBaseFile() + "; starting empty");
            return NO_FILE_VERSION;
        } catch (XmlPullParserException e) {
        } catch (XmlPullParserException e) {
            throw new RuntimeException(e);
            throw new RuntimeException(e);
        } catch (IOException e) {
        } catch (IOException e) {