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.ui.controller 18 19 import com.android.systemui.biometrics.UdfpsAnimationViewController 20 import com.android.systemui.biometrics.UdfpsKeyguardView 21 import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor 22 import com.android.systemui.dump.DumpManager 23 import com.android.systemui.keyguard.ui.adapter.UdfpsKeyguardViewControllerAdapter 24 import com.android.systemui.keyguard.ui.viewmodel.UdfpsKeyguardViewModels 25 import com.android.systemui.plugins.statusbar.StatusBarStateController 26 import com.android.systemui.shade.ShadeExpansionStateManager 27 import com.android.systemui.statusbar.phone.SystemUIDialogManager 28 import kotlinx.coroutines.ExperimentalCoroutinesApi 29 30 /** Class that coordinates non-HBM animations during keyguard authentication. */ 31 @ExperimentalCoroutinesApi 32 open class UdfpsKeyguardViewController( 33 val view: UdfpsKeyguardView, 34 statusBarStateController: StatusBarStateController, 35 shadeExpansionStateManager: ShadeExpansionStateManager, 36 systemUIDialogManager: SystemUIDialogManager, 37 dumpManager: DumpManager, 38 private val alternateBouncerInteractor: AlternateBouncerInteractor, 39 udfpsKeyguardViewModels: UdfpsKeyguardViewModels, 40 ) : 41 UdfpsAnimationViewController<UdfpsKeyguardView>( 42 view, 43 statusBarStateController, 44 shadeExpansionStateManager, 45 systemUIDialogManager, 46 dumpManager, 47 ), 48 UdfpsKeyguardViewControllerAdapter { 49 private val uniqueIdentifier = this.toString() 50 override val tag: String 51 get() = TAG 52 53 init { 54 udfpsKeyguardViewModels.bindViews(view) 55 } 56 onViewAttachednull57 public override fun onViewAttached() { 58 super.onViewAttached() 59 alternateBouncerInteractor.setAlternateBouncerUIAvailable(true, uniqueIdentifier) 60 } 61 onViewDetachednull62 public override fun onViewDetached() { 63 super.onViewDetached() 64 alternateBouncerInteractor.setAlternateBouncerUIAvailable(false, uniqueIdentifier) 65 } 66 shouldPauseAuthnull67 override fun shouldPauseAuth(): Boolean { 68 return !view.isVisible() 69 } 70 listenForTouchesOutsideViewnull71 override fun listenForTouchesOutsideView(): Boolean { 72 return true 73 } 74 75 companion object { 76 private const val TAG = "UdfpsKeyguardViewController" 77 } 78 } 79