Transitions - Add DOZING -> GONE
Recent changes remove the intermediate LOCKSCREEN state, which would flicker when unlocking directly from DOZE state. The device is no longer told to wake up when using FPS, so support a direct transition between DOZING and GONE. Fixes: 267156993 Test: atest KeyguardTransitionSCenariosTest Change-Id: I72c43c93fed9c7dba43449977f541cb3e19210a7
This commit is contained in:
@@ -21,6 +21,7 @@ import com.android.systemui.animation.Interpolators
|
||||
import com.android.systemui.dagger.SysUISingleton
|
||||
import com.android.systemui.dagger.qualifiers.Application
|
||||
import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepository
|
||||
import com.android.systemui.keyguard.shared.model.BiometricUnlockModel.Companion.isWakeAndUnlock
|
||||
import com.android.systemui.keyguard.shared.model.KeyguardState
|
||||
import com.android.systemui.keyguard.shared.model.TransitionInfo
|
||||
import com.android.systemui.keyguard.shared.model.WakefulnessModel.Companion.isWakingOrStartingToWake
|
||||
@@ -44,6 +45,7 @@ constructor(
|
||||
|
||||
override fun start() {
|
||||
listenForDozingToLockscreen()
|
||||
listenForDozingToGone()
|
||||
}
|
||||
|
||||
private fun listenForDozingToLockscreen() {
|
||||
@@ -68,6 +70,28 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun listenForDozingToGone() {
|
||||
scope.launch {
|
||||
keyguardInteractor.biometricUnlockState
|
||||
.sample(keyguardTransitionInteractor.startedKeyguardTransitionStep, ::Pair)
|
||||
.collect { (biometricUnlockState, lastStartedTransition) ->
|
||||
if (
|
||||
lastStartedTransition.to == KeyguardState.DOZING &&
|
||||
isWakeAndUnlock(biometricUnlockState)
|
||||
) {
|
||||
keyguardTransitionRepository.startTransition(
|
||||
TransitionInfo(
|
||||
name,
|
||||
KeyguardState.DOZING,
|
||||
KeyguardState.GONE,
|
||||
getAnimator(),
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getAnimator(duration: Duration = DEFAULT_DURATION): ValueAnimator {
|
||||
return ValueAnimator().apply {
|
||||
setInterpolator(Interpolators.LINEAR)
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.android.systemui.animation.Interpolators
|
||||
import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository
|
||||
import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepository
|
||||
import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepositoryImpl
|
||||
import com.android.systemui.keyguard.shared.model.BiometricUnlockModel
|
||||
import com.android.systemui.keyguard.shared.model.DozeStateModel
|
||||
import com.android.systemui.keyguard.shared.model.DozeTransitionModel
|
||||
import com.android.systemui.keyguard.shared.model.KeyguardState
|
||||
@@ -436,6 +437,43 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() {
|
||||
coroutineContext.cancelChildren()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `DOZING to GONE`() =
|
||||
testScope.runTest {
|
||||
// GIVEN a prior transition has run to DOZING
|
||||
runner.startTransition(
|
||||
testScope,
|
||||
TransitionInfo(
|
||||
ownerName = "",
|
||||
from = KeyguardState.LOCKSCREEN,
|
||||
to = KeyguardState.DOZING,
|
||||
animator =
|
||||
ValueAnimator().apply {
|
||||
duration = 10
|
||||
interpolator = Interpolators.LINEAR
|
||||
},
|
||||
)
|
||||
)
|
||||
runCurrent()
|
||||
reset(mockTransitionRepository)
|
||||
|
||||
// WHEN biometrics succeeds with wake and unlock mode
|
||||
keyguardRepository.setBiometricUnlockState(BiometricUnlockModel.WAKE_AND_UNLOCK)
|
||||
runCurrent()
|
||||
|
||||
val info =
|
||||
withArgCaptor<TransitionInfo> {
|
||||
verify(mockTransitionRepository).startTransition(capture())
|
||||
}
|
||||
// THEN a transition to DOZING should occur
|
||||
assertThat(info.ownerName).isEqualTo("FromDozingTransitionInteractor")
|
||||
assertThat(info.from).isEqualTo(KeyguardState.DOZING)
|
||||
assertThat(info.to).isEqualTo(KeyguardState.GONE)
|
||||
assertThat(info.animator).isNotNull()
|
||||
|
||||
coroutineContext.cancelChildren()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GONE to DOZING`() =
|
||||
testScope.runTest {
|
||||
|
||||
Reference in New Issue
Block a user