diff options
author | Erwin Jansen <jansene@google.com> | 2021-08-16 10:41:57 -0700 |
---|---|---|
committer | Roman Kiryanov <rkir@google.com> | 2022-06-15 13:52:26 -0700 |
commit | 0e902e9f4c238e2cf4152feadd1d51dc0482bf07 (patch) | |
tree | ddc27bd50c57bf17fd22185a11df4a6b77b800f2 | |
parent | 50800c51a8a29a72013bbd7e95b51204a51b23c1 (diff) | |
download | goldfish-0e902e9f4c238e2cf4152feadd1d51dc0482bf07.tar.gz |
Enable btlinux HAL
This enables the btlinux reference hal with vhci, with vhci packet
forwarding on /dev/bluetooth0
This requires an emulator with rootcanal enabled. (i.e. build >=
7637665)
Bug: 180413087
Test: manual - bluetooth works
Change-Id: I725fe1702fcc42f57cdc8b07607edcf08bd86973
Merged-In: I725fe1702fcc42f57cdc8b07607edcf08bd86973
-rw-r--r-- | 64bitonly/product/vendor.mk | 10 | ||||
-rw-r--r-- | init.ranchu.rc | 9 | ||||
-rw-r--r-- | sepolicy/common/bt_device.te | 1 | ||||
-rw-r--r-- | sepolicy/common/bt_vhci_forwarder.te | 7 | ||||
-rw-r--r-- | sepolicy/common/file_contexts | 6 | ||||
-rw-r--r-- | sepolicy/common/hal_bluetooth_sim.te | 9 | ||||
-rw-r--r-- | sepolicy/common/property_contexts | 2 | ||||
-rw-r--r-- | sepolicy/common/vendor_init.te | 1 | ||||
-rw-r--r-- | ueventd.ranchu.rc | 4 | ||||
-rw-r--r-- | vendor.mk | 12 |
10 files changed, 41 insertions, 20 deletions
diff --git a/64bitonly/product/vendor.mk b/64bitonly/product/vendor.mk index b38526af..12686a8e 100644 --- a/64bitonly/product/vendor.mk +++ b/64bitonly/product/vendor.mk @@ -81,10 +81,14 @@ PRODUCT_PACKAGES += \ libfeature_support_angle.so endif +# Enable bluetooth PRODUCT_PACKAGES += \ - android.hardware.bluetooth@1.1-service.sim \ - android.hardware.bluetooth.audio@2.0-impl -PRODUCT_PROPERTY_OVERRIDES += vendor.bt.rootcanal_test_console=off + bt_vhci_forwarder \ + android.hardware.bluetooth@1.1-service.btlinux \ + android.hardware.bluetooth.audio@2.1-impl + # +# Bluetooth se policies +BOARD_SEPOLICY_DIRS += system/bt/vendor_libs/linux/sepolicy PRODUCT_PACKAGES += \ android.hardware.health@2.1-service \ diff --git a/init.ranchu.rc b/init.ranchu.rc index 94769d29..2d20aa2c 100644 --- a/init.ranchu.rc +++ b/init.ranchu.rc @@ -196,6 +196,15 @@ service wpa_supplicant /vendor/bin/hw/wpa_supplicant -Dnl80211 -iwlan0 -c/vendor oneshot disabled +on property:vendor.qemu.vport.bluetooth=* + symlink ${vendor.qemu.vport.bluetooth} /dev/bluetooth0 + + +service bt_vhci_forwarder /vendor/bin/bt_vhci_forwarder -virtio_console_dev=/dev/bluetooth0 + class main + user bluetooth + group root bluetooth + # Enable zram only once per boot. From: # We want one opportunity per boot to enable zram, so we diff --git a/sepolicy/common/bt_device.te b/sepolicy/common/bt_device.te new file mode 100644 index 00000000..5c88bfb3 --- /dev/null +++ b/sepolicy/common/bt_device.te @@ -0,0 +1 @@ +type bt_device, dev_type;
\ No newline at end of file diff --git a/sepolicy/common/bt_vhci_forwarder.te b/sepolicy/common/bt_vhci_forwarder.te new file mode 100644 index 00000000..7175e73c --- /dev/null +++ b/sepolicy/common/bt_vhci_forwarder.te @@ -0,0 +1,7 @@ +type bt_vhci_forwarder, domain; +type bt_vhci_forwarder_exec, exec_type, vendor_file_type, file_type; + +init_daemon_domain(bt_vhci_forwarder) + +allow bt_vhci_forwarder bt_device:chr_file { open read write ioctl}; + diff --git a/sepolicy/common/file_contexts b/sepolicy/common/file_contexts index b1aa5ead..77ab0724 100644 --- a/sepolicy/common/file_contexts +++ b/sepolicy/common/file_contexts @@ -25,6 +25,10 @@ /dev/hvc0 u:object_r:serial_device:s0 # logcat /dev/hvc1 u:object_r:serial_device:s0 +# Bluetooth +/dev/vhci u:object_r:bt_device:s0 +/dev/bluetooth0 u:object_r:bt_device:s0 + /system_ext/bin/init\.qemu-adb-keys\.sh u:object_r:goldfish_system_setup_exec:s0 /vendor/bin/init\.ranchu-core\.sh u:object_r:goldfish_setup_exec:s0 @@ -35,8 +39,8 @@ /vendor/bin/mac80211_create_radios u:object_r:mac80211_create_radios_exec:s0 /vendor/bin/hw/libgoldfish-rild u:object_r:rild_exec:s0 /vendor/bin/dhcpclient u:object_r:dhcpclient_exec:s0 +/vendor/bin/bt_vhci_forwarder u:object_r:bt_vhci_forwarder_exec:s0 -/vendor/bin/hw/android\.hardware\.bluetooth@1\.1-service\.sim u:object_r:hal_bluetooth_sim_exec:s0 /vendor/bin/hw/android\.hardware\.drm@[0-9]+\.[0-9]+-service\.widevine u:object_r:hal_drm_widevine_exec:s0 /vendor/bin/hw/android\.hardware\.drm@[0-9]+\.[0-9]+-service\.clearkey u:object_r:hal_drm_clearkey_exec:s0 /vendor/bin/hw/android\.hardware\.gatekeeper@1\.0-service.software u:object_r:hal_gatekeeper_default_exec:s0 diff --git a/sepolicy/common/hal_bluetooth_sim.te b/sepolicy/common/hal_bluetooth_sim.te deleted file mode 100644 index d29b1a9d..00000000 --- a/sepolicy/common/hal_bluetooth_sim.te +++ /dev/null @@ -1,9 +0,0 @@ -type hal_bluetooth_sim, domain; -type hal_bluetooth_sim_exec, exec_type, vendor_file_type, file_type; -vendor_internal_prop(vendor_bt_rootcanal_prop) - -hal_server_domain(hal_bluetooth_sim, hal_bluetooth) - -init_daemon_domain(hal_bluetooth_sim) - -get_prop(hal_bluetooth_sim, vendor_bt_rootcanal_prop) diff --git a/sepolicy/common/property_contexts b/sepolicy/common/property_contexts index e15fdb45..9aecb779 100644 --- a/sepolicy/common/property_contexts +++ b/sepolicy/common/property_contexts @@ -23,7 +23,5 @@ vendor.net.radio0.dns3 u:object_r:vendor_net_radio0_prop:s0 exact string vendor.net.radio0.dns4 u:object_r:vendor_net_radio0_prop:s0 exact string vendor.net.shared_net_ip u:object_r:vendor_net_share_prop:s0 exact string vendor.net.wifi_mac_prefix u:object_r:vendor_net_share_prop:s0 exact string -vendor.bt.rootcanal_mac_address u:object_r:vendor_bt_rootcanal_prop:s0 exact string -vendor.bt.rootcanal_test_console u:object_r:vendor_bt_rootcanal_prop:s0 exact string vendor.wlan.firmware.version u:object_r:vendor_wlan_versions_prop:s0 exact string vendor.wlan.driver.version u:object_r:vendor_wlan_versions_prop:s0 exact string diff --git a/sepolicy/common/vendor_init.te b/sepolicy/common/vendor_init.te index c4ecff91..6e3b5eaf 100644 --- a/sepolicy/common/vendor_init.te +++ b/sepolicy/common/vendor_init.te @@ -1,6 +1,5 @@ set_prop(vendor_init, vendor_qemu_prop) allow vendor_init ram_device:blk_file setattr; -set_prop(vendor_init, vendor_bt_rootcanal_prop) set_prop(vendor_init, vendor_build_prop); set_prop(vendor_init, exported_system_prop); diff --git a/ueventd.ranchu.rc b/ueventd.ranchu.rc index 1f4f0fbe..a7ee542d 100644 --- a/ueventd.ranchu.rc +++ b/ueventd.ranchu.rc @@ -12,3 +12,7 @@ # logcat virtconsole /dev/hvc1 0660 system logd + +# bluetooth +/dev/vhci 0660 system bluetooth + @@ -83,11 +83,15 @@ PRODUCT_PACKAGES += \ libGLESv2_angle \ libfeature_support_angle.so endif - +# +# Enable bluetooth PRODUCT_PACKAGES += \ - android.hardware.bluetooth@1.1-service.sim \ - android.hardware.bluetooth.audio@2.0-impl -PRODUCT_PROPERTY_OVERRIDES += vendor.bt.rootcanal_test_console=off + bt_vhci_forwarder \ + android.hardware.bluetooth@1.1-service.btlinux \ + android.hardware.bluetooth.audio@2.1-impl + # +# Bluetooth se policies +BOARD_SEPOLICY_DIRS += system/bt/vendor_libs/linux/sepolicy PRODUCT_PACKAGES += \ android.hardware.health@2.1-service \ |