Allow udfps when strong auth is required

Only disallow UDFPS usage if the device is
in lockdown or reboot. Otherwise, (for reasons like TIMEOUT
or SOME_AUTH_REQUIRED_AFTER_USER_REQUEST), we
allow the user to use fingerprint to authenticate; however,
the we will immediately bring up the bouncer instead of entering the
device.

Test: manual
Test: atest KeyguardUpdateMonitorTest
Fixes: 205556311
Change-Id: Ia7e56b7d9b857a76036161cbd6edd981bed3bb6c
This commit is contained in:
Beverly
2021-11-08 14:42:47 -05:00
committed by Beverly Tai
parent 5505530a4b
commit 11dddec1bf
4 changed files with 26 additions and 10 deletions

View File

@@ -38,10 +38,8 @@ data class KeyguardFingerprintListenModel(
val shouldListenForFingerprintAssistant: Boolean, val shouldListenForFingerprintAssistant: Boolean,
val switchingUser: Boolean, val switchingUser: Boolean,
val udfps: Boolean, val udfps: Boolean,
val userDoesNotHaveTrust: Boolean, val userDoesNotHaveTrust: Boolean
val userNeedsStrongAuth: Boolean
) : KeyguardListenModel() ) : KeyguardListenModel()
/** /**
* Verbose debug information associated with [KeyguardUpdateMonitor.shouldListenForFace]. * Verbose debug information associated with [KeyguardUpdateMonitor.shouldListenForFace].
*/ */

View File

@@ -2222,11 +2222,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
!(mFingerprintLockedOut && mBouncer && mCredentialAttempted); !(mFingerprintLockedOut && mBouncer && mCredentialAttempted);
final boolean isEncryptedOrLockdownForUser = isEncryptedOrLockdown(user); final boolean isEncryptedOrLockdownForUser = isEncryptedOrLockdown(user);
final boolean userNeedsStrongAuth = userNeedsStrongAuth();
final boolean shouldListenUdfpsState = !isUdfps final boolean shouldListenUdfpsState = !isUdfps
|| (!userCanSkipBouncer || (!userCanSkipBouncer
&& !isEncryptedOrLockdownForUser && !isEncryptedOrLockdownForUser
&& !userNeedsStrongAuth
&& userDoesNotHaveTrust && userDoesNotHaveTrust
&& !mFingerprintLockedOut); && !mFingerprintLockedOut);
@@ -2257,8 +2255,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
shouldListenForFingerprintAssistant, shouldListenForFingerprintAssistant,
mSwitchingUser, mSwitchingUser,
isUdfps, isUdfps,
userDoesNotHaveTrust, userDoesNotHaveTrust));
userNeedsStrongAuth));
} }
return shouldListen; return shouldListen;
@@ -2362,7 +2359,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|| (DEBUG_FINGERPRINT || (DEBUG_FINGERPRINT
&& model instanceof KeyguardFingerprintListenModel && model instanceof KeyguardFingerprintListenModel
&& mFingerprintRunningState != BIOMETRIC_STATE_RUNNING); && 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); mListenModels.add(model);
} }
} }

View File

@@ -75,8 +75,7 @@ private fun fingerprintModel(user: Int) = KeyguardFingerprintListenModel(
shouldListenForFingerprintAssistant = false, shouldListenForFingerprintAssistant = false,
switchingUser = false, switchingUser = false,
udfps = false, udfps = false,
userDoesNotHaveTrust = false, userDoesNotHaveTrust = false
userNeedsStrongAuth = false
) )
private fun faceModel(user: Int) = KeyguardFaceListenModel( private fun faceModel(user: Int) = KeyguardFaceListenModel(

View File

@@ -19,6 +19,7 @@ package com.android.keyguard;
import static android.telephony.SubscriptionManager.DATA_ROAMING_DISABLE; import static android.telephony.SubscriptionManager.DATA_ROAMING_DISABLE;
import static android.telephony.SubscriptionManager.NAME_SOURCE_CARRIER_ID; 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.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_BOOT;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
@@ -960,6 +961,19 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(true)).isEqualTo(false); 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 @Test
public void testShouldNotListenForUdfps_whenTrustEnabled() { public void testShouldNotListenForUdfps_whenTrustEnabled() {
// GIVEN a "we should listen for udfps" state // GIVEN a "we should listen for udfps" state