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.notification
18 
19 import com.android.systemui.log.LogBuffer
20 import com.android.systemui.log.LogLevel.DEBUG
21 import com.android.systemui.log.LogLevel.INFO
22 import com.android.systemui.log.dagger.NotificationLog
23 import javax.inject.Inject
24 
25 /** Logger for [NotificationEntryManager]. */
26 class NotificationEntryManagerLogger @Inject constructor(
27     @NotificationLog private val buffer: LogBuffer
28 ) {
logNotifAddednull29     fun logNotifAdded(key: String) {
30         buffer.log(TAG, INFO, {
31             str1 = key
32         }, {
33             "NOTIF ADDED $str1"
34         })
35     }
36 
logNotifUpdatednull37     fun logNotifUpdated(key: String) {
38         buffer.log(TAG, INFO, {
39             str1 = key
40         }, {
41             "NOTIF UPDATED $str1"
42         })
43     }
44 
logInflationAbortednull45     fun logInflationAborted(key: String, status: String, reason: String) {
46         buffer.log(TAG, DEBUG, {
47             str1 = key
48             str2 = status
49             str3 = reason
50         }, {
51             "NOTIF INFLATION ABORTED $str1 notifStatus=$str2 reason=$str3"
52         })
53     }
54 
logNotifInflatednull55     fun logNotifInflated(key: String, isNew: Boolean) {
56         buffer.log(TAG, DEBUG, {
57             str1 = key
58             bool1 = isNew
59         }, {
60             "NOTIF INFLATED $str1 isNew=$bool1}"
61         })
62     }
63 
logRemovalInterceptednull64     fun logRemovalIntercepted(key: String) {
65         buffer.log(TAG, INFO, {
66             str1 = key
67         }, {
68             "NOTIF REMOVE INTERCEPTED for $str1"
69         })
70     }
71 
logLifetimeExtendednull72     fun logLifetimeExtended(key: String, extenderName: String, status: String) {
73         buffer.log(TAG, INFO, {
74             str1 = key
75             str2 = extenderName
76             str3 = status
77         }, {
78             "NOTIF LIFETIME EXTENDED $str1 extender=$str2 status=$str3"
79         })
80     }
81 
logNotifRemovednull82     fun logNotifRemoved(key: String, removedByUser: Boolean) {
83         buffer.log(TAG, INFO, {
84             str1 = key
85             bool1 = removedByUser
86         }, {
87             "NOTIF REMOVED $str1 removedByUser=$bool1"
88         })
89     }
90 
logFilterAndSortnull91     fun logFilterAndSort(reason: String) {
92         buffer.log(TAG, INFO, {
93             str1 = reason
94         }, {
95             "FILTER AND SORT reason=$str1"
96         })
97     }
98 }
99 
100 private const val TAG = "NotificationEntryMgr"