davinci: fod: Add support for Xiaomi's touchfeature

Change-Id: I15a4a3d777d784abe04e88372647fc9abff78626
Signed-off-by: Arian <arian.kulmer@web.de>
This commit is contained in:
PIPIPIG233666
2020-02-10 19:50:36 -05:00
committed by Arian
parent 86826edb8d
commit 86032a20b5
12 changed files with 56 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 The LineageOS Project
* Copyright (C) 2019-2020 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,9 +33,7 @@
#define PARAM_NIT_FOD 1
#define PARAM_NIT_NONE 0
#define FOD_STATUS_PATH "/sys/devices/virtual/touch/tp_dev/fod_status"
#define FOD_STATUS_ON 1
#define FOD_STATUS_OFF 0
#define TOUCH_FOD_ENABLE 10
#define FOD_UI_PATH "/sys/devices/platform/soc/soc:qcom,dsi-display/fod_ui"
@@ -45,12 +43,6 @@
namespace {
template <typename T>
static void set(const std::string& path, const T& value) {
std::ofstream file(path);
file << value;
}
static bool readBool(int fd) {
char c;
int rc;
@@ -81,6 +73,7 @@ namespace V1_0 {
namespace implementation {
FingerprintInscreen::FingerprintInscreen() {
touchFeatureService = ITouchFeature::getService();
xiaomiFingerprintService = IXiaomiFingerprint::getService();
std::thread([this]() {
@@ -138,12 +131,12 @@ Return<void> FingerprintInscreen::onRelease() {
}
Return<void> FingerprintInscreen::onShowFODView() {
set(FOD_STATUS_PATH, FOD_STATUS_ON);
touchFeatureService->setTouchMode(TOUCH_FOD_ENABLE, 1);
return Void();
}
Return<void> FingerprintInscreen::onHideFODView() {
set(FOD_STATUS_PATH, FOD_STATUS_OFF);
touchFeatureService->resetTouchMode(TOUCH_FOD_ENABLE);
return Void();
}