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.log.LogBuffer 20 import com.android.systemui.log.core.LogLevel.DEBUG 21 22 open class BiometricMessageDeferralLogger( 23 private val logBuffer: LogBuffer, 24 private val tag: String 25 ) { resetnull26 fun reset() { 27 logBuffer.log(tag, DEBUG, "reset") 28 } 29 logUpdateMessagenull30 fun logUpdateMessage(acquiredInfo: Int, helpString: String) { 31 logBuffer.log( 32 tag, 33 DEBUG, 34 { 35 int1 = acquiredInfo 36 str1 = helpString 37 }, 38 { "updateMessage acquiredInfo=$int1 helpString=$str1" } 39 ) 40 } 41 logFrameIgnorednull42 fun logFrameIgnored( 43 acquiredInfo: Int, 44 ) { 45 logBuffer.log(tag, DEBUG, { int1 = acquiredInfo }, { "frameIgnored acquiredInfo=$int1" }) 46 } 47 logFrameProcessednull48 fun logFrameProcessed( 49 acquiredInfo: Int, 50 totalFrames: Int, 51 mostFrequentAcquiredInfoToDefer: String? // may not meet the threshold 52 ) { 53 logBuffer.log( 54 tag, 55 DEBUG, 56 { 57 int1 = acquiredInfo 58 int2 = totalFrames 59 str1 = mostFrequentAcquiredInfoToDefer 60 }, 61 { 62 "frameProcessed acquiredInfo=$int1 totalFrames=$int2 " + 63 "messageToShowOnTimeout=$str1" 64 } 65 ) 66 } 67 } 68