From 5d98dda6dd2c89c19c9ede5a9b48066889b7d60d Mon Sep 17 00:00:00 2001 From: Stephane Lee Date: Tue, 5 Apr 2022 13:43:00 -0700 Subject: BatteryDefender: Allow health to read typec sysfs nodes Bug: 192828279 Bug: 180104512 Test: Ensure that there are no sepolicy errors on boot for hal_health_default Change-Id: Id58a3fc5db45608f151e4c3926faec3034a3e7cc --- vendor/google/file.te | 1 + vendor/google/genfs_contexts | 1 + vendor/google/hal_health_default.te | 2 ++ vendor/google/hal_usb_impl.te | 3 +++ vendor/google/pixelstats_vendor.te | 1 + 5 files changed, 8 insertions(+) diff --git a/vendor/google/file.te b/vendor/google/file.te index 726d585..633643c 100644 --- a/vendor/google/file.te +++ b/vendor/google/file.te @@ -33,6 +33,7 @@ type sysfs_fingerprint, sysfs_type, fs_type; type per_boot_file, file_type, data_file_type, core_data_file_type; type proc_sched_lib_mask_cpuinfo, proc_type, fs_type; type sysfs_limit_power_transfer, sysfs_type, fs_type; +type sysfs_typec_info, sysfs_type, fs_type; # Dumpstates bootloader logs type proc_bldrlog, fs_type, proc_type; diff --git a/vendor/google/genfs_contexts b/vendor/google/genfs_contexts index a0f0d6b..de173a2 100644 --- a/vendor/google/genfs_contexts +++ b/vendor/google/genfs_contexts @@ -127,6 +127,7 @@ genfscon debugfs /tcpm/usbpd0 u:object_r:debugfs_usb:s0 genfscon debugfs /logbuffer/usbpd u:object_r:debugfs_usb:s0 genfscon debugfs /logbuffer/smblib u:object_r:debugfs_usb:s0 genfscon debugfs /logbuffer/pps u:object_r:debugfs_usb:s0 +genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-00/c440000.qcom,spmi:qcom,pm6150@0:qcom,usb-pdphy@1700/usbpd0/typec u:object_r:sysfs_typec_info:s0 # Dumpstate hal genfscon debugfs /dma_buf/bufinfo u:object_r:debugfs_dma_buf:s0 diff --git a/vendor/google/hal_health_default.te b/vendor/google/hal_health_default.te index 4adbaa1..4d79c14 100644 --- a/vendor/google/hal_health_default.te +++ b/vendor/google/hal_health_default.te @@ -12,3 +12,5 @@ allow hal_health_default persist_battery_file:file create_file_perms; allow hal_health_default persist_battery_file:dir rw_dir_perms; allow hal_health_default mnt_vendor_file:dir search; allow hal_health_default sysfs_chargelevel:file rw_file_perms; + +r_dir_file(hal_health_default, sysfs_typec_info) diff --git a/vendor/google/hal_usb_impl.te b/vendor/google/hal_usb_impl.te index beedf6b..c2e9e52 100644 --- a/vendor/google/hal_usb_impl.te +++ b/vendor/google/hal_usb_impl.te @@ -12,3 +12,6 @@ allow hal_usb_impl sysfs_contaminant:file rw_file_perms; allow hal_usb_impl sysfs_limit_power_transfer:file rw_file_perms; set_prop(hal_usb_impl, vendor_usb_prop) allow hal_usb_impl sysfs_extcon:dir search; + +r_dir_file(hal_usb_impl, sysfs_typec_info) +allow hal_usb_impl sysfs_typec_info:file rw_file_perms; diff --git a/vendor/google/pixelstats_vendor.te b/vendor/google/pixelstats_vendor.te index d8e82e6..24f3170 100644 --- a/vendor/google/pixelstats_vendor.te +++ b/vendor/google/pixelstats_vendor.te @@ -21,3 +21,4 @@ allow pixelstats_vendor battery_history_device:chr_file r_file_perms; # UeventListener r_dir_file(pixelstats_vendor, sysfs_pixelstats) +r_dir_file(pixelstats_vendor, sysfs_typec_info) -- cgit v1.2.3