1 package com.android.systemui.statusbar.events 2 3 import com.android.systemui.dagger.SysUISingleton 4 import com.android.systemui.log.LogBuffer 5 import com.android.systemui.log.core.LogLevel 6 import javax.inject.Inject 7 8 /** Logs for the SystemStatusAnimationScheduler. */ 9 @SysUISingleton 10 class SystemStatusAnimationSchedulerLogger 11 @Inject 12 constructor( 13 @SystemStatusAnimationSchedulerLog private val logBuffer: LogBuffer, 14 ) { 15 logScheduleEventnull16 fun logScheduleEvent(event: StatusEvent) { 17 logBuffer.log( 18 TAG, 19 LogLevel.DEBUG, 20 { 21 str1 = event.javaClass.simpleName 22 int1 = event.priority 23 bool1 = event.forceVisible 24 bool2 = event.showAnimation 25 }, 26 { "Scheduling event: $str1(forceVisible=$bool1, priority=$int1, showAnimation=$bool2)" } 27 ) 28 } 29 logUpdateEventnull30 fun logUpdateEvent(event: StatusEvent, @SystemAnimationState animationState: Int) { 31 logBuffer.log( 32 TAG, 33 LogLevel.DEBUG, 34 { 35 str1 = event.javaClass.simpleName 36 int1 = event.priority 37 bool1 = event.forceVisible 38 bool2 = event.showAnimation 39 int2 = animationState 40 }, 41 { 42 "Updating current event from: $str1(forceVisible=$bool1, priority=$int1, " + 43 "showAnimation=$bool2), animationState=${animationState.name()}" 44 } 45 ) 46 } 47 logIgnoreEventnull48 fun logIgnoreEvent(event: StatusEvent) { 49 logBuffer.log( 50 TAG, 51 LogLevel.DEBUG, 52 { 53 str1 = event.javaClass.simpleName 54 int1 = event.priority 55 bool1 = event.forceVisible 56 bool2 = event.showAnimation 57 }, 58 { "Ignore event: $str1(forceVisible=$bool1, priority=$int1, showAnimation=$bool2)" } 59 ) 60 } 61 logHidePersistentDotCallbackInvokednull62 fun logHidePersistentDotCallbackInvoked() { 63 logBuffer.log(TAG, LogLevel.DEBUG, "Hide persistent dot callback invoked") 64 } 65 logTransitionToPersistentDotCallbackInvokednull66 fun logTransitionToPersistentDotCallbackInvoked() { 67 logBuffer.log(TAG, LogLevel.DEBUG, "Transition to persistent dot callback invoked") 68 } 69 logAnimationStateUpdatenull70 fun logAnimationStateUpdate(@SystemAnimationState animationState: Int) { 71 logBuffer.log( 72 TAG, 73 LogLevel.DEBUG, 74 { int1 = animationState }, 75 { "AnimationState update: ${int1.name()}" } 76 ) 77 animationState.name() 78 } 79 namenull80 private fun @receiver:SystemAnimationState Int.name() = 81 when (this) { 82 IDLE -> "IDLE" 83 ANIMATION_QUEUED -> "ANIMATION_QUEUED" 84 ANIMATING_IN -> "ANIMATING_IN" 85 RUNNING_CHIP_ANIM -> "RUNNING_CHIP_ANIM" 86 ANIMATING_OUT -> "ANIMATING_OUT" 87 SHOWING_PERSISTENT_DOT -> "SHOWING_PERSISTENT_DOT" 88 else -> "UNKNOWN_ANIMATION_STATE" 89 } 90 } 91 92 private const val TAG = "SystemStatusAnimationSchedulerLog" 93