diff --git a/bluetooth/bluetooth.mk b/bluetooth/bluetooth.mk index 6f9a9d7..29ddb9c 100644 --- a/bluetooth/bluetooth.mk +++ b/bluetooth/bluetooth.mk @@ -9,5 +9,8 @@ PRODUCT_PACKAGES += \ android.hardware.bluetooth.prebuilt.xml \ android.hardware.bluetooth_le.prebuilt.xml +BOARD_SEPOLICY_DIRS += device/google/gs-common/bluetooth/sepolicy +BOARD_SEPOLICY_DIRS += hardware/google/pixel-sepolicy/powerstats + DEVICE_MANIFEST_FILE += device/google/gs-common/bluetooth/manifest_bluetooth.xml DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE += device/google/gs-common/bluetooth/compatibility_matrix.xml diff --git a/bluetooth/sepolicy/device.te b/bluetooth/sepolicy/device.te new file mode 100644 index 0000000..a256332 --- /dev/null +++ b/bluetooth/sepolicy/device.te @@ -0,0 +1,3 @@ +# Bt Wifi Coexistence device +type wb_coexistence_dev, dev_type; + diff --git a/bluetooth/sepolicy/file_contexts b/bluetooth/sepolicy/file_contexts new file mode 100644 index 0000000..e7c2617 --- /dev/null +++ b/bluetooth/sepolicy/file_contexts @@ -0,0 +1,6 @@ +# Bluetooth +/vendor/bin/hw/android\.hardware\.bluetooth-service\.pixel 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/bluetooth/sepolicy/genfs_contexts b/bluetooth/sepolicy/genfs_contexts new file mode 100644 index 0000000..899041b --- /dev/null +++ b/bluetooth/sepolicy/genfs_contexts @@ -0,0 +1,8 @@ +# Bluetooth pin control device node +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/bluetooth/sepolicy/hal_bluetooth_btlinux.te b/bluetooth/sepolicy/hal_bluetooth_btlinux.te new file mode 100644 index 0000000..a893102 --- /dev/null +++ b/bluetooth/sepolicy/hal_bluetooth_btlinux.te @@ -0,0 +1,18 @@ +# coexistence device file node +add_hwservice(hal_bluetooth_btlinux, hal_bluetooth_coexistence_hwservice); +add_service(hal_bluetooth_btlinux, hal_bluetooth_coexistence_service); +allow hal_bluetooth_btlinux wb_coexistence_dev:chr_file rw_file_perms; + +# power stats +allow hal_bluetooth_btlinux hal_power_stats_vendor_service:service_manager find; +binder_call(hal_bluetooth_btlinux, hal_power_stats_default) + +# bt firmware dump +allow hal_bluetooth_btlinux aconfig_storage_metadata_file:dir search; +allow hal_bluetooth_btlinux sscoredump_vendor_data_crashinfo_file:dir { read search }; + +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/bluetooth/sepolicy/hwservice.te b/bluetooth/sepolicy/hwservice.te new file mode 100644 index 0000000..5e36cd0 --- /dev/null +++ b/bluetooth/sepolicy/hwservice.te @@ -0,0 +1,3 @@ +# Bluetooth HAL extension +type hal_bluetooth_coexistence_hwservice, hwservice_manager_type, vendor_hwservice_type; + diff --git a/bluetooth/sepolicy/hwservice_contexts b/bluetooth/sepolicy/hwservice_contexts new file mode 100644 index 0000000..8480b4e --- /dev/null +++ b/bluetooth/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 diff --git a/bluetooth/sepolicy/service.te b/bluetooth/sepolicy/service.te new file mode 100644 index 0000000..b8403da --- /dev/null +++ b/bluetooth/sepolicy/service.te @@ -0,0 +1,2 @@ +# Bluetooth HAL extension +type hal_bluetooth_coexistence_service, hal_service_type, service_manager_type; diff --git a/bluetooth/sepolicy/service_contexts b/bluetooth/sepolicy/service_contexts new file mode 100644 index 0000000..4aecc90 --- /dev/null +++ b/bluetooth/sepolicy/service_contexts @@ -0,0 +1,7 @@ +# Bluetooth HAL extension +vendor.google.bluetooth_ext.IBTChannelAvoidance/default u:object_r:hal_bluetooth_coexistence_service:s0 +vendor.google.bluetooth_ext.IBluetoothSar/default u:object_r:hal_bluetooth_coexistence_service:s0 +vendor.google.bluetooth_ext.IBluetoothCcc/default u:object_r:hal_bluetooth_coexistence_service:s0 +vendor.google.bluetooth_ext.IBluetoothEwp/default u:object_r:hal_bluetooth_coexistence_service:s0 +vendor.google.bluetooth_ext.IBluetoothExt/default u:object_r:hal_bluetooth_coexistence_service:s0 +vendor.google.bluetooth_ext.IBluetoothFinder/default u:object_r:hal_bluetooth_coexistence_service:s0