diff options
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerImpl.kt')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerImpl.kt | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerImpl.kt index 68321f433c81..28b00b738a66 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerImpl.kt @@ -182,19 +182,19 @@ constructor( // Set hasPersistentDot to false. If the animationState is anything before ANIMATING_OUT, // the disappear animation will not animate into a dot but remove the chip entirely hasPersistentDot = false - // if we are currently showing a persistent dot, hide it - if (animationState.value == SHOWING_PERSISTENT_DOT) notifyHidePersistentDot() - // if we are currently animating into a dot, wait for the animation to finish and then hide - // the dot - if (animationState.value == ANIMATING_OUT) { - coroutineScope.launch { - withTimeout(DISAPPEAR_ANIMATION_DURATION) { - animationState.first { - it == SHOWING_PERSISTENT_DOT || it == IDLE || it == ANIMATION_QUEUED - } - notifyHidePersistentDot() - } + + if (animationState.value == SHOWING_PERSISTENT_DOT) { + // if we are currently showing a persistent dot, hide it and update the animationState + notifyHidePersistentDot() + if (scheduledEvent.value != null) { + animationState.value = ANIMATION_QUEUED + } else { + animationState.value = IDLE } + } else if (animationState.value == ANIMATING_OUT) { + // if we are currently animating out, hide the dot. The animationState will be updated + // once the animation has ended in the onAnimationEnd callback + notifyHidePersistentDot() } } @@ -376,14 +376,6 @@ constructor( Assert.isMainThread() val anims: List<Animator> = listeners.mapNotNull { it.onHidePersistentDot() } - if (animationState.value == SHOWING_PERSISTENT_DOT) { - if (scheduledEvent.value != null) { - animationState.value = ANIMATION_QUEUED - } else { - animationState.value = IDLE - } - } - if (anims.isNotEmpty()) { val aSet = AnimatorSet() aSet.playTogether(anims) |