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

Commit 260882b5 authored by Chandru S's avatar Chandru S
Browse files

Use a no-op implementation of face auth interactor whenever FaceManager is not present

Fixes: 328783311
Test: everything builds, manually installed sysui on face auth supported device and face auth not supported device to verify lockscreen interactions work.
Flag: NONE no-op change because all methods in both the interactors return the
same values that were being returned previously in Face auth supported
and unsupported devices

Change-Id: Id35e391447c251b597b7c1ff242ecd08b2388b7e
parent 2bf9a567
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.deviceentry.domain.interactor

import com.android.systemui.CoreStartable
import com.android.systemui.deviceentry.shared.model.FaceAuthenticationStatus
import com.android.systemui.deviceentry.shared.model.FaceDetectionStatus
import kotlinx.coroutines.flow.Flow
@@ -25,7 +26,7 @@ import kotlinx.coroutines.flow.StateFlow
 * Interactor that exposes API to get the face authentication status and handle any events that can
 * cause face authentication to run for device entry.
 */
interface DeviceEntryFaceAuthInteractor {
interface DeviceEntryFaceAuthInteractor : CoreStartable {

    /** Current authentication status */
    val authenticationStatus: Flow<FaceAuthenticationStatus>
+1 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ class NoopDeviceEntryFaceAuthInteractor @Inject constructor() : DeviceEntryFaceA
    override fun isFaceAuthEnabledAndEnrolled(): Boolean = false

    override fun isFaceAuthStrong(): Boolean = false
    override fun start() = Unit

    override fun registerListener(listener: FaceAuthenticationListener) {}

+1 −2
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import android.content.Context
import android.hardware.biometrics.BiometricFaceConstants
import android.hardware.biometrics.BiometricSourceType
import com.android.keyguard.KeyguardUpdateMonitor
import com.android.systemui.CoreStartable
import com.android.systemui.biometrics.data.repository.FacePropertyRepository
import com.android.systemui.biometrics.shared.model.LockoutMode
import com.android.systemui.biometrics.shared.model.SensorStrength
@@ -91,7 +90,7 @@ constructor(
    private val powerInteractor: PowerInteractor,
    private val biometricSettingsRepository: BiometricSettingsRepository,
    private val trustManager: TrustManager,
) : CoreStartable, DeviceEntryFaceAuthInteractor {
) : DeviceEntryFaceAuthInteractor {

    private val listeners: MutableList<FaceAuthenticationListener> = mutableListOf()

+21 −11
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -12,16 +12,17 @@
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package com.android.systemui.keyguard.data.repository

import android.hardware.face.FaceManager
import com.android.systemui.CoreStartable
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.deviceentry.data.repository.DeviceEntryFaceAuthRepository
import com.android.systemui.deviceentry.data.repository.DeviceEntryFaceAuthRepositoryImpl
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInteractor
import com.android.systemui.deviceentry.domain.interactor.NoopDeviceEntryFaceAuthInteractor
import com.android.systemui.deviceentry.domain.interactor.SystemUIDeviceEntryFaceAuthInteractor
import com.android.systemui.deviceentry.ui.binder.LiftToRunFaceAuthBinder
import com.android.systemui.log.table.TableLogBuffer
@@ -41,15 +42,8 @@ interface DeviceEntryFaceAuthModule {

    @Binds
    @IntoMap
    @ClassKey(SystemUIDeviceEntryFaceAuthInteractor::class)
    fun bindSystemUIDeviceEntryFaceAuthInteractor(
        impl: SystemUIDeviceEntryFaceAuthInteractor
    ): CoreStartable

    @Binds
    fun keyguardFaceAuthInteractor(
        impl: SystemUIDeviceEntryFaceAuthInteractor
    ): DeviceEntryFaceAuthInteractor
    @ClassKey(DeviceEntryFaceAuthInteractor::class)
    fun bindFaceAuthStartable(impl: DeviceEntryFaceAuthInteractor): CoreStartable

    @Binds
    @IntoMap
@@ -57,6 +51,22 @@ interface DeviceEntryFaceAuthModule {
    fun bindLiftToRunFaceAuthBinder(impl: LiftToRunFaceAuthBinder): CoreStartable

    companion object {

        @Provides
        @SysUISingleton
        fun providesFaceAuthInteractorInstance(
            faceManager: FaceManager?,
            systemUIDeviceEntryFaceAuthInteractor:
                dagger.Lazy<SystemUIDeviceEntryFaceAuthInteractor>,
            noopDeviceEntryFaceAuthInteractor: dagger.Lazy<NoopDeviceEntryFaceAuthInteractor>,
        ): DeviceEntryFaceAuthInteractor {
            return if (faceManager != null) {
                systemUIDeviceEntryFaceAuthInteractor.get()
            } else {
                noopDeviceEntryFaceAuthInteractor.get()
            }
        }

        @Provides
        @SysUISingleton
        @FaceAuthTableLog