Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 10bf2e16 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes Ie8d984e3,I17eed506 into main

* changes:
  Prevent running face detection when shade is expanded
  Change face auth trigger to LockScreen -> Shade transition
parents 1652915e 6474964c
Loading
Loading
Loading
Loading
+52 −16
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ import java.io.PrintWriter
import java.io.StringWriter
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.advanceTimeBy
import kotlinx.coroutines.test.runCurrent
@@ -561,14 +562,29 @@ class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() {
    fun withSceneContainerEnabled_authenticateDoesNotRunWhenKeyguardIsGoingAway() =
        testScope.runTest {
            testGatingCheckForFaceAuth(sceneContainerEnabled = true) {
                keyguardTransitionRepository.sendTransitionStep(
                    TransitionStep(
                        KeyguardState.LOCKSCREEN,
                        KeyguardState.UNDEFINED,
                        value = 0.5f,
                        transitionState = TransitionState.RUNNING
                    ),
                    validateStep = false
                kosmos.sceneInteractor.setTransitionState(
                    MutableStateFlow(
                        ObservableTransitionState.Transition(
                            fromScene = Scenes.Bouncer,
                            toScene = Scenes.Gone,
                            currentScene = flowOf(Scenes.Bouncer),
                            progress = MutableStateFlow(0.2f),
                            isInitiatedByUserInput = true,
                            isUserInputOngoing = flowOf(false),
                        )
                    )
                )
                runCurrent()
            }
        }

    @Test
    @EnableSceneContainer
    fun withSceneContainerEnabled_authenticateDoesNotRunWhenLockscreenIsGone() =
        testScope.runTest {
            testGatingCheckForFaceAuth(sceneContainerEnabled = true) {
                kosmos.sceneInteractor.setTransitionState(
                    MutableStateFlow(ObservableTransitionState.Idle(Scenes.Gone))
                )
                runCurrent()
            }
@@ -898,15 +914,32 @@ class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() {
    fun withSceneContainer_faceDetectDoesNotRunWhenKeyguardGoingAway() =
        testScope.runTest {
            testGatingCheckForDetect(sceneContainerEnabled = true) {
                keyguardTransitionRepository.sendTransitionStep(
                    TransitionStep(
                        KeyguardState.LOCKSCREEN,
                        KeyguardState.UNDEFINED,
                        value = 0.5f,
                        transitionState = TransitionState.RUNNING
                    ),
                    validateStep = false
                kosmos.sceneInteractor.setTransitionState(
                    MutableStateFlow(
                        ObservableTransitionState.Transition(
                            fromScene = Scenes.Bouncer,
                            toScene = Scenes.Gone,
                            currentScene = flowOf(Scenes.Bouncer),
                            progress = MutableStateFlow(0.2f),
                            isInitiatedByUserInput = true,
                            isUserInputOngoing = flowOf(false),
                        )
                    )
                )

                runCurrent()
            }
        }

    @Test
    @EnableSceneContainer
    fun withSceneContainer_faceDetectDoesNotRunWhenLockscreenIsGone() =
        testScope.runTest {
            testGatingCheckForDetect(sceneContainerEnabled = true) {
                kosmos.sceneInteractor.setTransitionState(
                    MutableStateFlow(ObservableTransitionState.Idle(Scenes.Gone))
                )

                runCurrent()
            }
        }
@@ -1231,6 +1264,9 @@ class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() {
                TransitionStep(KeyguardState.OFF, KeyguardState.LOCKSCREEN, value = 1.0f),
                validateStep = false
            )
            kosmos.sceneInteractor.setTransitionState(
                MutableStateFlow(ObservableTransitionState.Idle(Scenes.Lockscreen))
            )
        } else {
            keyguardRepository.setKeyguardGoingAway(false)
        }
+4 −2
Original line number Diff line number Diff line
@@ -391,8 +391,10 @@ constructor(
            ),
            Pair(
                if (SceneContainerFlag.isEnabled) {
                    keyguardTransitionInteractor
                        .isInTransitionWhere(toStatePredicate = { it == KeyguardState.UNDEFINED })
                    sceneInteractor
                        .get()
                        .transitionState
                        .map { it.isTransitioning(to = Scenes.Gone) || it.isIdle(Scenes.Gone) }
                        .isFalse()
                } else {
                    keyguardRepository.isKeyguardGoingAway.isFalse()
+1 −1
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ interface DeviceEntryFaceAuthInteractor : CoreStartable {

    fun onDeviceLifted()

    fun onQsExpansionStarted()
    fun onShadeExpansionStarted()

    fun onNotificationPanelClicked()

+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ class NoopDeviceEntryFaceAuthInteractor @Inject constructor() : DeviceEntryFaceA

    override fun onDeviceLifted() {}

    override fun onQsExpansionStarted() {}
    override fun onShadeExpansionStarted() {}

    override fun onNotificationPanelClicked() {}

+4 −4
Original line number Diff line number Diff line
@@ -220,9 +220,9 @@ constructor(
            sceneInteractor
                .get()
                .transitionState
                .filter { it.isTransitioning(from = Scenes.QuickSettings, to = Scenes.Shade) }
                .filter { it.isTransitioning(from = Scenes.Lockscreen, to = Scenes.Shade) }
                .distinctUntilChanged()
                .onEach { onQsExpansionStarted() }
                .onEach { onShadeExpansionStarted() }
                .launchIn(applicationScope)
        }
    }
@@ -250,8 +250,8 @@ constructor(
        runFaceAuth(FaceAuthUiEvent.FACE_AUTH_TRIGGERED_NOTIFICATION_PANEL_CLICKED, true)
    }

    override fun onQsExpansionStarted() {
        runFaceAuth(FaceAuthUiEvent.FACE_AUTH_TRIGGERED_QS_EXPANDED, true)
    override fun onShadeExpansionStarted() {
        runFaceAuth(FaceAuthUiEvent.FACE_AUTH_TRIGGERED_QS_EXPANDED, false)
    }

    override fun onDeviceLifted() {
Loading