virtual adapter
diff --git a/adapter/Android.bp b/adapter/Android.bp
deleted file mode 100644
index ecfd6aa..0000000
--- a/adapter/Android.bp
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2023 LibreMobileOS Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-cc_binary {
- name: "android.hardware.biometrics.face@1.0-service.lmodroid",
- defaults: ["hidl_defaults"],
- init_rc: ["android.hardware.biometrics.face@1.0-service.lmodroid.rc"],
- relative_install_path: "hw",
- srcs: [
- "BiometricsFace.cpp",
- "FaceHalServiceCallback.cpp",
- "service.cpp",
- ],
- vendor: true,
- shared_libs: [
- "libbinder",
- "libbinder_ndk",
- "libhidlbase",
- "libutils",
- "liblog",
- "android.hardware.biometrics.face@1.0",
- "LMOFaceClient_aidl-V1-ndk",
- ],
-}
diff --git a/adapter/BiometricsFace.cpp b/adapter/BiometricsFace.cpp
deleted file mode 100644
index 92d279f..0000000
--- a/adapter/BiometricsFace.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "BiometricsFace.h"
-#include "FaceHalServiceCallback.h"
-
-namespace android::hardware::biometrics::face::implementation {
-
-BiometricsFace::BiometricsFace(IFaceHalService faceHalService) : mFaceHalService(faceHalService) {}
-
-Return<Status> intToStatus(int32_t error) {
- switch (error) {
- case 0:
- return Status::OK;
- case 1:
- return Status::ILLEGAL_ARGUMENT;
- case 2:
- return Status::OPERATION_NOT_SUPPORTED;
- case 3:
- return Status::INTERNAL_ERROR;
- case 4:
- return Status::NOT_ENROLLED;
- }
- return Status::OK;
-}
-
-// Methods from IBiometricsFace follow.
-Return<void> BiometricsFace::setCallback(const sp<IBiometricsFaceClientCallback>& clientCallback,
- setCallback_cb _hidl_cb) {
- int64_t userId = 0;
- mFaceHalService->getDeviceId(&userId);
- sp<FaceHalServiceCallback> faceHalCallback = new FaceHalServiceCallback(clientCallback);
- mFaceHalService->setCallback(faceHalCallback);
- _hidl_cb({Status::OK, (uint64_t) userId});
- return Void();
-}
-
-Return<Status> BiometricsFace::setActiveUser(int32_t userId, const hidl_string& storePath) {
- int32_t ret = 0;
- mFaceHalService->setActiveUser(userId, storePath.c_str(), &ret);
- return intToStatus(ret);
-}
-
-Return<void> BiometricsFace::generateChallenge(uint32_t timeout,
- generateChallenge_cb _hidl_cb) {
- int64_t challenge = 0;
- mFaceHalService->generateChallenge(timeout, &challenge);
- _hidl_cb({Status::OK, (uint64_t)challenge});
- return Void();
-}
-
-Return<Status> BiometricsFace::enroll(const hidl_vec<uint8_t>& hat, uint32_t timeoutSec,
- const hidl_vec<Feature>& disabledFeatures) {
- int32_t ret = 0;
- ::std::vector<int32_t> disabledFeaturesVec;
- for (int i = 0; i < disabledFeatures.size(); ++i) {
- disabledFeaturesVec.push_back(static_cast<int32_t>(disabledFeatures[i]));
- }
- mFaceHalService->enroll(hat, timeoutSec, disabledFeaturesVec, &ret);
- return intToStatus(ret);
-}
-
-Return<Status> BiometricsFace::revokeChallenge() {
- int32_t ret = 0;
- mFaceHalService->revokeChallenge(&ret);
- return intToStatus(ret);
-}
-
-Return<Status> BiometricsFace::setFeature(Feature feature, bool enabled,
- const hidl_vec<uint8_t>& hat,
- uint32_t faceId) {
- int32_t ret = 0;
- mFaceHalService->setFeature(static_cast<int32_t>(feature), enabled, hat, faceId, &ret);
- return intToStatus(ret);
-}
-
-Return<void> BiometricsFace::getFeature(Feature feature, uint32_t faceId,
- getFeature_cb _hidl_cb) {
- bool ret = false;
- mFaceHalService->getFeature(static_cast<int32_t>(feature), faceId, &ret);
- _hidl_cb({Status::OK, ret});
- return Void();
-}
-
-Return<void> BiometricsFace::getAuthenticatorId(getAuthenticatorId_cb _hidl_cb) {
- int64_t authenticatorId = 0;
- mFaceHalService->getAuthenticatorId(&authenticatorId);
- _hidl_cb({Status::OK, (uint64_t) authenticatorId});
- return Void();
-}
-
-Return<Status> BiometricsFace::cancel() {
- int32_t ret = 0;
- mFaceHalService->cancel(&ret);
- return intToStatus(ret);
-}
-
-Return<Status> BiometricsFace::enumerate() {
- int32_t ret = 0;
- mFaceHalService->enumerate(&ret);
- return intToStatus(ret);
-}
-
-Return<Status> BiometricsFace::remove(uint32_t faceId) {
- int32_t ret = 0;
- mFaceHalService->remove(faceId, &ret);
- return intToStatus(ret);
-}
-
-Return<Status> BiometricsFace::authenticate(uint64_t operationId) {
- int32_t ret = 0;
- mFaceHalService->authenticate(operationId, &ret);
- return intToStatus(ret);
-}
-
-Return<Status> BiometricsFace::userActivity() {
- int32_t ret = 0;
- mFaceHalService->userActivity(&ret);
- return intToStatus(ret);
-}
-
-Return<Status> BiometricsFace::resetLockout(const hidl_vec<uint8_t>& hat) {
- int32_t ret = 0;
- mFaceHalService->resetLockout(hat, &ret);
- return intToStatus(ret);
-}
-
-} // namespace android::hardware::biometrics::face::implementation
diff --git a/adapter/BiometricsFace.h b/adapter/BiometricsFace.h
deleted file mode 100644
index 7e415a7..0000000
--- a/adapter/BiometricsFace.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <android/hardware/biometrics/face/1.0/IBiometricsFace.h>
-#include <hidl/MQDescriptor.h>
-#include <hidl/Status.h>
-#include <random>
-
-#include <aidl/com/libremobileos/faceunlock/client/IFaceHalService.h>
-#include <aidl/com/libremobileos/faceunlock/client/IFaceHalServiceCallback.h>
-#include <aidl/com/libremobileos/faceunlock/client/BnFaceHalServiceCallback.h>
-
-namespace android::hardware::biometrics::face::implementation {
-
-using ::android::sp;
-using ::android::hardware::hidl_array;
-using ::android::hardware::hidl_memory;
-using ::android::hardware::hidl_string;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::hardware::biometrics::face::V1_0::Feature;
-using ::android::hardware::biometrics::face::V1_0::IBiometricsFaceClientCallback;
-using ::android::hardware::biometrics::face::V1_0::Status;
-
-using ::aidl::com::libremobileos::faceunlock::client::BnFaceHalServiceCallback;
-using ::aidl::com::libremobileos::faceunlock::client::IFaceHalService;
-using ::aidl::com::libremobileos::faceunlock::client::IFaceHalServiceCallback;
-
-class BiometricsFace : public V1_0::IBiometricsFace {
- public:
- BiometricsFace(IFaceHalService);
-
- // Methods from ::android::hardware::biometrics::face::V1_0::IBiometricsFace follow.
- Return<void> setCallback(const sp<IBiometricsFaceClientCallback>& clientCallback,
- setCallback_cb _hidl_cb) override;
-
- Return<Status> setActiveUser(int32_t userId, const hidl_string& storePath) override;
-
- Return<void> generateChallenge(uint32_t challengeTimeoutSec,
- generateChallenge_cb _hidl_cb) override;
-
- Return<Status> enroll(const hidl_vec<uint8_t>& hat, uint32_t timeoutSec,
- const hidl_vec<Feature>& disabledFeatures) override;
-
- Return<Status> revokeChallenge() override;
-
- Return<Status> setFeature(Feature feature, bool enabled, const hidl_vec<uint8_t>& hat,
- uint32_t faceId) override;
-
- Return<void> getFeature(Feature feature, uint32_t faceId, getFeature_cb _hidl_cb) override;
-
- Return<void> getAuthenticatorId(getAuthenticatorId_cb _hidl_cb) override;
-
- Return<Status> cancel() override;
-
- Return<Status> enumerate() override;
-
- Return<Status> remove(uint32_t faceId) override;
-
- Return<Status> authenticate(uint64_t operationId) override;
-
- Return<Status> userActivity() override;
-
- Return<Status> resetLockout(const hidl_vec<uint8_t>& hat) override;
-
- private:
- sp<IFaceHalService> mFaceHalService;
-};
-
-} // namespace android::hardware::biometrics::face::implementation
diff --git a/adapter/FaceHalServiceCallback.cpp b/adapter/FaceHalServiceCallback.cpp
deleted file mode 100644
index 3415e8e..0000000
--- a/adapter/FaceHalServiceCallback.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "FaceHalServiceCallback.h"
-
-namespace android::hardware::biometrics::face::implementation {
-
-using ::android::hardware::biometrics::face::V1_0::FaceAcquiredInfo;
-using ::android::hardware::biometrics::face::V1_0::FaceError;
-
-FaceHalServiceCallback::FaceHalServiceCallback(sp<IBiometricsFaceClientCallback> biometricsFaceClientCallback) : mBiometricsFaceClientCallback(biometricsFaceClientCallback) {}
-
-// Methods from ::com::libremobileos::faceunlock::client::IFaceHalServiceCallback follow.
-::ndk::ScopedAStatus FaceHalServiceCallback::onEnrollResult(int64_t deviceId, int32_t faceId, int32_t userId, int32_t remaining) {
- mBiometricsFaceClientCallback->onEnrollResult(deviceId, faceId, userId, remaining);
- return ::ndk::ScopedAStatus::ok();
-}
-
-::ndk::ScopedAStatus FaceHalServiceCallback::onAuthenticated(int64_t deviceId, int32_t faceId, int32_t userId, const ::std::vector<uint8_t> &token) {
- mBiometricsFaceClientCallback->onAuthenticated(deviceId, faceId, userId, token);
- return ::ndk::ScopedAStatus::ok();
-}
-
-::ndk::ScopedAStatus FaceHalServiceCallback::onAcquired(int64_t deviceId, int32_t userId, int32_t acquiredInfo, int32_t vendorCode) {
- mBiometricsFaceClientCallback->onAcquired(deviceId, userId, static_cast<FaceAcquiredInfo>(acquiredInfo), vendorCode);
- return ::ndk::ScopedAStatus::ok();
-}
-
-::ndk::ScopedAStatus FaceHalServiceCallback::onError(int64_t deviceId, int32_t userId, int32_t error, int32_t vendorCode) {
- mBiometricsFaceClientCallback->onError(deviceId, userId, static_cast<FaceError>(error), vendorCode);
- return ::ndk::ScopedAStatus::ok();
-}
-
-::ndk::ScopedAStatus FaceHalServiceCallback::onRemoved(int64_t deviceId, const ::std::vector<int32_t> &faceIds, int32_t userId) {
- std::vector<uint32_t> ufaceIds(begin(faceIds), end(faceIds));
- mBiometricsFaceClientCallback->onRemoved(deviceId, ufaceIds, userId);
- return ::ndk::ScopedAStatus::ok();
-}
-
-::ndk::ScopedAStatus FaceHalServiceCallback::onEnumerate(int64_t deviceId, const ::std::vector<int32_t> &faceIds, int32_t userId) {
- std::vector<uint32_t> ufaceIds(begin(faceIds), end(faceIds));
- mBiometricsFaceClientCallback->onEnumerate(deviceId, ufaceIds, userId);
- return ::ndk::ScopedAStatus::ok();
-}
-
-::ndk::ScopedAStatus FaceHalServiceCallback::onLockoutChanged(int64_t duration) {
- mBiometricsFaceClientCallback->onLockoutChanged(duration);
- return ::ndk::ScopedAStatus::ok();
-}
-
-} // namespace android::hardware::biometrics::face::implementation
diff --git a/adapter/FaceHalServiceCallback.h b/adapter/FaceHalServiceCallback.h
deleted file mode 100644
index abf44df..0000000
--- a/adapter/FaceHalServiceCallback.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include "BiometricsFace.h"
-
-namespace android::hardware::biometrics::face::implementation {
-
-class FaceHalServiceCallback : public BnFaceHalServiceCallback {
-public:
- FaceHalServiceCallback(sp<IBiometricsFaceClientCallback>);
-
- // Methods from ::aidl::com::libremobileos::faceunlock::client::IFaceHalServiceCallback follow.
- ::ndk::ScopedAStatus onEnrollResult(int64_t deviceId, int32_t faceId, int32_t userId, int32_t remaining) override;
-
- ::ndk::ScopedAStatus onAuthenticated(int64_t deviceId, int32_t faceId, int32_t userId, const ::std::vector<uint8_t> &token) override;
-
- ::ndk::ScopedAStatus onAcquired(int64_t deviceId, int32_t userId, int32_t acquiredInfo, int32_t vendorCode) override;
-
- ::ndk::ScopedAStatus onError(int64_t deviceId, int32_t userId, int32_t error, int32_t vendorCode) override;
-
- ::ndk::ScopedAStatus onRemoved(int64_t deviceId, const ::std::vector<int32_t> &faceIds, int32_t userId) override;
-
- ::ndk::ScopedAStatus onEnumerate(int64_t deviceId, const ::std::vector<int32_t> &faceIds, int32_t userId) override;
-
- ::ndk::ScopedAStatus onLockoutChanged(int64_t duration) override;
-
-private:
- sp<IBiometricsFaceClientCallback> mBiometricsFaceClientCallback;
-};
-
-} // namespace android::hardware::biometrics::face::implementation
diff --git a/adapter/android.hardware.biometrics.face@1.0-service.lmodroid.rc b/adapter/android.hardware.biometrics.face@1.0-service.lmodroid.rc
deleted file mode 100644
index 4495f48..0000000
--- a/adapter/android.hardware.biometrics.face@1.0-service.lmodroid.rc
+++ /dev/null
@@ -1,11 +0,0 @@
-service vendor.face-hal-1-0-lmodroid /vendor/bin/hw/android.hardware.biometrics.face@1.0-service.lmodroid
- # "class hal" causes a race condition on some devices due to files created
- # in /data. As a workaround, postpone startup until later in boot once
- # /data is mounted.
- class late_start
- user system
- group system
- writepid /dev/cpuset/foreground/tasks
- capabilities SYS_NICE
- rlimit rtprio 10 10
- disabled
diff --git a/adapter/service.cpp b/adapter/service.cpp
deleted file mode 100644
index 1614511..0000000
--- a/adapter/service.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define LOG_TAG "android.hardware.biometrics.face@1.0-service.lmodroid"
-
-#include "BiometricsFace.h"
-#include <android/hardware/biometrics/face/1.0/IBiometricsFace.h>
-#include <android/hardware/biometrics/face/1.0/types.h>
-#include <android/log.h>
-#include <android/binder_manager.h>
-#include <binder/ProcessState.h>
-#include <hidl/HidlSupport.h>
-#include <hidl/HidlTransportSupport.h>
-
-using android::IBinder;
-using android::sp;
-using android::hardware::configureRpcThreadpool;
-using android::hardware::joinRpcThreadpool;
-using android::hardware::biometrics::face::implementation::BiometricsFace;
-using android::hardware::biometrics::face::V1_0::IBiometricsFace;
-using ::aidl::com::libremobileos::faceunlock::client::IFaceHalService;
-
-int main() {
- ALOGI("LMODroid BiometricsFace HAL is being started.");
- // the conventional HAL might start binder services
- android::ProcessState::self()->setThreadPoolMaxThreadCount(4);
- android::ProcessState::self()->startThreadPool();
- configureRpcThreadpool(4, true /*callerWillJoin*/);
-
- ALOGI("Waiting for faceunlockhal service to start...");
- IFaceHalService faceHalService = IFaceHalService::fromBinder(SpAIBinder(AServiceManager_waitForService("faceunlockhal")));
-
- android::sp<IBiometricsFace> face = new BiometricsFace(faceHalService);
- const android::status_t status = face->registerAsService("lmodroid");
-
- if (status != android::OK) {
- ALOGE("Error starting the BiometricsFace HAL.");
- return 1;
- }
-
- ALOGI("BiometricsFace HAL has started successfully.");
- joinRpcThreadpool();
-
- ALOGI("BiometricsFace HAL is terminating.");
- return 1; // should never get here
-}
diff --git a/app/src/main/Android.bp b/app/src/main/Android.bp
index abc147e..1010db2 100644
--- a/app/src/main/Android.bp
+++ b/app/src/main/Android.bp
@@ -18,6 +18,4 @@
],
required: ["LMOFaceUnlockSettingsOverlay"],
jni_libs: ["libtensorflowlite_jni"],
- init_rc: ["LMOFaceUnlock.rc"],
- vintf_fragments: ["manifest_face_lmodroid.xml"],
}
diff --git a/app/src/main/LMOFaceUnlock.rc b/app/src/main/LMOFaceUnlock.rc
deleted file mode 100644
index ce9a9de..0000000
--- a/app/src/main/LMOFaceUnlock.rc
+++ /dev/null
@@ -1,2 +0,0 @@
-on post-fs-data
- start vendor.face-hal-1-0-lmodroid
diff --git a/app/src/main/manifest_face_lmodroid.xml b/app/src/main/manifest_face_lmodroid.xml
deleted file mode 100644
index 514a02d..0000000
--- a/app/src/main/manifest_face_lmodroid.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<manifest version="2.0" type="framework">
- <hal format="hidl">
- <name>android.hardware.biometrics.face</name>
- <transport>hwbinder</transport>
- <version>1.0</version>
- <interface>
- <name>IBiometricsFace</name>
- <instance>lmodroid</instance>
- </interface>
- </hal>
-</manifest>
diff --git a/framework/Android.bp b/framework/Android.bp
index 546ec1b..cd51880 100644
--- a/framework/Android.bp
+++ b/framework/Android.bp
@@ -1,24 +1,21 @@
aidl_interface {
name: "LMOFaceClient_aidl",
- vendor_available: true,
srcs: [
"client/**/*.aidl",
],
local_include_dir: "client",
- stability: "vintf",
- // cheat around setting a version
+ unstable: true,
owner: "libremobileos",
backend: {
java: {
enabled: true,
- // markVintfStability() is a platform API
platform_apis: true,
},
cpp: {
enabled: true,
},
ndk: {
- enabled: true,
+ enabled: false,
},
},
}
@@ -28,7 +25,7 @@
platform_apis: true,
srcs: ["client/**/*.java"],
static_libs: [
- "LMOFaceClient_aidl-V1-java",
+ "LMOFaceClient_aidl-java",
],
}
diff --git a/framework/aidl_api/LMOFaceClient_aidl/current/com/libremobileos/faceunlock/client/IFaceHalService.aidl b/framework/aidl_api/LMOFaceClient_aidl/current/com/libremobileos/faceunlock/client/IFaceHalService.aidl
deleted file mode 100644
index c68ed3a..0000000
--- a/framework/aidl_api/LMOFaceClient_aidl/current/com/libremobileos/faceunlock/client/IFaceHalService.aidl
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2023 LibreMobileOS Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-// the interface (from the latest frozen version), the build system will
-// prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package com.libremobileos.faceunlock.client;
-@VintfStability
-interface IFaceHalService {
- long getDeviceId();
- oneway void setCallback(in com.libremobileos.faceunlock.client.IFaceHalServiceCallback callback);
- int setActiveUser(int userId, String storePath);
- long generateChallenge(int timeout);
- int enroll(in byte[] token, int timeout, in int[] disabledFeatures);
- int revokeChallenge();
- int setFeature(int feature, boolean enable, in byte[] token, int faceId);
- boolean getFeature(int feature, int faceId);
- long getAuthenticatorId();
- int cancel();
- int enumerate();
- int remove(int faceId);
- int authenticate(long operationId);
- int userActivity();
- int resetLockout(in byte[] token);
-}
diff --git a/framework/aidl_api/LMOFaceClient_aidl/current/com/libremobileos/faceunlock/client/IFaceHalServiceCallback.aidl b/framework/aidl_api/LMOFaceClient_aidl/current/com/libremobileos/faceunlock/client/IFaceHalServiceCallback.aidl
deleted file mode 100644
index f6fbae6..0000000
--- a/framework/aidl_api/LMOFaceClient_aidl/current/com/libremobileos/faceunlock/client/IFaceHalServiceCallback.aidl
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2023 LibreMobileOS Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-// the interface (from the latest frozen version), the build system will
-// prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package com.libremobileos.faceunlock.client;
-@VintfStability
-interface IFaceHalServiceCallback {
- oneway void onEnrollResult(long deviceId, int faceId, int userId, int remaining);
- oneway void onAuthenticated(long deviceId, int faceId, int userId, in byte[] token);
- oneway void onAcquired(long deviceId, int userId, int acquiredInfo, int vendorCode);
- oneway void onError(long deviceId, int userId, int error, int vendorCode);
- oneway void onRemoved(long deviceId, in int[] faceIds, int userId);
- oneway void onEnumerate(long deviceId, in int[] faceIds, int userId);
- oneway void onLockoutChanged(long duration);
-}
diff --git a/framework/aidl_api/LMOFaceClient_aidl/current/com/libremobileos/faceunlock/client/IFaceUnlockManager.aidl b/framework/aidl_api/LMOFaceClient_aidl/current/com/libremobileos/faceunlock/client/IFaceUnlockManager.aidl
deleted file mode 100644
index 615eb2d..0000000
--- a/framework/aidl_api/LMOFaceClient_aidl/current/com/libremobileos/faceunlock/client/IFaceUnlockManager.aidl
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2023 LibreMobileOS Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-// the interface (from the latest frozen version), the build system will
-// prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package com.libremobileos.faceunlock.client;
-@VintfStability
-interface IFaceUnlockManager {
- void enrollResult(int remaining);
- void error(int error);
- void finishEnroll(String encodedFaces, in byte[] token);
-}
diff --git a/framework/client/com/libremobileos/faceunlock/client/IFaceHalService.aidl b/framework/client/com/libremobileos/faceunlock/client/IFaceHalService.aidl
index 55a79dd..f4ee366 100644
--- a/framework/client/com/libremobileos/faceunlock/client/IFaceHalService.aidl
+++ b/framework/client/com/libremobileos/faceunlock/client/IFaceHalService.aidl
@@ -18,7 +18,6 @@
import com.libremobileos.faceunlock.client.IFaceHalServiceCallback;
-@VintfStability
interface IFaceHalService {
long getDeviceId();
diff --git a/framework/client/com/libremobileos/faceunlock/client/IFaceHalServiceCallback.aidl b/framework/client/com/libremobileos/faceunlock/client/IFaceHalServiceCallback.aidl
index 379ab42..f92bfe9 100644
--- a/framework/client/com/libremobileos/faceunlock/client/IFaceHalServiceCallback.aidl
+++ b/framework/client/com/libremobileos/faceunlock/client/IFaceHalServiceCallback.aidl
@@ -16,7 +16,6 @@
package com.libremobileos.faceunlock.client;
-@VintfStability
oneway interface IFaceHalServiceCallback {
void onEnrollResult(long deviceId, int faceId, int userId, int remaining);
diff --git a/framework/client/com/libremobileos/faceunlock/client/IFaceUnlockManager.aidl b/framework/client/com/libremobileos/faceunlock/client/IFaceUnlockManager.aidl
index 389c82d..39909b1 100644
--- a/framework/client/com/libremobileos/faceunlock/client/IFaceUnlockManager.aidl
+++ b/framework/client/com/libremobileos/faceunlock/client/IFaceUnlockManager.aidl
@@ -16,7 +16,6 @@
package com.libremobileos.faceunlock.client;
-@VintfStability
interface IFaceUnlockManager {
void enrollResult(int remaining);
void error(int error);
diff --git a/framework/server/com/libremobileos/faceunlock/client/FaceCallbackAdapter.java b/framework/server/com/libremobileos/faceunlock/client/FaceCallbackAdapter.java
new file mode 100644
index 0000000..b6e2f02
--- /dev/null
+++ b/framework/server/com/libremobileos/faceunlock/client/FaceCallbackAdapter.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2023 LibreMobileOS Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.libremobileos.faceunlock.client;
+
+import android.hardware.biometrics.face.V1_0.IBiometricsFaceClientCallback;
+import android.os.RemoteException;
+
+import java.util.ArrayList;
+
+public class FaceCallbackAdapter extends IFaceHalServiceCallback.Stub {
+ private final IBiometricsFaceClientCallback mCallback;
+
+ /* package-private */ FaceCallbackAdapter(IBiometricsFaceClientCallback callback) {
+ this.mCallback = callback;
+ }
+
+ @Override
+ public void onEnrollResult(long deviceId, int faceId, int userId, int remaining) throws RemoteException {
+ mCallback.onEnrollResult(deviceId, faceId, userId, remaining);
+ }
+
+ @Override
+ public void onAuthenticated(long deviceId, int faceId, int userId, byte[] token) throws RemoteException {
+ mCallback.onAuthenticated(deviceId, faceId, userId, convertArr(token));
+ }
+
+ @Override
+ public void onAcquired(long deviceId, int userId, int acquiredInfo, int vendorCode) throws RemoteException {
+ mCallback.onAcquired(deviceId, userId, acquiredInfo, vendorCode);
+ }
+
+ @Override
+ public void onError(long deviceId, int userId, int error, int vendorCode) throws RemoteException {
+ mCallback.onError(deviceId, userId, error, vendorCode);
+ }
+
+ @Override
+ public void onRemoved(long deviceId, int[] faceIds, int userId) throws RemoteException {
+ mCallback.onRemoved(deviceId, convertArr(faceIds), userId);
+ }
+
+ @Override
+ public void onEnumerate(long deviceId, int[] faceIds, int userId) throws RemoteException {
+ mCallback.onEnumerate(deviceId, convertArr(faceIds), userId);
+ }
+
+ @Override
+ public void onLockoutChanged(long duration) throws RemoteException {
+ mCallback.onLockoutChanged(duration);
+ }
+
+ private static ArrayList<Integer> convertArr(int[] ar) {
+ ArrayList<Integer> ret = new ArrayList<>();;
+ for (int b : ar) {
+ ret.add(b);
+ }
+ return ret;
+ }
+
+ private static ArrayList<Byte> convertArr(byte[] ar) {
+ ArrayList<Byte> ret = new ArrayList<>();;
+ for (byte b : ar) {
+ ret.add(b);
+ }
+ return ret;
+ }
+}
diff --git a/framework/server/com/libremobileos/faceunlock/client/FaceUnlockHalManager.java b/framework/server/com/libremobileos/faceunlock/client/FaceUnlockHalManager.java
new file mode 100644
index 0000000..63f3211
--- /dev/null
+++ b/framework/server/com/libremobileos/faceunlock/client/FaceUnlockHalManager.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2023 LibreMobileOS Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.libremobileos.faceunlock.client;
+
+import android.hardware.biometrics.face.V1_0.IBiometricsFace;
+import android.os.ServiceManager;
+import android.util.Log;
+
+public final class FaceUnlockHalManager {
+
+ public static final String SERVICE_NAME = "faceunlockhal";
+ private static final String TAG = "FaceUnlockHalManager";
+
+ public static IBiometricsFace getIBiometricsFace() {
+ IFaceHalService faceHalService = IFaceHalService.Stub.asInterface(
+ ServiceManager.getService(SERVICE_NAME));
+ if (faceHalService == null) {
+ Log.e(TAG, "Unable to get IFaceHalService.");
+ return null;
+ }
+ return new FakeBiometricsFace(faceHalService);
+ }
+}
diff --git a/framework/server/com/libremobileos/faceunlock/client/FakeBiometricsFace.java b/framework/server/com/libremobileos/faceunlock/client/FakeBiometricsFace.java
new file mode 100644
index 0000000..9a1ac02
--- /dev/null
+++ b/framework/server/com/libremobileos/faceunlock/client/FakeBiometricsFace.java
@@ -0,0 +1,200 @@
+/*
+ * Copyright (C) 2023 LibreMobileOS Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.libremobileos.faceunlock.client;
+
+import android.hardware.biometrics.face.V1_0.IBiometricsFace;
+import android.hardware.biometrics.face.V1_0.IBiometricsFaceClientCallback;
+import android.hardware.biometrics.face.V1_0.OptionalBool;
+import android.hardware.biometrics.face.V1_0.OptionalUint64;
+import android.hardware.biometrics.face.V1_0.Status;
+import android.hidl.base.V1_0.DebugInfo;
+import android.os.IHwBinder;
+import android.os.NativeHandle;
+import android.os.RemoteException;
+import android.util.Log;
+
+import java.util.ArrayList;
+
+public class FakeBiometricsFace implements IBiometricsFace {
+
+ private static final String TAG = "FakeBiometricsFace";
+
+ private final IFaceHalService mFaceHalService;
+ /* package-private */ FakeBiometricsFace(IFaceHalService faceHalService) {
+ this.mFaceHalService = faceHalService;
+ }
+
+ @Override
+ public IHwBinder asBinder() {
+ // Stub
+ Log.e(TAG, "unsupported call to asBinder()");
+ return null;
+ }
+
+ @Override
+ public OptionalUint64 setCallback(IBiometricsFaceClientCallback iBiometricsFaceClientCallback) throws RemoteException {
+ mFaceHalService.setCallback(new FaceCallbackAdapter(iBiometricsFaceClientCallback));
+ return makeOkUint(0);
+ }
+
+ @Override
+ public int setActiveUser(int i, String s) throws RemoteException {
+ return mFaceHalService.setActiveUser(i, s);
+ }
+
+ @Override
+ public OptionalUint64 generateChallenge(int i) throws RemoteException {
+ return makeOkUint(mFaceHalService.generateChallenge(i));
+ }
+
+ @Override
+ public int enroll(ArrayList<Byte> arrayList, int i, ArrayList<Integer> arrayList1) throws RemoteException {
+ return mFaceHalService.enroll(convertArr(arrayList), i, convertIntArr(arrayList1));
+ }
+
+ @Override
+ public int revokeChallenge() throws RemoteException {
+ return mFaceHalService.revokeChallenge();
+ }
+
+ @Override
+ public int setFeature(int i, boolean b, ArrayList<Byte> arrayList, int i1) throws RemoteException {
+ return mFaceHalService.setFeature(i, b, convertArr(arrayList), i1);
+ }
+
+ @Override
+ public OptionalBool getFeature(int i, int i1) throws RemoteException {
+ OptionalBool ret = new OptionalBool();
+ ret.status = Status.OK;
+ ret.value = mFaceHalService.getFeature(i, i1);
+ return ret;
+ }
+
+ @Override
+ public OptionalUint64 getAuthenticatorId() throws RemoteException {
+ return makeOkUint(mFaceHalService.getAuthenticatorId());
+ }
+
+ @Override
+ public int cancel() throws RemoteException {
+ return mFaceHalService.cancel();
+ }
+
+ @Override
+ public int enumerate() throws RemoteException {
+ return mFaceHalService.enumerate();
+ }
+
+ @Override
+ public int remove(int i) throws RemoteException {
+ return mFaceHalService.remove(i);
+ }
+
+ @Override
+ public int authenticate(long l) throws RemoteException {
+ return mFaceHalService.authenticate(l);
+ }
+
+ @Override
+ public int userActivity() throws RemoteException {
+ return mFaceHalService.userActivity();
+ }
+
+ @Override
+ public int resetLockout(ArrayList<Byte> arrayList) throws RemoteException {
+ return mFaceHalService.resetLockout(convertArr(arrayList));
+ }
+
+ @Override
+ public ArrayList<String> interfaceChain() throws RemoteException {
+ // Stub
+ return null;
+ }
+
+ @Override
+ public void debug(NativeHandle nativeHandle, ArrayList<String> arrayList) throws RemoteException {
+ // Stub
+ }
+
+ @Override
+ public String interfaceDescriptor() throws RemoteException {
+ // Stub
+ return null;
+ }
+
+ @Override
+ public ArrayList<byte[]> getHashChain() throws RemoteException {
+ // Stub
+ return null;
+ }
+
+ @Override
+ public void setHALInstrumentation() throws RemoteException {
+ // Stub
+ }
+
+ @Override
+ public boolean linkToDeath(IHwBinder.DeathRecipient deathRecipient, long l) throws RemoteException {
+ // Stub
+ return false;
+ }
+
+ @Override
+ public void ping() throws RemoteException {
+ // Stub
+ }
+
+ @Override
+ public DebugInfo getDebugInfo() throws RemoteException {
+ // Stub
+ return null;
+ }
+
+ @Override
+ public void notifySyspropsChanged() throws RemoteException {
+ // Stub
+ }
+
+ @Override
+ public boolean unlinkToDeath(IHwBinder.DeathRecipient deathRecipient) throws RemoteException {
+ // Stub
+ return false;
+ }
+
+ private static OptionalUint64 makeOkUint(long value) {
+ OptionalUint64 ret = new OptionalUint64();
+ ret.status = Status.OK;
+ ret.value = value;
+ return ret;
+ }
+
+ private static int[] convertIntArr(ArrayList<Integer> al) {
+ int[] ret = new int[al.size()];
+ for (int i = 0; i < ret.length; i++) {
+ ret[i] = al.get(i);
+ }
+ return ret;
+ }
+
+ private static byte[] convertArr(ArrayList<Byte> al) {
+ byte[] ret = new byte[al.size()];
+ for (int i = 0; i < ret.length; i++) {
+ ret[i] = al.get(i);
+ }
+ return ret;
+ }
+}
diff --git a/framework/server/com/libremobileos/faceunlock/server/FaceUnlockServer.java b/framework/server/com/libremobileos/faceunlock/server/FaceUnlockServer.java
index 3968d39..221a813 100644
--- a/framework/server/com/libremobileos/faceunlock/server/FaceUnlockServer.java
+++ b/framework/server/com/libremobileos/faceunlock/server/FaceUnlockServer.java
@@ -79,12 +79,6 @@
private final IBinder mFaceUnlockHalBinder = new IFaceHalService.Stub() {
- @Override
- public final int getInterfaceVersion() { return super.VERSION; }
-
- @Override
- public final String getInterfaceHash() { return super.HASH; }
-
@Override
public long getDeviceId() {
return kDeviceId;
@@ -431,12 +425,6 @@
private final IBinder mFaceUnlockManagerBinder = new IFaceUnlockManager.Stub() {
- @Override
- public final int getInterfaceVersion() { return super.VERSION; }
-
- @Override
- public final String getInterfaceHash() { return super.HASH; }
-
@Override
public void enrollResult(int remaining) throws RemoteException {
if (mCallback != null) {