Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromAlternateBouncerTransitionInteractorTest.kt +33 −0 Original line number Diff line number Diff line Loading @@ -228,6 +228,39 @@ class FromAlternateBouncerTransitionInteractorTest(flags: FlagsParameterization) Truth.assertThat(currentScene).isEqualTo(CommunalScenes.Blank) } @Test @EnableFlags(FLAG_GLANCEABLE_HUB_V2) fun transitionToDreaming() = kosmos.runTest { fakePowerRepository.updateWakefulness( WakefulnessState.AWAKE, WakeSleepReason.POWER_BUTTON, WakeSleepReason.POWER_BUTTON, false, ) fakeKeyguardRepository.setKeyguardOccluded(false) fakeKeyguardBouncerRepository.setAlternateVisible(true) runCurrent() transitionRepository.sendTransitionSteps( from = KeyguardState.LOCKSCREEN, to = KeyguardState.ALTERNATE_BOUNCER, testScope, ) reset(transitionRepository) fakeKeyguardRepository.setKeyguardOccluded(true) fakeKeyguardRepository.setDreaming(true) fakeKeyguardBouncerRepository.setAlternateVisible(false) testScope.advanceTimeBy(200) // advance past delay assertThat(transitionRepository) .startedTransition( from = KeyguardState.ALTERNATE_BOUNCER, to = KeyguardState.DREAMING, ) } @Test @DisableFlags(Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR) fun transitionToGone_whenOpeningGlanceableHubEditMode() = Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromAlternateBouncerTransitionInteractor.kt +8 −13 Original line number Diff line number Diff line Loading @@ -118,26 +118,19 @@ constructor( powerInteractor.isAwake, keyguardInteractor.isAodAvailable, communalSceneInteractor.isIdleOnCommunal, communalInteractor.editModeOpen, keyguardInteractor.isDreaming, keyguardInteractor.isKeyguardOccluded, ) .filterRelevantKeyguardStateAnd { (isAlternateBouncerShowing, isPrimaryBouncerShowing, _, _, _) -> (isAlternateBouncerShowing, isPrimaryBouncerShowing, _, _, _, _) -> !isAlternateBouncerShowing && !isPrimaryBouncerShowing } .collect { ( _, _, isAwake, isAodAvailable, isIdleOnCommunal, isCommunalEditMode, isOccluded) -> .collect { (_, _, isAwake, isAodAvailable, isIdleOnCommunal, isDreaming, isOccluded) -> // When unlocking over glanceable hub to enter edit mode, transitioning directly // to GONE prevents the lockscreen flash. Let listenForAlternateBouncerToGone // handle it. if (isCommunalEditMode) return@collect if (communalInteractor.editModeOpen.value) return@collect val hubV2 = communalSettingsInteractor.isV2FlagEnabled() val to = if (!isAwake) { Loading @@ -150,8 +143,10 @@ constructor( if (!hubV2 && isIdleOnCommunal) { if (SceneContainerFlag.isEnabled) return@collect KeyguardState.GLANCEABLE_HUB } else if (isOccluded) { } else if (isOccluded && !isDreaming) { KeyguardState.OCCLUDED } else if (hubV2 && isDreaming) { KeyguardState.DREAMING } else if (hubV2 && isIdleOnCommunal) { if (SceneContainerFlag.isEnabled) return@collect KeyguardState.GLANCEABLE_HUB Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/FromAlternateBouncerTransitionInteractorTest.kt +33 −0 Original line number Diff line number Diff line Loading @@ -228,6 +228,39 @@ class FromAlternateBouncerTransitionInteractorTest(flags: FlagsParameterization) Truth.assertThat(currentScene).isEqualTo(CommunalScenes.Blank) } @Test @EnableFlags(FLAG_GLANCEABLE_HUB_V2) fun transitionToDreaming() = kosmos.runTest { fakePowerRepository.updateWakefulness( WakefulnessState.AWAKE, WakeSleepReason.POWER_BUTTON, WakeSleepReason.POWER_BUTTON, false, ) fakeKeyguardRepository.setKeyguardOccluded(false) fakeKeyguardBouncerRepository.setAlternateVisible(true) runCurrent() transitionRepository.sendTransitionSteps( from = KeyguardState.LOCKSCREEN, to = KeyguardState.ALTERNATE_BOUNCER, testScope, ) reset(transitionRepository) fakeKeyguardRepository.setKeyguardOccluded(true) fakeKeyguardRepository.setDreaming(true) fakeKeyguardBouncerRepository.setAlternateVisible(false) testScope.advanceTimeBy(200) // advance past delay assertThat(transitionRepository) .startedTransition( from = KeyguardState.ALTERNATE_BOUNCER, to = KeyguardState.DREAMING, ) } @Test @DisableFlags(Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR) fun transitionToGone_whenOpeningGlanceableHubEditMode() = Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromAlternateBouncerTransitionInteractor.kt +8 −13 Original line number Diff line number Diff line Loading @@ -118,26 +118,19 @@ constructor( powerInteractor.isAwake, keyguardInteractor.isAodAvailable, communalSceneInteractor.isIdleOnCommunal, communalInteractor.editModeOpen, keyguardInteractor.isDreaming, keyguardInteractor.isKeyguardOccluded, ) .filterRelevantKeyguardStateAnd { (isAlternateBouncerShowing, isPrimaryBouncerShowing, _, _, _) -> (isAlternateBouncerShowing, isPrimaryBouncerShowing, _, _, _, _) -> !isAlternateBouncerShowing && !isPrimaryBouncerShowing } .collect { ( _, _, isAwake, isAodAvailable, isIdleOnCommunal, isCommunalEditMode, isOccluded) -> .collect { (_, _, isAwake, isAodAvailable, isIdleOnCommunal, isDreaming, isOccluded) -> // When unlocking over glanceable hub to enter edit mode, transitioning directly // to GONE prevents the lockscreen flash. Let listenForAlternateBouncerToGone // handle it. if (isCommunalEditMode) return@collect if (communalInteractor.editModeOpen.value) return@collect val hubV2 = communalSettingsInteractor.isV2FlagEnabled() val to = if (!isAwake) { Loading @@ -150,8 +143,10 @@ constructor( if (!hubV2 && isIdleOnCommunal) { if (SceneContainerFlag.isEnabled) return@collect KeyguardState.GLANCEABLE_HUB } else if (isOccluded) { } else if (isOccluded && !isDreaming) { KeyguardState.OCCLUDED } else if (hubV2 && isDreaming) { KeyguardState.DREAMING } else if (hubV2 && isIdleOnCommunal) { if (SceneContainerFlag.isEnabled) return@collect KeyguardState.GLANCEABLE_HUB Loading