Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8947c9eb authored by William Xiao's avatar William Xiao Committed by Android Build Coastguard Worker
Browse files

Suppress IndexOutOfBoundsException when cancelling low light animation

This is a temporary fix for udc-dev to prevent a SysUI crash.

Bug: 285666217
Test: manually confirmed on device that cancelling the animation does not cause a crah
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:36b2e9cf0d5266475867a8b023b13722927b4bd2)
Merged-In: I5a05b174eced7db0b79260f95e4646f961417d9c
Change-Id: I5a05b174eced7db0b79260f95e4646f961417d9c
parent 3339534e
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -111,8 +111,14 @@ class LowLightTransitionCoordinator @Inject constructor() {
            }
            animator.addListener(listener)
            continuation.invokeOnCancellation {
                try {
                    animator.removeListener(listener)
                    animator.cancel()
                } catch (exception: IndexOutOfBoundsException) {
                    // TODO(b/285666217): remove this try/catch once a proper fix is implemented.
                    // Cancelling the animator can cause an exception since we may be removing a
                    // listener during the cancellation. See b/285666217 for more details.
                }
            }
        }
}