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
This commit is contained in:
Tony Huang
2021-07-22 16:42:35 +08:00
parent e5c6355a2e
commit 2ac27f9e10

View File

@@ -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));
}
}