use of android.bluetooth.BluetoothCodecConfig in project android_packages_apps_Settings by omnirom.
the class BluetoothQualityDialogPreferenceController method updateState.
@Override
public void updateState(Preference preference) {
super.updateState(preference);
// Enable preference when current codec type is LDAC. For other cases, disable it.
final BluetoothCodecConfig currentConfig = getCurrentCodecConfig();
if (currentConfig != null && currentConfig.getCodecType() == BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC) {
preference.setEnabled(true);
} else {
preference.setEnabled(false);
preference.setSummary("");
}
}
use of android.bluetooth.BluetoothCodecConfig in project android_packages_apps_Settings by omnirom.
the class AbstractBluetoothA2dpPreferenceController method updateState.
@Override
public void updateState(Preference preference) {
BluetoothDevice activeDevice = mBluetoothA2dp.getActiveDevice();
if (activeDevice == null || getCodecConfig(activeDevice) == null || mPreference == null) {
return;
}
BluetoothCodecConfig codecConfig;
synchronized (mBluetoothA2dpConfigStore) {
codecConfig = getCodecConfig(activeDevice);
}
final int index = getCurrentA2dpSettingIndex(codecConfig);
mPreference.setValue(mListValues[index]);
// We only want to append "Streaming" if not using default
if (index == getDefaultIndex()) {
mPreference.setSummary(mListSummaries[index]);
} else {
mPreference.setSummary(mContext.getResources().getString(STREAMING_LABEL_ID, mListSummaries[index]));
}
writeConfigurationValues(mListValues[index]);
}
use of android.bluetooth.BluetoothCodecConfig in project android_packages_apps_Settings by omnirom.
the class BluetoothQualityDialogPreferenceControllerTest method updateState_codeTypeAAC_disablePreference.
@Test
public void updateState_codeTypeAAC_disablePreference() {
BluetoothCodecConfig[] mCodecConfigs = { mCodecConfigAAC, mCodecConfigLDAC };
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.updateState(mPreference);
assertThat(mPreference.isEnabled()).isFalse();
}
use of android.bluetooth.BluetoothCodecConfig in project android_packages_apps_Settings by omnirom.
the class BluetoothSampleRateDialogPreferenceControllerTest method getSelectableIndex_verifyList.
@Test
public void getSelectableIndex_verifyList() {
BluetoothCodecConfig[] mCodecConfigs = { mCodecConfigAAC, mCodecConfigSBC };
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
List<Integer> indexList = new ArrayList<>();
indexList.add(mController.getDefaultIndex());
indexList.add(mController.convertCfgToBtnIndex(BluetoothCodecConfig.SAMPLE_RATE_48000));
indexList.add(mController.convertCfgToBtnIndex(BluetoothCodecConfig.SAMPLE_RATE_88200));
assertThat(mController.getSelectableIndex().containsAll(indexList)).isTrue();
assertThat(indexList.containsAll(mController.getSelectableIndex())).isTrue();
}
use of android.bluetooth.BluetoothCodecConfig in project android_packages_apps_Settings by omnirom.
the class BluetoothBitPerSampleDialogPreferenceControllerTest method writeConfigurationValues_selectDefault_setHighest.
@Test
public void writeConfigurationValues_selectDefault_setHighest() {
BluetoothCodecConfig[] mCodecConfigs = { mCodecConfigAAC, mCodecConfigSBC };
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.writeConfigurationValues(0);
verify(mBluetoothA2dpConfigStore).setBitsPerSample(BluetoothCodecConfig.BITS_PER_SAMPLE_24);
}
Aggregations