diff options
| author | 2022-01-18 13:19:03 -0800 | |
|---|---|---|
| committer | 2022-01-19 01:34:10 +0000 | |
| commit | 08a10463523eda31516dd3009547df9c669152b5 (patch) | |
| tree | 512940ed7de9d0ae34fc898e58f8fb3fda93d1f0 | |
| parent | 39cdae1f82e31cd9e40dd10c3ae7fbc3ddc98270 (diff) | |
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
| -rw-r--r-- | services/core/java/com/android/server/pm/InstallPackageHelper.java | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/services/core/java/com/android/server/pm/InstallPackageHelper.java b/services/core/java/com/android/server/pm/InstallPackageHelper.java index 0d65463d729d..47a7a922fe2a 100644 --- a/services/core/java/com/android/server/pm/InstallPackageHelper.java +++ b/services/core/java/com/android/server/pm/InstallPackageHelper.java @@ -1221,25 +1221,24 @@ final class InstallPackageHelper { } } + // 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 + // the package setting for the latest library version. + if (parsedPackage.isStaticSharedLibrary()) { + SharedLibraryInfo libraryInfo = + mSharedLibraries.getLatestStaticSharedLibraVersionLPr(parsedPackage); + if (libraryInfo != null) { + signatureCheckPs = mPm.mSettings.getPackageLPr(libraryInfo.getPackageName()); + } + } + 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 - // the package setting for the latest library version. - if (parsedPackage.isStaticSharedLibrary()) { - SharedLibraryInfo libraryInfo = - mSharedLibraries.getLatestStaticSharedLibraVersionLPr(parsedPackage); - if (libraryInfo != null) { - signatureCheckPs = mPm.mSettings.getPackageLPr( - libraryInfo.getPackageName()); - } - } - // 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. |