summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeverly <beverlyt@google.com>2021-11-08 14:42:47 -0500
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-12-26 15:02:41 +0000
commit90fbe59520050d19341b3b5207a40ccd1c1c8f9d (patch)
treec2e9653951d6e39e3025a42bdfab0555d6530102
parente3046d5139e495037a0155a794a44e3d9fa92f22 (diff)
downloadbase-90fbe59520050d19341b3b5207a40ccd1c1c8f9d.tar.gz
Allow udfps when strong auth is required
Only disallow UDFPS usage if the device is in lockdown or reboot. Otherwise, (for reasons like TIMEOUT), we allow the user to use fingerprint to authenticate. Test: manual Test: atest KeyguardUpdateMonitorTest Fixes: 205556311 Change-Id: Ia7e56b7d9b857a76036161cbd6edd981bed3bb6c Merged-In: Ia7e56b7d9b857a76036161cbd6edd981bed3bb6c (cherry picked from commit 83dd25e77cc3e898b68077b25dd597cba51c6bfd) (cherry picked from commit 90d73e4e93807e52e39d85306da0d28c6aef0a34) Merged-In:Ia7e56b7d9b857a76036161cbd6edd981bed3bb6c
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardListenModel.kt3
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java15
-rw-r--r--packages/SystemUI/tests/src/com/android/keyguard/KeyguardListenQueueTest.kt3
-rw-r--r--packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java14
4 files changed, 26 insertions, 9 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardListenModel.kt b/packages/SystemUI/src/com/android/keyguard/KeyguardListenModel.kt
index 9286175cc2ea..471bac16642b 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardListenModel.kt
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardListenModel.kt
@@ -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
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 877e76480b1e..7a518d2b2bfe 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -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);
}
}
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardListenQueueTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardListenQueueTest.kt
index db87c5df16e1..4bdab7658a06 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardListenQueueTest.kt
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardListenQueueTest.kt
@@ -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(
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
index ec4dfba87af0..185a291f57ad 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java
@@ -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;
@@ -931,6 +932,19 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
}
@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
mStatusBarStateListener.onStateChanged(StatusBarState.KEYGUARD);