From 43301fec5516e52eca8a9c5355095bf9415ca445 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Thu, 10 Mar 2022 01:33:38 +0000 Subject: 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 Merged-In: I06c5eaf4a82368996c734cd245803b3d7c4e7d71 (cherry picked from commit 154a763558f2179427b672dd96a602ea4d9c7bdd) --- .../core/java/com/android/server/wm/RootWindowContainer.java | 12 +++++++++--- .../com/android/server/wm/WindowManagerShellCommand.java | 7 ++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/wm/RootWindowContainer.java b/services/core/java/com/android/server/wm/RootWindowContainer.java index 628e124877e9..9cd37b305dc6 100644 --- a/services/core/java/com/android/server/wm/RootWindowContainer.java +++ b/services/core/java/com/android/server/wm/RootWindowContainer.java @@ -3624,11 +3624,17 @@ class RootWindowContainer extends WindowContainer return new ArrayList<>(); } } else { + final RecentTasks recentTasks = mWindowManager.mAtmService.getRecentTasks(); + final int recentsComponentUid = recentTasks != null + ? recentTasks.getRecentsComponentUid() + : -1; final ArrayList 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; } diff --git a/services/core/java/com/android/server/wm/WindowManagerShellCommand.java b/services/core/java/com/android/server/wm/WindowManagerShellCommand.java index a94fd074ff2e..2d8410bd12d2 100644 --- a/services/core/java/com/android/server/wm/WindowManagerShellCommand.java +++ b/services/core/java/com/android/server/wm/WindowManagerShellCommand.java @@ -513,9 +513,14 @@ public class WindowManagerShellCommand extends ShellCommand { try (ZipOutputStream out = new ZipOutputStream(getRawOutputStream())) { ArrayList> 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(); -- cgit v1.2.3-59-g8ed1b