use of android.bluetooth.BluetoothCodecStatus in project android_packages_apps_Settings by omnirom.
the class BluetoothChannelModeDialogPreferenceControllerTest method getSelectableIndex_verifyList.
@Test
public void getSelectableIndex_verifyList() {
BluetoothCodecConfig[] mCodecConfigs = { mCodecConfigAAC, mCodecConfigSBC };
mCodecStatus = new BluetoothCodecStatus(mCodecConfigSBC, null, mCodecConfigs);
when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
List<Integer> indexList = new ArrayList<>();
indexList.add(mPreference.getDefaultIndex());
indexList.add(mController.convertCfgToBtnIndex(BluetoothCodecConfig.CHANNEL_MODE_MONO));
indexList.add(mController.convertCfgToBtnIndex(BluetoothCodecConfig.CHANNEL_MODE_STEREO));
assertThat(mController.getSelectableIndex().containsAll(indexList)).isTrue();
assertThat(indexList.containsAll(mController.getSelectableIndex())).isTrue();
}
use of android.bluetooth.BluetoothCodecStatus in project android_packages_apps_Settings by omnirom.
the class BluetoothCodecDialogPreferenceControllerTest method writeConfigurationValues_checkCodec.
@Test
public void writeConfigurationValues_checkCodec() {
BluetoothCodecConfig[] mCodecConfigs = { mCodecConfigAAC, mCodecConfigSBC, mCodecConfigAPTX, mCodecConfigAPTXHD, mCodecConfigLDAC, mCodecConfigAAC, mCodecConfigSBC };
mCodecStatus = new BluetoothCodecStatus(mCodecConfigSBC, null, mCodecConfigs);
when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.writeConfigurationValues(1);
verify(mBluetoothA2dpConfigStore, atLeastOnce()).setCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC);
mController.writeConfigurationValues(2);
verify(mBluetoothA2dpConfigStore).setCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC);
mController.writeConfigurationValues(3);
verify(mBluetoothA2dpConfigStore).setCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX);
mController.writeConfigurationValues(4);
verify(mBluetoothA2dpConfigStore).setCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD);
mController.writeConfigurationValues(5);
verify(mBluetoothA2dpConfigStore).setCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC);
}
use of android.bluetooth.BluetoothCodecStatus in project android_packages_apps_Settings by omnirom.
the class BluetoothCodecDialogPreferenceControllerTest method writeConfigurationValues_selectDefault_setHighest.
@Test
public void writeConfigurationValues_selectDefault_setHighest() {
BluetoothCodecConfig[] mCodecConfigs = { mCodecConfigAAC, mCodecConfigSBC };
mCodecStatus = new BluetoothCodecStatus(mCodecConfigSBC, null, mCodecConfigs);
when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.writeConfigurationValues(0);
verify(mBluetoothA2dpConfigStore).setCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC);
}
use of android.bluetooth.BluetoothCodecStatus in project android_packages_apps_Settings by omnirom.
the class AbstractBluetoothDialogPreferenceControllerTest method onBluetoothServiceConnected_verifyBluetoothA2dpConfigStore.
@Test
public void onBluetoothServiceConnected_verifyBluetoothA2dpConfigStore() {
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
verify(mBluetoothA2dpConfigStore).setCodecType(mCodecConfigAAC.getCodecType());
verify(mBluetoothA2dpConfigStore).setSampleRate(mCodecConfigAAC.getSampleRate());
verify(mBluetoothA2dpConfigStore).setBitsPerSample(mCodecConfigAAC.getBitsPerSample());
verify(mBluetoothA2dpConfigStore).setChannelMode(mCodecConfigAAC.getChannelMode());
verify(mBluetoothA2dpConfigStore).setCodecPriority(CODEC_PRIORITY_HIGHEST);
verify(mBluetoothA2dpConfigStore).setCodecSpecific1Value(mCodecConfigAAC.getCodecSpecific1());
}
use of android.bluetooth.BluetoothCodecStatus in project android_packages_apps_Settings by omnirom.
the class AbstractBluetoothDialogPreferenceControllerTest method getSelectableByCodecType_verifyConfig.
@Test
public void getSelectableByCodecType_verifyConfig() {
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
assertThat(mController.getSelectableByCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC)).isEqualTo(mCodecConfigAAC);
}
Aggregations