rhodep: sensors: Implement double tap sensor
Change-Id: I6c217c994d6e4d5ae062a31a44fffc9f097a7f6f
This commit is contained in:
parent
38132c5884
commit
4c0b8f716d
4 changed files with 25 additions and 8 deletions
|
@ -314,4 +314,7 @@
|
||||||
|
|
||||||
<!-- Whether the device enable the non-standalone (NSA) mode of 5G NR.-->
|
<!-- Whether the device enable the non-standalone (NSA) mode of 5G NR.-->
|
||||||
<bool name="config_telephony5gNonStandalone">true</bool>
|
<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>
|
</resources>
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
# sec_nfc
|
# sec_nfc
|
||||||
import /vendor/etc/init/hw/init.nfc.sec.rc
|
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
|
on post-fs
|
||||||
chown system system /sys/devices/platform/soc/4804000.ufshc/clkgate_enable
|
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
|
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
|
oneshot
|
||||||
disabled
|
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
|
on post-fs-data
|
||||||
exec_start vendor.ident-fps-overlay-sh
|
exec_start vendor.ident-fps-overlay-sh
|
||||||
chown system system /dev/fpsensor
|
chown system system /dev/fpsensor
|
||||||
|
|
|
@ -120,6 +120,20 @@ class SysfsPollingOneShotSensor : public OneShotSensor {
|
||||||
int mPollFd;
|
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 implementation
|
||||||
} // namespace subhal
|
} // namespace subhal
|
||||||
} // namespace V2_1
|
} // namespace V2_1
|
||||||
|
|
|
@ -32,7 +32,9 @@ namespace implementation {
|
||||||
using ::android::hardware::Void;
|
using ::android::hardware::Void;
|
||||||
using ::android::hardware::sensors::V2_0::implementation::ScopedWakelock;
|
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) {
|
Return<void> SensorsSubHal::getSensorsList_2_1(ISensors::getSensorsList_2_1_cb _hidl_cb) {
|
||||||
std::vector<SensorInfo> sensors;
|
std::vector<SensorInfo> sensors;
|
||||||
|
|
Loading…
Reference in a new issue