Consider the recents component activities/windows when dumping visible

- The Launcher currently manages gesture nav, so often a bug report
  taken with better bug will prevent the launcher state from being
  recorded as a part of the BR.  This ensures that both the activity
  dump and the window hierarchy is saved even if it is not visible.

Bug: 223509022
Bug: 223498680
Test: dumpsys activity -v all, cmd window dump-visible-window-views
      while Launcher is not visible
Change-Id: I06c5eaf4a82368996c734cd245803b3d7c4e7d71
This commit is contained in:
Winson Chung
2022-03-10 01:33:38 +00:00
parent 5c51147284
commit 154a763558
2 changed files with 15 additions and 4 deletions

View File

@@ -3376,11 +3376,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, userId));
forAllLeafTasks(task -> {
final boolean isRecents = (task.effectiveUid == recentsComponentUid);
if (!dumpVisibleRootTasksOnly || task.shouldBeVisible(null) || isRecents) {
activities.addAll(task.getDumpActivitiesLocked(name, userId));
}
return false;
});
return activities;
}

View File

@@ -566,9 +566,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.getUid() == recentsComponentUid);
if (w.isVisible() || isRecents) {
ByteTransferPipe pipe = null;
try {
pipe = new ByteTransferPipe();