sm6150-common: fingerprint: Allow to build without fingerprintextension

Change-Id: Ib51286dafaf0633ba959332ecdb5ad277c6714bf
This commit is contained in:
Arian 2021-03-01 15:19:27 +01:00
parent 3f9ee454dc
commit a8c1391091
No known key found for this signature in database
GPG Key ID: 48029380598CE3B9
9 changed files with 56 additions and 21 deletions

View File

@ -502,14 +502,4 @@
</interface>
<fqname>@3.0::IRTPService/imsrtpservice</fqname>
</hal>
<hal format="hidl">
<name>vendor.xiaomi.hardware.fingerprintextension</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IXiaomiFingerprint</name>
<instance>default</instance>
</interface>
<fqname>@1.0::IXiaomiFingerprint/default</fqname>
</hal>
</manifest>

View File

@ -1,8 +1,6 @@
cc_binary {
name: "android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sm6150",
cc_defaults {
name: "xiaomi_sm6150_fingerprint_defaults",
defaults: ["hidl_defaults"],
init_rc: ["android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sm6150.rc"],
vintf_fragments: ["android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sm6150.xml"],
vendor: true,
relative_install_path: "hw",
srcs: [
@ -17,7 +15,24 @@ cc_binary {
"libhardware",
"libutils",
"android.hardware.biometrics.fingerprint@2.1",
"vendor.xiaomi.hardware.fingerprintextension@1.0",
],
}
cc_binary {
name: "android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sm6150",
defaults: ["xiaomi_sm6150_fingerprint_defaults"],
init_rc: ["android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sm6150.rc"],
vintf_fragments: ["android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sm6150.xml"],
}
cc_binary {
name: "android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sm6150-ext",
defaults: ["xiaomi_sm6150_fingerprint_defaults"],
init_rc: ["android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sm6150-ext.rc"],
vintf_fragments: [
"android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sm6150.xml",
"vendor.xiaomi.hardware.fingerprintextension@1.0.xml",
],
shared_libs: ["vendor.xiaomi.hardware.fingerprintextension@1.0"],
cflags: ["-DXIAOMI_FINGERPRINTEXTENSION"],
}

View File

@ -378,9 +378,11 @@ void BiometricsFingerprint::notify(const fingerprint_msg_t *msg) {
}
}
#ifdef XIAOMI_FINGERPRINTEXTENSION
Return<int32_t> BiometricsFingerprint::extCmd(int32_t cmd, int32_t param) {
return mDevice->extCmd(mDevice, cmd, param);
}
#endif /* XIAOMI_FINGERPRINTEXTENSION */
} // namespace implementation
} // namespace V2_1

View File

@ -24,9 +24,13 @@
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <android/hardware/biometrics/fingerprint/2.1/IBiometricsFingerprint.h>
#include <vendor/xiaomi/hardware/fingerprintextension/1.0/IXiaomiFingerprint.h>
#ifdef XIAOMI_FINGERPRINTEXTENSION
#include <vendor/xiaomi/hardware/fingerprintextension/1.0/IXiaomiFingerprint.h>
#include "fingerprint.h"
#else
#include <hardware/fingerprint.h>
#endif
namespace android {
namespace hardware {
@ -44,9 +48,12 @@ using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::sp;
#ifdef XIAOMI_FINGERPRINTEXTENSION
using ::vendor::xiaomi::hardware::fingerprintextension::V1_0::IXiaomiFingerprint;
struct BiometricsFingerprint : public IBiometricsFingerprint, public IXiaomiFingerprint {
#else
struct BiometricsFingerprint : public IBiometricsFingerprint {
#endif
public:
BiometricsFingerprint();
~BiometricsFingerprint();
@ -67,7 +74,9 @@ public:
Return<RequestStatus> remove(uint32_t gid, uint32_t fid) override;
Return<RequestStatus> setActiveGroup(uint32_t gid, const hidl_string& storePath) override;
Return<RequestStatus> authenticate(uint64_t operationId, uint32_t gid) override;
#ifdef XIAOMI_FINGERPRINTEXTENSION
Return<int32_t> extCmd(int32_t cmd, int32_t param) override;
#endif /*XIAOMI_FINGERPRINTEXTENSION */
private:
static fingerprint_device_t* openHal();

View File

@ -0,0 +1,7 @@
service vendor.fps_hal /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sm6150-ext
# "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 input uhid

View File

@ -43,6 +43,7 @@ status_t BiometricsFingerprint::registerAsSystemService() {
ALOGI("Successfully registered IBiometricsFingerprint");
}
#ifdef XIAOMI_FINGERPRINTEXTENSION
ret = IXiaomiFingerprint::registerAsService();
if (ret != 0) {
ALOGE("Failed to register IXiaomiFingerprint (%d)", ret);
@ -50,6 +51,7 @@ status_t BiometricsFingerprint::registerAsSystemService() {
} else {
ALOGI("Successfully registered IXiaomiFingerprint");
}
#endif /* XIAOMI_FINGERPRINTEXTENSION */
fail:
return ret;

View File

@ -0,0 +1,12 @@
<manifest version="1.0" type="device">
<hal format="hidl">
<name>vendor.xiaomi.hardware.fingerprintextension</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IXiaomiFingerprint</name>
<instance>default</instance>
</interface>
<fqname>@1.0::IXiaomiFingerprint/default</fqname>
</hal>
</manifest>

View File

@ -11,6 +11,7 @@
# HALs
/(vendor|system/vendor)/bin/hw/android\.hardware\.biometrics\.fingerprint@2\.1-service\.xiaomi_sm6150 u:object_r:hal_fingerprint_default_exec:s0
/(vendor|system/vendor)/bin/hw/android\.hardware\.biometrics\.fingerprint@2\.1-service\.xiaomi_sm6150-ext u:object_r:hal_fingerprint_default_exec:s0
/vendor/bin/hw/android\.hardware\.light@2\.0-service\.xiaomi_sm6150 u:object_r:hal_light_default_exec:s0
/vendor/bin/hw/vendor\.lineage\.livedisplay@2\.0-service\.xiaomi_sm6150 u:object_r:hal_lineage_livedisplay_qti_exec:s0

View File

@ -138,9 +138,6 @@ PRODUCT_PACKAGES += \
android.hardware.drm@1.3-service.clearkey
# Fingerprint
PRODUCT_PACKAGES += \
android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sm6150
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml