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

Commit d00f2acc authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Allow udfps when strong auth is required" into sc-qpr1-dev

parents 63c62baf 90d73e4e
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -43,8 +43,7 @@ data class KeyguardFingerprintListenModel(
    val shouldListenForFingerprintAssistant: Boolean,
    val switchingUser: Boolean,
    val udfps: Boolean,
    val userDoesNotHaveTrust: Boolean,
    val userNeedsStrongAuth: Boolean
    val userDoesNotHaveTrust: Boolean
) : KeyguardListenModel() {
    override val modality: Int = TYPE_FACE
}
+10 −5
Original line number Diff line number Diff line
@@ -2254,11 +2254,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                !(mFingerprintLockedOut && mBouncer && mCredentialAttempted);

        final boolean isEncryptedOrLockdownForUser = isEncryptedOrLockdown(user);
        final boolean userNeedsStrongAuth = userNeedsStrongAuth();
        final boolean shouldListenUdfpsState = !isUdfps
                || (!userCanSkipBouncer
                    && !isEncryptedOrLockdownForUser
                    && !userNeedsStrongAuth
                    && userDoesNotHaveTrust
                    && !mFingerprintLockedOut);

@@ -2289,8 +2287,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                        shouldListenForFingerprintAssistant,
                        mSwitchingUser,
                        isUdfps,
                        userDoesNotHaveTrust,
                        userNeedsStrongAuth));
                        userDoesNotHaveTrust));
        }

        return shouldListen;
@@ -2394,7 +2391,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                || (DEBUG_FINGERPRINT
                    && model instanceof KeyguardFingerprintListenModel
                    && mFingerprintRunningState != BIOMETRIC_STATE_RUNNING);
        if (notYetRunning && model.getListening()) {
        final boolean running =
                (DEBUG_FACE
                        && model instanceof KeyguardFaceListenModel
                        && mFaceRunningState == BIOMETRIC_STATE_RUNNING)
                        || (DEBUG_FINGERPRINT
                        && model instanceof KeyguardFingerprintListenModel
                        && mFingerprintRunningState == BIOMETRIC_STATE_RUNNING);
        if (notYetRunning && model.getListening()
                || running && !model.getListening()) {
            mListenModels.add(model);
        }
    }
+1 −2
Original line number Diff line number Diff line
@@ -75,8 +75,7 @@ private fun fingerprintModel(user: Int) = KeyguardFingerprintListenModel(
    shouldListenForFingerprintAssistant = false,
    switchingUser = false,
    udfps = false,
    userDoesNotHaveTrust = false,
    userNeedsStrongAuth = false
    userDoesNotHaveTrust = false
)

private fun faceModel(user: Int) = KeyguardFaceListenModel(
+14 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.keyguard;
import static android.telephony.SubscriptionManager.DATA_ROAMING_DISABLE;
import static android.telephony.SubscriptionManager.NAME_SOURCE_CARRIER_ID;

import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.SOME_AUTH_REQUIRED_AFTER_USER_REQUEST;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_BOOT;

import static com.google.common.truth.Truth.assertThat;
@@ -930,6 +931,19 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
        assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(true)).isEqualTo(false);
    }

    @Test
    public void testStartUdfpsServiceStrongAuthRequiredAfterTimeout() {
        // GIVEN status bar state is on the keyguard
        mStatusBarStateListener.onStateChanged(StatusBarState.KEYGUARD);

        // WHEN user loses smart unlock trust
        when(mStrongAuthTracker.getStrongAuthForUser(KeyguardUpdateMonitor.getCurrentUser()))
                .thenReturn(SOME_AUTH_REQUIRED_AFTER_USER_REQUEST);

        // THEN we should still listen for udfps
        assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(true)).isEqualTo(true);
    }

    @Test
    public void testShouldNotListenForUdfps_whenTrustEnabled() {
        // GIVEN a "we should listen for udfps" state