blob: fa3171f850131c4dcaca3c47ac9fdd18ade7a098 [file] [log] [blame]
Ilya Matyukhina9a3c852020-08-18 03:09:41 -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 "Fingerprint.h"
18#include "Session.h"
19
20namespace aidl::android::hardware::biometrics::fingerprint {
Ilya Matyukhin124e70a2021-02-12 13:00:15 -080021namespace {
Ilya Matyukhina9a3c852020-08-18 03:09:41 -070022
Ilya Matyukhin124e70a2021-02-12 13:00:15 -080023constexpr int SENSOR_ID = 1;
24constexpr common::SensorStrength SENSOR_STRENGTH = common::SensorStrength::STRONG;
25constexpr int MAX_ENROLLMENTS_PER_USER = 5;
26constexpr FingerprintSensorType SENSOR_TYPE = FingerprintSensorType::REAR;
27constexpr bool SUPPORTS_NAVIGATION_GESTURES = true;
28constexpr char HW_DEVICE_NAME[] = "fingerprintSensor";
29constexpr char HW_VERSION[] = "vendor/model/revision";
30constexpr char FW_VERSION[] = "1.01";
31constexpr char SERIAL_NUMBER[] = "00000001";
Kevin Chyn7d3fdf52020-09-15 13:01:40 -070032
Ilya Matyukhin124e70a2021-02-12 13:00:15 -080033} // namespace
Kevin Chync306b762020-09-17 12:40:09 -070034
Ilya Matyukhin124e70a2021-02-12 13:00:15 -080035Fingerprint::Fingerprint() {}
36
37ndk::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 Matyukhina9a3c852020-08-18 03:09:41 -070052 return ndk::ScopedAStatus::ok();
53}
54
55ndk::ScopedAStatus Fingerprint::createSession(int32_t /*sensorId*/, int32_t /*userId*/,
56 const std::shared_ptr<ISessionCallback>& cb,
Ilya Matyukhin124e70a2021-02-12 13:00:15 -080057 std::shared_ptr<ISession>* out) {
58 *out = SharedRefBase::make<Session>(cb);
Ilya Matyukhina9a3c852020-08-18 03:09:41 -070059 return ndk::ScopedAStatus::ok();
60}
Ilya Matyukhina9a3c852020-08-18 03:09:41 -070061} // namespace aidl::android::hardware::biometrics::fingerprint