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

Commit cbafe0b0 authored by Patrick Baumann's avatar Patrick Baumann
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
parent 79a1f8e7
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -2149,6 +2149,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
@@ -11878,6 +11886,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
@@ -15157,6 +15168,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);