Use btlinux HAL implementation
Use reference HAL implementation(btlinux) with vhci drvier
Bug: 178702430
Bug: 178702496
Test: check if BT works well as is
Change-Id: Ib2e790f6782ab7bcbf6f2947c68d924e9a696ca4
diff --git a/shared/BoardConfig.mk b/shared/BoardConfig.mk
index c77440d..0c5efe0 100644
--- a/shared/BoardConfig.mk
+++ b/shared/BoardConfig.mk
@@ -158,6 +158,8 @@
# vendor sepolicy
BOARD_VENDOR_SEPOLICY_DIRS += device/google/cuttlefish/shared/sepolicy/vendor
+
+BOARD_SEPOLICY_DIRS += system/bt/vendor_libs/linux/sepolicy
BOARD_VENDOR_SEPOLICY_DIRS += device/google/cuttlefish/shared/sepolicy/vendor/google
# product sepolicy, allow other layers to append
PRODUCT_PRIVATE_SEPOLICY_DIRS += device/google/cuttlefish/shared/sepolicy/product/private
diff --git a/shared/config/init.vendor.rc b/shared/config/init.vendor.rc
index af05896..3cd5a02 100644
--- a/shared/config/init.vendor.rc
+++ b/shared/config/init.vendor.rc
@@ -49,6 +49,8 @@
# works around framework netiface enumeration issue
start rename_eth1
+ start bt_vhci_forwarder
+
# So GceBootReporter can print to kmsg
chmod 622 /dev/kmsg
@@ -76,6 +78,10 @@
mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
start socket_vsock_proxy
+service bt_vhci_forwarder /vendor/bin/bt_vhci_forwarder -virtio_console_dev=/dev/hvc5
+ user bluetooth
+ group bluetooth
+
service setup_wifi /vendor/bin/setup_wifi
oneshot
diff --git a/shared/config/ueventd.rc b/shared/config/ueventd.rc
index f214300..84d2806 100644
--- a/shared/config/ueventd.rc
+++ b/shared/config/ueventd.rc
@@ -24,6 +24,7 @@
# bluetooth
/dev/hvc5 0660 bluetooth bluetooth
+/dev/vhci 0660 bluetooth bluetooth
/dev/gnss0 0666 system system
diff --git a/shared/device.mk b/shared/device.mk
index a9f1f9b..8f43661 100644
--- a/shared/device.mk
+++ b/shared/device.mk
@@ -43,6 +43,7 @@
# Depends on TARGET_PRODUCT because TARGET_ARCH is not available here.
ifneq ($(findstring x86,$(TARGET_PRODUCT)),)
TARGET_ENABLE_HOST_BLUETOOTH_EMULATION ?= true
+TARGET_USE_BTLINUX_HAL_IMPL ?= true
endif
AB_OTA_UPDATER := true
@@ -149,6 +150,7 @@
cuttlefish_rotate \
rename_netiface \
setup_wifi \
+ bt_vhci_forwarder \
socket_vsock_proxy \
tombstone_transmit \
tombstone_producer \
@@ -372,9 +374,13 @@
#
ifeq ($(TARGET_ENABLE_HOST_BLUETOOTH_EMULATION),true)
-PRODUCT_PACKAGES += [email protected]
+ifeq ($(TARGET_USE_BTLINUX_HAL_IMPL),true)
+ PRODUCT_PACKAGES += [email protected]
else
-PRODUCT_PACKAGES += [email protected]
+ PRODUCT_PACKAGES += [email protected]
+endif
+else
+ PRODUCT_PACKAGES += [email protected]
endif
PRODUCT_PACKAGES += [email protected]
diff --git a/shared/sepolicy/vendor/bt_vhci_forwarder.te b/shared/sepolicy/vendor/bt_vhci_forwarder.te
new file mode 100644
index 0000000..2172696
--- /dev/null
+++ b/shared/sepolicy/vendor/bt_vhci_forwarder.te
@@ -0,0 +1,6 @@
+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/shared/sepolicy/vendor/file_contexts b/shared/sepolicy/vendor/file_contexts
index 6ff4871..8a5004a 100644
--- a/shared/sepolicy/vendor/file_contexts
+++ b/shared/sepolicy/vendor/file_contexts
@@ -24,6 +24,8 @@
/dev/hvc4 u:object_r:gatekeeper_device:s0
/dev/hvc5 u:object_r:bt_device:s0
+/dev/vhci u:object_r:bt_device:s0
+
# ARM serial console device
/dev/ttyAMA[0-9]* u:object_r:serial_device:s0
@@ -77,6 +79,8 @@
/vendor/bin/hw/android\.hardware\.neuralnetworks-service-sample-.* u:object_r:hal_neuralnetworks_sample_exec:s0
/vendor/bin/hw/android\.hardware\.vibrator@1\.x-service\.example u:object_r:hal_vibrator_default_exec:s0
/vendor/bin/setup_wifi u:object_r:setup_wifi_exec:s0
+/vendor/bin/bt_vhci_forwarder u:object_r:bt_vhci_forwarder_exec:s0
+
/vendor/bin/hw/android\.hardware\.sensors@2\.1-service\.mock u:object_r:hal_sensors_default_exec:s0
/vendor/bin/hw/android\.hardware\.input\.classifier@1\.0-service.default u:object_r:hal_input_classifier_default_exec:s0
/vendor/bin/hw/android\.hardware\.thermal@2\.0-service\.mock u:object_r:hal_thermal_default_exec:s0