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

Commit a35dd7e3 authored by Liana Kazanova's avatar Liana Kazanova Committed by Android (Google) Code Review
Browse files

Merge "Revert "Add path to allow task to replace Pipped task without breaking split"" into 24D1-dev

parents 84b6ca6e f2176865
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -69,12 +69,8 @@ public class TransitionUtil {

    /** Returns {@code true} if the transition is opening or closing mode. */
    public static boolean isOpenOrCloseMode(@TransitionInfo.TransitionMode int mode) {
        return isOpeningMode(mode) || mode == TRANSIT_CLOSE || mode == TRANSIT_TO_BACK;
    }

    /** Returns {@code true} if the transition is opening mode. */
    public static boolean isOpeningMode(@TransitionInfo.TransitionMode int mode) {
        return mode == TRANSIT_OPEN || mode == TRANSIT_TO_FRONT;
        return mode == TRANSIT_OPEN || mode == TRANSIT_CLOSE
                || mode == TRANSIT_TO_FRONT || mode == TRANSIT_TO_BACK;
    }

    /** Returns {@code true} if the transition has a display change. */
+1 −2
Original line number Diff line number Diff line
@@ -843,8 +843,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
        mPipUiEventLoggerLogger.log(uiEventEnum);

        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "onTaskAppeared: %s, state=%s, taskId=%s", mTaskInfo.topActivity,
                mPipTransitionState, mTaskInfo.taskId);
                "onTaskAppeared: %s, state=%s", mTaskInfo.topActivity, mPipTransitionState);
        if (mPipTransitionState.getInSwipePipToHomeTransition()) {
            if (!mWaitForFixedRotation) {
                onEndOfSwipePipToHomeTransition();
+4 −16
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ import static com.android.wm.shell.common.split.SplitScreenUtils.reverseSplitPos
import static com.android.wm.shell.common.split.SplitScreenUtils.splitFailureMessage;
import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN;
import static com.android.wm.shell.shared.TransitionUtil.isClosingType;
import static com.android.wm.shell.shared.TransitionUtil.isOpeningMode;
import static com.android.wm.shell.shared.TransitionUtil.isOpeningType;
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_MAIN;
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_SIDE;
@@ -67,7 +66,6 @@ import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON
import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_SCREEN_LOCKED_SHOW_ON_TOP;
import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_UNKNOWN;
import static com.android.wm.shell.splitscreen.SplitScreenController.exitReasonToString;
import static com.android.wm.shell.transition.MixedTransitionHelper.getPipReplacingChange;
import static com.android.wm.shell.transition.Transitions.ENABLE_SHELL_TRANSITIONS;
import static com.android.wm.shell.transition.Transitions.TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE;
import static com.android.wm.shell.transition.Transitions.TRANSIT_SPLIT_SCREEN_PAIR_OPEN;
@@ -2804,7 +2802,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
            mSplitLayout.setFreezeDividerWindow(false);
            final StageChangeRecord record = new StageChangeRecord();
            final int transitType = info.getType();
            TransitionInfo.Change pipChange = null;
            boolean hasEnteringPip = false;
            for (int iC = 0; iC < info.getChanges().size(); ++iC) {
                final TransitionInfo.Change change = info.getChanges().get(iC);
                if (change.getMode() == TRANSIT_CHANGE
@@ -2815,7 +2813,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                }

                if (mMixedHandler.isEnteringPip(change, transitType)) {
                    pipChange = change;
                    hasEnteringPip = true;
                }

                final ActivityManager.RunningTaskInfo taskInfo = change.getTaskInfo();
@@ -2867,19 +2865,9 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                }
            }

            if (pipChange != null) {
                TransitionInfo.Change pipReplacingChange = getPipReplacingChange(info, pipChange,
                        mMainStage.mRootTaskInfo.taskId, mSideStage.mRootTaskInfo.taskId,
                        getSplitItemStage(pipChange.getLastParent()));
                if (pipReplacingChange != null) {
                    // Set an enter transition for when startAnimation gets called again
                    mSplitTransitions.setEnterTransition(transition, /*remoteTransition*/ null,
                            TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE, /*resizeAnim*/ false);
                }

            if (hasEnteringPip) {
                mMixedHandler.animatePendingEnterPipFromSplit(transition, info,
                        startTransaction, finishTransaction, finishCallback,
                        pipReplacingChange != null);
                        startTransaction, finishTransaction, finishCallback);
                return true;
            }

+2 −6
Original line number Diff line number Diff line
@@ -177,11 +177,9 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
    @Override
    @CallSuper
    public void onTaskAppeared(ActivityManager.RunningTaskInfo taskInfo, SurfaceControl leash) {
        ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onTaskAppeared: taskId=%d taskParent=%d rootTask=%d "
                        + "taskActivity=%s",
        ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onTaskAppeared: task=%d taskParent=%d rootTask=%d",
                taskInfo.taskId, taskInfo.parentTaskId,
                mRootTaskInfo != null ? mRootTaskInfo.taskId : -1,
                taskInfo.baseActivity);
                mRootTaskInfo != null ? mRootTaskInfo.taskId : -1);
        if (mRootTaskInfo == null) {
            mRootLeash = leash;
            mRootTaskInfo = taskInfo;
@@ -215,8 +213,6 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
    @Override
    @CallSuper
    public void onTaskInfoChanged(ActivityManager.RunningTaskInfo taskInfo) {
        ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onTaskInfoChanged: taskId=%d taskAct=%s",
                taskInfo.taskId, taskInfo.baseActivity);
        mWindowDecorViewModel.ifPresent(viewModel -> viewModel.onTaskInfoChanged(taskInfo));
        if (mRootTaskInfo.taskId == taskInfo.taskId) {
            // Inflates split decor view only when the root task is visible.
+3 −9
Original line number Diff line number Diff line
@@ -76,7 +76,6 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler,
    private ActivityEmbeddingController mActivityEmbeddingController;

    abstract static class MixedTransition {
        /** Entering Pip from split, breaks split. */
        static final int TYPE_ENTER_PIP_FROM_SPLIT = 1;

        /** Both the display and split-state (enter/exit) is changing */
@@ -103,9 +102,6 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler,
        /** Enter pip from one of the Activity Embedding windows. */
        static final int TYPE_ENTER_PIP_FROM_ACTIVITY_EMBEDDING = 9;

        /** Entering Pip from split, but replace the Pip stage instead of breaking split. */
        static final int TYPE_ENTER_PIP_REPLACE_FROM_SPLIT = 10;

        /** The default animation for this mixed transition. */
        static final int ANIM_TYPE_DEFAULT = 0;

@@ -487,11 +483,9 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler,
    // TODO(b/287704263): Remove when split/mixed are reversed.
    public boolean animatePendingEnterPipFromSplit(IBinder transition, TransitionInfo info,
            SurfaceControl.Transaction startT, SurfaceControl.Transaction finishT,
            Transitions.TransitionFinishCallback finishCallback, boolean replacingPip) {
        int type = replacingPip
                ? MixedTransition.TYPE_ENTER_PIP_REPLACE_FROM_SPLIT
                : MixedTransition.TYPE_ENTER_PIP_FROM_SPLIT;
        final MixedTransition mixed = createDefaultMixedTransition(type, transition);
            Transitions.TransitionFinishCallback finishCallback) {
        final MixedTransition mixed = createDefaultMixedTransition(
                MixedTransition.TYPE_ENTER_PIP_FROM_SPLIT, transition);
        mActiveTransitions.add(mixed);
        Transitions.TransitionFinishCallback callback = wct -> {
            mActiveTransitions.remove(mixed);
Loading