1 /* 2 * Copyright (C) 2023 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 android.content.Context 20 import android.util.AttributeSet 21 import kotlinx.coroutines.ExperimentalCoroutinesApi 22 23 /** View corresponding with udfps_keyguard_view.xml */ 24 @ExperimentalCoroutinesApi 25 class UdfpsKeyguardView( 26 context: Context, 27 attrs: AttributeSet?, 28 ) : 29 UdfpsAnimationView( 30 context, 31 attrs, 32 ) { 33 private val fingerprintDrawablePlaceHolder = UdfpsFpDrawable(context) 34 private var visible = false 35 calculateAlphanull36 override fun calculateAlpha(): Int { 37 return if (mPauseAuth) { 38 0 39 } else 255 // ViewModels handle animating alpha values 40 } 41 getDrawablenull42 override fun getDrawable(): UdfpsDrawable { 43 return fingerprintDrawablePlaceHolder 44 } 45 isVisiblenull46 fun isVisible(): Boolean { 47 return visible 48 } 49 setVisiblenull50 fun setVisible(isVisible: Boolean) { 51 visible = isVisible 52 isPauseAuth = !visible 53 } 54 } 55