是的,Android AOSP可以同时支持A2DP和LE Audio。要实现这一点,需要进行以下步骤:
LOCAL_BLUETOOTH_A2DP := true
int flags = PROPERTY_A2DP_SINK | PROPERTY_AVRCP_CT; adapterProperties_->addProperty(adapter, BluetoothProperty(PROPERTY_UUIDS, uuids)); adapterProperties_->addProperty(adapter, BluetoothProperty(PROPERTY_CLASS_OF_DEVICE, classOfDevice)); adapterProperties_->addProperty(adapter, BluetoothProperty(PROPERTY_ADAPTER_NAME, adapterName)); adapterProperties_->addProperty(adapter, BluetoothProperty(PROPERTY_LOCAL_FRIENDLY_NAME, localName)); adapterProperties_->addProperty(adapter, BluetoothProperty(PROPERTY_DISCOVERY_TIMEOUT, discoveryTimeoutS)); adapterProperties_->addProperty(adapter, BluetoothProperty(PROPERTY_DISCOVERY_LOADED, NULL, 0)); adapterProperties_->addProperty(adapter, BluetoothProperty(PROPERTY_DISCOVERY_NB_DEVICES, NULL, 0)); adapterProperties_->addProperty(adapter, BluetoothProperty(PROPERTY_ADAPTER_SCAN_MODE, &scanMode)); adapterProperties_->addProperty(adapter, BluetoothProperty(PROPERTY_ADAPTER_DISCOVERING, &discovering)); adapterProperties_->addProperty(adapter, BluetoothProperty(PROPERTY_ADAPTER_BONDED_DEVICES, NULL, 0)); adapterProperties_->addProperty(adapter, BluetoothProperty(PROPERTY_ADAPTER_UUIDS_LENGTH, &uuidLength)); adapterProperties_->addProperty(adapter, BluetoothProperty(PROPERTY_AVAILABILITY_CHANGED));
int flags = PROPERTY_BLE_BROADCASTER | PROPERTY_BLE_OBSERVER; adapterProperties_->addProperty(adapter, BluetoothProperty(PROPERTY_BLE_ADV_NAME, bleAdvName)); adapterProperties_->addProperty(adapter, BluetoothProperty(PROPERTY_BLE_ADV_DATA, bleAdvData, bleAdvDataLen)); adapterProperties_->addProperty(adapter, BluetoothProperty(PROPERTY_BLE_SCAN_RSP_DATA, bleScanRspData, bleScanRspDataLen)); adapterProperties_->addProperty(adapter, BluetoothProperty(PROPERTY_UUIDS, uuids, UUID_SIZE)); adapterProperties_->addProperty(adapter, BluetoothProperty(PROPERTY_CLASS_OF_DEVICE, (uint32_t)classOfDevice)); adapterProperties_->addProperty(adapter, BluetoothProperty(PROPERTY_LOCAL_FRIENDLY_NAME, localName, strlen(localName))); adapterProperties_->addProperty(adapter, BluetoothProperty(PROPERTY_DISCOVERY_TIMEOUT, &discoveryTimeoutS)); adapterProperties_->addProperty(adapter, BluetoothProperty(PROPERTY_BLE_SCAN_MODE, NULL, 0)); adapterProperties_->addProperty(adapter, BluetoothProperty(PROPERTY_BLE_ADVERTISING, NULL, 0));