1 /* <lambda>null2 * 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.deviceentry.ui.viewmodel 18 19 import com.android.systemui.accessibility.domain.interactor.AccessibilityInteractor 20 import com.android.systemui.biometrics.domain.interactor.UdfpsOverlayInteractor 21 import com.android.systemui.keyguard.ui.view.DeviceEntryIconView 22 import com.android.systemui.keyguard.ui.viewmodel.DeviceEntryForegroundViewModel 23 import com.android.systemui.keyguard.ui.viewmodel.DeviceEntryIconViewModel 24 import javax.inject.Inject 25 import kotlinx.coroutines.flow.Flow 26 import kotlinx.coroutines.flow.combine 27 28 /** Models the UI state for the non-alternate bouncer UDFPS accessibility overlay */ 29 class DeviceEntryUdfpsAccessibilityOverlayViewModel 30 @Inject 31 constructor( 32 udfpsOverlayInteractor: UdfpsOverlayInteractor, 33 accessibilityInteractor: AccessibilityInteractor, 34 private val deviceEntryIconViewModel: DeviceEntryIconViewModel, 35 private val deviceEntryFgIconViewModel: DeviceEntryForegroundViewModel, 36 ) : 37 UdfpsAccessibilityOverlayViewModel( 38 udfpsOverlayInteractor, 39 accessibilityInteractor, 40 ) { 41 /** Overlay is only visible if the UDFPS icon is visible on the keyguard. */ 42 override fun isVisibleWhenTouchExplorationEnabled(): Flow<Boolean> = 43 combine( 44 deviceEntryFgIconViewModel.viewModel, 45 deviceEntryIconViewModel.deviceEntryViewAlpha, 46 ) { iconViewModel, alpha -> 47 iconViewModel.type == DeviceEntryIconView.IconType.FINGERPRINT && 48 !iconViewModel.useAodVariant && 49 alpha == 1f 50 } 51 } 52