blob: 1d99ed26bcb2ffc96b864b77d3625fad19243574 [file] [log] [blame]
Ilya Matyukhin366cc532020-01-17 22:45:44 -08001/*
2 * Copyright 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#pragma once
18
Ilya Matyukhin1c0e3b72020-03-19 12:53:41 -070019#include <android/hardware/biometrics/face/1.0/IBiometricsFace.h>
Ilya Matyukhin366cc532020-01-17 22:45:44 -080020#include <hidl/MQDescriptor.h>
21#include <hidl/Status.h>
22#include <random>
23
24namespace android::hardware::biometrics::face::implementation {
25
26using ::android::sp;
27using ::android::hardware::hidl_array;
28using ::android::hardware::hidl_memory;
29using ::android::hardware::hidl_string;
30using ::android::hardware::hidl_vec;
31using ::android::hardware::Return;
32using ::android::hardware::Void;
33using ::android::hardware::biometrics::face::V1_0::Feature;
34using ::android::hardware::biometrics::face::V1_0::IBiometricsFaceClientCallback;
35using ::android::hardware::biometrics::face::V1_0::Status;
36
Ilya Matyukhin1c0e3b72020-03-19 12:53:41 -070037class BiometricsFace : public V1_0::IBiometricsFace {
Ilya Matyukhin366cc532020-01-17 22:45:44 -080038 public:
39 BiometricsFace();
40
41 // Methods from ::android::hardware::biometrics::face::V1_0::IBiometricsFace follow.
42 Return<void> setCallback(const sp<IBiometricsFaceClientCallback>& clientCallback,
43 setCallback_cb _hidl_cb) override;
44
45 Return<Status> setActiveUser(int32_t userId, const hidl_string& storePath) override;
46
47 Return<void> generateChallenge(uint32_t challengeTimeoutSec,
48 generateChallenge_cb _hidl_cb) override;
49
50 Return<Status> enroll(const hidl_vec<uint8_t>& hat, uint32_t timeoutSec,
51 const hidl_vec<Feature>& disabledFeatures) override;
52
53 Return<Status> revokeChallenge() override;
54
55 Return<Status> setFeature(Feature feature, bool enabled, const hidl_vec<uint8_t>& hat,
56 uint32_t faceId) override;
57
58 Return<void> getFeature(Feature feature, uint32_t faceId, getFeature_cb _hidl_cb) override;
59
60 Return<void> getAuthenticatorId(getAuthenticatorId_cb _hidl_cb) override;
61
62 Return<Status> cancel() override;
63
64 Return<Status> enumerate() override;
65
66 Return<Status> remove(uint32_t faceId) override;
67
68 Return<Status> authenticate(uint64_t operationId) override;
69
70 Return<Status> userActivity() override;
71
72 Return<Status> resetLockout(const hidl_vec<uint8_t>& hat) override;
73
Ilya Matyukhin366cc532020-01-17 22:45:44 -080074 private:
75 std::mt19937 mRandom;
76 int32_t mUserId;
77 sp<IBiometricsFaceClientCallback> mClientCallback;
78};
79
80} // namespace android::hardware::biometrics::face::implementation