Add CUJ instrumentation for KQS

Flag: NONE LEGACY ENABLE_KEYBOARD_QUICK_SWITCH ENABLED
Bug: 339585624
Test: manually checked that CUJ calls were reached
Change-Id: Ifd2b92451c5ed2ebc35834c1d2f495275db3d49a
This commit is contained in:
Schneider Victor-tulias committed 2024-07-04 10:44:26 -04:00
1 parent 25eaff395e
commit acddb58539
4 files changed
+68 -7

No files matched your search

@@ -1213,22 +1213,44 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
}
}
public void handleGroupTaskLaunch(
GroupTask task,
@Nullable RemoteTransition remoteTransition,
boolean onDesktop) {
handleGroupTaskLaunch(task, remoteTransition, onDesktop, null, null);
}
/**
* Launches the given GroupTask with the following behavior:
* - If the GroupTask is a DesktopTask, launch the tasks in that Desktop.
* - If {@code onDesktop}, bring the given GroupTask to the front.
* - If the GroupTask is a single task, launch it via startActivityFromRecents.
* - Otherwise, we assume the GroupTask is a Split pair and launch them together.
* <p>
* Given start and/or finish callbacks, they will be run before an after the app launch
* respectively in cases where we can't use the remote transition, otherwise we will assume that
* these callbacks are included in the remote transition.
*/
public void handleGroupTaskLaunch(GroupTask task, @Nullable RemoteTransition remoteTransition,
boolean onDesktop) {
public void handleGroupTaskLaunch(
GroupTask task,
@Nullable RemoteTransition remoteTransition,
boolean onDesktop,
@Nullable Runnable onStartCallback,
@Nullable Runnable onFinishCallback) {
if (task instanceof DesktopTask) {
UI_HELPER_EXECUTOR.execute(() ->
SystemUiProxy.INSTANCE.get(this).showDesktopApps(getDisplay().getDisplayId(),
remoteTransition));
} else if (onDesktop) {
UI_HELPER_EXECUTOR.execute(() ->
SystemUiProxy.INSTANCE.get(this).showDesktopApp(task.task1.key.id));
UI_HELPER_EXECUTOR.execute(() -> {
if (onStartCallback != null) {
onStartCallback.run();
}
SystemUiProxy.INSTANCE.get(this).showDesktopApp(task.task1.key.id);
if (onFinishCallback != null) {
onFinishCallback.run();
}
});
} else if (task.task2 == null) {
UI_HELPER_EXECUTOR.execute(() -> {
ActivityOptions activityOptions =