eqs: sensors: Implement UDFPS sensor

Change-Id: I8b65e3196a7d6f158f4ff589b9755cf7c7e51c92
This commit is contained in:
Cosmin Tanislav
2022-02-20 19:21:09 +02:00
parent f934f86c8f
commit 389dc914b7
4 changed files with 18 additions and 0 deletions

View File

@@ -278,4 +278,7 @@
<!-- Type of the double tap sensor. Empty if double tap is not supported. --> <!-- 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> <string name="config_dozeDoubleTapSensorType" translatable="false">org.lineageos.sensor.double_tap</string>
<!-- Type of the udfps long press sensor. Empty if long press is not supported. -->
<string name="config_dozeUdfpsLongPressSensorType" translatable="false">org.lineageos.sensor.udfps</string>
</resources> </resources>

View File

@@ -46,6 +46,8 @@ on post-fs
# Sensors # Sensors
chown system system /sys/devices/platform/soc/990000.i2c/i2c-0/0-005d/touchscreen/primary/double_tap_enabled chown system system /sys/devices/platform/soc/990000.i2c/i2c-0/0-005d/touchscreen/primary/double_tap_enabled
chown system system /sys/devices/platform/soc/990000.i2c/i2c-0/0-005d/touchscreen/primary/double_tap_pressed chown system system /sys/devices/platform/soc/990000.i2c/i2c-0/0-005d/touchscreen/primary/double_tap_pressed
chown system system /sys/devices/platform/soc/990000.i2c/i2c-0/0-005d/touchscreen/primary/udfps_enabled
chown system system /sys/devices/platform/soc/990000.i2c/i2c-0/0-005d/touchscreen/primary/udfps_pressed
on post-fs-data on post-fs-data
# Param updater data for various modules # Param updater data for various modules

View File

@@ -134,6 +134,18 @@ class DoubleTapSensor : public SysfsPollingOneShotSensor {
static_cast<SensorType>(static_cast<int32_t>(SensorType::DEVICE_PRIVATE_BASE) + 1)) {} static_cast<SensorType>(static_cast<int32_t>(SensorType::DEVICE_PRIVATE_BASE) + 1)) {}
}; };
const std::string kTsUdfpsPressedPath = kTsPath + "udfps_pressed";
const std::string kTsUdfpsEnabledPath = kTsPath + "udfps_enabled";
class UdfpsSensor : public SysfsPollingOneShotSensor {
public:
UdfpsSensor(int32_t sensorHandle, ISensorsEventCallback* callback)
: SysfsPollingOneShotSensor(
sensorHandle, callback, kTsUdfpsPressedPath, kTsUdfpsEnabledPath,
"UDFPS Sensor", "org.lineageos.sensor.udfps",
static_cast<SensorType>(static_cast<int32_t>(SensorType::DEVICE_PRIVATE_BASE) + 2)) {}
};
} // namespace implementation } // namespace implementation
} // namespace subhal } // namespace subhal
} // namespace V2_1 } // namespace V2_1

View File

@@ -34,6 +34,7 @@ using ::android::hardware::sensors::V2_0::implementation::ScopedWakelock;
SensorsSubHal::SensorsSubHal() : mCallback(nullptr), mNextHandle(1) { SensorsSubHal::SensorsSubHal() : mCallback(nullptr), mNextHandle(1) {
AddSensor<DoubleTapSensor>(); AddSensor<DoubleTapSensor>();
AddSensor<UdfpsSensor>();
} }
Return<void> SensorsSubHal::getSensorsList_2_1(ISensors::getSensorsList_2_1_cb _hidl_cb) { Return<void> SensorsSubHal::getSensorsList_2_1(ISensors::getSensorsList_2_1_cb _hidl_cb) {