sm7125-common: fingerprint: prevent unnwanted onFingerUp() calls

* onFingerUp() would also be called during unlocking with Pin/Password/etc, always resetting the brightness to the previous value

Change-Id: I5319a8a50a4ad3308e787322c6c2a417b9169b23
fourteen-wip
Simon1511 1 year ago
parent ea551ed57a
commit 19005b2e9a
  1. 16
      fingerprint/BiometricsFingerprint.cpp

@ -28,6 +28,7 @@
#include <inttypes.h>
#include <unistd.h>
#include <cutils/properties.h>
#include <string.h>
#ifdef HAS_FINGERPRINT_GESTURES
#include <fcntl.h>
@ -35,6 +36,7 @@
#define TSP_CMD_PATH "/sys/class/sec/tsp/cmd"
#define HBM_PATH "/sys/class/lcd/panel/mask_brightness"
#define MASK_BRIGHTNESS_PATH "/sys/class/lcd/panel/actual_mask_brightness"
namespace android {
namespace hardware {
@ -53,6 +55,14 @@ static void set(const std::string& path, const T& value) {
file << value;
}
template <typename T>
static T get(const std::string& path, const T& def) {
std::ifstream file(path);
T result;
file >> result;
return file.fail() ? def : result;
}
std::string getBootloader() {
return android::base::GetProperty("ro.boot.bootloader", "");
}
@ -139,9 +149,11 @@ Return<void> BiometricsFingerprint::onFingerDown(uint32_t, uint32_t, float, floa
}
Return<void> BiometricsFingerprint::onFingerUp() {
request(SEM_REQUEST_TOUCH_EVENT, FINGERPRINT_REQUEST_RESUME);
if (strcmp(get<std::string>(MASK_BRIGHTNESS_PATH, "0").c_str(), "0") != 0) {
request(SEM_REQUEST_TOUCH_EVENT, FINGERPRINT_REQUEST_RESUME);
set(HBM_PATH, "0");
set(HBM_PATH, "0");
}
return Void();
}

Loading…
Cancel
Save