Skip to content

Commit e8429c5

Browse files
neobuddy89mg712702
authored andcommitted
Add switch to select SBC HD by default [2/3]
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com> Change-Id: I3307506e332350894dbe6022882a9510293f1a4d
1 parent c64274d commit e8429c5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/com/android/bluetooth/a2dp/A2dpCodecConfig.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,22 @@ void enableOptionalCodecs(BluetoothDevice device, BluetoothCodecConfig currentCo
105105
return;
106106
}
107107

108+
boolean sbc_priority = Settings.System.getInt(mContext.getContentResolver(),
109+
Settings.System.SBC_HD_PRIORITY, 0) != 0;
110+
108111
// Set the mandatory codec's priority to default, and remove the rest
109112
for (int i = 0; i < codecConfigArray.length; i++) {
110113
BluetoothCodecConfig codecConfig = codecConfigArray[i];
111114
if (codecConfig != null && !codecConfig.isMandatoryCodec()) {
112115
codecConfigArray[i] = null;
116+
} else if (sbc_priority) {
117+
// Rebuild SBC selectable codec with Dual Channel (SBC HD audio)
118+
codecConfigArray[i] = new BluetoothCodecConfig(
119+
BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC, mA2dpSourceCodecPrioritySbc,
120+
BluetoothCodecConfig.SAMPLE_RATE_NONE,
121+
BluetoothCodecConfig.BITS_PER_SAMPLE_NONE,
122+
BluetoothCodecConfig.CHANNEL_MODE_DUAL_CHANNEL, 0 /* codecSpecific1 */,
123+
0 /* codecSpecific2 */, 0 /* codecSpecific3 */, 0 /* codecSpecific4 */);
113124
}
114125
}
115126

0 commit comments

Comments
 (0)