From 1a004c09f802816a0ec4a0d17697ce3c3033a033 Mon Sep 17 00:00:00 2001 From: Willi Ye Date: Thu, 30 Dec 2021 15:21:49 +0100 Subject: [PATCH] sm7125: fod: Write to brightness path directly Change-Id: Ib71ba0e2da3d8f48219547b3b53ada4598396299 --- fod/FingerprintInscreen.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/fod/FingerprintInscreen.cpp b/fod/FingerprintInscreen.cpp index 12b34ee..2d9da3e 100644 --- a/fod/FingerprintInscreen.cpp +++ b/fod/FingerprintInscreen.cpp @@ -26,7 +26,7 @@ #define FINGERPRINT_ACQUIRED_VENDOR 6 #define TSP_CMD_PATH "/sys/class/sec/tsp/cmd" -#define MASK_BRIGHTNESS_PATH "/sys/class/lcd/panel/mask_brightness" +#define BRIGHTNESS_PATH "/sys/class/backlight/panel0-backlight/brightness" #define SEM_FINGER_STATE 22 #define SEM_PARAM_PRESSED 2 @@ -72,7 +72,8 @@ static hidl_vec stringToVec(const std::string& str) { FingerprintInscreen::FingerprintInscreen() { mSehBiometricsFingerprintService = ISehBiometricsFingerprint::getService(); set(TSP_CMD_PATH, "set_fod_rect,421,2018,659,2256"); - set(MASK_BRIGHTNESS_PATH, "319"); + mPreviousBrightness = get(BRIGHTNESS_PATH, ""); + set(BRIGHTNESS_PATH, "319"); set(TSP_CMD_PATH, "fod_enable,1,1,0"); } @@ -97,6 +98,11 @@ Return FingerprintInscreen::onPress() { Return FingerprintInscreen::onRelease() { mSehBiometricsFingerprintService->sehRequest(SEM_FINGER_STATE, SEM_PARAM_RELEASED, stringToVec(SEM_AOSP_FQNAME), FingerprintInscreen::requestResult); + set(TSP_CMD_PATH, "fod_enable,0"); + if (!mPreviousBrightness.empty()) { + set(BRIGHTNESS_PATH, mPreviousBrightness); + mPreviousBrightness = ""; + } return Void(); } @@ -105,6 +111,11 @@ Return FingerprintInscreen::onShowFODView() { } Return FingerprintInscreen::onHideFODView() { + set(TSP_CMD_PATH, "fod_enable,0"); + if (!mPreviousBrightness.empty()) { + set(BRIGHTNESS_PATH, mPreviousBrightness); + mPreviousBrightness = ""; + } return Void(); }