• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.android.systemui.statusbar.notification.stack
2 
3 import com.android.systemui.log.dagger.NotificationHeadsUpLog
4 import com.android.systemui.plugins.log.LogBuffer
5 import com.android.systemui.plugins.log.LogLevel.DEBUG
6 import com.android.systemui.plugins.log.LogLevel.INFO
7 import com.android.systemui.statusbar.notification.collection.NotificationEntry
8 import com.android.systemui.statusbar.notification.logKey
9 import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_ADD
10 import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_HEADS_UP_APPEAR
11 import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR
12 import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR_CLICK
13 import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_HEADS_UP_OTHER
14 import com.google.errorprone.annotations.CompileTimeConstant
15 import javax.inject.Inject
16 
17 class NotificationStackScrollLogger @Inject constructor(
18     @NotificationHeadsUpLog private val buffer: LogBuffer
19 ) {
hunAnimationSkippednull20     fun hunAnimationSkipped(entry: NotificationEntry, reason: String) {
21         buffer.log(TAG, INFO, {
22             str1 = entry.logKey
23             str2 = reason
24         }, {
25             "heads up animation skipped: key: $str1 reason: $str2"
26         })
27     }
hunAnimationEventAddednull28     fun hunAnimationEventAdded(entry: NotificationEntry, type: Int) {
29         val reason: String
30         reason = if (type == ANIMATION_TYPE_HEADS_UP_DISAPPEAR) {
31             "HEADS_UP_DISAPPEAR"
32         } else if (type == ANIMATION_TYPE_HEADS_UP_DISAPPEAR_CLICK) {
33             "HEADS_UP_DISAPPEAR_CLICK"
34         } else if (type == ANIMATION_TYPE_HEADS_UP_APPEAR) {
35             "HEADS_UP_APPEAR"
36         } else if (type == ANIMATION_TYPE_HEADS_UP_OTHER) {
37             "HEADS_UP_OTHER"
38         } else if (type == ANIMATION_TYPE_ADD) {
39             "ADD"
40         } else {
41             type.toString()
42         }
43         buffer.log(TAG, INFO, {
44             str1 = entry.logKey
45             str2 = reason
46         }, {
47             "heads up animation added: $str1 with type $str2"
48         })
49     }
50 
hunSkippedForUnexpectedStatenull51     fun hunSkippedForUnexpectedState(entry: NotificationEntry, expected: Boolean, actual: Boolean) {
52         buffer.log(TAG, INFO, {
53             str1 = entry.logKey
54             bool1 = expected
55             bool2 = actual
56         }, {
57             "HUN animation skipped for unexpected hun state: " +
58                     "key: $str1 expected: $bool1 actual: $bool2"
59         })
60     }
61 
dnull62     fun d(@CompileTimeConstant msg: String) = buffer.log(TAG, DEBUG, msg)
63 
64     fun logEmptySpaceClick(
65         isBelowLastNotification: Boolean,
66         statusBarState: Int,
67         touchIsClick: Boolean,
68         motionEventDesc: String
69     ) {
70         buffer.log(TAG, DEBUG, {
71             int1 = statusBarState
72             bool1 = touchIsClick
73             bool2 = isBelowLastNotification
74             str1 = motionEventDesc
75         }, {
76             "handleEmptySpaceClick: statusBarState: $int1 isTouchAClick: $bool1 " +
77                     "isTouchBelowNotification: $bool2 motionEvent: $str1"
78         })
79     }
80 }
81 
82 private const val TAG = "NotificationStackScroll"