Add task menu item to move task to external display

Call SystemUiProxy.moveToExternalDisplay to move existing Overview task to desktop in external display

Bug: 372872848
Test: atest
NexusLauncherTests:com.android.quickstep.ExternalDisplaySystemShortcutTest
Flag: com.android.window.flags.move_to_external_display_shortcut
Change-Id: I096a9839956ab5cab86bd0aaabc625a8587ca42a
This commit is contained in:
Graciela Wissen Putri
2024-10-14 10:32:22 +00:00
parent 9777937d41
commit 2f4ccc63b6
9 changed files with 345 additions and 0 deletions
@@ -6673,6 +6673,26 @@ public abstract class RecentsView<
successCallback.run();
}
/**
* Move the provided task into external display and invoke {@code successCallback} if succeeded.
*/
public void moveTaskToExternalDisplay(TaskContainer taskContainer, Runnable successCallback) {
if (!DesktopModeStatus.canEnterDesktopMode(mContext)) {
return;
}
switchToScreenshot(() -> finishRecentsAnimation(/* toRecents= */true, /* shouldPip= */false,
() -> moveTaskToDesktopInternal(taskContainer, successCallback)));
}
private void moveTaskToDesktopInternal(TaskContainer taskContainer, Runnable successCallback) {
if (mDesktopRecentsTransitionController == null) {
return;
}
mDesktopRecentsTransitionController.moveToExternalDisplay(taskContainer.getTask().key.id);
successCallback.run();
}
// Logs when the orientation of Overview changes. We log both real and fake orientation changes.
private void logOrientationChanged() {
// Only log when Overview is showing.