Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2020 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 | #include "Fingerprint.h" |
| 18 | #include "Session.h" |
| 19 | |
| 20 | namespace aidl::android::hardware::biometrics::fingerprint { |
Ilya Matyukhin | 124e70a | 2021-02-12 13:00:15 -0800 | [diff] [blame^] | 21 | namespace { |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 22 | |
Ilya Matyukhin | 124e70a | 2021-02-12 13:00:15 -0800 | [diff] [blame^] | 23 | constexpr int SENSOR_ID = 1; |
| 24 | constexpr common::SensorStrength SENSOR_STRENGTH = common::SensorStrength::STRONG; |
| 25 | constexpr int MAX_ENROLLMENTS_PER_USER = 5; |
| 26 | constexpr FingerprintSensorType SENSOR_TYPE = FingerprintSensorType::REAR; |
| 27 | constexpr bool SUPPORTS_NAVIGATION_GESTURES = true; |
| 28 | constexpr char HW_DEVICE_NAME[] = "fingerprintSensor"; |
| 29 | constexpr char HW_VERSION[] = "vendor/model/revision"; |
| 30 | constexpr char FW_VERSION[] = "1.01"; |
| 31 | constexpr char SERIAL_NUMBER[] = "00000001"; |
Kevin Chyn | 7d3fdf5 | 2020-09-15 13:01:40 -0700 | [diff] [blame] | 32 | |
Ilya Matyukhin | 124e70a | 2021-02-12 13:00:15 -0800 | [diff] [blame^] | 33 | } // namespace |
Kevin Chyn | c306b76 | 2020-09-17 12:40:09 -0700 | [diff] [blame] | 34 | |
Ilya Matyukhin | 124e70a | 2021-02-12 13:00:15 -0800 | [diff] [blame^] | 35 | Fingerprint::Fingerprint() {} |
| 36 | |
| 37 | ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector<SensorProps>* out) { |
| 38 | std::vector<common::HardwareInfo> hardwareInfos = { |
| 39 | {HW_DEVICE_NAME, HW_VERSION, FW_VERSION, SERIAL_NUMBER}}; |
| 40 | |
| 41 | common::CommonProps commonProps = {SENSOR_ID, SENSOR_STRENGTH, MAX_ENROLLMENTS_PER_USER, |
| 42 | hardwareInfos}; |
| 43 | |
| 44 | SensorLocation sensorLocation = {0 /* displayId */, 0 /* sensorLocationX */, |
| 45 | 0 /* sensorLocationY */, 0 /* sensorRadius */}; |
| 46 | |
| 47 | *out = {{commonProps, |
| 48 | SENSOR_TYPE, |
| 49 | {sensorLocation}, |
| 50 | SUPPORTS_NAVIGATION_GESTURES, |
| 51 | false /* supportsDetectInteraction */}}; |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 52 | return ndk::ScopedAStatus::ok(); |
| 53 | } |
| 54 | |
| 55 | ndk::ScopedAStatus Fingerprint::createSession(int32_t /*sensorId*/, int32_t /*userId*/, |
| 56 | const std::shared_ptr<ISessionCallback>& cb, |
Ilya Matyukhin | 124e70a | 2021-02-12 13:00:15 -0800 | [diff] [blame^] | 57 | std::shared_ptr<ISession>* out) { |
| 58 | *out = SharedRefBase::make<Session>(cb); |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 59 | return ndk::ScopedAStatus::ok(); |
| 60 | } |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 61 | } // namespace aidl::android::hardware::biometrics::fingerprint |