hidl: biometrics: fingerprint: Move fingerprint HIDL to 2.3

Change-Id: I2e5ed64ac7ae2f1003503072666204c0788a003a
This commit is contained in:
Sebastiano Barezzi 2022-03-25 01:32:20 +01:00
parent 3c98e02fe1
commit c3f110d5f8
No known key found for this signature in database
GPG Key ID: 47760583F393BC44
6 changed files with 40 additions and 17 deletions

View File

@ -6,10 +6,10 @@
//
cc_binary {
name: "android.hardware.biometrics.fingerprint@2.1-service.xiaomi",
name: "android.hardware.biometrics.fingerprint@2.3-service.xiaomi",
defaults: ["hidl_defaults"],
init_rc: ["android.hardware.biometrics.fingerprint@2.1-service.xiaomi.rc"],
vintf_fragments: ["android.hardware.biometrics.fingerprint@2.1-service.xiaomi.xml"],
init_rc: ["android.hardware.biometrics.fingerprint@2.3-service.xiaomi.rc"],
vintf_fragments: ["android.hardware.biometrics.fingerprint@2.3-service.xiaomi.xml"],
vendor: true,
relative_install_path: "hw",
srcs: [
@ -24,6 +24,8 @@ cc_binary {
"libhardware",
"libutils",
"android.hardware.biometrics.fingerprint@2.1",
"android.hardware.biometrics.fingerprint@2.2",
"android.hardware.biometrics.fingerprint@2.3",
],
header_libs: ["xiaomifingerprint_headers"],

View File

@ -5,7 +5,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
#define LOG_TAG "android.hardware.biometrics.fingerprint@2.1-service.xiaomi"
#define LOG_TAG "android.hardware.biometrics.fingerprint@2.3-service.xiaomi"
#include <hardware/hw_auth_token.h>
@ -19,7 +19,7 @@ namespace android {
namespace hardware {
namespace biometrics {
namespace fingerprint {
namespace V2_1 {
namespace V2_3 {
namespace implementation {
// Supported fingerprint HAL version
@ -200,6 +200,19 @@ Return<RequestStatus> BiometricsFingerprint::authenticate(uint64_t operationId,
return ErrorFilter(mDevice->authenticate(mDevice, operationId, gid));
}
Return<bool> BiometricsFingerprint::isUdfps(uint32_t /*sensorId*/) {
return false;
}
Return<void> BiometricsFingerprint::onFingerDown(uint32_t /*x*/, uint32_t /*y*/, float /*minor*/,
float /*major*/) {
return Void();
}
Return<void> BiometricsFingerprint::onFingerUp() {
return Void();
}
IBiometricsFingerprint* BiometricsFingerprint::getInstance() {
if (!sInstance) {
sInstance = new BiometricsFingerprint();
@ -338,7 +351,7 @@ void BiometricsFingerprint::notify(const fingerprint_msg_t* msg) {
}
} // namespace implementation
} // namespace V2_1
} // namespace V2_3
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware

View File

@ -7,7 +7,7 @@
#pragma once
#include <android/hardware/biometrics/fingerprint/2.1/IBiometricsFingerprint.h>
#include <android/hardware/biometrics/fingerprint/2.3/IBiometricsFingerprint.h>
#include <android/log.h>
#include <hardware/hardware.h>
#include <hidl/MQDescriptor.h>
@ -19,7 +19,7 @@ namespace android {
namespace hardware {
namespace biometrics {
namespace fingerprint {
namespace V2_1 {
namespace V2_3 {
namespace implementation {
using ::android::sp;
@ -27,9 +27,11 @@ using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint;
using ::android::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo;
using ::android::hardware::biometrics::fingerprint::V2_1::FingerprintError;
using ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprintClientCallback;
using ::android::hardware::biometrics::fingerprint::V2_1::RequestStatus;
using ::android::hardware::biometrics::fingerprint::V2_3::IBiometricsFingerprint;
struct BiometricsFingerprint : public IBiometricsFingerprint {
public:
@ -54,6 +56,12 @@ struct BiometricsFingerprint : public IBiometricsFingerprint {
Return<RequestStatus> setActiveGroup(uint32_t gid, const hidl_string& storePath) override;
Return<RequestStatus> authenticate(uint64_t operationId, uint32_t gid) override;
// Methods from ::android::hardware::biometrics::fingerprint::V2_3::IBiometricsFingerprint
// follow.
Return<bool> isUdfps(uint32_t sensorId) override;
Return<void> onFingerDown(uint32_t x, uint32_t y, float minor, float major) override;
Return<void> onFingerUp() override;
private:
static fingerprint_device_t* openHal();
static void notify(
@ -69,7 +77,7 @@ struct BiometricsFingerprint : public IBiometricsFingerprint {
};
} // namespace implementation
} // namespace V2_1
} // namespace V2_3
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware

View File

@ -1,4 +1,4 @@
service vendor.fps_hal /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.1-service.xiaomi
service vendor.fps_hal /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.3-service.xiaomi
# "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.

View File

@ -2,7 +2,7 @@
<hal format="hidl">
<name>android.hardware.biometrics.fingerprint</name>
<transport>hwbinder</transport>
<version>2.1</version>
<version>2.3</version>
<interface>
<name>IBiometricsFingerprint</name>
<instance>default</instance>

View File

@ -5,10 +5,10 @@
* SPDX-License-Identifier: Apache-2.0
*/
#define LOG_TAG "android.hardware.biometrics.fingerprint@2.1-service.xiaomi"
#define LOG_TAG "android.hardware.biometrics.fingerprint@2.3-service.xiaomi"
#include <android/hardware/biometrics/fingerprint/2.1/IBiometricsFingerprint.h>
#include <android/hardware/biometrics/fingerprint/2.1/types.h>
#include <android/hardware/biometrics/fingerprint/2.2/types.h>
#include <android/hardware/biometrics/fingerprint/2.3/IBiometricsFingerprint.h>
#include <android/log.h>
#include <hidl/HidlSupport.h>
#include <hidl/HidlTransportSupport.h>
@ -17,8 +17,8 @@
using android::sp;
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
using android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint;
using android::hardware::biometrics::fingerprint::V2_1::implementation::BiometricsFingerprint;
using android::hardware::biometrics::fingerprint::V2_3::IBiometricsFingerprint;
using android::hardware::biometrics::fingerprint::V2_3::implementation::BiometricsFingerprint;
int main() {
android::sp<IBiometricsFingerprint> bio = BiometricsFingerprint::getInstance();