Fix broken layout after switched stage positions

Invoke onBoundsChanged to make sure it always updates bounds of both
stages in window hierachy after switched stage positions.

Fix: 189046868
Test: atest WMShellUnitTests
Test: trigger staged split, snap divider to non-middle position,
observed double tapping divider bar will update split layout properly.

Change-Id: I5556cc94a19758f737076f241426deee2ca24a22
This commit is contained in:
Jerry Chang
2021-05-22 17:27:52 +00:00
parent d86db44b5f
commit d18a7bb158

View File

@@ -253,17 +253,17 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
}
void setSideStagePosition(@SplitPosition int sideStagePosition) {
setSideStagePosition(sideStagePosition, true /* updateVisibility */);
setSideStagePosition(sideStagePosition, true /* updateBounds */);
}
private void setSideStagePosition(@SplitPosition int sideStagePosition,
boolean updateVisibility) {
boolean updateBounds) {
if (mSideStagePosition == sideStagePosition) return;
mSideStagePosition = sideStagePosition;
sendOnStagePositionChanged();
if (mSideStageListener.mVisible && updateVisibility) {
onStageVisibilityChanged(mSideStageListener);
if (mSideStageListener.mVisible && updateBounds) {
onBoundsChanged(mSplitLayout);
}
}
@@ -755,7 +755,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
// Update local states (before animating).
setDividerVisibility(true);
setSideStagePosition(SPLIT_POSITION_BOTTOM_OR_RIGHT, false /* updateVisibility */);
setSideStagePosition(SPLIT_POSITION_BOTTOM_OR_RIGHT, false /* updateBounds */);
setSplitsVisible(true);
addDividerBarToTransition(info, t, true /* show */);