diff options
2 files changed, 14 insertions, 3 deletions
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/clocks/DefaultClockController.kt b/packages/SystemUI/shared/src/com/android/systemui/shared/clocks/DefaultClockController.kt index 599cd23f6616..23a7271afbdb 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/clocks/DefaultClockController.kt +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/clocks/DefaultClockController.kt @@ -142,7 +142,9 @@ class DefaultClockController( currentColor = color view.setColors(DOZE_COLOR, color) - view.animateAppearOnLockscreen() + if (!animations.dozeState.isActive) { + view.animateAppearOnLockscreen() + } } } @@ -197,7 +199,7 @@ class DefaultClockController( dozeFraction: Float, foldFraction: Float, ) : ClockAnimations { - private val dozeState = AnimationState(dozeFraction) + internal val dozeState = AnimationState(dozeFraction) private val foldState = AnimationState(foldFraction) init { @@ -238,7 +240,7 @@ class DefaultClockController( get() = true } - private class AnimationState( + class AnimationState( var fraction: Float, ) { var isActive: Boolean = fraction > 0.5f diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/clocks/DefaultClockProviderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shared/clocks/DefaultClockProviderTest.kt index f5bed79b5e6f..a7588ddcaeef 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shared/clocks/DefaultClockProviderTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/shared/clocks/DefaultClockProviderTest.kt @@ -43,6 +43,7 @@ import org.mockito.ArgumentMatchers.anyFloat import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.notNull import org.mockito.Mock +import org.mockito.Mockito.never import org.mockito.Mockito.times import org.mockito.Mockito.verify import org.mockito.Mockito.`when` as whenever @@ -178,4 +179,12 @@ class DefaultClockProviderTest : SysuiTestCase() { verify(mockSmallClockView, times(2)).refreshFormat() verify(mockLargeClockView, times(2)).refreshFormat() } + + @Test + fun test_aodClock_always_whiteColor() { + val clock = provider.createClock(DEFAULT_CLOCK_ID) + clock.animations.doze(0.9f) // set AOD mode to active + clock.smallClock.events.onRegionDarknessChanged(true) + verify((clock.smallClock.view as AnimatableClockView), never()).animateAppearOnLockscreen() + } } |