Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java +32 −2 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTI import static com.android.wm.shell.pip.PipAnimationController.isInPipDirection; import static com.android.wm.shell.pip.PipAnimationController.isOutPipDirection; import static com.android.wm.shell.pip.PipTransitionState.ENTERED_PIP; import static com.android.wm.shell.transition.Transitions.TRANSIT_CLEANUP_PIP_EXIT; import static com.android.wm.shell.transition.Transitions.TRANSIT_EXIT_PIP; import static com.android.wm.shell.transition.Transitions.TRANSIT_EXIT_PIP_TO_SPLIT; import static com.android.wm.shell.transition.Transitions.TRANSIT_REMOVE_PIP; Loading Loading @@ -122,6 +123,8 @@ public class PipTransition extends PipTransitionController { @Nullable private IBinder mMoveToBackTransition; private IBinder mRequestedEnterTransition; private IBinder mCleanupTransition; private WindowContainerToken mRequestedEnterTask; /** The Task window that is currently in PIP windowing mode. */ @Nullable Loading Loading @@ -232,10 +235,12 @@ public class PipTransition extends PipTransitionController { // Exiting PIP. final int type = info.getType(); if (transition.equals(mExitTransition) || transition.equals(mMoveToBackTransition)) { if (transition.equals(mExitTransition) || transition.equals(mMoveToBackTransition) || transition.equals(mCleanupTransition)) { mExitDestinationBounds.setEmpty(); mExitTransition = null; mMoveToBackTransition = null; mCleanupTransition = null; mHasFadeOut = false; if (mFinishCallback != null) { callFinishCallback(null /* wct */); Loading Loading @@ -269,6 +274,9 @@ public class PipTransition extends PipTransitionController { removePipImmediately(info, startTransaction, finishTransaction, finishCallback, pipTaskInfo); break; case TRANSIT_CLEANUP_PIP_EXIT: cleanupPipExitTransition(startTransaction, finishCallback); break; default: throw new IllegalStateException("mExitTransition with unexpected transit type=" + transitTypeToString(type)); Loading Loading @@ -768,7 +776,19 @@ public class PipTransition extends PipTransitionController { mPipAnimationController.resetAnimatorState(); finishTransaction.remove(pipLeash); } if (mFixedRotationState == FIXED_ROTATION_TRANSITION) { // TODO(b/358226697): start a new transition with the WCT instead of applying it in // the {@link finishCallback}, to ensure shell creates a transition for it. finishCallback.onTransitionFinished(wct); } else { // Apply wct in separate transition so that it can be correctly handled by the // {@link FreeformTaskTransitionObserver} when desktop windowing (which does not // utilize fixed rotation transitions for exiting pip) is enabled (See b/288910069). mCleanupTransition = mTransitions.startTransition( TRANSIT_CLEANUP_PIP_EXIT, wct, this); finishCallback.onTransitionFinished(null); } }; mFinishTransaction = finishTransaction; Loading Loading @@ -914,6 +934,16 @@ public class PipTransition extends PipTransitionController { finishCallback.onTransitionFinished(null); } /** * For {@link Transitions#TRANSIT_CLEANUP_PIP_EXIT} which applies final config changes needed * after the exit from pip transition animation finishes. */ private void cleanupPipExitTransition(@NonNull SurfaceControl.Transaction startTransaction, @NonNull Transitions.TransitionFinishCallback finishCallback) { startTransaction.apply(); finishCallback.onTransitionFinished(null); } /** Whether we should handle the given {@link TransitionInfo} animation as entering PIP. */ private boolean isEnteringPip(@NonNull TransitionInfo info) { for (int i = info.getChanges().size() - 1; i >= 0; --i) { Loading libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java +3 −0 Original line number Diff line number Diff line Loading @@ -193,6 +193,9 @@ public class Transitions implements RemoteCallable<Transitions>, /** Remote Transition that split accepts but ultimately needs to be animated by the remote. */ public static final int TRANSIT_SPLIT_PASSTHROUGH = TRANSIT_FIRST_CUSTOM + 18; /** Transition to set windowing mode after exit pip transition is finished animating. */ public static final int TRANSIT_CLEANUP_PIP_EXIT = WindowManager.TRANSIT_FIRST_CUSTOM + 19; /** Transition type for desktop mode transitions. */ public static final int TRANSIT_DESKTOP_MODE_TYPES = WindowManager.TRANSIT_FIRST_CUSTOM + 100; Loading services/core/java/com/android/server/wm/WindowContainer.java +13 −6 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.server.wm; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_BEHIND; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; Loading Loading @@ -2997,12 +2998,18 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< // Make sure display isn't a part of the transition already - needed for legacy transitions. if (mDisplayContent.inTransition()) return false; if (!ActivityTaskManagerService.isPip2ExperimentEnabled()) { // Screenshots are turned off when PiP is undergoing changes. return !inPinnedWindowingMode() && getParent() != null && !getParent().inPinnedWindowingMode(); return ActivityTaskManagerService.isPip2ExperimentEnabled() || !isPipChange(); } return true; /** Returns true if WC is pinned and undergoing changes. */ private boolean isPipChange() { final boolean isExitingPip = this.asTaskFragment() != null && mTransitionController.getWindowingModeAtStart(this) == WINDOWING_MODE_PINNED && !inPinnedWindowingMode(); return isExitingPip || inPinnedWindowingMode() || (getParent() != null && getParent().inPinnedWindowingMode()); } /** Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java +32 −2 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTI import static com.android.wm.shell.pip.PipAnimationController.isInPipDirection; import static com.android.wm.shell.pip.PipAnimationController.isOutPipDirection; import static com.android.wm.shell.pip.PipTransitionState.ENTERED_PIP; import static com.android.wm.shell.transition.Transitions.TRANSIT_CLEANUP_PIP_EXIT; import static com.android.wm.shell.transition.Transitions.TRANSIT_EXIT_PIP; import static com.android.wm.shell.transition.Transitions.TRANSIT_EXIT_PIP_TO_SPLIT; import static com.android.wm.shell.transition.Transitions.TRANSIT_REMOVE_PIP; Loading Loading @@ -122,6 +123,8 @@ public class PipTransition extends PipTransitionController { @Nullable private IBinder mMoveToBackTransition; private IBinder mRequestedEnterTransition; private IBinder mCleanupTransition; private WindowContainerToken mRequestedEnterTask; /** The Task window that is currently in PIP windowing mode. */ @Nullable Loading Loading @@ -232,10 +235,12 @@ public class PipTransition extends PipTransitionController { // Exiting PIP. final int type = info.getType(); if (transition.equals(mExitTransition) || transition.equals(mMoveToBackTransition)) { if (transition.equals(mExitTransition) || transition.equals(mMoveToBackTransition) || transition.equals(mCleanupTransition)) { mExitDestinationBounds.setEmpty(); mExitTransition = null; mMoveToBackTransition = null; mCleanupTransition = null; mHasFadeOut = false; if (mFinishCallback != null) { callFinishCallback(null /* wct */); Loading Loading @@ -269,6 +274,9 @@ public class PipTransition extends PipTransitionController { removePipImmediately(info, startTransaction, finishTransaction, finishCallback, pipTaskInfo); break; case TRANSIT_CLEANUP_PIP_EXIT: cleanupPipExitTransition(startTransaction, finishCallback); break; default: throw new IllegalStateException("mExitTransition with unexpected transit type=" + transitTypeToString(type)); Loading Loading @@ -768,7 +776,19 @@ public class PipTransition extends PipTransitionController { mPipAnimationController.resetAnimatorState(); finishTransaction.remove(pipLeash); } if (mFixedRotationState == FIXED_ROTATION_TRANSITION) { // TODO(b/358226697): start a new transition with the WCT instead of applying it in // the {@link finishCallback}, to ensure shell creates a transition for it. finishCallback.onTransitionFinished(wct); } else { // Apply wct in separate transition so that it can be correctly handled by the // {@link FreeformTaskTransitionObserver} when desktop windowing (which does not // utilize fixed rotation transitions for exiting pip) is enabled (See b/288910069). mCleanupTransition = mTransitions.startTransition( TRANSIT_CLEANUP_PIP_EXIT, wct, this); finishCallback.onTransitionFinished(null); } }; mFinishTransaction = finishTransaction; Loading Loading @@ -914,6 +934,16 @@ public class PipTransition extends PipTransitionController { finishCallback.onTransitionFinished(null); } /** * For {@link Transitions#TRANSIT_CLEANUP_PIP_EXIT} which applies final config changes needed * after the exit from pip transition animation finishes. */ private void cleanupPipExitTransition(@NonNull SurfaceControl.Transaction startTransaction, @NonNull Transitions.TransitionFinishCallback finishCallback) { startTransaction.apply(); finishCallback.onTransitionFinished(null); } /** Whether we should handle the given {@link TransitionInfo} animation as entering PIP. */ private boolean isEnteringPip(@NonNull TransitionInfo info) { for (int i = info.getChanges().size() - 1; i >= 0; --i) { Loading
libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java +3 −0 Original line number Diff line number Diff line Loading @@ -193,6 +193,9 @@ public class Transitions implements RemoteCallable<Transitions>, /** Remote Transition that split accepts but ultimately needs to be animated by the remote. */ public static final int TRANSIT_SPLIT_PASSTHROUGH = TRANSIT_FIRST_CUSTOM + 18; /** Transition to set windowing mode after exit pip transition is finished animating. */ public static final int TRANSIT_CLEANUP_PIP_EXIT = WindowManager.TRANSIT_FIRST_CUSTOM + 19; /** Transition type for desktop mode transitions. */ public static final int TRANSIT_DESKTOP_MODE_TYPES = WindowManager.TRANSIT_FIRST_CUSTOM + 100; Loading
services/core/java/com/android/server/wm/WindowContainer.java +13 −6 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.server.wm; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_BEHIND; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; Loading Loading @@ -2997,12 +2998,18 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< // Make sure display isn't a part of the transition already - needed for legacy transitions. if (mDisplayContent.inTransition()) return false; if (!ActivityTaskManagerService.isPip2ExperimentEnabled()) { // Screenshots are turned off when PiP is undergoing changes. return !inPinnedWindowingMode() && getParent() != null && !getParent().inPinnedWindowingMode(); return ActivityTaskManagerService.isPip2ExperimentEnabled() || !isPipChange(); } return true; /** Returns true if WC is pinned and undergoing changes. */ private boolean isPipChange() { final boolean isExitingPip = this.asTaskFragment() != null && mTransitionController.getWindowingModeAtStart(this) == WINDOWING_MODE_PINNED && !inPinnedWindowingMode(); return isExitingPip || inPinnedWindowingMode() || (getParent() != null && getParent().inPinnedWindowingMode()); } /** Loading