From dc92a031e2afedb66577fcfd2d825b94eed2cc94 Mon Sep 17 00:00:00 2001 From: Songchun Fan Date: Tue, 24 May 2022 21:34:31 +0000 Subject: [PATCH] [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 --- .../java/com/android/server/pm/InstallPackageHelper.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/pm/InstallPackageHelper.java b/services/core/java/com/android/server/pm/InstallPackageHelper.java index e753459985349..c710120ca4376 100644 --- a/services/core/java/com/android/server/pm/InstallPackageHelper.java +++ b/services/core/java/com/android/server/pm/InstallPackageHelper.java @@ -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); }