• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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, visible: Boolean?) {
57         buffer.log(
58             TAG,
59             LogLevel.DEBUG,
60             {
61                 int1 = host
62                 str1 = visible.toString()
63             },
64             { "Host (updateHostAttachment): $int1 visible $str1" },
65         )
66     }
67 
logUserVisibilityChangenull68     fun logUserVisibilityChange(shadeVisible: Boolean, mediaVisible: Boolean) {
69         buffer.log(
70             TAG,
71             LogLevel.DEBUG,
72             {
73                 bool1 = shadeVisible
74                 bool2 = mediaVisible
75             },
76             { "User visibility shade: $bool1 media: $bool2" },
77         )
78     }
79 }
80