Merge changes from topic "add pixel-bt service" into main

* changes:
  add sepolicy rules for bluetooth common hal
  introduce pixel bluetooth common hal service
This commit is contained in:
Joner Lin 2024-10-23 12:03:51 +00:00 committed by Android (Google) Code Review
commit ca74f2730a
11 changed files with 126 additions and 0 deletions

16
bluetooth/bluetooth.mk Normal file
View file

@ -0,0 +1,16 @@
PRODUCT_SOONG_NAMESPACES += vendor/google/connectivity/bluetooth/common
PRODUCT_PACKAGES += \
android.hardware.bluetooth-V1-ndk.so \
android.hardware.bluetooth.finder-V1-ndk.so \
android.hardware.bluetooth.ranging-V1-ndk.so \
android.hardware.bluetooth-service.pixel \
vendor.google.bluetooth_ext-V1-ndk.so \
bt_vendor.conf \
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

View file

@ -0,0 +1,30 @@
<compatibility-matrix version="1.0" type="framework">
<hal format="aidl" optional="true">
<name>vendor.google.bluetooth_ext</name>
<version>1</version>
<interface>
<name>IBluetoothFinder</name>
<instance>default</instance>
</interface>
<interface>
<name>IBluetoothCcc</name>
<instance>default</instance>
</interface>
<interface>
<name>IBTChannelAvoidance</name>
<instance>default</instance>
</interface>
<interface>
<name>IBluetoothSar</name>
<instance>default</instance>
</interface>
<interface>
<name>IBluetoothExt</name>
<instance>default</instance>
</interface>
<interface>
<name>IBluetoothEwp</name>
<instance>default</instance>
</interface>
</hal>
</compatibility-matrix>

View file

@ -0,0 +1,27 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.bluetooth</name>
<version>1</version>
<fqname>IBluetoothHci/default</fqname>
</hal>
<hal format="aidl">
<name>android.hardware.bluetooth.finder</name>
<version>1</version>
<fqname>IBluetoothFinder/default</fqname>
</hal>
<hal format="aidl">
<name>android.hardware.bluetooth.ranging</name>
<version>1</version>
<fqname>IBluetoothChannelSounding/default</fqname>
</hal>
<hal format="aidl">
<name>vendor.google.bluetooth_ext</name>
<version>1</version>
<fqname>IBTChannelAvoidance/default</fqname>
<fqname>IBluetoothCcc/default</fqname>
<fqname>IBluetoothEwp/default</fqname>
<fqname>IBluetoothExt/default</fqname>
<fqname>IBluetoothFinder/default</fqname>
<fqname>IBluetoothSar/default</fqname>
</hal>
</manifest>

View file

@ -0,0 +1,3 @@
# Bt Wifi Coexistence device
type wb_coexistence_dev, dev_type;

View file

@ -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

View file

@ -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

View file

@ -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;
')

View file

@ -0,0 +1,3 @@
# Bluetooth HAL extension
type hal_bluetooth_coexistence_hwservice, hwservice_manager_type, vendor_hwservice_type;

View file

@ -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

View file

@ -0,0 +1,2 @@
# Bluetooth HAL extension
type hal_bluetooth_coexistence_service, hal_service_type, service_manager_type;

View file

@ -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