From 8657d3fdc8bd2b68a0aae406827e578a5cf87301 Mon Sep 17 00:00:00 2001 From: GuaiYiHu Date: Thu, 19 Sep 2019 19:22:28 +0200 Subject: sdm660-common: biometrics: Rework the fpc-goodix differentiation Change-Id: Ib6be2c12d1fc7e9354001f7eb0b28e740eecde46 --- biometrics/BiometricsFingerprint.cpp | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) (limited to 'biometrics/BiometricsFingerprint.cpp') diff --git a/biometrics/BiometricsFingerprint.cpp b/biometrics/BiometricsFingerprint.cpp index 42243ab..311bbc6 100644 --- a/biometrics/BiometricsFingerprint.cpp +++ b/biometrics/BiometricsFingerprint.cpp @@ -16,15 +16,13 @@ */ #define LOG_TAG "android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sdm660" -#include - #include #include #include #include "BiometricsFingerprint.h" -#include "Hardware.h" +#include #include #include @@ -216,6 +214,7 @@ IBiometricsFingerprint* BiometricsFingerprint::getInstance() { void setFpVendorProp(const char *fp_vendor) { property_set("persist.vendor.sys.fp.vendor", fp_vendor); + property_set("ro.boot.fpsensor", fp_vendor); } fingerprint_device_t* getDeviceForVendor(const char *class_name) @@ -223,18 +222,7 @@ fingerprint_device_t* getDeviceForVendor(const char *class_name) const hw_module_t *hw_module = nullptr; int err; - if (!strcmp(class_name, "fpc")) { - setFpVendorProp("fpc"); - err = load("/system/vendor/lib64/hw/fingerprint.fpc.so", &hw_module); - } else if (!strcmp(class_name, "gdx")) { - setFpVendorProp("goodix"); - err = load("/system/vendor/lib64/hw/fingerprint.goodix.so", &hw_module); - } else { - setFpVendorProp("none"); - ALOGE("No fingerprint module class specified."); - err = 1; - } - + err = hw_get_module_by_class(FINGERPRINT_HARDWARE_MODULE_ID, class_name, &hw_module); if (err) { ALOGE("Failed to get fingerprint module: class %s, error %d", class_name, err); return nullptr; @@ -276,17 +264,25 @@ fingerprint_device_t* getDeviceForVendor(const char *class_name) fingerprint_device_t* getFingerprintDevice() { fingerprint_device_t *fp_device; - char class_name[PROPERTY_VALUE_MAX]; - property_get("ro.boot.fpsensor", - class_name, NULL); + fp_device = getDeviceForVendor("fpc"); + if (fp_device == nullptr) { + ALOGE("Failed to load fpc fingerprint module"); + } else { + setFpVendorProp("fpc"); + return fp_device; + } - fp_device = getDeviceForVendor(class_name); + fp_device = getDeviceForVendor("goodix"); if (fp_device == nullptr) { - ALOGE("Failed to load %s fingerprint module", class_name); + ALOGE("Failed to load goodix fingerprint module"); } else { + setFpVendorProp("goodix"); return fp_device; } + + setFpVendorProp("none"); + return nullptr; } -- cgit v1.2.3