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

View File

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

View File

@@ -899,6 +899,25 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
anyBoolean()); 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 @Test
public void testTriesToAuthenticate_whenTrustOnAgentKeyguard_ifBypass() { public void testTriesToAuthenticate_whenTrustOnAgentKeyguard_ifBypass() {
mKeyguardUpdateMonitor.dispatchStartedWakingUp(PowerManager.WAKE_REASON_POWER_BUTTON); mKeyguardUpdateMonitor.dispatchStartedWakingUp(PowerManager.WAKE_REASON_POWER_BUTTON);