From 33558d6274903458efb403dee92c12750fd7ea20 Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Fri, 11 Aug 2023 09:12:56 +0000 Subject: 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 --- .../src/com/android/wm/shell/back/CrossActivityAnimation.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'libs/WindowManager') diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/back/CrossActivityAnimation.java b/libs/WindowManager/Shell/src/com/android/wm/shell/back/CrossActivityAnimation.java index edefe9e3ab06..74a243d34642 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/back/CrossActivityAnimation.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/back/CrossActivityAnimation.java @@ -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 -- cgit v1.2.3-59-g8ed1b