Support large desktop tile in grid only overview
Based on UX specs, desktop tile should be using the large size and be
pinned ot the right in overview.
Updates to ensure the desktop tile is using the focused tile size when
grid only overview is enabled.
Test: enable grid only overview, have some fullscreen tasks in overview
and some desktop tasks, open overview from home, observe desktop tile
peeks from right
Test: same setup as before, open a fullscreen app, open overview,
observe desktop tile peeks in from right
Test: same setup as before, go to desktop, open overview, observe
desktop tile is focused
Test: turn off grid only overview, repeat the same test case
Bug: 271131878
Change-Id: Ic804428dca415f08a26c47e1d6b9b3a94fcfbfdf
diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
index d7ff8ab..3e565b3 100644
--- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
@@ -350,6 +350,13 @@
}
/**
+ * 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 1122e80..52217c1 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -451,6 +451,7 @@
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
@@ -1941,6 +1942,10 @@
mLastComputedGridSize);
mSizeStrategy.calculateGridTaskSize(mActivity, mActivity.getDeviceProfile(),
mLastComputedGridTaskSize, mOrientationHandler);
+ if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED) {
+ mSizeStrategy.calculateDesktopTaskSize(mActivity, mActivity.getDeviceProfile(),
+ mLastComputedDesktopTaskSize);
+ }
mTaskGridVerticalDiff = mLastComputedGridTaskSize.top - mLastComputedTaskSize.top;
mTopBottomRowHeightDiff =
@@ -2031,6 +2036,11 @@
return mLastComputedGridTaskSize;
}
+ /** Gets the last computed desktop task size */
+ public Rect getLastComputedDesktopTaskSize() {
+ return mLastComputedDesktopTaskSize;
+ }
+
/** Gets the task size for modal state. */
public void getModalTaskSize(Rect outRect) {
mSizeStrategy.calculateModalTaskSize(mActivity, mActivity.getDeviceProfile(), outRect,
@@ -2765,10 +2775,13 @@
} else if (taskView.isDesktopTask()) {
// Desktop task was not focused. Pin it to the right of focused
desktopTaskIndex = i;
- gridTranslations[i] += mIsRtl ? taskWidthAndSpacing : -taskWidthAndSpacing;
+ if (!ENABLE_GRID_ONLY_OVERVIEW.get()) {
+ // 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((mLastComputedTaskSize.height() + taskTopMargin
+ taskView.setGridTranslationY((mLastComputedDesktopTaskSize.height() + taskTopMargin
- taskView.getLayoutParams().height) / 2f);
} else {
if (i > focusedTaskIndex) {
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index b9aaef6..ab72f2d 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -1619,7 +1619,12 @@
int boxWidth;
int boxHeight;
boolean isFocusedTask = isFocusedTask();
- if (isFocusedTask || isDesktopTask()) {
+ if (isDesktopTask()) {
+ Rect lastComputedDesktopTaskSize =
+ getRecentsView().getLastComputedDesktopTaskSize();
+ boxWidth = lastComputedDesktopTaskSize.width();
+ boxHeight = lastComputedDesktopTaskSize.height();
+ } else 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;