summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alejandro Nijamkin <nijamkin@google.com> 2024-08-27 16:12:30 -0700
committer Alejandro Nijamkin <nijamkin@google.com> 2024-08-28 11:20:32 -0700
commitded65cc2925b8b07b7066591a50bc2e074cf54a3 (patch)
tree68cbe050377fb828c844494fe065bef4cd2c9c3a
parentd6161f27ffcacfe6c5a654c65a6ddd9b2f1333da (diff)
[flexiglass] Adds tracing to bouncer view-models
The scene view-model in BouncerSceneContentViewModel activates its child view-models depending on the current authentication method (PIN, password, or pattern). This CL adds a traceCoroutine around that. Bug: 354270224 Test: changed bouncer auth methods back and forth Flag: com.android.systemui.scene_container Change-Id: I51f3b43992d39c8a52afd07ee0d31ecdb5a5b6a0
-rw-r--r--packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/AuthMethodBouncerViewModel.kt3
-rw-r--r--packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/BouncerSceneContentViewModel.kt3
-rw-r--r--packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PasswordBouncerViewModel.kt1
-rw-r--r--packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PatternBouncerViewModel.kt1
-rw-r--r--packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModel.kt1
5 files changed, 8 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/AuthMethodBouncerViewModel.kt b/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/AuthMethodBouncerViewModel.kt
index 4250ffff86c1..c67b35424cc9 100644
--- a/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/AuthMethodBouncerViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/AuthMethodBouncerViewModel.kt
@@ -39,6 +39,9 @@ sealed class AuthMethodBouncerViewModel(
* being able to attempt to unlock the device.
*/
val isInputEnabled: StateFlow<Boolean>,
+
+ /** Name to use for performance tracing purposes. */
+ val traceName: String,
) : ExclusiveActivatable() {
private val _animateFailure = MutableStateFlow(false)
diff --git a/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/BouncerSceneContentViewModel.kt b/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/BouncerSceneContentViewModel.kt
index b83810d90ae8..b985fc4efece 100644
--- a/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/BouncerSceneContentViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/BouncerSceneContentViewModel.kt
@@ -23,6 +23,7 @@ import android.graphics.Bitmap
import androidx.compose.ui.input.key.KeyEvent
import androidx.compose.ui.input.key.type
import androidx.core.graphics.drawable.toBitmap
+import com.android.app.tracing.coroutines.traceCoroutine
import com.android.systemui.authentication.domain.interactor.AuthenticationInteractor
import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.authentication.shared.model.AuthenticationWipeModel
@@ -146,7 +147,7 @@ constructor(
.map(::getChildViewModel)
.collectLatest { childViewModelOrNull ->
_authMethodViewModel.value = childViewModelOrNull
- childViewModelOrNull?.activate()
+ childViewModelOrNull?.let { traceCoroutine(it.traceName) { it.activate() } }
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PasswordBouncerViewModel.kt b/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PasswordBouncerViewModel.kt
index c91fd6a1a18e..fc860e53aac5 100644
--- a/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PasswordBouncerViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PasswordBouncerViewModel.kt
@@ -53,6 +53,7 @@ constructor(
AuthMethodBouncerViewModel(
interactor = interactor,
isInputEnabled = isInputEnabled,
+ traceName = "PasswordBouncerViewModel",
) {
private val _password = MutableStateFlow("")
diff --git a/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PatternBouncerViewModel.kt b/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PatternBouncerViewModel.kt
index 4c029299e16b..60ec3019d09d 100644
--- a/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PatternBouncerViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PatternBouncerViewModel.kt
@@ -51,6 +51,7 @@ constructor(
AuthMethodBouncerViewModel(
interactor = interactor,
isInputEnabled = isInputEnabled,
+ traceName = "PatternBouncerViewModel",
) {
/** The number of columns in the dot grid. */
diff --git a/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModel.kt b/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModel.kt
index c6119544d2b0..db78a98d96af 100644
--- a/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/bouncer/ui/viewmodel/PinBouncerViewModel.kt
@@ -63,6 +63,7 @@ constructor(
AuthMethodBouncerViewModel(
interactor = interactor,
isInputEnabled = isInputEnabled,
+ traceName = "PinBouncerViewModel",
) {
/**
* Whether the sim-related UI in the pin view is showing.