From ac878d3f629291bc6229dad4315da40f7b372cc2 Mon Sep 17 00:00:00 2001 From: Vaibhav Devmurari Date: Mon, 3 Oct 2022 13:01:26 +0000 Subject: [PATCH] Add SePolicy for system_server accessing sysfs for USB devices Add SePolicy to allow Android input manager accessing sysfs nodes for external USB devices To support input device lights manager feature in frameworks, provide sysfs node access to system server process. DD: go/pk_backlight_control (For keyboard backlight control for external keyboards) Kernel provides a standardized LED interface to expose LED controls over sysfs: https://docs.kernel.org/leds/leds-class.html The feature will be provided for devices with kernel sysfs class led support and vendor kernel driver for input controllers that do have lights. The kernel sysfs class led support is a kernel config option (LEDS_CLASS), and an input device driver will create the sysfs class node interface. By giving system_server the access to these sysfs nodes, the feature will work on devices with the kernel option and kernel input/hid driver support. We do use CTS tests to enforce the kernel options and the input device drivers. What's already supported? - We already support access to UHID sysfs node which used for all bluetooth based external peripherals What's included in this CL? - Adding support to access sysfs nodes for USB based external devices Test: manual Bug: 245506418 Change-Id: Ieb55614ed651b85f0e6752a17d02f4d370fd1e6f --- whitechapel/vendor/google/genfs_contexts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/whitechapel/vendor/google/genfs_contexts b/whitechapel/vendor/google/genfs_contexts index 2c59fc03..aabe7653 100644 --- a/whitechapel/vendor/google/genfs_contexts +++ b/whitechapel/vendor/google/genfs_contexts @@ -259,6 +259,10 @@ genfscon proc /nvt_pen_diff genfscon proc /nvt_raw u:object_r:proc_touch:s0 genfscon proc /nvt_selftest u:object_r:proc_touch:s0 +# Input +genfscon sysfs /devices/platform/11110000.usb/11110000.dwc3/xhci-hcd-exynos.4.auto/usb2/2-1 u:object_r:sysfs_uhid:s0 +genfscon sysfs /devices/platform/11110000.usb/11110000.dwc3/xhci-hcd-exynos.5.auto/usb2/2-1 u:object_r:sysfs_uhid:s0 + # GPS genfscon sysfs /devices/platform/10940000.spi/spi_master/spi5/spi5.0/nstandby u:object_r:sysfs_gps:s0 genfscon sysfs /devices/virtual/pps/pps0/assert_elapsed u:object_r:sysfs_gps_assert:s0