Fix flickering when cancel cross activity animation.

Cross activity animation use different spring animations to control
different object/status, so the finish stage of each animations are
arrived separatly. For the cancel animation case, force update the
closing target to final stage before release all animation leashes.

Bug: 230798396
Test: manual enter/cancel animation and verify no flicker.
Change-Id: I82d99ce4bc922cf7ecb7013ef532e8b18c47c35a
This commit is contained in:
wilsonshih
2023-08-11 09:12:56 +00:00
parent eb277dabba
commit 33558d6274

View File

@@ -371,7 +371,15 @@ class CrossActivityAnimation {
@Override
public void onBackCancelled() {
mProgressAnimator.onBackCancelled(CrossActivityAnimation.this::finishAnimation);
mProgressAnimator.onBackCancelled(() -> {
// mProgressAnimator can reach finish stage earlier than mLeavingProgressSpring,
// and if we release all animation leash first, the leavingProgressSpring won't
// able to update the animation anymore, which cause flicker.
// Here should force update the closing animation target to the final stage before
// release it.
setLeavingProgress(0);
finishAnimation();
});
}
@Override