1 package com.android.systemui.media.nearby 2 3 import com.android.systemui.dagger.SysUISingleton 4 import com.android.systemui.log.dagger.NearbyMediaDevicesLog 5 import com.android.systemui.log.LogBuffer 6 import com.android.systemui.log.core.LogLevel 7 import javax.inject.Inject 8 9 /** Log messages for [NearbyMediaDevicesManager]. */ 10 @SysUISingleton 11 class NearbyMediaDevicesLogger @Inject constructor( 12 @NearbyMediaDevicesLog private val buffer: LogBuffer 13 ) { 14 /** 15 * Log that a new provider was registered. 16 * 17 * @param numProviders the total number of providers that are currently registered. 18 */ logProviderRegisterednull19 fun logProviderRegistered(numProviders: Int) = buffer.log( 20 TAG, 21 LogLevel.DEBUG, 22 { int1 = numProviders }, <lambda>null23 { "Provider registered; total providers = $int1" } 24 ) 25 26 /** 27 * Log that a new provider was unregistered. 28 * 29 * @param numProviders the total number of providers that are currently registered. 30 */ logProviderUnregisterednull31 fun logProviderUnregistered(numProviders: Int) = buffer.log( 32 TAG, 33 LogLevel.DEBUG, 34 { int1 = numProviders }, <lambda>null35 { "Provider unregistered; total providers = $int1" } 36 ) 37 38 /** 39 * Log that a provider's binder has died. 40 * 41 * @param numProviders the total number of providers that are currently registered. 42 */ logProviderBinderDiednull43 fun logProviderBinderDied(numProviders: Int) = buffer.log( 44 TAG, 45 LogLevel.DEBUG, 46 { int1 = numProviders }, <lambda>null47 { "Provider binder died; total providers = $int1" } 48 ) 49 } 50 51 private const val TAG = "NearbyMediaDevices" 52