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

Commit 067b5838 authored by android-build-team Robot's avatar android-build-team Robot Committed by android-build-merger
Browse files

Merge "Fix NPE in package manager when asserting overlays" into pi-dev

am: 61554708

Change-Id: Id3ed6fd761042fe16a15e5774047070c63cd5d22
parents 41e5b212 61554708
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -11160,8 +11160,23 @@ public class PackageManagerService extends IPackageManager.Stub
                                mSettings.getPackageLPr(pkg.packageName),
                                "previous package state not present");
                        // previousPkg.pkg may be null: the package will be not be scanned if the
                        // package manager knows there is a newer version on /data.
                        // TODO[b/79435695]: Find a better way to keep track of the "static"
                        // property for RROs instead of having to parse packages on /system
                        PackageParser.Package ppkg = previousPkg.pkg;
                        if (ppkg == null) {
                            try {
                                final PackageParser pp = new PackageParser();
                                ppkg = pp.parsePackage(previousPkg.codePath,
                                        parseFlags | PackageParser.PARSE_IS_SYSTEM_DIR);
                            } catch (PackageParserException e) {
                                Slog.w(TAG, "failed to parse " + previousPkg.codePath, e);
                            }
                        }
                        // Static overlays cannot be updated.
                        if (previousPkg.pkg.mOverlayIsStatic) {
                        if (ppkg != null && ppkg.mOverlayIsStatic) {
                            throw new PackageManagerException("Overlay " + pkg.packageName +
                                    " is static and cannot be upgraded.");
                        // Non-static overlays cannot be converted to static overlays.