From e8f9151270ec7f8995f6437410ae5580f9c09a3b Mon Sep 17 00:00:00 2001 From: Shan Huang Date: Mon, 18 Apr 2022 19:55:02 +0000 Subject: [PATCH] Fix broken animation on two consecutive swipes. The bug is caused by allowing a second swipe to restart animation in BackAnimationController. This CL adds a flag to reject incoming gestures when an uninterruptable transition (e.g. commit transition, cancel transition) is already in progress. To prevent an unfinished transition from failing all future swipes, this CL also introduces a timeout mechanism to start accepting gesture again after a fixed period. Bug: 221394367 Test: Do two quick consecutive swipes and observe the back to home animation. Merged-In: Ib969afb72cc15bd268613546f3495008b6bc9125 Change-Id: Ib969afb72cc15bd268613546f3495008b6bc9125 --- .../shell/back/BackAnimationController.java | 41 ++++++++++++++++- .../back/BackAnimationControllerTest.java | 45 ++++++++++++++++++- 2 files changed, 83 insertions(+), 3 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java index 8fa9f564fb222..a16841cb870ac 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java @@ -67,8 +67,12 @@ public class BackAnimationController implements RemoteCallable { + finishAnimation(); + mTransitionInProgress = false; + }; public BackAnimationController( @NonNull @ShellMainThread ShellExecutor shellExecutor, @@ -229,7 +239,8 @@ public class BackAnimationController implements RemoteCallable