Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +9 −26 Original line number Diff line number Diff line Loading @@ -3226,11 +3226,7 @@ class DesktopTasksController( * Adds split screen changes to a transaction. Note that bounds are not reset here due to * animation; see {@link onDesktopSplitSelectAnimComplete} */ private fun addMoveToSplitChanges( wct: WindowContainerTransaction, taskInfo: RunningTaskInfo, deskId: Int?, ): RunOnTransitStart? { private fun addMoveToSplitChanges(wct: WindowContainerTransaction, taskInfo: RunningTaskInfo) { if (!DesktopModeFlags.ENABLE_INPUT_LAYER_TRANSITION_FIX.isTrue) { // This windowing mode is to get the transition animation started; once we complete // split select, we will change windowing mode to undefined and inherit from split Loading @@ -3242,15 +3238,6 @@ class DesktopTasksController( // The task's density may have been overridden in freeform; revert it here as we don't // want it overridden in multi-window. wct.setDensityDpi(taskInfo.token, getDefaultDensityDpi()) return performDesktopExitCleanupIfNeeded( taskId = taskInfo.taskId, displayId = taskInfo.displayId, deskId = deskId, wct = wct, forceToFullscreen = true, shouldEndUpAtHome = false, ) } /** Returns the ID of the Task that will be minimized, or null if no task will be minimized. */ Loading Loading @@ -3692,18 +3679,14 @@ class DesktopTasksController( val deskId = taskRepository.getDeskIdForTask(taskInfo.taskId) logV("Split requested for task=%d in desk=%d", taskInfo.taskId, deskId) val wct = WindowContainerTransaction() val runOnTransitStart = addMoveToSplitChanges(wct, taskInfo, deskId) val transition = addMoveToSplitChanges(wct, taskInfo) splitScreenController.requestEnterSplitSelect( taskInfo, wct, if (leftOrTop) SPLIT_POSITION_TOP_OR_LEFT else SPLIT_POSITION_BOTTOM_OR_RIGHT, if (leftOrTop) SPLIT_POSITION_TOP_OR_LEFT else SPLIT_POSITION_BOTTOM_OR_RIGHT, taskInfo.configuration.windowConfiguration.bounds, /* startRecents = */ true, /* withRecentsWct = */ wct, ) if (transition != null) { runOnTransitStart?.invoke(transition) } } } } Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DragToDesktopTransitionHandler.kt +28 −19 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.os.UserHandle import android.view.Choreographer import android.view.SurfaceControl import android.view.SurfaceControl.Transaction import android.view.WindowManager.TRANSIT_CHANGE import android.view.WindowManager.TRANSIT_CLOSE import android.window.DesktopExperienceFlags import android.window.DesktopModeFlags Loading Loading @@ -234,6 +235,7 @@ sealed class DragToDesktopTransitionHandler( * means the user wants to remain in their current windowing mode. */ fun cancelDragToDesktopTransition(cancelState: CancelState) { logV("cancelDragToDesktop cancel=%s", cancelState) if (!inProgress) { logV("cancelDragToDesktop: not in progress, returning") // Don't attempt to cancel a drag to desktop transition since there is no transition in Loading Loading @@ -278,14 +280,18 @@ sealed class DragToDesktopTransitionHandler( } else { SPLIT_POSITION_BOTTOM_OR_RIGHT } val wct = WindowContainerTransaction() restoreWindowOrder(wct, state) logV( "cancelDragToDesktop finishing start-transition and starting split-select " + "request to position=%s with state=%s", splitPosition, state, ) state.startTransitionFinishTransaction?.apply() val finishWCT = WindowContainerTransaction() val taskInfo = state.draggedTaskChange?.taskInfo ?: error("Expected non-null taskInfo") finishWCT.setDoNotPip(taskInfo.token) state.startTransitionFinishCb?.onTransitionFinished(finishWCT) requestSplitFromScaledTask(splitPosition, wct) requestSplitFromScaledTask(splitPosition, homeRunning = true) clearState() } else if ( state.draggedTaskChange != null && Loading Loading @@ -313,13 +319,13 @@ sealed class DragToDesktopTransitionHandler( /** Calculate the bounds of a scaled task, then use those bounds to request split select. */ private fun requestSplitFromScaledTask( @SplitPosition splitPosition: Int, wct: WindowContainerTransaction, homeRunning: Boolean, ) { val state = requireTransitionState() val taskInfo = state.draggedTaskChange?.taskInfo ?: error("Expected non-null taskInfo") val animatedTaskBounds = getAnimatedTaskBounds() state.dragAnimator.cancelAnimator() requestSplitSelect(wct, taskInfo, splitPosition, animatedTaskBounds) requestSplitSelect(taskInfo, splitPosition, animatedTaskBounds, homeRunning) } private fun getAnimatedTaskBounds(): Rect { Loading @@ -339,25 +345,30 @@ sealed class DragToDesktopTransitionHandler( } private fun requestSplitSelect( wct: WindowContainerTransaction, taskInfo: RunningTaskInfo, @SplitPosition splitPosition: Int, taskBounds: Rect = Rect(taskInfo.configuration.windowConfiguration.bounds), homeRunning: Boolean, ) { // Prepare to exit split in order to enter split select. if (taskInfo.windowingMode == WINDOWING_MODE_MULTI_WINDOW) { splitScreenController.prepareExitSplitScreen( wct, splitScreenController.getStageOfTask(taskInfo.taskId), SplitScreenController.EXIT_REASON_DESKTOP_MODE, ) splitScreenController.transitionHandler.onSplitToDesktop() } val wct = WindowContainerTransaction() if (!DesktopModeFlags.ENABLE_INPUT_LAYER_TRANSITION_FIX.isTrue) { wct.setWindowingMode(taskInfo.token, WINDOWING_MODE_MULTI_WINDOW) } wct.setDensityDpi(taskInfo.token, context.resources.displayMetrics.densityDpi) splitScreenController.requestEnterSplitSelect(taskInfo, wct, splitPosition, taskBounds) val startRecents = !homeRunning val delegateWctToRecents = startRecents && !wct.isEmpty if (!startRecents && !wct.isEmpty) { // Split-select won't start a transition, so apply |wct| here. transitions.startTransition(TRANSIT_CHANGE, wct, /* handler= */ null) } splitScreenController.requestEnterSplitSelect( taskInfo, splitPosition, taskBounds, startRecents, /* withRecentsWct= */ if (delegateWctToRecents) wct else null, ) } private fun requestBubbleFromScaledTask(onLeft: Boolean) { Loading Loading @@ -557,11 +568,9 @@ sealed class DragToDesktopTransitionHandler( } else { SPLIT_POSITION_BOTTOM_OR_RIGHT } val wct = WindowContainerTransaction() restoreWindowOrder(wct) state.startTransitionFinishTransaction?.apply() state.startTransitionFinishCb?.onTransitionFinished(/* wct= */ null) requestSplitSelect(wct, taskInfo, splitPosition) requestSplitSelect(taskInfo, splitPosition, homeRunning = true) } else if ( state.cancelState == CancelState.CANCEL_BUBBLE_LEFT || state.cancelState == CancelState.CANCEL_BUBBLE_RIGHT Loading libs/WindowManager/Shell/src/com/android/wm/shell/recents/IRecentTasks.aidl +3 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.app.IApplicationThread; import android.app.PendingIntent; import android.content.Intent; import android.os.Bundle; import android.window.WindowContainerTransaction; import com.android.wm.shell.recents.IRecentsAnimationRunner; import com.android.wm.shell.recents.IRecentTasksListener; Loading Loading @@ -55,5 +56,6 @@ interface IRecentTasks { * Starts a recents transition. */ oneway void startRecentsTransition(in PendingIntent intent, in Intent fillIn, in Bundle options, IApplicationThread appThread, IRecentsAnimationRunner listener) = 5; in @nullable WindowContainerTransaction wct, IApplicationThread appThread, IRecentsAnimationRunner listener) = 5; } libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentTasksController.java +3 −1 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import android.util.SparseIntArray; import android.window.DesktopExperienceFlags; import android.window.DesktopModeFlags; import android.window.WindowContainerToken; import android.window.WindowContainerTransaction; import androidx.annotation.BinderThread; import androidx.annotation.NonNull; Loading Loading @@ -1085,6 +1086,7 @@ public class RecentTasksController implements TaskStackListenerCallback, @Override public void startRecentsTransition(PendingIntent intent, Intent fillIn, Bundle options, @Nullable WindowContainerTransaction wct, IApplicationThread appThread, IRecentsAnimationRunner listener) { if (mController.mTransitionHandler == null) { Slog.e(TAG, "Used shell-transitions startRecentsTransition without" Loading @@ -1093,7 +1095,7 @@ public class RecentTasksController implements TaskStackListenerCallback, } executeRemoteCallWithTaskPermission(mController, "startRecentsTransition", (controller) -> controller.mTransitionHandler.startRecentsTransition( intent, fillIn, options, appThread, listener)); intent, fillIn, options, wct, appThread, listener)); } } } libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java +5 −4 Original line number Diff line number Diff line Loading @@ -47,7 +47,6 @@ import android.app.ActivityManager; import android.app.ActivityTaskManager; import android.app.IApplicationThread; import android.app.PendingIntent; import android.app.WindowConfiguration; import android.content.Context; import android.content.Intent; import android.graphics.Color; Loading Loading @@ -180,6 +179,7 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler, */ @VisibleForTesting public IBinder startRecentsTransition(PendingIntent intent, Intent fillIn, Bundle options, @Nullable WindowContainerTransaction wct, IApplicationThread appThread, IRecentsAnimationRunner listener) { // only care about latest one. mAnimApp = appThread; Loading @@ -194,7 +194,7 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler, if (isSyntheticRequest) { transition = startSyntheticRecentsTransition(listener); } else { transition = startRealRecentsTransition(intent, fillIn, options, listener); transition = startRealRecentsTransition(intent, fillIn, options, wct, listener); } return transition; } Loading Loading @@ -224,11 +224,12 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler, * Starts a real WM-backed recents transition. */ private IBinder startRealRecentsTransition(PendingIntent intent, Intent fillIn, Bundle options, IRecentsAnimationRunner listener) { @Nullable WindowContainerTransaction requestWct, IRecentsAnimationRunner listener) { ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION, "RecentsTransitionHandler.startRecentsTransition"); final WindowContainerTransaction wct = new WindowContainerTransaction(); final WindowContainerTransaction wct = requestWct != null ? requestWct : new WindowContainerTransaction(); wct.sendPendingIntent(intent, fillIn, options); // Find the mixed handler which should handle this request (if we are in a state where a Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +9 −26 Original line number Diff line number Diff line Loading @@ -3226,11 +3226,7 @@ class DesktopTasksController( * Adds split screen changes to a transaction. Note that bounds are not reset here due to * animation; see {@link onDesktopSplitSelectAnimComplete} */ private fun addMoveToSplitChanges( wct: WindowContainerTransaction, taskInfo: RunningTaskInfo, deskId: Int?, ): RunOnTransitStart? { private fun addMoveToSplitChanges(wct: WindowContainerTransaction, taskInfo: RunningTaskInfo) { if (!DesktopModeFlags.ENABLE_INPUT_LAYER_TRANSITION_FIX.isTrue) { // This windowing mode is to get the transition animation started; once we complete // split select, we will change windowing mode to undefined and inherit from split Loading @@ -3242,15 +3238,6 @@ class DesktopTasksController( // The task's density may have been overridden in freeform; revert it here as we don't // want it overridden in multi-window. wct.setDensityDpi(taskInfo.token, getDefaultDensityDpi()) return performDesktopExitCleanupIfNeeded( taskId = taskInfo.taskId, displayId = taskInfo.displayId, deskId = deskId, wct = wct, forceToFullscreen = true, shouldEndUpAtHome = false, ) } /** Returns the ID of the Task that will be minimized, or null if no task will be minimized. */ Loading Loading @@ -3692,18 +3679,14 @@ class DesktopTasksController( val deskId = taskRepository.getDeskIdForTask(taskInfo.taskId) logV("Split requested for task=%d in desk=%d", taskInfo.taskId, deskId) val wct = WindowContainerTransaction() val runOnTransitStart = addMoveToSplitChanges(wct, taskInfo, deskId) val transition = addMoveToSplitChanges(wct, taskInfo) splitScreenController.requestEnterSplitSelect( taskInfo, wct, if (leftOrTop) SPLIT_POSITION_TOP_OR_LEFT else SPLIT_POSITION_BOTTOM_OR_RIGHT, if (leftOrTop) SPLIT_POSITION_TOP_OR_LEFT else SPLIT_POSITION_BOTTOM_OR_RIGHT, taskInfo.configuration.windowConfiguration.bounds, /* startRecents = */ true, /* withRecentsWct = */ wct, ) if (transition != null) { runOnTransitStart?.invoke(transition) } } } } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DragToDesktopTransitionHandler.kt +28 −19 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.os.UserHandle import android.view.Choreographer import android.view.SurfaceControl import android.view.SurfaceControl.Transaction import android.view.WindowManager.TRANSIT_CHANGE import android.view.WindowManager.TRANSIT_CLOSE import android.window.DesktopExperienceFlags import android.window.DesktopModeFlags Loading Loading @@ -234,6 +235,7 @@ sealed class DragToDesktopTransitionHandler( * means the user wants to remain in their current windowing mode. */ fun cancelDragToDesktopTransition(cancelState: CancelState) { logV("cancelDragToDesktop cancel=%s", cancelState) if (!inProgress) { logV("cancelDragToDesktop: not in progress, returning") // Don't attempt to cancel a drag to desktop transition since there is no transition in Loading Loading @@ -278,14 +280,18 @@ sealed class DragToDesktopTransitionHandler( } else { SPLIT_POSITION_BOTTOM_OR_RIGHT } val wct = WindowContainerTransaction() restoreWindowOrder(wct, state) logV( "cancelDragToDesktop finishing start-transition and starting split-select " + "request to position=%s with state=%s", splitPosition, state, ) state.startTransitionFinishTransaction?.apply() val finishWCT = WindowContainerTransaction() val taskInfo = state.draggedTaskChange?.taskInfo ?: error("Expected non-null taskInfo") finishWCT.setDoNotPip(taskInfo.token) state.startTransitionFinishCb?.onTransitionFinished(finishWCT) requestSplitFromScaledTask(splitPosition, wct) requestSplitFromScaledTask(splitPosition, homeRunning = true) clearState() } else if ( state.draggedTaskChange != null && Loading Loading @@ -313,13 +319,13 @@ sealed class DragToDesktopTransitionHandler( /** Calculate the bounds of a scaled task, then use those bounds to request split select. */ private fun requestSplitFromScaledTask( @SplitPosition splitPosition: Int, wct: WindowContainerTransaction, homeRunning: Boolean, ) { val state = requireTransitionState() val taskInfo = state.draggedTaskChange?.taskInfo ?: error("Expected non-null taskInfo") val animatedTaskBounds = getAnimatedTaskBounds() state.dragAnimator.cancelAnimator() requestSplitSelect(wct, taskInfo, splitPosition, animatedTaskBounds) requestSplitSelect(taskInfo, splitPosition, animatedTaskBounds, homeRunning) } private fun getAnimatedTaskBounds(): Rect { Loading @@ -339,25 +345,30 @@ sealed class DragToDesktopTransitionHandler( } private fun requestSplitSelect( wct: WindowContainerTransaction, taskInfo: RunningTaskInfo, @SplitPosition splitPosition: Int, taskBounds: Rect = Rect(taskInfo.configuration.windowConfiguration.bounds), homeRunning: Boolean, ) { // Prepare to exit split in order to enter split select. if (taskInfo.windowingMode == WINDOWING_MODE_MULTI_WINDOW) { splitScreenController.prepareExitSplitScreen( wct, splitScreenController.getStageOfTask(taskInfo.taskId), SplitScreenController.EXIT_REASON_DESKTOP_MODE, ) splitScreenController.transitionHandler.onSplitToDesktop() } val wct = WindowContainerTransaction() if (!DesktopModeFlags.ENABLE_INPUT_LAYER_TRANSITION_FIX.isTrue) { wct.setWindowingMode(taskInfo.token, WINDOWING_MODE_MULTI_WINDOW) } wct.setDensityDpi(taskInfo.token, context.resources.displayMetrics.densityDpi) splitScreenController.requestEnterSplitSelect(taskInfo, wct, splitPosition, taskBounds) val startRecents = !homeRunning val delegateWctToRecents = startRecents && !wct.isEmpty if (!startRecents && !wct.isEmpty) { // Split-select won't start a transition, so apply |wct| here. transitions.startTransition(TRANSIT_CHANGE, wct, /* handler= */ null) } splitScreenController.requestEnterSplitSelect( taskInfo, splitPosition, taskBounds, startRecents, /* withRecentsWct= */ if (delegateWctToRecents) wct else null, ) } private fun requestBubbleFromScaledTask(onLeft: Boolean) { Loading Loading @@ -557,11 +568,9 @@ sealed class DragToDesktopTransitionHandler( } else { SPLIT_POSITION_BOTTOM_OR_RIGHT } val wct = WindowContainerTransaction() restoreWindowOrder(wct) state.startTransitionFinishTransaction?.apply() state.startTransitionFinishCb?.onTransitionFinished(/* wct= */ null) requestSplitSelect(wct, taskInfo, splitPosition) requestSplitSelect(taskInfo, splitPosition, homeRunning = true) } else if ( state.cancelState == CancelState.CANCEL_BUBBLE_LEFT || state.cancelState == CancelState.CANCEL_BUBBLE_RIGHT Loading
libs/WindowManager/Shell/src/com/android/wm/shell/recents/IRecentTasks.aidl +3 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.app.IApplicationThread; import android.app.PendingIntent; import android.content.Intent; import android.os.Bundle; import android.window.WindowContainerTransaction; import com.android.wm.shell.recents.IRecentsAnimationRunner; import com.android.wm.shell.recents.IRecentTasksListener; Loading Loading @@ -55,5 +56,6 @@ interface IRecentTasks { * Starts a recents transition. */ oneway void startRecentsTransition(in PendingIntent intent, in Intent fillIn, in Bundle options, IApplicationThread appThread, IRecentsAnimationRunner listener) = 5; in @nullable WindowContainerTransaction wct, IApplicationThread appThread, IRecentsAnimationRunner listener) = 5; }
libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentTasksController.java +3 −1 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import android.util.SparseIntArray; import android.window.DesktopExperienceFlags; import android.window.DesktopModeFlags; import android.window.WindowContainerToken; import android.window.WindowContainerTransaction; import androidx.annotation.BinderThread; import androidx.annotation.NonNull; Loading Loading @@ -1085,6 +1086,7 @@ public class RecentTasksController implements TaskStackListenerCallback, @Override public void startRecentsTransition(PendingIntent intent, Intent fillIn, Bundle options, @Nullable WindowContainerTransaction wct, IApplicationThread appThread, IRecentsAnimationRunner listener) { if (mController.mTransitionHandler == null) { Slog.e(TAG, "Used shell-transitions startRecentsTransition without" Loading @@ -1093,7 +1095,7 @@ public class RecentTasksController implements TaskStackListenerCallback, } executeRemoteCallWithTaskPermission(mController, "startRecentsTransition", (controller) -> controller.mTransitionHandler.startRecentsTransition( intent, fillIn, options, appThread, listener)); intent, fillIn, options, wct, appThread, listener)); } } }
libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java +5 −4 Original line number Diff line number Diff line Loading @@ -47,7 +47,6 @@ import android.app.ActivityManager; import android.app.ActivityTaskManager; import android.app.IApplicationThread; import android.app.PendingIntent; import android.app.WindowConfiguration; import android.content.Context; import android.content.Intent; import android.graphics.Color; Loading Loading @@ -180,6 +179,7 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler, */ @VisibleForTesting public IBinder startRecentsTransition(PendingIntent intent, Intent fillIn, Bundle options, @Nullable WindowContainerTransaction wct, IApplicationThread appThread, IRecentsAnimationRunner listener) { // only care about latest one. mAnimApp = appThread; Loading @@ -194,7 +194,7 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler, if (isSyntheticRequest) { transition = startSyntheticRecentsTransition(listener); } else { transition = startRealRecentsTransition(intent, fillIn, options, listener); transition = startRealRecentsTransition(intent, fillIn, options, wct, listener); } return transition; } Loading Loading @@ -224,11 +224,12 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler, * Starts a real WM-backed recents transition. */ private IBinder startRealRecentsTransition(PendingIntent intent, Intent fillIn, Bundle options, IRecentsAnimationRunner listener) { @Nullable WindowContainerTransaction requestWct, IRecentsAnimationRunner listener) { ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION, "RecentsTransitionHandler.startRecentsTransition"); final WindowContainerTransaction wct = new WindowContainerTransaction(); final WindowContainerTransaction wct = requestWct != null ? requestWct : new WindowContainerTransaction(); wct.sendPendingIntent(intent, fillIn, options); // Find the mixed handler which should handle this request (if we are in a state where a Loading