sm8450-common: Move to double tap sensor

Change-Id: Ib4803011fefad35c8b7a2d1e2b7d2744b32b13f4
This commit is contained in:
Arian 2024-06-01 19:13:29 +02:00
parent 999f5ead73
commit ec8a98e97f
7 changed files with 11 additions and 72 deletions

View file

@ -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

View file

@ -10,6 +10,9 @@
<!-- Doze: should the TYPE_PICK_UP_GESTURE sensor be used as a pulse signal. -->
<bool name="config_dozePulsePickup">true</bool>
<!-- Type of the double tap sensor. Empty if double tap is not supported. -->
<string name="config_dozeDoubleTapSensorType" translatable="false">org.lineageos.sensor.double_tap</string>
<!-- Type of the tap sensor. Empty if tap is not supported. -->
<string name="config_dozeTapSensorType" translatable="false">org.lineageos.sensor.single_tap</string>
@ -58,9 +61,6 @@
<!-- If true, the display will be shifted around in ambient mode. -->
<bool name="config_enableBurnInProtection">true</bool>
<!-- Whether device supports double tap to wake -->
<bool name="config_supportDoubleTapWake">true</bool>
<!-- Low zone brightness thresholds in the range [0, 255] -->
<integer-array name="config_brightnessThresholdsOfPeakRefreshRate" translatable="false">
<item>7</item>

View file

@ -1,65 +0,0 @@
/*
* Copyright (C) 2021 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <aidl/android/hardware/power/BnPower.h>
#include <android-base/file.h>
#include <android-base/logging.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -1 +0,0 @@
allow hal_power_default touchfeature_device:chr_file rw_file_perms;