summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Issei Suzuki <issei@google.com> 2022-12-01 12:58:29 +0000
committer Issei Suzuki <issei@google.com> 2022-12-05 14:32:18 +0000
commitcd8958e685c82612060eed08eb53ebffced152ed (patch)
tree5cab8a7f1360e0bbed1b781c780337496e60952c
parent2b46e4671b82f4d3fd90e62fcfa6d2d9a2b59eed (diff)
Fix WM shell crash when targets belong to a different display.
When showWhenLocked activity is launched on a second display, it's possible that a window container for a wallpaper on the default display and the showWhenLocked activity on the second display are both collected for app transition. This is a workaround to prevent NPE for such cases. Bug: 260997053 Test: atest MultiDisplayLockedKeyguardTests Change-Id: I9dbd0928aa785a6d547b8e19841748280ba982c9
-rw-r--r--services/core/java/com/android/server/wm/Transition.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java
index ec3962c282f6..e90a52f774a1 100644
--- a/services/core/java/com/android/server/wm/Transition.java
+++ b/services/core/java/com/android/server/wm/Transition.java
@@ -1645,8 +1645,11 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
WindowContainer<?> ancestor = findCommonAncestor(sortedTargets, changes, topApp);
- // make leash based on highest (z-order) direct child of ancestor with a participant.
- WindowContainer leashReference = sortedTargets.get(0);
+ // Make leash based on highest (z-order) direct child of ancestor with a participant.
+ // TODO(b/261418859): Handle the case when the target contains window containers which
+ // belong to a different display. As a workaround we use topApp, from which wallpaper
+ // window container is removed, instead of sortedTargets here.
+ WindowContainer leashReference = topApp;
while (leashReference.getParent() != ancestor) {
leashReference = leashReference.getParent();
}