Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt +45 −82 Original line number Diff line number Diff line Loading @@ -137,9 +137,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest @JvmStatic @Parameters(name = "{0}") fun getParams(): List<FlagsParameterization> { return FlagsParameterization.allCombinationsOf( FLAG_COMMUNAL_SCENE_KTF_REFACTOR, ) return FlagsParameterization.allCombinationsOf(FLAG_COMMUNAL_SCENE_KTF_REFACTOR) .andSceneContainer() } } Loading @@ -157,9 +155,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest mSetFlagsRule.enableFlags(FLAG_COMMUNAL_HUB) kosmos.fakeFeatureFlagsClassic.set(COMMUNAL_SERVICE_ENABLED, true) if (!SceneContainerFlag.isEnabled) { mSetFlagsRule.disableFlags( Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR, ) mSetFlagsRule.disableFlags(Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR) } featureFlags = FakeFeatureFlags() Loading Loading @@ -194,7 +190,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest ownerName = "FromLockscreenTransitionInteractor" + "(#listenForLockscreenToPrimaryBouncer)", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -219,7 +215,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.DOZING, from = KeyguardState.OCCLUDED, ownerName = "FromOccludedTransitionInteractor(Sleep transition triggered)", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -244,7 +240,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.AOD, from = KeyguardState.OCCLUDED, ownerName = "FromOccludedTransitionInteractor(Sleep transition triggered)", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading Loading @@ -273,7 +269,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.DREAMING, from = KeyguardState.LOCKSCREEN, ownerName = "FromLockscreenTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading Loading @@ -303,7 +299,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.DREAMING_LOCKSCREEN_HOSTED, from = KeyguardState.LOCKSCREEN, ownerName = "FromLockscreenTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -328,7 +324,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.DOZING, from = KeyguardState.LOCKSCREEN, ownerName = "FromLockscreenTransitionInteractor(Sleep transition triggered)", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -353,7 +349,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.AOD, from = KeyguardState.LOCKSCREEN, ownerName = "FromLockscreenTransitionInteractor(Sleep transition triggered)", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -373,7 +369,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest // GIVEN a prior transition has run to DREAMING_LOCKSCREEN_HOSTED runTransitionAndSetWakefulness( KeyguardState.GONE, KeyguardState.DREAMING_LOCKSCREEN_HOSTED KeyguardState.DREAMING_LOCKSCREEN_HOSTED, ) // WHEN the lockscreen hosted dream stops Loading @@ -385,7 +381,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.LOCKSCREEN, from = KeyguardState.DREAMING_LOCKSCREEN_HOSTED, ownerName = "FromDreamingLockscreenHostedTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -398,7 +394,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest // GIVEN a prior transition has run to DREAMING_LOCKSCREEN_HOSTED runTransitionAndSetWakefulness( KeyguardState.GONE, KeyguardState.DREAMING_LOCKSCREEN_HOSTED KeyguardState.DREAMING_LOCKSCREEN_HOSTED, ) // WHEN biometrics succeeds with wake and unlock from dream mode Loading @@ -412,7 +408,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.GONE, from = KeyguardState.DREAMING_LOCKSCREEN_HOSTED, ownerName = "FromDreamingLockscreenHostedTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -429,7 +425,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest // GIVEN a prior transition has run to DREAMING_LOCKSCREEN_HOSTED runTransitionAndSetWakefulness( KeyguardState.GONE, KeyguardState.DREAMING_LOCKSCREEN_HOSTED KeyguardState.DREAMING_LOCKSCREEN_HOSTED, ) // WHEN the primary bouncer is set to show Loading @@ -441,7 +437,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.PRIMARY_BOUNCER, from = KeyguardState.DREAMING_LOCKSCREEN_HOSTED, ownerName = "FromDreamingLockscreenHostedTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -458,7 +454,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest // GIVEN a prior transition has run to DREAMING_LOCKSCREEN_HOSTED runTransitionAndSetWakefulness( KeyguardState.GONE, KeyguardState.DREAMING_LOCKSCREEN_HOSTED KeyguardState.DREAMING_LOCKSCREEN_HOSTED, ) // WHEN the device begins to sleep Loading @@ -473,7 +469,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.DOZING, from = KeyguardState.DREAMING_LOCKSCREEN_HOSTED, ownerName = "FromDreamingLockscreenHostedTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -491,7 +487,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest // GIVEN a prior transition has run to DREAMING_LOCKSCREEN_HOSTED runTransitionAndSetWakefulness( KeyguardState.GONE, KeyguardState.DREAMING_LOCKSCREEN_HOSTED KeyguardState.DREAMING_LOCKSCREEN_HOSTED, ) // WHEN the keyguard is occluded and the lockscreen hosted dream stops Loading @@ -504,7 +500,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.OCCLUDED, from = KeyguardState.DREAMING_LOCKSCREEN_HOSTED, ownerName = "FromDreamingLockscreenHostedTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -526,7 +522,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest .startedTransition( to = KeyguardState.LOCKSCREEN, from = KeyguardState.DOZING, animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -538,7 +534,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest transitionRepository.sendTransitionSteps( KeyguardState.LOCKSCREEN, KeyguardState.DOZING, testScheduler testScheduler, ) // GIVEN a prior transition has started to LOCKSCREEN transitionRepository.sendTransitionStep( Loading Loading @@ -591,7 +587,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.GONE, from = KeyguardState.DOZING, ownerName = "FromDozingTransitionInteractor(biometric wake and unlock)", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -615,7 +611,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest .startedTransition( from = KeyguardState.DOZING, to = KeyguardState.PRIMARY_BOUNCER, animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading Loading @@ -645,7 +641,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.GONE, from = KeyguardState.DREAMING, ownerName = "FromDreamingTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading Loading @@ -677,7 +673,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest .startedTransition( from = KeyguardState.DOZING, to = KeyguardState.GLANCEABLE_HUB, animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -703,7 +699,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.DOZING, from = KeyguardState.GONE, ownerName = "FromGoneTransitionInteractor(Sleep transition triggered)", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -729,7 +725,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.AOD, from = KeyguardState.GONE, ownerName = "FromGoneTransitionInteractor(Sleep transition triggered)", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -751,7 +747,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.LOCKSCREEN, from = KeyguardState.GONE, ownerName = "FromGoneTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -775,7 +771,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.OCCLUDED, ownerName = "FromGoneTransitionInteractor" + "(Dismissible keyguard with occlusion)", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -800,7 +796,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.DREAMING, from = KeyguardState.GONE, ownerName = "FromGoneTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading Loading @@ -831,7 +827,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.GLANCEABLE_HUB, from = KeyguardState.GONE, ownerName = FromGoneTransitionInteractor::class.simpleName, animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -854,7 +850,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.GLANCEABLE_HUB, from = KeyguardState.GONE, ownerName = CommunalSceneTransitionInteractor::class.simpleName, animatorAssertion = { it.isNull() } animatorAssertion = { it.isNull() }, ) coroutineContext.cancelChildren() Loading @@ -867,7 +863,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest // GIVEN a prior transition has run to ALTERNATE_BOUNCER runTransitionAndSetWakefulness( KeyguardState.LOCKSCREEN, KeyguardState.ALTERNATE_BOUNCER KeyguardState.ALTERNATE_BOUNCER, ) // WHEN the alternateBouncer stops showing and then the primary bouncer shows Loading @@ -879,7 +875,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.PRIMARY_BOUNCER, from = KeyguardState.ALTERNATE_BOUNCER, ownerName = "FromAlternateBouncerTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -892,7 +888,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest bouncerRepository.setAlternateVisible(true) runTransitionAndSetWakefulness( KeyguardState.LOCKSCREEN, KeyguardState.ALTERNATE_BOUNCER KeyguardState.ALTERNATE_BOUNCER, ) // GIVEN the primary bouncer isn't showing, aod available and starting to sleep Loading @@ -909,7 +905,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.AOD, from = KeyguardState.ALTERNATE_BOUNCER, ownerName = "FromAlternateBouncerTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -922,7 +918,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest bouncerRepository.setAlternateVisible(true) runTransitionAndSetWakefulness( KeyguardState.LOCKSCREEN, KeyguardState.ALTERNATE_BOUNCER KeyguardState.ALTERNATE_BOUNCER, ) // GIVEN the primary bouncer isn't showing, aod not available and starting to sleep Loading @@ -940,7 +936,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.DOZING, from = KeyguardState.ALTERNATE_BOUNCER, ownerName = "FromAlternateBouncerTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -953,7 +949,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest bouncerRepository.setAlternateVisible(true) runTransitionAndSetWakefulness( KeyguardState.LOCKSCREEN, KeyguardState.ALTERNATE_BOUNCER KeyguardState.ALTERNATE_BOUNCER, ) // GIVEN the primary bouncer isn't showing and device not sleeping Loading Loading @@ -982,7 +978,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest bouncerRepository.setAlternateVisible(true) runTransitionAndSetWakefulness( KeyguardState.LOCKSCREEN, KeyguardState.ALTERNATE_BOUNCER KeyguardState.ALTERNATE_BOUNCER, ) // GIVEN the keyguard is going away Loading Loading @@ -1013,7 +1009,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest bouncerRepository.setAlternateVisible(true) runTransitionAndSetWakefulness( KeyguardState.LOCKSCREEN, KeyguardState.ALTERNATE_BOUNCER KeyguardState.ALTERNATE_BOUNCER, ) // GIVEN the primary bouncer isn't showing and device not sleeping Loading Loading @@ -1131,7 +1127,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest bouncerRepository.setPrimaryShow(true) runTransitionAndSetWakefulness( KeyguardState.GLANCEABLE_HUB, KeyguardState.PRIMARY_BOUNCER KeyguardState.PRIMARY_BOUNCER, ) // WHEN the primaryBouncer stops showing Loading Loading @@ -1165,7 +1161,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest bouncerRepository.setPrimaryShow(true) runTransitionAndSetWakefulness( KeyguardState.GLANCEABLE_HUB, KeyguardState.PRIMARY_BOUNCER KeyguardState.PRIMARY_BOUNCER, ) // GIVEN that we are dreaming and occluded Loading @@ -1189,36 +1185,6 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest coroutineContext.cancelChildren() } @Test @DisableSceneContainer fun primaryBouncerToDreamingLockscreenHosted() = testScope.runTest { // GIVEN device dreaming with the lockscreen hosted dream and not dozing keyguardRepository.setIsActiveDreamLockscreenHosted(true) // GIVEN a prior transition has run to PRIMARY_BOUNCER bouncerRepository.setPrimaryShow(true) runTransitionAndSetWakefulness( KeyguardState.DREAMING_LOCKSCREEN_HOSTED, KeyguardState.PRIMARY_BOUNCER ) // WHEN the primary bouncer stops showing and lockscreen hosted dream still active bouncerRepository.setPrimaryShow(false) runCurrent() // THEN a transition back to DREAMING_LOCKSCREEN_HOSTED should occur assertThat(transitionRepository) .startedTransition( ownerName = "FromPrimaryBouncerTransitionInteractor", from = KeyguardState.PRIMARY_BOUNCER, to = KeyguardState.DREAMING_LOCKSCREEN_HOSTED, animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() } @Test @BrokenWithSceneContainer(339465026) fun occludedToGone() = Loading Loading @@ -1585,10 +1551,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest // WHEN the device starts DOZE_AOD keyguardRepository.setDozeTransitionModel( DozeTransitionModel( from = DozeStateModel.INITIALIZED, to = DozeStateModel.DOZE_AOD, ) DozeTransitionModel(from = DozeStateModel.INITIALIZED, to = DozeStateModel.DOZE_AOD) ) runCurrent() Loading Loading @@ -2268,7 +2231,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest private suspend fun TestScope.runTransitionAndSetWakefulness( from: KeyguardState, to: KeyguardState to: KeyguardState, ) { transitionRepository.sendTransitionStep( TransitionStep( Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromPrimaryBouncerTransitionInteractor.kt +27 −18 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.keyguard.domain.interactor import android.animation.ValueAnimator import android.util.Log import com.android.keyguard.KeyguardSecurityModel import com.android.systemui.Flags.communalSceneKtfRefactor import com.android.systemui.communal.domain.interactor.CommunalSceneInteractor Loading Loading @@ -76,7 +77,7 @@ constructor( override fun start() { listenForPrimaryBouncerToGone() listenForPrimaryBouncerToAsleep() listenForPrimaryBouncerToLockscreenHubOrOccluded() listenForPrimaryBouncerNotShowing() listenForPrimaryBouncerToDreamingLockscreenHosted() listenForTransitionToCamera(scope, keyguardInteractor) } Loading @@ -86,7 +87,7 @@ constructor( .transition( edge = Edge.INVALID, edgeWithoutSceneContainer = Edge.create(from = KeyguardState.PRIMARY_BOUNCER, to = KeyguardState.GONE) Edge.create(from = KeyguardState.PRIMARY_BOUNCER, to = KeyguardState.GONE), ) .map<TransitionStep, Boolean?> { it.value > TO_GONE_SURFACE_BEHIND_VISIBLE_THRESHOLD } .onStart { Loading @@ -102,7 +103,7 @@ constructor( } } private fun listenForPrimaryBouncerToLockscreenHubOrOccluded() { private fun listenForPrimaryBouncerNotShowing() { if (SceneContainerFlag.isEnabled) return if (KeyguardWmStateRefactor.isEnabled) { scope.launch { Loading @@ -110,7 +111,7 @@ constructor( .sample( powerInteractor.isAwake, keyguardInteractor.isActiveDreamLockscreenHosted, communalSceneInteractor.isIdleOnCommunal communalSceneInteractor.isIdleOnCommunal, ) .filterRelevantKeyguardStateAnd { (isBouncerShowing, _, _, _) -> // TODO(b/307976454) - See if we need to listen for SHOW_WHEN_LOCKED Loading Loading @@ -138,20 +139,17 @@ constructor( } else { scope.launch { keyguardInteractor.primaryBouncerShowing .filterRelevantKeyguardStateAnd { isBouncerShowing -> !isBouncerShowing } .sample( powerInteractor.isAwake, keyguardInteractor.isKeyguardOccluded, keyguardInteractor.isDreaming, keyguardInteractor.isActiveDreamLockscreenHosted, communalSceneInteractor.isIdleOnCommunal, ) .filterRelevantKeyguardStateAnd { (isBouncerShowing, isAwake, _, _, isActiveDreamLockscreenHosted, _) -> !isBouncerShowing && isAwake && !isActiveDreamLockscreenHosted } .collect { (_, _, occluded, isDreaming, _, isIdleOnCommunal) -> .collect { (_, isAwake, isDreaming, isIdleOnCommunal) -> val isOccluded = keyguardInteractor.isKeyguardOccluded.value val toState = if (occluded && !isDreaming) { if (isAwake) { if (isOccluded && !isDreaming) { KeyguardState.OCCLUDED } else if (isIdleOnCommunal) { KeyguardState.GLANCEABLE_HUB Loading @@ -160,6 +158,16 @@ constructor( } else { KeyguardState.LOCKSCREEN } } else { // This shouldn't necessarily happen, but there's a bug in the // bouncer logic which is incorrectly showing/hiding rapidly Log.i( TAG, "Going back to sleeping state to correct an attempt to " + "show bouncer", ) keyguardInteractor.asleepKeyguardState.value } startTransitionTo(toState) } } Loading Loading @@ -255,6 +263,7 @@ constructor( } companion object { private const val TAG = "FromPrimaryBouncerTransitionInteractor" private val DEFAULT_DURATION = 300.milliseconds val TO_AOD_DURATION = DEFAULT_DURATION val TO_DOZING_DURATION = DEFAULT_DURATION Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt +45 −82 Original line number Diff line number Diff line Loading @@ -137,9 +137,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest @JvmStatic @Parameters(name = "{0}") fun getParams(): List<FlagsParameterization> { return FlagsParameterization.allCombinationsOf( FLAG_COMMUNAL_SCENE_KTF_REFACTOR, ) return FlagsParameterization.allCombinationsOf(FLAG_COMMUNAL_SCENE_KTF_REFACTOR) .andSceneContainer() } } Loading @@ -157,9 +155,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest mSetFlagsRule.enableFlags(FLAG_COMMUNAL_HUB) kosmos.fakeFeatureFlagsClassic.set(COMMUNAL_SERVICE_ENABLED, true) if (!SceneContainerFlag.isEnabled) { mSetFlagsRule.disableFlags( Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR, ) mSetFlagsRule.disableFlags(Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR) } featureFlags = FakeFeatureFlags() Loading Loading @@ -194,7 +190,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest ownerName = "FromLockscreenTransitionInteractor" + "(#listenForLockscreenToPrimaryBouncer)", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -219,7 +215,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.DOZING, from = KeyguardState.OCCLUDED, ownerName = "FromOccludedTransitionInteractor(Sleep transition triggered)", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -244,7 +240,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.AOD, from = KeyguardState.OCCLUDED, ownerName = "FromOccludedTransitionInteractor(Sleep transition triggered)", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading Loading @@ -273,7 +269,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.DREAMING, from = KeyguardState.LOCKSCREEN, ownerName = "FromLockscreenTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading Loading @@ -303,7 +299,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.DREAMING_LOCKSCREEN_HOSTED, from = KeyguardState.LOCKSCREEN, ownerName = "FromLockscreenTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -328,7 +324,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.DOZING, from = KeyguardState.LOCKSCREEN, ownerName = "FromLockscreenTransitionInteractor(Sleep transition triggered)", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -353,7 +349,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.AOD, from = KeyguardState.LOCKSCREEN, ownerName = "FromLockscreenTransitionInteractor(Sleep transition triggered)", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -373,7 +369,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest // GIVEN a prior transition has run to DREAMING_LOCKSCREEN_HOSTED runTransitionAndSetWakefulness( KeyguardState.GONE, KeyguardState.DREAMING_LOCKSCREEN_HOSTED KeyguardState.DREAMING_LOCKSCREEN_HOSTED, ) // WHEN the lockscreen hosted dream stops Loading @@ -385,7 +381,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.LOCKSCREEN, from = KeyguardState.DREAMING_LOCKSCREEN_HOSTED, ownerName = "FromDreamingLockscreenHostedTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -398,7 +394,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest // GIVEN a prior transition has run to DREAMING_LOCKSCREEN_HOSTED runTransitionAndSetWakefulness( KeyguardState.GONE, KeyguardState.DREAMING_LOCKSCREEN_HOSTED KeyguardState.DREAMING_LOCKSCREEN_HOSTED, ) // WHEN biometrics succeeds with wake and unlock from dream mode Loading @@ -412,7 +408,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.GONE, from = KeyguardState.DREAMING_LOCKSCREEN_HOSTED, ownerName = "FromDreamingLockscreenHostedTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -429,7 +425,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest // GIVEN a prior transition has run to DREAMING_LOCKSCREEN_HOSTED runTransitionAndSetWakefulness( KeyguardState.GONE, KeyguardState.DREAMING_LOCKSCREEN_HOSTED KeyguardState.DREAMING_LOCKSCREEN_HOSTED, ) // WHEN the primary bouncer is set to show Loading @@ -441,7 +437,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.PRIMARY_BOUNCER, from = KeyguardState.DREAMING_LOCKSCREEN_HOSTED, ownerName = "FromDreamingLockscreenHostedTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -458,7 +454,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest // GIVEN a prior transition has run to DREAMING_LOCKSCREEN_HOSTED runTransitionAndSetWakefulness( KeyguardState.GONE, KeyguardState.DREAMING_LOCKSCREEN_HOSTED KeyguardState.DREAMING_LOCKSCREEN_HOSTED, ) // WHEN the device begins to sleep Loading @@ -473,7 +469,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.DOZING, from = KeyguardState.DREAMING_LOCKSCREEN_HOSTED, ownerName = "FromDreamingLockscreenHostedTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -491,7 +487,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest // GIVEN a prior transition has run to DREAMING_LOCKSCREEN_HOSTED runTransitionAndSetWakefulness( KeyguardState.GONE, KeyguardState.DREAMING_LOCKSCREEN_HOSTED KeyguardState.DREAMING_LOCKSCREEN_HOSTED, ) // WHEN the keyguard is occluded and the lockscreen hosted dream stops Loading @@ -504,7 +500,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.OCCLUDED, from = KeyguardState.DREAMING_LOCKSCREEN_HOSTED, ownerName = "FromDreamingLockscreenHostedTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -526,7 +522,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest .startedTransition( to = KeyguardState.LOCKSCREEN, from = KeyguardState.DOZING, animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -538,7 +534,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest transitionRepository.sendTransitionSteps( KeyguardState.LOCKSCREEN, KeyguardState.DOZING, testScheduler testScheduler, ) // GIVEN a prior transition has started to LOCKSCREEN transitionRepository.sendTransitionStep( Loading Loading @@ -591,7 +587,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.GONE, from = KeyguardState.DOZING, ownerName = "FromDozingTransitionInteractor(biometric wake and unlock)", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -615,7 +611,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest .startedTransition( from = KeyguardState.DOZING, to = KeyguardState.PRIMARY_BOUNCER, animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading Loading @@ -645,7 +641,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.GONE, from = KeyguardState.DREAMING, ownerName = "FromDreamingTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading Loading @@ -677,7 +673,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest .startedTransition( from = KeyguardState.DOZING, to = KeyguardState.GLANCEABLE_HUB, animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -703,7 +699,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.DOZING, from = KeyguardState.GONE, ownerName = "FromGoneTransitionInteractor(Sleep transition triggered)", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -729,7 +725,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.AOD, from = KeyguardState.GONE, ownerName = "FromGoneTransitionInteractor(Sleep transition triggered)", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -751,7 +747,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.LOCKSCREEN, from = KeyguardState.GONE, ownerName = "FromGoneTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -775,7 +771,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.OCCLUDED, ownerName = "FromGoneTransitionInteractor" + "(Dismissible keyguard with occlusion)", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -800,7 +796,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.DREAMING, from = KeyguardState.GONE, ownerName = "FromGoneTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading Loading @@ -831,7 +827,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.GLANCEABLE_HUB, from = KeyguardState.GONE, ownerName = FromGoneTransitionInteractor::class.simpleName, animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -854,7 +850,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.GLANCEABLE_HUB, from = KeyguardState.GONE, ownerName = CommunalSceneTransitionInteractor::class.simpleName, animatorAssertion = { it.isNull() } animatorAssertion = { it.isNull() }, ) coroutineContext.cancelChildren() Loading @@ -867,7 +863,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest // GIVEN a prior transition has run to ALTERNATE_BOUNCER runTransitionAndSetWakefulness( KeyguardState.LOCKSCREEN, KeyguardState.ALTERNATE_BOUNCER KeyguardState.ALTERNATE_BOUNCER, ) // WHEN the alternateBouncer stops showing and then the primary bouncer shows Loading @@ -879,7 +875,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.PRIMARY_BOUNCER, from = KeyguardState.ALTERNATE_BOUNCER, ownerName = "FromAlternateBouncerTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -892,7 +888,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest bouncerRepository.setAlternateVisible(true) runTransitionAndSetWakefulness( KeyguardState.LOCKSCREEN, KeyguardState.ALTERNATE_BOUNCER KeyguardState.ALTERNATE_BOUNCER, ) // GIVEN the primary bouncer isn't showing, aod available and starting to sleep Loading @@ -909,7 +905,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.AOD, from = KeyguardState.ALTERNATE_BOUNCER, ownerName = "FromAlternateBouncerTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -922,7 +918,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest bouncerRepository.setAlternateVisible(true) runTransitionAndSetWakefulness( KeyguardState.LOCKSCREEN, KeyguardState.ALTERNATE_BOUNCER KeyguardState.ALTERNATE_BOUNCER, ) // GIVEN the primary bouncer isn't showing, aod not available and starting to sleep Loading @@ -940,7 +936,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest to = KeyguardState.DOZING, from = KeyguardState.ALTERNATE_BOUNCER, ownerName = "FromAlternateBouncerTransitionInteractor", animatorAssertion = { it.isNotNull() } animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() Loading @@ -953,7 +949,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest bouncerRepository.setAlternateVisible(true) runTransitionAndSetWakefulness( KeyguardState.LOCKSCREEN, KeyguardState.ALTERNATE_BOUNCER KeyguardState.ALTERNATE_BOUNCER, ) // GIVEN the primary bouncer isn't showing and device not sleeping Loading Loading @@ -982,7 +978,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest bouncerRepository.setAlternateVisible(true) runTransitionAndSetWakefulness( KeyguardState.LOCKSCREEN, KeyguardState.ALTERNATE_BOUNCER KeyguardState.ALTERNATE_BOUNCER, ) // GIVEN the keyguard is going away Loading Loading @@ -1013,7 +1009,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest bouncerRepository.setAlternateVisible(true) runTransitionAndSetWakefulness( KeyguardState.LOCKSCREEN, KeyguardState.ALTERNATE_BOUNCER KeyguardState.ALTERNATE_BOUNCER, ) // GIVEN the primary bouncer isn't showing and device not sleeping Loading Loading @@ -1131,7 +1127,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest bouncerRepository.setPrimaryShow(true) runTransitionAndSetWakefulness( KeyguardState.GLANCEABLE_HUB, KeyguardState.PRIMARY_BOUNCER KeyguardState.PRIMARY_BOUNCER, ) // WHEN the primaryBouncer stops showing Loading Loading @@ -1165,7 +1161,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest bouncerRepository.setPrimaryShow(true) runTransitionAndSetWakefulness( KeyguardState.GLANCEABLE_HUB, KeyguardState.PRIMARY_BOUNCER KeyguardState.PRIMARY_BOUNCER, ) // GIVEN that we are dreaming and occluded Loading @@ -1189,36 +1185,6 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest coroutineContext.cancelChildren() } @Test @DisableSceneContainer fun primaryBouncerToDreamingLockscreenHosted() = testScope.runTest { // GIVEN device dreaming with the lockscreen hosted dream and not dozing keyguardRepository.setIsActiveDreamLockscreenHosted(true) // GIVEN a prior transition has run to PRIMARY_BOUNCER bouncerRepository.setPrimaryShow(true) runTransitionAndSetWakefulness( KeyguardState.DREAMING_LOCKSCREEN_HOSTED, KeyguardState.PRIMARY_BOUNCER ) // WHEN the primary bouncer stops showing and lockscreen hosted dream still active bouncerRepository.setPrimaryShow(false) runCurrent() // THEN a transition back to DREAMING_LOCKSCREEN_HOSTED should occur assertThat(transitionRepository) .startedTransition( ownerName = "FromPrimaryBouncerTransitionInteractor", from = KeyguardState.PRIMARY_BOUNCER, to = KeyguardState.DREAMING_LOCKSCREEN_HOSTED, animatorAssertion = { it.isNotNull() }, ) coroutineContext.cancelChildren() } @Test @BrokenWithSceneContainer(339465026) fun occludedToGone() = Loading Loading @@ -1585,10 +1551,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest // WHEN the device starts DOZE_AOD keyguardRepository.setDozeTransitionModel( DozeTransitionModel( from = DozeStateModel.INITIALIZED, to = DozeStateModel.DOZE_AOD, ) DozeTransitionModel(from = DozeStateModel.INITIALIZED, to = DozeStateModel.DOZE_AOD) ) runCurrent() Loading Loading @@ -2268,7 +2231,7 @@ class KeyguardTransitionScenariosTest(flags: FlagsParameterization?) : SysuiTest private suspend fun TestScope.runTransitionAndSetWakefulness( from: KeyguardState, to: KeyguardState to: KeyguardState, ) { transitionRepository.sendTransitionStep( TransitionStep( Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromPrimaryBouncerTransitionInteractor.kt +27 −18 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.keyguard.domain.interactor import android.animation.ValueAnimator import android.util.Log import com.android.keyguard.KeyguardSecurityModel import com.android.systemui.Flags.communalSceneKtfRefactor import com.android.systemui.communal.domain.interactor.CommunalSceneInteractor Loading Loading @@ -76,7 +77,7 @@ constructor( override fun start() { listenForPrimaryBouncerToGone() listenForPrimaryBouncerToAsleep() listenForPrimaryBouncerToLockscreenHubOrOccluded() listenForPrimaryBouncerNotShowing() listenForPrimaryBouncerToDreamingLockscreenHosted() listenForTransitionToCamera(scope, keyguardInteractor) } Loading @@ -86,7 +87,7 @@ constructor( .transition( edge = Edge.INVALID, edgeWithoutSceneContainer = Edge.create(from = KeyguardState.PRIMARY_BOUNCER, to = KeyguardState.GONE) Edge.create(from = KeyguardState.PRIMARY_BOUNCER, to = KeyguardState.GONE), ) .map<TransitionStep, Boolean?> { it.value > TO_GONE_SURFACE_BEHIND_VISIBLE_THRESHOLD } .onStart { Loading @@ -102,7 +103,7 @@ constructor( } } private fun listenForPrimaryBouncerToLockscreenHubOrOccluded() { private fun listenForPrimaryBouncerNotShowing() { if (SceneContainerFlag.isEnabled) return if (KeyguardWmStateRefactor.isEnabled) { scope.launch { Loading @@ -110,7 +111,7 @@ constructor( .sample( powerInteractor.isAwake, keyguardInteractor.isActiveDreamLockscreenHosted, communalSceneInteractor.isIdleOnCommunal communalSceneInteractor.isIdleOnCommunal, ) .filterRelevantKeyguardStateAnd { (isBouncerShowing, _, _, _) -> // TODO(b/307976454) - See if we need to listen for SHOW_WHEN_LOCKED Loading Loading @@ -138,20 +139,17 @@ constructor( } else { scope.launch { keyguardInteractor.primaryBouncerShowing .filterRelevantKeyguardStateAnd { isBouncerShowing -> !isBouncerShowing } .sample( powerInteractor.isAwake, keyguardInteractor.isKeyguardOccluded, keyguardInteractor.isDreaming, keyguardInteractor.isActiveDreamLockscreenHosted, communalSceneInteractor.isIdleOnCommunal, ) .filterRelevantKeyguardStateAnd { (isBouncerShowing, isAwake, _, _, isActiveDreamLockscreenHosted, _) -> !isBouncerShowing && isAwake && !isActiveDreamLockscreenHosted } .collect { (_, _, occluded, isDreaming, _, isIdleOnCommunal) -> .collect { (_, isAwake, isDreaming, isIdleOnCommunal) -> val isOccluded = keyguardInteractor.isKeyguardOccluded.value val toState = if (occluded && !isDreaming) { if (isAwake) { if (isOccluded && !isDreaming) { KeyguardState.OCCLUDED } else if (isIdleOnCommunal) { KeyguardState.GLANCEABLE_HUB Loading @@ -160,6 +158,16 @@ constructor( } else { KeyguardState.LOCKSCREEN } } else { // This shouldn't necessarily happen, but there's a bug in the // bouncer logic which is incorrectly showing/hiding rapidly Log.i( TAG, "Going back to sleeping state to correct an attempt to " + "show bouncer", ) keyguardInteractor.asleepKeyguardState.value } startTransitionTo(toState) } } Loading Loading @@ -255,6 +263,7 @@ constructor( } companion object { private const val TAG = "FromPrimaryBouncerTransitionInteractor" private val DEFAULT_DURATION = 300.milliseconds val TO_AOD_DURATION = DEFAULT_DURATION val TO_DOZING_DURATION = DEFAULT_DURATION Loading