Merge "Always listen for FP on alternateBouncer showing" into tm-qpr-dev

This commit is contained in:
Beverly Tai
2023-02-15 16:28:18 +00:00
committed by Android (Google) Code Review
3 changed files with 26 additions and 1 deletions

View File

@@ -27,6 +27,7 @@ data class KeyguardFingerprintListenModel(
override var userId: Int = 0,
override var listening: Boolean = false,
// keepSorted
var alternateBouncerShowing: Boolean = false,
var biometricEnabledForUser: Boolean = false,
var bouncerIsOrWillShow: Boolean = false,
var canSkipBouncer: Boolean = false,
@@ -57,6 +58,7 @@ data class KeyguardFingerprintListenModel(
userId.toString(),
listening.toString(),
// keep sorted
alternateBouncerShowing.toString(),
biometricEnabledForUser.toString(),
bouncerIsOrWillShow.toString(),
canSkipBouncer.toString(),
@@ -96,6 +98,7 @@ data class KeyguardFingerprintListenModel(
userId = model.userId
listening = model.listening
// keep sorted
alternateBouncerShowing = model.alternateBouncerShowing
biometricEnabledForUser = model.biometricEnabledForUser
bouncerIsOrWillShow = model.bouncerIsOrWillShow
canSkipBouncer = model.canSkipBouncer
@@ -141,6 +144,7 @@ data class KeyguardFingerprintListenModel(
"userId",
"listening",
// keep sorted
"alternateBouncerShowing",
"biometricAllowedForUser",
"bouncerIsOrWillShow",
"canSkipBouncer",

View File

@@ -2632,6 +2632,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
ActiveUnlockConfig.ActiveUnlockRequestOrigin.UNLOCK_INTENT,
"alternateBouncer");
}
updateFingerprintListeningState(BIOMETRIC_ACTION_UPDATE);
}
private boolean shouldTriggerActiveUnlock() {
@@ -2716,7 +2717,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|| shouldListenForFingerprintAssistant
|| (mKeyguardOccluded && mIsDreaming)
|| (mKeyguardOccluded && userDoesNotHaveTrust
&& (mOccludingAppRequestingFp || isUdfps));
&& (mOccludingAppRequestingFp || isUdfps || mAlternateBouncerShowing));
// Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an
// instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
@@ -2757,6 +2758,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
System.currentTimeMillis(),
user,
shouldListen,
mAlternateBouncerShowing,
biometricEnabledForUser,
mPrimaryBouncerIsOrWillBeShowing,
userCanSkipBouncer,

View File

@@ -899,6 +899,25 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
anyBoolean());
}
@Test
public void noFpListeningWhenKeyguardIsOccluded_unlessAlternateBouncerShowing() {
// GIVEN device is awake but occluded
mKeyguardUpdateMonitor.dispatchStartedWakingUp(PowerManager.WAKE_REASON_POWER_BUTTON);
mKeyguardUpdateMonitor.setKeyguardShowing(false, true);
// THEN fingerprint shouldn't listen
assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(false)).isFalse();
verify(mFingerprintManager, never()).authenticate(any(), any(), any(), any(), anyInt(),
anyInt(), anyInt());
// WHEN alternate bouncer is shown
mKeyguardUpdateMonitor.setAlternateBouncerShowing(true);
// THEN make sure FP listening begins
verify(mFingerprintManager).authenticate(any(), any(), any(), any(), anyInt(), anyInt(),
anyInt());
}
@Test
public void testTriesToAuthenticate_whenTrustOnAgentKeyguard_ifBypass() {
mKeyguardUpdateMonitor.dispatchStartedWakingUp(PowerManager.WAKE_REASON_POWER_BUTTON);