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.LogBuffer 21 import com.android.systemui.log.LogLevel 22 import com.android.systemui.log.dagger.NotifInteractionLog 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: NotificationEntry?, 34 pendingIntent: PendingIntent 35 ) { 36 buffer.log(TAG, LogLevel.DEBUG, { 37 str1 = entry?.key 38 str2 = entry?.ranking?.channel?.id 39 str3 = pendingIntent.intent.toString() 40 }, { 41 "ACTION CLICK $str1 (channel=$str2) for pending intent $str3" 42 }) 43 } 44 logRemoteInputWasHandlednull45 fun logRemoteInputWasHandled( 46 entry: NotificationEntry? 47 ) { 48 buffer.log(TAG, LogLevel.DEBUG, { 49 str1 = entry?.key 50 }, { 51 " [Action click] Triggered remote input (for $str1))" 52 }) 53 } 54 logStartingIntentWithDefaultHandlernull55 fun logStartingIntentWithDefaultHandler( 56 entry: NotificationEntry?, 57 pendingIntent: PendingIntent 58 ) { 59 buffer.log(TAG, LogLevel.DEBUG, { 60 str1 = entry?.key 61 str2 = pendingIntent.intent.toString() 62 }, { 63 " [Action click] Launching intent $str2 via default handler (for $str1)" 64 }) 65 } 66 logWaitingToCloseKeyguardnull67 fun logWaitingToCloseKeyguard( 68 pendingIntent: PendingIntent 69 ) { 70 buffer.log(TAG, LogLevel.DEBUG, { 71 str1 = pendingIntent.intent.toString() 72 }, { 73 " [Action click] Intent $str1 launches an activity, dismissing keyguard first..." 74 }) 75 } 76 logKeyguardGonenull77 fun logKeyguardGone( 78 pendingIntent: PendingIntent 79 ) { 80 buffer.log(TAG, LogLevel.DEBUG, { 81 str1 = pendingIntent.intent.toString() 82 }, { 83 " [Action click] Keyguard dismissed, calling default handler for intent $str1" 84 }) 85 } 86 } 87 88 private const val TAG = "ActionClickLogger"