• 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
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
23 import com.android.systemui.statusbar.notification.collection.NotificationEntry
24 import javax.inject.Inject
25 
26 /**
27  * Logger class for events related to the user clicking on notification actions
28  */
29 class ActionClickLogger @Inject constructor(
30     @NotifInteractionLog private val buffer: LogBuffer
31 ) {
logInitialClicknull32     fun logInitialClick(
33         entry: String?,
34         index: Integer?,
35         pendingIntent: PendingIntent
36     ) {
37         buffer.log(TAG, LogLevel.DEBUG, {
38             str1 = entry
39             str3 = pendingIntent.toString()
40             int1 = index?.toInt() ?: Int.MIN_VALUE
41         }, {
42             "ACTION CLICK $str1 for pending intent $str3 at index $int1"
43         })
44     }
45 
logRemoteInputWasHandlednull46     fun logRemoteInputWasHandled(
47         entry: String?,
48         index: Int?
49     ) {
50         buffer.log(TAG, LogLevel.DEBUG, {
51             str1 = entry
52             int1 = index ?: Int.MIN_VALUE
53         }, {
54             "  [Action click] Triggered remote input (for $str1) at index $int1"
55         })
56     }
57 
logStartingIntentWithDefaultHandlernull58     fun logStartingIntentWithDefaultHandler(
59         entry: String?,
60         pendingIntent: PendingIntent,
61         index: Int?
62     ) {
63         buffer.log(TAG, LogLevel.DEBUG, {
64             str1 = entry
65             str2 = pendingIntent.toString()
66             int1 = index ?: Int.MIN_VALUE
67         }, {
68             "  [Action click] Launching intent $str2 via default handler (for $str1 at index $int1)"
69         })
70     }
71 
logWaitingToCloseKeyguardnull72     fun logWaitingToCloseKeyguard(
73         pendingIntent: PendingIntent,
74         index: Int?
75     ) {
76         buffer.log(TAG, LogLevel.DEBUG, {
77             str1 = pendingIntent.toString()
78             int1 = index ?: Int.MIN_VALUE
79         }, {
80             "  [Action click] Intent $str1 at index $int1 launches an activity, dismissing " +
81                     "keyguard first..."
82         })
83     }
84 
logKeyguardGonenull85     fun logKeyguardGone(
86         pendingIntent: PendingIntent,
87         index: Int?
88     ) {
89         buffer.log(TAG, LogLevel.DEBUG, {
90             str1 = pendingIntent.toString()
91             int1 = index ?: Int.MIN_VALUE
92         }, {
93             "  [Action click] Keyguard dismissed, calling default handler for intent $str1 at " +
94                     "index $int1"
95         })
96     }
97 }
98 
99 private const val TAG = "ActionClickLogger"