From 496fd6a64a0d354e05b286ea6a0b30200837f676 Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Fri, 21 Apr 2023 09:12:14 +0000 Subject: [PATCH] Only need to dismiss stage if one of the task is closed. If both stages are closed, it might be starting a new full screen task, so don't handle it. Bug: 279117417 Test: no regression on 278060807. Test: atest WMShellFlickerTests:SwitchBackToSplitFromAnotherApp Change-Id: I09be7fafff4286493bc1456eb7b22d1d2e13b172 --- .../com/android/wm/shell/splitscreen/StageCoordinator.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 ceef373182fac..cca63ef2b5d68 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 @@ -2419,12 +2419,13 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, } } } - // If the size of dismissStages > 0, the task is closed without prepare pending + // If the size of dismissStages == 1, one of the task is closed without prepare pending // transition, which could happen if all activities were finished after finish top // activity in a task, so the trigger task is null when handleRequest. + // Note if the size of dismissStages == 2, it's starting a new task, so don't handle it. final ArraySet dismissStages = record.getShouldDismissedStage(); if (mMainStage.getChildCount() == 0 || mSideStage.getChildCount() == 0 - || dismissStages.size() > 0) { + || dismissStages.size() == 1) { Log.e(TAG, "Somehow removed the last task in a stage outside of a proper " + "transition."); final WindowContainerTransaction wct = new WindowContainerTransaction();