From 0a4215b3c1a0a01c9f66cd0b19649d8717cc7516 Mon Sep 17 00:00:00 2001 From: Tony Huang Date: Wed, 7 Jun 2023 07:55:29 +0000 Subject: Don't dismiss split during enter if already visible Open to side enter transition is only used if split is active and foreground. We will check exception case if changes on both stage didn't include in this transition. But this exception case should happen usually while user trying to launch same app which already on front. So we should not dismiss split itself and just log it. Fix: 285795299 Test: manual Test: pass existing tests Change-Id: Idf6c38ade49ce25f1301e0ca4bb17210dcb906f9 --- .../src/com/android/wm/shell/splitscreen/StageCoordinator.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'libs') diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java index c8e88fcc0a6a..85b71fe158c1 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java @@ -1497,6 +1497,10 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, // Legacy transition we need to create divider here, shell transition case we will // create it on #finishEnterSplitScreen mSplitLayout.init(); + } else { + // We handle split visibility itself on shell transition, but sometimes we didn't + // reset it correctly after dismiss by some reason, so just set invisible before active. + setSplitsVisible(false); } if (taskInfo != null) { setSideStagePosition(startPosition, wct); @@ -2638,11 +2642,11 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, if (mSplitTransitions.mPendingEnter.mExtraTransitType == TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE) { + // Open to side should only be used when split already active and foregorund. if (mainChild == null && sideChild == null) { Log.w(TAG, "Launched a task in split, but didn't receive any task in transition."); - mSplitTransitions.mPendingEnter.cancel((cancelWct, cancelT) - -> prepareExitSplitScreen(STAGE_TYPE_UNDEFINED, cancelWct)); - mSplitUnsupportedToast.show(); + // This should happen when the target app is already on front, so just cancel. + mSplitTransitions.mPendingEnter.cancel(null); return true; } } else { -- cgit v1.2.3-59-g8ed1b