diff --git a/services/core/java/com/android/server/wm/RemoteAnimationController.java b/services/core/java/com/android/server/wm/RemoteAnimationController.java index b4bfedda94c7c..63b52aa01b974 100644 --- a/services/core/java/com/android/server/wm/RemoteAnimationController.java +++ b/services/core/java/com/android/server/wm/RemoteAnimationController.java @@ -395,10 +395,14 @@ class RemoteAnimationController implements DeathRecipient { // Restore z-layering, position and stack crop until client has a chance to modify it. t.setLayer(animationLeash, mRecord.mAppWindowToken.getPrefixOrderIndex()); - t.setPosition(animationLeash, mPosition.x, mPosition.y); - mTmpRect.set(mStackBounds); - mTmpRect.offsetTo(0, 0); - t.setWindowCrop(animationLeash, mTmpRect); + if (mRecord.mStartBounds != null) { + t.setPosition(animationLeash, mRecord.mStartBounds.left, mRecord.mStartBounds.top); + t.setWindowCrop(animationLeash, mRecord.mStartBounds.width(), + mRecord.mStartBounds.height()); + } else { + t.setPosition(animationLeash, mPosition.x, mPosition.y); + t.setWindowCrop(animationLeash, mStackBounds.width(), mStackBounds.height()); + } mCapturedLeash = animationLeash; mCapturedFinishCallback = finishCallback; } diff --git a/services/tests/wmtests/src/com/android/server/wm/RemoteAnimationControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/RemoteAnimationControllerTest.java index cb74c3e32252a..a84bb14fb204e 100644 --- a/services/tests/wmtests/src/com/android/server/wm/RemoteAnimationControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/RemoteAnimationControllerTest.java @@ -110,7 +110,7 @@ public class RemoteAnimationControllerTest extends WindowTestsBase { assertEquals(false, app.isTranslucent); verify(mMockTransaction).setLayer(mMockLeash, app.prefixOrderIndex); verify(mMockTransaction).setPosition(mMockLeash, app.position.x, app.position.y); - verify(mMockTransaction).setWindowCrop(mMockLeash, new Rect(0, 0, 100, 50)); + verify(mMockTransaction).setWindowCrop(mMockLeash, 100, 50); finishedCaptor.getValue().onAnimationFinished(); verify(mFinishedCallback).onAnimationFinished(eq(adapter)); @@ -251,8 +251,9 @@ public class RemoteAnimationControllerTest extends WindowTestsBase { assertEquals(win.mWinAnimator.mLastClipRect, app.clipRect); assertEquals(false, app.isTranslucent); verify(mMockTransaction).setLayer(mMockLeash, app.prefixOrderIndex); - verify(mMockTransaction).setPosition(mMockLeash, app.position.x, app.position.y); - verify(mMockTransaction).setWindowCrop(mMockLeash, new Rect(0, 0, 200, 200)); + verify(mMockTransaction).setPosition( + mMockLeash, app.startBounds.left, app.startBounds.top); + verify(mMockTransaction).setWindowCrop(mMockLeash, 200, 200); verify(mMockTransaction).setPosition(mMockThumbnailLeash, 0, 0); finishedCaptor.getValue().onAnimationFinished();