sm7125-common: sensors: Implement UDFPS sensor

Change-Id: I8b65e3196a7d6f158f4ff589b9755cf7c7e51c92
fourteen-wip
Cosmin Tanislav 3 years ago committed by Simon1511
parent 7b0b484944
commit c1c4ae8953
  1. 3
      overlay/frameworks/base/core/res/res/values/config.xml
  2. 1
      rootdir/etc/init.samsung.rc
  3. 11
      sensors/Sensor.h
  4. 4
      sensors/SensorsSubHal.cpp
  5. 2
      sepolicy/vendor/hal_sensors_default.te

@ -1361,4 +1361,7 @@
<!-- Doze: should the TYPE_PICK_UP_GESTURE sensor be used as a pulse signal. --> <!-- Doze: should the TYPE_PICK_UP_GESTURE sensor be used as a pulse signal. -->
<bool name="config_dozePulsePickup">true</bool> <bool name="config_dozePulsePickup">true</bool>
<!-- 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>

@ -167,6 +167,7 @@ on boot
chmod 0660 /sys/class/sec/tsp/input/enabled chmod 0660 /sys/class/sec/tsp/input/enabled
chown system system /sys/class/sec/tsp/enabled chown system system /sys/class/sec/tsp/enabled
chmod 0660 /sys/class/sec/tsp/enabled chmod 0660 /sys/class/sec/tsp/enabled
chown system system /sys/class/sec/tsp/input/fod_pressed
chown root system /proc/tsp_msg chown root system /proc/tsp_msg
chmod 0440 /proc/tsp_msg chmod 0440 /proc/tsp_msg
chown system radio /sys/class/sec/tsp/pressure_enable chown system radio /sys/class/sec/tsp/pressure_enable

@ -115,6 +115,17 @@ class SysfsPollingOneShotSensor : public OneShotSensor {
int mPollFd; int mPollFd;
}; };
const std::string kTsUdfpsPressedPath = "/sys/class/sec/tsp/input/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 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<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) {
std::vector<SensorInfo> sensors; std::vector<SensorInfo> sensors;

@ -34,6 +34,8 @@ allow hal_sensors_default sysfs_sec_key:file r_file_perms;
allow hal_sensors_default sysfs_sec_touchscreen:dir r_dir_perms; allow hal_sensors_default sysfs_sec_touchscreen:dir r_dir_perms;
allow hal_sensors_default sysfs_sec_touchscreen:file r_file_perms; allow hal_sensors_default sysfs_sec_touchscreen:file r_file_perms;
allow hal_sensors_default sysfs_sec_touchscreen:lnk_file r_file_perms; allow hal_sensors_default sysfs_sec_touchscreen:lnk_file r_file_perms;
allow hal_sensors_default sysfs_power_writable:dir search;
allow hal_sensors_default sysfs_power_writable:file { read open };
# /sys/class/sec/tsp/cmd # /sys/class/sec/tsp/cmd
allow hal_sensors_default sysfs_touchscreen_writable:file rw_file_perms; allow hal_sensors_default sysfs_touchscreen_writable:file rw_file_perms;

Loading…
Cancel
Save