Merge changes from topic "presubmit-am-9ba2a394f5ad4d338eadbfa2cb56aee6-sc-dev-sc-v2-dev-sc-v2-dev" into sc-v2-dev-plus-aosp

* changes:
  [automerge] Consider the recents component activities/windows when dumping visible 2p: 43301fec55
  Consider the recents component activities/windows when dumping visible
This commit is contained in:
Winson Chung
2022-03-11 05:21:39 +00:00
committed by Android (Google) Code Review
2 changed files with 15 additions and 4 deletions

View File

@@ -3624,11 +3624,17 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
return new ArrayList<>();
}
} else {
final RecentTasks recentTasks = mWindowManager.mAtmService.getRecentTasks();
final int recentsComponentUid = recentTasks != null
? recentTasks.getRecentsComponentUid()
: -1;
final ArrayList<ActivityRecord> activities = new ArrayList<>();
forAllRootTasks(rootTask -> {
if (!dumpVisibleRootTasksOnly || rootTask.shouldBeVisible(null)) {
activities.addAll(rootTask.getDumpActivitiesLocked(name));
forAllLeafTasks(task -> {
final boolean isRecents = (task.effectiveUid == recentsComponentUid);
if (!dumpVisibleRootTasksOnly || task.shouldBeVisible(null) || isRecents) {
activities.addAll(task.getDumpActivitiesLocked(name));
}
return false;
});
return activities;
}

View File

@@ -513,9 +513,14 @@ public class WindowManagerShellCommand extends ShellCommand {
try (ZipOutputStream out = new ZipOutputStream(getRawOutputStream())) {
ArrayList<Pair<String, ByteTransferPipe>> requestList = new ArrayList<>();
synchronized (mInternal.mGlobalLock) {
final RecentTasks recentTasks = mInternal.mAtmService.getRecentTasks();
final int recentsComponentUid = recentTasks != null
? recentTasks.getRecentsComponentUid()
: -1;
// Request dump from all windows parallelly before writing to disk.
mInternal.mRoot.forAllWindows(w -> {
if (w.isVisible()) {
final boolean isRecents = (w.mSession.mUid == recentsComponentUid);
if (w.isVisible() || isRecents) {
ByteTransferPipe pipe = null;
try {
pipe = new ByteTransferPipe();