sensors: Implement single tap sensor

Change-Id: I838121ffc627fb8091ce16e0ec4499f5f44bc446
This commit is contained in:
Arian 2024-05-31 02:05:57 +02:00
parent 55b7558c79
commit b5ae2b09f2
2 changed files with 14 additions and 0 deletions

View File

@ -132,6 +132,17 @@ class DoubleTapSensor : public SysfsPollingOneShotSensor {
1)) {}
};
class SingleTapSensor : public SysfsPollingOneShotSensor {
public:
SingleTapSensor(int32_t sensorHandle, ISensorsEventCallback* callback)
: SysfsPollingOneShotSensor(
sensorHandle, callback, "/sys/class/touch/touch_dev/gesture_single_tap_state",
"/sys/class/touch/touch_dev/gesture_single_tap_enabled", "Single Tap Sensor",
"org.lineageos.sensor.single_tap",
static_cast<SensorType>(static_cast<int32_t>(SensorType::DEVICE_PRIVATE_BASE) +
2)) {}
};
} // namespace implementation
} // namespace subhal
} // namespace V2_1

View File

@ -36,6 +36,9 @@ SensorsSubHal::SensorsSubHal() : mCallback(nullptr), mNextHandle(1) {
if (property_get_bool("ro.vendor.sensors.xiaomi.double_tap", false)) {
AddSensor<DoubleTapSensor>();
}
if (property_get_bool("ro.vendor.sensors.xiaomi.single_tap", false)) {
AddSensor<SingleTapSensor>();
}
}
Return<void> SensorsSubHal::getSensorsList_2_1(ISensors::getSensorsList_2_1_cb _hidl_cb) {