Fix app callback broken when immediately restarting back gesture after cancel
This fixes two bugs: 1. When calling onBackStarted, we need to ensure that onBackCancelled of a potential previously cancelled gesture is called first. onBackCancelled can be delayed because the progress animates to 0 before the callback is invoked. Otherwise onBackStarted of the second gesture can be called before onBackCancelled of the first gesture is called. 2. The BackTouchTracker should be reset when the user gesture ends (instead of when BackProgressAnimator finished animating the progress back to 0). That ensures that a new gesture that starts between the gesture end and the progress reaching zero does not update the BackProgressAnimator of the previous (cancelled) gesture with new MotionEvents. Bug: 338021694 Flag: NONE Test: atest FrameworksCoreTests:WindowOnBackInvokedDispatcherTest Test: Manual, i.e. verifying that onBackCancelled is dispatched before onBackStarted when immediately restarting back gesture Change-Id: Ibe3ce291713dc5ba0512404fa47f6b17d50f7a13
Loading
Please register or sign in to comment