Use alternateBouncerShowing instead of mOccludingAppRequestingFace to trigger face auth while secure camera is launched.

- mOccludingAppRequestingFace is set to true by `UdfpsKeyguardViewController#showUdfpsBouncer`
 - This doesn't happen for devices with non-UDFPS fingerpint sensors.
 - Using alternateBouncerShowing would work better here.

Other changes:
 - Renames udfpsBouncerShowing to alternateBouncerShowing

Fixes: 267132953
Test: atest KeyguardUpdateMonitorTest
Test: manually,
  1. Enroll fingerprint (non-udfps) & face
  2. Suspend phone and go to Aod/Lockscreen
  3. Double press power button to open camera over lockscreen
  4. Open the gallery from the camera app.
  5. Alternate FPS bouncer should be shown and face auth should also run
Change-Id: I05d4256169a6fe491ed3c3be1cd6690341ad931f
This commit is contained in:
Chandru S
2023-02-07 15:26:15 -08:00
parent da5de14a55
commit a9443a091b
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 listening: Boolean = false,
// keep sorted
var alternateBouncerShowing: Boolean = false,
var authInterruptActive: Boolean = false,
var biometricSettingEnabledForUser: Boolean = false,
var bouncerFullyShown: Boolean = false,
@@ -44,7 +45,6 @@ data class KeyguardFaceListenModel(
var secureCameraLaunched: Boolean = false,
var supportsDetect: Boolean = false,
var switchingUser: Boolean = false,
var udfpsBouncerShowing: Boolean = false,
var udfpsFingerDown: Boolean = false,
var userNotTrustedOrDetectionIsNeeded: Boolean = false,
) : KeyguardListenModel() {
@@ -73,7 +73,7 @@ data class KeyguardFaceListenModel(
secureCameraLaunched.toString(),
supportsDetect.toString(),
switchingUser.toString(),
udfpsBouncerShowing.toString(),
alternateBouncerShowing.toString(),
udfpsFingerDown.toString(),
userNotTrustedOrDetectionIsNeeded.toString(),
)
@@ -95,6 +95,7 @@ data class KeyguardFaceListenModel(
userId = model.userId
listening = model.listening
// keep sorted
alternateBouncerShowing = model.alternateBouncerShowing
biometricSettingEnabledForUser = model.biometricSettingEnabledForUser
bouncerFullyShown = model.bouncerFullyShown
faceAndFpNotAuthenticated = model.faceAndFpNotAuthenticated
@@ -111,7 +112,6 @@ data class KeyguardFaceListenModel(
secureCameraLaunched = model.secureCameraLaunched
supportsDetect = model.supportsDetect
switchingUser = model.switchingUser
udfpsBouncerShowing = model.udfpsBouncerShowing
switchingUser = model.switchingUser
udfpsFingerDown = model.udfpsFingerDown
userNotTrustedOrDetectionIsNeeded = model.userNotTrustedOrDetectionIsNeeded

View File

@@ -310,7 +310,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
private boolean mGoingToSleep;
private boolean mPrimaryBouncerFullyShown;
private boolean mPrimaryBouncerIsOrWillBeShowing;
private boolean mUdfpsBouncerShowing;
private boolean mAlternateBouncerShowing;
private boolean mAuthInterruptActive;
private boolean mNeedsSlowUnlockTransition;
private boolean mAssistantVisible;
@@ -535,7 +535,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
* It's assumed that the trust was granted for the current user.
*/
private boolean shouldDismissKeyguardOnTrustGrantedWithCurrentUser(TrustGrantFlags flags) {
final boolean isBouncerShowing = mPrimaryBouncerIsOrWillBeShowing || mUdfpsBouncerShowing;
final boolean isBouncerShowing =
mPrimaryBouncerIsOrWillBeShowing || mAlternateBouncerShowing;
return (flags.isInitiatedByUser() || flags.dismissKeyguardRequested())
&& (mDeviceInteractive || flags.temporaryAndRenewable())
&& (isBouncerShowing || flags.dismissKeyguardRequested());
@@ -1741,7 +1742,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
public void onAuthenticationFailed() {
String reason =
mKeyguardBypassController.canBypass() ? "bypass"
: mUdfpsBouncerShowing ? "udfpsBouncer"
: mAlternateBouncerShowing ? "alternateBouncer"
: mPrimaryBouncerFullyShown ? "bouncer"
: "udfpsFpDown";
requestActiveUnlock(
@@ -2600,7 +2601,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
requestActiveUnlock(
requestOrigin,
extraReason, canFaceBypass
|| mUdfpsBouncerShowing
|| mAlternateBouncerShowing
|| mPrimaryBouncerFullyShown
|| mAuthController.isUdfpsFingerDown());
}
@@ -2618,23 +2619,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) {
mUdfpsBouncerShowing = showing;
if (mUdfpsBouncerShowing) {
public void setAlternateBouncerShowing(boolean showing) {
mAlternateBouncerShowing = showing;
if (mAlternateBouncerShowing) {
updateFaceListeningState(BIOMETRIC_ACTION_START,
FACE_AUTH_TRIGGERED_ALTERNATE_BIOMETRIC_BOUNCER_SHOWN);
requestActiveUnlock(
ActiveUnlockConfig.ActiveUnlockRequestOrigin.UNLOCK_INTENT,
"udfpsBouncer");
"alternateBouncer");
}
}
private boolean shouldTriggerActiveUnlock() {
// Triggers:
final boolean triggerActiveUnlockForAssistant = shouldTriggerActiveUnlockForAssistant();
final boolean awakeKeyguard = mPrimaryBouncerFullyShown || mUdfpsBouncerShowing
final boolean awakeKeyguard = mPrimaryBouncerFullyShown || mAlternateBouncerShowing
|| (isKeyguardVisible() && !mGoingToSleep
&& mStatusBarState != StatusBarState.SHADE_LOCKED);
@@ -2818,7 +2819,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
final boolean isPostureAllowedForFaceAuth =
mConfigFaceAuthSupportedPosture == 0 /* DEVICE_POSTURE_UNKNOWN */ ? true
: (mPostureState == mConfigFaceAuthSupportedPosture);
// Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an
// instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
final boolean shouldListen =
@@ -2828,11 +2828,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|| awakeKeyguard
|| shouldListenForFaceAssistant
|| isUdfpsFingerDown
|| mUdfpsBouncerShowing)
|| mAlternateBouncerShowing)
&& !mSwitchingUser && !faceDisabledForUser && userNotTrustedOrDetectionIsNeeded
&& !mKeyguardGoingAway && biometricEnabledForUser
&& faceAuthAllowedOrDetectionIsNeeded && mIsPrimaryUser
&& (!mSecureCameraLaunched || mOccludingAppRequestingFace)
&& (!mSecureCameraLaunched || mAlternateBouncerShowing)
&& faceAndFpNotAuthenticated
&& !mGoingToSleep
&& isPostureAllowedForFaceAuth;
@@ -2843,6 +2843,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
System.currentTimeMillis(),
user,
shouldListen,
mAlternateBouncerShowing,
mAuthInterruptActive,
biometricEnabledForUser,
mPrimaryBouncerFullyShown,
@@ -2860,7 +2861,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
mSecureCameraLaunched,
supportsDetect,
mSwitchingUser,
mUdfpsBouncerShowing,
isUdfpsFingerDown,
userNotTrustedOrDetectionIsNeeded));
@@ -3954,7 +3954,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
pw.println(" mPrimaryBouncerIsOrWillBeShowing="
+ mPrimaryBouncerIsOrWillBeShowing);
pw.println(" mStatusBarState=" + StatusBarState.toString(mStatusBarState));
pw.println(" mUdfpsBouncerShowing=" + mUdfpsBouncerShowing);
pw.println(" mAlternateBouncerShowing=" + mAlternateBouncerShowing);
} else if (isSfpsSupported()) {
pw.println(" sfpsEnrolled=" + isSfpsEnrolled());
pw.println(" shouldListenForSfps=" + shouldListenForFingerprint(false));

View File

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

View File

@@ -1733,7 +1733,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
}
@Test
public void testShouldListenForFace_whenOccludingAppRequestsFaceAuth_returnsTrue()
public void shouldListenForFace_secureCameraLaunchedButAlternateBouncerIsLaunched_returnsTrue()
throws RemoteException {
// Face auth should run when the following is true.
keyguardNotGoingAway();
@@ -1749,7 +1749,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isFalse();
occludingAppRequestsFaceAuth();
alternateBouncerVisible();
mTestableLooper.processAllMessages();
assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isTrue();
@@ -1839,7 +1839,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
}
@Test
public void testShouldListenForFace_whenUdfpsBouncerIsShowing_returnsTrue()
public void testShouldListenForFace_whenAlternateBouncerIsShowing_returnsTrue()
throws RemoteException {
// Preconditions for face auth to run
keyguardNotGoingAway();
@@ -1851,13 +1851,13 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
mTestableLooper.processAllMessages();
assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isFalse();
mKeyguardUpdateMonitor.setUdfpsBouncerShowing(true);
mKeyguardUpdateMonitor.setAlternateBouncerShowing(true);
assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isTrue();
}
@Test
public void testShouldListenForFace_udfpsBouncerIsShowingButDeviceGoingToSleep_returnsFalse()
public void testShouldListenForFace_alternateBouncerShowingButDeviceGoingToSleep_returnsFalse()
throws RemoteException {
// Preconditions for face auth to run
keyguardNotGoingAway();
@@ -1867,7 +1867,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
biometricsEnabledForCurrentUser();
userNotCurrentlySwitching();
deviceNotGoingToSleep();
mKeyguardUpdateMonitor.setUdfpsBouncerShowing(true);
alternateBouncerVisible();
mTestableLooper.processAllMessages();
assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isTrue();
@@ -1877,6 +1877,10 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isFalse();
}
private void alternateBouncerVisible() {
mKeyguardUpdateMonitor.setAlternateBouncerShowing(true);
}
@Test
public void testShouldListenForFace_whenFaceIsLockedOut_returnsTrue()
throws RemoteException {
@@ -1887,7 +1891,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
biometricsNotDisabledThroughDevicePolicyManager();
biometricsEnabledForCurrentUser();
userNotCurrentlySwitching();
mKeyguardUpdateMonitor.setUdfpsBouncerShowing(true);
mKeyguardUpdateMonitor.setAlternateBouncerShowing(true);
mTestableLooper.processAllMessages();
assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isTrue();