Phone fails to switch channel mode from stereo to mono

-Set codec to SBC when HD audio is off

Bug: 194349060
Test: make -j50 RunSettingsRoboTests

Change-Id: Iae4aa3f1d77350f5b4d91e7a687e048091c1daea
This commit is contained in:
Tim Peng
2021-08-20 05:43:29 +00:00
parent ab7640dcd9
commit 07b3675717
3 changed files with 51 additions and 3 deletions

View File

@@ -219,11 +219,17 @@ public abstract class AbstractBluetoothDialogPreferenceController extends
*/
public void onHDAudioEnabled(boolean enabled) {}
static int getHighestCodec(BluetoothCodecConfig[] configs) {
static int getHighestCodec(BluetoothA2dp bluetoothA2dp, BluetoothDevice activeDevice,
BluetoothCodecConfig[] configs) {
if (configs == null) {
Log.d(TAG, "Unable to get highest codec. Configs are empty");
return BluetoothCodecConfig.SOURCE_CODEC_TYPE_INVALID;
}
// If HD audio is not enabled, SBC is the only one available codec.
if (bluetoothA2dp.isOptionalCodecsEnabled(activeDevice)
!= BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED) {
return BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC;
}
for (int i = 0; i < CODEC_TYPES.length; i++) {
for (int j = 0; j < configs.length; j++) {
if ((configs[j].getCodecType() == CODEC_TYPES[i])) {