From a5fb51b23d77c60339f5f78b6cd06d542ac16ef5 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 8 Apr 2020 19:02:14 +0200 Subject: [PATCH] common: Add lhd Change-Id: I63728476203bbbbb11c7d3ffad8575cb700cb21e --- common/vendor/device.te | 1 + common/vendor/file.te | 3 +++ common/vendor/file_contexts | 10 ++++++++++ common/vendor/genfs_contexts | 2 ++ common/vendor/lhd.te | 35 +++++++++++++++++++++++++++++++++++ 5 files changed, 51 insertions(+) create mode 100644 common/vendor/lhd.te diff --git a/common/vendor/device.te b/common/vendor/device.te index 6c88642..f3bcba9 100644 --- a/common/vendor/device.te +++ b/common/vendor/device.te @@ -8,6 +8,7 @@ type omr_block_device, dev_type; type radio_block_device, dev_type; type sec_efs_block_device, dev_type; +type bbd_device, dev_type; type drb_device, dev_type; type fp_sensor_device, dev_type; type io_device, dev_type; diff --git a/common/vendor/file.te b/common/vendor/file.te index 58ad04b..3734c4f 100644 --- a/common/vendor/file.te +++ b/common/vendor/file.te @@ -25,6 +25,7 @@ type sysfs_battery, sysfs_type, r_fs_type, fs_type; type sysfs_fingerprint, sysfs_type, r_fs_type, fs_type; type sysfs_iio, sysfs_type, r_fs_type, fs_type; type sysfs_input, sysfs_type, r_fs_type, fs_type; +type sysfs_sec_gps, sysfs_type, r_fs_type, fs_type; type sysfs_sec_key, sysfs_type, r_fs_type, fs_type; type sysfs_sec_sensors, sysfs_type, r_fs_type, fs_type; type sysfs_sec_touchscreen, sysfs_type, r_fs_type, fs_type; @@ -34,8 +35,10 @@ type sysfs_wifi, sysfs_type, r_fs_type, fs_type; type sysfs_backlight_writable, sysfs_type, rw_fs_type, fs_type; type sysfs_battery_writable, sysfs_type, rw_fs_type, fs_type; +type sysfs_gps_writable, sysfs_type, rw_fs_type, fs_type; type sysfs_lcd_writable, sysfs_type, rw_fs_type, fs_type; type sysfs_power_writable, sysfs_type, rw_fs_type, fs_type; +type sysfs_sensorhub_writable, sysfs_type, rw_fs_type, fs_type; type sysfs_sensors_writable, sysfs_type, rw_fs_type, fs_type; type sysfs_sim_writable, sysfs_type, rw_fs_type, fs_type; type sysfs_spi_writeable, sysfs_type, rw_fs_type, fs_type; diff --git a/common/vendor/file_contexts b/common/vendor/file_contexts index bf3637e..d1b3921 100644 --- a/common/vendor/file_contexts +++ b/common/vendor/file_contexts @@ -27,6 +27,16 @@ /dev/batch_io u:object_r:io_device:s0 /dev/ssp_sensorhub u:object_r:ssp_device:s0 +### gnss/gps +/dev/bbd_control u:object_r:bbd_device:s0 +/dev/bbd_packet u:object_r:bbd_device:s0 +/dev/bbd_patch u:object_r:bbd_device:s0 +/dev/bbd_reliable u:object_r:bbd_device:s0 +/dev/bbd_sensor u:object_r:bbd_device:s0 +/dev/bbd_sio u:object_r:bbd_device:s0 +/dev/bbd_urgent_patch u:object_r:bbd_device:s0 +/dev/ttyBCM[0-9]* u:object_r:bbd_device:s0 + ### radio # DRB /dev/drb u:object_r:drb_device:s0 diff --git a/common/vendor/genfs_contexts b/common/vendor/genfs_contexts index 94e0659..d17cb2a 100644 --- a/common/vendor/genfs_contexts +++ b/common/vendor/genfs_contexts @@ -7,6 +7,7 @@ genfscon sysfs /class/backlight/ u:obje genfscon sysfs /class/fingerprint/fingerprint u:object_r:sysfs_fingerprint:s0 genfscon sysfs /class/input u:object_r:sysfs_input:s0 genfscon sysfs /class/power_supply u:object_r:sysfs_battery:s0 +genfscon sysfs /class/sec/gps u:object_r:sysfs_sec_gps:s0 genfscon sysfs /class/sec/sensors u:object_r:sysfs_sec_sensors:s0 genfscon sysfs /class/sec/tsp u:object_r:sysfs_sec_touchscreen:s0 genfscon sysfs /class/sensor_event u:object_r:sysfs_sensors:s0 @@ -23,6 +24,7 @@ genfscon sysfs /devices/platform/panel@0/lcd/panel u:obje genfscon sysfs /devices/virtual/fingerprint/fingerprint u:object_r:sysfs_fingerprint:s0 genfscon sysfs /devices/virtual/input u:object_r:sysfs_input:s0 genfscon sysfs /devices/virtual/lcd/panel u:object_r:sysfs_lcd_writable:s0 +genfscon sysfs /devices/virtual/sec/gps u:object_r:sysfs_sec_gps:s0 genfscon sysfs /devices/virtual/sec/sec_key u:object_r:sysfs_sec_key:s0 genfscon sysfs /devices/virtual/sec/tsp u:object_r:sysfs_sec_touchscreen:s0 genfscon sysfs /devices/virtual/sec/tsp/cmd u:object_r:sysfs_touchscreen_writable:s0 diff --git a/common/vendor/lhd.te b/common/vendor/lhd.te new file mode 100644 index 0000000..fa27fca --- /dev/null +++ b/common/vendor/lhd.te @@ -0,0 +1,35 @@ +type lhd, domain; +type lhd_exec, exec_type, vendor_file_type, file_type; + +# lhd is started by init, type transit from init domain to lhd domain +init_daemon_domain(lhd) + +get_prop(lhd, hwservicemanager_prop) +hwbinder_use(lhd) +allow lhd system_suspend_hwservice:hwservice_manager { find }; +binder_call(lhd, system_suspend_server) + +allow lhd self:tcp_socket create_stream_socket_perms; +allow lhd port:tcp_socket { name_bind name_connect }; +allow lhd node:tcp_socket node_bind; + +# /data/vendor/gps +allow lhd gps_vendor_data_file:dir rw_dir_perms; +allow lhd gps_vendor_data_file:file create_file_perms; +allow lhd gps_vendor_data_file:fifo_file create_file_perms; + +# /dev/bbd_control +allow lhd bbd_device:chr_file rw_file_perms; + +# /dev/socket/fwmarkd +allow lhd fwmarkd_socket:sock_file write; + +# /sys/class/sec/gps +allow lhd sysfs_sec_gps:dir r_dir_perms; +allow lhd sysfs_sec_gps:file r_file_perms; + +# /sys/devices/virtual/sec/sensorhub/mcu_power +allow lhd sysfs_sensorhub_writable:file rw_file_perms; + +# /sys/class/sec/gps/GPS_PWR_EN/value +allow lhd sysfs_gps_writable:file rw_file_perms; -- 2.20.1