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

Commit 2daf3cc2 authored by Ikram Gabiyev's avatar Ikram Gabiyev Committed by Android (Google) Code Review
Browse files

Merge "Allow open intent to enter PiP w/o config-at-end" into main

parents 6a7ff6fa 7654565a
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -965,11 +965,12 @@ public class PipTransition extends PipTransitionController implements

            // #getEnterPipTransaction() always attempts to mark PiP activity as config-at-end one.
            // However, the activity will only actually be marked config-at-end by Core if it is
            // both isVisible and isVisibleRequested, which is when we can't run bounds animation.
            // both isVisible and isVisibleRequested, which is when we can run bounds animation.
            //
            // So we can use the absence of a config-at-end activity as a signal that we should run
            // a legacy-enter PiP animation instead.
            return TransitionUtil.isOpeningMode(pipChange.getMode())
            return (TransitionUtil.isOpeningMode(pipChange.getMode())
                    || pipChange.getMode() == TRANSIT_CHANGE)
                    && PipTransitionUtils.getDeferConfigActivityChange(
                            info, pipChange.getContainer()) == null;
        }
+9 −9
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import com.android.wm.shell.pip.PipTransitionController;
import com.android.wm.shell.pip2.phone.transition.PipTransitionUtils;
import com.android.wm.shell.protolog.ShellProtoLogGroup;
import com.android.wm.shell.shared.TransitionUtil;
import com.android.wm.shell.shared.pip.PipFlags;
import com.android.wm.shell.splitscreen.SplitScreen;
import com.android.wm.shell.splitscreen.SplitScreenController;
import com.android.wm.shell.splitscreen.StageCoordinator;
@@ -235,7 +236,7 @@ class DefaultMixedTransition extends DefaultMixedHandler.MixedTransition {
        }

        TransitionInfo.Change pipChange = null;
        TransitionInfo.Change pipActivityChange = null;
        final TransitionInfo pipInfo = subCopy(info, TRANSIT_PIP, false /* withChanges */);
        for (int i = info.getChanges().size() - 1; i >= 0; --i) {
            TransitionInfo.Change change = info.getChanges().get(i);
            if (mPipHandler.isEnteringPip(change, info.getType())) {
@@ -245,12 +246,14 @@ class DefaultMixedTransition extends DefaultMixedHandler.MixedTransition {
                }
                pipChange = change;
                info.getChanges().remove(i);
                pipInfo.addChange(pipChange);
            } else if (change.getTaskInfo() == null && change.getParent() != null
                    && pipChange != null && change.getParent().equals(pipChange.getContainer())) {
                // Cache the PiP activity if it's a target and cached pip task change is its parent;
                // note that we are bottom-to-top, so if such activity has a task
                // that is also a target, then it must have been cached already as pipChange.
                pipActivityChange = change;
                TransitionInfo.Change pipActivityChange = info.getChanges().remove(i);
                pipInfo.getChanges().addFirst(pipActivityChange);
            }
        }
        TransitionInfo.Change desktopChange = null;
@@ -295,15 +298,12 @@ class DefaultMixedTransition extends DefaultMixedHandler.MixedTransition {
            // make a new startTransaction because pip's startEnterAnimation "consumes" it so
            // we need a separate one to send over to launcher.
            SurfaceControl.Transaction otherStartT = new SurfaceControl.Transaction();
            if (pipActivityChange == null) {
                mPipHandler.startEnterAnimation(pipChange, otherStartT, finishTransaction,
                        finishCB);
            } else {
                info.getChanges().remove(pipActivityChange);
                TransitionInfo pipInfo = subCopy(info, TRANSIT_PIP, false /* withChanges */);
                pipInfo.getChanges().addAll(List.of(pipChange, pipActivityChange));
            if (PipFlags.isPip2ExperimentEnabled()) {
                mPipHandler.startAnimation(mTransition, pipInfo, startTransaction,
                        finishTransaction, finishCB);
            } else {
                mPipHandler.startEnterAnimation(pipChange, otherStartT, finishTransaction,
                        finishCB);
            }

            // Dispatch the rest of the transition normally.