From 461f055f849e7be6bfe1e326a8113b7dc01f63bf Mon Sep 17 00:00:00 2001 From: Alex Stetson Date: Tue, 1 Aug 2023 10:52:15 -0700 Subject: [PATCH] Allow for disabled chip animation configuration - Add config for different form factors to disable chip animation and go directly to the persistent dot - Pass status event to notifyTransitionToPersistentDot when animation is disabled (since currentlyDisplayedEvent will always be null) Bug: 289425128 Test: manual Change-Id: I876b0ee17fe8dc4840f7732173d3b02f52488f7f --- packages/SystemUI/res/values/config.xml | 3 +++ .../systemui/statusbar/events/SystemEventCoordinator.kt | 4 +++- .../events/SystemStatusAnimationSchedulerImpl.kt | 8 ++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index 9c864abca9dd1..540ae439d617f 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -775,6 +775,9 @@ true + + true + diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemEventCoordinator.kt b/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemEventCoordinator.kt index 23edf1787649a..2403920e69f97 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemEventCoordinator.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemEventCoordinator.kt @@ -164,7 +164,9 @@ constructor( } private fun isChipAnimationEnabled(): Boolean { - return DeviceConfig.getBoolean(NAMESPACE_PRIVACY, CHIP_ANIMATION_ENABLED, true) + val defaultValue = + context.resources.getBoolean(R.bool.config_enablePrivacyChipAnimation) + return DeviceConfig.getBoolean(NAMESPACE_PRIVACY, CHIP_ANIMATION_ENABLED, defaultValue) } } } 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 6fc715a2b578d..ea16fc48b696e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemStatusAnimationSchedulerImpl.kt @@ -243,7 +243,7 @@ constructor( if (!event.showAnimation && event.forceVisible) { // If animations are turned off, we'll transition directly to the dot animationState.value = SHOWING_PERSISTENT_DOT - notifyTransitionToPersistentDot() + notifyTransitionToPersistentDot(event) return } @@ -335,7 +335,7 @@ constructor( } animators.add(chipAnimationController.onSystemEventAnimationFinish(hasPersistentDot)) if (hasPersistentDot) { - val dotAnim = notifyTransitionToPersistentDot() + val dotAnim = notifyTransitionToPersistentDot(currentlyDisplayedEvent) if (dotAnim != null) { animators.add(dotAnim) } @@ -344,12 +344,12 @@ constructor( return AnimatorSet().also { it.playTogether(animators) } } - private fun notifyTransitionToPersistentDot(): Animator? { + private fun notifyTransitionToPersistentDot(event: StatusEvent?): Animator? { logger?.logTransitionToPersistentDotCallbackInvoked() val anims: List = listeners.mapNotNull { it.onSystemStatusAnimationTransitionToPersistentDot( - currentlyDisplayedEvent?.contentDescription + event?.contentDescription ) } if (anims.isNotEmpty()) {