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
This commit is contained in:
JW Wang
2022-08-03 14:32:03 +08:00
parent 74441f0ef3
commit b8a9b524f2
2 changed files with 13 additions and 1 deletions

View File

@@ -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();

View File

@@ -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();