blob: 652a7e1f6c7f59a40797f2f5f22e1de0989455f0 [file] [log] [blame]
Ilya Matyukhin09166982020-10-12 13:41:03 -07001/*
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
Joshua McCloskeydb009a52022-05-10 05:18:20 +000020#include "FakeFaceEngine.h"
21
Ilya Matyukhin09166982020-10-12 13:41:03 -070022namespace aidl::android::hardware::biometrics::face {
23
Kevin Chyn4e7c0162020-12-11 15:45:54 -080024const int kSensorId = 4;
Joshua McCloskeydb009a52022-05-10 05:18:20 +000025const common::SensorStrength kSensorStrength = FakeFaceEngine::GetSensorStrength();
Ilya Matyukhin09166982020-10-12 13:41:03 -070026const int kMaxEnrollmentsPerUser = 5;
Joshua McCloskeydb009a52022-05-10 05:18:20 +000027const FaceSensorType kSensorType = FakeFaceEngine::GetSensorType();
Ilya Matyukhin09166982020-10-12 13:41:03 -070028const bool kHalControlsPreview = true;
Haining Chen48618552021-03-14 17:30:09 -070029const std::string kHwComponentId = "faceSensor";
Ilya Matyukhin09166982020-10-12 13:41:03 -070030const std::string kHardwareVersion = "vendor/model/revision";
Haining Chen48618552021-03-14 17:30:09 -070031const std::string kFirmwareVersion = "1.01";
Ilya Matyukhin09166982020-10-12 13:41:03 -070032const std::string kSerialNumber = "00000001";
Haining Chen48618552021-03-14 17:30:09 -070033const std::string kSwComponentId = "matchingAlgorithm";
34const std::string kSoftwareVersion = "vendor/version/revision";
Ilya Matyukhin09166982020-10-12 13:41:03 -070035
36ndk::ScopedAStatus Face::getSensorProps(std::vector<SensorProps>* return_val) {
Haining Chen48618552021-03-14 17:30:09 -070037 common::ComponentInfo hw_component_info;
38 hw_component_info.componentId = kHwComponentId;
39 hw_component_info.hardwareVersion = kHardwareVersion;
40 hw_component_info.firmwareVersion = kFirmwareVersion;
41 hw_component_info.serialNumber = kSerialNumber;
42 hw_component_info.softwareVersion = "";
43
44 common::ComponentInfo sw_component_info;
45 sw_component_info.componentId = kSwComponentId;
46 sw_component_info.hardwareVersion = "";
47 sw_component_info.firmwareVersion = "";
48 sw_component_info.serialNumber = "";
49 sw_component_info.softwareVersion = kSoftwareVersion;
Ilya Matyukhin09166982020-10-12 13:41:03 -070050
51 common::CommonProps commonProps;
52 commonProps.sensorId = kSensorId;
53 commonProps.sensorStrength = kSensorStrength;
54 commonProps.maxEnrollmentsPerUser = kMaxEnrollmentsPerUser;
Haining Chen48618552021-03-14 17:30:09 -070055 commonProps.componentInfo = {std::move(hw_component_info), std::move(sw_component_info)};
Ilya Matyukhin09166982020-10-12 13:41:03 -070056
57 SensorProps props;
58 props.commonProps = std::move(commonProps);
59 props.sensorType = kSensorType;
60 props.halControlsPreview = kHalControlsPreview;
Kevin Chynbad76852020-11-11 13:23:35 -080061 props.enrollPreviewWidth = 1080;
62 props.enrollPreviewHeight = 1920;
63 props.enrollTranslationX = 100.f;
64 props.enrollTranslationY = 50.f;
65 props.enrollPreviewScale = 1.f;
Ilya Matyukhin09166982020-10-12 13:41:03 -070066
67 *return_val = {std::move(props)};
68 return ndk::ScopedAStatus::ok();
69}
70
71ndk::ScopedAStatus Face::createSession(int32_t /*sensorId*/, int32_t /*userId*/,
72 const std::shared_ptr<ISessionCallback>& cb,
73 std::shared_ptr<ISession>* return_val) {
Joshua McCloskeydb009a52022-05-10 05:18:20 +000074 *return_val = SharedRefBase::make<Session>(std::make_unique<FakeFaceEngine>(), cb);
Ilya Matyukhin09166982020-10-12 13:41:03 -070075 return ndk::ScopedAStatus::ok();
76}
77
Ilya Matyukhin09166982020-10-12 13:41:03 -070078} // namespace aidl::android::hardware::biometrics::face