From ac3dd218f82ee5f71002e00b5c95ac8080aa13fb Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Wed, 26 Apr 2023 23:24:00 +0800 Subject: [PATCH] Merge closing transition when recents is running If the incoming transition clears all pausing task, the handler only needs to consume it because the task is either already disappearing by swipe-up animation or is kept showing on recents. Otherwise it may go DefaultTransitionHandler and apply a weird animation depends on the change info. Bug: 279142303 Test: When swipe-to-home animation is running, the current task finishes itself. There should be no additional animation. Change-Id: Id671e0cc3ddb3736e1e33f14138dacbe05631c9c --- .../wm/shell/recents/RecentsTransitionHandler.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java index eb4d2a16c5220..bffc51c6b22f2 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java @@ -549,6 +549,14 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { // are in mOpening. for (int i = 0; i < closingTasks.size(); ++i) { final TransitionInfo.Change change = closingTasks.get(i); + final int pausingIdx = TaskState.indexOf(mPausingTasks, change); + if (pausingIdx >= 0) { + mPausingTasks.remove(pausingIdx); + didMergeThings = true; + ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION, + " closing pausing taskId=%d", change.getTaskInfo().taskId); + continue; + } int openingIdx = TaskState.indexOf(mOpeningTasks, change); if (openingIdx < 0) { Slog.w(TAG, "Closing a task that wasn't opening, this may be split or" @@ -601,6 +609,11 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { didMergeThings = true; mState = STATE_NEW_TASK; } + if (mPausingTasks.isEmpty()) { + // The pausing tasks may be removed by the incoming closing tasks. + ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION, + "[%d] RecentsController.merge: empty pausing tasks", mInstanceId); + } if (!hasTaskChange) { // Activity only transition, so consume the merge as it doesn't affect the rest of // recents.