blob: 96f1e561b0348f92d0774f5668252183a7eaab98 [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
Kevin Chyne33abd62020-09-18 10:31:50 -070017#include <aidl/android/hardware/biometrics/common/BnCancellationSignal.h>
Ilya Matyukhina9a3c852020-08-18 03:09:41 -070018
19#include "Session.h"
20
21namespace aidl::android::hardware::biometrics::fingerprint {
22
Kevin Chyne33abd62020-09-18 10:31:50 -070023class CancellationSignal : public common::BnCancellationSignal {
Ilya Matyukhina9a3c852020-08-18 03:09:41 -070024 public:
25 ndk::ScopedAStatus cancel() override { return ndk::ScopedAStatus::ok(); }
26};
27
28Session::Session(std::shared_ptr<ISessionCallback> cb) : cb_(std::move(cb)) {}
29
Ilya Matyukhin3d54f452020-10-15 17:32:09 -070030ndk::ScopedAStatus Session::generateChallenge(int32_t /*cookie*/, int32_t /*timeoutSec*/) {
31 return ndk::ScopedAStatus::ok();
32}
33
34ndk::ScopedAStatus Session::revokeChallenge(int32_t /*cookie*/, int64_t /*challenge*/) {
35 return ndk::ScopedAStatus::ok();
36}
37
Ilya Matyukhina9a3c852020-08-18 03:09:41 -070038ndk::ScopedAStatus Session::enroll(int32_t /*cookie*/, const keymaster::HardwareAuthToken& /*hat*/,
Kevin Chyne33abd62020-09-18 10:31:50 -070039 std::shared_ptr<common::ICancellationSignal>* /*return_val*/) {
Ilya Matyukhina9a3c852020-08-18 03:09:41 -070040 return ndk::ScopedAStatus::ok();
41}
42
43ndk::ScopedAStatus Session::authenticate(int32_t /*cookie*/, int64_t /*keystoreOperationId*/,
Kevin Chyne33abd62020-09-18 10:31:50 -070044 std::shared_ptr<common::ICancellationSignal>* return_val) {
Ilya Matyukhina9a3c852020-08-18 03:09:41 -070045 if (cb_) {
46 cb_->onStateChanged(0, SessionState::AUTHENTICATING);
47 }
48 *return_val = SharedRefBase::make<CancellationSignal>();
49 return ndk::ScopedAStatus::ok();
50}
51
52ndk::ScopedAStatus Session::detectInteraction(
Kevin Chyne33abd62020-09-18 10:31:50 -070053 int32_t /*cookie*/, std::shared_ptr<common::ICancellationSignal>* /*return_val*/) {
Ilya Matyukhina9a3c852020-08-18 03:09:41 -070054 return ndk::ScopedAStatus::ok();
55}
56
57ndk::ScopedAStatus Session::enumerateEnrollments(int32_t /*cookie*/) {
Kevin Chynde2610f2020-10-20 18:26:50 -070058 if (cb_) {
59 cb_->onStateChanged(0, SessionState::ENUMERATING_ENROLLMENTS);
60 cb_->onEnrollmentsEnumerated(std::vector<int32_t>());
61 }
Ilya Matyukhina9a3c852020-08-18 03:09:41 -070062 return ndk::ScopedAStatus::ok();
63}
64
65ndk::ScopedAStatus Session::removeEnrollments(int32_t /*cookie*/,
66 const std::vector<int32_t>& /*enrollmentIds*/) {
Kevin Chynde2610f2020-10-20 18:26:50 -070067 if (cb_) {
68 cb_->onStateChanged(0, SessionState::REMOVING_ENROLLMENTS);
69 cb_->onEnrollmentsRemoved(std::vector<int32_t>());
70 }
Ilya Matyukhina9a3c852020-08-18 03:09:41 -070071 return ndk::ScopedAStatus::ok();
72}
73
74ndk::ScopedAStatus Session::getAuthenticatorId(int32_t /*cookie*/) {
Kevin Chynde2610f2020-10-20 18:26:50 -070075 if (cb_) {
76 cb_->onStateChanged(0, SessionState::GETTING_AUTHENTICATOR_ID);
77 cb_->onAuthenticatorIdRetrieved(0 /* authenticatorId */);
78 }
Ilya Matyukhina9a3c852020-08-18 03:09:41 -070079 return ndk::ScopedAStatus::ok();
80}
81
Kevin Chyn6e862c32020-09-16 18:27:37 -070082ndk::ScopedAStatus Session::invalidateAuthenticatorId(int32_t /*cookie*/,
Ilya Matyukhin3d54f452020-10-15 17:32:09 -070083 const keymaster::HardwareAuthToken& /*hat*/) {
Kevin Chyn6e862c32020-09-16 18:27:37 -070084 return ndk::ScopedAStatus::ok();
85}
86
Ilya Matyukhina9a3c852020-08-18 03:09:41 -070087ndk::ScopedAStatus Session::resetLockout(int32_t /*cookie*/,
88 const keymaster::HardwareAuthToken& /*hat*/) {
89 return ndk::ScopedAStatus::ok();
90}
91
92ndk::ScopedAStatus Session::onPointerDown(int32_t /*pointerId*/, int32_t /*x*/, int32_t /*y*/,
93 float /*minor*/, float /*major*/) {
94 return ndk::ScopedAStatus::ok();
95}
96
97ndk::ScopedAStatus Session::onPointerUp(int32_t /*pointerId*/) {
98 return ndk::ScopedAStatus::ok();
99}
100
101ndk::ScopedAStatus Session::onUiReady() {
102 return ndk::ScopedAStatus::ok();
103}
Ilya Matyukhina9a3c852020-08-18 03:09:41 -0700104} // namespace aidl::android::hardware::biometrics::fingerprint