Merge "For devices w/o haptics, show bouncer on biometric fail" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
1c0ca5caae
@@ -3643,6 +3643,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
mHandler.sendEmptyMessage(MSG_KEYGUARD_DISMISS_ANIMATION_FINISHED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true when the screen is on (including when a screensaver is showing),
|
||||
* false when the screen is OFF or DOZE (including showing AOD UI)
|
||||
*/
|
||||
public boolean isDeviceInteractive() {
|
||||
return mDeviceInteractive;
|
||||
}
|
||||
@@ -3785,6 +3789,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
pw.println(" mFingerprintLockedOut=" + mFingerprintLockedOut);
|
||||
pw.println(" mFingerprintLockedOutPermanent=" + mFingerprintLockedOutPermanent);
|
||||
pw.println(" enabledByUser=" + mBiometricEnabledForUser.get(userId));
|
||||
pw.println(" mKeyguardOccluded=" + mKeyguardOccluded);
|
||||
pw.println(" mIsDreaming=" + mIsDreaming);
|
||||
if (isUdfpsSupported()) {
|
||||
pw.println(" udfpsEnrolled=" + isUdfpsEnrolled());
|
||||
pw.println(" shouldListenForUdfps=" + shouldListenForFingerprint(true));
|
||||
|
||||
@@ -448,7 +448,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
|
||||
}
|
||||
// During wake and unlock, we need to draw black before waking up to avoid abrupt
|
||||
// brightness changes due to display state transitions.
|
||||
boolean alwaysOnEnabled = mDozeParameters.getAlwaysOn();
|
||||
Runnable wakeUp = ()-> {
|
||||
if (!wasDeviceInteractive) {
|
||||
if (DEBUG_BIO_WAKELOCK) {
|
||||
@@ -659,7 +658,10 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
|
||||
mLatencyTracker.onActionCancel(action);
|
||||
}
|
||||
|
||||
if (biometricSourceType == BiometricSourceType.FINGERPRINT
|
||||
if (!mVibratorHelper.hasVibrator()
|
||||
&& (!mUpdateMonitor.isDeviceInteractive() || mUpdateMonitor.isDreaming())) {
|
||||
startWakeAndUnlock(MODE_SHOW_BOUNCER);
|
||||
} else if (biometricSourceType == BiometricSourceType.FINGERPRINT
|
||||
&& mUpdateMonitor.isUdfpsSupported()) {
|
||||
long currUptimeMillis = SystemClock.uptimeMillis();
|
||||
if (currUptimeMillis - mLastFpFailureUptimeMillis < mConsecutiveFpFailureThreshold) {
|
||||
|
||||
@@ -131,6 +131,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
|
||||
when(mKeyguardBypassController.onBiometricAuthenticated(any(), anyBoolean()))
|
||||
.thenReturn(true);
|
||||
when(mAuthController.isUdfpsFingerDown()).thenReturn(false);
|
||||
when(mVibratorHelper.hasVibrator()).thenReturn(true);
|
||||
mDependency.injectTestDependency(NotificationMediaManager.class, mMediaManager);
|
||||
mBiometricUnlockController = new BiometricUnlockController(mDozeScrimController,
|
||||
mKeyguardViewMediator, mScrimController, mShadeController,
|
||||
@@ -423,4 +424,35 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
|
||||
verify(mHandler).post(captor.capture());
|
||||
captor.getValue().run();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onFPFailureNoHaptics_notDeviceInteractive_showBouncer() {
|
||||
// GIVEN no vibrator and the screen is off
|
||||
when(mVibratorHelper.hasVibrator()).thenReturn(false);
|
||||
when(mUpdateMonitor.isDeviceInteractive()).thenReturn(false);
|
||||
when(mUpdateMonitor.isDreaming()).thenReturn(false);
|
||||
|
||||
// WHEN FP fails
|
||||
mBiometricUnlockController.onBiometricAuthFailed(BiometricSourceType.FINGERPRINT);
|
||||
|
||||
// after device is finished waking up
|
||||
mBiometricUnlockController.mWakefulnessObserver.onFinishedWakingUp();
|
||||
|
||||
// THEN show the bouncer
|
||||
verify(mStatusBarKeyguardViewManager).showBouncer(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onFPFailureNoHaptics_dreaming_showBouncer() {
|
||||
// GIVEN no vibrator and device is dreaming
|
||||
when(mVibratorHelper.hasVibrator()).thenReturn(false);
|
||||
when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true);
|
||||
when(mUpdateMonitor.isDreaming()).thenReturn(true);
|
||||
|
||||
// WHEN FP fails
|
||||
mBiometricUnlockController.onBiometricAuthFailed(BiometricSourceType.FINGERPRINT);
|
||||
|
||||
// THEN show the bouncer
|
||||
verify(mStatusBarKeyguardViewManager).showBouncer(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user