Merge "Suppress IndexOutOfBoundsException when cancelling low light animation" into udc-dev
diff --git a/libs/dream/lowlight/src/com/android/dream/lowlight/LowLightTransitionCoordinator.kt b/libs/dream/lowlight/src/com/android/dream/lowlight/LowLightTransitionCoordinator.kt
index 26efb55..4736030 100644
--- a/libs/dream/lowlight/src/com/android/dream/lowlight/LowLightTransitionCoordinator.kt
+++ b/libs/dream/lowlight/src/com/android/dream/lowlight/LowLightTransitionCoordinator.kt
@@ -111,8 +111,14 @@
}
animator.addListener(listener)
continuation.invokeOnCancellation {
- animator.removeListener(listener)
- animator.cancel()
+ 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.
+ }
}
}
}