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

Commit 1735d182 authored by Peter Kalauskas's avatar Peter Kalauskas
Browse files

Trace state flows for screen unlock interactions

Bug: 334171711
Test: atest CoroutineTracingPerfTests
Flag: com.android.systemui.coroutine_tracing
Change-Id: I90fb23d219d06a4d03cb855d90af5f49774b0857
parent 0f44b427
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.bouncer.data.repository
import android.annotation.SuppressLint
import android.os.Build
import android.util.Log
import com.android.app.tracing.coroutines.flow.asSharedFlowTraced
import com.android.keyguard.KeyguardSecurityModel
import com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.EXPANSION_HIDDEN
import com.android.systemui.bouncer.shared.model.BouncerDismissActionModel
@@ -35,7 +36,6 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.launchIn
@@ -189,13 +189,15 @@ constructor(
    /** Whether the user is unlocked via a primary authentication method (pin/pattern/password). */
    private val _keyguardAuthenticatedPrimaryAuth = MutableSharedFlow<Int>()
    override val keyguardAuthenticatedPrimaryAuth: Flow<Int> =
        _keyguardAuthenticatedPrimaryAuth.asSharedFlow()
        _keyguardAuthenticatedPrimaryAuth.asSharedFlowTraced("keyguardAuthenticatedPrimaryAuth")

    /** Whether the user requested to show the bouncer when device is already authenticated */
    @SuppressLint("SharedFlowCreation")
    private val _userRequestedBouncerWhenAlreadyAuthenticated = MutableSharedFlow<Int>()
    override val userRequestedBouncerWhenAlreadyAuthenticated: Flow<Int> =
        _userRequestedBouncerWhenAlreadyAuthenticated.asSharedFlow()
        _userRequestedBouncerWhenAlreadyAuthenticated.asSharedFlowTraced(
            "userRequestedBouncerWhenAlreadyAuthenticated"
        )

    private val _showMessage = MutableStateFlow<BouncerShowMessageModel?>(null)
    override val showMessage = _showMessage.asStateFlow()
+4 −2
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.os.PowerManager
import com.android.app.tracing.coroutines.flow.traceAs
import com.android.keyguard.UserActivityNotifier
import com.android.systemui.Flags
import com.android.systemui.broadcast.BroadcastDispatcher
@@ -139,7 +140,7 @@ constructor(
            }
            .stateIn(scope, SharingStarted.Eagerly, false)

    private val _wakefulness = MutableStateFlow(WakefulnessModel())
    private val _wakefulness = MutableStateFlow(WakefulnessModel()).traceAs("wakefulness")
    override val wakefulness = _wakefulness.asStateFlow()

    override fun updateWakefulness(
@@ -157,7 +158,8 @@ constructor(
            )
    }

    private val _screenPowerState = MutableStateFlow(ScreenPowerState.SCREEN_OFF)
    private val _screenPowerState =
        MutableStateFlow(ScreenPowerState.SCREEN_OFF).traceAs("screenPowerState")
    override val screenPowerState = _screenPowerState.asStateFlow()

    override fun setScreenPowerState(state: ScreenPowerState) {