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

Commit b92a138e authored by Grace Cheng's avatar Grace Cheng
Browse files

Add debug logging to sfps indicator code

Add debug logging for refactor enabled sfps indicator logic

Flag: NONE
Bug: 340227038
Test: N/A
Change-Id: I6495b567bef60de7ec01aa5396b56a3424f891c9
Merged-In: Icc25cd08fa1cd7ee1f9d80aa9863c982bd6ea291
parent f0a7446d
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.hardware.biometrics.BiometricRequestConstants.REASON_AUTH_SETTING
import android.hardware.biometrics.BiometricRequestConstants.REASON_ENROLL_ENROLLING
import android.hardware.biometrics.BiometricRequestConstants.REASON_ENROLL_FIND_SENSOR
import android.hardware.biometrics.BiometricSourceType
import android.util.Log
import com.android.systemui.biometrics.shared.model.AuthenticationReason
import com.android.systemui.biometrics.shared.model.AuthenticationReason.SettingsOperations
import com.android.systemui.biometrics.shared.model.AuthenticationState
@@ -42,6 +43,7 @@ import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.filterIsInstance
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.shareIn

/** A repository for the state of biometric authentication. */
@@ -67,6 +69,7 @@ constructor(
    private val authenticationState: Flow<AuthenticationState> =
        conflatedCallbackFlow {
                val updateAuthenticationState = { state: AuthenticationState ->
                    Log.d(TAG, "authenticationState updated: $state")
                    trySendWithFailureLogging(state, TAG, "Error sending AuthenticationState state")
                }

@@ -121,7 +124,9 @@ constructor(
            .shareIn(applicationScope, started = SharingStarted.Eagerly, replay = 1)

    override val fingerprintAuthenticationReason: Flow<AuthenticationReason> =
        authenticationState.map { it.requestReason }
        authenticationState
            .map { it.requestReason }
            .onEach { Log.d(TAG, "fingerprintAuthenticationReason updated: $it") }

    override val fingerprintAcquiredStatus: Flow<FingerprintAuthenticationStatus> =
        authenticationState
+11 −7
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.biometrics.domain.interactor

import android.app.ActivityTaskManager
import android.util.Log
import com.android.systemui.biometrics.data.repository.BiometricStatusRepository
import com.android.systemui.biometrics.shared.model.AuthenticationReason
import com.android.systemui.biometrics.shared.model.AuthenticationReason.SettingsOperations
@@ -25,6 +26,7 @@ import javax.inject.Inject
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onEach

/** Encapsulates business logic for interacting with biometric authentication state. */
interface BiometricStatusInteractor {
@@ -46,14 +48,16 @@ constructor(
) : BiometricStatusInteractor {

    override val sfpsAuthenticationReason: Flow<AuthenticationReason> =
        biometricStatusRepository.fingerprintAuthenticationReason.map { reason: AuthenticationReason
            ->
        biometricStatusRepository.fingerprintAuthenticationReason
            .map { reason: AuthenticationReason ->
                if (reason.isReasonToAlwaysUpdateSfpsOverlay(activityTaskManager)) {
                    reason
                } else {
                    AuthenticationReason.NotRunning
                }
        }.distinctUntilChanged()
            }
            .distinctUntilChanged()
            .onEach { Log.d(TAG, "sfpsAuthenticationReason updated: $it") }

    override val fingerprintAcquiredStatus: Flow<FingerprintAuthenticationStatus> =
        biometricStatusRepository.fingerprintAcquiredStatus
+14 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ package com.android.systemui.biometrics.ui.binder
import android.content.Context
import android.graphics.PorterDuff
import android.graphics.PorterDuffColorFilter
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.WindowManager
@@ -96,6 +97,13 @@ constructor(
                                    showIndicatorForDeviceEntry,
                                    progressBarIsVisible) =
                                    combinedFlows
                                Log.d(
                                    TAG,
                                    "systemServerAuthReason = $systemServerAuthReason, " +
                                        "showIndicatorForDeviceEntry = " +
                                        "$showIndicatorForDeviceEntry, " +
                                        "progressBarIsVisible = $progressBarIsVisible"
                                )
                                if (!isInRearDisplayMode) {
                                    if (progressBarIsVisible) {
                                        hide()
@@ -119,6 +127,10 @@ constructor(
    /** Show the side fingerprint sensor indicator */
    private fun show() {
        if (overlayView?.isAttachedToWindow == true) {
            Log.d(
                TAG,
                "show(): overlayView $overlayView isAttachedToWindow already, ignoring show request"
            )
            return
        }

@@ -135,6 +147,7 @@ constructor(
            )
        bind(overlayView!!, overlayViewModel, fpsUnlockTracker.get(), windowManager.get())
        overlayView!!.visibility = View.INVISIBLE
        Log.d(TAG, "show(): adding overlayView $overlayView")
        windowManager.get().addView(overlayView, overlayViewModel.defaultOverlayViewParams)
    }

@@ -144,6 +157,7 @@ constructor(
            val lottie = overlayView!!.requireViewById<LottieAnimationView>(R.id.sidefps_animation)
            lottie.pauseAnimation()
            lottie.removeAllLottieOnCompositionLoadedListener()
            Log.d(TAG, "hide(): removing overlayView $overlayView, setting to null")
            windowManager.get().removeView(overlayView)
            overlayView = null
        }
+7 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.keyguard.domain.interactor

import android.content.Context
import android.util.Log
import com.android.keyguard.KeyguardUpdateMonitor
import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor
import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerInteractor
@@ -35,6 +36,7 @@ import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.merge
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch

/**
@@ -73,9 +75,12 @@ constructor(
                deviceEntryFingerprintAuthRepository.shouldUpdateIndicatorVisibility.filter { it }
            )
            .map { shouldShowIndicatorForPrimaryBouncer() }
            .onEach { Log.d(TAG, "showIndicatorForPrimaryBouncer updated: $it") }

    private val showIndicatorForAlternateBouncer: Flow<Boolean> =
        alternateBouncerInteractor.isVisible
        alternateBouncerInteractor.isVisible.onEach {
            Log.d(TAG, "showIndicatorForAlternateBouncer updated: $it")
        }

    /**
     * Indicates whether the primary or alternate bouncers request showing the side fingerprint
@@ -88,6 +93,7 @@ constructor(
                showForPrimaryBouncer || showForAlternateBouncer
            }
            .distinctUntilChanged()
            .onEach { Log.d(TAG, "showIndicatorForDeviceEntry updated: $it") }

    private fun shouldShowIndicatorForPrimaryBouncer(): Boolean {
        val sfpsEnabled: Boolean =