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

Commit b8a9b524 authored by JW Wang's avatar JW Wang
Browse files

Include dependency packages in RunningAppProcessInfo

So we have a complete picture about all packages loaded into a process.
This will be used to check if installing a package causes a process to
be killed.

Note if pkgList or pkgDeps contain the package to be installed, the process
will be killed during install.

Bug: 235306967
Test: m
Change-Id: I052185f8d54717e65fa1fddaa42ca80ebbf15a5d
parent 74441f0e
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -3128,7 +3128,13 @@ public class ActivityManager {
        /**
         * All packages that have been loaded into the process.
         */
        public String pkgList[];
        public String[] pkgList;

        /**
         * Additional packages loaded into the process as dependency.
         * @hide
         */
        public String[] pkgDeps;

        /**
         * Constant for {@link #flags}: this is an app that is unable to
@@ -3509,6 +3515,7 @@ public class ActivityManager {
            dest.writeInt(pid);
            dest.writeInt(uid);
            dest.writeStringArray(pkgList);
            dest.writeStringArray(pkgDeps);
            dest.writeInt(this.flags);
            dest.writeInt(lastTrimLevel);
            dest.writeInt(importance);
@@ -3527,6 +3534,7 @@ public class ActivityManager {
            pid = source.readInt();
            uid = source.readInt();
            pkgList = source.readStringArray();
            pkgDeps = source.readStringArray();
            flags = source.readInt();
            lastTrimLevel = source.readInt();
            importance = source.readInt();
+4 −0
Original line number Diff line number Diff line
@@ -3733,6 +3733,10 @@ public final class ProcessList {
                ActivityManager.RunningAppProcessInfo currApp =
                        new ActivityManager.RunningAppProcessInfo(app.processName,
                                app.getPid(), app.getPackageList());
                if (app.getPkgDeps() != null) {
                    final int size = app.getPkgDeps().size();
                    currApp.pkgDeps = app.getPkgDeps().toArray(new String[size]);
                }
                fillInProcMemInfoLOSP(app, currApp, clientTargetSdk);
                if (state.getAdjSource() instanceof ProcessRecord) {
                    currApp.importanceReasonPid = ((ProcessRecord) state.getAdjSource()).getPid();