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

Commit f160eeba authored by gang.huang's avatar gang.huang Committed by Song Chun Fan
Browse files

Catch IllegalArgumentException as it might indicate corrupted packages.xml

Bug: 327803684
Test: Manual
Merged-In: Icea3d175ae899413ee28b052086bd9f12a189aea
Change-Id: Icea3d175ae899413ee28b052086bd9f12a189aea
parent 729b91d1
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -3194,12 +3194,7 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile

                    } else if (tagName.equals("verifier")) {
                        final String deviceIdentity = parser.getAttributeValue(null, "device");
                        try {
                        mVerifierDeviceIdentity = VerifierDeviceIdentity.parse(deviceIdentity);
                        } catch (IllegalArgumentException e) {
                            Slog.w(PackageManagerService.TAG, "Discard invalid verifier device id: "
                                    + e.getMessage());
                        }
                    } else if (TAG_READ_EXTERNAL_STORAGE.equals(tagName)) {
                        // No longer used.
                    } else if (tagName.equals("keyset-settings")) {
@@ -3228,7 +3223,7 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
                }

                str.close();
            } catch (IOException | XmlPullParserException e) {
            } catch (IOException | XmlPullParserException | IllegalArgumentException e) {
                // Remove corrupted file and retry.
                atomicFile.failRead(str, e);