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 { |
| 21 | |
Kevin Chyn | 09fc704 | 2020-11-17 19:06:53 -0800 | [diff] [blame^] | 22 | const int kSensorId = 1; |
Kevin Chyn | 7d3fdf5 | 2020-09-15 13:01:40 -0700 | [diff] [blame] | 23 | const common::SensorStrength kSensorStrength = common::SensorStrength::STRONG; |
| 24 | const int kMaxEnrollmentsPerUser = 5; |
| 25 | const FingerprintSensorType kSensorType = FingerprintSensorType::REAR; |
Kevin Chyn | e33abd6 | 2020-09-18 10:31:50 -0700 | [diff] [blame] | 26 | const bool kSupportsNavigationGestures = true; |
Kevin Chyn | c306b76 | 2020-09-17 12:40:09 -0700 | [diff] [blame] | 27 | const std::string kHwDeviceName = "fingerprintSensor"; |
| 28 | const std::string kHardwareVersion = "vendor/model/revision"; |
| 29 | const std::string kFirmwareVersion = "1.01"; |
| 30 | const std::string kSerialNumber = "00000001"; |
Kevin Chyn | 7d3fdf5 | 2020-09-15 13:01:40 -0700 | [diff] [blame] | 31 | |
| 32 | ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector<SensorProps>* return_val) { |
| 33 | *return_val = std::vector<SensorProps>(); |
Kevin Chyn | c306b76 | 2020-09-17 12:40:09 -0700 | [diff] [blame] | 34 | |
| 35 | std::vector<common::HardwareInfo> hardwareInfos = std::vector<common::HardwareInfo>(); |
| 36 | common::HardwareInfo sensorInfo = {kHwDeviceName, |
| 37 | kHardwareVersion, |
| 38 | kFirmwareVersion, |
| 39 | kSerialNumber |
| 40 | }; |
| 41 | hardwareInfos.push_back(sensorInfo); |
Kevin Chyn | 7d3fdf5 | 2020-09-15 13:01:40 -0700 | [diff] [blame] | 42 | common::CommonProps commonProps = {kSensorId, |
| 43 | kSensorStrength, |
Kevin Chyn | c306b76 | 2020-09-17 12:40:09 -0700 | [diff] [blame] | 44 | kMaxEnrollmentsPerUser, |
| 45 | hardwareInfos}; |
Kevin Chyn | 7d3fdf5 | 2020-09-15 13:01:40 -0700 | [diff] [blame] | 46 | SensorProps props = {commonProps, |
Kevin Chyn | 94a8221 | 2020-09-16 18:55:39 -0700 | [diff] [blame] | 47 | kSensorType, |
Kevin Chyn | e33abd6 | 2020-09-18 10:31:50 -0700 | [diff] [blame] | 48 | kSupportsNavigationGestures, |
Kevin Chyn | 94a8221 | 2020-09-16 18:55:39 -0700 | [diff] [blame] | 49 | 0 /* sensorLocationX */, |
| 50 | 0 /* sensorLocationY */, |
| 51 | 0 /* sensorRadius */, |
| 52 | 0 /* displayId */}; |
Kevin Chyn | 7d3fdf5 | 2020-09-15 13:01:40 -0700 | [diff] [blame] | 53 | return_val->push_back(props); |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 54 | return ndk::ScopedAStatus::ok(); |
| 55 | } |
| 56 | |
| 57 | ndk::ScopedAStatus Fingerprint::createSession(int32_t /*sensorId*/, int32_t /*userId*/, |
| 58 | const std::shared_ptr<ISessionCallback>& cb, |
| 59 | std::shared_ptr<ISession>* return_val) { |
| 60 | *return_val = SharedRefBase::make<Session>(cb); |
| 61 | return ndk::ScopedAStatus::ok(); |
| 62 | } |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 63 | } // namespace aidl::android::hardware::biometrics::fingerprint |