1 package com.android.systemui.statusbar.notification.stack 2 3 import android.view.ViewGroup 4 import com.android.systemui.log.LogBuffer 5 import com.android.systemui.log.core.LogLevel.DEBUG 6 import com.android.systemui.log.core.LogLevel.INFO 7 import com.android.systemui.log.core.LogLevel.ERROR 8 import com.android.systemui.log.dagger.NotificationHeadsUpLog 9 import com.android.systemui.log.dagger.NotificationRenderLog 10 import com.android.systemui.log.dagger.ShadeLog 11 import com.android.systemui.statusbar.notification.collection.NotificationEntry 12 import com.android.systemui.statusbar.notification.logKey 13 import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_ADD 14 import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_HEADS_UP_APPEAR 15 import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR 16 import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR_CLICK 17 import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_HEADS_UP_OTHER 18 import com.google.errorprone.annotations.CompileTimeConstant 19 import javax.inject.Inject 20 21 class NotificationStackScrollLogger @Inject constructor( 22 @NotificationHeadsUpLog private val buffer: LogBuffer, 23 @NotificationRenderLog private val notificationRenderBuffer: LogBuffer, 24 @ShadeLog private val shadeLogBuffer: LogBuffer, 25 ) { hunAnimationSkippednull26 fun hunAnimationSkipped(entry: String, reason: String) { 27 buffer.log(TAG, INFO, { 28 str1 = entry 29 str2 = reason 30 }, { 31 "heads up animation skipped: key: $str1 reason: $str2" 32 }) 33 } hunAnimationEventAddednull34 fun hunAnimationEventAdded(entry: String, type: Int) { 35 val reason: String 36 reason = if (type == ANIMATION_TYPE_HEADS_UP_DISAPPEAR) { 37 "HEADS_UP_DISAPPEAR" 38 } else if (type == ANIMATION_TYPE_HEADS_UP_DISAPPEAR_CLICK) { 39 "HEADS_UP_DISAPPEAR_CLICK" 40 } else if (type == ANIMATION_TYPE_HEADS_UP_APPEAR) { 41 "HEADS_UP_APPEAR" 42 } else if (type == ANIMATION_TYPE_HEADS_UP_OTHER) { 43 "HEADS_UP_OTHER" 44 } else if (type == ANIMATION_TYPE_ADD) { 45 "ADD" 46 } else { 47 type.toString() 48 } 49 buffer.log(TAG, INFO, { 50 str1 = entry 51 str2 = reason 52 }, { 53 "heads up animation added: $str1 with type $str2" 54 }) 55 } 56 hunSkippedForUnexpectedStatenull57 fun hunSkippedForUnexpectedState(entry: String, expected: Boolean, actual: Boolean) { 58 buffer.log(TAG, INFO, { 59 str1 = entry 60 bool1 = expected 61 bool2 = actual 62 }, { 63 "HUN animation skipped for unexpected hun state: " + 64 "key: $str1 expected: $bool1 actual: $bool2" 65 }) 66 } 67 logShadeDebugEventnull68 fun logShadeDebugEvent(@CompileTimeConstant msg: String) = shadeLogBuffer.log(TAG, DEBUG, msg) 69 70 fun logEmptySpaceClick( 71 isBelowLastNotification: Boolean, 72 statusBarState: Int, 73 touchIsClick: Boolean, 74 motionEventDesc: String 75 ) { 76 shadeLogBuffer.log(TAG, DEBUG, { 77 int1 = statusBarState 78 bool1 = touchIsClick 79 bool2 = isBelowLastNotification 80 str1 = motionEventDesc 81 }, { 82 "handleEmptySpaceClick: statusBarState: $int1 isTouchAClick: $bool1 " + 83 "isTouchBelowNotification: $bool2 motionEvent: $str1" 84 }) 85 } 86 transientNotificationRowTraversalCleanednull87 fun transientNotificationRowTraversalCleaned(entry: String, reason: String) { 88 notificationRenderBuffer.log(TAG, INFO, { 89 str1 = entry 90 str2 = reason 91 }, { 92 "transientNotificationRowTraversalCleaned: key: $str1 reason: $str2" 93 }) 94 } 95 addTransientChildNotificationToChildContainernull96 fun addTransientChildNotificationToChildContainer( 97 childEntry: String, 98 containerEntry: String, 99 ) { 100 notificationRenderBuffer.log(TAG, INFO, { 101 str1 = childEntry 102 str2 = containerEntry 103 }, { 104 "addTransientChildToContainer from onViewRemovedInternal: childKey: $str1 " + 105 "-- containerKey: $str2" 106 }) 107 } 108 addTransientChildNotificationToNsslnull109 fun addTransientChildNotificationToNssl( 110 childEntry: String, 111 ) { 112 notificationRenderBuffer.log(TAG, INFO, { 113 str1 = childEntry 114 }, { 115 "addTransientRowToNssl from onViewRemovedInternal: childKey: $str1" 116 }) 117 } 118 addTransientChildNotificationToViewGroupnull119 fun addTransientChildNotificationToViewGroup( 120 childEntry: String, 121 container: ViewGroup 122 ) { 123 notificationRenderBuffer.log(TAG, ERROR, { 124 str1 = childEntry 125 str2 = container.toString() 126 }, { 127 "addTransientRowTo unhandled ViewGroup from onViewRemovedInternal: childKey: $str1 " + 128 "-- ViewGroup: $str2" 129 }) 130 } 131 addTransientRownull132 fun addTransientRow( 133 childEntry: String, 134 index: Int 135 ) { 136 notificationRenderBuffer.log( 137 TAG, 138 INFO, 139 { 140 str1 = childEntry 141 int1 = index 142 }, 143 { "addTransientRow to NSSL: childKey: $str1 -- index: $int1" } 144 ) 145 } 146 removeTransientRownull147 fun removeTransientRow( 148 childEntry: String, 149 ) { 150 notificationRenderBuffer.log( 151 TAG, 152 INFO, 153 { 154 str1 = childEntry 155 }, 156 { "removeTransientRow from NSSL: childKey: $str1" } 157 ) 158 } 159 logUpdateSensitivenessWithAnimationnull160 fun logUpdateSensitivenessWithAnimation( 161 shouldAnimate: Boolean, 162 isSensitive: Boolean, 163 isSensitiveContentProtectionActive: Boolean, 164 isAnyProfilePublic: Boolean, 165 ) { 166 notificationRenderBuffer.log( 167 TAG, 168 INFO, 169 { 170 bool1 = shouldAnimate 171 bool2 = isSensitive 172 bool3 = isSensitiveContentProtectionActive 173 bool4 = isAnyProfilePublic 174 }, 175 { 176 "updateSensitivenessWithAnimation from NSSL: shouldAnimate=$bool1 " + 177 "isSensitive(hideSensitive)=$bool2 isSensitiveContentProtectionActive=$bool3 " + 178 "isAnyProfilePublic=$bool4" 179 }, 180 ) 181 } 182 logUpdateSensitivenessWithAnimationnull183 fun logUpdateSensitivenessWithAnimation(animate: Boolean, anyProfilePublicMode: Boolean) { 184 notificationRenderBuffer.log( 185 TAG, 186 INFO, 187 { 188 bool1 = animate 189 bool2 = anyProfilePublicMode 190 }, 191 { 192 "updateSensitivenessWithAnimation from NSSL: animate=$bool1 " + 193 "anyProfilePublicMode(hideSensitive)=$bool2" 194 }, 195 ) 196 } 197 } 198 199 private const val TAG = "NotificationStackScroll" 200