1 /*
2  * Copyright (C) 2023 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.collection.inflation
18 
19 import com.android.systemui.log.LogBuffer
20 import com.android.systemui.log.core.LogLevel
21 import com.android.systemui.log.dagger.NotifInflationLog
22 import com.android.systemui.statusbar.notification.collection.NotificationEntry
23 import com.android.systemui.statusbar.notification.collection.inflation.NotifInflater.Params
24 import com.android.systemui.statusbar.notification.logKey
25 import javax.inject.Inject
26 
27 class NotificationRowBinderLogger
28 @Inject
29 constructor(@NotifInflationLog private val buffer: LogBuffer) {
logCreatingRownull30     fun logCreatingRow(entry: NotificationEntry, params: Params) {
31         buffer.log(
32             TAG,
33             LogLevel.DEBUG,
34             {
35                 str1 = entry.logKey
36                 str2 = params.reason
37             },
38             { "creating row for $str1: $str2" }
39         )
40     }
41 
logInflatingRownull42     fun logInflatingRow(entry: NotificationEntry) {
43         buffer.log(TAG, LogLevel.DEBUG, { str1 = entry.logKey }, { "inflating row for $str1" })
44     }
45 
logInflatedRownull46     fun logInflatedRow(entry: NotificationEntry) {
47         buffer.log(TAG, LogLevel.DEBUG, { str1 = entry.logKey }, { "inflated row for $str1" })
48     }
49 
logUpdatingRownull50     fun logUpdatingRow(entry: NotificationEntry, params: Params) {
51         buffer.log(
52             TAG,
53             LogLevel.DEBUG,
54             {
55                 str1 = entry.logKey
56                 str2 = params.reason
57             },
58             { "updating row for $str1: $str2" }
59         )
60     }
61 
logReleasingViewsnull62     fun logReleasingViews(entry: NotificationEntry) {
63         buffer.log(TAG, LogLevel.DEBUG, { str1 = entry.logKey }, { "releasing views for $str1" })
64     }
65 
logNotReleasingViewsRowDoesntExistnull66     fun logNotReleasingViewsRowDoesntExist(entry: NotificationEntry) {
67         buffer.log(
68             TAG,
69             LogLevel.DEBUG,
70             { str1 = entry.logKey },
71             { "not releasing views for $str1: row doesn't exist" }
72         )
73     }
74 
logRequestingRebindnull75     fun logRequestingRebind(entry: NotificationEntry, params: Params) {
76         buffer.log(
77             TAG,
78             LogLevel.DEBUG,
79             {
80                 str1 = entry.key
81                 str2 = params.reason
82             },
83             { "requesting rebind for $str1: $str2" }
84         )
85     }
86 
logRebindCompletenull87     fun logRebindComplete(entry: NotificationEntry) {
88         buffer.log(TAG, LogLevel.DEBUG, { str1 = entry.key }, { "rebind complete for $str1" })
89     }
90 }
91 
92 private const val TAG = "NotificationRowBinder"
93