2D Recents: polish the app -> recents transition am: fc6ac0a78a
am: f6770e45f4
Change-Id: Ic1da2d280f4234fd69e9c7e6c69cc845a2aeae34
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
index 2f8a78b..cf6357b 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java
@@ -745,8 +745,12 @@
Task toTask = new Task();
TaskViewTransform toTransform = getThumbnailTransitionTransform(stackView, toTask,
windowOverrideRect);
- Bitmap thumbnail = drawThumbnailTransitionBitmap(toTask, toTransform,
- mThumbTransitionBitmapCache);
+ // When using a grid layout, the header is already visible on screen at the target
+ // location, making it unnecessary to draw it in the transition thumbnail.
+ Bitmap thumbnail = stackView.useGridLayout()
+ ? mThumbTransitionBitmapCache.createAshmemBitmap()
+ : drawThumbnailTransitionBitmap(toTask, toTransform,
+ mThumbTransitionBitmapCache);
if (thumbnail != null) {
RectF toTaskRect = toTransform.rect;
return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView,
@@ -777,7 +781,6 @@
// Get the transform for the running task
stackView.updateLayoutAlgorithm(true /* boundScroll */);
stackView.updateToInitialState();
- boolean isInSplitScreen = Recents.getSystemServices().hasDockedTask();
stackView.getStackAlgorithm().getStackTransformScreenCoordinates(launchTask,
stackView.getScroller().getStackScroll(), mTmpTransform, null, windowOverrideRect);
return mTmpTransform;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
index a58896a..4fa7ecb5 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
@@ -291,6 +291,9 @@
@ViewDebug.ExportedProperty(category="recents")
private int mStackBottomOffset;
+ /** The height, in pixels, of each task view's title bar. */
+ private int mTitleBarHeight;
+
// The paths defining the motion of the tasks when the stack is focused and unfocused
private Path mUnfocusedCurve;
private Path mFocusedCurve;
@@ -403,6 +406,14 @@
mBaseBottomMargin = res.getDimensionPixelSize(R.dimen.recents_layout_bottom_margin);
mFreeformStackGap =
res.getDimensionPixelSize(R.dimen.recents_freeform_layout_bottom_margin);
+ mTitleBarHeight = getDimensionForDevice(mContext,
+ R.dimen.recents_task_view_header_height,
+ R.dimen.recents_task_view_header_height,
+ R.dimen.recents_task_view_header_height,
+ R.dimen.recents_task_view_header_height_tablet_land,
+ R.dimen.recents_task_view_header_height,
+ R.dimen.recents_task_view_header_height_tablet_land,
+ R.dimen.recents_grid_task_view_header_height);
}
/**
@@ -903,12 +914,17 @@
* Transforms the given {@param transformOut} to the screen coordinates, overriding the current
* window rectangle with {@param windowOverrideRect} if non-null.
*/
- public TaskViewTransform transformToScreenCoordinates(TaskViewTransform transformOut,
+ TaskViewTransform transformToScreenCoordinates(TaskViewTransform transformOut,
Rect windowOverrideRect) {
Rect windowRect = windowOverrideRect != null
? windowOverrideRect
: Recents.getSystemServices().getWindowRect();
transformOut.rect.offset(windowRect.left, windowRect.top);
+ if (useGridLayout()) {
+ // Draw the thumbnail a little lower to perfectly coincide with the view we are
+ // transitioning to, where the header bar has already been drawn.
+ transformOut.rect.offset(0, mTitleBarHeight);
+ }
return transformOut;
}