[automerge] Consider the recents component activities/windows when dumping visible 2p: 43301fec55

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17160643

Bug: 223509022
Bug: 223498680
Change-Id: I51c0e784a29a2103aec4f6831e5b503c5d486327
Merged-In: I06c5eaf4a82368996c734cd245803b3d7c4e7d71
This commit is contained in:
Presubmit Automerger Backend
2022-03-10 22:47:39 +00:00
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();