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

Commit 5e493070 authored by Beverly's avatar Beverly Committed by Beverly Tai
Browse files

Request face auth on posture change to OPENED

Even when the event isn't from a wakeup of the device.
This will now have some redundancy with the wakeup(UNFOLD)
event; however, it's OK to have two requests pending.

Test: atest KeyguardUpdateMonitorTest
Flag: none
Bug: 331721693
Change-Id: I18bb85ba8225272246a14034358c25d682893de1
parent 016ce9ef
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STR
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_LOCKOUT;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN;
import static com.android.systemui.statusbar.policy.DevicePostureController.DEVICE_POSTURE_OPENED;
import static com.android.systemui.statusbar.policy.DevicePostureController.DEVICE_POSTURE_UNKNOWN;

import android.annotation.AnyThread;
import android.annotation.MainThread;
@@ -1868,7 +1867,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                @Override
                public void onPostureChanged(@DevicePostureInt int posture) {
                    if (posture == DEVICE_POSTURE_OPENED) {
                        mLogger.d("Posture changed to open - attempting to request active unlock");
                        mLogger.d("Posture changed to open - attempting to request active"
                                + " unlock and run face auth");
                        getFaceAuthInteractor().onDeviceUnfolded();
                        requestActiveUnlockFromWakeReason(PowerManager.WAKE_REASON_UNFOLD_DEVICE,
                                false);
                    }
@@ -2434,9 +2435,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                updateFingerprintListeningState(BIOMETRIC_ACTION_START);
            }
        });
        if (mConfigFaceAuthSupportedPosture != DEVICE_POSTURE_UNKNOWN) {
        mDevicePostureController.addCallback(mPostureCallback);
        }
        updateFingerprintListeningState(BIOMETRIC_ACTION_UPDATE);

        mTaskStackChangeListeners.registerTaskStackListener(mTaskStackListener);
+12 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.keyguard.shared.model.DevicePosture
import com.android.systemui.res.R
import java.util.concurrent.Executor
import javax.inject.Inject
@@ -68,6 +69,8 @@ interface FacePropertyRepository {

    /** The info of current available camera. */
    val cameraInfo: StateFlow<CameraInfo?>

    val supportedPostures: List<DevicePosture>
}

/** Describes a biometric sensor */
@@ -188,6 +191,15 @@ constructor(
                initialValue = if (cameraInfoList.isNotEmpty()) cameraInfoList[0] else null
            )

    private val supportedPosture =
        applicationContext.resources.getInteger(R.integer.config_face_auth_supported_posture)
    override val supportedPostures: List<DevicePosture> =
        if (supportedPosture == 0) {
            DevicePosture.entries
        } else {
            listOf(DevicePosture.toPosture(supportedPosture))
        }

    private val defaultSensorLocation: StateFlow<Point?> =
        cameraInfo
            .map { it?.cameraLocation }
+1 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ interface DeviceEntryFaceAuthInteractor {
    fun onPrimaryBouncerUserInput()
    fun onAccessibilityAction()
    fun onWalletLaunched()
    fun onDeviceUnfolded()

    /** Whether face auth is considered class 3 */
    fun isFaceAuthStrong(): Boolean
+1 −0
Original line number Diff line number Diff line
@@ -66,4 +66,5 @@ class NoopDeviceEntryFaceAuthInteractor @Inject constructor() : DeviceEntryFaceA
    override fun onPrimaryBouncerUserInput() {}
    override fun onAccessibilityAction() {}
    override fun onWalletLaunched() = Unit
    override fun onDeviceUnfolded() {}
}
+7 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.systemui.deviceentry.shared.model.ErrorFaceAuthenticationStat
import com.android.systemui.deviceentry.shared.model.FaceAuthenticationStatus
import com.android.systemui.keyguard.data.repository.BiometricSettingsRepository
import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor
import com.android.systemui.keyguard.shared.model.DevicePosture
import com.android.systemui.keyguard.shared.model.KeyguardState.AOD
import com.android.systemui.keyguard.shared.model.KeyguardState.DOZING
import com.android.systemui.keyguard.shared.model.KeyguardState.LOCKSCREEN
@@ -248,6 +249,12 @@ constructor(
        }
    }

    override fun onDeviceUnfolded() {
        if (facePropertyRepository.supportedPostures.contains(DevicePosture.OPENED)) {
            runFaceAuth(FaceAuthUiEvent.FACE_AUTH_UPDATED_POSTURE_CHANGED, true)
        }
    }

    override fun registerListener(listener: FaceAuthenticationListener) {
        listeners.add(listener)
    }
Loading