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.data.repository 18 19 import android.hardware.biometrics.SensorLocationInternal 20 import com.android.systemui.biometrics.shared.model.FingerprintSensorType 21 import com.android.systemui.biometrics.shared.model.SensorStrength 22 import kotlinx.coroutines.flow.MutableStateFlow 23 import kotlinx.coroutines.flow.asStateFlow 24 25 class FakeFingerprintPropertyRepository : FingerprintPropertyRepository { 26 27 private val _sensorId: MutableStateFlow<Int> = MutableStateFlow(-1) 28 override val sensorId = _sensorId.asStateFlow() 29 30 private val _strength: MutableStateFlow<SensorStrength> = 31 MutableStateFlow(SensorStrength.CONVENIENCE) 32 override val strength = _strength.asStateFlow() 33 34 private val _sensorType: MutableStateFlow<FingerprintSensorType> = 35 MutableStateFlow(FingerprintSensorType.UNKNOWN) 36 override val sensorType = _sensorType.asStateFlow() 37 38 private val _sensorLocations: MutableStateFlow<Map<String, SensorLocationInternal>> = 39 MutableStateFlow(mapOf("" to SensorLocationInternal.DEFAULT)) 40 override val sensorLocations = _sensorLocations.asStateFlow() 41 42 fun setProperties( 43 sensorId: Int, 44 strength: SensorStrength, 45 sensorType: FingerprintSensorType, 46 sensorLocations: Map<String, SensorLocationInternal> 47 ) { 48 _sensorId.value = sensorId 49 _strength.value = strength 50 _sensorType.value = sensorType 51 _sensorLocations.value = sensorLocations 52 } 53 } 54