1 /* 2 * Copyright (C) 2023 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.statusbar.pipeline.mobile.ui 18 19 import android.view.View 20 import com.android.systemui.common.shared.model.Icon 21 import com.android.systemui.dagger.SysUISingleton 22 import com.android.systemui.log.LogBuffer 23 import com.android.systemui.log.core.LogLevel 24 import com.android.systemui.statusbar.pipeline.dagger.VerboseMobileViewLog 25 import com.android.systemui.statusbar.pipeline.mobile.domain.model.SignalIconModel 26 import com.android.systemui.statusbar.pipeline.mobile.ui.MobileViewLogger.Companion.getIdForLogging 27 import javax.inject.Inject 28 29 /** 30 * Logs for **verbose** changes with the new mobile views. 31 * 32 * This is a hopefully temporary log until we resolve some open bugs (b/267236367, b/269565345, 33 * b/270300839). 34 */ 35 @SysUISingleton 36 class VerboseMobileViewLogger 37 @Inject 38 constructor( 39 @VerboseMobileViewLog private val buffer: LogBuffer, 40 ) { logBinderReceivedVisibilitynull41 fun logBinderReceivedVisibility(parentView: View, subId: Int, visibility: Boolean) { 42 buffer.log( 43 TAG, 44 LogLevel.VERBOSE, 45 { 46 str1 = parentView.getIdForLogging() 47 int1 = subId 48 bool1 = visibility 49 }, 50 { "Binder[subId=$int1, viewId=$str1] received visibility: $bool1" }, 51 ) 52 } 53 logBinderReceivedSignalIconnull54 fun logBinderReceivedSignalIcon(parentView: View, subId: Int, icon: SignalIconModel) { 55 buffer.log( 56 TAG, 57 LogLevel.VERBOSE, 58 { 59 str1 = parentView.getIdForLogging() 60 int1 = subId 61 int2 = icon.level 62 bool1 = if (icon is SignalIconModel.Cellular) icon.showExclamationMark else false 63 }, 64 { 65 "Binder[subId=$int1, viewId=$str1] received new signal icon: " + 66 "level=$int2 showExclamation=$bool1" 67 }, 68 ) 69 } 70 logBinderReceivedNetworkTypeIconnull71 fun logBinderReceivedNetworkTypeIcon(parentView: View, subId: Int, icon: Icon.Resource?) { 72 buffer.log( 73 TAG, 74 LogLevel.VERBOSE, 75 { 76 str1 = parentView.getIdForLogging() 77 int1 = subId 78 bool1 = icon != null 79 int2 = icon?.res ?: -1 80 }, 81 { 82 "Binder[subId=$int1, viewId=$str1] received new network type icon: " + 83 if (bool1) "resId=$int2" else "null" 84 }, 85 ) 86 } 87 } 88 89 private const val TAG = "VerboseMobileViewLogger" 90