diff --git a/sensors/Android.bp b/sensors/Android.bp index 30dc413..5980c83 100644 --- a/sensors/Android.bp +++ b/sensors/Android.bp @@ -8,7 +8,7 @@ soong_config_module_type { name: "sensors_xiaomi_cc_defaults", module_type: "cc_defaults", config_namespace: "SENSORS_XIAOMI", - bool_variables: ["USES_UDFPS_SENSOR", "USES_DOUBLE_TAP_SENSOR"], + bool_variables: ["USES_UDFPS_SENSOR", "USES_DOUBLE_TAP_SENSOR", "USES_SINGLE_TAP_SENSOR"], properties: ["cppflags"], } @@ -21,6 +21,9 @@ sensors_xiaomi_cc_defaults { USES_DOUBLE_TAP_SENSOR: { cppflags: ["-DUSES_DOUBLE_TAP_SENSOR"], }, + USES_SINGLE_TAP_SENSOR: { + cppflags: ["-DUSES_SINGLE_TAP_SENSOR"], + }, }, } diff --git a/sensors/Sensor.h b/sensors/Sensor.h index 8cc0c6f..2c43179 100644 --- a/sensors/Sensor.h +++ b/sensors/Sensor.h @@ -152,6 +152,22 @@ class DoubleTapSensor : public SysfsPollingOneShotSensor { }; #endif +#ifdef USES_SINGLE_TAP_SENSOR +static const char* singleTapPaths[] = { + "/sys/devices/platform/soc/884000.i2c/i2c-1/1-0038/single_tap_pressed", + NULL +}; + +class SingleTapSensor : public SysfsPollingOneShotSensor { + public: + SingleTapSensor(int32_t sensorHandle, ISensorsEventCallback* callback) + : SysfsPollingOneShotSensor( + sensorHandle, callback, GetPollPath(singleTapPaths), + "Single Tap Sensor", "co.aospa.sensor.single_tap", + static_cast(static_cast(SensorType::DEVICE_PRIVATE_BASE) + 1)) {} +}; +#endif + } // namespace implementation } // namespace subhal } // namespace V2_1 diff --git a/sensors/SensorsSubHal.cpp b/sensors/SensorsSubHal.cpp index 23e1ac7..7515423 100644 --- a/sensors/SensorsSubHal.cpp +++ b/sensors/SensorsSubHal.cpp @@ -39,6 +39,9 @@ SensorsSubHal::SensorsSubHal() : mCallback(nullptr), mNextHandle(1) { #ifdef USES_DOUBLE_TAP_SENSOR AddSensor(); #endif +#ifdef USES_SINGLE_TAP_SENSOR + AddSensor(); +#endif } Return SensorsSubHal::getSensorsList_2_1(ISensors::getSensorsList_2_1_cb _hidl_cb) {