Fix regression from ag/9518396

- Previously, we would only cancel the current animation if
  sharedState.canBeContinued which was only set when mGestureEndTarget
  was set, which is only calculated when the swipe gesture ends,
  and is only true if the end target is not Launcher.

  In ag//9518396 the check for the null end target was moved into
  isRunningAnimationToLauncher(), but that call actually bakes in two
  checks together, which means that even when tapping the home button
  (where there is no gesture and no end target), it would return false.
  Instead, we should ensure that the gesture target is set before trying
  to cancel the animation.
- Also fix an existing issue where if the consumer is cleaned up after
  the start callback is registered, but not before the callback has
  returned, that we may incorrectly set the wrong launcher state since
  the callback is made to the old gesture handler which tries to prepare
  the recents UI (this manifests as a blank launcher screen).

Bug: 141886704
Change-Id: I642f20d631924730e98d10bb2123bd9448793fc6
1 file changed