device_google_zumapro/vendor/hal_usb_impl.te
Roy Luo 20707fd77f Add udc sysfs to udc_sysfs fs context
Meeded for system server to monitor usb gadget state.
Grant hal_usb_impl read access as it's needed by UsbDataSessionMonitor.
Starting at board level api 202504 due to its dependency on aosp/3337514

10956 10956 W android.hardwar: type=1400 audit(0.0:327): avc:  denied  { read } for  name="state" dev="sysfs" ino=84394 scontext=u:r:hal_usb_impl:s0 tcontext=u:object_r:sysfs_udc:s0 tclass=file permissive=0

Bug: 339241080
Test: tested on Tokay
Flag: android.hardware.usb.flags.enable_udc_sysfs_usb_state_update
Change-Id: Iab79eec9a836d70792dfaa64eb24a5c013dc85aa
2024-12-09 13:21:14 +00:00

35 lines
1.2 KiB
Text

type hal_usb_impl, domain;
type hal_usb_impl_exec, vendor_file_type, exec_type, file_type;
init_daemon_domain(hal_usb_impl)
hal_server_domain(hal_usb_impl, hal_usb)
hal_server_domain(hal_usb_impl, hal_usb_gadget)
allow hal_usb_impl sysfs_batteryinfo:dir r_dir_perms;
allow hal_usb_impl sysfs_batteryinfo:file rw_file_perms;
get_prop(hal_usb_impl, vendor_usb_config_prop)
# Needed for monitoring usb port temperature
allow hal_usb_impl self:capability2 wake_alarm;
wakelock_use(hal_usb_impl);
# For interfacing with ThermalHAL
hal_client_domain(hal_usb_impl, hal_thermal);
# Needed for reporting Usb Overheat suez event through statsd
allow hal_usb_impl fwk_stats_service:service_manager find;
# For reading the usb-c throttling stats
allow hal_usb_impl sysfs_usbc_throttling_stats:file r_file_perms;
# For issuing vendor commands to USB hub via libusbhost
allow hal_usb_impl device:dir r_dir_perms;
allow hal_usb_impl usb_device:chr_file rw_file_perms;
allow hal_usb_impl usb_device:dir r_dir_perms;
# For monitoring usb sysfs attributes
allow hal_usb_impl sysfs_wakeup:dir search;
allow hal_usb_impl sysfs_wakeup:file r_file_perms;
starting_at_board_api(202504, `
allow hal_usb_impl sysfs_udc:file r_file_perms;
')