Open Task into Desktop Mode when Taksbar is in DesktopMode
This cl includes
- opening app from taskbar context is now aware of if taskbar is in desktop mode and opens app in Desktop Mode when user oepn any app.
- This cl will not include the animation when taskbar variant is changing between launcher and desktop mode.
Solution
- if desktop tasks are visible we will open any app from taskbar context into Desktop windowing mode after launching the DesktopTaskView manually. We will launch desktop task from recentview first and upon end of recent animation we will launch the app.
Bug: 343882478
Test: Manual
Flag: com.android.window.flags.enable_desktop_windowing_mode
Change-Id: I7d235179e8700755a7d6b032601136ad4296b090
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
index d7e5c61..0a83ceb 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
@@ -1274,9 +1274,25 @@
} else if (tag instanceof TaskItemInfo info) {
RemoteTransition remoteTransition = canUnminimizeDesktopTask(info.getTaskId())
? createUnminimizeRemoteTransition() : null;
- UI_HELPER_EXECUTOR.execute(() ->
- SystemUiProxy.INSTANCE.get(this).showDesktopApp(
- info.getTaskId(), remoteTransition));
+
+ if (areDesktopTasksVisible() && recents != null) {
+ TaskView taskView = recents.getTaskViewByTaskId(info.getTaskId());
+ if (taskView == null) return;
+ RunnableList runnableList = taskView.launchWithAnimation();
+ if (runnableList != null) {
+ runnableList.add(() ->
+ // wrapped it in runnable here since we need the post for DW to be
+ // ready. if we don't other DW will be gone and only the launched task
+ // will show.
+ UI_HELPER_EXECUTOR.execute(() ->
+ SystemUiProxy.INSTANCE.get(this).showDesktopApp(
+ info.getTaskId(), remoteTransition)));
+ }
+ } else {
+ UI_HELPER_EXECUTOR.execute(() ->
+ SystemUiProxy.INSTANCE.get(this).showDesktopApp(
+ info.getTaskId(), remoteTransition));
+ }
mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(
/* stash= */ true);
} else if (tag instanceof WorkspaceItemInfo) {
@@ -1518,7 +1534,17 @@
.launchAppPair((AppPairIcon) launchingIconView,
-1 /*cuj*/)));
} else {
- startItemInfoActivity(itemInfos.get(0), foundTask);
+ if (areDesktopTasksVisible()) {
+ RunnableList runnableList = recents.launchDesktopTaskView();
+ // Wrapping it in runnable so we post after DW is ready for the app
+ // launch.
+ if (runnableList != null) {
+ runnableList.add(() -> UI_HELPER_EXECUTOR.execute(
+ () -> startItemInfoActivity(itemInfos.get(0), foundTask)));
+ }
+ } else {
+ startItemInfoActivity(itemInfos.get(0), foundTask);
+ }
}
}
);
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 92c93ff..41802e8 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -1499,6 +1499,19 @@
}
/**
+ * Launch DesktopTaskView if found.
+ * @return provides runnable list to attach runnable at end of Desktop Mode launch
+ */
+ public RunnableList launchDesktopTaskView() {
+ for (TaskView taskView : getTaskViews()) {
+ if (taskView instanceof DesktopTaskView) {
+ return taskView.launchWithAnimation();
+ }
+ }
+ return null;
+ }
+
+ /**
* Returns a {@link TaskView} that has taskId matching {@code taskId} or null if no match.
*/
@Nullable