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

Commit 08a10463 authored by Alex Buynytskyy's avatar Alex Buynytskyy
Browse files

Use the latest static shared lib version for signature checks.

Previously this would only work if there is already package with the same name installed. This does not make much sense as we might be checking against a different package. This change moves the override one level above.

Bug: 213398637
Test: presubmit
Change-Id: I78c2e730fca846cdf8933bae76c1362f048ce6f4
parent 39cdae1f
Loading
Loading
Loading
Loading
+12 −13
Original line number Diff line number Diff line
@@ -1221,12 +1221,6 @@ final class InstallPackageHelper {
                }
            }

            if (signatureCheckPs != null) {
                if (DEBUG_INSTALL) {
                    Slog.d(TAG,
                            "Existing package for signature checking: " + signatureCheckPs);
                }

            // Static shared libs have same package with different versions where
            // we internally use a synthetic package name to allow multiple versions
            // of the same package, therefore we need to compare signatures against
@@ -1235,11 +1229,16 @@ final class InstallPackageHelper {
                SharedLibraryInfo libraryInfo =
                        mSharedLibraries.getLatestStaticSharedLibraVersionLPr(parsedPackage);
                if (libraryInfo != null) {
                        signatureCheckPs = mPm.mSettings.getPackageLPr(
                                libraryInfo.getPackageName());
                    signatureCheckPs = mPm.mSettings.getPackageLPr(libraryInfo.getPackageName());
                }
            }

            if (signatureCheckPs != null) {
                if (DEBUG_INSTALL) {
                    Slog.d(TAG,
                            "Existing package for signature checking: " + signatureCheckPs);
                }

                // Quick validity check that we're signed correctly if updating;
                // we'll check this again later when scanning, but we want to
                // bail early here before tripping over redefined permissions.