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

Commit 8f5ecd68 authored by Grace Cheng's avatar Grace Cheng
Browse files

Add debug logging to sfps indicator code

Add debug logging for sfps indicator logic

Flag: NONE only adds logs
Bug: 340227038
Test: N/A
Change-Id: Icc25cd08fa1cd7ee1f9d80aa9863c982bd6ea291
parent ec275b73
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.hardware.biometrics.events.AuthenticationStoppedInfo
import android.hardware.biometrics.events.AuthenticationSucceededInfo
import android.hardware.face.FaceManager
import android.hardware.fingerprint.FingerprintManager
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
@@ -52,6 +53,7 @@ import kotlinx.coroutines.flow.distinctUntilChanged
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. */
@@ -85,6 +87,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")
                }

@@ -187,6 +190,7 @@ constructor(
                        it.biometricSourceType == BiometricSourceType.FINGERPRINT)
            }
            .map { it.requestReason }
            .onEach { Log.d(TAG, "fingerprintAuthenticationReason updated: $it") }

    override val fingerprintAcquiredStatus: Flow<FingerprintAuthenticationStatus> =
        authenticationState
+15 −8
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.data.repository.FingerprintPropertyRepository
import com.android.systemui.biometrics.shared.model.AuthenticationReason
@@ -26,6 +27,7 @@ import javax.inject.Inject
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.onEach

/** Encapsulates business logic for interacting with biometric authentication state. */
interface BiometricStatusInteractor {
@@ -52,12 +54,17 @@ constructor(
                biometricStatusRepository.fingerprintAuthenticationReason,
                fingerprintPropertyRepository.sensorType
            ) { reason: AuthenticationReason, sensorType ->
            if (sensorType.isPowerButton() && reason.isReasonToAlwaysUpdateSfpsOverlay(activityTaskManager)) {
                if (
                    sensorType.isPowerButton() &&
                        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
@@ -91,6 +92,13 @@ constructor(
                                    showIndicatorForDeviceEntry,
                                    progressBarIsVisible) =
                                    combinedFlows
                                Log.d(
                                    TAG,
                                    "systemServerAuthReason = $systemServerAuthReason, " +
                                        "showIndicatorForDeviceEntry = " +
                                        "$showIndicatorForDeviceEntry, " +
                                        "progressBarIsVisible = $progressBarIsVisible"
                                )
                                if (!isInRearDisplayMode) {
                                    if (progressBarIsVisible) {
                                        hide()
@@ -114,6 +122,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
        }

@@ -128,6 +140,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)
    }

@@ -137,6 +150,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
@@ -39,6 +40,7 @@ import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.merge
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch

/**
@@ -96,10 +98,13 @@ constructor(
                    keyguardUpdateMonitor.isFingerprintDetectionRunning &&
                    keyguardUpdateMonitor.isUnlockingWithFingerprintAllowed
            }
            .onEach { Log.d(TAG, "showIndicatorForPrimaryBouncer updated: $it") }

    private val showIndicatorForAlternateBouncer: Flow<Boolean> =
        // Note: this interactor internally verifies that SideFPS is enabled and running.
        alternateBouncerInteractor.isVisible
        alternateBouncerInteractor.isVisible.onEach {
            Log.d(TAG, "showIndicatorForAlternateBouncer updated: $it")
        }

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

    private fun isBouncerActive(): Boolean {
        if (SceneContainerFlag.isEnabled) {