Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModelTest.kt +19 −0 Original line number Diff line number Diff line Loading @@ -359,6 +359,25 @@ class KeyguardRootViewModelTest(flags: FlagsParameterization) : SysuiTestCase() assertThat(alpha).isEqualTo(0f) } @Test fun alpha_transitionBetweenHubAndDream_isZero() = testScope.runTest { val alpha by collectLastValue(underTest.alpha(viewState)) // Default value check assertThat(alpha).isEqualTo(1f) // Start transitioning between DREAM and HUB but don't finish. keyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.DREAMING, to = KeyguardState.GLANCEABLE_HUB, testScope = testScope, throughTransitionState = TransitionState.STARTED, ) assertThat(alpha).isEqualTo(0f) } @Test @EnableSceneContainer fun alpha_transitionToHub_isZero_scene_container() = Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModel.kt +30 −19 Original line number Diff line number Diff line Loading @@ -33,6 +33,8 @@ import com.android.systemui.keyguard.shared.model.BurnInModel import com.android.systemui.keyguard.shared.model.Edge import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.KeyguardState.AOD import com.android.systemui.keyguard.shared.model.KeyguardState.DREAMING import com.android.systemui.keyguard.shared.model.KeyguardState.GLANCEABLE_HUB import com.android.systemui.keyguard.shared.model.KeyguardState.GONE import com.android.systemui.keyguard.shared.model.KeyguardState.LOCKSCREEN import com.android.systemui.keyguard.shared.model.KeyguardState.OCCLUDED Loading @@ -45,6 +47,7 @@ import com.android.systemui.shade.domain.interactor.ShadeInteractor import com.android.systemui.statusbar.notification.domain.interactor.NotificationsKeyguardInteractor import com.android.systemui.statusbar.phone.DozeParameters import com.android.systemui.statusbar.phone.ScreenOffAnimationController import com.android.systemui.util.kotlin.BooleanFlowOperators.any import com.android.systemui.util.kotlin.BooleanFlowOperators.anyOf import com.android.systemui.util.kotlin.pairwise import com.android.systemui.util.kotlin.sample Loading Loading @@ -198,29 +201,37 @@ constructor( .distinctUntilChanged() /** * Keyguard should not show while the communal hub is fully visible. This check is added since * at the moment, closing the notification shade will cause the keyguard alpha to be set back to * 1. Also ensure keyguard is never visible when GONE. * Keyguard states which should fully hide the keyguard. * * Note: [GONE] is not included as it is handled separately. */ private val hiddenKeyguardStates = listOf(OCCLUDED, DREAMING, GLANCEABLE_HUB) /** * Keyguard should not show if fully transitioned into a hidden keyguard state or if * transitioning between hidden states. */ private val hideKeyguard: Flow<Boolean> = combine( communalInteractor.isIdleOnCommunal, (hiddenKeyguardStates.map { state -> keyguardTransitionInteractor .transitionValue(scene = Scenes.Gone, stateWithoutSceneContainer = GONE) .transitionValue(state) .map { it == 1f } .onStart { emit(false) }, .onStart { emit(false) } } + listOf( communalInteractor.isIdleOnCommunal, keyguardTransitionInteractor .transitionValue(OCCLUDED) .transitionValue(scene = Scenes.Gone, stateWithoutSceneContainer = GONE) .map { it == 1f } .onStart { emit(false) }, keyguardTransitionInteractor .transitionValue(KeyguardState.DREAMING) .map { it == 1f } .isInTransitionWhere( fromStatePredicate = { hiddenKeyguardStates.contains(it) }, toStatePredicate = { hiddenKeyguardStates.contains(it) }, ) .onStart { emit(false) }, ) { isIdleOnCommunal, isGone, isOccluded, isDreaming -> isIdleOnCommunal || isGone || isOccluded || isDreaming } .distinctUntilChanged() )) .any() /** Last point that the root view was tapped */ val lastRootViewTapPosition: Flow<Point?> = keyguardInteractor.lastRootViewTapPosition Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModelTest.kt +19 −0 Original line number Diff line number Diff line Loading @@ -359,6 +359,25 @@ class KeyguardRootViewModelTest(flags: FlagsParameterization) : SysuiTestCase() assertThat(alpha).isEqualTo(0f) } @Test fun alpha_transitionBetweenHubAndDream_isZero() = testScope.runTest { val alpha by collectLastValue(underTest.alpha(viewState)) // Default value check assertThat(alpha).isEqualTo(1f) // Start transitioning between DREAM and HUB but don't finish. keyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.DREAMING, to = KeyguardState.GLANCEABLE_HUB, testScope = testScope, throughTransitionState = TransitionState.STARTED, ) assertThat(alpha).isEqualTo(0f) } @Test @EnableSceneContainer fun alpha_transitionToHub_isZero_scene_container() = Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModel.kt +30 −19 Original line number Diff line number Diff line Loading @@ -33,6 +33,8 @@ import com.android.systemui.keyguard.shared.model.BurnInModel import com.android.systemui.keyguard.shared.model.Edge import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.KeyguardState.AOD import com.android.systemui.keyguard.shared.model.KeyguardState.DREAMING import com.android.systemui.keyguard.shared.model.KeyguardState.GLANCEABLE_HUB import com.android.systemui.keyguard.shared.model.KeyguardState.GONE import com.android.systemui.keyguard.shared.model.KeyguardState.LOCKSCREEN import com.android.systemui.keyguard.shared.model.KeyguardState.OCCLUDED Loading @@ -45,6 +47,7 @@ import com.android.systemui.shade.domain.interactor.ShadeInteractor import com.android.systemui.statusbar.notification.domain.interactor.NotificationsKeyguardInteractor import com.android.systemui.statusbar.phone.DozeParameters import com.android.systemui.statusbar.phone.ScreenOffAnimationController import com.android.systemui.util.kotlin.BooleanFlowOperators.any import com.android.systemui.util.kotlin.BooleanFlowOperators.anyOf import com.android.systemui.util.kotlin.pairwise import com.android.systemui.util.kotlin.sample Loading Loading @@ -198,29 +201,37 @@ constructor( .distinctUntilChanged() /** * Keyguard should not show while the communal hub is fully visible. This check is added since * at the moment, closing the notification shade will cause the keyguard alpha to be set back to * 1. Also ensure keyguard is never visible when GONE. * Keyguard states which should fully hide the keyguard. * * Note: [GONE] is not included as it is handled separately. */ private val hiddenKeyguardStates = listOf(OCCLUDED, DREAMING, GLANCEABLE_HUB) /** * Keyguard should not show if fully transitioned into a hidden keyguard state or if * transitioning between hidden states. */ private val hideKeyguard: Flow<Boolean> = combine( communalInteractor.isIdleOnCommunal, (hiddenKeyguardStates.map { state -> keyguardTransitionInteractor .transitionValue(scene = Scenes.Gone, stateWithoutSceneContainer = GONE) .transitionValue(state) .map { it == 1f } .onStart { emit(false) }, .onStart { emit(false) } } + listOf( communalInteractor.isIdleOnCommunal, keyguardTransitionInteractor .transitionValue(OCCLUDED) .transitionValue(scene = Scenes.Gone, stateWithoutSceneContainer = GONE) .map { it == 1f } .onStart { emit(false) }, keyguardTransitionInteractor .transitionValue(KeyguardState.DREAMING) .map { it == 1f } .isInTransitionWhere( fromStatePredicate = { hiddenKeyguardStates.contains(it) }, toStatePredicate = { hiddenKeyguardStates.contains(it) }, ) .onStart { emit(false) }, ) { isIdleOnCommunal, isGone, isOccluded, isDreaming -> isIdleOnCommunal || isGone || isOccluded || isDreaming } .distinctUntilChanged() )) .any() /** Last point that the root view was tapped */ val lastRootViewTapPosition: Flow<Point?> = keyguardInteractor.lastRootViewTapPosition Loading