Merge "Fix Keyboard quick switch screenshots and spliscreen launch" into main

This commit is contained in:
Schneider Victor-tulias authored and Android (Google) Code Review committed 2023-12-05 04:10:13 +00:00
commit dc4b61be59
5 files changed
+31 -28

No files matched your search

@@ -133,11 +133,20 @@ public class KeyboardQuickSwitchViewController {
GroupTask task = mControllerCallbacks.getTaskAt(index);
if (task == null) {
return Math.max(0, index);
} else if (mOnDesktop) {
}
Task task2 = task.task2;
int runningTaskId = ActivityManagerWrapper.getInstance().getRunningTask().taskId;
if (runningTaskId == task.task1.key.id
|| (task2 != null && runningTaskId == task2.key.id)) {
// Ignore attempts to run the selected task if it is already running.
return -1;
}
if (mOnDesktop) {
UI_HELPER_EXECUTOR.execute(() ->
SystemUiProxy.INSTANCE.get(mKeyboardQuickSwitchView.getContext())
.showDesktopApp(task.task1.key.id));
} else if (task.task2 == null) {
} else if (task2 == null) {
UI_HELPER_EXECUTOR.execute(() ->
ActivityManagerWrapper.getInstance().startActivityFromRecents(
task.task1.key,
@@ -145,8 +154,7 @@ public class KeyboardQuickSwitchViewController {
taskView == null ? mKeyboardQuickSwitchView : taskView, null)
.options));
} else {
mControllers.uiController.launchSplitTasks(
taskView == null ? mKeyboardQuickSwitchView : taskView, task);
mControllers.uiController.launchSplitTasks(task);
}
return -1;
}
@@ -26,7 +26,6 @@ import android.animation.AnimatorSet;
import android.os.RemoteException;
import android.util.Log;
import android.view.TaskTransitionSpec;
import android.view.View;
import android.view.WindowManagerGlobal;
import androidx.annotation.NonNull;
@@ -386,8 +385,8 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
}
@Override
public void launchSplitTasks(@NonNull View taskView, @NonNull GroupTask groupTask) {
mLauncher.launchSplitTasks(taskView, groupTask);
public void launchSplitTasks(@NonNull GroupTask groupTask) {
mLauncher.launchSplitTasks(groupTask);
}
@Override
@@ -297,11 +297,9 @@ public class TaskbarUIController {
}
/**
* Launches the focused task in splitscreen.
*
* No-op if the view is not yet open.
* Launches the given task in split-screen.
*/
public void launchSplitTasks(@NonNull View taskview, @NonNull GroupTask groupTask) { }
public void launchSplitTasks(@NonNull GroupTask groupTask) { }
/**
* Returns the matching view (if any) in the taskbar.
@@ -19,6 +19,7 @@ import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.os.Trace.TRACE_TAG_APP;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_OPTIMIZE_MEASURE;
import static android.view.accessibility.AccessibilityEvent.TYPE_VIEW_FOCUSED;
import static com.android.app.animation.Interpolators.EMPHASIZED;
import static com.android.launcher3.LauncherConstants.SavedInstanceKeys.PENDING_SPLIT_SELECT_INFO;
import static com.android.launcher3.LauncherConstants.SavedInstanceKeys.RUNTIME_STATE;
@@ -34,8 +35,6 @@ import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.LauncherState.OVERVIEW_MODAL_TASK;
import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT;
import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent;
import static com.android.launcher3.config.FeatureFlags.ENABLE_HOME_TRANSITION_LISTENER;
import static com.android.launcher3.config.FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP;
import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID;
import static com.android.launcher3.popup.QuickstepSystemShortcut.getSplitSelectShortcutByPosition;
@@ -1263,24 +1262,19 @@ public class QuickstepLauncher extends Launcher {
/**
* Launches the given {@link GroupTask} in splitscreen.
*
* If the second split task is missing, launches the first task normally.
*/
public void launchSplitTasks(@NonNull View taskView, @NonNull GroupTask groupTask) {
if (groupTask.task2 == null) {
UI_HELPER_EXECUTOR.execute(() ->
ActivityManagerWrapper.getInstance().startActivityFromRecents(
groupTask.task1.key,
getActivityLaunchOptions(taskView, null).options));
return;
}
public void launchSplitTasks(@NonNull GroupTask groupTask) {
// Top/left and bottom/right tasks respectively.
Task task1 = groupTask.task1;
// task2 should never be null when calling this method. Allow a crash to catch invalid calls
Task task2 = groupTask.task2;
mSplitSelectStateController.launchExistingSplitPair(
null /* launchingTaskView */,
groupTask.task1.key.id,
groupTask.task2.key.id,
task1.key.id,
task2.key.id,
SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT,
/* callback= */ success -> mSplitSelectStateController.resetState(),
/* freezeTaskList= */ true,
/* freezeTaskList= */ false,
groupTask.mSplitBounds == null
? SNAP_TO_50_50
: groupTask.mSplitBounds.snapPosition);
@@ -195,11 +195,15 @@ public class TaskThumbnailCache {
return null;
}
CancellableTask<ThumbnailData> request = new CancellableTask<ThumbnailData>() {
CancellableTask<ThumbnailData> request = new CancellableTask<>() {
@Override
public ThumbnailData getResultOnBg() {
return ActivityManagerWrapper.getInstance().getTaskThumbnail(
ThumbnailData thumbnailData = ActivityManagerWrapper.getInstance().getTaskThumbnail(
key.id, lowResolution);
if (thumbnailData.thumbnail != null) {
return thumbnailData;
}
return ActivityManagerWrapper.getInstance().takeTaskThumbnail(key.id);
}
@Override