Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a0de7ad6 authored by Beverly's avatar Beverly
Browse files

Decrease threshold for a consecutive UDFPS attempt

Test: manually fail UDFPS multiple times, see bouncer
Test: atest BiometricUnlockControllerTest
Fixes: 218824540
Change-Id: I0e160f48edbc71ecb2bf114d68c7b3b65ed76a7f
parent 471b0fba
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -28,5 +28,6 @@
    <!-- Will display the bouncer on one side of the display, and the current user icon and
    <!-- Will display the bouncer on one side of the display, and the current user icon and
         user switcher on the other side -->
         user switcher on the other side -->
    <bool name="config_enableBouncerUserSwitcher">false</bool>
    <bool name="config_enableBouncerUserSwitcher">false</bool>

    <!-- Time to be considered a consecutive fingerprint failure in ms -->
    <integer name="fp_consecutive_failure_time_ms">3500</integer>
</resources>
</resources>
+6 −6
Original line number Original line Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.systemui.statusbar.phone;
import static android.app.StatusBarManager.SESSION_KEYGUARD;
import static android.app.StatusBarManager.SESSION_KEYGUARD;


import android.annotation.IntDef;
import android.annotation.IntDef;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.Resources;
import android.hardware.biometrics.BiometricSourceType;
import android.hardware.biometrics.BiometricSourceType;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintManager;
@@ -45,6 +44,7 @@ import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.keyguard.KeyguardViewController;
import com.android.keyguard.KeyguardViewController;
import com.android.systemui.Dumpable;
import com.android.systemui.Dumpable;
import com.android.systemui.R;
import com.android.systemui.biometrics.AuthController;
import com.android.systemui.biometrics.AuthController;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dagger.qualifiers.Main;
@@ -163,7 +163,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
    private final KeyguardStateController mKeyguardStateController;
    private final KeyguardStateController mKeyguardStateController;
    private final NotificationShadeWindowController mNotificationShadeWindowController;
    private final NotificationShadeWindowController mNotificationShadeWindowController;
    private final SessionTracker mSessionTracker;
    private final SessionTracker mSessionTracker;
    private final Context mContext;
    private final int mConsecutiveFpFailureThreshold;
    private final int mWakeUpDelay;
    private final int mWakeUpDelay;
    private int mMode;
    private int mMode;
    private BiometricSourceType mBiometricType;
    private BiometricSourceType mBiometricType;
@@ -266,7 +266,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
    private KeyguardUnlockAnimationController mKeyguardUnlockAnimationController;
    private KeyguardUnlockAnimationController mKeyguardUnlockAnimationController;


    @Inject
    @Inject
    public BiometricUnlockController(Context context, DozeScrimController dozeScrimController,
    public BiometricUnlockController(DozeScrimController dozeScrimController,
            KeyguardViewMediator keyguardViewMediator, ScrimController scrimController,
            KeyguardViewMediator keyguardViewMediator, ScrimController scrimController,
            ShadeController shadeController,
            ShadeController shadeController,
            NotificationShadeWindowController notificationShadeWindowController,
            NotificationShadeWindowController notificationShadeWindowController,
@@ -284,7 +284,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
            KeyguardUnlockAnimationController keyguardUnlockAnimationController,
            KeyguardUnlockAnimationController keyguardUnlockAnimationController,
            SessionTracker sessionTracker,
            SessionTracker sessionTracker,
            LatencyTracker latencyTracker) {
            LatencyTracker latencyTracker) {
        mContext = context;
        mPowerManager = powerManager;
        mPowerManager = powerManager;
        mShadeController = shadeController;
        mShadeController = shadeController;
        mUpdateMonitor = keyguardUpdateMonitor;
        mUpdateMonitor = keyguardUpdateMonitor;
@@ -302,6 +301,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
        mKeyguardStateController = keyguardStateController;
        mKeyguardStateController = keyguardStateController;
        mHandler = handler;
        mHandler = handler;
        mWakeUpDelay = resources.getInteger(com.android.internal.R.integer.config_wakeUpDelayDoze);
        mWakeUpDelay = resources.getInteger(com.android.internal.R.integer.config_wakeUpDelayDoze);
        mConsecutiveFpFailureThreshold = resources.getInteger(
                R.integer.fp_consecutive_failure_time_ms);
        mKeyguardBypassController = keyguardBypassController;
        mKeyguardBypassController = keyguardBypassController;
        mKeyguardBypassController.setUnlockController(this);
        mKeyguardBypassController.setUnlockController(this);
        mMetricsLogger = metricsLogger;
        mMetricsLogger = metricsLogger;
@@ -666,8 +667,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
        if (biometricSourceType == BiometricSourceType.FINGERPRINT
        if (biometricSourceType == BiometricSourceType.FINGERPRINT
                && mUpdateMonitor.isUdfpsSupported()) {
                && mUpdateMonitor.isUdfpsSupported()) {
            long currUptimeMillis = SystemClock.uptimeMillis();
            long currUptimeMillis = SystemClock.uptimeMillis();
            if (currUptimeMillis - mLastFpFailureUptimeMillis
            if (currUptimeMillis - mLastFpFailureUptimeMillis < mConsecutiveFpFailureThreshold) {
                    < (mStatusBarStateController.isDozing() ? 3500 : 2000)) {
                mNumConsecutiveFpFailures += 1;
                mNumConsecutiveFpFailures += 1;
            } else {
            } else {
                mNumConsecutiveFpFailures = 1;
                mNumConsecutiveFpFailures = 1;
+1 −2
Original line number Original line Diff line number Diff line
@@ -126,10 +126,9 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
                .thenReturn(true);
                .thenReturn(true);
        when(mAuthController.isUdfpsFingerDown()).thenReturn(false);
        when(mAuthController.isUdfpsFingerDown()).thenReturn(false);
        when(mKeyguardBypassController.canPlaySubtleWindowAnimations()).thenReturn(true);
        when(mKeyguardBypassController.canPlaySubtleWindowAnimations()).thenReturn(true);
        mContext.addMockSystemService(PowerManager.class, mPowerManager);
        mDependency.injectTestDependency(NotificationMediaManager.class, mMediaManager);
        mDependency.injectTestDependency(NotificationMediaManager.class, mMediaManager);
        res.addOverride(com.android.internal.R.integer.config_wakeUpDelayDoze, 0);
        res.addOverride(com.android.internal.R.integer.config_wakeUpDelayDoze, 0);
        mBiometricUnlockController = new BiometricUnlockController(mContext, mDozeScrimController,
        mBiometricUnlockController = new BiometricUnlockController(mDozeScrimController,
                mKeyguardViewMediator, mScrimController, mShadeController,
                mKeyguardViewMediator, mScrimController, mShadeController,
                mNotificationShadeWindowController, mKeyguardStateController, mHandler,
                mNotificationShadeWindowController, mKeyguardStateController, mHandler,
                mUpdateMonitor, res.getResources(), mKeyguardBypassController, mDozeParameters,
                mUpdateMonitor, res.getResources(), mKeyguardBypassController, mDozeParameters,