1 /* 2 * Copyright (C) 2021 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.phone.fragment 18 19 import com.android.systemui.log.dagger.CollapsedSbFragmentLog 20 import com.android.systemui.log.LogBuffer 21 import com.android.systemui.log.core.LogLevel 22 import com.android.systemui.statusbar.disableflags.DisableFlagsLogger 23 import javax.inject.Inject 24 25 /** Used by [CollapsedStatusBarFragment] to log messages to a [LogBuffer]. */ 26 class CollapsedStatusBarFragmentLogger @Inject constructor( 27 @CollapsedSbFragmentLog private val buffer: LogBuffer, 28 private val disableFlagsLogger: DisableFlagsLogger, 29 ) { 30 31 /** 32 * Logs a string representing the new state received by [CollapsedStatusBarFragment] and any 33 * modifications that were made to the flags locally. 34 * 35 * @param new see [DisableFlagsLogger.getDisableFlagsString] 36 */ logDisableFlagChangenull37 fun logDisableFlagChange( 38 new: DisableFlagsLogger.DisableState, 39 ) { 40 buffer.log( 41 TAG, 42 LogLevel.INFO, 43 { 44 int1 = new.disable1 45 int2 = new.disable2 46 }, 47 { 48 disableFlagsLogger.getDisableFlagsString( 49 DisableFlagsLogger.DisableState(int1, int2), 50 ) 51 } 52 ) 53 } 54 logVisibilityModelnull55 fun logVisibilityModel(model: StatusBarVisibilityModel) { 56 buffer.log( 57 TAG, 58 LogLevel.INFO, 59 { 60 bool1 = model.showClock 61 bool2 = model.showNotificationIcons 62 bool3 = model.showOngoingActivityChip 63 bool4 = model.showSystemInfo 64 }, 65 { "New visibilities calculated internally. " + 66 "showClock=$bool1 " + 67 "showNotificationIcons=$bool2 " + 68 "showOngoingActivityChip=$bool3 " + 69 "showSystemInfo=$bool4" 70 } 71 ) 72 } 73 } 74 75 private const val TAG = "CollapsedSbFragment" 76