From 26b95e4b14cb35482dafb180cc9cd8efbe3bec48 Mon Sep 17 00:00:00 2001 From: Jeff Chang Date: Thu, 23 Mar 2023 20:49:05 +0800 Subject: [PATCH] Prevent starting split pending transition when it exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is a validation to check whether an empty child exists in split from startAnimation. The IllegalStateException is thrown to say “Somehow removed the last task in a stage outside of a proper transition”. There is a case to run into this situation situation that makes a split first and launches an unsupported multi-window activity. The onNoLongerSupportMultiWindow() is invoked and starts a dismiss transition. Since the trampoline launch design, the onNoLongerSupportMultiWindow() is coming and triggers another dismiss transition. That makes the 2nd transition not consistent while the startAnimation() is invoked. This CL skip to set the pending transition if there is one existing. Also apply the same protection to enter pendingTransition. Bug: 273871464 Bug: 274835996 Test: (A|B) → C,C1 which do not support multi-window Change-Id: I2ccff5402e9bd14cbed43a730fcd07c564725408 --- .../wm/shell/splitscreen/SplitScreenTransitions.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenTransitions.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenTransitions.java index e09c3c9e4d3ff..ebdaaa9aa4a96 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenTransitions.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenTransitions.java @@ -296,6 +296,11 @@ class SplitScreenTransitions { Transitions.TransitionHandler handler, @Nullable TransitionConsumedCallback consumedCallback, @Nullable TransitionFinishedCallback finishedCallback) { + if (mPendingEnter != null) { + ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " splitTransition " + + " skip to start enter split transition since it already exist. "); + return null; + } final IBinder transition = mTransitions.startTransition(transitType, wct, handler); setEnterTransition(transition, remoteTransition, consumedCallback, finishedCallback); return transition; @@ -323,6 +328,12 @@ class SplitScreenTransitions { IBinder startDismissTransition(WindowContainerTransaction wct, Transitions.TransitionHandler handler, @SplitScreen.StageType int dismissTop, @SplitScreenController.ExitReason int reason) { + if (mPendingDismiss != null) { + ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " splitTransition " + + " skip to start dismiss split transition since it already exist. reason to " + + " dismiss = %s", exitReasonToString(reason)); + return null; + } final int type = reason == EXIT_REASON_DRAG_DIVIDER ? TRANSIT_SPLIT_DISMISS_SNAP : TRANSIT_SPLIT_DISMISS; IBinder transition = mTransitions.startTransition(type, wct, handler);