g12: Guard bluetooth support properly
authorBruno Martins <bgcngm@gmail.com>
Thu, 9 Jun 2022 14:53:49 +0000 (15:53 +0100)
committerBruno Martins <bgcngm@gmail.com>
Sun, 3 Jul 2022 14:11:39 +0000 (15:11 +0100)
* Devices without bluetooth must set BOARD_HAVE_BLUETOOTH to
  false in product.mk, not BoardConfig.
* While we're at it, remove useless prop to disable bluetooth audio.

Change-Id: Icec1b48bb477d285a5af06ce4d86fdbc0d155213

BoardConfigCommon.mk
g12.mk
manifest.xml
manifest_bt.xml [new file with mode: 0644]
vendor.prop

index f3c55b9e93ed34f5a8e2cef00bde3869b5d8c5bd..e80d8a82c81bc08a1b0223a32d1a6c0001248791 100644 (file)
@@ -35,7 +35,12 @@ TARGET_SCREEN_DENSITY := 320
 TARGET_AMLOGIC_GPU_ARCH := bifrost
 
 ## HIDL
+ifeq ($(BOARD_HAVE_BLUETOOTH),false)
 DEVICE_MANIFEST_FILE := $(COMMON_PATH)/manifest.xml
+else
+DEVICE_MANIFEST_FILE := $(COMMON_PATH)/manifest.xml
+DEVICE_MANIFEST_FILE += $(COMMON_PATH)/manifest_bt.xml
+endif
 DEVICE_MATRIX_FILE := $(COMMON_PATH)/compatibility_matrix.xml
 
 ## Kernel
diff --git a/g12.mk b/g12.mk
index f25c592c3419dfe749174f781d1a1caa25ccf58f..20cb99e88b2d6066b87240b97f86dc51778572f6 100644 (file)
--- a/g12.mk
+++ b/g12.mk
@@ -40,10 +40,26 @@ PRODUCT_PACKAGES += \
     libaudiofoundation.vendor
 
 ## Bluetooth
+ifeq ($(BOARD_HAVE_BLUETOOTH),false)
+PRODUCT_PROPERTY_OVERRIDES += \
+    config.disable_bluetooth=true
+else
 PRODUCT_PACKAGES += \
     android.hardware.bluetooth@1.0.vendor \
     android.hardware.bluetooth.audio@2.0-impl
 
+PRODUCT_PROPERTY_OVERRIDES += \
+    ro.vendor.autoconnectbt.btclass=50c \
+    ro.vendor.autoconnectbt.isneed=false \
+    ro.vendor.autoconnectbt.macprefix=00:CD:FF \
+    ro.vendor.autoconnectbt.nameprefix=Amlogic_RC \
+    ro.vendor.autoconnectbt.rssilimit=70
+
+PRODUCT_COPY_FILES +=  \
+    frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \
+    frameworks/native/data/etc/android.hardware.bluetooth_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml
+endif
+
 ## Boot animation
 TARGET_SCREEN_HEIGHT := 1080
 TARGET_SCREEN_WIDTH := 1920
@@ -172,8 +188,6 @@ PRODUCT_USE_DYNAMIC_PARTITIONS := true
 ## Permissions
 PRODUCT_COPY_FILES +=  \
     frameworks/native/data/etc/android.hardware.audio.output.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.output.xml \
-    frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \
-    frameworks/native/data/etc/android.hardware.bluetooth_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml \
     frameworks/native/data/etc/android.hardware.device_unique_attestation.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.device_unique_attestation.xml \
     frameworks/native/data/etc/android.hardware.ethernet.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.ethernet.xml \
     frameworks/native/data/etc/android.hardware.gamepad.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.gamepad.xml \
index 96681b5f737f31d561f330ac06322349684a9862..22aec2ed195491b5fcf25bb2bca9c8ab8bc5ba6c 100644 (file)
             <instance>default</instance>
         </interface>
     </hal>
-    <hal format="hidl">
-        <name>android.hardware.bluetooth</name>
-        <transport>hwbinder</transport>
-        <version>1.0</version>
-        <interface>
-            <name>IBluetoothHci</name>
-            <instance>default</instance>
-        </interface>
-    </hal>
-    <hal format="hidl">
-        <name>android.hardware.bluetooth.audio</name>
-        <transport>hwbinder</transport>
-        <version>2.0</version>
-        <interface>
-            <name>IBluetoothAudioProvidersFactory</name>
-            <instance>default</instance>
-        </interface>
-    </hal>
     <hal format="hidl">
         <name>android.hardware.camera.provider</name>
         <transport>hwbinder</transport>
diff --git a/manifest_bt.xml b/manifest_bt.xml
new file mode 100644 (file)
index 0000000..e13d727
--- /dev/null
@@ -0,0 +1,20 @@
+<manifest version="1.0" type="device">
+    <hal format="hidl">
+        <name>android.hardware.bluetooth</name>
+        <transport>hwbinder</transport>
+        <version>1.0</version>
+        <interface>
+            <name>IBluetoothHci</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl">
+        <name>android.hardware.bluetooth.audio</name>
+        <transport>hwbinder</transport>
+        <version>2.0</version>
+        <interface>
+            <name>IBluetoothAudioProvidersFactory</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+</manifest>
index 03bb4e0dd5db44bc57ba7c271056a3804b300fcd..fce08ebc0a18521d3894b4a82f439de6ecc010f1 100644 (file)
@@ -8,14 +8,6 @@
 ro.config.media_vol_default=20
 ro.config.media_vol_steps=25
 
-## Bluetooth
-persist.bluetooth.bluetooth_audio_hal.disabled=false
-ro.vendor.autoconnectbt.btclass=50c
-ro.vendor.autoconnectbt.isneed=false
-ro.vendor.autoconnectbt.macprefix=00:CD:FF
-ro.vendor.autoconnectbt.nameprefix=Amlogic_RC
-ro.vendor.autoconnectbt.rssilimit=70
-
 ## Dalvik
 dalvik.vm.heapgrowthlimit=256m
 dalvik.vm.heapmaxfree=8m