summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Baumann <patb@google.com>2019-10-10 15:50:28 -0700
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-11-16 00:27:18 +0000
commitfab928923c8255626049e6f459105d2e4c715384 (patch)
tree3ca465f79d51dfa8333f56287e5f6b0a1818dcb9
parent18ed45f835485d8d64708540d318707eeb215c1c (diff)
downloadbase-fab928923c8255626049e6f459105d2e4c715384.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 (cherry picked from commit 34b504c32ff054265630662fa6fa57158cbcdc6c)
-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 aae48239a0cc..703c17acd6ce 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -18626,7 +18626,7 @@ public class PackageManagerService extends IPackageManager.Stub
continue;
}
List<VersionedPackage> libClientPackages = getPackagesUsingSharedLibraryLPr(
- libraryInfo, 0, currUserId);
+ libraryInfo, MATCH_KNOWN_PACKAGES, currUserId);
if (!ArrayUtils.isEmpty(libClientPackages)) {
Slog.w(TAG, "Not removing package " + pkg.manifestPackageName
+ " hosting lib " + libraryInfo.getName() + " version "
@@ -23652,8 +23652,9 @@ public class PackageManagerService extends IPackageManager.Stub
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) {