1 package com.android.systemui.qs 2 3 import com.android.systemui.log.LogBuffer 4 import com.android.systemui.log.core.LogLevel 5 import com.android.systemui.log.dagger.QSDisableLog 6 import com.android.systemui.statusbar.disableflags.DisableFlagsLogger 7 import javax.inject.Inject 8 9 /** A helper class for logging disable flag changes made in [QSImpl]. */ 10 class QSDisableFlagsLogger 11 @Inject 12 constructor( 13 @QSDisableLog private val buffer: LogBuffer, 14 private val disableFlagsLogger: DisableFlagsLogger 15 ) { 16 17 /** 18 * Logs a string representing the new state received by [QSImpl] and any modifications that were 19 * made to the flags locally. 20 * 21 * @param new see [DisableFlagsLogger.getDisableFlagsString] 22 * @param newAfterLocalModification see [DisableFlagsLogger.getDisableFlagsString] 23 */ logDisableFlagChangenull24 fun logDisableFlagChange( 25 new: DisableFlagsLogger.DisableState, 26 newAfterLocalModification: DisableFlagsLogger.DisableState 27 ) { 28 buffer.log( 29 TAG, 30 LogLevel.INFO, 31 { 32 int1 = new.disable1 33 int2 = new.disable2 34 long1 = newAfterLocalModification.disable1.toLong() 35 long2 = newAfterLocalModification.disable2.toLong() 36 }, 37 { 38 disableFlagsLogger.getDisableFlagsString( 39 new = DisableFlagsLogger.DisableState(int1, int2), 40 newAfterLocalModification = 41 DisableFlagsLogger.DisableState(long1.toInt(), long2.toInt()) 42 ) 43 } 44 ) 45 } 46 } 47 48 private const val TAG = "QSDisableFlagsLog" 49