summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVince Leung <leungv@google.com>2021-04-30 16:46:48 -0700
committerVince Leung <leungv@google.com>2021-05-17 16:18:44 +0000
commita883cba76335d926124aaf6a00fbe0d29cec8081 (patch)
tree9c2ff7fb232b3bbc9b31ceb1df4449bf3a109730
parent9e1f66d5b5582ac8e67215cd9479fb18264585b2 (diff)
downloadpixel-sepolicy-a883cba76335d926124aaf6a00fbe0d29cec8081.tar.gz
vibrator: cs40l25: allow access to audio devices
Add policies to allow access to audio devices required for audio haptics channel. Bug: 178431048 Test: manually verify audio-coupled-haptics is working for Pixel ringtones on P21 devices Change-Id: I8e481ba65b5a713bcc2e25fdf4727ad68ba7f721
-rw-r--r--vibrator/common/device.te1
-rw-r--r--vibrator/cs40l25/file_contexts3
-rw-r--r--vibrator/cs40l25/hal_vibrator_default.te6
3 files changed, 10 insertions, 0 deletions
diff --git a/vibrator/common/device.te b/vibrator/common/device.te
new file mode 100644
index 0000000..3460c8c
--- /dev/null
+++ b/vibrator/common/device.te
@@ -0,0 +1 @@
+type vibrator_snd_device, dev_type;
diff --git a/vibrator/cs40l25/file_contexts b/vibrator/cs40l25/file_contexts
index adcc5c6..4cc9af0 100644
--- a/vibrator/cs40l25/file_contexts
+++ b/vibrator/cs40l25/file_contexts
@@ -1,2 +1,5 @@
/vendor/bin/hw/android\.hardware\.vibrator-service\.cs40l25 u:object_r:hal_vibrator_default_exec:s0
/vendor/bin/hw/android\.hardware\.vibrator-service\.cs40l25-dual u:object_r:hal_vibrator_default_exec:s0
+
+/dev/snd/pcmC0D24p u:object_r:vibrator_snd_device:s0
+/dev/snd/pcmC1D24p u:object_r:vibrator_snd_device:s0
diff --git a/vibrator/cs40l25/hal_vibrator_default.te b/vibrator/cs40l25/hal_vibrator_default.te
index 3d337bf..d5992b9 100644
--- a/vibrator/cs40l25/hal_vibrator_default.te
+++ b/vibrator/cs40l25/hal_vibrator_default.te
@@ -2,6 +2,12 @@ allow hal_vibrator_default sysfs_leds:dir search;
allow hal_vibrator_default mnt_vendor_file:dir search;
allow hal_vibrator_default persist_file:dir search;
+
+allow hal_vibrator_default vibrator_snd_device:chr_file rw_file_perms;
+allow hal_vibrator_default vibrator_snd_device:dir search;
+allow hal_vibrator_default proc_asound:dir search;
+allow hal_vibrator_default proc_asound:file r_file_perms;
+
r_dir_file(hal_vibrator_default, persist_haptics_file)
get_prop(hal_vibrator_default, vendor_vibrator_prop);