From 6c48f27c69f4109f5b0351e456ef652dd8be8aa3 Mon Sep 17 00:00:00 2001 From: Arian Date: Fri, 18 Mar 2022 09:30:42 -0300 Subject: veux: Uprev fingerprint HAL to 2.3 --- biometrics/Android.bp | 8 +++-- biometrics/BiometricsFingerprint.cpp | 24 ++++++++++--- biometrics/BiometricsFingerprint.h | 21 +++++++---- ...ometrics.fingerprint@2.1-service.xiaomi_holi.rc | 36 ------------------- ...metrics.fingerprint@2.1-service.xiaomi_holi.xml | 42 ---------------------- ...ometrics.fingerprint@2.3-service.xiaomi_holi.rc | 36 +++++++++++++++++++ ...metrics.fingerprint@2.3-service.xiaomi_holi.xml | 42 ++++++++++++++++++++++ biometrics/service.cpp | 10 +++--- device.mk | 4 +-- sepolicy/vendor/file_contexts | 12 ++++--- 10 files changed, 131 insertions(+), 104 deletions(-) delete mode 100644 biometrics/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_holi.rc delete mode 100644 biometrics/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_holi.xml create mode 100644 biometrics/android.hardware.biometrics.fingerprint@2.3-service.xiaomi_holi.rc create mode 100644 biometrics/android.hardware.biometrics.fingerprint@2.3-service.xiaomi_holi.xml diff --git a/biometrics/Android.bp b/biometrics/Android.bp index f5f26c7..11fc8dd 100644 --- a/biometrics/Android.bp +++ b/biometrics/Android.bp @@ -1,9 +1,9 @@ cc_binary { - name: "android.hardware.biometrics.fingerprint@2.1-service.xiaomi_holi", + name: "android.hardware.biometrics.fingerprint@2.3-service.xiaomi_holi", defaults: ["hidl_defaults"], relative_install_path: "hw", - init_rc: ["android.hardware.biometrics.fingerprint@2.1-service.xiaomi_holi.rc"], - vintf_fragments: ["android.hardware.biometrics.fingerprint@2.1-service.xiaomi_holi.xml"], + init_rc: ["android.hardware.biometrics.fingerprint@2.3-service.xiaomi_holi.rc"], + vintf_fragments: ["android.hardware.biometrics.fingerprint@2.3-service.xiaomi_holi.xml"], srcs: [ "BiometricsFingerprint.cpp", "service.cpp", @@ -15,6 +15,8 @@ cc_binary { "libhardware", "libutils", "android.hardware.biometrics.fingerprint@2.1", + "android.hardware.biometrics.fingerprint@2.2", + "android.hardware.biometrics.fingerprint@2.3", "//hardware/xiaomi:vendor.xiaomi.hardware.fingerprintextension@1.0", ], vendor: true, diff --git a/biometrics/BiometricsFingerprint.cpp b/biometrics/BiometricsFingerprint.cpp index 668c220..707099d 100644 --- a/biometrics/BiometricsFingerprint.cpp +++ b/biometrics/BiometricsFingerprint.cpp @@ -14,8 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#define LOG_TAG "android.hardware.biometrics.fingerprint@2.1-service.xiaomi_holi" -#define LOG_VERBOSE "android.hardware.biometrics.fingerprint@2.1-service.xiaomi_holi" +#define LOG_TAG "android.hardware.biometrics.fingerprint@2.3-service.xiaomi_holi" +#define LOG_VERBOSE "android.hardware.biometrics.fingerprint@2.3-service.xiaomi_holi" #include @@ -30,7 +30,7 @@ namespace android { namespace hardware { namespace biometrics { namespace fingerprint { -namespace V2_1 { +namespace V2_3 { namespace implementation { // Supported fingerprint HAL version @@ -375,8 +375,24 @@ Return BiometricsFingerprint::extCmd(int32_t cmd, int32_t param) { return mDevice->extCmd(mDevice, cmd, param); } + +Return BiometricsFingerprint::isUdfps(uint32_t /* sensorId */) { + return false; +} + +Return BiometricsFingerprint::onFingerDown(uint32_t /* x */, uint32_t /* y */, + float /* minor */, float /* major */) { + return Void(); +} + +Return BiometricsFingerprint::onFingerUp() { + return Void(); +} + + + } // namespace implementation -} // namespace V2_1 +} // namespace V2_3 } // namespace fingerprint } // namespace biometrics } // namespace hardware diff --git a/biometrics/BiometricsFingerprint.h b/biometrics/BiometricsFingerprint.h index 84e3080..124209e 100644 --- a/biometrics/BiometricsFingerprint.h +++ b/biometrics/BiometricsFingerprint.h @@ -15,27 +15,29 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_1_BIOMETRICSFINGERPRINT_H -#define ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_1_BIOMETRICSFINGERPRINT_H +#ifndef ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_3_BIOMETRICSFINGERPRINT_H +#define ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_3_BIOMETRICSFINGERPRINT_H #include #include #include "xiaomi_fingerprint.h" #include #include -#include +#include #include namespace android { namespace hardware { namespace biometrics { namespace fingerprint { -namespace V2_1 { +namespace V2_3 { namespace implementation { -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; using ::android::hardware::Return; using ::android::hardware::Void; using ::android::hardware::hidl_vec; @@ -78,13 +80,18 @@ private: std::mutex mClientCallbackMutex; sp mClientCallback; xiaomi_fingerprint_device_t *mDevice; + + // Methods from ::android::hardware::biometrics::fingerprint::V2_3::IBiometricsFingerprint follow. + Return isUdfps(uint32_t sensorId) override; + Return onFingerDown(uint32_t x, uint32_t y, float minor, float major) override; + Return onFingerUp() override; }; } // namespace implementation -} // namespace V2_1 +} // namespace V2_3 } // namespace fingerprint } // namespace biometrics } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_1_BIOMETRICSFINGERPRINT_H +#endif // ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_3_BIOMETRICSFINGERPRINT_H diff --git a/biometrics/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_holi.rc b/biometrics/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_holi.rc deleted file mode 100644 index 2fed25b..0000000 --- a/biometrics/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_holi.rc +++ /dev/null @@ -1,36 +0,0 @@ -service vendor.fps_hal /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_holi - # "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 - -on boot - #for silead fingeprint - mkdir /data/vendor/silead 0777 system system - chown system system /dev/silead_fp - chmod 0660 /dev/silead_fp - chown system system /dev/spidev1.0 - chmod 0660 /dev/spidev1.0 - chown system system /dev/silead_stub - chmod 0660 /dev/silead_stub - - #for goodix dump - mkdir /data/vendor/goodix 0777 system system - mkdir /data/vendor_de/0/goodix 0770 system system - - #fpc fingerprint - chown system system /sys/bus/platform/devices/soc:fpc1020/hw_reset - chown system system /sys/bus/platform/devices/soc:fpc1020/irq - chown system system /sys/bus/platform/devices/soc:fpc1020/wakeup_enable - chown system system /sys/bus/platform/devices/soc:fpc1020/regulator_enable - chown system system /sys/bus/platform/devices/soc:fpc1020/compatible_all - chown system system /sys/bus/platform/devices/soc:fpc1020/fingerdown_wait - - chmod 0644 /sys/bus/platform/devices/soc:fpc1020/hw_reset - chmod 0644 /sys/bus/platform/devices/soc:fpc1020/irq - chmod 0644 /sys/bus/platform/devices/soc:fpc1020/wakeup_enable - chmod 0644 /sys/bus/platform/devices/soc:fpc1020/regulator_enable - chmod 0644 /sys/bus/platform/devices/soc:fpc1020/compatible_all - chmod 0644 /sys/bus/platform/devices/soc:fpc1020/fingerdown_wait diff --git a/biometrics/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_holi.xml b/biometrics/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_holi.xml deleted file mode 100644 index 66a77d9..0000000 --- a/biometrics/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_holi.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - android.hardware.biometrics.fingerprint - hwbinder - 2.1 - - IBiometricsFingerprint - default - - - - vendor.goodix.hardware.biometrics.fingerprint - hwbinder - 2.1 - - IGoodixFingerprintDaemon - default - - - IGoodixFingerprintDaemonExt - default - - - - vendor.xiaomi.hardware.fingerprintextension - hwbinder - 1.0 - - IXiaomiFingerprint - default - - - - vendor.silead.hardware.fingerprintext - hwbinder - 1.0 - - ISileadFingerprint - default - - - diff --git a/biometrics/android.hardware.biometrics.fingerprint@2.3-service.xiaomi_holi.rc b/biometrics/android.hardware.biometrics.fingerprint@2.3-service.xiaomi_holi.rc new file mode 100644 index 0000000..ec62a44 --- /dev/null +++ b/biometrics/android.hardware.biometrics.fingerprint@2.3-service.xiaomi_holi.rc @@ -0,0 +1,36 @@ +service vendor.fps_hal /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.3-service.xiaomi_holi + # "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 + +on boot + #for silead fingeprint + mkdir /data/vendor/silead 0777 system system + chown system system /dev/silead_fp + chmod 0660 /dev/silead_fp + chown system system /dev/spidev1.0 + chmod 0660 /dev/spidev1.0 + chown system system /dev/silead_stub + chmod 0660 /dev/silead_stub + + #for goodix dump + mkdir /data/vendor/goodix 0777 system system + mkdir /data/vendor_de/0/goodix 0770 system system + + #fpc fingerprint + chown system system /sys/bus/platform/devices/soc:fpc1020/hw_reset + chown system system /sys/bus/platform/devices/soc:fpc1020/irq + chown system system /sys/bus/platform/devices/soc:fpc1020/wakeup_enable + chown system system /sys/bus/platform/devices/soc:fpc1020/regulator_enable + chown system system /sys/bus/platform/devices/soc:fpc1020/compatible_all + chown system system /sys/bus/platform/devices/soc:fpc1020/fingerdown_wait + + chmod 0644 /sys/bus/platform/devices/soc:fpc1020/hw_reset + chmod 0644 /sys/bus/platform/devices/soc:fpc1020/irq + chmod 0644 /sys/bus/platform/devices/soc:fpc1020/wakeup_enable + chmod 0644 /sys/bus/platform/devices/soc:fpc1020/regulator_enable + chmod 0644 /sys/bus/platform/devices/soc:fpc1020/compatible_all + chmod 0644 /sys/bus/platform/devices/soc:fpc1020/fingerdown_wait diff --git a/biometrics/android.hardware.biometrics.fingerprint@2.3-service.xiaomi_holi.xml b/biometrics/android.hardware.biometrics.fingerprint@2.3-service.xiaomi_holi.xml new file mode 100644 index 0000000..0112777 --- /dev/null +++ b/biometrics/android.hardware.biometrics.fingerprint@2.3-service.xiaomi_holi.xml @@ -0,0 +1,42 @@ + + + android.hardware.biometrics.fingerprint + hwbinder + 2.3 + + IBiometricsFingerprint + default + + + + vendor.goodix.hardware.biometrics.fingerprint + hwbinder + 2.1 + + IGoodixFingerprintDaemon + default + + + IGoodixFingerprintDaemonExt + default + + + + vendor.xiaomi.hardware.fingerprintextension + hwbinder + 1.0 + + IXiaomiFingerprint + default + + + + vendor.silead.hardware.fingerprintext + hwbinder + 1.0 + + ISileadFingerprint + default + + + diff --git a/biometrics/service.cpp b/biometrics/service.cpp index 0f6f70e..38e133e 100644 --- a/biometrics/service.cpp +++ b/biometrics/service.cpp @@ -14,18 +14,18 @@ * limitations under the License. */ -#define LOG_TAG "android.hardware.biometrics.fingerprint@2.1-service.xiaomi_holi" +#define LOG_TAG "android.hardware.biometrics.fingerprint@2.3-service.xiaomi_holi" #include #include #include -#include -#include +#include +#include #include #include "BiometricsFingerprint.h" -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; using android::hardware::configureRpcThreadpool; using android::hardware::joinRpcThreadpool; using android::sp; diff --git a/device.mk b/device.mk index e9e8bdb..3cfd68c 100644 --- a/device.mk +++ b/device.mk @@ -182,9 +182,7 @@ PRODUCT_PACKAGES += \ # Fingerprint PRODUCT_PACKAGES += \ - android.hardware.biometrics.fingerprint@2.1-service.xiaomi_holi \ - vendor.goodix.hardware.biometrics.fingerprint@2.1.vendor \ - vendor.xiaomi.hardware.fingerprintextension@1.0.vendor + android.hardware.biometrics.fingerprint@2.3-service.xiaomi_holi # GPS PRODUCT_PACKAGES += \ diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index 7475fab..dda8a34 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -21,20 +21,24 @@ /mnt/vendor/dsp/fastrpc_shell_3 u:object_r:public_adsprpcd_file:s0 # Fingerprint +/vendor/bin/hw/android\.hardware\.biometrics\.fingerprint@2.3-service\.xiaomi_holi u:object_r:hal_fingerprint_default_exec:s0 +/vendor/bin/hw/vendor\.silead\.hardware\.fingerprintext@1\.0-service u:object_r:hal_fingerprint_default_exec:s0 + +# Fingerprint devices /dev/goodix_fp u:object_r:vendor_fingerprint_device:s0 /dev/silead_fp u:object_r:vendor_fingerprint_device:s0 /dev/silead_s.* u:object_r:vendor_fingerprint_device:s0 /dev/silead_stub u:object_r:vendor_fingerprint_device:s0 /dev/spidev.* u:object_r:vendor_fingerprint_device:s0 -/mnt/vendor/persist/silead(/.*)? u:object_r:vendor_fingerprint_data_file:s0 -/mnt/vendor/persist/goodix(/.*)? u:object_r:vendor_fingerprint_data_file:s0 + +# Fingerprint data /data/vendor/fpc(/.*)? u:object_r:vendor_fingerprint_data_file:s0 /data/vendor/fpdump(/.*)? u:object_r:vendor_fingerprint_data_file:s0 /data/vendor/goodix(/.*)? u:object_r:vendor_fingerprint_data_file:s0 /data/vendor/goodix/gf_data(/.*)? u:object_r:vendor_fingerprint_data_file:s0 /data/vendor/silead(/.*)? u:object_r:vendor_fingerprint_data_file:s0 -/vendor/bin/hw/android\.hardware\.biometrics\.fingerprint@2.1-service\.xiaomi_holi u:object_r:hal_fingerprint_default_exec:s0 -/vendor/bin/hw/vendor\.silead\.hardware\.fingerprintext@1\.0-service u:object_r:hal_fingerprint_default_exec:s0 +/mnt/vendor/persist/silead(/.*)? u:object_r:vendor_fingerprint_data_file:s0 +/mnt/vendor/persist/goodix(/.*)? u:object_r:vendor_fingerprint_data_file:s0 # IR /dev/ir_spi u:object_r:ir_spi_device:s0 -- cgit v1.2.3