From 940e7d9ffed5b85d7bc9a994e0c63b3c9b916428 Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Tue, 25 Apr 2023 16:33:02 -0700 Subject: [PATCH] Reparent task back to the surface control during change transitions Test: manual - expand a bubble and swipe up to collapse it - do this repeatedly and observe the animation doesn't flash the task at the top of the screen Bug: 279074446 Change-Id: I81ece15a1fb21bfb9687540b96cb1baaafb74cb4 --- .../wm/shell/taskview/TaskViewTaskController.java | 4 ++++ .../wm/shell/taskview/TaskViewTransitions.java | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTaskController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTaskController.java index 7991c529aa499..2ab4c751d3992 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTaskController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTaskController.java @@ -82,6 +82,10 @@ public class TaskViewTaskController implements ShellTaskOrganizer.TaskListener { mGuard.open("release"); } + SurfaceControl getSurfaceControl() { + return mSurfaceControl; + } + /** * Sets the provided {@link TaskViewBase}, which is used to notify the client part about the * task related changes and getting the current bounds. diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTransitions.java b/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTransitions.java index 81d69a4fa6119..c7e534a2bcf5c 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTransitions.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTransitions.java @@ -336,6 +336,19 @@ public class TaskViewTransitions implements Transitions.TransitionHandler { tv.prepareOpenAnimation(taskIsNew, startTransaction, finishTransaction, chg.getTaskInfo(), chg.getLeash(), wct); changesHandled++; + } else if (chg.getMode() == TRANSIT_CHANGE) { + TaskViewTaskController tv = findTaskView(chg.getTaskInfo()); + if (tv == null) { + if (pending != null) { + Slog.w(TAG, "Found a non-TaskView task in a TaskView Transition. This " + + "shouldn't happen, so there may be a visual artifact: " + + chg.getTaskInfo().taskId); + } + continue; + } + startTransaction.reparent(chg.getLeash(), tv.getSurfaceControl()); + finishTransaction.reparent(chg.getLeash(), tv.getSurfaceControl()); + changesHandled++; } } if (stillNeedsMatchingLaunch) {