From d60ebc5327b34f93a2ba74c0754cc5cebdc9c9ee Mon Sep 17 00:00:00 2001 From: Erik Staats Date: Thu, 16 Sep 2021 15:03:31 -0700 Subject: [PATCH] Allow the sensor HAL to access raw HID devices. Bug: 195964858 Test: Paired a Sony PS4 controller and verified that it's discovered by the dynamic sensor HAL. Test: See details in testing done comment in https://googleplex-android-review.git.corp.google.com/15847652 . Change-Id: Ic0bdd711d066a9793eba305102e9a850e3973856 --- usf/sensor_hal.te | 3 +++ whitechapel/vendor/google/device.te | 4 ++++ whitechapel/vendor/google/file_contexts | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/usf/sensor_hal.te b/usf/sensor_hal.te index 0797253e..22a42087 100644 --- a/usf/sensor_hal.te +++ b/usf/sensor_hal.te @@ -52,6 +52,9 @@ allow hal_sensors_default sysfs_aoc_dumpstate:file r_file_perms; # Allow access for dynamic sensor properties. get_prop(hal_sensors_default, vendor_dynamic_sensor_prop) +# Allow access to raw HID devices for dynamic sensors. +allow hal_sensors_default hidraw_device:chr_file rw_file_perms; + # # Suez type enforcements. # diff --git a/whitechapel/vendor/google/device.te b/whitechapel/vendor/google/device.te index bc3c9477..bad0be07 100644 --- a/whitechapel/vendor/google/device.te +++ b/whitechapel/vendor/google/device.te @@ -55,3 +55,7 @@ type amcs_device, dev_type; # Battery history type battery_history_device, dev_type; + +# Raw HID device +type hidraw_device, dev_type; + diff --git a/whitechapel/vendor/google/file_contexts b/whitechapel/vendor/google/file_contexts index bc03a78e..ff401dcd 100644 --- a/whitechapel/vendor/google/file_contexts +++ b/whitechapel/vendor/google/file_contexts @@ -441,3 +441,7 @@ /vendor/lib64/android\.frameworks\.stats-V1-ndk_platform\.so u:object_r:same_process_hal_file:s0 /vendor/lib64/vendor-pixelatoms-cpp\.so u:object_r:same_process_hal_file:s0 /vendor/lib64/libprotobuf-cpp-lite-3\.9\.1\.so u:object_r:same_process_hal_file:s0 + +# Raw HID device +/dev/hidraw[0-9]* u:object_r:hidraw_device:s0 +