diff --git a/configs/hidl/manifest.xml b/configs/hidl/manifest.xml
index b30beb9..29b2108 100644
--- a/configs/hidl/manifest.xml
+++ b/configs/hidl/manifest.xml
@@ -502,14 +502,4 @@
@3.0::IRTPService/imsrtpservice
-
- vendor.xiaomi.hardware.fingerprintextension
- hwbinder
- 1.0
-
- IXiaomiFingerprint
- default
-
- @1.0::IXiaomiFingerprint/default
-
diff --git a/fingerprint/Android.bp b/fingerprint/Android.bp
index 90bbe7e..4347fc7 100644
--- a/fingerprint/Android.bp
+++ b/fingerprint/Android.bp
@@ -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"],
}
diff --git a/fingerprint/BiometricsFingerprint.cpp b/fingerprint/BiometricsFingerprint.cpp
index 318e8b2..d902b42 100644
--- a/fingerprint/BiometricsFingerprint.cpp
+++ b/fingerprint/BiometricsFingerprint.cpp
@@ -378,9 +378,11 @@ void BiometricsFingerprint::notify(const fingerprint_msg_t *msg) {
}
}
+#ifdef XIAOMI_FINGERPRINTEXTENSION
Return BiometricsFingerprint::extCmd(int32_t cmd, int32_t param) {
return mDevice->extCmd(mDevice, cmd, param);
}
+#endif /* XIAOMI_FINGERPRINTEXTENSION */
} // namespace implementation
} // namespace V2_1
diff --git a/fingerprint/BiometricsFingerprint.h b/fingerprint/BiometricsFingerprint.h
index b5bf399..1d4fadb 100644
--- a/fingerprint/BiometricsFingerprint.h
+++ b/fingerprint/BiometricsFingerprint.h
@@ -24,9 +24,13 @@
#include
#include
#include
-#include
+#ifdef XIAOMI_FINGERPRINTEXTENSION
+#include
#include "fingerprint.h"
+#else
+#include
+#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 remove(uint32_t gid, uint32_t fid) override;
Return setActiveGroup(uint32_t gid, const hidl_string& storePath) override;
Return authenticate(uint64_t operationId, uint32_t gid) override;
+#ifdef XIAOMI_FINGERPRINTEXTENSION
Return extCmd(int32_t cmd, int32_t param) override;
+#endif /*XIAOMI_FINGERPRINTEXTENSION */
private:
static fingerprint_device_t* openHal();
diff --git a/fingerprint/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sm6150-ext.rc b/fingerprint/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sm6150-ext.rc
new file mode 100644
index 0000000..b77fb05
--- /dev/null
+++ b/fingerprint/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sm6150-ext.rc
@@ -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
diff --git a/fingerprint/service.cpp b/fingerprint/service.cpp
index 760d101..9f4c8d6 100644
--- a/fingerprint/service.cpp
+++ b/fingerprint/service.cpp
@@ -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;
diff --git a/fingerprint/vendor.xiaomi.hardware.fingerprintextension@1.0.xml b/fingerprint/vendor.xiaomi.hardware.fingerprintextension@1.0.xml
new file mode 100644
index 0000000..5671287
--- /dev/null
+++ b/fingerprint/vendor.xiaomi.hardware.fingerprintextension@1.0.xml
@@ -0,0 +1,12 @@
+
+
+ vendor.xiaomi.hardware.fingerprintextension
+ hwbinder
+ 1.0
+
+ IXiaomiFingerprint
+ default
+
+ @1.0::IXiaomiFingerprint/default
+
+
diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts
index 6ddff69..3ee6a40 100644
--- a/sepolicy/vendor/file_contexts
+++ b/sepolicy/vendor/file_contexts
@@ -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
diff --git a/sm6150.mk b/sm6150.mk
index ec472aa..3985f33 100644
--- a/sm6150.mk
+++ b/sm6150.mk
@@ -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