Add support for selection of Opus in Developer Options

Stub implementation for LC3 is added due to the interfaces being
present. The BT stack does not currently implement LC3 over A2DP.

Bug: 226441860
Test: BluetoothCodecDialogPreferenceControllerTest

Change-Id: I40546c97370872b37c0258d10e67a3871f9d9af5
This commit is contained in:
Omer Osman
2022-04-22 02:10:26 +00:00
parent 5d68dd58aa
commit b61e129f35
5 changed files with 76 additions and 8 deletions

View File

@@ -40,7 +40,11 @@ public abstract class AbstractBluetoothDialogPreferenceController extends
private static final String TAG = "AbstractBtDlgCtr";
protected static final int[] CODEC_TYPES = {BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC,
private static final int SOURCE_CODEC_TYPE_OPUS = 6; // TODO(b/240635097): remove in U
protected static final int[] CODEC_TYPES = {SOURCE_CODEC_TYPE_OPUS,
BluetoothCodecConfig.SOURCE_CODEC_TYPE_LC3,
BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC,
BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD,
BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX,
BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC,

View File

@@ -61,6 +61,8 @@ public class BluetoothCodecDialogPreference extends BaseBluetoothDialogPreferenc
mRadioButtonIds.add(R.id.bluetooth_audio_codec_aptx);
mRadioButtonIds.add(R.id.bluetooth_audio_codec_aptx_hd);
mRadioButtonIds.add(R.id.bluetooth_audio_codec_ldac);
mRadioButtonIds.add(R.id.bluetooth_audio_codec_lc3);
mRadioButtonIds.add(R.id.bluetooth_audio_codec_opus);
String[] stringArray = context.getResources().getStringArray(
R.array.bluetooth_a2dp_codec_titles);
for (int i = 0; i < stringArray.length; i++) {

View File

@@ -40,6 +40,8 @@ public class BluetoothCodecDialogPreferenceController extends
private static final String KEY = "bluetooth_audio_codec_settings";
private static final String TAG = "BtCodecCtr";
private static final int SOURCE_CODEC_TYPE_OPUS = 6; // TODO remove in U
private final Callback mCallback;
public BluetoothCodecDialogPreferenceController(Context context, Lifecycle lifecycle,
@@ -118,6 +120,14 @@ public class BluetoothCodecDialogPreferenceController extends
codecTypeValue = BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC;
codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST;
break;
case 6:
codecTypeValue = BluetoothCodecConfig.SOURCE_CODEC_TYPE_LC3;
codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST;
break;
case 7:
codecTypeValue = SOURCE_CODEC_TYPE_OPUS; // TODO update in U
codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST;
break;
default:
break;
}
@@ -180,6 +190,9 @@ public class BluetoothCodecDialogPreferenceController extends
case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC:
index = 5;
break;
case SOURCE_CODEC_TYPE_OPUS: // TODO update in U
index = 7;
break;
default:
Log.e(TAG, "Unsupported config:" + config);
break;