Merge "Unpin desktop task in overview" into main
diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
index 2341e4c..59302b7 100644
--- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
@@ -380,13 +380,6 @@
}
/**
- * Calculates the task size for the desktop task
- */
- public final void calculateDesktopTaskSize(Context context, DeviceProfile dp, Rect outRect) {
- calculateFocusTaskSize(context, dp, outRect);
- }
-
- /**
* Calculates the modal taskView size for the provided device configuration
*/
public final void calculateModalTaskSize(Context context, DeviceProfile dp, Rect outRect,
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 4985f0b..2ead7a6 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -463,7 +463,6 @@
protected final Rect mLastComputedTaskSize = new Rect();
protected final Rect mLastComputedGridSize = new Rect();
protected final Rect mLastComputedGridTaskSize = new Rect();
- protected final Rect mLastComputedDesktopTaskSize = new Rect();
private TaskView mSelectedTask = null;
// How much a task that is directly offscreen will be pushed out due to RecentsView scale/pivot.
@Nullable
@@ -1658,15 +1657,8 @@
removeView(runningTaskView);
mMovingTaskView = null;
runningTaskView.resetPersistentViewTransforms();
- int frontTaskIndex = 0;
- if (isDesktopModeSupported() && mDesktopTaskView != null
- && !runningTaskView.isDesktopTask()) {
- // If desktop mode is enabled, desktop task view is pinned at first position if present.
- // Move running task to position 1.
- frontTaskIndex = 1;
- }
- addView(runningTaskView, frontTaskIndex);
- setCurrentPage(frontTaskIndex);
+ addView(runningTaskView, 0);
+ setCurrentPage(0);
updateTaskSize();
}
@@ -1743,7 +1735,6 @@
// Clear out desktop view if it is set
mDesktopTaskView = null;
- DesktopTask desktopTask = null;
// Add views as children based on whether it's grouped or single task. Looping through
// taskGroups backwards populates the thumbnail grid from least recent to most recent.
@@ -1752,12 +1743,6 @@
boolean isRemovalNeeded = stagedTaskIdToBeRemovedFromGrid != INVALID_TASK_ID
&& groupTask.containsTask(stagedTaskIdToBeRemovedFromGrid);
- if (groupTask instanceof DesktopTask) {
- desktopTask = (DesktopTask) groupTask;
- // Desktop task will be added separately in the end
- continue;
- }
-
TaskView taskView;
if (isRemovalNeeded && groupTask.hasMultipleTasks()) {
// If we need to remove half of a pair of tasks, force a TaskView with Type.SINGLE
@@ -1788,6 +1773,10 @@
((GroupedTaskView) taskView).bind(leftTopTask, rightBottomTask, mOrientationState,
groupTask.mSplitBounds);
+ } else if (taskView instanceof DesktopTaskView) {
+ ((DesktopTaskView) taskView).bind(((DesktopTask) groupTask).tasks,
+ mOrientationState);
+ mDesktopTaskView = (DesktopTaskView) taskView;
} else {
taskView.bind(groupTask.task1, mOrientationState);
}
@@ -1800,19 +1789,6 @@
if (!taskGroups.isEmpty()) {
addView(mClearAllButton);
- if (isDesktopModeSupported()) {
- // Check if we have apps on the desktop
- if (desktopTask != null && !desktopTask.tasks.isEmpty()) {
- // If we are actively choosing apps for split, skip the desktop tile
- if (!getSplitSelectController().isSplitSelectActive()) {
- mDesktopTaskView = (DesktopTaskView) getTaskViewFromPool(
- TaskView.Type.DESKTOP);
- // Always add a desktop task to the first position
- addView(mDesktopTaskView, 0);
- mDesktopTaskView.bind(desktopTask.tasks, mOrientationState);
- }
- }
- }
}
// Keep same previous focused task
@@ -1820,12 +1796,6 @@
// If the list changed, maybe the focused task doesn't exist anymore
if (newFocusedTaskView == null && getTaskViewCount() > 0) {
newFocusedTaskView = getTaskViewAt(0);
- // Check if the first task is the desktop.
- // If first task is desktop, try to find another task to set as the focused task
- if (newFocusedTaskView != null && newFocusedTaskView.isDesktopTask()
- && getTaskViewCount() > 1) {
- newFocusedTaskView = getTaskViewAt(1);
- }
}
mFocusedTaskViewId = newFocusedTaskView != null && !enableGridOnlyOverview()
? newFocusedTaskView.getTaskViewId() : INVALID_TASK_ID;
@@ -1869,12 +1839,7 @@
if (hasAnyValidTaskIds(runningTaskId)) {
targetPage = indexOfChild(newRunningTaskView);
} else if (getTaskViewCount() > 0) {
- TaskView taskView = requireTaskViewAt(0);
- // If first task id desktop, try to find another task to set the target page
- if (taskView.isDesktopTask() && getTaskViewCount() > 1) {
- taskView = requireTaskViewAt(1);
- }
- targetPage = indexOfChild(taskView);
+ targetPage = indexOfChild(requireTaskViewAt(0));
}
}
if (targetPage != -1 && mCurrentPage != targetPage) {
@@ -2119,9 +2084,6 @@
mSizeStrategy.calculateGridSize(dp, mActivity, mLastComputedGridSize);
mSizeStrategy.calculateGridTaskSize(mActivity, dp, mLastComputedGridTaskSize,
getPagedOrientationHandler());
- if (isDesktopModeSupported()) {
- mSizeStrategy.calculateDesktopTaskSize(mActivity, dp, mLastComputedDesktopTaskSize);
- }
if (enableGridOnlyOverview()) {
mSizeStrategy.calculateCarouselTaskSize(mActivity, dp, mLastComputedCarouselTaskSize,
getPagedOrientationHandler());
@@ -2222,11 +2184,6 @@
return mLastComputedGridTaskSize;
}
- /** Gets the last computed desktop task size */
- public Rect getLastComputedDesktopTaskSize() {
- return mLastComputedDesktopTaskSize;
- }
-
public Rect getLastComputedCarouselTaskSize() {
return mLastComputedCarouselTaskSize;
}
@@ -2977,8 +2934,6 @@
TaskView homeTaskView = getHomeTaskView();
TaskView nextFocusedTaskView = null;
- int desktopTaskIndex = Integer.MAX_VALUE;
-
if (!isTaskDismissal) {
mTopRowIdSet.clear();
}
@@ -3005,21 +2960,6 @@
// If focused task is snapped, the row width is just task width and spacing.
snappedTaskRowWidth = taskWidthAndSpacing;
}
- } else if (taskView.isDesktopTask()) {
- // Desktop task was not focused. Pin it to the right of focused
- desktopTaskIndex = i;
- if (taskView.getVisibility() == View.GONE) {
- // Desktop task view is hidden, skip it from grid calculations
- continue;
- }
- if (!enableGridOnlyOverview()) {
- // Only apply x-translation when using legacy overview grid
- gridTranslations[i] += mIsRtl ? taskWidthAndSpacing : -taskWidthAndSpacing;
- }
-
- // Center view vertically in case it's from different orientation.
- taskView.setGridTranslationY((mLastComputedDesktopTaskSize.height() + taskTopMargin
- - taskView.getLayoutParams().height) / 2f);
} else {
if (i > focusedTaskIndex) {
// For tasks after the focused task, shift by focused task's width and spacing.
@@ -3060,7 +3000,7 @@
// Move horizontally into empty space.
float widthOffset = 0;
for (int j = i - 1; !topSet.contains(j) && j >= 0; j--) {
- if (j == focusedTaskIndex || j == desktopTaskIndex) {
+ if (j == focusedTaskIndex) {
continue;
}
widthOffset += requireTaskViewAt(j).getLayoutParams().width + mPageSpacing;
@@ -3079,7 +3019,7 @@
// Move horizontally into empty space.
float widthOffset = 0;
for (int j = i - 1; !bottomSet.contains(j) && j >= 0; j--) {
- if (j == focusedTaskIndex || j == desktopTaskIndex) {
+ if (j == focusedTaskIndex) {
continue;
}
widthOffset += requireTaskViewAt(j).getLayoutParams().width + mPageSpacing;
@@ -5545,10 +5485,6 @@
}
private int getFirstViewIndex() {
- if (isDesktopModeSupported() && mDesktopTaskView != null) {
- // Desktop task is at position 0, that is the first view
- return 0;
- }
TaskView focusedTaskView = mShowAsGridLastOnLayout ? getFocusedTaskView() : null;
return focusedTaskView != null ? indexOfChild(focusedTaskView) : 0;
}
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index 14d7842..5123364 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -1737,12 +1737,7 @@
int boxWidth;
int boxHeight;
boolean isFocusedTask = isFocusedTask();
- if (isDesktopTask()) {
- Rect lastComputedDesktopTaskSize =
- getRecentsView().getLastComputedDesktopTaskSize();
- boxWidth = lastComputedDesktopTaskSize.width();
- boxHeight = lastComputedDesktopTaskSize.height();
- } else if (isFocusedTask) {
+ if (isFocusedTask) {
// Task will be focused and should use focused task size. Use focusTaskRatio
// that is associated with the original orientation of the focused task.
boxWidth = taskWidth;