Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DozingToGoneTransitionViewModelTest.kt +3 −5 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ class DozingToGoneTransitionViewModelTest : SysuiTestCase() { @Test fun lockscreenAlpha() = testScope.runTest { val viewState = ViewStateAccessor(alpha = { 0.6f }) val viewState = ViewStateAccessor() val alpha by collectValues(underTest.lockscreenAlpha(viewState)) keyguardTransitionRepository.sendTransitionSteps( Loading @@ -62,11 +62,9 @@ class DozingToGoneTransitionViewModelTest : SysuiTestCase() { testScope ) assertThat(alpha[0]).isEqualTo(0.6f) // Fades out just prior to halfway // Remain at zero throughout assertThat(alpha[0]).isEqualTo(0f) assertThat(alpha[1]).isEqualTo(0f) // Must finish at 0 assertThat(alpha[2]).isEqualTo(0f) } @Test Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractor.kt +31 −4 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import com.android.systemui.keyguard.shared.model.BiometricUnlockMode.Companion. import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.power.domain.interactor.PowerInteractor import com.android.systemui.util.kotlin.Utils.Companion.sample import com.android.systemui.util.kotlin.sample import javax.inject.Inject import kotlin.time.Duration.Companion.milliseconds import kotlinx.coroutines.CoroutineDispatcher Loading Loading @@ -65,6 +66,7 @@ constructor( override fun start() { listenForDozingToAny() listenForDozingToGoneViaBiometrics() listenForWakeFromDozing() listenForTransitionToCamera(scope, keyguardInteractor) } Loading @@ -77,6 +79,35 @@ constructor( isKeyguardDismissible && !isKeyguardShowing } private fun listenForDozingToGoneViaBiometrics() { if (KeyguardWmStateRefactor.isEnabled) { return } // This is separate from `listenForDozingToAny` because any delay on wake and unlock will // cause a noticeable issue with animations scope.launch { powerInteractor.isAwake .filterRelevantKeyguardStateAnd { isAwake -> isAwake } .sample( keyguardInteractor.biometricUnlockState, ::Pair, ) .collect { ( _, biometricUnlockState, ) -> if (isWakeAndUnlock(biometricUnlockState.mode)) { startTransitionTo( KeyguardState.GONE, ownerReason = "biometric wake and unlock", ) } } } } private fun listenForDozingToAny() { if (KeyguardWmStateRefactor.isEnabled) { return Loading @@ -87,7 +118,6 @@ constructor( .debounce(50L) .filterRelevantKeyguardStateAnd { isAwake -> isAwake } .sample( keyguardInteractor.biometricUnlockState, keyguardInteractor.isKeyguardOccluded, communalInteractor.isIdleOnCommunal, canTransitionToGoneOnWake, Loading @@ -96,7 +126,6 @@ constructor( .collect { ( _, biometricUnlockState, occluded, isIdleOnCommunal, canTransitionToGoneOnWake, Loading @@ -104,8 +133,6 @@ constructor( startTransitionTo( if (!deviceEntryRepository.isLockscreenEnabled()) { KeyguardState.GONE } else if (isWakeAndUnlock(biometricUnlockState.mode)) { KeyguardState.GONE } else if (canTransitionToGoneOnWake) { KeyguardState.GONE } else if (primaryBouncerShowing) { Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/DozingToGoneTransitionViewModel.kt +2 −5 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.systemui.keyguard.ui.viewmodel import android.util.MathUtils import com.android.systemui.dagger.SysUISingleton import com.android.systemui.keyguard.domain.interactor.FromDozingTransitionInteractor.Companion.TO_GONE_DURATION import com.android.systemui.keyguard.shared.model.Edge Loading Loading @@ -50,12 +49,10 @@ constructor( ) fun lockscreenAlpha(viewState: ViewStateAccessor): Flow<Float> { var startAlpha = 1f return transitionAnimation.sharedFlow( duration = 200.milliseconds, onStart = { startAlpha = viewState.alpha() }, onStep = { MathUtils.lerp(startAlpha, 0f, it) }, onFinish = { 0f }, onStart = { 0f }, onStep = { 0f }, ) } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java +3 −0 Original line number Diff line number Diff line Loading @@ -538,6 +538,9 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp // later to awaken. } mNotificationShadeWindowController.setNotificationShadeFocusable(false); // Notify the interactor first, to prevent race conditions with the screen waking up // that would show a flicker of the lockscreen on DOZING->GONE mBiometricUnlockInteractor.setBiometricUnlockState(mode, biometricUnlockSource); mKeyguardViewMediator.onWakeAndUnlocking(wakeInKeyguard); Trace.endSection(); break; Loading packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -569,13 +569,13 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest // WHEN biometrics succeeds with wake and unlock mode powerInteractor.setAwakeForTest() keyguardRepository.setBiometricUnlockState(BiometricUnlockMode.WAKE_AND_UNLOCK) advanceTimeBy(60L) runCurrent() assertThat(transitionRepository) .startedTransition( to = KeyguardState.GONE, from = KeyguardState.DOZING, ownerName = "FromDozingTransitionInteractor", ownerName = "FromDozingTransitionInteractor(biometric wake and unlock)", animatorAssertion = { it.isNotNull() } ) Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/DozingToGoneTransitionViewModelTest.kt +3 −5 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ class DozingToGoneTransitionViewModelTest : SysuiTestCase() { @Test fun lockscreenAlpha() = testScope.runTest { val viewState = ViewStateAccessor(alpha = { 0.6f }) val viewState = ViewStateAccessor() val alpha by collectValues(underTest.lockscreenAlpha(viewState)) keyguardTransitionRepository.sendTransitionSteps( Loading @@ -62,11 +62,9 @@ class DozingToGoneTransitionViewModelTest : SysuiTestCase() { testScope ) assertThat(alpha[0]).isEqualTo(0.6f) // Fades out just prior to halfway // Remain at zero throughout assertThat(alpha[0]).isEqualTo(0f) assertThat(alpha[1]).isEqualTo(0f) // Must finish at 0 assertThat(alpha[2]).isEqualTo(0f) } @Test Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromDozingTransitionInteractor.kt +31 −4 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import com.android.systemui.keyguard.shared.model.BiometricUnlockMode.Companion. import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.power.domain.interactor.PowerInteractor import com.android.systemui.util.kotlin.Utils.Companion.sample import com.android.systemui.util.kotlin.sample import javax.inject.Inject import kotlin.time.Duration.Companion.milliseconds import kotlinx.coroutines.CoroutineDispatcher Loading Loading @@ -65,6 +66,7 @@ constructor( override fun start() { listenForDozingToAny() listenForDozingToGoneViaBiometrics() listenForWakeFromDozing() listenForTransitionToCamera(scope, keyguardInteractor) } Loading @@ -77,6 +79,35 @@ constructor( isKeyguardDismissible && !isKeyguardShowing } private fun listenForDozingToGoneViaBiometrics() { if (KeyguardWmStateRefactor.isEnabled) { return } // This is separate from `listenForDozingToAny` because any delay on wake and unlock will // cause a noticeable issue with animations scope.launch { powerInteractor.isAwake .filterRelevantKeyguardStateAnd { isAwake -> isAwake } .sample( keyguardInteractor.biometricUnlockState, ::Pair, ) .collect { ( _, biometricUnlockState, ) -> if (isWakeAndUnlock(biometricUnlockState.mode)) { startTransitionTo( KeyguardState.GONE, ownerReason = "biometric wake and unlock", ) } } } } private fun listenForDozingToAny() { if (KeyguardWmStateRefactor.isEnabled) { return Loading @@ -87,7 +118,6 @@ constructor( .debounce(50L) .filterRelevantKeyguardStateAnd { isAwake -> isAwake } .sample( keyguardInteractor.biometricUnlockState, keyguardInteractor.isKeyguardOccluded, communalInteractor.isIdleOnCommunal, canTransitionToGoneOnWake, Loading @@ -96,7 +126,6 @@ constructor( .collect { ( _, biometricUnlockState, occluded, isIdleOnCommunal, canTransitionToGoneOnWake, Loading @@ -104,8 +133,6 @@ constructor( startTransitionTo( if (!deviceEntryRepository.isLockscreenEnabled()) { KeyguardState.GONE } else if (isWakeAndUnlock(biometricUnlockState.mode)) { KeyguardState.GONE } else if (canTransitionToGoneOnWake) { KeyguardState.GONE } else if (primaryBouncerShowing) { Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/DozingToGoneTransitionViewModel.kt +2 −5 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.systemui.keyguard.ui.viewmodel import android.util.MathUtils import com.android.systemui.dagger.SysUISingleton import com.android.systemui.keyguard.domain.interactor.FromDozingTransitionInteractor.Companion.TO_GONE_DURATION import com.android.systemui.keyguard.shared.model.Edge Loading Loading @@ -50,12 +49,10 @@ constructor( ) fun lockscreenAlpha(viewState: ViewStateAccessor): Flow<Float> { var startAlpha = 1f return transitionAnimation.sharedFlow( duration = 200.milliseconds, onStart = { startAlpha = viewState.alpha() }, onStep = { MathUtils.lerp(startAlpha, 0f, it) }, onFinish = { 0f }, onStart = { 0f }, onStep = { 0f }, ) } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java +3 −0 Original line number Diff line number Diff line Loading @@ -538,6 +538,9 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp // later to awaken. } mNotificationShadeWindowController.setNotificationShadeFocusable(false); // Notify the interactor first, to prevent race conditions with the screen waking up // that would show a flicker of the lockscreen on DOZING->GONE mBiometricUnlockInteractor.setBiometricUnlockState(mode, biometricUnlockSource); mKeyguardViewMediator.onWakeAndUnlocking(wakeInKeyguard); Trace.endSection(); break; Loading
packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -569,13 +569,13 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest // WHEN biometrics succeeds with wake and unlock mode powerInteractor.setAwakeForTest() keyguardRepository.setBiometricUnlockState(BiometricUnlockMode.WAKE_AND_UNLOCK) advanceTimeBy(60L) runCurrent() assertThat(transitionRepository) .startedTransition( to = KeyguardState.GONE, from = KeyguardState.DOZING, ownerName = "FromDozingTransitionInteractor", ownerName = "FromDozingTransitionInteractor(biometric wake and unlock)", animatorAssertion = { it.isNotNull() } ) Loading