Allow clipping individual direction of TaskView
- Only clip the nav bar (taskbar), and always do that in tablets regardless of whether taskbar is stashed, so TaskView always have the same ratio (mocks: https://docs.google.com/presentation/d/1_3zQak_C9FzDPCcIdYagfUit4QyqfdRxetkim3dI9rY/edit#slide=id.ge211eb96a5_5_8)
- When taskbar is present, don't use full thumbnail to avoid TaskView resizing in fullscreen: http://dr/file/d/18C8DSygPBU1gkmMQPPIIa2NqQESFurxW/view?resourcekey=0-8W79f31gstzI_1ZPpHulBQ
- When taskbar is stashed, we still need full thumbnail to gradually crop out the taskbar in overview
Test: Open Chrome, swipe up and ensure status bar inset stays in overview but taskbar stays clipped out from the onset.
Bug: 190681228
Change-Id: I9d563572f2e6800e90d567c2bfae4528a126f24e
diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
index e781160..e2ef3bc 100644
--- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
@@ -290,19 +290,35 @@
public static void getTaskDimension(Context context, DeviceProfile dp, PointF out) {
if (dp.isMultiWindowMode) {
WindowBounds bounds = SplitScreenBounds.INSTANCE.getSecondaryWindowBounds(context);
- if (TaskView.clipStatusAndNavBars(dp)) {
- out.x = bounds.availableSize.x;
- out.y = bounds.availableSize.y;
- } else {
- out.x = bounds.availableSize.x + bounds.insets.left + bounds.insets.right;
- out.y = bounds.availableSize.y + bounds.insets.top + bounds.insets.bottom;
+ out.x = bounds.availableSize.x;
+ out.y = bounds.availableSize.y;
+ if (!TaskView.clipLeft(dp)) {
+ out.x += bounds.insets.left;
}
- } else if (TaskView.clipStatusAndNavBars(dp)) {
- out.x = dp.availableWidthPx;
- out.y = dp.availableHeightPx;
+ if (!TaskView.clipRight(dp)) {
+ out.x += bounds.insets.right;
+ }
+ if (!TaskView.clipTop(dp)) {
+ out.y += bounds.insets.top;
+ }
+ if (!TaskView.clipBottom(dp)) {
+ out.y += bounds.insets.bottom;
+ }
} else {
out.x = dp.widthPx;
out.y = dp.heightPx;
+ if (TaskView.clipLeft(dp)) {
+ out.x -= dp.getInsets().left;
+ }
+ if (TaskView.clipRight(dp)) {
+ out.x -= dp.getInsets().right;
+ }
+ if (TaskView.clipTop(dp)) {
+ out.y -= dp.getInsets().top;
+ }
+ if (TaskView.clipBottom(dp)) {
+ out.y -= Math.max(dp.getInsets().bottom, dp.taskbarSize);
+ }
}
}
diff --git a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
index 21e0ae8..841e578 100644
--- a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
+++ b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
@@ -396,9 +396,17 @@
Rect insets = dp.getInsets();
float fullWidth = dp.widthPx;
float fullHeight = dp.heightPx;
- if (TaskView.clipStatusAndNavBars(dp)) {
- fullWidth -= insets.left + insets.right;
- fullHeight -= insets.top + insets.bottom;
+ if (TaskView.clipLeft(dp)) {
+ fullWidth -= insets.left;
+ }
+ if (TaskView.clipRight(dp)) {
+ fullWidth -= insets.right;
+ }
+ if (TaskView.clipTop(dp)) {
+ fullHeight -= insets.top;
+ }
+ if (TaskView.clipBottom(dp)) {
+ fullHeight -= insets.bottom;
}
getTaskDimension(mContext, dp, outPivot);
diff --git a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
index 0577cce..28044e4 100644
--- a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
@@ -211,10 +211,6 @@
return Insets.NONE;
}
- if (!TaskView.clipStatusAndNavBars(mActivity.getDeviceProfile())) {
- return Insets.NONE;
- }
-
RectF bitmapRect = new RectF(
0, 0,
mThumbnailData.thumbnail.getWidth(), mThumbnailData.thumbnail.getHeight());
@@ -228,11 +224,14 @@
RectF boundsInBitmapSpace = new RectF();
boundsToBitmapSpace.mapRect(boundsInBitmapSpace, viewRect);
- return Insets.of(
- Math.round(boundsInBitmapSpace.left),
- Math.round(boundsInBitmapSpace.top),
- Math.round(bitmapRect.right - boundsInBitmapSpace.right),
- Math.round(bitmapRect.bottom - boundsInBitmapSpace.bottom));
+ DeviceProfile dp = mActivity.getDeviceProfile();
+ int leftInset = TaskView.clipLeft(dp) ? Math.round(boundsInBitmapSpace.left) : 0;
+ int topInset = TaskView.clipTop(dp) ? Math.round(boundsInBitmapSpace.top) : 0;
+ int rightInset = TaskView.clipRight(dp) ? Math.round(
+ bitmapRect.right - boundsInBitmapSpace.right) : 0;
+ int bottomInset = TaskView.clipBottom(dp)
+ ? Math.round(bitmapRect.bottom - boundsInBitmapSpace.bottom) : 0;
+ return Insets.of(leftInset, topInset, rightInset, bottomInset);
}
@@ -440,8 +439,19 @@
int thumbnailRotation = thumbnailData.rotation;
int deltaRotate = getRotationDelta(currentRotation, thumbnailRotation);
- RectF thumbnailClipHint = TaskView.clipStatusAndNavBars(dp)
- ? new RectF(thumbnailData.insets) : new RectF();
+ RectF thumbnailClipHint = new RectF();
+ if (TaskView.clipLeft(dp)) {
+ thumbnailClipHint.left = thumbnailData.insets.left;
+ }
+ if (TaskView.clipRight(dp)) {
+ thumbnailClipHint.right = thumbnailData.insets.right;
+ }
+ if (TaskView.clipTop(dp)) {
+ thumbnailClipHint.top = thumbnailData.insets.top;
+ }
+ if (TaskView.clipBottom(dp)) {
+ thumbnailClipHint.bottom = thumbnailData.insets.bottom;
+ }
float scale = thumbnailData.scale;
final float thumbnailScale;
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index 174e1b3..5986649 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -146,19 +146,39 @@
public static final float MAX_PAGE_SCRIM_ALPHA = 0.4f;
/**
- * Should the TaskView display clip off the status and navigation bars in recents. When this
- * is false the overview shows the whole screen scaled down instead.
+ * Should the TaskView display clip off the left inset in RecentsView.
*/
- public static boolean clipStatusAndNavBars(DeviceProfile deviceProfile) {
- return deviceProfile.isTaskbarPresentInApps;
+ public static boolean clipLeft(DeviceProfile deviceProfile) {
+ return false;
+ }
+
+ /**
+ * Should the TaskView display clip off the top inset in RecentsView.
+ */
+ public static boolean clipTop(DeviceProfile deviceProfile) {
+ return false;
+ }
+
+ /**
+ * Should the TaskView display clip off the right inset in RecentsView.
+ */
+ public static boolean clipRight(DeviceProfile deviceProfile) {
+ return false;
+ }
+
+ /**
+ * Should the TaskView display clip off the bottom inset in RecentsView.
+ */
+ public static boolean clipBottom(DeviceProfile deviceProfile) {
+ return deviceProfile.isTablet;
}
/**
* Should the TaskView scale down to fit whole thumbnail in fullscreen.
*/
public static boolean useFullThumbnail(DeviceProfile deviceProfile) {
- return deviceProfile.isTaskbarPresentInApps;
- };
+ return deviceProfile.isTablet && !deviceProfile.isTaskbarPresentInApps;
+ }
private static final float EDGE_SCALE_DOWN_FACTOR_CAROUSEL = 0.03f;
private static final float EDGE_SCALE_DOWN_FACTOR_GRID = 0.00f;