From ec8a98e97f3c8fbe778cd883775e13ce31baddca Mon Sep 17 00:00:00 2001 From: Arian Date: Sat, 1 Jun 2024 19:13:29 +0200 Subject: [PATCH] sm8450-common: Move to double tap sensor Change-Id: Ib4803011fefad35c8b7a2d1e2b7d2744b32b13f4 --- BoardConfigCommon.mk | 3 - .../FrameworksResXiaomi/res/values/config.xml | 6 +- power/power-mode.cpp | 65 ------------------- properties/vendor.prop | 1 + rootdir/etc/init.touch_report.rc | 5 ++ sepolicy/vendor/genfs_contexts | 2 + sepolicy/vendor/hal_power.te | 1 - 7 files changed, 11 insertions(+), 72 deletions(-) delete mode 100644 power/power-mode.cpp delete mode 100644 sepolicy/vendor/hal_power.te diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk index dae1418..140aa90 100644 --- a/BoardConfigCommon.mk +++ b/BoardConfigCommon.mk @@ -192,9 +192,6 @@ TARGET_COPY_OUT_VENDOR_DLKM := vendor_dlkm BOARD_USES_QCOM_HARDWARE := true TARGET_BOARD_PLATFORM := taro -# Power -TARGET_POWERHAL_MODE_EXT := $(COMMON_PATH)/power/power-mode.cpp - # PowerShare SOONG_CONFIG_NAMESPACES += XIAOMI_POWERSHARE SOONG_CONFIG_XIAOMI_POWERSHARE := WIRELESS_TX_ENABLE_PATH diff --git a/overlay/FrameworksResXiaomi/res/values/config.xml b/overlay/FrameworksResXiaomi/res/values/config.xml index fc18806..8728a01 100644 --- a/overlay/FrameworksResXiaomi/res/values/config.xml +++ b/overlay/FrameworksResXiaomi/res/values/config.xml @@ -10,6 +10,9 @@ true + + org.lineageos.sensor.double_tap + org.lineageos.sensor.single_tap @@ -58,9 +61,6 @@ true - - true - 7 diff --git a/power/power-mode.cpp b/power/power-mode.cpp deleted file mode 100644 index 81b238a..0000000 --- a/power/power-mode.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2021 The LineageOS Project - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include - -#define SET_CUR_VALUE 0 -#define TOUCH_DOUBLETAP_MODE 14 -#define TOUCH_MAGIC 't' -#define TOUCH_IOC_SETMODE _IO(TOUCH_MAGIC, SET_CUR_VALUE) -#define TOUCH_DEV_PATH "/dev/xiaomi-touch" -#define TOUCH_ID_PRIMARY 0 -#define TOUCH_ID_SECONDARY 1 -#define MI_DISP_SECONDARY "/sys/devices/virtual/mi_display/disp_feature/disp-DSI-1" - -namespace aidl { -namespace android { -namespace hardware { -namespace power { -namespace impl { - -using ::aidl::android::hardware::power::Mode; - -bool isDeviceSpecificModeSupported(Mode type, bool* _aidl_return) { - switch (type) { - case Mode::DOUBLE_TAP_TO_WAKE: - *_aidl_return = true; - return true; - default: - return false; - } -} - -bool setDeviceSpecificMode(Mode type, bool enabled) { - switch (type) { - case Mode::DOUBLE_TAP_TO_WAKE: { - int fd = open(TOUCH_DEV_PATH, O_RDWR); - int arg_primary[3] = {TOUCH_ID_PRIMARY, TOUCH_DOUBLETAP_MODE, enabled ? 1 : 0}; - ioctl(fd, TOUCH_IOC_SETMODE, &arg_primary); - - struct stat buffer; - if (stat(MI_DISP_SECONDARY, &buffer) == 0) { - int arg_secondary[3] = {TOUCH_ID_SECONDARY, TOUCH_DOUBLETAP_MODE, enabled ? 1 : 0}; - ioctl(fd, TOUCH_IOC_SETMODE, &arg_secondary); - } - - close(fd); - return true; - } - default: - return false; - } -} - -} // namespace impl -} // namespace power -} // namespace hardware -} // namespace android -} // namespace aidl diff --git a/properties/vendor.prop b/properties/vendor.prop index fb3225e..3c2e0d0 100644 --- a/properties/vendor.prop +++ b/properties/vendor.prop @@ -203,6 +203,7 @@ ro.vendor.radio.build_profile=u-stable persist.vendor.rcs.singlereg.feature=1 # Sensors +ro.vendor.sensors.xiaomi.double_tap=true ro.vendor.sensors.xiaomi.single_tap=true # SSR diff --git a/rootdir/etc/init.touch_report.rc b/rootdir/etc/init.touch_report.rc index a173c41..5dfb66e 100644 --- a/rootdir/etc/init.touch_report.rc +++ b/rootdir/etc/init.touch_report.rc @@ -109,6 +109,11 @@ on boot chown system system /sys/class/touch/touch_dev/gesture_single_tap_enabled chmod 0660 /sys/class/touch/touch_dev/gesture_single_tap_enabled + chown system system /sys/class/touch/touch_dev/gesture_double_tap_enabled + chmod 0660 /sys/class/touch/touch_dev/gesture_double_tap_enabled + chown system system /sys/class/touch/touch_dev/gesture_double_tap_state + chmod 0664 /sys/class/touch/touch_dev/gesture_double_tap_state + service touch_report /vendor/bin/touch_report class hal user system diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts index 15336bc..578e1e3 100644 --- a/sepolicy/vendor/genfs_contexts +++ b/sepolicy/vendor/genfs_contexts @@ -8,6 +8,8 @@ genfscon sysfs /devices/platform/soc/soc:fingerprint_fpc u:object_r:vendor_sysfs # Sensors genfscon sysfs /devices/virtual/touch/touch_dev/fod_longpress_gesture_enabled u:object_r:vendor_sysfs_sensors:s0 +genfscon sysfs /devices/virtual/touch/touch_dev/gesture_double_tap_enabled u:object_r:vendor_sysfs_sensors:s0 +genfscon sysfs /devices/virtual/touch/touch_dev/gesture_double_tap_state u:object_r:vendor_sysfs_sensors:s0 genfscon sysfs /devices/virtual/touch/touch_dev/gesture_single_tap_enabled u:object_r:vendor_sysfs_sensors:s0 genfscon sysfs /devices/virtual/touch/touch_dev/gesture_single_tap_state u:object_r:vendor_sysfs_sensors:s0 diff --git a/sepolicy/vendor/hal_power.te b/sepolicy/vendor/hal_power.te deleted file mode 100644 index 92f56ab..0000000 --- a/sepolicy/vendor/hal_power.te +++ /dev/null @@ -1 +0,0 @@ -allow hal_power_default touchfeature_device:chr_file rw_file_perms;