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

Commit ee8393ba authored by Beverly's avatar Beverly
Browse files

For non-udfps, detectFP if primaryAuth required

If the user attempts to FP auth, we will listen for FP
detection (as opposed to authentication or not at all). If the
user places their finger on the FP sensor, without running the
FP matcher, we can show the bouncer.

Additionally, update the logic when switching users. Immediately
after a user switch, cancel the FP listening state and then
restart based on the new state (because it may change to/from
detect or authenticate).

Repro steps:
  1. Enable extra logging:
       adb shell settings put global systemui/buffer/KeyguardUpdateMonitorLog v
  2. Setup side fps
  3. Fail side fps 5 times to lock out fp
  4. See logs that SysUI is running detectFP ("startListeningForFingerprint - detect")
  5. Attempt FP => bouncer appears

Test: atest KeyguardUpdateMonitorTest
Test: atest SystemUITests
Bug: 245778799
Change-Id: Ic1d4984c7514fc96b6552267128dee814730bb30
Merged-In: Ic1d4984c7514fc96b6552267128dee814730bb30
parent 83afbfcf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ data class KeyguardFingerprintListenModel(
    val credentialAttempted: Boolean,
    val deviceInteractive: Boolean,
    val dreaming: Boolean,
    val encryptedOrLockdown: Boolean,
    val fingerprintDisabled: Boolean,
    val fingerprintLockedOut: Boolean,
    val goingToSleep: Boolean,
@@ -37,6 +36,7 @@ data class KeyguardFingerprintListenModel(
    val primaryUser: Boolean,
    val shouldListenSfpsState: Boolean,
    val shouldListenForFingerprintAssistant: Boolean,
    val strongerAuthRequired: Boolean,
    val switchingUser: Boolean,
    val udfps: Boolean,
    val userDoesNotHaveTrust: Boolean
+5 −3
Original line number Diff line number Diff line
@@ -363,16 +363,18 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
        final boolean sfpsEnabled = getResources().getBoolean(
                R.bool.config_show_sidefps_hint_on_bouncer);
        final boolean fpsDetectionRunning = mUpdateMonitor.isFingerprintDetectionRunning();
        final boolean needsStrongAuth = mUpdateMonitor.userNeedsStrongAuth();
        final boolean isUnlockingWithFpAllowed =
                mUpdateMonitor.isUnlockingWithFingerprintAllowed();

        boolean toShow = mBouncerVisible && sfpsEnabled && fpsDetectionRunning && !needsStrongAuth;
        boolean toShow = mBouncerVisible && sfpsEnabled && fpsDetectionRunning
                && isUnlockingWithFpAllowed;

        if (DEBUG) {
            Log.d(TAG, "sideFpsToShow=" + toShow + ", "
                    + "mBouncerVisible=" + mBouncerVisible + ", "
                    + "configEnabled=" + sfpsEnabled + ", "
                    + "fpsDetectionRunning=" + fpsDetectionRunning + ", "
                    + "needsStrongAuth=" + needsStrongAuth);
                    + "isUnlockingWithFpAllowed=" + isUnlockingWithFpAllowed);
        }
        if (toShow) {
            mSideFpsController.get().show(SideFpsUiRequestSource.PRIMARY_BOUNCER);
+92 −59

File changed.

Preview size limit exceeded, changes collapsed.

+5 −5
Original line number Diff line number Diff line
@@ -116,9 +116,9 @@ class AuthRippleController @Inject constructor(
        notificationShadeWindowController.setForcePluginOpen(false, this)
    }

    fun showUnlockRipple(biometricSourceType: BiometricSourceType?) {
    fun showUnlockRipple(biometricSourceType: BiometricSourceType) {
        if (!keyguardStateController.isShowing ||
            keyguardUpdateMonitor.userNeedsStrongAuth()) {
                !keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(biometricSourceType)) {
            return
        }

@@ -246,7 +246,7 @@ class AuthRippleController @Inject constructor(
        object : KeyguardUpdateMonitorCallback() {
            override fun onBiometricAuthenticated(
                userId: Int,
                biometricSourceType: BiometricSourceType?,
                biometricSourceType: BiometricSourceType,
                isStrongBiometric: Boolean
            ) {
                if (biometricSourceType == BiometricSourceType.FINGERPRINT) {
@@ -255,14 +255,14 @@ class AuthRippleController @Inject constructor(
                showUnlockRipple(biometricSourceType)
            }

        override fun onBiometricAuthFailed(biometricSourceType: BiometricSourceType?) {
        override fun onBiometricAuthFailed(biometricSourceType: BiometricSourceType) {
            if (biometricSourceType == BiometricSourceType.FINGERPRINT) {
                mView.retractDwellRipple()
            }
        }

        override fun onBiometricAcquired(
            biometricSourceType: BiometricSourceType?,
            biometricSourceType: BiometricSourceType,
            acquireInfo: Int
        ) {
            if (biometricSourceType == BiometricSourceType.FINGERPRINT &&
+2 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.keyguard.domain.interactor

import android.content.res.ColorStateList
import android.hardware.biometrics.BiometricSourceType
import android.os.Handler
import android.os.Trace
import android.os.UserHandle
@@ -71,7 +72,7 @@ constructor(
                KeyguardUpdateMonitor.getCurrentUser()
            ) &&
            !needsFullscreenBouncer() &&
            !keyguardUpdateMonitor.userNeedsStrongAuth() &&
            keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(BiometricSourceType.FACE) &&
            !keyguardBypassController.bypassEnabled

    /** Runnable to show the primary bouncer. */
Loading