Use start-bounds for animation leash crop

When available, set the animation leash crop to the start-bounds
rather than the end-bounds. Otherwise, for change transitions, there
is a small period of time (between when the leash is set-up and
when the app process receives the start-animation call) where
incorrect state can be drawn.

Bug: 136468446
Test: atest RemoteAnimationControllerTest.
      With remote animator on mode change, maximize while taking
      an sf trace. Check that anim-leash crop is set properly.

Change-Id: I4148980af1514b13455923db29876ffb3045ebcb
This commit is contained in:
Evan Rosky
2019-07-01 09:59:17 -07:00
parent 42439214eb
commit b96326e40f
2 changed files with 12 additions and 7 deletions

View File

@@ -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;
}

View File

@@ -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();