Skip to content


[Predictive Back][Search] Fixed UnsupportedOperationException `Anim…
Browse files Browse the repository at this point in the history
…atorSet` crash in `SearchView`.

When navigation icon animation is disabled after the predictive back navigation icon animators are initialized, a strange crash happens in `SearchViewAnimatorSet#updateBackProgress` from the call to `AnimatorSet#setCurrentPlayTime()`, in which the button progress `AnimatorSet` duration is 250 but the total duration is 0. This triggers an [`UnsupportedOperationException`]( with the message: `"Error: Play time should always be in between 0 and duration."`.

Adding an early return from `SearchViewAnimatorSet#updateBackProgress` when navigation animation is disabled appears to fix the crash.

PiperOrigin-RevId: 550885523
  • Loading branch information
afohrman authored and pekingme committed Jul 26, 2023
1 parent 4c89301 commit f101532
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -629,6 +629,11 @@ public void updateBackProgress(@NonNull BackEventCompat backEvent) {

// Early return if navigation icon animation is disabled.
if (!searchView.isAnimatedNavigationIcon()) {

// Start and immediately pause the animator set so we can seek it with setCurrentPlayTime() in
// subsequent updateBackProgress() calls when the progress value changes.
backProgressAnimatorSet = getButtonsProgressAnimator(/* show= */ false);
Expand Down

0 comments on commit f101532

Please sign in to comment.