From 9009a944bed25d1cc1ed23180fe0e16a931d68ba Mon Sep 17 00:00:00 2001 From: Jerry Chang Date: Tue, 6 Jul 2021 14:45:08 +0000 Subject: [PATCH] Prevent flickering between fullscreen and multi-window of main stage When both stage's visibility changed to visible, main stage might receives visibility changed before side stage if it has higher z-order than side stage. Make sure we only update main stage's windowing mode with the visibility changed of side stage to prevent stacking multiple windowing mode transactions which result to flicker issue. Fix: 192926422 Bug: 186614428 Test: trigger stage split and toggle IME panel on main stage to reorder main stage above side stage, obesrved stage split won't flicker after dismissed keyguard. Change-Id: Ib5e69fa35cc8d0c2b68415ae0689aea2988c7549 --- .../android/wm/shell/splitscreen/StageCoordinator.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 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 c6aacb1ab501f..9f8b79932dede 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 @@ -432,7 +432,11 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler, exitSplitScreen(toTop); } - if (mainStageVisible) { + // When both stage's visibility changed to visible, main stage might receives visibility + // changed before side stage if it has higher z-order than side stage. Make sure we only + // update main stage's windowing mode with the visibility changed of side stage to prevent + // stacking multiple windowing mode transactions which result to flicker issue. + if (mainStageVisible && stageListener == mSideStageListener) { final WindowContainerTransaction wct = new WindowContainerTransaction(); if (sideStageVisible) { // The main stage configuration should to follow split layout when side stage is @@ -510,10 +514,6 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler, // Make sure the main stage is active. mMainStage.activate(getMainStageBounds(), wct); mSideStage.setBounds(getSideStageBounds(), wct); - // Reorder side stage to the top whenever there's a new child task appeared in side - // stage. This is needed to prevent main stage occludes side stage and makes main stage - // flipping between fullscreen and multi-window windowing mode. - wct.reorder(mSideStage.mRootTaskInfo.token, true); mTaskOrganizer.applyTransaction(wct); } }