Set mState = mCurrentStableState in onAnimationCancel()
Context: there was a bug where you could get stuck in HintState if you
did the following (timing is critical):
1. Short swipe from nav region towards HintState, but not far enough or
fast enough to commit before letting go; this cancels the state
animation, returning towards Normal (but, crucially, StateManager
still has state set as Hint)
2. While previous animation is animating back to Normal, swipe up again,
but this time faster/farther to actually reach Hint; this time, the
animation does go towards Hint, but gets stuck there. The reason it
gets stuck is because StateManager thinks we're already in Hint from
step 1, so doesn't call onStateTransitionEnd(Hint) in step 2. Thus,
we never get QuickstepLauncher#onStateSetEnd(Hint), which is what we
rely on to return to Normal.
Fix is to have StateManager change its internal state to
mCurrentStableState (the state the transition started from) if the
animation is canceled. (Also need to keep that state if restarting the
animation, which AbstractStateChangeTouchController does in onDragEnd,
regardless of whether it ends up going to mFromState or mToState.)
Test: short swipe followed immediately by fast fling from nav region on home successfully goes to HintState and back to Normal
Fixes: 228276181
Change-Id: I2e3aeac06d482b57729416d5de55cc6ffc9df23c
2 files changed