From d48c48462345a52e568b64579f8e87e0c0db0b06 Mon Sep 17 00:00:00 2001 From: Gaurav Bhola Date: Fri, 13 Jan 2023 18:33:16 -0800 Subject: [PATCH] When checking for isTaskView(), account for children. - This case can happen when TaskView contains a launch root task view that contains other tasks. These children tasks can potentially be reparented to a new Surface. Test: Tested manually using the Car ui portrait target Fix: 265483665 Change-Id: I549ece791eab942a3fc5297b8bc914f1217b9416 --- .../android/server/wm/AppTransitionController.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/wm/AppTransitionController.java b/services/core/java/com/android/server/wm/AppTransitionController.java index d65c2f96e1ceb..2b8b59cb47483 100644 --- a/services/core/java/com/android/server/wm/AppTransitionController.java +++ b/services/core/java/com/android/server/wm/AppTransitionController.java @@ -901,9 +901,18 @@ public class AppTransitionController { * TODO(b/213312721): Remove this predicate and its callers once ShellTransition is enabled. */ static boolean isTaskViewTask(WindowContainer wc) { - // We use Task#mRemoveWithTaskOrganizer to identify an embedded Task, but this is a hack and + // Use Task#mRemoveWithTaskOrganizer to identify an embedded Task, but this is a hack and // it is not guaranteed to work this logic in the future version. - return wc instanceof Task && ((Task) wc).mRemoveWithTaskOrganizer; + boolean isTaskViewTask = wc instanceof Task && ((Task) wc).mRemoveWithTaskOrganizer; + if (isTaskViewTask) { + return true; + } + + WindowContainer parent = wc.getParent(); + boolean isParentATaskViewTask = parent != null + && parent instanceof Task + && ((Task) parent).mRemoveWithTaskOrganizer; + return isParentATaskViewTask; } /**