Update SystemUiProxy to support RemoteTransition when moving a task to desktop

This CL updates the methods and APIs to match the updated API from DesktopTasksController in WM Shell.
We've introduced RemoteTransition to be used for animating a task when it's moved into a desktop task.

Bug: 333524374
Fix: 379620787
Flag: com.android.window.flags.enable_desktop_windowing_mode
Test: TaplTestsOverviewDesktop
Test: OverviewDesktopTaskImageTest
Change-Id: I63cd094b3956ebe8fe7acda7da30ca73e1098ea0
This commit is contained in:
Jordan Silva
2024-11-20 15:30:31 +00:00
parent 3448777679
commit 8ec11ab65f
4 changed files with 16 additions and 9 deletions
@@ -31,6 +31,8 @@ import com.android.launcher3.util.Executors.MAIN_EXECUTOR
import com.android.quickstep.SystemUiProxy
import com.android.quickstep.TaskViewUtils
import com.android.quickstep.views.DesktopTaskView
import com.android.quickstep.views.TaskContainer
import com.android.quickstep.views.TaskView
import com.android.window.flags.Flags
import com.android.wm.shell.shared.desktopmode.DesktopModeTransitionSource
import java.util.function.Consumer
@@ -62,8 +64,12 @@ class DesktopRecentsTransitionController(
}
/** Launch desktop tasks from recents view */
fun moveToDesktop(taskId: Int, transitionSource: DesktopModeTransitionSource) {
systemUiProxy.moveToDesktop(taskId, transitionSource)
fun moveToDesktop(taskContainer: TaskContainer, transitionSource: DesktopModeTransitionSource) {
systemUiProxy.moveToDesktop(
taskContainer.task.key.id,
transitionSource,
/* transition = */ null,
)
}
/** Move task to external display from recents view */
@@ -72,7 +78,7 @@ class DesktopRecentsTransitionController(
}
private class RemoteDesktopLaunchTransitionRunner(
private val desktopTaskView: DesktopTaskView,
private val taskView: TaskView,
private val animated: Boolean,
private val stateManager: StateManager<*, *>,
private val depthController: DepthController?,
@@ -99,7 +105,7 @@ class DesktopRecentsTransitionController(
MAIN_EXECUTOR.execute {
val animator =
TaskViewUtils.composeRecentsDesktopLaunchAnimator(
desktopTaskView,
taskView,
stateManager,
depthController,
info,
@@ -1476,10 +1476,11 @@ public class SystemUiProxy implements ISystemUiProxy, NavHandle {
}
/** Call shell to move a task with given `taskId` to desktop */
public void moveToDesktop(int taskId, DesktopModeTransitionSource transitionSource) {
public void moveToDesktop(int taskId, DesktopModeTransitionSource transitionSource,
@Nullable RemoteTransition transition) {
if (mDesktopMode != null) {
try {
mDesktopMode.moveToDesktop(taskId, transitionSource);
mDesktopMode.moveToDesktop(taskId, transitionSource, transition);
} catch (RemoteException e) {
Log.w(TAG, "Failed call moveToDesktop", e);
}
@@ -559,7 +559,7 @@ public final class TaskViewUtils {
* Start recents to desktop animation
*/
public static AnimatorSet composeRecentsDesktopLaunchAnimator(
@NonNull DesktopTaskView launchingTaskView,
@NonNull TaskView launchingTaskView,
@NonNull StateManager stateManager, @Nullable DepthController depthController,
@NonNull TransitionInfo transitionInfo,
SurfaceControl.Transaction t, @NonNull Runnable finishCallback) {
@@ -6762,8 +6762,8 @@ public abstract class RecentsView<
if (mDesktopRecentsTransitionController == null) {
return;
}
mDesktopRecentsTransitionController.moveToDesktop(taskContainer.getTask().key.id,
transitionSource);
mDesktopRecentsTransitionController.moveToDesktop(taskContainer, transitionSource);
successCallback.run();
}