Merge "Fix thumbnail disalignment on curved paths" into nyc-dev
diff --git a/services/core/java/com/android/server/wm/AppTransition.java b/services/core/java/com/android/server/wm/AppTransition.java
index 62fa013..15a2691 100644
--- a/services/core/java/com/android/server/wm/AppTransition.java
+++ b/services/core/java/com/android/server/wm/AppTransition.java
@@ -881,7 +881,7 @@
* when a thumbnail is specified with the pending animation override.
*/
Animation createThumbnailAspectScaleAnimationLocked(Rect appRect, @Nullable Rect contentInsets,
- Bitmap thumbnailHeader, final int taskId) {
+ Bitmap thumbnailHeader, final int taskId, int orientation) {
Animation a;
final int thumbWidthI = thumbnailHeader.getWidth();
final float thumbWidth = thumbWidthI > 0 ? thumbWidthI : 1;
@@ -890,12 +890,30 @@
float scaleW = appWidth / thumbWidth;
getNextAppTransitionStartRect(taskId, mTmpRect);
- final float toY = mTmpRect.height() / 2 * (scaleW - 1f) + appRect.top;
- final float fromY = mTmpRect.top;
- final float toX = mTmpRect.width() / 2 * (scaleW - 1f) + appRect.left;
- final float fromX = mTmpRect.left;
- final float pivotX = mTmpRect.width() / 2;
- final float pivotY = mTmpRect.height() / 2;
+ final float fromX;
+ final float fromY;
+ final float toX;
+ final float toY;
+ final float pivotX;
+ final float pivotY;
+ if (orientation == Configuration.ORIENTATION_PORTRAIT) {
+ fromX = mTmpRect.left;
+ fromY = mTmpRect.top;
+
+ // For the curved translate animation to work, the pivot points needs to be at the
+ // same absolute position as the one from the real surface.
+ toX = mTmpRect.width() / 2 * (scaleW - 1f) + appRect.left;
+ toY = appRect.height() / 2 * (1 - 1 / scaleW) + appRect.top;
+ pivotX = mTmpRect.width() / 2;
+ pivotY = appRect.height() / 2 / scaleW;
+ } else {
+ pivotX = 0;
+ pivotY = 0;
+ fromX = mTmpRect.left;
+ fromY = mTmpRect.top;
+ toX = appRect.left;
+ toY = appRect.top;
+ }
final long duration = getAspectScaleDuration();
final Interpolator interpolator = getAspectScaleInterpolator();
if (mNextAppTransitionScaleUp) {
diff --git a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
index 5ff0613..3b0081d 100644
--- a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
+++ b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
@@ -1582,7 +1582,7 @@
// synchronize its thumbnail surface with the surface for the
// open/close animation (only on the way down)
anim = mService.mAppTransition.createThumbnailAspectScaleAnimationLocked(appRect,
- insets, thumbnailHeader, taskId);
+ insets, thumbnailHeader, taskId, mService.mCurConfiguration.orientation);
openingAppAnimator.thumbnailForceAboveLayer = Math.max(openingLayer, closingLayer);
openingAppAnimator.deferThumbnailDestruction =
!mService.mAppTransition.isNextThumbnailTransitionScaleUp();