Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopMixedTransitionHandler.kt +4 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,10 @@ class DesktopMixedTransitionHandler( override fun startMinimizedModeTransition(wct: WindowContainerTransaction?): IBinder = freeformTaskTransitionHandler.startMinimizedModeTransition(wct) /** Delegates starting PiP transition to [FreeformTaskTransitionHandler]. */ override fun startPipTransition(wct: WindowContainerTransaction?): IBinder = freeformTaskTransitionHandler.startPipTransition(wct) /** Starts close transition and handles or delegates desktop task close animation. */ override fun startRemoveTransition(wct: WindowContainerTransaction?): IBinder { if ( Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +37 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import android.view.WindowManager.TRANSIT_CHANGE import android.view.WindowManager.TRANSIT_CLOSE import android.view.WindowManager.TRANSIT_NONE import android.view.WindowManager.TRANSIT_OPEN import android.view.WindowManager.TRANSIT_PIP import android.view.WindowManager.TRANSIT_TO_FRONT import android.widget.Toast import android.window.DesktopModeFlags Loading Loading @@ -220,6 +221,7 @@ class DesktopTasksController( // Launch cookie used to identify a drag and drop transition to fullscreen after it has begun. // Used to prevent handleRequest from moving the new fullscreen task to freeform. private var dragAndDropFullscreenCookie: Binder? = null private var pendingPipTransitionAndTask: Pair<IBinder, Int>? = null init { desktopMode = DesktopModeImpl() Loading Loading @@ -557,6 +559,26 @@ class DesktopTasksController( } fun minimizeTask(taskInfo: RunningTaskInfo) { val wct = WindowContainerTransaction() val isMinimizingToPip = taskInfo.pictureInPictureParams?.isAutoEnterEnabled() ?: false // If task is going to PiP, start a PiP transition instead of a minimize transition if (isMinimizingToPip) { val requestInfo = TransitionRequestInfo( TRANSIT_PIP, /* triggerTask= */ null, taskInfo, /* remoteTransition= */ null, /* displayChange= */ null, /* flags= */ 0 ) val requestRes = transitions.dispatchRequest(Binder(), requestInfo, /* skip= */ null) wct.merge(requestRes.second, true) pendingPipTransitionAndTask = freeformTaskTransitionStarter.startPipTransition(wct) to taskInfo.taskId return } minimizeTaskInner(taskInfo) } private fun minimizeTaskInner(taskInfo: RunningTaskInfo) { val taskId = taskInfo.taskId val displayId = taskInfo.displayId val wct = WindowContainerTransaction() Loading Loading @@ -1335,6 +1357,21 @@ class DesktopTasksController( return false } override fun onTransitionConsumed( transition: IBinder, aborted: Boolean, finishT: Transaction? ) { pendingPipTransitionAndTask?.let { (pipTransition, taskId) -> if (transition == pipTransition) { if (aborted) { shellTaskOrganizer.getRunningTaskInfo(taskId)?.let { minimizeTaskInner(it) } } pendingPipTransitionAndTask = null } } } override fun handleRequest( transition: IBinder, request: TransitionRequestInfo, Loading libs/WindowManager/Shell/src/com/android/wm/shell/freeform/FreeformTaskTransitionHandler.java +7 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.wm.shell.freeform; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.view.WindowManager.TRANSIT_PIP; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; Loading Loading @@ -99,6 +100,12 @@ public class FreeformTaskTransitionHandler return token; } @Override public IBinder startPipTransition(WindowContainerTransaction wct) { final IBinder token = mTransitions.startTransition(TRANSIT_PIP, wct, null); mPendingTransitionTokens.add(token); return token; } @Override public IBinder startRemoveTransition(WindowContainerTransaction wct) { Loading libs/WindowManager/Shell/src/com/android/wm/shell/freeform/FreeformTaskTransitionStarter.java +9 −0 Original line number Diff line number Diff line Loading @@ -51,4 +51,13 @@ public interface FreeformTaskTransitionStarter { * @return the started transition */ IBinder startRemoveTransition(WindowContainerTransaction wct); /** * Starts PiP transition * * @param wct the {@link WindowContainerTransaction} that launches the PiP * * @return the started transition */ IBinder startPipTransition(WindowContainerTransaction wct); } No newline at end of file libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java +5 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ import android.window.WindowContainerTransaction; import androidx.annotation.Nullable; import com.android.internal.util.Preconditions; import com.android.window.flags.Flags; import com.android.wm.shell.ShellTaskOrganizer; import com.android.wm.shell.common.pip.PipBoundsAlgorithm; import com.android.wm.shell.common.pip.PipBoundsState; Loading Loading @@ -729,6 +730,10 @@ public class PipTransition extends PipTransitionController implements && getFixedRotationDelta(info, pipTaskChange) == ROTATION_90) { adjustedSourceRectHint.offset(cutoutInsets.left, cutoutInsets.top); } if (Flags.enableDesktopWindowingPip()) { adjustedSourceRectHint.offset(-pipActivityChange.getStartAbsBounds().left, -pipActivityChange.getStartAbsBounds().top); } } else { // For non-valid app provided src-rect-hint, calculate one to crop into during // app icon overlay animation. Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopMixedTransitionHandler.kt +4 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,10 @@ class DesktopMixedTransitionHandler( override fun startMinimizedModeTransition(wct: WindowContainerTransaction?): IBinder = freeformTaskTransitionHandler.startMinimizedModeTransition(wct) /** Delegates starting PiP transition to [FreeformTaskTransitionHandler]. */ override fun startPipTransition(wct: WindowContainerTransaction?): IBinder = freeformTaskTransitionHandler.startPipTransition(wct) /** Starts close transition and handles or delegates desktop task close animation. */ override fun startRemoveTransition(wct: WindowContainerTransaction?): IBinder { if ( Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +37 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import android.view.WindowManager.TRANSIT_CHANGE import android.view.WindowManager.TRANSIT_CLOSE import android.view.WindowManager.TRANSIT_NONE import android.view.WindowManager.TRANSIT_OPEN import android.view.WindowManager.TRANSIT_PIP import android.view.WindowManager.TRANSIT_TO_FRONT import android.widget.Toast import android.window.DesktopModeFlags Loading Loading @@ -220,6 +221,7 @@ class DesktopTasksController( // Launch cookie used to identify a drag and drop transition to fullscreen after it has begun. // Used to prevent handleRequest from moving the new fullscreen task to freeform. private var dragAndDropFullscreenCookie: Binder? = null private var pendingPipTransitionAndTask: Pair<IBinder, Int>? = null init { desktopMode = DesktopModeImpl() Loading Loading @@ -557,6 +559,26 @@ class DesktopTasksController( } fun minimizeTask(taskInfo: RunningTaskInfo) { val wct = WindowContainerTransaction() val isMinimizingToPip = taskInfo.pictureInPictureParams?.isAutoEnterEnabled() ?: false // If task is going to PiP, start a PiP transition instead of a minimize transition if (isMinimizingToPip) { val requestInfo = TransitionRequestInfo( TRANSIT_PIP, /* triggerTask= */ null, taskInfo, /* remoteTransition= */ null, /* displayChange= */ null, /* flags= */ 0 ) val requestRes = transitions.dispatchRequest(Binder(), requestInfo, /* skip= */ null) wct.merge(requestRes.second, true) pendingPipTransitionAndTask = freeformTaskTransitionStarter.startPipTransition(wct) to taskInfo.taskId return } minimizeTaskInner(taskInfo) } private fun minimizeTaskInner(taskInfo: RunningTaskInfo) { val taskId = taskInfo.taskId val displayId = taskInfo.displayId val wct = WindowContainerTransaction() Loading Loading @@ -1335,6 +1357,21 @@ class DesktopTasksController( return false } override fun onTransitionConsumed( transition: IBinder, aborted: Boolean, finishT: Transaction? ) { pendingPipTransitionAndTask?.let { (pipTransition, taskId) -> if (transition == pipTransition) { if (aborted) { shellTaskOrganizer.getRunningTaskInfo(taskId)?.let { minimizeTaskInner(it) } } pendingPipTransitionAndTask = null } } } override fun handleRequest( transition: IBinder, request: TransitionRequestInfo, Loading
libs/WindowManager/Shell/src/com/android/wm/shell/freeform/FreeformTaskTransitionHandler.java +7 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.wm.shell.freeform; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.view.WindowManager.TRANSIT_PIP; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; Loading Loading @@ -99,6 +100,12 @@ public class FreeformTaskTransitionHandler return token; } @Override public IBinder startPipTransition(WindowContainerTransaction wct) { final IBinder token = mTransitions.startTransition(TRANSIT_PIP, wct, null); mPendingTransitionTokens.add(token); return token; } @Override public IBinder startRemoveTransition(WindowContainerTransaction wct) { Loading
libs/WindowManager/Shell/src/com/android/wm/shell/freeform/FreeformTaskTransitionStarter.java +9 −0 Original line number Diff line number Diff line Loading @@ -51,4 +51,13 @@ public interface FreeformTaskTransitionStarter { * @return the started transition */ IBinder startRemoveTransition(WindowContainerTransaction wct); /** * Starts PiP transition * * @param wct the {@link WindowContainerTransaction} that launches the PiP * * @return the started transition */ IBinder startPipTransition(WindowContainerTransaction wct); } No newline at end of file
libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java +5 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ import android.window.WindowContainerTransaction; import androidx.annotation.Nullable; import com.android.internal.util.Preconditions; import com.android.window.flags.Flags; import com.android.wm.shell.ShellTaskOrganizer; import com.android.wm.shell.common.pip.PipBoundsAlgorithm; import com.android.wm.shell.common.pip.PipBoundsState; Loading Loading @@ -729,6 +730,10 @@ public class PipTransition extends PipTransitionController implements && getFixedRotationDelta(info, pipTaskChange) == ROTATION_90) { adjustedSourceRectHint.offset(cutoutInsets.left, cutoutInsets.top); } if (Flags.enableDesktopWindowingPip()) { adjustedSourceRectHint.offset(-pipActivityChange.getStartAbsBounds().left, -pipActivityChange.getStartAbsBounds().top); } } else { // For non-valid app provided src-rect-hint, calculate one to crop into during // app icon overlay animation. Loading