From 2ac27f9e10406ae3549eb31a678821b22b754247 Mon Sep 17 00:00:00 2001 From: Tony Huang Date: Thu, 22 Jul 2021 16:42:35 +0800 Subject: [PATCH] Make sure divider show after DA info changed Currently it will not receive stage visibility changed callback after display info changed, the divider will not show even if it has re-initialized. Fix this by add applyVisibility call when display info changed. Fix: 194159070 Test: active stage split and rotate phone Change-Id: I2b9d6849300bc8a594cdbe658a7f7a663fd949a7 --- .../shell/splitscreen/StageCoordinator.java | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 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 81ce2b7bd2a58..6f23ae59d9c67 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 @@ -620,22 +620,9 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler, } mSyncQueue.runInSync(t -> { - final SurfaceControl dividerLeash = mSplitLayout.getDividerLeash(); final SurfaceControl sideStageLeash = mSideStage.mRootLeash; final SurfaceControl mainStageLeash = mMainStage.mRootLeash; - if (dividerLeash != null) { - if (mDividerVisible) { - t.show(dividerLeash) - .setLayer(dividerLeash, Integer.MAX_VALUE) - .setPosition(dividerLeash, - mSplitLayout.getDividerBounds().left, - mSplitLayout.getDividerBounds().top); - } else { - t.hide(dividerLeash); - } - } - if (sideStageVisible) { final Rect sideStageBounds = getSideStageBounds(); t.show(sideStageLeash) @@ -662,9 +649,30 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler, } else { t.hide(mainStageLeash); } + + applyDividerVisibility(t); }); } + private void applyDividerVisibility(SurfaceControl.Transaction t) { + final SurfaceControl dividerLeash = mSplitLayout.getDividerLeash(); + if (dividerLeash == null) { + return; + } + + if (mDividerVisible) { + t.show(dividerLeash) + .setLayer(dividerLeash, Integer.MAX_VALUE) + .setPosition(dividerLeash, + mSplitLayout.getDividerBounds().left, + mSplitLayout.getDividerBounds().top); + } else { + t.hide(dividerLeash); + } + + } + + private void onStageHasChildrenChanged(StageListenerImpl stageListener) { final boolean hasChildren = stageListener.mHasChildren; final boolean isSideStage = stageListener == mSideStageListener; @@ -782,6 +790,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler, && mSplitLayout.updateConfiguration(mDisplayAreaInfo.configuration) && mMainStage.isActive()) { onBoundsChanged(mSplitLayout); + mSyncQueue.runInSync(t -> applyDividerVisibility(t)); } }