diff --git a/packages/SystemUI/res-keyguard/values/config.xml b/packages/SystemUI/res-keyguard/values/config.xml index e8244433260d9..a25ab5109fa80 100644 --- a/packages/SystemUI/res-keyguard/values/config.xml +++ b/packages/SystemUI/res-keyguard/values/config.xml @@ -28,5 +28,6 @@ false - + + 3500 diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java index 6a78370c7dab9..d5d1ceada88a4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java @@ -19,7 +19,6 @@ package com.android.systemui.statusbar.phone; import static android.app.StatusBarManager.SESSION_KEYGUARD; import android.annotation.IntDef; -import android.content.Context; import android.content.res.Resources; import android.hardware.biometrics.BiometricSourceType; import android.hardware.fingerprint.FingerprintManager; @@ -45,6 +44,7 @@ import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.keyguard.KeyguardViewController; import com.android.systemui.Dumpable; +import com.android.systemui.R; import com.android.systemui.biometrics.AuthController; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Main; @@ -163,7 +163,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp private final KeyguardStateController mKeyguardStateController; private final NotificationShadeWindowController mNotificationShadeWindowController; private final SessionTracker mSessionTracker; - private final Context mContext; + private final int mConsecutiveFpFailureThreshold; private final int mWakeUpDelay; private int mMode; private BiometricSourceType mBiometricType; @@ -266,7 +266,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp private KeyguardUnlockAnimationController mKeyguardUnlockAnimationController; @Inject - public BiometricUnlockController(Context context, DozeScrimController dozeScrimController, + public BiometricUnlockController(DozeScrimController dozeScrimController, KeyguardViewMediator keyguardViewMediator, ScrimController scrimController, ShadeController shadeController, NotificationShadeWindowController notificationShadeWindowController, @@ -284,7 +284,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp KeyguardUnlockAnimationController keyguardUnlockAnimationController, SessionTracker sessionTracker, LatencyTracker latencyTracker) { - mContext = context; mPowerManager = powerManager; mShadeController = shadeController; mUpdateMonitor = keyguardUpdateMonitor; @@ -302,6 +301,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp mKeyguardStateController = keyguardStateController; mHandler = handler; mWakeUpDelay = resources.getInteger(com.android.internal.R.integer.config_wakeUpDelayDoze); + mConsecutiveFpFailureThreshold = resources.getInteger( + R.integer.fp_consecutive_failure_time_ms); mKeyguardBypassController = keyguardBypassController; mKeyguardBypassController.setUnlockController(this); mMetricsLogger = metricsLogger; @@ -666,8 +667,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp if (biometricSourceType == BiometricSourceType.FINGERPRINT && mUpdateMonitor.isUdfpsSupported()) { long currUptimeMillis = SystemClock.uptimeMillis(); - if (currUptimeMillis - mLastFpFailureUptimeMillis - < (mStatusBarStateController.isDozing() ? 3500 : 2000)) { + if (currUptimeMillis - mLastFpFailureUptimeMillis < mConsecutiveFpFailureThreshold) { mNumConsecutiveFpFailures += 1; } else { mNumConsecutiveFpFailures = 1; diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java index fb232ba3ac2ca..ed144fa993696 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java @@ -126,10 +126,9 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { .thenReturn(true); when(mAuthController.isUdfpsFingerDown()).thenReturn(false); when(mKeyguardBypassController.canPlaySubtleWindowAnimations()).thenReturn(true); - mContext.addMockSystemService(PowerManager.class, mPowerManager); mDependency.injectTestDependency(NotificationMediaManager.class, mMediaManager); res.addOverride(com.android.internal.R.integer.config_wakeUpDelayDoze, 0); - mBiometricUnlockController = new BiometricUnlockController(mContext, mDozeScrimController, + mBiometricUnlockController = new BiometricUnlockController(mDozeScrimController, mKeyguardViewMediator, mScrimController, mShadeController, mNotificationShadeWindowController, mKeyguardStateController, mHandler, mUpdateMonitor, res.getResources(), mKeyguardBypassController, mDozeParameters,