summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Baumann <patb@google.com>2019-10-10 15:50:28 -0700
committerGreg Wroblewski <musashi@google.com>2020-01-10 14:53:48 -0800
commit304ea57b9862a0ed9ef1b7a2913a1f45e2a78da7 (patch)
tree553692b5fe40820fd1d497787a76c7dee2c959d1
parentbbd78f88c9fa98d47ba23887e054191f6ac6f657 (diff)
downloadbase-304ea57b9862a0ed9ef1b7a2913a1f45e2a78da7.tar.gz
Use KNOWN_PACKAGES when shared lib consumers
This change ensures we find ALL known packages that could be consuming a shared library, not only currently installed ones. Without this check, the system may get into a state in which we have currently uninstalled but on-device apps that depend on a shared library that does not exist on device. This change also leaves static shared library packages on device even if it's not installed for any of the remaining users as it could still be used, but marked uninstalled for users in which it is consumed. Bug: 141413692 Bug: 142083996 Test: Manual; attempt to remove shared lib after marking its consumer uninstalled. Test: atest StaticSharedLibsHostTests Change-Id: Id4e37c3e4d3ea3ad5fddae5d2c7305e56f50eeea Merged-In: Id4e37c3e4d3ea3ad5fddae5d2c7305e56f50eeea (cherry picked from commit 08315953bc42fb392c32293418dfb2a3e4ffbe53)
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index f619b32fbb57..5aa760957418 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -18920,7 +18920,7 @@ public class PackageManagerService extends IPackageManager.Stub
continue;
}
List<VersionedPackage> libClientPackages = getPackagesUsingSharedLibraryLPr(
- libEntry.info, 0, currUserId);
+ libEntry.info, MATCH_KNOWN_PACKAGES, currUserId);
if (!ArrayUtils.isEmpty(libClientPackages)) {
Slog.w(TAG, "Not removing package " + pkg.manifestPackageName
+ " hosting lib " + libEntry.info.getName() + " version "
@@ -24034,8 +24034,9 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
continue;
}
final String packageName = ps.pkg.packageName;
- // Skip over if system app
- if ((ps.pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0) {
+ // Skip over if system app or static shared library
+ if ((ps.pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0
+ || !TextUtils.isEmpty(ps.pkg.staticSharedLibName)) {
continue;
}
if (DEBUG_CLEAN_APKS) {