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.dagger.NotifInteractionLog
20 import com.android.systemui.log.LogBuffer
21 import com.android.systemui.log.core.LogLevel
22 import com.android.systemui.statusbar.notification.collection.NotificationEntry
23 import javax.inject.Inject
24 
25 class NotificationClickerLogger @Inject constructor(
26     @NotifInteractionLog private val buffer: LogBuffer
27 ) {
28     fun logOnClick(entry: NotificationEntry) {
29         buffer.log(TAG, LogLevel.DEBUG, {
30             str1 = entry.logKey
31             str2 = entry.ranking.channel.id
32         }, {
33             "CLICK $str1 (channel=$str2)"
34         })
35     }
36 
37     fun logMenuVisible(entry: NotificationEntry) {
38         buffer.log(TAG, LogLevel.DEBUG, {
39             str1 = entry.logKey
40         }, {
41             "Ignoring click on $str1; menu is visible"
42         })
43     }
44 
45     fun logParentMenuVisible(entry: NotificationEntry) {
46         buffer.log(TAG, LogLevel.DEBUG, {
47             str1 = entry.logKey
48         }, {
49             "Ignoring click on $str1; parent menu is visible"
50         })
51     }
52 
53     fun logChildrenExpanded(entry: NotificationEntry) {
54         buffer.log(TAG, LogLevel.DEBUG, {
55             str1 = entry.logKey
56         }, {
57             "Ignoring click on $str1; children are expanded"
58         })
59     }
60 
61     fun logGutsExposed(entry: NotificationEntry) {
62         buffer.log(TAG, LogLevel.DEBUG, {
63             str1 = entry.logKey
64         }, {
65             "Ignoring click on $str1; guts are exposed"
66         })
67     }
68 }
69 
70 private const val TAG = "NotificationClicker"
71