sm7125-common: sensors: Implement UDFPS sensor

Change-Id: I8b65e3196a7d6f158f4ff589b9755cf7c7e51c92
tirimbino
Cosmin Tanislav 2 years ago committed by Ruchit Marathe
parent 23c9f5277f
commit 6261647b3f
  1. 2
      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

@ -1228,4 +1228,6 @@
<!-- The type of the light sensor to be used by the display framework for things like
auto-brightness. If unset, then it just gets the default sensor of type TYPE_LIGHT. -->
<string name="config_displayLightSensorType">com.samsung.sensor.physical_light</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>

@ -167,6 +167,7 @@ on boot
chmod 0660 /sys/class/sec/tsp/input/enabled
chown system system /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
chmod 0440 /proc/tsp_msg
chown system radio /sys/class/sec/tsp/pressure_enable

@ -115,6 +115,17 @@ class SysfsPollingOneShotSensor : public OneShotSensor {
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 subhal
} // namespace V2_1

@ -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;

@ -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: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
allow hal_sensors_default sysfs_touchscreen_writable:file rw_file_perms;

Loading…
Cancel
Save