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

Commit 86d092aa authored by Jerry Chang's avatar Jerry Chang Committed by Android (Google) Code Review
Browse files

Merge "Consolidate leaving split screen to pip mode behavior" into tm-qpr-dev

parents 921aac6f 0f31aa29
Loading
Loading
Loading
Loading
+17 −6
Original line number Diff line number Diff line
@@ -122,6 +122,7 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
    private int mDensity;

    private final boolean mDimNonImeSide;
    private ValueAnimator mDividerFlingAnimator;

    public SplitLayout(String windowName, Context context, Configuration configuration,
            SplitLayoutHandler splitLayoutHandler,
@@ -395,6 +396,10 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
        mSplitWindowManager.release(t);
        mDisplayImeController.removePositionProcessor(mImePositionProcessor);
        mImePositionProcessor.reset();
        if (mDividerFlingAnimator != null) {
            mDividerFlingAnimator.cancel();
        }
        resetDividerPosition();
    }

    public void release() {
@@ -577,13 +582,18 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
                    CUJ_SPLIT_SCREEN_RESIZE);
            return;
        }
        ValueAnimator animator = ValueAnimator

        if (mDividerFlingAnimator != null) {
            mDividerFlingAnimator.cancel();
        }

        mDividerFlingAnimator = ValueAnimator
                .ofInt(from, to)
                .setDuration(duration);
        animator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
        animator.addUpdateListener(
        mDividerFlingAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
        mDividerFlingAnimator.addUpdateListener(
                animation -> updateDivideBounds((int) animation.getAnimatedValue()));
        animator.addListener(new AnimatorListenerAdapter() {
        mDividerFlingAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                if (flingFinishedCallback != null) {
@@ -591,14 +601,15 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
                }
                InteractionJankMonitorUtils.endTracing(
                        CUJ_SPLIT_SCREEN_RESIZE);
                mDividerFlingAnimator = null;
            }

            @Override
            public void onAnimationCancel(Animator animation) {
                setDividePosition(to, true /* applyLayoutChange */);
                mDividerFlingAnimator = null;
            }
        });
        animator.start();
        mDividerFlingAnimator.start();
    }

    /** Switch both surface position with animation. */
+1 −14
Original line number Diff line number Diff line
@@ -1040,7 +1040,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        mIsDividerRemoteAnimating = false;

        mSplitLayout.getInvisibleBounds(mTempRect1);
        if (childrenToTop == null) {
        if (childrenToTop == null || childrenToTop.getTopVisibleChildTaskId() == INVALID_TASK_ID) {
            mSideStage.removeAllTasks(wct, false /* toTop */);
            mMainStage.deactivate(wct, false /* toTop */);
            wct.reorder(mRootTaskInfo.token, false /* onTop */);
@@ -1299,13 +1299,6 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        }
    }

    private void onStageChildTaskEnterPip() {
        // When the exit split-screen is caused by one of the task enters auto pip,
        // we want both tasks to be put to bottom instead of top, otherwise it will end up
        // a fullscreen plus a pinned task instead of pinned only at the end of the transition.
        exitSplitScreen(null, EXIT_REASON_CHILD_TASK_ENTER_PIP);
    }

    private void updateRecentTasksSplitPair() {
        if (!mShouldUpdateRecents) {
            return;
@@ -2068,7 +2061,6 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
            // Update divider state after animation so that it is still around and positioned
            // properly for the animation itself.
            mSplitLayout.release();
            mSplitLayout.resetDividerPosition();
            mTopStageAfterFoldDismiss = STAGE_TYPE_UNDEFINED;
        }
    }
@@ -2344,11 +2336,6 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
            StageCoordinator.this.onStageChildTaskStatusChanged(this, taskId, present, visible);
        }

        @Override
        public void onChildTaskEnterPip() {
            StageCoordinator.this.onStageChildTaskEnterPip();
        }

        @Override
        public void onRootTaskVanished() {
            reset();
+0 −6
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.wm.shell.splitscreen;

import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.view.RemoteAnimationTarget.MODE_OPENING;

@@ -74,8 +73,6 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {

        void onChildTaskStatusChanged(int taskId, boolean present, boolean visible);

        void onChildTaskEnterPip();

        void onRootTaskVanished();

        void onNoLongerSupportMultiWindow();
@@ -257,9 +254,6 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
                // Status is managed/synchronized by the transition lifecycle.
                return;
            }
            if (taskInfo.getWindowingMode() == WINDOWING_MODE_PINNED) {
                mCallbacks.onChildTaskEnterPip();
            }
            sendStatusChanged();
        } else {
            throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo