Unable to set Bluetooth configuration at the first time
- initial configuration value - add test case Bug: 147634692 Test: make -j50 RunSettingsRoboTests Change-Id: If55036d358d664bcbcb816a38f18019c62976d38
This commit is contained in:
@@ -53,9 +53,12 @@ public abstract class AbstractBluetoothDialogPreferenceController extends
|
||||
protected static final int[] CHANNEL_MODES = {BluetoothCodecConfig.CHANNEL_MODE_STEREO,
|
||||
BluetoothCodecConfig.CHANNEL_MODE_MONO};
|
||||
|
||||
protected final BluetoothA2dpConfigStore mBluetoothA2dpConfigStore;
|
||||
|
||||
public AbstractBluetoothDialogPreferenceController(Context context, Lifecycle lifecycle,
|
||||
BluetoothA2dpConfigStore store) {
|
||||
super(context, lifecycle, store);
|
||||
mBluetoothA2dpConfigStore = store;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -92,6 +95,25 @@ public abstract class AbstractBluetoothDialogPreferenceController extends
|
||||
return getCurrentIndexByConfig(codecConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBluetoothServiceConnected(BluetoothA2dp bluetoothA2dp) {
|
||||
super.onBluetoothServiceConnected(bluetoothA2dp);
|
||||
initConfigStore();
|
||||
}
|
||||
|
||||
private void initConfigStore() {
|
||||
final BluetoothCodecConfig config = getCurrentCodecConfig();
|
||||
if (config == null) {
|
||||
return;
|
||||
}
|
||||
mBluetoothA2dpConfigStore.setCodecType(config.getCodecType());
|
||||
mBluetoothA2dpConfigStore.setSampleRate(config.getSampleRate());
|
||||
mBluetoothA2dpConfigStore.setBitsPerSample(config.getBitsPerSample());
|
||||
mBluetoothA2dpConfigStore.setChannelMode(config.getChannelMode());
|
||||
mBluetoothA2dpConfigStore.setCodecPriority(config.getCodecPriority());
|
||||
mBluetoothA2dpConfigStore.setCodecSpecific1Value(config.getCodecSpecific1());
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the new value to the {@link BluetoothA2dpConfigStore}.
|
||||
*
|
||||
@@ -174,7 +196,7 @@ public abstract class AbstractBluetoothDialogPreferenceController extends
|
||||
*
|
||||
* @param enabled Is {@code true} when the setting is enabled.
|
||||
*/
|
||||
public void onHDAudioEnabled(boolean enabled) {};
|
||||
public void onHDAudioEnabled(boolean enabled) {}
|
||||
|
||||
static int getHighestCodec(BluetoothCodecConfig[] configs) {
|
||||
if (configs == null) {
|
||||
|
Reference in New Issue
Block a user