Merge "Fix Color Clock on AOD" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
1ed40ed78f
@@ -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
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user