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

Commit 2b4273e9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "No face auth bouncer delay if posture unsupported" into udc-qpr-dev am: f1ca6295

parents b3610c59 f1ca6295
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -3170,6 +3170,13 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                || (posture == mConfigFaceAuthSupportedPosture);
                || (posture == mConfigFaceAuthSupportedPosture);
    }
    }


    /**
     * If the current device posture allows face auth to run.
     */
    public boolean doesCurrentPostureAllowFaceAuth() {
        return doesPostureAllowFaceAuth(mPostureState);
    }

    private void logListenerModelData(@NonNull KeyguardListenModel model) {
    private void logListenerModelData(@NonNull KeyguardListenModel model) {
        mLogger.logKeyguardListenerModel(model);
        mLogger.logKeyguardListenerModel(model);
        if (model instanceof KeyguardFingerprintListenModel) {
        if (model instanceof KeyguardFingerprintListenModel) {
+2 −1
Original line number Original line Diff line number Diff line
@@ -391,7 +391,8 @@ constructor(
    private fun usePrimaryBouncerPassiveAuthDelay(): Boolean {
    private fun usePrimaryBouncerPassiveAuthDelay(): Boolean {
        val canRunFaceAuth =
        val canRunFaceAuth =
            keyguardStateController.isFaceAuthEnabled &&
            keyguardStateController.isFaceAuthEnabled &&
                keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(BiometricSourceType.FACE)
                keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(BiometricSourceType.FACE) &&
                keyguardUpdateMonitor.doesCurrentPostureAllowFaceAuth()
        val canRunActiveUnlock =
        val canRunActiveUnlock =
            currentUserActiveUnlockRunning &&
            currentUserActiveUnlockRunning &&
                keyguardUpdateMonitor.canTriggerActiveUnlockBasedOnDeviceState()
                keyguardUpdateMonitor.canTriggerActiveUnlockBasedOnDeviceState()
+20 −0
Original line number Original line Diff line number Diff line
@@ -407,6 +407,7 @@ class PrimaryBouncerInteractorTest : SysuiTestCase() {
        whenever(keyguardStateController.isFaceAuthEnabled).thenReturn(true)
        whenever(keyguardStateController.isFaceAuthEnabled).thenReturn(true)
        whenever(keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(BiometricSourceType.FACE))
        whenever(keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(BiometricSourceType.FACE))
            .thenReturn(true)
            .thenReturn(true)
        whenever(keyguardUpdateMonitor.doesCurrentPostureAllowFaceAuth()).thenReturn(true)


        // WHEN bouncer show is requested
        // WHEN bouncer show is requested
        underTest.show(true)
        underTest.show(true)
@@ -423,6 +424,25 @@ class PrimaryBouncerInteractorTest : SysuiTestCase() {
        verify(repository).setPrimaryShowingSoon(false)
        verify(repository).setPrimaryShowingSoon(false)
    }
    }


    @Test
    fun noDelayBouncer_biometricsAllowed_postureDoesNotAllowFaceAuth() {
        mainHandler.setMode(FakeHandler.Mode.QUEUEING)

        // GIVEN bouncer should not be delayed because device isn't in the right posture for
        // face auth
        whenever(keyguardStateController.isFaceAuthEnabled).thenReturn(true)
        whenever(keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(BiometricSourceType.FACE))
            .thenReturn(true)
        whenever(keyguardUpdateMonitor.doesCurrentPostureAllowFaceAuth()).thenReturn(false)

        // WHEN bouncer show is requested
        underTest.show(true)

        // THEN primary show & primary showing soon are updated immediately
        verify(repository).setPrimaryShow(true)
        verify(repository).setPrimaryShowingSoon(false)
    }

    @Test
    @Test
    fun delayBouncerWhenActiveUnlockPossible() {
    fun delayBouncerWhenActiveUnlockPossible() {
        testScope.run {
        testScope.run {