Ilya Matyukhin | 0916698 | 2020-10-12 13:41:03 -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 "Face.h" |
| 18 | #include "Session.h" |
| 19 | |
| 20 | namespace aidl::android::hardware::biometrics::face { |
| 21 | |
Kevin Chyn | 4e7c016 | 2020-12-11 15:45:54 -0800 | [diff] [blame] | 22 | const int kSensorId = 4; |
Kevin Chyn | cfb5499 | 2020-11-17 13:06:23 -0800 | [diff] [blame] | 23 | const common::SensorStrength kSensorStrength = common::SensorStrength::STRONG; |
Ilya Matyukhin | 0916698 | 2020-10-12 13:41:03 -0700 | [diff] [blame] | 24 | const int kMaxEnrollmentsPerUser = 5; |
| 25 | const FaceSensorType kSensorType = FaceSensorType::RGB; |
| 26 | const bool kHalControlsPreview = true; |
Haining Chen | 4861855 | 2021-03-14 17:30:09 -0700 | [diff] [blame] | 27 | const std::string kHwComponentId = "faceSensor"; |
Ilya Matyukhin | 0916698 | 2020-10-12 13:41:03 -0700 | [diff] [blame] | 28 | const std::string kHardwareVersion = "vendor/model/revision"; |
Haining Chen | 4861855 | 2021-03-14 17:30:09 -0700 | [diff] [blame] | 29 | const std::string kFirmwareVersion = "1.01"; |
Ilya Matyukhin | 0916698 | 2020-10-12 13:41:03 -0700 | [diff] [blame] | 30 | const std::string kSerialNumber = "00000001"; |
Haining Chen | 4861855 | 2021-03-14 17:30:09 -0700 | [diff] [blame] | 31 | const std::string kSwComponentId = "matchingAlgorithm"; |
| 32 | const std::string kSoftwareVersion = "vendor/version/revision"; |
Ilya Matyukhin | 0916698 | 2020-10-12 13:41:03 -0700 | [diff] [blame] | 33 | |
| 34 | ndk::ScopedAStatus Face::getSensorProps(std::vector<SensorProps>* return_val) { |
Haining Chen | 4861855 | 2021-03-14 17:30:09 -0700 | [diff] [blame] | 35 | common::ComponentInfo hw_component_info; |
| 36 | hw_component_info.componentId = kHwComponentId; |
| 37 | hw_component_info.hardwareVersion = kHardwareVersion; |
| 38 | hw_component_info.firmwareVersion = kFirmwareVersion; |
| 39 | hw_component_info.serialNumber = kSerialNumber; |
| 40 | hw_component_info.softwareVersion = ""; |
| 41 | |
| 42 | common::ComponentInfo sw_component_info; |
| 43 | sw_component_info.componentId = kSwComponentId; |
| 44 | sw_component_info.hardwareVersion = ""; |
| 45 | sw_component_info.firmwareVersion = ""; |
| 46 | sw_component_info.serialNumber = ""; |
| 47 | sw_component_info.softwareVersion = kSoftwareVersion; |
Ilya Matyukhin | 0916698 | 2020-10-12 13:41:03 -0700 | [diff] [blame] | 48 | |
| 49 | common::CommonProps commonProps; |
| 50 | commonProps.sensorId = kSensorId; |
| 51 | commonProps.sensorStrength = kSensorStrength; |
| 52 | commonProps.maxEnrollmentsPerUser = kMaxEnrollmentsPerUser; |
Haining Chen | 4861855 | 2021-03-14 17:30:09 -0700 | [diff] [blame] | 53 | commonProps.componentInfo = {std::move(hw_component_info), std::move(sw_component_info)}; |
Ilya Matyukhin | 0916698 | 2020-10-12 13:41:03 -0700 | [diff] [blame] | 54 | |
| 55 | SensorProps props; |
| 56 | props.commonProps = std::move(commonProps); |
| 57 | props.sensorType = kSensorType; |
| 58 | props.halControlsPreview = kHalControlsPreview; |
Kevin Chyn | bad7685 | 2020-11-11 13:23:35 -0800 | [diff] [blame] | 59 | props.enrollPreviewWidth = 1080; |
| 60 | props.enrollPreviewHeight = 1920; |
| 61 | props.enrollTranslationX = 100.f; |
| 62 | props.enrollTranslationY = 50.f; |
| 63 | props.enrollPreviewScale = 1.f; |
Ilya Matyukhin | 0916698 | 2020-10-12 13:41:03 -0700 | [diff] [blame] | 64 | |
| 65 | *return_val = {std::move(props)}; |
| 66 | return ndk::ScopedAStatus::ok(); |
| 67 | } |
| 68 | |
| 69 | ndk::ScopedAStatus Face::createSession(int32_t /*sensorId*/, int32_t /*userId*/, |
| 70 | const std::shared_ptr<ISessionCallback>& cb, |
| 71 | std::shared_ptr<ISession>* return_val) { |
| 72 | *return_val = SharedRefBase::make<Session>(cb); |
| 73 | return ndk::ScopedAStatus::ok(); |
| 74 | } |
| 75 | |
Ilya Matyukhin | 0916698 | 2020-10-12 13:41:03 -0700 | [diff] [blame] | 76 | } // namespace aidl::android::hardware::biometrics::face |