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.controls.ui.controller 18 19 import com.android.systemui.dagger.SysUISingleton 20 import com.android.systemui.log.LogBuffer 21 import com.android.systemui.log.core.LogLevel 22 import com.android.systemui.log.dagger.MediaViewLog 23 import javax.inject.Inject 24 25 private const val TAG = "MediaView" 26 27 /** A buffered log for media view events that are too noisy for regular logging */ 28 @SysUISingleton 29 class MediaViewLogger @Inject constructor(@MediaViewLog private val buffer: LogBuffer) { logMediaSizenull30 fun logMediaSize(reason: String, width: Int, height: Int) { 31 buffer.log( 32 TAG, 33 LogLevel.DEBUG, 34 { 35 str1 = reason 36 int1 = width 37 int2 = height 38 }, 39 { "size ($str1): $int1 x $int2" } 40 ) 41 } 42 logMediaLocationnull43 fun logMediaLocation(reason: String, startLocation: Int, endLocation: Int) { 44 buffer.log( 45 TAG, 46 LogLevel.DEBUG, 47 { 48 str1 = reason 49 int1 = startLocation 50 int2 = endLocation 51 }, 52 { "location ($str1): $int1 -> $int2" } 53 ) 54 } 55 logMediaHostAttachmentnull56 fun logMediaHostAttachment(host: Int) { 57 buffer.log(TAG, LogLevel.DEBUG, { int1 = host }, { "Host (updateHostAttachment): $int1" }) 58 } 59 } 60