Fix continueComputingRecentsScrollIfNecessary() running infinitely

When continuing a gesture during quick switch, we cancel the
previous animation but don't invalidate it (since the gesture
isn't fully finished), and the new gesture handler calls
mRecentsView.setOnPageTransitionEndCallback(), so the previous
handler will never get STATE_RECENTS_SCROLLING_FINISHED. Thus,
continueComputingRecentsScrollIfNecessary() will never end.

To fix this, also check !mCanceled, since that is set when
continuing the gesture. Also use postOnAnimation() instead of
post() since that has better guarantees that the next
computation will wait for the next animation frame, rather
than whenever the message queue is available, which might
happen too frequently.

Test: quick switch from A to B and back to A before settling
on B, ensure we stop calling computeScroll().

Bug: 153589287
Change-Id: I6b4389ef2cf5a818438c7ae36d8807b3e41c8501
1 file changed