summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Andreas Miko <amiko@google.com> 2023-11-13 14:55:14 +0100
committer Andreas Miko <amiko@google.com> 2023-11-14 15:54:13 +0100
commitd9817f4eb7ca62e7654cd174f7ac9e459cdb48e9 (patch)
tree5e87b0169c9b2da53f9b0315bd0ceb309d0bd4a0
parentcd1181e4f18629f86d1ab8bd1a9efaacf0850623 (diff)
Move KeyguardTransitionRepository logging
Transition logs are stable and very useful for debugging many scenarios and therefore should appear in standard logcat which is also easy to access in bugreports Test: NONE Bug: b/310906083 Flag: NONE Change-Id: I86db5d051cbff90f3cbb8acb91da6b8e256e6fba
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardTransitionRepository.kt36
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionAuditLogger.kt18
2 files changed, 18 insertions, 36 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardTransitionRepository.kt b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardTransitionRepository.kt
index 8d5d73f88ca1..5c76be80f1ad 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardTransitionRepository.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardTransitionRepository.kt
@@ -49,8 +49,10 @@ import kotlinx.coroutines.flow.filter
* [TransitionInteractor]. These interactors will call [startTransition] and [updateTransition] on
* this repository.
*
- * To print all transitions to logcat to help with debugging, run this command: adb shell settings
- * put global systemui/buffer/KeyguardLog VERBOSE
+ * To print all transitions to logcat to help with debugging, run this command:
+ * ```
+ * adb shell cmd statusbar echo -b KeyguardLog:VERBOSE
+ * ```
*
* This will print all keyguard transitions to logcat with the KeyguardTransitionAuditLogger tag.
*/
@@ -175,9 +177,11 @@ class KeyguardTransitionRepositoryImpl @Inject constructor() : KeyguardTransitio
override fun onAnimationStart(animation: Animator) {
emitTransition(TransitionStep(info, startingValue, TransitionState.STARTED))
}
+
override fun onAnimationCancel(animation: Animator) {
endAnimation(lastStep.value, TransitionState.CANCELED)
}
+
override fun onAnimationEnd(animation: Animator) {
endAnimation(1f, TransitionState.FINISHED)
}
@@ -222,7 +226,7 @@ class KeyguardTransitionRepositoryImpl @Inject constructor() : KeyguardTransitio
}
private fun emitTransition(nextStep: TransitionStep, isManual: Boolean = false) {
- trace(nextStep, isManual)
+ logAndTrace(nextStep, isManual)
val emitted = _transitions.tryEmit(nextStep)
if (!emitted) {
Log.w(TAG, "Failed to emit next value without suspending")
@@ -230,26 +234,22 @@ class KeyguardTransitionRepositoryImpl @Inject constructor() : KeyguardTransitio
lastStep = nextStep
}
- private fun trace(step: TransitionStep, isManual: Boolean) {
+ private fun logAndTrace(step: TransitionStep, isManual: Boolean) {
if (step.transitionState == TransitionState.RUNNING) {
return
}
- val traceName =
- "Transition: ${step.from} -> ${step.to} " +
- if (isManual) {
- "(manual)"
- } else {
- ""
- }
+ val manualStr = if (isManual) " (manual)" else ""
+ val traceName = "Transition: ${step.from} -> ${step.to}$manualStr"
+
val traceCookie = traceName.hashCode()
- if (step.transitionState == TransitionState.STARTED) {
- Trace.beginAsyncSection(traceName, traceCookie)
- } else if (
- step.transitionState == TransitionState.FINISHED ||
- step.transitionState == TransitionState.CANCELED
- ) {
- Trace.endAsyncSection(traceName, traceCookie)
+ when (step.transitionState) {
+ TransitionState.STARTED -> Trace.beginAsyncSection(traceName, traceCookie)
+ TransitionState.FINISHED -> Trace.endAsyncSection(traceName, traceCookie)
+ TransitionState.CANCELED -> Trace.endAsyncSection(traceName, traceCookie)
+ else -> {}
}
+
+ Log.i(TAG, "${step.transitionState.name} transition: $step$manualStr")
}
companion object {
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionAuditLogger.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionAuditLogger.kt
index 419524fe7730..a03fa38ec850 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionAuditLogger.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionAuditLogger.kt
@@ -75,24 +75,6 @@ constructor(
}
scope.launch {
- interactor.finishedKeyguardTransitionStep.collect {
- logger.log(TAG, VERBOSE, "Finished transition", it)
- }
- }
-
- scope.launch {
- interactor.canceledKeyguardTransitionStep.collect {
- logger.log(TAG, VERBOSE, "Canceled transition", it)
- }
- }
-
- scope.launch {
- interactor.startedKeyguardTransitionStep.collect {
- logger.log(TAG, VERBOSE, "Started transition", it)
- }
- }
-
- scope.launch {
keyguardInteractor.dozeTransitionModel.collect {
logger.log(TAG, VERBOSE, "Doze transition", it)
}