• 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.LogBuffer
21 import com.android.systemui.log.LogLevel.DEBUG
22 import com.android.systemui.log.LogLevel.ERROR
23 import com.android.systemui.log.LogLevel.INFO
24 import com.android.systemui.log.LogLevel.WARNING
25 import com.android.systemui.log.dagger.NotifInteractionLog
26 import javax.inject.Inject
27 
28 class StatusBarNotificationActivityStarterLogger @Inject constructor(
29     @NotifInteractionLog private val buffer: LogBuffer
30 ) {
logStartingActivityFromClicknull31     fun logStartingActivityFromClick(key: String) {
32         buffer.log(TAG, DEBUG, {
33             str1 = key
34         }, {
35             "(1/4) onNotificationClicked: $str1"
36         })
37     }
38 
logHandleClickAfterKeyguardDismissednull39     fun logHandleClickAfterKeyguardDismissed(key: String) {
40         buffer.log(TAG, DEBUG, {
41             str1 = key
42         }, {
43             "(2/4) handleNotificationClickAfterKeyguardDismissed: $str1"
44         })
45     }
46 
logHandleClickAfterPanelCollapsednull47     fun logHandleClickAfterPanelCollapsed(key: String) {
48         buffer.log(TAG, DEBUG, {
49             str1 = key
50         }, {
51             "(3/4) handleNotificationClickAfterPanelCollapsed: $str1"
52         })
53     }
54 
logStartNotificationIntentnull55     fun logStartNotificationIntent(key: String, pendingIntent: PendingIntent) {
56         buffer.log(TAG, INFO, {
57             str1 = key
58             str2 = pendingIntent.intent.toString()
59         }, {
60             "(4/4) Starting $str2 for notification $str1"
61         })
62     }
63 
logExpandingBubblenull64     fun logExpandingBubble(key: String) {
65         buffer.log(TAG, DEBUG, {
66             str1 = key
67         }, {
68             "Expanding bubble for $str1 (rather than firing intent)"
69         })
70     }
71 
logSendingIntentFailednull72     fun logSendingIntentFailed(e: Exception) {
73         buffer.log(TAG, WARNING, {
74             str1 = e.toString()
75         }, {
76             "Sending contentIntentFailed: $str1"
77         })
78     }
79 
logNonClickableNotificationnull80     fun logNonClickableNotification(key: String) {
81         buffer.log(TAG, ERROR, {
82             str1 = key
83         }, {
84             "onNotificationClicked called for non-clickable notification! $str1"
85         })
86     }
87 
logFullScreenIntentSuppressedByDnDnull88     fun logFullScreenIntentSuppressedByDnD(key: String) {
89         buffer.log(TAG, DEBUG, {
90             str1 = key
91         }, {
92             "No Fullscreen intent: suppressed by DND: $str1"
93         })
94     }
95 
logFullScreenIntentNotImportantEnoughnull96     fun logFullScreenIntentNotImportantEnough(key: String) {
97         buffer.log(TAG, DEBUG, {
98             str1 = key
99         }, {
100             "No Fullscreen intent: not important enough: $str1"
101         })
102     }
103 
logSendingFullScreenIntentnull104     fun logSendingFullScreenIntent(key: String, pendingIntent: PendingIntent) {
105         buffer.log(TAG, INFO, {
106             str1 = key
107             str2 = pendingIntent.intent.toString()
108         }, {
109             "Notification $str1 has fullScreenIntent; sending fullScreenIntent $str2"
110         })
111     }
112 }
113 
114 private const val TAG = "NotifActivityStarter"
115