sm7125: fingerprint: Use kernel HBM

*We can now use kernel HBM instead of lighting up the whole screen
*Disable HBM when enrolling finishes and when authenticated to make sure HBM doesn't get stuck in enabled state
*Add a 35ms delay to make sure the screen dims before enabling HBM, preventing flickering
*Depends on d4e9440553

Signed-off-by: Simon1511 <simon2002.schoenmackers@gmail.com>
Change-Id: I330eb33a619e89a6744bca05edfe18fd30215e4a
fourteen-wip
Simon1511 2 years ago
parent fa5ad7d486
commit 539a28de28
  1. 21
      fingerprint/BiometricsFingerprint.cpp
  2. 2
      fingerprint/BiometricsFingerprint.h
  3. 7
      sepolicy/vendor/hal_fingerprint_default.te

@ -34,7 +34,7 @@
#define SEH_PARAM_RELEASED 1
#define SEH_AOSP_FQNAME "android.hardware.biometrics.fingerprint@2.3::IBiometricsFingerprint"
#define TSP_CMD_PATH "/sys/class/sec/tsp/cmd"
#define BRIGHTNESS_PATH "/sys/class/backlight/panel0-backlight/brightness"
#define HBM_PATH "/sys/class/lcd/panel/mask_brightness"
namespace vendor {
namespace samsung {
@ -114,19 +114,14 @@ static hidl_vec<int8_t> stringToVec(const std::string& str) {
}
Return<void> SehBiometricsFingerprint::onFingerDown(uint32_t, uint32_t, float, float) {
mPreviousBrightness = get<std::string>(BRIGHTNESS_PATH, "");
set(BRIGHTNESS_PATH, "331");
std::thread([this]() {
std::this_thread::sleep_for(std::chrono::milliseconds(35));
set(HBM_PATH, "331");
}).detach();
sehRequest(SEH_FINGER_STATE, SEH_PARAM_PRESSED,
stringToVec(SEH_AOSP_FQNAME), SehBiometricsFingerprint::requestResult);
std::thread([this]() {
std::this_thread::sleep_for(std::chrono::milliseconds(400));
if (!mPreviousBrightness.empty()) {
set(BRIGHTNESS_PATH, mPreviousBrightness);
mPreviousBrightness = "";
}
}).detach();
return Void();
}
@ -134,6 +129,8 @@ Return<void> SehBiometricsFingerprint::onFingerUp() {
sehRequest(SEH_FINGER_STATE, SEH_PARAM_RELEASED,
stringToVec(SEH_AOSP_FQNAME), SehBiometricsFingerprint::requestResult);
set(HBM_PATH, "0");
return Void();
}
@ -402,6 +399,9 @@ void SehBiometricsFingerprint::notify(const fingerprint_msg_t* msg) {
}
} break;
case FINGERPRINT_TEMPLATE_ENROLLING:
if(msg->data.enroll.samples_remaining == 0) {
set(HBM_PATH, "0");
}
LOG(DEBUG) << "onEnrollResult(fid=" << msg->data.enroll.finger.fid
<< ", gid=" << msg->data.enroll.finger.gid
<< ", rem=" << msg->data.enroll.samples_remaining << ")";
@ -434,6 +434,7 @@ void SehBiometricsFingerprint::notify(const fingerprint_msg_t* msg) {
const uint8_t* hat = reinterpret_cast<const uint8_t*>(&msg->data.authenticated.hat);
const hidl_vec<uint8_t> token(
std::vector<uint8_t>(hat, hat + sizeof(msg->data.authenticated.hat)));
set(HBM_PATH, "0");
if (!thisPtr->mClientCallback
->onAuthenticated(devId, msg->data.authenticated.finger.fid,
msg->data.authenticated.finger.gid, token)

@ -99,8 +99,6 @@ public:
int (*ss_fingerprint_request)(int32_t cmd_id, const int8_t* inputBuf, uint32_t value, int8_t* outBuf, uint32_t len, uint32_t inParam);
static void requestResult(int retval, const hidl_vec<int8_t>& outBuf);
std::string mPreviousBrightness;
};
} // namespace implementation

@ -12,12 +12,9 @@ allow hal_fingerprint_default biometrics_efs_file:file r_file_perms;
allow hal_fingerprint_default biometrics_efs_file:dir search;
allow hal_fingerprint_default efs_file:dir search;
# /sys/class/backlight/panel0-backlight/
# /sys/class/lcd/panel/mask_brightness
allow hal_fingerprint_default sysfs_lcd_writable:dir search;
allow hal_fingerprint_default sysfs_lcd_writable:file r_file_perms;
allow hal_fingerprint_default vendor_sysfs_graphics:dir r_dir_perms;
allow hal_fingerprint_default vendor_sysfs_graphics:file rw_file_perms;
allow hal_fingerprint_default sysfs_lcd_writable:file rw_file_perms;
# /sys/class/fingerprint/
allow hal_fingerprint_default sysfs_fingerprint:dir r_dir_perms;

Loading…
Cancel
Save