r8s: sensors: Implement UDFPS sensor

Change-Id: I8b65e3196a7d6f158f4ff589b9755cf7c7e51c92
This commit is contained in:
Cosmin Tanislav
2022-02-20 19:21:09 +02:00
committed by borbelyvince
parent 40e70817cc
commit 0c7d011952
3 changed files with 17 additions and 1 deletions

View File

@@ -42,4 +42,7 @@
@see https://www.w3.org/TR/SVG/paths.html#PathData
-->
<string name="config_mainBuiltInDisplayCutout">M 0,0 H -62 V 88 H 62 V 0 H 0 Z</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>

View File

@@ -115,6 +115,17 @@ class SysfsPollingOneShotSensor : public OneShotSensor {
int mPollFd;
};
const std::string kTsUdfpsPressedPath = "/sys/class/sec/tsp/fod_pressed";
class UdfpsSensor : public SysfsPollingOneShotSensor {
public:
UdfpsSensor(int32_t sensorHandle, ISensorsEventCallback* callback)
: SysfsPollingOneShotSensor(
sensorHandle, callback, kTsUdfpsPressedPath,
"UDFPS Sensor", "org.lineageos.sensor.udfps",
static_cast<SensorType>(static_cast<int32_t>(SensorType::DEVICE_PRIVATE_BASE) + 2)) {}
};
} // namespace implementation
} // namespace subhal
} // namespace V2_1

View File

@@ -32,7 +32,9 @@ namespace implementation {
using ::android::hardware::Void;
using ::android::hardware::sensors::V2_0::implementation::ScopedWakelock;
SensorsSubHal::SensorsSubHal() : mCallback(nullptr), mNextHandle(1) {}
SensorsSubHal::SensorsSubHal() : mCallback(nullptr), mNextHandle(1) {
AddSensor<UdfpsSensor>();
}
Return<void> SensorsSubHal::getSensorsList_2_1(ISensors::getSensorsList_2_1_cb _hidl_cb) {
std::vector<SensorInfo> sensors;