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

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

Merge "Set force translucent by split visibility" into tm-qpr-dev am:...

Merge "Set force translucent by split visibility" into tm-qpr-dev am: 4b4bd645 am: d32bff63 am: 7503aab5

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



Change-Id: I238d67cf5ddd03a512c4775557fe3c53d95b258b
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 9ffd2256 7503aab5
Loading
Loading
Loading
Loading
+27 −29
Original line number Diff line number Diff line
@@ -207,6 +207,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
    private boolean mIsDividerRemoteAnimating;
    private boolean mIsDropEntering;
    private boolean mIsExiting;
    private boolean mIsRootTranslucent;

    private DefaultMixedHandler mMixedHandler;
    private final Toast mSplitUnsupportedToast;
@@ -422,6 +423,11 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
            }
        }

        if (!isSplitActive()) {
            // prevent the fling divider to center transitioni if split screen didn't active.
            mIsDropEntering = true;
        }

        setSideStagePosition(sideStagePosition, wct);
        final WindowContainerTransaction evictWct = new WindowContainerTransaction();
        targetStage.evictAllChildren(evictWct);
@@ -436,28 +442,13 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        // reparent the task to an invisible split root will make the activity invisible.  Reorder
        // the root task to front to make the entering transition from pip to split smooth.
        wct.reorder(mRootTaskInfo.token, true);
        wct.setForceTranslucent(mRootTaskInfo.token, true);
        wct.reorder(targetStage.mRootTaskInfo.token, true);
        wct.setForceTranslucent(targetStage.mRootTaskInfo.token, true);
        // prevent the fling divider to center transition
        mIsDropEntering = true;

        targetStage.addTask(task, wct);

        if (ENABLE_SHELL_TRANSITIONS) {
            prepareEnterSplitScreen(wct);
            mSplitTransitions.startEnterTransition(TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE, wct,
                    null, this, null /* consumedCallback */, (finishWct, finishT) -> {
                        if (!evictWct.isEmpty()) {
                            finishWct.merge(evictWct, true);
                        }
                    } /* finishedCallback */);
        } else {
        if (!evictWct.isEmpty()) {
            wct.merge(evictWct, true /* transfer */);
        }
        mTaskOrganizer.applyTransaction(wct);
        }
        return true;
    }

@@ -716,7 +707,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        mSplitLayout.setDivideRatio(splitRatio);
        updateWindowBounds(mSplitLayout, wct);
        wct.reorder(mRootTaskInfo.token, true);
        wct.setForceTranslucent(mRootTaskInfo.token, false);
        setRootForceTranslucent(false, wct);

        // Make sure the launch options will put tasks in the corresponding split roots
        mainOptions = mainOptions != null ? mainOptions : new Bundle();
@@ -923,7 +914,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,

        updateWindowBounds(mSplitLayout, wct);
        wct.reorder(mRootTaskInfo.token, true);
        wct.setForceTranslucent(mRootTaskInfo.token, false);
        setRootForceTranslucent(false, wct);

        // TODO(b/268008375): Merge APIs to start a split pair into one.
        if (mainTaskId != INVALID_TASK_ID) {
@@ -1351,7 +1342,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
            mSideStage.removeAllTasks(wct, false /* toTop */);
            mMainStage.deactivate(wct, false /* toTop */);
            wct.reorder(mRootTaskInfo.token, false /* onTop */);
            wct.setForceTranslucent(mRootTaskInfo.token, true);
            setRootForceTranslucent(true, wct);
            wct.setBounds(mSideStage.mRootTaskInfo.token, mTempRect1);
            onTransitionAnimationComplete();
        } else {
@@ -1383,7 +1374,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                    mMainStage.deactivate(finishedWCT, childrenToTop == mMainStage /* toTop */);
                    mSideStage.removeAllTasks(finishedWCT, childrenToTop == mSideStage /* toTop */);
                    finishedWCT.reorder(mRootTaskInfo.token, false /* toTop */);
                    finishedWCT.setForceTranslucent(mRootTaskInfo.token, true);
                    setRootForceTranslucent(true, wct);
                    finishedWCT.setBounds(mSideStage.mRootTaskInfo.token, mTempRect1);
                    mSyncQueue.queue(finishedWCT);
                    mSyncQueue.runInSync(at -> {
@@ -1505,7 +1496,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        mMainStage.activate(wct, true /* includingTopTask */);
        updateWindowBounds(mSplitLayout, wct);
        wct.reorder(mRootTaskInfo.token, true);
        wct.setForceTranslucent(mRootTaskInfo.token, false);
        setRootForceTranslucent(false, wct);
    }

    void finishEnterSplitScreen(SurfaceControl.Transaction t) {
@@ -1709,6 +1700,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,

        mRootTaskInfo = null;
        mRootTaskLeash = null;
        mIsRootTranslucent = false;
    }


@@ -1727,7 +1719,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        // Make the stages adjacent to each other so they occlude what's behind them.
        wct.setAdjacentRoots(mMainStage.mRootTaskInfo.token, mSideStage.mRootTaskInfo.token);
        wct.setLaunchAdjacentFlagRoot(mSideStage.mRootTaskInfo.token);
        wct.setForceTranslucent(mRootTaskInfo.token, true);
        setRootForceTranslucent(true, wct);
        mSplitLayout.getInvisibleBounds(mTempRect1);
        wct.setBounds(mSideStage.mRootTaskInfo.token, mTempRect1);
        mSyncQueue.queue(wct);
@@ -1751,7 +1743,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
            mSideStage.evictOtherChildren(wct, taskId);
            updateWindowBounds(mSplitLayout, wct);
            wct.reorder(mRootTaskInfo.token, true);
            wct.setForceTranslucent(mRootTaskInfo.token, false);
            setRootForceTranslucent(false, wct);

            mSyncQueue.queue(wct);
            mSyncQueue.runInSync(t -> {
@@ -1775,6 +1767,13 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        mDisplayInsetsController.removeInsetsChangedListener(mDisplayId, mSplitLayout);
    }

    private void setRootForceTranslucent(boolean translucent, WindowContainerTransaction wct) {
        if (mIsRootTranslucent == translucent) return;

        mIsRootTranslucent = translucent;
        wct.setForceTranslucent(mRootTaskInfo.token, translucent);
    }

    private void onStageVisibilityChanged(StageListenerImpl stageListener) {
        // If split didn't active, just ignore this callback because we should already did these
        // on #applyExitSplitScreen.
@@ -1801,12 +1800,11 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
            // Split entering background.
            wct.setReparentLeafTaskIfRelaunch(mRootTaskInfo.token,
                    true /* setReparentLeafTaskIfRelaunch */);
            if (!mMainStage.mRootTaskInfo.isSleeping && !mSideStage.mRootTaskInfo.isSleeping) {
                wct.setForceTranslucent(mRootTaskInfo.token, true);
            }
            setRootForceTranslucent(true, wct);
        } else {
            wct.setReparentLeafTaskIfRelaunch(mRootTaskInfo.token,
                    false /* setReparentLeafTaskIfRelaunch */);
            setRootForceTranslucent(false, wct);
        }

        mSyncQueue.queue(wct);
@@ -1938,7 +1936,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                mMainStage.activate(wct, true /* includingTopTask */);
                updateWindowBounds(mSplitLayout, wct);
                wct.reorder(mRootTaskInfo.token, true);
                wct.setForceTranslucent(mRootTaskInfo.token, false);
                setRootForceTranslucent(false, wct);
            }

            mSyncQueue.queue(wct);