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

Commit 2ed97a6a authored by Tony Huang's avatar Tony Huang Committed by Automerger Merge Worker
Browse files

Merge "Make sure divider show after DA info changed" into sc-v2-dev am: c7efed22 am: 77d8f94d

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15358031

Change-Id: I0d2ee24af930bd5ed3bd27b664f940df527690c4
parents 4d82757b 77d8f94d
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));
        }
    }