[pm] update shared libraries if the old package used it

It is possible that the new package doesn't use share libraries but the
old package does. In those cases, the old code doesn't update the shared
libraries to null. This CL fixes that.

BUG: 227290968
Test: manual with installing a standalone webview apk and observe the
usesLibraryFiles fields are cleared after the installation.
Change-Id: I37c9e3a526ff71c6e50ba0b7b319f60e5d2f5410

Change-Id: I4562f1e77b7336af28b9468569c72436ff108b6b
This commit is contained in:
Songchun Fan
2022-05-24 21:34:31 +00:00
parent 53af3ea395
commit dc92a031e2

View File

@@ -335,7 +335,10 @@ final class InstallPackageHelper {
mPm.mTransferredPackages.add(pkg.getPackageName());
}
if (reconciledPkg.mCollectedSharedLibraryInfos != null) {
if (reconciledPkg.mCollectedSharedLibraryInfos != null
|| (oldPkgSetting != null && oldPkgSetting.getUsesLibraryInfos() != null)) {
// Reconcile if the new package or the old package uses shared libraries.
// It is possible that the old package uses shared libraries but the new one doesn't.
mSharedLibraries.executeSharedLibrariesUpdateLPw(pkg, pkgSetting, null, null,
reconciledPkg.mCollectedSharedLibraryInfos, allUsers);
}