From 46212d918696d79004daf3b5dddd43926a819c1f Mon Sep 17 00:00:00 2001 From: Adam Shih Date: Tue, 16 Aug 2022 14:09:32 +0800 Subject: [PATCH] move bcmbt settings to gs-common Bug: 242661555 Test: build pass Change-Id: I5e56453001013f98ffe4e934b96a00e8939509c7 --- bcmbt/bluetooth.mk | 2 ++ bcmbt/sepolicy/device.te | 3 +++ bcmbt/sepolicy/file_contexts | 6 ++++++ bcmbt/sepolicy/genfs_contexts | 7 +++++++ bcmbt/sepolicy/hal_bluetooth_btlinux.te | 22 ++++++++++++++++++++++ bcmbt/sepolicy/hwservice.te | 3 +++ bcmbt/sepolicy/hwservice_contexts | 6 ++++++ 7 files changed, 49 insertions(+) create mode 100644 bcmbt/bluetooth.mk create mode 100644 bcmbt/sepolicy/device.te create mode 100644 bcmbt/sepolicy/file_contexts create mode 100644 bcmbt/sepolicy/genfs_contexts create mode 100644 bcmbt/sepolicy/hal_bluetooth_btlinux.te create mode 100644 bcmbt/sepolicy/hwservice.te create mode 100644 bcmbt/sepolicy/hwservice_contexts diff --git a/bcmbt/bluetooth.mk b/bcmbt/bluetooth.mk new file mode 100644 index 0000000..870467a --- /dev/null +++ b/bcmbt/bluetooth.mk @@ -0,0 +1,2 @@ +PRODUCT_PACKAGES += android.hardware.bluetooth@1.1-service.bcmbtlinux +BOARD_SEPOLICY_DIRS += device/google/gs-common/bcmbt/sepolicy diff --git a/bcmbt/sepolicy/device.te b/bcmbt/sepolicy/device.te new file mode 100644 index 0000000..a256332 --- /dev/null +++ b/bcmbt/sepolicy/device.te @@ -0,0 +1,3 @@ +# Bt Wifi Coexistence device +type wb_coexistence_dev, dev_type; + diff --git a/bcmbt/sepolicy/file_contexts b/bcmbt/sepolicy/file_contexts new file mode 100644 index 0000000..d4681db --- /dev/null +++ b/bcmbt/sepolicy/file_contexts @@ -0,0 +1,6 @@ +# Bluetooth +/(vendor|system/vendor)/bin/hw/android\.hardware\.bluetooth@1\.1-service\.bcmbtlinux u:object_r:hal_bluetooth_btlinux_exec:s0 + +/dev/wbrc u:object_r:wb_coexistence_dev:s0 +/dev/ttySAC16 u:object_r:hci_attach_dev:s0 + diff --git a/bcmbt/sepolicy/genfs_contexts b/bcmbt/sepolicy/genfs_contexts new file mode 100644 index 0000000..607e146 --- /dev/null +++ b/bcmbt/sepolicy/genfs_contexts @@ -0,0 +1,7 @@ +genfscon sysfs /devices/platform/odm/odm:btbcm/rfkill/rfkill0/state u:object_r:sysfs_bluetooth_writable:s0 +genfscon sysfs /devices/platform/odm/odm:btbcm/rfkill/rfkill2/state u:object_r:sysfs_bluetooth_writable:s0 +genfscon proc /bluetooth/sleep/lpm u:object_r:proc_bluetooth_writable:s0 +genfscon proc /bluetooth/sleep/btwrite u:object_r:proc_bluetooth_writable:s0 +genfscon proc /bluetooth/sleep/btwake u:object_r:proc_bluetooth_writable:s0 +genfscon proc /bluetooth/timesync u:object_r:proc_bluetooth_writable:s0 + diff --git a/bcmbt/sepolicy/hal_bluetooth_btlinux.te b/bcmbt/sepolicy/hal_bluetooth_btlinux.te new file mode 100644 index 0000000..f348099 --- /dev/null +++ b/bcmbt/sepolicy/hal_bluetooth_btlinux.te @@ -0,0 +1,22 @@ +add_hwservice(hal_bluetooth_btlinux, hal_bluetooth_coexistence_hwservice); +get_prop(hal_bluetooth_btlinux, boot_status_prop) + +allow hal_bluetooth_btlinux sysfs_bluetooth_writable:file rw_file_perms; +allow hal_bluetooth_btlinux proc_bluetooth_writable:file rw_file_perms; +allow hal_bluetooth_btlinux hci_attach_dev:chr_file rw_file_perms; +allow hal_bluetooth_btlinux wb_coexistence_dev:chr_file rw_file_perms; +binder_call(hal_bluetooth_btlinux, servicemanager) + +# power stats +vndbinder_use(hal_bluetooth_btlinux) +allow hal_bluetooth_btlinux hal_power_stats_vendor_service:service_manager find; +binder_call(hal_bluetooth_btlinux, hal_power_stats_default) + +allow hal_bluetooth_btlinux sscoredump_vendor_data_crashinfo_file:dir create_dir_perms; +allow hal_bluetooth_btlinux sscoredump_vendor_data_crashinfo_file:file create_file_perms; + +userdebug_or_eng(` + allow hal_bluetooth_btlinux sscoredump_vendor_data_coredump_file:dir create_dir_perms; + allow hal_bluetooth_btlinux sscoredump_vendor_data_coredump_file:file create_file_perms; + allow hal_bluetooth_btlinux logbuffer_device:chr_file r_file_perms; +') diff --git a/bcmbt/sepolicy/hwservice.te b/bcmbt/sepolicy/hwservice.te new file mode 100644 index 0000000..5e36cd0 --- /dev/null +++ b/bcmbt/sepolicy/hwservice.te @@ -0,0 +1,3 @@ +# Bluetooth HAL extension +type hal_bluetooth_coexistence_hwservice, hwservice_manager_type, vendor_hwservice_type; + diff --git a/bcmbt/sepolicy/hwservice_contexts b/bcmbt/sepolicy/hwservice_contexts new file mode 100644 index 0000000..8480b4e --- /dev/null +++ b/bcmbt/sepolicy/hwservice_contexts @@ -0,0 +1,6 @@ +# Bluetooth HAL extension +hardware.google.bluetooth.bt_channel_avoidance::IBTChannelAvoidance u:object_r:hal_bluetooth_coexistence_hwservice:s0 +hardware.google.bluetooth.sar::IBluetoothSar u:object_r:hal_bluetooth_coexistence_hwservice:s0 +hardware.google.bluetooth.ccc::IBluetoothCcc u:object_r:hal_bluetooth_coexistence_hwservice:s0 +hardware.google.bluetooth.ewp::IBluetoothEwp u:object_r:hal_bluetooth_coexistence_hwservice:s0 +hardware.google.bluetooth.ext::IBluetoothExt u:object_r:hal_bluetooth_coexistence_hwservice:s0