1 /* 2 * Copyright (C) 2024 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.keyguard.logging 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.core.LogLevel.DEBUG 23 import com.android.systemui.log.core.LogLevel.INFO 24 import com.android.systemui.log.dagger.DeviceEntryIconLog 25 import com.google.errorprone.annotations.CompileTimeConstant 26 import javax.inject.Inject 27 28 private const val GENERIC_TAG = "DeviceEntryIconLogger" 29 30 /** Helper class for logging for the DeviceEntryIcon */ 31 @SysUISingleton 32 class DeviceEntryIconLogger 33 @Inject 34 constructor(@DeviceEntryIconLog private val logBuffer: LogBuffer) { inull35 fun i(@CompileTimeConstant msg: String) = log(msg, INFO) 36 fun d(@CompileTimeConstant msg: String) = log(msg, DEBUG) 37 fun log(@CompileTimeConstant msg: String, level: LogLevel) = 38 logBuffer.log(GENERIC_TAG, level, msg) 39 40 fun logDeviceEntryUdfpsTouchOverlayShouldHandleTouches( 41 shouldHandleTouches: Boolean, 42 canTouchDeviceEntryViewAlpha: Boolean, 43 alternateBouncerVisible: Boolean, 44 hideAffordancesRequest: Boolean, 45 ) { 46 logBuffer.log( 47 "DeviceEntryUdfpsTouchOverlay", 48 DEBUG, 49 { 50 bool1 = canTouchDeviceEntryViewAlpha 51 bool2 = alternateBouncerVisible 52 bool3 = hideAffordancesRequest 53 bool4 = shouldHandleTouches 54 }, 55 { 56 "shouldHandleTouches=$bool4 canTouchDeviceEntryViewAlpha=$bool1 " + 57 "alternateBouncerVisible=$bool2 hideAffordancesRequest=$bool3" 58 } 59 ) 60 } 61 } 62