rhodep: sensors: Implement double tap sensor

Change-Id: I6c217c994d6e4d5ae062a31a44fffc9f097a7f6f
This commit is contained in:
Cosmin Tanislav 2022-09-21 10:09:08 +05:30 committed by Anand S
parent 38132c5884
commit 4c0b8f716d
No known key found for this signature in database
GPG key ID: EFD0D6FBB9A067B4
4 changed files with 25 additions and 8 deletions

View file

@ -314,4 +314,7 @@
<!-- Whether the device enable the non-standalone (NSA) mode of 5G NR.-->
<bool name="config_telephony5gNonStandalone">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>
</resources>

View file

@ -1,13 +1,6 @@
# sec_nfc
import /vendor/etc/init/hw/init.nfc.sec.rc
on post-fs
# "Tap to wake" gesture
chown root input /sys/class/sensors/dt-gesture/enable
chmod 0660 /sys/class/sensors/dt-gesture/enable
chown root input /sys/class/sensors/dt-gesture/poll_delay
chmod 0660 /sys/class/sensors/dt-gesture/poll_delay
on post-fs
chown system system /sys/devices/platform/soc/4804000.ufshc/clkgate_enable
chown system system /sys/devices/platform/soc/4804000.ufshc/devfreq/4804000.ufshc/min_freq
@ -27,6 +20,11 @@ service vendor.ident-fps-overlay-sh /vendor/bin/init.oem.fingerprint.overlay.sh
oneshot
disabled
on post-fs
# Sensors
chown system system /sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.0/touchscreen/primary/double_tap_enabled
chown system system /sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.0/touchscreen/primary/double_tap_pressed
on post-fs-data
exec_start vendor.ident-fps-overlay-sh
chown system system /dev/fpsensor

View file

@ -120,6 +120,20 @@ class SysfsPollingOneShotSensor : public OneShotSensor {
int mPollFd;
};
const std::string kTsPath = "/sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.0/touchscreen/primary/";
const std::string kTsDoubleTapPressedPath = kTsPath + "double_tap_pressed";
const std::string kTsDoubleTapEnabledPath = kTsPath + "double_tap_enabled";
class DoubleTapSensor : public SysfsPollingOneShotSensor {
public:
DoubleTapSensor(int32_t sensorHandle, ISensorsEventCallback* callback)
: SysfsPollingOneShotSensor(
sensorHandle, callback, kTsDoubleTapPressedPath, kTsDoubleTapEnabledPath,
"Double Tap Sensor", "org.lineageos.sensor.double_tap",
static_cast<SensorType>(static_cast<int32_t>(SensorType::DEVICE_PRIVATE_BASE) + 1)) {}
};
} // 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<DoubleTapSensor>();
}
Return<void> SensorsSubHal::getSensorsList_2_1(ISensors::getSensorsList_2_1_cb _hidl_cb) {
std::vector<SensorInfo> sensors;