Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -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 | |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 17 | #include "Session.h" |
| 18 | |
Kevin Chyn | 146f6c8 | 2021-02-10 11:32:35 -0800 | [diff] [blame] | 19 | #include <android-base/logging.h> |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 20 | |
Joshua McCloskey | c8c0bad | 2022-05-10 05:17:44 +0000 | [diff] [blame] | 21 | #include "util/CancellationSignal.h" |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 22 | |
Jeff Pu | 5265318 | 2022-10-12 16:27:23 -0400 | [diff] [blame] | 23 | #undef LOG_TAG |
| 24 | #define LOG_TAG "FingerprintVirtualHalSession" |
| 25 | |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 26 | namespace aidl::android::hardware::biometrics::fingerprint { |
| 27 | |
Jeff Pu | 87e9f2b | 2023-05-03 17:59:21 +0000 | [diff] [blame] | 28 | void onClientDeath(void* cookie) { |
| 29 | LOG(INFO) << "FingerprintService has died"; |
| 30 | Session* session = static_cast<Session*>(cookie); |
| 31 | if (session && !session->isClosed()) { |
| 32 | session->close(); |
| 33 | } |
| 34 | } |
| 35 | |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 36 | Session::Session(int sensorId, int userId, std::shared_ptr<ISessionCallback> cb, |
| 37 | FakeFingerprintEngine* engine, WorkerThread* worker) |
| 38 | : mSensorId(sensorId), |
| 39 | mUserId(userId), |
| 40 | mCb(std::move(cb)), |
| 41 | mEngine(engine), |
| 42 | mWorker(worker), |
| 43 | mScheduledState(SessionState::IDLING), |
| 44 | mCurrentState(SessionState::IDLING) { |
| 45 | CHECK_GE(mSensorId, 0); |
| 46 | CHECK_GE(mUserId, 0); |
| 47 | CHECK(mEngine); |
| 48 | CHECK(mWorker); |
| 49 | CHECK(mCb); |
Jeff Pu | 87e9f2b | 2023-05-03 17:59:21 +0000 | [diff] [blame] | 50 | |
| 51 | mDeathRecipient = AIBinder_DeathRecipient_new(onClientDeath); |
| 52 | } |
| 53 | |
| 54 | binder_status_t Session::linkToDeath(AIBinder* binder) { |
| 55 | return AIBinder_linkToDeath(binder, mDeathRecipient, this); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 56 | } |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 57 | |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 58 | void Session::scheduleStateOrCrash(SessionState state) { |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 59 | // TODO(b/166800618): call enterIdling from the terminal callbacks and restore these checks. |
| 60 | // CHECK(mScheduledState == SessionState::IDLING); |
| 61 | // CHECK(mCurrentState == SessionState::IDLING); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 62 | mScheduledState = state; |
| 63 | } |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 64 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 65 | void Session::enterStateOrCrash(SessionState state) { |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 66 | CHECK(mScheduledState == state); |
f | 48dc9fc | 2021-03-10 04:40:58 +0000 | [diff] [blame] | 67 | mCurrentState = state; |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 68 | mScheduledState = SessionState::IDLING; |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 69 | } |
| 70 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 71 | void Session::enterIdling() { |
| 72 | // TODO(b/166800618): call enterIdling from the terminal callbacks and rethink this conditional. |
| 73 | if (mCurrentState != SessionState::CLOSED) { |
| 74 | mCurrentState = SessionState::IDLING; |
| 75 | } |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 76 | } |
| 77 | |
| 78 | bool Session::isClosed() { |
| 79 | return mCurrentState == SessionState::CLOSED; |
| 80 | } |
| 81 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 82 | ndk::ScopedAStatus Session::generateChallenge() { |
Kevin Chyn | 146f6c8 | 2021-02-10 11:32:35 -0800 | [diff] [blame] | 83 | LOG(INFO) << "generateChallenge"; |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 84 | scheduleStateOrCrash(SessionState::GENERATING_CHALLENGE); |
| 85 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 86 | mWorker->schedule(Callable::from([this] { |
| 87 | enterStateOrCrash(SessionState::GENERATING_CHALLENGE); |
f | 8c8e4c6 | 2021-03-05 05:12:58 +0000 | [diff] [blame] | 88 | mEngine->generateChallengeImpl(mCb.get()); |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 89 | enterIdling(); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 90 | })); |
| 91 | |
Ilya Matyukhin | 3d54f45 | 2020-10-15 17:32:09 -0700 | [diff] [blame] | 92 | return ndk::ScopedAStatus::ok(); |
| 93 | } |
| 94 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 95 | ndk::ScopedAStatus Session::revokeChallenge(int64_t challenge) { |
Kevin Chyn | 146f6c8 | 2021-02-10 11:32:35 -0800 | [diff] [blame] | 96 | LOG(INFO) << "revokeChallenge"; |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 97 | scheduleStateOrCrash(SessionState::REVOKING_CHALLENGE); |
| 98 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 99 | mWorker->schedule(Callable::from([this, challenge] { |
| 100 | enterStateOrCrash(SessionState::REVOKING_CHALLENGE); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 101 | mEngine->revokeChallengeImpl(mCb.get(), challenge); |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 102 | enterIdling(); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 103 | })); |
| 104 | |
Ilya Matyukhin | 3d54f45 | 2020-10-15 17:32:09 -0700 | [diff] [blame] | 105 | return ndk::ScopedAStatus::ok(); |
| 106 | } |
| 107 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 108 | ndk::ScopedAStatus Session::enroll(const keymaster::HardwareAuthToken& hat, |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 109 | std::shared_ptr<common::ICancellationSignal>* out) { |
Kevin Chyn | 146f6c8 | 2021-02-10 11:32:35 -0800 | [diff] [blame] | 110 | LOG(INFO) << "enroll"; |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 111 | scheduleStateOrCrash(SessionState::ENROLLING); |
| 112 | |
| 113 | std::promise<void> cancellationPromise; |
| 114 | auto cancFuture = cancellationPromise.get_future(); |
| 115 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 116 | mWorker->schedule(Callable::from([this, hat, cancFuture = std::move(cancFuture)] { |
| 117 | enterStateOrCrash(SessionState::ENROLLING); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 118 | if (shouldCancel(cancFuture)) { |
| 119 | mCb->onError(Error::CANCELED, 0 /* vendorCode */); |
| 120 | } else { |
Joe Bolinger | de94aa0 | 2021-12-09 17:00:32 -0800 | [diff] [blame] | 121 | mEngine->enrollImpl(mCb.get(), hat, cancFuture); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 122 | } |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 123 | enterIdling(); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 124 | })); |
| 125 | |
| 126 | *out = SharedRefBase::make<CancellationSignal>(std::move(cancellationPromise)); |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 127 | return ndk::ScopedAStatus::ok(); |
| 128 | } |
| 129 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 130 | ndk::ScopedAStatus Session::authenticate(int64_t operationId, |
Ilya Matyukhin | 124e70a | 2021-02-12 13:00:15 -0800 | [diff] [blame] | 131 | std::shared_ptr<common::ICancellationSignal>* out) { |
Kevin Chyn | 146f6c8 | 2021-02-10 11:32:35 -0800 | [diff] [blame] | 132 | LOG(INFO) << "authenticate"; |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 133 | scheduleStateOrCrash(SessionState::AUTHENTICATING); |
| 134 | |
| 135 | std::promise<void> cancPromise; |
| 136 | auto cancFuture = cancPromise.get_future(); |
| 137 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 138 | mWorker->schedule(Callable::from([this, operationId, cancFuture = std::move(cancFuture)] { |
| 139 | enterStateOrCrash(SessionState::AUTHENTICATING); |
| 140 | if (shouldCancel(cancFuture)) { |
| 141 | mCb->onError(Error::CANCELED, 0 /* vendorCode */); |
| 142 | } else { |
Joe Bolinger | de94aa0 | 2021-12-09 17:00:32 -0800 | [diff] [blame] | 143 | mEngine->authenticateImpl(mCb.get(), operationId, cancFuture); |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 144 | } |
| 145 | enterIdling(); |
| 146 | })); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 147 | |
| 148 | *out = SharedRefBase::make<CancellationSignal>(std::move(cancPromise)); |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 149 | return ndk::ScopedAStatus::ok(); |
| 150 | } |
| 151 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 152 | ndk::ScopedAStatus Session::detectInteraction(std::shared_ptr<common::ICancellationSignal>* out) { |
Kevin Chyn | 146f6c8 | 2021-02-10 11:32:35 -0800 | [diff] [blame] | 153 | LOG(INFO) << "detectInteraction"; |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 154 | scheduleStateOrCrash(SessionState::DETECTING_INTERACTION); |
| 155 | |
| 156 | std::promise<void> cancellationPromise; |
| 157 | auto cancFuture = cancellationPromise.get_future(); |
| 158 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 159 | mWorker->schedule(Callable::from([this, cancFuture = std::move(cancFuture)] { |
| 160 | enterStateOrCrash(SessionState::DETECTING_INTERACTION); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 161 | if (shouldCancel(cancFuture)) { |
| 162 | mCb->onError(Error::CANCELED, 0 /* vendorCode */); |
| 163 | } else { |
Joe Bolinger | de94aa0 | 2021-12-09 17:00:32 -0800 | [diff] [blame] | 164 | mEngine->detectInteractionImpl(mCb.get(), cancFuture); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 165 | } |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 166 | enterIdling(); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 167 | })); |
| 168 | |
| 169 | *out = SharedRefBase::make<CancellationSignal>(std::move(cancellationPromise)); |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 170 | return ndk::ScopedAStatus::ok(); |
| 171 | } |
| 172 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 173 | ndk::ScopedAStatus Session::enumerateEnrollments() { |
Kevin Chyn | 146f6c8 | 2021-02-10 11:32:35 -0800 | [diff] [blame] | 174 | LOG(INFO) << "enumerateEnrollments"; |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 175 | scheduleStateOrCrash(SessionState::ENUMERATING_ENROLLMENTS); |
| 176 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 177 | mWorker->schedule(Callable::from([this] { |
| 178 | enterStateOrCrash(SessionState::ENUMERATING_ENROLLMENTS); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 179 | mEngine->enumerateEnrollmentsImpl(mCb.get()); |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 180 | enterIdling(); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 181 | })); |
| 182 | |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 183 | return ndk::ScopedAStatus::ok(); |
| 184 | } |
| 185 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 186 | ndk::ScopedAStatus Session::removeEnrollments(const std::vector<int32_t>& enrollmentIds) { |
Jeff Pu | 63f33c7 | 2022-07-28 16:06:23 -0400 | [diff] [blame] | 187 | LOG(INFO) << "removeEnrollments, size:" << enrollmentIds.size(); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 188 | scheduleStateOrCrash(SessionState::REMOVING_ENROLLMENTS); |
| 189 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 190 | mWorker->schedule(Callable::from([this, enrollmentIds] { |
| 191 | enterStateOrCrash(SessionState::REMOVING_ENROLLMENTS); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 192 | mEngine->removeEnrollmentsImpl(mCb.get(), enrollmentIds); |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 193 | enterIdling(); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 194 | })); |
| 195 | |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 196 | return ndk::ScopedAStatus::ok(); |
| 197 | } |
| 198 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 199 | ndk::ScopedAStatus Session::getAuthenticatorId() { |
Kevin Chyn | 146f6c8 | 2021-02-10 11:32:35 -0800 | [diff] [blame] | 200 | LOG(INFO) << "getAuthenticatorId"; |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 201 | scheduleStateOrCrash(SessionState::GETTING_AUTHENTICATOR_ID); |
| 202 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 203 | mWorker->schedule(Callable::from([this] { |
| 204 | enterStateOrCrash(SessionState::GETTING_AUTHENTICATOR_ID); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 205 | mEngine->getAuthenticatorIdImpl(mCb.get()); |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 206 | enterIdling(); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 207 | })); |
| 208 | |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 209 | return ndk::ScopedAStatus::ok(); |
| 210 | } |
| 211 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 212 | ndk::ScopedAStatus Session::invalidateAuthenticatorId() { |
Kevin Chyn | 146f6c8 | 2021-02-10 11:32:35 -0800 | [diff] [blame] | 213 | LOG(INFO) << "invalidateAuthenticatorId"; |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 214 | scheduleStateOrCrash(SessionState::INVALIDATING_AUTHENTICATOR_ID); |
| 215 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 216 | mWorker->schedule(Callable::from([this] { |
| 217 | enterStateOrCrash(SessionState::INVALIDATING_AUTHENTICATOR_ID); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 218 | mEngine->invalidateAuthenticatorIdImpl(mCb.get()); |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 219 | enterIdling(); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 220 | })); |
| 221 | |
Kevin Chyn | 6e862c3 | 2020-09-16 18:27:37 -0700 | [diff] [blame] | 222 | return ndk::ScopedAStatus::ok(); |
| 223 | } |
| 224 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 225 | ndk::ScopedAStatus Session::resetLockout(const keymaster::HardwareAuthToken& hat) { |
Kevin Chyn | 146f6c8 | 2021-02-10 11:32:35 -0800 | [diff] [blame] | 226 | LOG(INFO) << "resetLockout"; |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 227 | scheduleStateOrCrash(SessionState::RESETTING_LOCKOUT); |
| 228 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 229 | mWorker->schedule(Callable::from([this, hat] { |
| 230 | enterStateOrCrash(SessionState::RESETTING_LOCKOUT); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 231 | mEngine->resetLockoutImpl(mCb.get(), hat); |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 232 | enterIdling(); |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 233 | })); |
| 234 | |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 235 | return ndk::ScopedAStatus::ok(); |
| 236 | } |
| 237 | |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 238 | ndk::ScopedAStatus Session::close() { |
Ilya Matyukhin | 71005c5 | 2021-02-17 12:44:14 -0800 | [diff] [blame] | 239 | LOG(INFO) << "close"; |
Ilya Matyukhin | aea213b | 2021-03-23 19:01:42 -0700 | [diff] [blame] | 240 | // TODO(b/166800618): call enterIdling from the terminal callbacks and restore this check. |
| 241 | // CHECK(mCurrentState == SessionState::IDLING) << "Can't close a non-idling session. |
| 242 | // Crashing."; |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 243 | mCurrentState = SessionState::CLOSED; |
Ilya Matyukhin | cbbfa93 | 2021-03-22 13:25:15 -0700 | [diff] [blame] | 244 | mCb->onSessionClosed(); |
Jeff Pu | 87e9f2b | 2023-05-03 17:59:21 +0000 | [diff] [blame] | 245 | AIBinder_DeathRecipient_delete(mDeathRecipient); |
Ilya Matyukhin | 71005c5 | 2021-02-17 12:44:14 -0800 | [diff] [blame] | 246 | return ndk::ScopedAStatus::ok(); |
| 247 | } |
| 248 | |
Jeff Pu | 63f33c7 | 2022-07-28 16:06:23 -0400 | [diff] [blame] | 249 | ndk::ScopedAStatus Session::onPointerDown(int32_t pointerId, int32_t x, int32_t y, float minor, |
| 250 | float major) { |
Kevin Chyn | 146f6c8 | 2021-02-10 11:32:35 -0800 | [diff] [blame] | 251 | LOG(INFO) << "onPointerDown"; |
Jeff Pu | 63f33c7 | 2022-07-28 16:06:23 -0400 | [diff] [blame] | 252 | mWorker->schedule(Callable::from([this, pointerId, x, y, minor, major] { |
| 253 | mEngine->onPointerDownImpl(pointerId, x, y, minor, major); |
| 254 | enterIdling(); |
| 255 | })); |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 256 | return ndk::ScopedAStatus::ok(); |
| 257 | } |
| 258 | |
Jeff Pu | 63f33c7 | 2022-07-28 16:06:23 -0400 | [diff] [blame] | 259 | ndk::ScopedAStatus Session::onPointerUp(int32_t pointerId) { |
Kevin Chyn | 146f6c8 | 2021-02-10 11:32:35 -0800 | [diff] [blame] | 260 | LOG(INFO) << "onPointerUp"; |
Jeff Pu | 63f33c7 | 2022-07-28 16:06:23 -0400 | [diff] [blame] | 261 | mWorker->schedule(Callable::from([this, pointerId] { |
| 262 | mEngine->onPointerUpImpl(pointerId); |
| 263 | enterIdling(); |
| 264 | })); |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 265 | return ndk::ScopedAStatus::ok(); |
| 266 | } |
| 267 | |
| 268 | ndk::ScopedAStatus Session::onUiReady() { |
Kevin Chyn | 146f6c8 | 2021-02-10 11:32:35 -0800 | [diff] [blame] | 269 | LOG(INFO) << "onUiReady"; |
Jeff Pu | 63f33c7 | 2022-07-28 16:06:23 -0400 | [diff] [blame] | 270 | mWorker->schedule(Callable::from([this] { |
| 271 | mEngine->onUiReadyImpl(); |
| 272 | enterIdling(); |
| 273 | })); |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 274 | return ndk::ScopedAStatus::ok(); |
| 275 | } |
Ilya Matyukhin | 48ff896 | 2021-02-22 13:13:13 -0800 | [diff] [blame] | 276 | |
Joe Bolinger | 13cb0fb | 2021-12-03 12:45:48 -0800 | [diff] [blame] | 277 | ndk::ScopedAStatus Session::authenticateWithContext( |
| 278 | int64_t operationId, const common::OperationContext& /*context*/, |
| 279 | std::shared_ptr<common::ICancellationSignal>* out) { |
| 280 | return authenticate(operationId, out); |
| 281 | } |
| 282 | |
| 283 | ndk::ScopedAStatus Session::enrollWithContext(const keymaster::HardwareAuthToken& hat, |
| 284 | const common::OperationContext& /*context*/, |
| 285 | std::shared_ptr<common::ICancellationSignal>* out) { |
| 286 | return enroll(hat, out); |
| 287 | } |
| 288 | |
| 289 | ndk::ScopedAStatus Session::detectInteractionWithContext( |
| 290 | const common::OperationContext& /*context*/, |
| 291 | std::shared_ptr<common::ICancellationSignal>* out) { |
| 292 | return detectInteraction(out); |
| 293 | } |
| 294 | |
| 295 | ndk::ScopedAStatus Session::onPointerDownWithContext(const PointerContext& context) { |
| 296 | return onPointerDown(context.pointerId, context.x, context.y, context.minor, context.major); |
| 297 | } |
| 298 | |
| 299 | ndk::ScopedAStatus Session::onPointerUpWithContext(const PointerContext& context) { |
| 300 | return onPointerUp(context.pointerId); |
| 301 | } |
| 302 | |
Joe Bolinger | 25e9823 | 2022-01-24 18:56:23 +0000 | [diff] [blame] | 303 | ndk::ScopedAStatus Session::onContextChanged(const common::OperationContext& /*context*/) { |
| 304 | return ndk::ScopedAStatus::ok(); |
| 305 | } |
| 306 | |
Austin Delgado | 88ded64 | 2023-02-16 11:34:50 -0800 | [diff] [blame] | 307 | ndk::ScopedAStatus Session::onPointerCancelWithContext(const PointerContext& /*context*/) { |
| 308 | return ndk::ScopedAStatus::ok(); |
| 309 | } |
| 310 | |
| 311 | ndk::ScopedAStatus Session::setIgnoreDisplayTouches(bool /*shouldIgnore*/) { |
| 312 | return ndk::ScopedAStatus::ok(); |
| 313 | } |
| 314 | |
Ilya Matyukhin | a9a3c85 | 2020-08-18 03:09:41 -0700 | [diff] [blame] | 315 | } // namespace aidl::android::hardware::biometrics::fingerprint |