Loading quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java +67 −9 Original line number Diff line number Diff line Loading @@ -22,9 +22,13 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.launcher3.R; import com.android.launcher3.statehandlers.DesktopVisibilityController; import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext; import com.android.quickstep.LauncherActivityInterface; import com.android.quickstep.RecentsModel; import com.android.quickstep.util.DesktopTask; import com.android.quickstep.util.GroupTask; import com.android.quickstep.views.DesktopTaskView; import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.recents.model.ThumbnailData; Loading Loading @@ -102,19 +106,73 @@ public final class KeyboardQuickSwitchController implements mQuickSwitchViewController = new KeyboardQuickSwitchViewController( mControllers, overlayContext, keyboardQuickSwitchView, mControllerCallbacks); DesktopVisibilityController desktopController = LauncherActivityInterface.INSTANCE.getDesktopVisibilityController(); final boolean onDesktop = DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED && desktopController != null && desktopController.areFreeformTasksVisible(); if (mModel.isTaskListValid(mTaskListChangeId)) { mQuickSwitchViewController.openQuickSwitchView( mTasks, mNumHiddenTasks, /* updateTasks= */ false, currentFocusedIndex); mQuickSwitchViewController.openQuickSwitchView(mTasks, mNumHiddenTasks, /* updateTasks= */ false, currentFocusedIndex, onDesktop); return; } mTaskListChangeId = mModel.getTasks((tasks) -> { if (onDesktop) { processLoadedTasksOnDesktop(tasks); } else { processLoadedTasks(tasks); } mQuickSwitchViewController.openQuickSwitchView(mTasks, mNumHiddenTasks, /* updateTasks= */ true, currentFocusedIndex, onDesktop); }); } private void processLoadedTasks(ArrayList<GroupTask> tasks) { // Only store MAX_TASK tasks, from most to least recent Collections.reverse(tasks); mTasks = tasks.stream().limit(MAX_TASKS).collect(Collectors.toList()); mNumHiddenTasks = Math.max(0, tasks.size() - MAX_TASKS); mQuickSwitchViewController.openQuickSwitchView( mTasks, mNumHiddenTasks, /* updateTasks= */ true, currentFocusedIndex); }); // Hide all desktop tasks and show them on the hidden tile int hiddenDesktopTasks = 0; if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED) { // TODO(b/280468885): show desktop task as a grouped desktop tile DesktopTask desktopTask = findDesktopTask(tasks); if (desktopTask != null) { hiddenDesktopTasks = desktopTask.tasks.size(); tasks = tasks.stream() .filter(t -> !(t instanceof DesktopTask)) .collect(Collectors.toCollection(ArrayList<GroupTask>::new)); } } mTasks = tasks.stream() .limit(MAX_TASKS) .collect(Collectors.toList()); mNumHiddenTasks = Math.max(0, tasks.size() - MAX_TASKS) + hiddenDesktopTasks; } private void processLoadedTasksOnDesktop(ArrayList<GroupTask> tasks) { // Find the single desktop task that contains a grouping of desktop tasks DesktopTask desktopTask = findDesktopTask(tasks); if (desktopTask != null) { mTasks = desktopTask.tasks.stream().map(GroupTask::new).collect(Collectors.toList()); // All other tasks, apart from the grouped desktop task, are hidden mNumHiddenTasks = Math.max(0, tasks.size() - 1); } else { // Desktop tasks were visible, but the recents entry is missing. Fall back to empty list mTasks = Collections.emptyList(); mNumHiddenTasks = tasks.size(); } } @Nullable private DesktopTask findDesktopTask(ArrayList<GroupTask> tasks) { return (DesktopTask) tasks.stream() .filter(t -> t instanceof DesktopTask) .findFirst() .orElse(null); } void closeQuickSwitchView() { Loading Loading @@ -169,7 +227,7 @@ public final class KeyboardQuickSwitchController implements class ControllerCallbacks { int getTaskCount() { return mNumHiddenTasks == 0 ? mTasks.size() : MAX_TASKS + 1; return mTasks.size() + (mNumHiddenTasks == 0 ? 0 : 1); } @Nullable Loading quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchView.java +6 −2 Original line number Diff line number Diff line Loading @@ -190,8 +190,12 @@ public class KeyboardQuickSwitchView extends ConstraintLayout { ConstraintLayout.LayoutParams lp = new ConstraintLayout.LayoutParams( width, mTaskViewHeight); if (previousView == null) { lp.startToStart = PARENT_ID; } else { lp.endToEnd = PARENT_ID; lp.startToEnd = previousView.getId(); } lp.topToTop = PARENT_ID; lp.bottomToBottom = PARENT_ID; lp.setMarginEnd(mSpacing); Loading quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java +10 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import androidx.annotation.Nullable; import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext; import com.android.launcher3.taskbar.overlay.TaskbarOverlayDragLayer; import com.android.quickstep.SystemUiProxy; import com.android.quickstep.util.GroupTask; import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.recents.model.ThumbnailData; Loading @@ -52,6 +53,8 @@ public class KeyboardQuickSwitchViewController { private int mCurrentFocusIndex = -1; private boolean mOnDesktop; protected KeyboardQuickSwitchViewController( @NonNull TaskbarControllers controllers, @NonNull TaskbarOverlayContext overlayContext, Loading @@ -71,10 +74,12 @@ public class KeyboardQuickSwitchViewController { @NonNull List<GroupTask> tasks, int numHiddenTasks, boolean updateTasks, int currentFocusIndexOverride) { int currentFocusIndexOverride, boolean onDesktop) { TaskbarOverlayDragLayer dragLayer = mOverlayContext.getDragLayer(); dragLayer.addView(mKeyboardQuickSwitchView); dragLayer.runOnClickOnce(v -> closeQuickSwitchView(true)); mOnDesktop = onDesktop; mKeyboardQuickSwitchView.applyLoadPlan( mOverlayContext, Loading Loading @@ -136,6 +141,10 @@ public class KeyboardQuickSwitchViewController { GroupTask task = mControllerCallbacks.getTaskAt(index); if (task == null) { return Math.max(0, index); } else if (mOnDesktop) { UI_HELPER_EXECUTOR.execute(() -> SystemUiProxy.INSTANCE.get(mKeyboardQuickSwitchView.getContext()) .showDesktopApp(task.task1.key.id)); } else if (task.task2 == null) { UI_HELPER_EXECUTOR.execute(() -> ActivityManagerWrapper.getInstance().startActivityFromRecents( Loading quickstep/src/com/android/quickstep/OverviewCommandHelper.java +0 −6 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.taskbar.TaskbarUIController; import com.android.launcher3.util.RunnableList; import com.android.quickstep.RecentsAnimationCallbacks.RecentsAnimationListener; import com.android.quickstep.views.DesktopTaskView; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; import com.android.systemui.shared.recents.model.ThumbnailData; Loading Loading @@ -186,11 +185,6 @@ public class OverviewCommandHelper { && dp != null && (dp.isTablet || dp.isTwoPanels); if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) { // TODO(b/268075592): add support for quickswitch to/from desktop allowQuickSwitch = false; } if (cmd.type == TYPE_HIDE) { if (!allowQuickSwitch) { return true; Loading quickstep/src/com/android/quickstep/RecentTasksList.java +0 −1 Original line number Diff line number Diff line Loading @@ -308,7 +308,6 @@ public class RecentTasksList { task.setLastSnapshotData(taskInfo); task.positionInParent = taskInfo.positionInParent; task.appBounds = taskInfo.configuration.windowConfiguration.getAppBounds(); // TODO(b/244348395): tasks should be sorted from oldest to most recently used tasks.add(task); } return new DesktopTask(tasks); Loading Loading
quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java +67 −9 Original line number Diff line number Diff line Loading @@ -22,9 +22,13 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.launcher3.R; import com.android.launcher3.statehandlers.DesktopVisibilityController; import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext; import com.android.quickstep.LauncherActivityInterface; import com.android.quickstep.RecentsModel; import com.android.quickstep.util.DesktopTask; import com.android.quickstep.util.GroupTask; import com.android.quickstep.views.DesktopTaskView; import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.recents.model.ThumbnailData; Loading Loading @@ -102,19 +106,73 @@ public final class KeyboardQuickSwitchController implements mQuickSwitchViewController = new KeyboardQuickSwitchViewController( mControllers, overlayContext, keyboardQuickSwitchView, mControllerCallbacks); DesktopVisibilityController desktopController = LauncherActivityInterface.INSTANCE.getDesktopVisibilityController(); final boolean onDesktop = DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED && desktopController != null && desktopController.areFreeformTasksVisible(); if (mModel.isTaskListValid(mTaskListChangeId)) { mQuickSwitchViewController.openQuickSwitchView( mTasks, mNumHiddenTasks, /* updateTasks= */ false, currentFocusedIndex); mQuickSwitchViewController.openQuickSwitchView(mTasks, mNumHiddenTasks, /* updateTasks= */ false, currentFocusedIndex, onDesktop); return; } mTaskListChangeId = mModel.getTasks((tasks) -> { if (onDesktop) { processLoadedTasksOnDesktop(tasks); } else { processLoadedTasks(tasks); } mQuickSwitchViewController.openQuickSwitchView(mTasks, mNumHiddenTasks, /* updateTasks= */ true, currentFocusedIndex, onDesktop); }); } private void processLoadedTasks(ArrayList<GroupTask> tasks) { // Only store MAX_TASK tasks, from most to least recent Collections.reverse(tasks); mTasks = tasks.stream().limit(MAX_TASKS).collect(Collectors.toList()); mNumHiddenTasks = Math.max(0, tasks.size() - MAX_TASKS); mQuickSwitchViewController.openQuickSwitchView( mTasks, mNumHiddenTasks, /* updateTasks= */ true, currentFocusedIndex); }); // Hide all desktop tasks and show them on the hidden tile int hiddenDesktopTasks = 0; if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED) { // TODO(b/280468885): show desktop task as a grouped desktop tile DesktopTask desktopTask = findDesktopTask(tasks); if (desktopTask != null) { hiddenDesktopTasks = desktopTask.tasks.size(); tasks = tasks.stream() .filter(t -> !(t instanceof DesktopTask)) .collect(Collectors.toCollection(ArrayList<GroupTask>::new)); } } mTasks = tasks.stream() .limit(MAX_TASKS) .collect(Collectors.toList()); mNumHiddenTasks = Math.max(0, tasks.size() - MAX_TASKS) + hiddenDesktopTasks; } private void processLoadedTasksOnDesktop(ArrayList<GroupTask> tasks) { // Find the single desktop task that contains a grouping of desktop tasks DesktopTask desktopTask = findDesktopTask(tasks); if (desktopTask != null) { mTasks = desktopTask.tasks.stream().map(GroupTask::new).collect(Collectors.toList()); // All other tasks, apart from the grouped desktop task, are hidden mNumHiddenTasks = Math.max(0, tasks.size() - 1); } else { // Desktop tasks were visible, but the recents entry is missing. Fall back to empty list mTasks = Collections.emptyList(); mNumHiddenTasks = tasks.size(); } } @Nullable private DesktopTask findDesktopTask(ArrayList<GroupTask> tasks) { return (DesktopTask) tasks.stream() .filter(t -> t instanceof DesktopTask) .findFirst() .orElse(null); } void closeQuickSwitchView() { Loading Loading @@ -169,7 +227,7 @@ public final class KeyboardQuickSwitchController implements class ControllerCallbacks { int getTaskCount() { return mNumHiddenTasks == 0 ? mTasks.size() : MAX_TASKS + 1; return mTasks.size() + (mNumHiddenTasks == 0 ? 0 : 1); } @Nullable Loading
quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchView.java +6 −2 Original line number Diff line number Diff line Loading @@ -190,8 +190,12 @@ public class KeyboardQuickSwitchView extends ConstraintLayout { ConstraintLayout.LayoutParams lp = new ConstraintLayout.LayoutParams( width, mTaskViewHeight); if (previousView == null) { lp.startToStart = PARENT_ID; } else { lp.endToEnd = PARENT_ID; lp.startToEnd = previousView.getId(); } lp.topToTop = PARENT_ID; lp.bottomToBottom = PARENT_ID; lp.setMarginEnd(mSpacing); Loading
quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java +10 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import androidx.annotation.Nullable; import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext; import com.android.launcher3.taskbar.overlay.TaskbarOverlayDragLayer; import com.android.quickstep.SystemUiProxy; import com.android.quickstep.util.GroupTask; import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.recents.model.ThumbnailData; Loading @@ -52,6 +53,8 @@ public class KeyboardQuickSwitchViewController { private int mCurrentFocusIndex = -1; private boolean mOnDesktop; protected KeyboardQuickSwitchViewController( @NonNull TaskbarControllers controllers, @NonNull TaskbarOverlayContext overlayContext, Loading @@ -71,10 +74,12 @@ public class KeyboardQuickSwitchViewController { @NonNull List<GroupTask> tasks, int numHiddenTasks, boolean updateTasks, int currentFocusIndexOverride) { int currentFocusIndexOverride, boolean onDesktop) { TaskbarOverlayDragLayer dragLayer = mOverlayContext.getDragLayer(); dragLayer.addView(mKeyboardQuickSwitchView); dragLayer.runOnClickOnce(v -> closeQuickSwitchView(true)); mOnDesktop = onDesktop; mKeyboardQuickSwitchView.applyLoadPlan( mOverlayContext, Loading Loading @@ -136,6 +141,10 @@ public class KeyboardQuickSwitchViewController { GroupTask task = mControllerCallbacks.getTaskAt(index); if (task == null) { return Math.max(0, index); } else if (mOnDesktop) { UI_HELPER_EXECUTOR.execute(() -> SystemUiProxy.INSTANCE.get(mKeyboardQuickSwitchView.getContext()) .showDesktopApp(task.task1.key.id)); } else if (task.task2 == null) { UI_HELPER_EXECUTOR.execute(() -> ActivityManagerWrapper.getInstance().startActivityFromRecents( Loading
quickstep/src/com/android/quickstep/OverviewCommandHelper.java +0 −6 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.taskbar.TaskbarUIController; import com.android.launcher3.util.RunnableList; import com.android.quickstep.RecentsAnimationCallbacks.RecentsAnimationListener; import com.android.quickstep.views.DesktopTaskView; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; import com.android.systemui.shared.recents.model.ThumbnailData; Loading Loading @@ -186,11 +185,6 @@ public class OverviewCommandHelper { && dp != null && (dp.isTablet || dp.isTwoPanels); if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) { // TODO(b/268075592): add support for quickswitch to/from desktop allowQuickSwitch = false; } if (cmd.type == TYPE_HIDE) { if (!allowQuickSwitch) { return true; Loading
quickstep/src/com/android/quickstep/RecentTasksList.java +0 −1 Original line number Diff line number Diff line Loading @@ -308,7 +308,6 @@ public class RecentTasksList { task.setLastSnapshotData(taskInfo); task.positionInParent = taskInfo.positionInParent; task.appBounds = taskInfo.configuration.windowConfiguration.getAppBounds(); // TODO(b/244348395): tasks should be sorted from oldest to most recently used tasks.add(task); } return new DesktopTask(tasks); Loading