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.biometrics 18 19 import com.android.systemui.log.LogBuffer 20 import com.android.systemui.log.core.LogLevel 21 import com.android.systemui.log.core.LogLevel.ERROR 22 import com.android.systemui.log.core.LogLevel.VERBOSE 23 import com.android.systemui.log.core.LogLevel.WARNING 24 import com.android.systemui.log.dagger.UdfpsLog 25 import com.google.errorprone.annotations.CompileTimeConstant 26 import javax.inject.Inject 27 28 private const val TAG = "UdfpsLogger" 29 30 /** Helper class for logging for Udfps */ 31 class UdfpsLogger @Inject constructor(@UdfpsLog private val logBuffer: LogBuffer) { enull32 fun e(tag: String, @CompileTimeConstant msg: String) = log(tag, msg, ERROR) 33 34 fun e(tag: String, @CompileTimeConstant msg: String, throwable: Throwable?) { 35 logBuffer.log(tag, ERROR, {}, { msg }, exception = throwable) 36 } 37 vnull38 fun v(tag: String, @CompileTimeConstant msg: String) = log(tag, msg, VERBOSE) 39 40 fun w(tag: String, @CompileTimeConstant msg: String) = log(tag, msg, WARNING) 41 42 fun log(tag: String, @CompileTimeConstant msg: String, level: LogLevel) { 43 logBuffer.log(tag, level, msg) 44 } 45 requestMaxRefreshRatenull46 fun requestMaxRefreshRate(request: Boolean) { 47 logBuffer.log("RefreshRate", LogLevel.DEBUG, { bool1 = request }, { "Request max: $bool1" }) 48 } 49 } 50