Merge "Consider the recents component activities/windows when dumping visible" into sc-v2-dev

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<>(); return new ArrayList<>();
} }
} else { } else {
final RecentTasks recentTasks = mWindowManager.mAtmService.getRecentTasks();
final int recentsComponentUid = recentTasks != null
? recentTasks.getRecentsComponentUid()
: -1;
final ArrayList<ActivityRecord> activities = new ArrayList<>(); final ArrayList<ActivityRecord> activities = new ArrayList<>();
forAllRootTasks(rootTask -> { forAllLeafTasks(task -> {
if (!dumpVisibleRootTasksOnly || rootTask.shouldBeVisible(null)) { final boolean isRecents = (task.effectiveUid == recentsComponentUid);
activities.addAll(rootTask.getDumpActivitiesLocked(name)); if (!dumpVisibleRootTasksOnly || task.shouldBeVisible(null) || isRecents) {
activities.addAll(task.getDumpActivitiesLocked(name));
} }
return false;
}); });
return activities; return activities;
} }

View File

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