diff options
author | GuaiYiHu <guaiyihu@foxmail.com> | 2019-09-19 19:22:28 +0200 |
---|---|---|
committer | Michael Bestas <mkbestas@lineageos.org> | 2020-04-30 00:48:53 +0300 |
commit | 8657d3fdc8bd2b68a0aae406827e578a5cf87301 (patch) | |
tree | 0549437db07f272d2f79089fee391f4493dae943 /biometrics/BiometricsFingerprint.cpp | |
parent | dce434aa656f86c1a904f2b2f25046d690a368b4 (diff) |
sdm660-common: biometrics: Rework the fpc-goodix differentiation
Change-Id: Ib6be2c12d1fc7e9354001f7eb0b28e740eecde46
Diffstat (limited to 'biometrics/BiometricsFingerprint.cpp')
-rw-r--r-- | biometrics/BiometricsFingerprint.cpp | 36 |
1 files changed, 16 insertions, 20 deletions
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 <cutils/properties.h> - #include <hardware/hw_auth_token.h> #include <hardware/hardware.h> #include <hardware/fingerprint.h> #include "BiometricsFingerprint.h" -#include "Hardware.h" +#include <cutils/properties.h> #include <inttypes.h> #include <unistd.h> @@ -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; } |