Merge "Prefer launching desktop tasks on freeform display" into main
This commit is contained in:
commit
343333ce8a
6 files changed
+68
-49
No files matched your search
@@ -442,6 +442,13 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
&& mControllers.taskbarDesktopModeController.isInDesktopMode(getDisplayId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTaskbarShowingDesktopTasks() {
|
||||
return mControllers != null
|
||||
&& mControllers.taskbarDesktopModeController.shouldShowDesktopTasksInTaskbar(
|
||||
getDisplayId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showLockedTaskbarOnHome() {
|
||||
return DisplayController.showLockedTaskbarOnHome(this);
|
||||
@@ -1468,6 +1475,28 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
mControllers.uiController.startSplitSelection(splitSelectSource);
|
||||
}
|
||||
|
||||
// If in overview, and a desktop task is available, launches the overview desktop task and
|
||||
// schedules the provided runnable.
|
||||
// Returns whether the runnable has been posted.
|
||||
private boolean runAfterLaunchingDesktopTaskIfInOverview(
|
||||
RecentsView recents,
|
||||
Runnable runnableToRun) {
|
||||
if (recents == null || !isTaskbarShowingDesktopTasks()
|
||||
|| !mControllers.uiController.isInOverviewUi()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RunnableList runnableList = recents.launchRunningDesktopTaskView();
|
||||
// Wrapping it in runnable so we post after DW is ready for the app
|
||||
// launch.
|
||||
if (runnableList == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
runnableList.add(() -> UI_HELPER_EXECUTOR.execute(runnableToRun));
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void onTaskbarIconClicked(View view) {
|
||||
TaskbarUIController taskbarUIController = mControllers.uiController;
|
||||
RecentsView recents = taskbarUIController.getRecentsView();
|
||||
@@ -1479,25 +1508,17 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
// TODO: b/316004172, b/343289567: Handle `DesktopTask` and `SplitTask`.
|
||||
if (tag instanceof SingleTask singleTask) {
|
||||
RemoteTransition remoteTransition =
|
||||
(isInDesktopMode() && canUnminimizeDesktopTask(
|
||||
(isTaskbarShowingDesktopTasks() && canUnminimizeDesktopTask(
|
||||
singleTask.getTask().key.id))
|
||||
? createDesktopAppLaunchRemoteTransition(AppLaunchType.UNMINIMIZE,
|
||||
Cuj.CUJ_DESKTOP_MODE_APP_LAUNCH_FROM_ICON)
|
||||
: null;
|
||||
if (isInDesktopMode() && mControllers.uiController.isInOverviewUi()) {
|
||||
RunnableList runnableList = recents.launchRunningDesktopTaskView();
|
||||
// Wrapping it in runnable so we post after DW is ready for the app
|
||||
// launch.
|
||||
if (runnableList != null) {
|
||||
runnableList.add(() -> UI_HELPER_EXECUTOR.execute(
|
||||
() -> handleGroupTaskLaunch(singleTask, remoteTransition,
|
||||
isInDesktopMode(),
|
||||
DesktopTaskToFrontReason.TASKBAR_TAP)));
|
||||
}
|
||||
} else {
|
||||
handleGroupTaskLaunch(singleTask, remoteTransition, isInDesktopMode(),
|
||||
DesktopTaskToFrontReason.TASKBAR_TAP);
|
||||
Runnable launchTask = () -> handleGroupTaskLaunch(singleTask, remoteTransition,
|
||||
isTaskbarShowingDesktopTasks(), DesktopTaskToFrontReason.TASKBAR_TAP);
|
||||
if (!runAfterLaunchingDesktopTaskIfInOverview(recents, launchTask)) {
|
||||
launchTask.run();
|
||||
}
|
||||
|
||||
mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true);
|
||||
} else if (tag instanceof FolderInfo) {
|
||||
// Tapping an expandable folder icon on Taskbar
|
||||
@@ -1520,24 +1541,12 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
AppLaunchType.UNMINIMIZE, Cuj.CUJ_DESKTOP_MODE_APP_LAUNCH_FROM_ICON)
|
||||
: null;
|
||||
|
||||
|
||||
if (isInDesktopMode() && mControllers.uiController.isInOverviewUi()) {
|
||||
RunnableList runnableList = recents.launchRunningDesktopTaskView();
|
||||
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,
|
||||
DesktopTaskToFrontReason.TASKBAR_TAP)));
|
||||
}
|
||||
} else {
|
||||
UI_HELPER_EXECUTOR.execute(() ->
|
||||
SystemUiProxy.INSTANCE.get(this).showDesktopApp(
|
||||
info.getTaskId(), remoteTransition,
|
||||
DesktopTaskToFrontReason.TASKBAR_TAP));
|
||||
Runnable launchTask = () ->
|
||||
SystemUiProxy.INSTANCE.get(this).showDesktopApp(
|
||||
info.getTaskId(), remoteTransition,
|
||||
DesktopTaskToFrontReason.TASKBAR_TAP);
|
||||
if (!runAfterLaunchingDesktopTaskIfInOverview(recents, launchTask)) {
|
||||
UI_HELPER_EXECUTOR.execute(launchTask);
|
||||
}
|
||||
|
||||
mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(
|
||||
@@ -1794,17 +1803,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
.launchAppPair((AppPairIcon) launchingIconView,
|
||||
-1 /*cuj*/)));
|
||||
} else {
|
||||
if (isInDesktopMode()
|
||||
&& mControllers.uiController.isInOverviewUi()) {
|
||||
RunnableList runnableList = recents.launchRunningDesktopTaskView();
|
||||
// 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);
|
||||
Runnable launchTask =
|
||||
() -> startItemInfoActivity(itemInfos.get(0), foundTask);
|
||||
if (!runAfterLaunchingDesktopTaskIfInOverview(recents, launchTask)) {
|
||||
launchTask.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1840,7 +1842,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (isInDesktopMode()
|
||||
if (isTaskbarShowingDesktopTasks()
|
||||
&& DesktopModeFlags.ENABLE_DESKTOP_APP_LAUNCH_TRANSITIONS_BUGFIX.isTrue()) {
|
||||
launchDesktopApp(intent, info, displayId);
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user