1 package com.android.systemui.media.muteawait
2 
3 import com.android.systemui.dagger.SysUISingleton
4 import com.android.systemui.log.dagger.MediaMuteAwaitLog
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 [MediaMuteAwaitConnectionManager]. */
10 @SysUISingleton
11 class MediaMuteAwaitLogger @Inject constructor(
12     @MediaMuteAwaitLog private val buffer: LogBuffer
13 ) {
14     /** Logs that a muted device has been newly added. */
logMutedDeviceAddednull15     fun logMutedDeviceAdded(deviceAddress: String, deviceName: String, hasMediaUsage: Boolean) =
16         buffer.log(
17             TAG,
18             LogLevel.DEBUG,
19             {
20                 str1 = deviceAddress
21                 str2 = deviceName
22                 bool1 = hasMediaUsage
23             },
<lambda>null24             {
25                 "Muted device added: address=$str1 name=$str2 hasMediaUsage=$bool1"
26             }
27         )
28 
29     /** Logs that a muted device has been removed. */
logMutedDeviceRemovednull30     fun logMutedDeviceRemoved(
31         deviceAddress: String,
32         deviceName: String,
33         hasMediaUsage: Boolean,
34         isMostRecentDevice: Boolean
35     ) = buffer.log(
36         TAG,
37         LogLevel.DEBUG,
38         {
39             str1 = deviceAddress
40             str2 = deviceName
41             bool1 = hasMediaUsage
42             bool2 = isMostRecentDevice
43         },
<lambda>null44         {
45             "Muted device removed: " +
46                     "address=$str1 name=$str2 hasMediaUsage=$bool1 isMostRecentDevice=$bool2"
47         }
48     )
49 }
50 
51 private const val TAG = "MediaMuteAwait"
52