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

Commit d634c46b authored by Denis Kuznetsov's avatar Denis Kuznetsov Committed by Android (Google) Code Review
Browse files

Merge "Properly handle fingerprint sensors with unknown locations" into main

parents d830c0dd 5beccc06
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.biometrics;
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FACE;
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FINGERPRINT;
import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_REAR;
import static android.hardware.fingerprint.FingerprintSensorProperties.TYPE_UNKNOWN;
import static android.view.Display.INVALID_DISPLAY;

import static com.android.systemui.Flags.contAuthPlugin;
@@ -366,6 +367,8 @@ public class AuthController implements
                        mSfpsEnrolledForUser.put(userId, hasEnrollments);
                    } else if (prop.sensorType == TYPE_REAR) {
                        sensorBiometricType = BiometricType.REAR_FINGERPRINT;
                    } else {
                        sensorBiometricType = BiometricType.OTHER_FINGERPRINT;
                    }
                    break;
                }
@@ -1010,6 +1013,22 @@ public class AuthController implements
        return false;
    }

    /**
     * @return true if fps HW is supported on this device, but location is unknown. Can return
     * true even if the user has not enrolled fps. This may be false if called before
     * onAllAuthenticatorsRegistered.
     */
    public boolean isUnknownFpsSupported() {
        if (mFpProps != null) {
            for (FingerprintSensorPropertiesInternal prop: mFpProps) {
                if (prop.sensorType == TYPE_UNKNOWN) {
                    return true;
                }
            }
        }
        return false;
    }

    private String getNotRecognizedString(@Modality int modality) {
        final int messageRes;
        final int userId = mCurrentDialogArgs.argi1;
+3 −0
Original line number Diff line number Diff line
@@ -29,5 +29,8 @@ enum class BiometricType(val isFingerprint: Boolean) {

    // Fingerprint sensor that is located on the side of the device, typically on the power button
    SIDE_FINGERPRINT(true),

    // Fingerprint sensor with unknown location
    OTHER_FINGERPRINT(true),
    FACE(false),
}
+3 −2
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import com.android.keyguard.KeyguardUpdateMonitorCallback
import com.android.systemui.biometrics.AuthController
import com.android.systemui.biometrics.shared.model.AuthenticationReason
import com.android.systemui.common.coroutine.ChannelExt.trySendWithFailureLogging
import com.android.systemui.utils.coroutines.flow.conflatedCallbackFlow
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Main
@@ -34,6 +33,7 @@ import com.android.systemui.keyguard.shared.model.FailFingerprintAuthenticationS
import com.android.systemui.keyguard.shared.model.FingerprintAuthenticationStatus
import com.android.systemui.keyguard.shared.model.HelpFingerprintAuthenticationStatus
import com.android.systemui.keyguard.shared.model.SuccessFingerprintAuthenticationStatus
import com.android.systemui.utils.coroutines.flow.conflatedCallbackFlow
import javax.inject.Inject
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
@@ -124,7 +124,8 @@ constructor(
    private fun getFpSensorType(): BiometricType? {
        return if (authController.isUdfpsSupported) BiometricType.UNDER_DISPLAY_FINGERPRINT
        else if (authController.isSfpsSupported) BiometricType.SIDE_FINGERPRINT
        else if (authController.isRearFpsSupported) BiometricType.REAR_FINGERPRINT else null
        else if (authController.isRearFpsSupported) BiometricType.REAR_FINGERPRINT
        else if (authController.isUnknownFpsSupported) BiometricType.OTHER_FINGERPRINT else null
    }

    override val isLockedOut: StateFlow<Boolean> by lazy {