Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 08315953 authored by Patrick Baumann's avatar Patrick Baumann Committed by Bryan Ferris
Browse files

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
parent 6afabce5
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -18951,7 +18951,7 @@ public class PackageManagerService extends IPackageManager.Stub
                            continue;
                            continue;
                        }
                        }
                        List<VersionedPackage> libClientPackages = getPackagesUsingSharedLibraryLPr(
                        List<VersionedPackage> libClientPackages = getPackagesUsingSharedLibraryLPr(
                                libEntry.info, 0, currUserId);
                                libEntry.info, MATCH_KNOWN_PACKAGES, currUserId);
                        if (!ArrayUtils.isEmpty(libClientPackages)) {
                        if (!ArrayUtils.isEmpty(libClientPackages)) {
                            Slog.w(TAG, "Not removing package " + pkg.manifestPackageName
                            Slog.w(TAG, "Not removing package " + pkg.manifestPackageName
                                    + " hosting lib " + libEntry.info.getName() + " version "
                                    + " hosting lib " + libEntry.info.getName() + " version "
@@ -24065,8 +24065,9 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
                continue;
                continue;
            }
            }
            final String packageName = ps.pkg.packageName;
            final String packageName = ps.pkg.packageName;
            // Skip over if system app
            // Skip over if system app or static shared library
            if ((ps.pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0) {
            if ((ps.pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0
                    || !TextUtils.isEmpty(ps.pkg.staticSharedLibName)) {
                continue;
                continue;
            }
            }
            if (DEBUG_CLEAN_APKS) {
            if (DEBUG_CLEAN_APKS) {