1 /* 2 * Copyright (C) 2022 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.media.taptotransfer.common 18 19 import com.android.systemui.log.LogBuffer 20 import com.android.systemui.log.core.LogLevel 21 22 /** A helper for logging media tap-to-transfer events. */ 23 object MediaTttLoggerUtils { logStateChangenull24 fun logStateChange( 25 buffer: LogBuffer, 26 tag: String, 27 stateName: String, 28 mediaRouteId: String, 29 packageName: String?, 30 ) { 31 buffer.log( 32 tag, 33 LogLevel.DEBUG, 34 { 35 str1 = stateName 36 str2 = mediaRouteId 37 str3 = packageName 38 }, 39 { "State changed to $str1 for ID=$str2 package=$str3" } 40 ) 41 } 42 logStateChangeErrornull43 fun logStateChangeError(buffer: LogBuffer, tag: String, displayState: Int) { 44 buffer.log( 45 tag, 46 LogLevel.ERROR, 47 { int1 = displayState }, 48 { "Cannot display state=$int1; aborting" } 49 ) 50 } 51 logPackageNotFoundnull52 fun logPackageNotFound(buffer: LogBuffer, tag: String, packageName: String) { 53 buffer.log( 54 tag, 55 LogLevel.DEBUG, 56 { str1 = packageName }, 57 { "Package $str1 could not be found" } 58 ) 59 } 60 } 61