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

Commit e9e087dd authored by Patrick Baumann's avatar Patrick Baumann Committed by Richard Coles
Browse files

Send package changed for consumers of an updated shared lib

In the case that a static shared library is updated (same version code),
we should notify that the packages depending on the shared library have
changed to reflect the new paths of the shared lib.

Test: manual; update a static shared lib in place and observe broadcasts
Bug: 140129991
Change-Id: Ic8fea872c828833585a680d49c8e423b911a753a
(cherry picked from commit cbafe0b0)
parent a86312e0
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -2023,6 +2023,14 @@ public class PackageManagerService extends IPackageManager.Stub
                    pkgList.add(packageName);
                    sendResourcesChangedBroadcast(true, true, pkgList, uidArray, null);
                }
            } else if (!ArrayUtils.isEmpty(res.libraryConsumers)) { // if static shared lib
                for (int i = 0; i < res.libraryConsumers.size(); i++) {
                    PackageParser.Package pkg = res.libraryConsumers.get(i);
                    // send broadcast that all consumers of the static shared library have changed
                    sendPackageChangedBroadcast(pkg.packageName, false /*killFlag*/,
                            new ArrayList<>(Collections.singletonList(pkg.packageName)),
                            pkg.applicationInfo.uid);
                }
            }
            // Work that needs to happen on first install within each user
@@ -12193,6 +12201,9 @@ public class PackageManagerService extends IPackageManager.Stub
                }
            }
        }
        if (reconciledPkg.installResult != null) {
            reconciledPkg.installResult.libraryConsumers = clientLibPkgs;
        }
        if ((scanFlags & SCAN_BOOTING) != 0) {
            // No apps can run during boot scan, so they don't need to be frozen
@@ -16046,6 +16057,8 @@ public class PackageManagerService extends IPackageManager.Stub
        String installerPackageName;
        PackageRemovedInfo removedInfo;
        ArrayMap<String, PackageInstalledInfo> addedChildPackages;
        // The set of packages consuming this shared library or null if no consumers exist.
        ArrayList<PackageParser.Package> libraryConsumers;
        public void setError(int code, String msg) {
            setReturnCode(code);