Merge "Use alternateBouncerShowing instead of mOccludingAppRequestingFace to trigger face auth while secure camera is launched." into tm-qpr-dev

This commit is contained in:
Chandru S
2023-02-09 18:07:02 +00:00
committed by Android (Google) Code Review
4 changed files with 30 additions and 26 deletions

View File

@@ -27,6 +27,7 @@ data class KeyguardFaceListenModel(
override var userId: Int = 0, override var userId: Int = 0,
override var listening: Boolean = false, override var listening: Boolean = false,
// keep sorted // keep sorted
var alternateBouncerShowing: Boolean = false,
var authInterruptActive: Boolean = false, var authInterruptActive: Boolean = false,
var biometricSettingEnabledForUser: Boolean = false, var biometricSettingEnabledForUser: Boolean = false,
var bouncerFullyShown: Boolean = false, var bouncerFullyShown: Boolean = false,
@@ -44,7 +45,6 @@ data class KeyguardFaceListenModel(
var secureCameraLaunched: Boolean = false, var secureCameraLaunched: Boolean = false,
var supportsDetect: Boolean = false, var supportsDetect: Boolean = false,
var switchingUser: Boolean = false, var switchingUser: Boolean = false,
var udfpsBouncerShowing: Boolean = false,
var udfpsFingerDown: Boolean = false, var udfpsFingerDown: Boolean = false,
var userNotTrustedOrDetectionIsNeeded: Boolean = false, var userNotTrustedOrDetectionIsNeeded: Boolean = false,
) : KeyguardListenModel() { ) : KeyguardListenModel() {
@@ -73,7 +73,7 @@ data class KeyguardFaceListenModel(
secureCameraLaunched.toString(), secureCameraLaunched.toString(),
supportsDetect.toString(), supportsDetect.toString(),
switchingUser.toString(), switchingUser.toString(),
udfpsBouncerShowing.toString(), alternateBouncerShowing.toString(),
udfpsFingerDown.toString(), udfpsFingerDown.toString(),
userNotTrustedOrDetectionIsNeeded.toString(), userNotTrustedOrDetectionIsNeeded.toString(),
) )
@@ -95,6 +95,7 @@ data class KeyguardFaceListenModel(
userId = model.userId userId = model.userId
listening = model.listening listening = model.listening
// keep sorted // keep sorted
alternateBouncerShowing = model.alternateBouncerShowing
biometricSettingEnabledForUser = model.biometricSettingEnabledForUser biometricSettingEnabledForUser = model.biometricSettingEnabledForUser
bouncerFullyShown = model.bouncerFullyShown bouncerFullyShown = model.bouncerFullyShown
faceAndFpNotAuthenticated = model.faceAndFpNotAuthenticated faceAndFpNotAuthenticated = model.faceAndFpNotAuthenticated
@@ -111,7 +112,6 @@ data class KeyguardFaceListenModel(
secureCameraLaunched = model.secureCameraLaunched secureCameraLaunched = model.secureCameraLaunched
supportsDetect = model.supportsDetect supportsDetect = model.supportsDetect
switchingUser = model.switchingUser switchingUser = model.switchingUser
udfpsBouncerShowing = model.udfpsBouncerShowing
switchingUser = model.switchingUser switchingUser = model.switchingUser
udfpsFingerDown = model.udfpsFingerDown udfpsFingerDown = model.udfpsFingerDown
userNotTrustedOrDetectionIsNeeded = model.userNotTrustedOrDetectionIsNeeded userNotTrustedOrDetectionIsNeeded = model.userNotTrustedOrDetectionIsNeeded

View File

@@ -311,7 +311,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
private boolean mGoingToSleep; private boolean mGoingToSleep;
private boolean mPrimaryBouncerFullyShown; private boolean mPrimaryBouncerFullyShown;
private boolean mPrimaryBouncerIsOrWillBeShowing; private boolean mPrimaryBouncerIsOrWillBeShowing;
private boolean mUdfpsBouncerShowing; private boolean mAlternateBouncerShowing;
private boolean mAuthInterruptActive; private boolean mAuthInterruptActive;
private boolean mNeedsSlowUnlockTransition; private boolean mNeedsSlowUnlockTransition;
private boolean mAssistantVisible; private boolean mAssistantVisible;
@@ -536,7 +536,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
* It's assumed that the trust was granted for the current user. * It's assumed that the trust was granted for the current user.
*/ */
private boolean shouldDismissKeyguardOnTrustGrantedWithCurrentUser(TrustGrantFlags flags) { private boolean shouldDismissKeyguardOnTrustGrantedWithCurrentUser(TrustGrantFlags flags) {
final boolean isBouncerShowing = mPrimaryBouncerIsOrWillBeShowing || mUdfpsBouncerShowing; final boolean isBouncerShowing =
mPrimaryBouncerIsOrWillBeShowing || mAlternateBouncerShowing;
return (flags.isInitiatedByUser() || flags.dismissKeyguardRequested()) return (flags.isInitiatedByUser() || flags.dismissKeyguardRequested())
&& (mDeviceInteractive || flags.temporaryAndRenewable()) && (mDeviceInteractive || flags.temporaryAndRenewable())
&& (isBouncerShowing || flags.dismissKeyguardRequested()); && (isBouncerShowing || flags.dismissKeyguardRequested());
@@ -1742,7 +1743,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
public void onAuthenticationFailed() { public void onAuthenticationFailed() {
String reason = String reason =
mKeyguardBypassController.canBypass() ? "bypass" mKeyguardBypassController.canBypass() ? "bypass"
: mUdfpsBouncerShowing ? "udfpsBouncer" : mAlternateBouncerShowing ? "alternateBouncer"
: mPrimaryBouncerFullyShown ? "bouncer" : mPrimaryBouncerFullyShown ? "bouncer"
: "udfpsFpDown"; : "udfpsFpDown";
requestActiveUnlock( requestActiveUnlock(
@@ -2601,7 +2602,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
requestActiveUnlock( requestActiveUnlock(
requestOrigin, requestOrigin,
extraReason, canFaceBypass extraReason, canFaceBypass
|| mUdfpsBouncerShowing || mAlternateBouncerShowing
|| mPrimaryBouncerFullyShown || mPrimaryBouncerFullyShown
|| mAuthController.isUdfpsFingerDown()); || mAuthController.isUdfpsFingerDown());
} }
@@ -2619,23 +2620,23 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
} }
/** /**
* Whether the UDFPS bouncer is showing. * Whether the alternate bouncer is showing.
*/ */
public void setUdfpsBouncerShowing(boolean showing) { public void setAlternateBouncerShowing(boolean showing) {
mUdfpsBouncerShowing = showing; mAlternateBouncerShowing = showing;
if (mUdfpsBouncerShowing) { if (mAlternateBouncerShowing) {
updateFaceListeningState(BIOMETRIC_ACTION_START, updateFaceListeningState(BIOMETRIC_ACTION_START,
FACE_AUTH_TRIGGERED_ALTERNATE_BIOMETRIC_BOUNCER_SHOWN); FACE_AUTH_TRIGGERED_ALTERNATE_BIOMETRIC_BOUNCER_SHOWN);
requestActiveUnlock( requestActiveUnlock(
ActiveUnlockConfig.ActiveUnlockRequestOrigin.UNLOCK_INTENT, ActiveUnlockConfig.ActiveUnlockRequestOrigin.UNLOCK_INTENT,
"udfpsBouncer"); "alternateBouncer");
} }
} }
private boolean shouldTriggerActiveUnlock() { private boolean shouldTriggerActiveUnlock() {
// Triggers: // Triggers:
final boolean triggerActiveUnlockForAssistant = shouldTriggerActiveUnlockForAssistant(); final boolean triggerActiveUnlockForAssistant = shouldTriggerActiveUnlockForAssistant();
final boolean awakeKeyguard = mPrimaryBouncerFullyShown || mUdfpsBouncerShowing final boolean awakeKeyguard = mPrimaryBouncerFullyShown || mAlternateBouncerShowing
|| (isKeyguardVisible() && !mGoingToSleep || (isKeyguardVisible() && !mGoingToSleep
&& mStatusBarState != StatusBarState.SHADE_LOCKED); && mStatusBarState != StatusBarState.SHADE_LOCKED);
@@ -2819,7 +2820,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
final boolean isPostureAllowedForFaceAuth = final boolean isPostureAllowedForFaceAuth =
mConfigFaceAuthSupportedPosture == 0 /* DEVICE_POSTURE_UNKNOWN */ ? true mConfigFaceAuthSupportedPosture == 0 /* DEVICE_POSTURE_UNKNOWN */ ? true
: (mPostureState == mConfigFaceAuthSupportedPosture); : (mPostureState == mConfigFaceAuthSupportedPosture);
// 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.
final boolean shouldListen = final boolean shouldListen =
@@ -2829,11 +2829,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|| awakeKeyguard || awakeKeyguard
|| shouldListenForFaceAssistant || shouldListenForFaceAssistant
|| isUdfpsFingerDown || isUdfpsFingerDown
|| mUdfpsBouncerShowing) || mAlternateBouncerShowing)
&& !mSwitchingUser && !faceDisabledForUser && userNotTrustedOrDetectionIsNeeded && !mSwitchingUser && !faceDisabledForUser && userNotTrustedOrDetectionIsNeeded
&& !mKeyguardGoingAway && biometricEnabledForUser && !mKeyguardGoingAway && biometricEnabledForUser
&& faceAuthAllowedOrDetectionIsNeeded && mIsPrimaryUser && faceAuthAllowedOrDetectionIsNeeded && mIsPrimaryUser
&& (!mSecureCameraLaunched || mOccludingAppRequestingFace) && (!mSecureCameraLaunched || mAlternateBouncerShowing)
&& faceAndFpNotAuthenticated && faceAndFpNotAuthenticated
&& !mGoingToSleep && !mGoingToSleep
&& isPostureAllowedForFaceAuth; && isPostureAllowedForFaceAuth;
@@ -2844,6 +2844,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
System.currentTimeMillis(), System.currentTimeMillis(),
user, user,
shouldListen, shouldListen,
mAlternateBouncerShowing,
mAuthInterruptActive, mAuthInterruptActive,
biometricEnabledForUser, biometricEnabledForUser,
mPrimaryBouncerFullyShown, mPrimaryBouncerFullyShown,
@@ -2861,7 +2862,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
mSecureCameraLaunched, mSecureCameraLaunched,
supportsDetect, supportsDetect,
mSwitchingUser, mSwitchingUser,
mUdfpsBouncerShowing,
isUdfpsFingerDown, isUdfpsFingerDown,
userNotTrustedOrDetectionIsNeeded)); userNotTrustedOrDetectionIsNeeded));
@@ -3972,7 +3972,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
pw.println(" mPrimaryBouncerIsOrWillBeShowing=" pw.println(" mPrimaryBouncerIsOrWillBeShowing="
+ mPrimaryBouncerIsOrWillBeShowing); + mPrimaryBouncerIsOrWillBeShowing);
pw.println(" mStatusBarState=" + StatusBarState.toString(mStatusBarState)); pw.println(" mStatusBarState=" + StatusBarState.toString(mStatusBarState));
pw.println(" mUdfpsBouncerShowing=" + mUdfpsBouncerShowing); pw.println(" mAlternateBouncerShowing=" + mAlternateBouncerShowing);
} else if (isSfpsSupported()) { } else if (isSfpsSupported()) {
pw.println(" sfpsEnrolled=" + isSfpsEnrolled()); pw.println(" sfpsEnrolled=" + isSfpsEnrolled());
pw.println(" shouldListenForSfps=" + shouldListenForFingerprint(false)); pw.println(" shouldListenForSfps=" + shouldListenForFingerprint(false));

View File

@@ -753,7 +753,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mKeyguardMessageAreaController.setMessage(""); mKeyguardMessageAreaController.setMessage("");
} }
mBypassController.setAltBouncerShowing(isShowingAlternateBouncer); mBypassController.setAltBouncerShowing(isShowingAlternateBouncer);
mKeyguardUpdateManager.setUdfpsBouncerShowing(isShowingAlternateBouncer); mKeyguardUpdateManager.setAlternateBouncerShowing(isShowingAlternateBouncer);
if (updateScrim) { if (updateScrim) {
mCentralSurfaces.updateScrimController(); mCentralSurfaces.updateScrimController();

View File

@@ -1767,7 +1767,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
} }
@Test @Test
public void testShouldListenForFace_whenOccludingAppRequestsFaceAuth_returnsTrue() public void shouldListenForFace_secureCameraLaunchedButAlternateBouncerIsLaunched_returnsTrue()
throws RemoteException { throws RemoteException {
// Face auth should run when the following is true. // Face auth should run when the following is true.
keyguardNotGoingAway(); keyguardNotGoingAway();
@@ -1783,7 +1783,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isFalse(); assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isFalse();
occludingAppRequestsFaceAuth(); alternateBouncerVisible();
mTestableLooper.processAllMessages(); mTestableLooper.processAllMessages();
assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isTrue(); assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isTrue();
@@ -1873,7 +1873,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
} }
@Test @Test
public void testShouldListenForFace_whenUdfpsBouncerIsShowing_returnsTrue() public void testShouldListenForFace_whenAlternateBouncerIsShowing_returnsTrue()
throws RemoteException { throws RemoteException {
// Preconditions for face auth to run // Preconditions for face auth to run
keyguardNotGoingAway(); keyguardNotGoingAway();
@@ -1885,13 +1885,13 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
mTestableLooper.processAllMessages(); mTestableLooper.processAllMessages();
assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isFalse(); assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isFalse();
mKeyguardUpdateMonitor.setUdfpsBouncerShowing(true); mKeyguardUpdateMonitor.setAlternateBouncerShowing(true);
assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isTrue(); assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isTrue();
} }
@Test @Test
public void testShouldListenForFace_udfpsBouncerIsShowingButDeviceGoingToSleep_returnsFalse() public void testShouldListenForFace_alternateBouncerShowingButDeviceGoingToSleep_returnsFalse()
throws RemoteException { throws RemoteException {
// Preconditions for face auth to run // Preconditions for face auth to run
keyguardNotGoingAway(); keyguardNotGoingAway();
@@ -1901,7 +1901,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
biometricsEnabledForCurrentUser(); biometricsEnabledForCurrentUser();
userNotCurrentlySwitching(); userNotCurrentlySwitching();
deviceNotGoingToSleep(); deviceNotGoingToSleep();
mKeyguardUpdateMonitor.setUdfpsBouncerShowing(true); alternateBouncerVisible();
mTestableLooper.processAllMessages(); mTestableLooper.processAllMessages();
assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isTrue(); assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isTrue();
@@ -1911,6 +1911,10 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isFalse(); assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isFalse();
} }
private void alternateBouncerVisible() {
mKeyguardUpdateMonitor.setAlternateBouncerShowing(true);
}
@Test @Test
public void testShouldListenForFace_whenFaceIsLockedOut_returnsTrue() public void testShouldListenForFace_whenFaceIsLockedOut_returnsTrue()
throws RemoteException { throws RemoteException {
@@ -1921,7 +1925,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
biometricsNotDisabledThroughDevicePolicyManager(); biometricsNotDisabledThroughDevicePolicyManager();
biometricsEnabledForCurrentUser(); biometricsEnabledForCurrentUser();
userNotCurrentlySwitching(); userNotCurrentlySwitching();
mKeyguardUpdateMonitor.setUdfpsBouncerShowing(true); mKeyguardUpdateMonitor.setAlternateBouncerShowing(true);
mTestableLooper.processAllMessages(); mTestableLooper.processAllMessages();
assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isTrue(); assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isTrue();