diff --git a/configs/hidl/manifest.xml b/configs/hidl/manifest.xml
index 26e7df3..d449ecd 100644
--- a/configs/hidl/manifest.xml
+++ b/configs/hidl/manifest.xml
@@ -804,4 +804,13 @@
@1.0::IMotor/default
+
+ vendor.xiaomi.hardware.touchfeature
+ hwbinder
+ 1.0
+
+ ITouchFeature
+ default
+
+
diff --git a/fod/Android.bp b/fod/Android.bp
index 3847756..0ccb45a 100644
--- a/fod/Android.bp
+++ b/fod/Android.bp
@@ -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.
@@ -35,6 +35,7 @@ cc_binary {
"vendor.goodix.hardware.biometrics.fingerprint@2.1",
"vendor.lineage.biometrics.fingerprint.inscreen@1.0",
"vendor.xiaomi.hardware.fingerprintextension@1.0",
+ "vendor.xiaomi.hardware.touchfeature@1.0",
],
}
diff --git a/fod/FingerprintInscreen.cpp b/fod/FingerprintInscreen.cpp
index 177dc3b..5930457 100644
--- a/fod/FingerprintInscreen.cpp
+++ b/fod/FingerprintInscreen.cpp
@@ -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
-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 FingerprintInscreen::onRelease() {
}
Return FingerprintInscreen::onShowFODView() {
- set(FOD_STATUS_PATH, FOD_STATUS_ON);
+ touchFeatureService->setTouchMode(TOUCH_FOD_ENABLE, 1);
return Void();
}
Return FingerprintInscreen::onHideFODView() {
- set(FOD_STATUS_PATH, FOD_STATUS_OFF);
+ touchFeatureService->resetTouchMode(TOUCH_FOD_ENABLE);
return Void();
}
diff --git a/fod/FingerprintInscreen.h b/fod/FingerprintInscreen.h
index 8cad941..8d39985 100644
--- a/fod/FingerprintInscreen.h
+++ b/fod/FingerprintInscreen.h
@@ -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.
@@ -19,6 +19,7 @@
#include
#include
+#include
namespace vendor {
namespace lineage {
@@ -32,6 +33,7 @@ using ::android::sp;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::vendor::xiaomi::hardware::fingerprintextension::V1_0::IXiaomiFingerprint;
+using ::vendor::xiaomi::hardware::touchfeature::V1_0::ITouchFeature;
class FingerprintInscreen : public IFingerprintInscreen {
public:
@@ -53,6 +55,7 @@ public:
Return setCallback(const sp& callback) override;
private:
+ sp touchFeatureService;
sp xiaomiFingerprintService;
std::mutex mCallbackLock;
diff --git a/fod/vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.davinci.rc b/fod/vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.davinci.rc
index 16072d7..8b93887 100644
--- a/fod/vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.davinci.rc
+++ b/fod/vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.davinci.rc
@@ -1,9 +1,6 @@
on boot
chown system system /sys/devices/platform/soc/soc:qcom,dsi-display/fod_ui
- chown system system /sys/devices/virtual/touch/tp_dev/fod_status
-
chmod 0444 /sys/devices/platform/soc/soc:qcom,dsi-display/fod_ui
- chmod 0644 /sys/devices/virtual/touch/tp_dev/fod_status
service vendor.fingerprint-inscreen-1-0 /vendor/bin/hw/vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.davinci
interface vendor.lineage.biometrics.fingerprint.inscreen@1.0::IFingerprintInscreen default
diff --git a/proprietary-files.txt b/proprietary-files.txt
index d7bf04b..b118c3f 100644
--- a/proprietary-files.txt
+++ b/proprietary-files.txt
@@ -910,6 +910,11 @@ vendor/bin/time_daemon
vendor/etc/init/init.time_daemon.rc
vendor/lib64/libtime_genoff.so
+# Touchfeature
+vendor/bin/hw/vendor.xiaomi.hardware.touchfeature@1.0-service
+vendor/etc/init/vendor.xiaomi.hardware.touchfeature@1.0-service.rc
+vendor/lib64/hw/vendor.xiaomi.hardware.touchfeature@1.0-impl.so
+
# Touchscreen firmware
vendor/firmware/goodix_gt9886_limit_f10_first.tporder
vendor/firmware/goodix_gt9886_limit_f10_second.tporder
diff --git a/sepolicy/public/attributes b/sepolicy/public/attributes
index ebb573e..e2c5fa6 100644
--- a/sepolicy/public/attributes
+++ b/sepolicy/public/attributes
@@ -1 +1,3 @@
hal_attribute(motor)
+
+hal_attribute(touchfeature)
diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts
index 08285ac..89f3778 100644
--- a/sepolicy/vendor/file_contexts
+++ b/sepolicy/vendor/file_contexts
@@ -10,13 +10,13 @@
# FOD
/sys/devices/platform/soc/soc:qcom,dsi-display/fod_ui u:object_r:sysfs_fod:s0
-/sys/devices/virtual/touch/tp_dev/fod_status u:object_r:sysfs_fod:s0
# HALs
/vendor/bin/hw/android\.hardware\.light@2\.0-service\.davinci u:object_r:hal_light_default_exec:s0
/vendor/bin/hw/vendor\.lineage\.biometrics\.fingerprint\.inscreen@1\.0-service\.davinci u:object_r:hal_lineage_fod_default_exec:s0
/vendor/bin/hw/vendor\.lineage\.livedisplay@2\.0-service\.davinci u:object_r:hal_lineage_livedisplay_qti_exec:s0
/vendor/bin/hw/vendor\.xiaomi\.hardware\.motor@1\.0-service u:object_r:hal_motor_default_exec:s0
+/vendor/bin/hw/vendor\.xiaomi\.hardware\.touchfeature@1\.0-service u:object_r:hal_touchfeature_default_exec:s0
# HBM
/sys/devices/platform/soc/soc:qcom,dsi-display/hbm u:object_r:sysfs_hbm:s0
@@ -31,6 +31,9 @@
# WiFi
/vendor/bin/nv_mac u:object_r:wcnss_service_exec:s0
+# Touchfeature
+/dev/xiaomi-touch u:object_r:touchfeature_device:s0
+
# Xiaomi thermal daemon
/vendor/bin/mi_thermald u:object_r:mi_thermald_exec:s0
/data/vendor/thermal(/.*)? u:object_r:thermal_data_file:s0
diff --git a/sepolicy/vendor/hal_lineage_fod_default.te b/sepolicy/vendor/hal_lineage_fod_default.te
index d4836e4..2be48f6 100644
--- a/sepolicy/vendor/hal_lineage_fod_default.te
+++ b/sepolicy/vendor/hal_lineage_fod_default.te
@@ -5,5 +5,7 @@ allow hal_lineage_fod_default sysfs_graphics:dir r_dir_perms;
allow hal_lineage_fod_default sysfs_graphics:file rw_file_perms;
allow hal_lineage_fod_default hal_fingerprint_hwservice_xiaomi:hwservice_manager find;
+allow hal_lineage_fod_default hal_touchfeature_hwservice_xiaomi:hwservice_manager find;
binder_call(hal_lineage_fod_default, hal_fingerprint_default)
+binder_call(hal_lineage_fod_default, hal_touchfeature_default)
diff --git a/sepolicy/vendor/hal_touchfeature_default.te b/sepolicy/vendor/hal_touchfeature_default.te
new file mode 100644
index 0000000..ea3c237
--- /dev/null
+++ b/sepolicy/vendor/hal_touchfeature_default.te
@@ -0,0 +1,19 @@
+type hal_touchfeature_hwservice_xiaomi, hwservice_manager_type;
+type touchfeature_device, dev_type;
+type vendor_touchfeature_prop, property_type;
+
+type hal_touchfeature_default, domain;
+hal_server_domain(hal_touchfeature_default, hal_touchfeature)
+
+binder_call(hal_touchfeature_client, hal_touchfeature_server)
+
+type hal_touchfeature_default_exec, exec_type, vendor_file_type, file_type;
+init_daemon_domain(hal_touchfeature_default)
+
+add_hwservice(hal_touchfeature_server, hal_touchfeature_hwservice_xiaomi)
+allow hal_touchfeature_client hal_touchfeature_hwservice_xiaomi:hwservice_manager find;
+
+allow hal_touchfeature_default touchfeature_device:chr_file rw_file_perms;
+set_prop(hal_touchfeature_default, vendor_touchfeature_prop)
+
+vndbinder_use(hal_touchfeature_default)
diff --git a/sepolicy/vendor/hwservice_contexts b/sepolicy/vendor/hwservice_contexts
index 459ba98..7742d0e 100644
--- a/sepolicy/vendor/hwservice_contexts
+++ b/sepolicy/vendor/hwservice_contexts
@@ -1,3 +1,4 @@
vendor.goodix.hardware.biometrics.fingerprint::IGoodixFingerprintDaemon u:object_r:hal_fingerprint_hwservice_xiaomi:s0
vendor.xiaomi.hardware.fingerprintextension::IXiaomiFingerprint u:object_r:hal_fingerprint_hwservice_xiaomi:s0
vendor.xiaomi.hardware.motor::IMotor u:object_r:hal_motor_hwservice_xiaomi:s0
+vendor.xiaomi.hardware.touchfeature::ITouchFeature u:object_r:hal_touchfeature_hwservice_xiaomi:s0
diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts
index c6168f7..d36df4b 100644
--- a/sepolicy/vendor/property_contexts
+++ b/sepolicy/vendor/property_contexts
@@ -21,5 +21,8 @@ vendor.fps_hal. u:object_r:vendor_fp_prop:s0
# Sensors
persist.sensor. u:object_r:persist_sensors_prop:s0
+# Touchfeature
+ro.vendor.touchfeature.type u:object_r:vendor_touchfeature_prop:s0
+
# Xiaomi thermal daemon
sys.thermal. u:object_r:thermal_normal_prop:s0