From 4f441c03a754092cefe98019ab426a3f7cd88ba5 Mon Sep 17 00:00:00 2001 From: Jakub Rotkiewicz Date: Wed, 21 Aug 2024 19:49:31 +0000 Subject: [PATCH] bluetooth: Fix Mono/Stereo selection with new codec list When SBC was selected and user changed Channel mode from Stereo to Mono the codec type wasn't set properly and the reconfiguration failed. Bug: 329809288 Flag: EXEMPT - minor refactor Test: manual - choose SBC and change mode to MONO Merged-In: If847bab1cc05d8c38a680e87277dd857970b4251 Change-Id: Ie32e3a3aa85f866d504dde7396feacf154a2298b --- .../development/BluetoothA2dpConfigStore.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/development/BluetoothA2dpConfigStore.java b/src/com/android/settings/development/BluetoothA2dpConfigStore.java index d6b849f5718..0fef49f3124 100644 --- a/src/com/android/settings/development/BluetoothA2dpConfigStore.java +++ b/src/com/android/settings/development/BluetoothA2dpConfigStore.java @@ -80,8 +80,7 @@ public class BluetoothA2dpConfigStore { /** Create codec config utilizing {@link BluetoothCodecConfig.SourceCodecType} */ public BluetoothCodecConfig createCodecConfig() { - return new BluetoothCodecConfig.Builder() - .setCodecType(mCodecTypeNative) + BluetoothCodecConfig.Builder builder = new BluetoothCodecConfig.Builder() .setCodecPriority(mCodecPriority) .setSampleRate(mSampleRate) .setBitsPerSample(mBitsPerSample) @@ -89,8 +88,13 @@ public class BluetoothA2dpConfigStore { .setCodecSpecific1(mCodecSpecific1Value) .setCodecSpecific2(mCodecSpecific2Value) .setCodecSpecific3(mCodecSpecific3Value) - .setCodecSpecific4(mCodecSpecific4Value) - .build(); + .setCodecSpecific4(mCodecSpecific4Value); + if (Flags.a2dpOffloadCodecExtensibilitySettings()) { + builder.setExtendedCodecType(mCodecType); + } else { + builder.setCodecType(mCodecTypeNative); + } + return builder.build(); } /** Create codec config utilizing {@link BluetoothCodecType} */