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
This commit is contained in:
Roy Luo 2024-12-09 13:21:14 +00:00
parent 1f96101a5e
commit 20707fd77f
2 changed files with 8 additions and 1 deletions

View file

@ -499,3 +499,8 @@ genfscon sysfs /kernel/metrics/cpuidle_histogram/cpucluster_histogram u:obje
# Bluetooth
genfscon sysfs /devices/platform/155d0000.serial/uart_dbg u:object_r:sysfs_bt_uart:s0
# USB
starting_at_board_api(202504, `
genfscon sysfs /devices/platform/11210000.usb/11210000.dwc3/udc/11210000.dwc3/state u:object_r:sysfs_udc:s0
')

View file

@ -30,4 +30,6 @@ 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;
')