From 2a103593885a1c2d2e3cf922ece2419394f86c1a Mon Sep 17 00:00:00 2001 From: Evan Rosky Date: Mon, 13 Feb 2023 12:22:19 -0800 Subject: [PATCH] Make taskview resize into a transition This was previously using legacy applySync. This can interact badly with transitions if done in the wrong order. So, make this into a transition instead. Bug: 268326421 Test: ShowMultipleBubblesAndSwitchTest Change-Id: I9398ebb384e9ad32c2459397c7314e0590e456a5 --- .../wm/shell/taskview/TaskViewTaskController.java | 11 +++++++++-- .../wm/shell/taskview/TaskViewTransitions.java | 11 ++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) 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 646d55e4581c9..36c9077a197b1 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 @@ -387,8 +387,15 @@ public class TaskViewTaskController implements ShellTaskOrganizer.TaskListener { return; } // Sync Transactions can't operate simultaneously with shell transition collection. - // The transition animation (upon showing) will sync the location itself. - if (isUsingShellTransitions() && mTaskViewTransitions.hasPending()) return; + if (isUsingShellTransitions()) { + if (mTaskViewTransitions.hasPending()) { + // There is already a transition in-flight. The window bounds will be synced + // once it is complete. + return; + } + mTaskViewTransitions.setTaskBounds(this, boundsOnScreen); + return; + } WindowContainerTransaction wct = new WindowContainerTransaction(); wct.setBounds(mTaskToken, boundsOnScreen); 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 9b995c5dc6211..3b1ce49ebdc78 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 @@ -16,6 +16,7 @@ package com.android.wm.shell.taskview; +import static android.view.WindowManager.TRANSIT_CHANGE; import static android.view.WindowManager.TRANSIT_OPEN; import static android.view.WindowManager.TRANSIT_TO_BACK; import static android.view.WindowManager.TRANSIT_TO_FRONT; @@ -23,6 +24,7 @@ import static android.view.WindowManager.TRANSIT_TO_FRONT; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityManager; +import android.graphics.Rect; import android.os.IBinder; import android.util.Slog; import android.view.SurfaceControl; @@ -40,7 +42,7 @@ import java.util.ArrayList; * Handles Shell Transitions that involve TaskView tasks. */ public class TaskViewTransitions implements Transitions.TransitionHandler { - private static final String TAG = "TaskViewTransitions"; + static final String TAG = "TaskViewTransitions"; private final ArrayList mTaskViews = new ArrayList<>(); private final ArrayList mPending = new ArrayList<>(); @@ -197,6 +199,13 @@ public class TaskViewTransitions implements Transitions.TransitionHandler { // visibility is reported in transition. } + void setTaskBounds(TaskViewTaskController taskView, Rect boundsOnScreen) { + WindowContainerTransaction wct = new WindowContainerTransaction(); + wct.setBounds(taskView.getTaskInfo().token, boundsOnScreen); + mPending.add(new PendingTransition(TRANSIT_CHANGE, wct, taskView, null /* cookie */)); + startNextTransition(); + } + private void startNextTransition() { if (mPending.isEmpty()) return; final PendingTransition pending = mPending.get(0);