• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.systemui.statusbar.phone
18 
19 import android.app.PendingIntent
20 import com.android.systemui.log.dagger.NotifInteractionLog
21 import com.android.systemui.log.LogBuffer
22 import com.android.systemui.log.core.LogLevel.DEBUG
23 import com.android.systemui.log.core.LogLevel.ERROR
24 import com.android.systemui.log.core.LogLevel.INFO
25 import com.android.systemui.log.core.LogLevel.WARNING
26 import com.android.systemui.statusbar.notification.collection.NotificationEntry
27 import com.android.systemui.statusbar.notification.logKey
28 import javax.inject.Inject
29 
30 class StatusBarNotificationActivityStarterLogger @Inject constructor(
31     @NotifInteractionLog private val buffer: LogBuffer
32 ) {
logStartingActivityFromClicknull33     fun logStartingActivityFromClick(entry: NotificationEntry, isHeadsUpState: Boolean,
34                                      isKeyguardVisible: Boolean, isPanelExpanded: Boolean) {
35         buffer.log(TAG, DEBUG, {
36             str1 = entry.logKey
37             bool1 = isHeadsUpState
38             bool2 = isKeyguardVisible
39             bool3 = isPanelExpanded
40         }, {
41             "(1/5) onNotificationClicked: $str1 isHeadsUpState: $bool1 " +
42                     "isKeyguardVisible: $bool2 isPanelExpanded: $bool3"
43         })
44     }
45 
logHandleClickAfterKeyguardDismissednull46     fun logHandleClickAfterKeyguardDismissed(entry: NotificationEntry) {
47         buffer.log(TAG, DEBUG, {
48             str1 = entry.logKey
49         }, {
50             "(2/5) handleNotificationClickAfterKeyguardDismissed: $str1"
51         })
52     }
53 
logHandleClickAfterPanelCollapsednull54     fun logHandleClickAfterPanelCollapsed(entry: NotificationEntry) {
55         buffer.log(TAG, DEBUG, {
56             str1 = entry.logKey
57         }, {
58             "(3/5) handleNotificationClickAfterPanelCollapsed: $str1"
59         })
60     }
61 
logStartNotificationIntentnull62     fun logStartNotificationIntent(entry: NotificationEntry) {
63         buffer.log(TAG, INFO, {
64             str1 = entry.logKey
65         }, {
66             "(4/5) startNotificationIntent: $str1"
67         })
68     }
69 
logSendPendingIntentnull70     fun logSendPendingIntent(entry: NotificationEntry, pendingIntent: PendingIntent, result: Int) {
71         buffer.log(TAG, INFO, {
72             str1 = entry.logKey
73             str2 = pendingIntent.intent?.toString()
74             int1 = result
75         }, {
76             "(5/5) Started intent $str2 for notification $str1 with result code $int1"
77         })
78     }
79 
logCloseRemoteInputnull80     fun logCloseRemoteInput(entry: NotificationEntry) {
81         buffer.log(TAG, DEBUG, {
82             str1 = entry.logKey
83         }, {
84             "Closing remote input for $str1"
85         })
86     }
87 
logExpandingBubblenull88     fun logExpandingBubble(entry: NotificationEntry) {
89         buffer.log(TAG, DEBUG, {
90             str1 = entry.logKey
91         }, {
92             "Expanding bubble for $str1 (rather than firing intent)"
93         })
94     }
95 
logSendingIntentFailednull96     fun logSendingIntentFailed(e: Exception) {
97         buffer.log(TAG, WARNING, {
98             str1 = e.toString()
99         }, {
100             "Sending contentIntentFailed: $str1"
101         })
102     }
103 
logNonClickableNotificationnull104     fun logNonClickableNotification(entry: NotificationEntry) {
105         buffer.log(TAG, ERROR, {
106             str1 = entry.logKey
107         }, {
108             "onNotificationClicked called for non-clickable notification! $str1"
109         })
110     }
111 
logFullScreenIntentSuppressedByVRnull112     fun logFullScreenIntentSuppressedByVR(entry: NotificationEntry) {
113         buffer.log(TAG, DEBUG, {
114             str1 = entry.logKey
115         }, {
116             "No Fullscreen intent: suppressed by VR mode: $str1"
117         })
118     }
119 
logSendingFullScreenIntentnull120     fun logSendingFullScreenIntent(entry: NotificationEntry, pendingIntent: PendingIntent) {
121         buffer.log(TAG, INFO, {
122             str1 = entry.logKey
123             str2 = pendingIntent.intent?.toString()
124         }, {
125             "Notification $str1 has fullScreenIntent; sending fullScreenIntent $str2"
126         })
127     }
128 }
129 
130 private const val TAG = "NotifActivityStarter"
131