vibrator: add initial forcefeedback vibrator HAL
This HAL talks to vibrators which are exposed as input devices using the
forcefeedback API.
This version includes lots of debugging spam.
diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts
index 7c5f8e4..2472171 100644
--- a/sepolicy/file_contexts
+++ b/sepolicy/file_contexts
@@ -6,6 +6,7 @@
/dev/dri u:object_r:dri_device:s0
/dev/dri/card0 u:object_r:graphics_device:s0
/dev/dri/renderD128 u:object_r:gpu_device:s0
+/dev/input/.* u:object_r:input_device:s0
/dev/qcom_rmtfs_mem1 u:object_r:rmtfs_device:s0
/dev/ttyMSM0 u:object_r:console_device:s0
@@ -28,6 +29,7 @@
/vendor/bin/hw/android\.hardware\.gatekeeper@1\.0-service\.software u:object_r:hal_gatekeeper_default_exec:s0
/vendor/bin/hw/android\.hardware\.graphics\.allocator@4\.0-service\.minigbm_msm u:object_r:hal_graphics_allocator_default_exec:s0
+/vendor/bin/hw/android\.hardware\.vibrator@1\.1-service\.sdm845 u:object_r:hal_vibrator_default_exec:s0
/vendor/bin/hw/android\.hardware\.light@2\.0-service u:object_r:hal_light_default_exec:s0
/vendor/bin/pd-mapper u:object_r:pd_mapper_exec:s0
/vendor/bin/qrtr-cfg u:object_r:qrtr_exec:s0
diff --git a/sepolicy/hal_vibrator.te b/sepolicy/hal_vibrator.te
new file mode 100644
index 0000000..9a755bf
--- /dev/null
+++ b/sepolicy/hal_vibrator.te
@@ -0,0 +1,13 @@
+# Vibrator HAL scans input devices to find the haptics device
+# it then calls ioctls on it.
+# type hal_vibrator_default_exec, exec_type, vendor_file_type, file_type;
+init_daemon_domain(hal_vibrator_default);
+
+allow hal_vibrator_default input_device:chr_file { ioctl open read write };
+# EVIOCGBIT + EV_FF
+allowxperm hal_vibrator_default input_device:chr_file ioctl 0x4535;
+# EVIOCSFF
+allowxperm hal_vibrator_default input_device:chr_file ioctl 0x4580;
+# EVIOCRMFF
+allowxperm hal_vibrator_default input_device:chr_file ioctl 0x4581;
+allow hal_vibrator_default input_device:dir { open read search };