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 Cheetah
Flag: android.hardware.usb.flags.enable_udc_sysfs_usb_state_update
Change-Id: I0eac6b46677c786b505a4bd1c4f63385062bc132
This commit is contained in:
Roy Luo 2024-12-11 15:50:50 +00:00
parent 768c29c450
commit 427a3262f1
2 changed files with 4 additions and 0 deletions

View file

@ -360,3 +360,6 @@ genfscon sysfs /devices/platform/10940000.spi/spi_master/spi5/spi5.0/nstandby
# WLC # WLC
genfscon sysfs /devices/platform/10da0000.hsi2c/i2c-15/15-003c u:object_r:sysfs_wlc:s0 genfscon sysfs /devices/platform/10da0000.hsi2c/i2c-15/15-003c u:object_r:sysfs_wlc:s0
# USB
genfscon sysfs /devices/platform/11210000.usb/11210000.dwc3/udc/11210000.dwc3/state u:object_r:sysfs_udc:s0

View file

@ -33,3 +33,4 @@ allow hal_usb_impl usb_device:dir r_dir_perms;
# For monitoring usb sysfs attributes # For monitoring usb sysfs attributes
allow hal_usb_impl sysfs_wakeup:dir search; allow hal_usb_impl sysfs_wakeup:dir search;
allow hal_usb_impl sysfs_wakeup:file r_file_perms; allow hal_usb_impl sysfs_wakeup:file r_file_perms;
allow hal_usb_impl sysfs_udc:file r_file_perms;