Skip to content

Commit 19005b2

Browse files
committed
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
1 parent ea551ed commit 19005b2

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

fingerprint/BiometricsFingerprint.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@
2828
#include <inttypes.h>
2929
#include <unistd.h>
3030
#include <cutils/properties.h>
31+
#include <string.h>
3132

3233
#ifdef HAS_FINGERPRINT_GESTURES
3334
#include <fcntl.h>
3435
#endif
3536

3637
#define TSP_CMD_PATH "/sys/class/sec/tsp/cmd"
3738
#define HBM_PATH "/sys/class/lcd/panel/mask_brightness"
39+
#define MASK_BRIGHTNESS_PATH "/sys/class/lcd/panel/actual_mask_brightness"
3840

3941
namespace android {
4042
namespace hardware {
@@ -53,6 +55,14 @@ static void set(const std::string& path, const T& value) {
5355
file << value;
5456
}
5557

58+
template <typename T>
59+
static T get(const std::string& path, const T& def) {
60+
std::ifstream file(path);
61+
T result;
62+
file >> result;
63+
return file.fail() ? def : result;
64+
}
65+
5666
std::string getBootloader() {
5767
return android::base::GetProperty("ro.boot.bootloader", "");
5868
}
@@ -139,9 +149,11 @@ Return<void> BiometricsFingerprint::onFingerDown(uint32_t, uint32_t, float, floa
139149
}
140150

141151
Return<void> BiometricsFingerprint::onFingerUp() {
142-
request(SEM_REQUEST_TOUCH_EVENT, FINGERPRINT_REQUEST_RESUME);
152+
if (strcmp(get<std::string>(MASK_BRIGHTNESS_PATH, "0").c_str(), "0") != 0) {
153+
request(SEM_REQUEST_TOUCH_EVENT, FINGERPRINT_REQUEST_RESUME);
143154

144-
set(HBM_PATH, "0");
155+
set(HBM_PATH, "0");
156+
}
145157

146158
return Void();
147159
}

0 commit comments

Comments
 (0)