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

Unverified Commit dc116524 authored by LuK1337's avatar LuK1337 Committed by Michael Bestas
Browse files

SystemUI: Restore 14 QPR1 FingerprintInteractiveToAuth handling



NOTE: This is modified to allow interactive to auth for all non-udfps
sensors.

Co-authored-by: default avatarMichael Bestas <mkbestas@lineageos.org>
Co-authored-by: default avatarOliver Scott <olivercscott@gmail.com>
Change-Id: I169435e755c68433955f5f6185c3fa74400fca64
parent 7de55e4f
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -2991,9 +2991,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                && !strongerAuthRequired
                && userDoesNotHaveTrust);

        final boolean shouldListenFpsState = isUdfps
                || mFingerprintInteractiveToAuthProvider == null
                || !mFingerprintInteractiveToAuthProvider.isEnabled(user)
                || (isDeviceInteractive() && !mGoingToSleep);

        boolean shouldListen = shouldListenKeyguardState && shouldListenUserState
                && shouldListenBouncerState && shouldListenUdfpsState && !mBiometricPromptShowing;
                && shouldListenBouncerState && shouldListenUdfpsState && !mBiometricPromptShowing
                && shouldListenFpsState;
        logListenerModelData(
                new KeyguardFingerprintListenModel(
                    System.currentTimeMillis(),
+6 −0
Original line number Diff line number Diff line
@@ -36,4 +36,10 @@ interface FingerprintInteractiveToAuthProvider {
     * @return Vendor extension if needed for authentication.
     */
    fun getVendorExtension(userId: Int): AuthenticateReason.Vendor?

    /**
     * @param userId the user Id.
     * @return true if the InteractiveToAuthFeature is enabled, false if disabled.
     */
    fun isEnabled(userId: Int): Boolean
}
+1 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ class FingerprintInteractiveToAuthProviderImpl @Inject constructor(

    override fun getVendorExtension(userId: Int): AuthenticateReason.Vendor? = null

    private fun isEnabled(userId: Int): Boolean {
    override fun isEnabled(userId: Int): Boolean {
        var value = Settings.Secure.getIntForUser(
            context.contentResolver,
            Settings.Secure.SFPS_PERFORMANT_AUTH_ENABLED,
+27 −1
Original line number Diff line number Diff line
@@ -16,16 +16,42 @@

package com.android.systemui.biometrics

import android.content.Context
import android.hardware.biometrics.common.AuthenticateReason
import android.provider.Settings
import kotlinx.coroutines.flow.MutableStateFlow
import org.lineageos.platform.internal.R
import org.mockito.Mockito

class FakeFingerprintInteractiveToAuthProvider : FingerprintInteractiveToAuthProvider {
    override val enabledForCurrentUser: MutableStateFlow<Boolean> = MutableStateFlow(false)

    private val mockContext = Mockito.mock(Context::class.java)

    private val defaultValue = if (mockContext.resources.getBoolean(
                    R.bool.config_fingerprintWakeAndUnlock)) {
        1
    } else {
        0
    }

    private val userIdToExtension = mutableMapOf<Int, AuthenticateReason.Vendor>()

    override fun getVendorExtension(userId: Int): AuthenticateReason.Vendor? =
            userIdToExtension[userId]

    override fun isEnabled(userId: Int): Boolean {
        var value = Settings.Secure.getIntForUser(
                mockContext.contentResolver, Settings.Secure.SFPS_PERFORMANT_AUTH_ENABLED,
                -1,
                userId,
        )
        if (value == -1) {
            value = defaultValue
        }
        return value == 0
    }

    fun setVendorExtension(userId: Int, extension: AuthenticateReason.Vendor) {
        userIdToExtension[userId] = extension
    }