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.keyguard.logging 18 19 import com.android.systemui.dagger.SysUISingleton 20 import com.android.systemui.log.dagger.BiometricLog 21 import com.android.systemui.plugins.log.LogBuffer 22 import com.android.systemui.plugins.log.LogLevel.DEBUG 23 import javax.inject.Inject 24 25 /** Helper class for logging for [com.android.systemui.biometrics.FaceHelpMessageDeferral] */ 26 @SysUISingleton 27 class FaceMessageDeferralLogger 28 @Inject 29 constructor(@BiometricLog private val logBuffer: LogBuffer) : 30 BiometricMessageDeferralLogger(logBuffer, "FaceMessageDeferralLogger") 31 32 open class BiometricMessageDeferralLogger( 33 private val logBuffer: LogBuffer, 34 private val tag: String 35 ) { resetnull36 fun reset() { 37 logBuffer.log(tag, DEBUG, "reset") 38 } 39 logUpdateMessagenull40 fun logUpdateMessage(acquiredInfo: Int, helpString: String) { 41 logBuffer.log( 42 tag, 43 DEBUG, 44 { 45 int1 = acquiredInfo 46 str1 = helpString 47 }, 48 { "updateMessage acquiredInfo=$int1 helpString=$str1" } 49 ) 50 } 51 logFrameProcessednull52 fun logFrameProcessed( 53 acquiredInfo: Int, 54 totalFrames: Int, 55 mostFrequentAcquiredInfoToDefer: String? // may not meet the threshold 56 ) { 57 logBuffer.log( 58 tag, 59 DEBUG, 60 { 61 int1 = acquiredInfo 62 int2 = totalFrames 63 str1 = mostFrequentAcquiredInfoToDefer 64 }, 65 { 66 "frameProcessed acquiredInfo=$int1 totalFrames=$int2 " + 67 "messageToShowOnTimeout=$str1" 68 } 69 ) 70 } 71 } 72