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 18 19 import com.android.systemui.dagger.SysUISingleton 20 import com.android.systemui.log.LogBuffer 21 import com.android.systemui.log.core.LogLevel.DEBUG 22 import com.android.systemui.log.dagger.NotificationRemoteInputLog 23 import javax.inject.Inject 24 25 /** Logger class for [RemoteInputController]. */ 26 @SysUISingleton 27 class RemoteInputControllerLogger 28 @Inject 29 constructor(@NotificationRemoteInputLog private val logBuffer: LogBuffer) { 30 31 /** logs addRemoteInput invocation of [RemoteInputController] */ logAddRemoteInputnull32 fun logAddRemoteInput( 33 entryKey: String, 34 isRemoteInputAlreadyActive: Boolean, 35 isRemoteInputFound: Boolean, 36 reason: String, 37 notificationStyle: String 38 ) = 39 logBuffer.log( 40 TAG, 41 DEBUG, 42 { 43 str1 = entryKey 44 str2 = reason 45 str3 = notificationStyle 46 bool1 = isRemoteInputAlreadyActive 47 bool2 = isRemoteInputFound 48 }, <lambda>null49 { 50 "addRemoteInput reason:$str2 entry: $str1, style:$str3" + 51 ", isAlreadyActive: $bool1, isFound:$bool2" 52 } 53 ) 54 55 /** logs removeRemoteInput invocation of [RemoteInputController] */ 56 @JvmOverloads logRemoveRemoteInputnull57 fun logRemoveRemoteInput( 58 entryKey: String, 59 remoteEditImeVisible: Boolean, 60 remoteEditImeAnimatingAway: Boolean, 61 isRemoteInputActiveForEntry: Boolean, 62 isRemoteInputActive: Boolean, 63 reason: String, 64 notificationStyle: String 65 ) = 66 logBuffer.log( 67 TAG, 68 DEBUG, 69 { 70 str1 = entryKey 71 str2 = reason 72 str3 = notificationStyle 73 bool1 = remoteEditImeVisible 74 bool2 = remoteEditImeAnimatingAway 75 bool3 = isRemoteInputActiveForEntry 76 bool4 = isRemoteInputActive 77 }, <lambda>null78 { 79 "removeRemoteInput reason: $str2 entry: $str1" + 80 ", style: $str3, remoteEditImeVisible: $bool1" + 81 ", remoteEditImeAnimatingAway: $bool2, isRemoteInputActiveForEntry: $bool3" + 82 ", isRemoteInputActive: $bool4" 83 } 84 ) 85 logRemoteInputApplySkippednull86 fun logRemoteInputApplySkipped(entryKey: String, reason: String, notificationStyle: String) = 87 logBuffer.log( 88 TAG, 89 DEBUG, 90 { 91 str1 = entryKey 92 str2 = reason 93 str3 = notificationStyle 94 }, <lambda>null95 { 96 "removeRemoteInput[apply is skipped] reason: $str2" + 97 "for entry: $str1, style: $str3 " 98 } 99 ) 100 101 private companion object { 102 private const val TAG = "RemoteInputControllerLog" 103 } 104 } 105