Trebuchet: ui: Fix premature short-circuit on end spring anim
RectFSpringAnim represents the delightful animation where a closing
window gradually fades and settles into the launcher icon or widget it
was originally opened from. Unfortunately, double-tapping the home
button causes this animation to freeze:
https://issuetracker.google.com/issues/258314409
This is due to a race condition where the animation updates are halted
before the final one can reach its listener, QuickStepTransitionManager.
RectFSpringAnim.onUpdate normally updates its listeners frame-by-frame,
but this can be short-circuited via isEnded() if all of mRectXAnimEnded,
mRectYAnimEnded, and mRectScaleAnimEnded are true. RectFSpringAnim.end,
which is called when the user "fast-finishes" the closing window
animation, prematurely sets these 3 flags to true, preventing the final
onUpdateListener.onUpdate from notifying QuickStepTransitionManager that
it should set the window alpha to 0. Thus, the animation hangs.
This can be resolved by no longer setting the 3 flags to true in
RectFSpringAnim.end. These flags conceptually represent an n=3 countdown
latch that releases maybeOnEnd(). This can be trusted to proceed with
the correct timings as the x-translation, y-translation, and scale
animations' OnAnimationEndListeners are invoked on their own.
Test: m Launcher3QuickStep && adb install -r -d \
$OUT/system_ext/priv-app/Launcher3QuickStep/Launcher3QuickStep.apk
- Optional: Set Animator duration scale = Animation scale 5x
- Open app via launcher icon, launcher widget, or app list
- Close app, then "fast-finish" while animation is still running
- 3-button navigation: Double-tap home button
- Gesture navigation: Swipe up, then tap anywhere
BEFORE
| | 3-button nav | Gesture nav |
|---------------------|---------------------------|-------------------|
| Opened via icon | Anim freezes (!) | Anim skips to end |
| Opened via widget | Anim freezes (!) | Anim skips to end |
| Opened via app list | Anim does not skip to end | Anim skips to end |
AFTER
| | 3-button nav | Gesture nav |
|---------------------|---------------------------|-------------------|
| Opened via icon | Anim skips to end | Anim skips to end |
| Opened via widget | Anim skips to end | Anim skips to end |
| Opened via app list | Anim does not skip to end | Anim skips to end |
Change-Id: I962946b1274e933ce7ad795ed96555b8450dc1a4
Signed-off-by: Dan Choi <ygdanchoi@gmail.com>
1 file changed