Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2ac27f9e authored by Tony Huang's avatar Tony Huang
Browse files

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
parent e5c6355a
Loading
Loading
Loading
Loading
+22 −13
Original line number Diff line number Diff line
@@ -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));
        }
    }