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 18 package com.android.systemui.keyguard.data.repository 19 20 import com.android.systemui.keyguard.shared.model.FingerprintAuthenticationStatus 21 import kotlinx.coroutines.flow.Flow 22 import kotlinx.coroutines.flow.MutableStateFlow 23 import kotlinx.coroutines.flow.StateFlow 24 import kotlinx.coroutines.flow.asStateFlow 25 import kotlinx.coroutines.flow.filterNotNull 26 27 class FakeDeviceEntryFingerprintAuthRepository : DeviceEntryFingerprintAuthRepository { 28 private val _isLockedOut = MutableStateFlow(false) 29 override val isLockedOut: StateFlow<Boolean> = _isLockedOut.asStateFlow() 30 fun setLockedOut(lockedOut: Boolean) { 31 _isLockedOut.value = lockedOut 32 } 33 34 private val _isRunning = MutableStateFlow(false) 35 override val isRunning: Flow<Boolean> 36 get() = _isRunning 37 fun setIsRunning(value: Boolean) { 38 _isRunning.value = value 39 } 40 41 private var fpSensorType = MutableStateFlow<BiometricType?>(null) 42 override val availableFpSensorType: Flow<BiometricType?> 43 get() = fpSensorType 44 fun setAvailableFpSensorType(value: BiometricType?) { 45 fpSensorType.value = value 46 } 47 48 private var _authenticationStatus = MutableStateFlow<FingerprintAuthenticationStatus?>(null) 49 override val authenticationStatus: Flow<FingerprintAuthenticationStatus> 50 get() = _authenticationStatus.filterNotNull() 51 fun setAuthenticationStatus(status: FingerprintAuthenticationStatus) { 52 _authenticationStatus.value = status 53 } 54 } 55