SBC Dual Channel (SBC HD Audio) support
"HD Audio" checkbox is not checked for SBC by default.
Change-Id: Id45c48aeaa2eb86f3dffa0cc825d1e09f1c00187
Signed-off-by: spezi77 <spezi7713@gmx.net>
diff --git a/src/com/android/bluetooth/a2dp/A2dpCodecConfig.java b/src/com/android/bluetooth/a2dp/A2dpCodecConfig.java
index 81044b3..260a08f 100644
--- a/src/com/android/bluetooth/a2dp/A2dpCodecConfig.java
+++ b/src/com/android/bluetooth/a2dp/A2dpCodecConfig.java
@@ -112,6 +112,14 @@
BluetoothCodecConfig codecConfig = codecConfigArray[i];
if (codecConfig != null && !codecConfig.isMandatoryCodec()) {
codecConfigArray[i] = null;
+ } else {
+ // Rebuild SBC selectable codec with Dual Channel (SBC HD audio)
+ codecConfigArray[i] = new BluetoothCodecConfig(
+ BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC, mA2dpSourceCodecPrioritySbc,
+ BluetoothCodecConfig.SAMPLE_RATE_NONE,
+ BluetoothCodecConfig.BITS_PER_SAMPLE_NONE,
+ BluetoothCodecConfig.CHANNEL_MODE_DUAL_CHANNEL, 0 /* codecSpecific1 */,
+ 0 /* codecSpecific2 */, 0 /* codecSpecific3 */, 0 /* codecSpecific4 */);
}
}
diff --git a/src/com/android/bluetooth/a2dp/A2dpService.java b/src/com/android/bluetooth/a2dp/A2dpService.java
index d722e67..71a1ab9 100755
--- a/src/com/android/bluetooth/a2dp/A2dpService.java
+++ b/src/com/android/bluetooth/a2dp/A2dpService.java
@@ -1773,7 +1773,13 @@
BluetoothCodecStatus codecStatus = sm.getCodecStatus();
if (codecStatus != null) {
for (BluetoothCodecConfig config : codecStatus.getCodecsSelectableCapabilities()) {
- if (config.isMandatoryCodec()) {
+ boolean isMandatoryCodecWithDualChannel = (config.isMandatoryCodec()
+ && (config.getChannelMode() & config.CHANNEL_MODE_DUAL_CHANNEL)
+ == config.CHANNEL_MODE_DUAL_CHANNEL);
+ if (isMandatoryCodecWithDualChannel) {
+ hasMandatoryCodec = true;
+ supportsOptional = true;
+ } else if (config.isMandatoryCodec()) {
hasMandatoryCodec = true;
} else {
supportsOptional = true;