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

Commit 50c36bfd authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Request face auth on posture change to OPENED" into 24D1-dev

parents 97a462b1 87118017
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
@@ -64,6 +64,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.TransitionState
import com.android.systemui.log.FaceAuthenticationLogger
import com.android.systemui.power.domain.interactor.PowerInteractor
@@ -244,6 +245,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