Search in sources :

Example 41 with BluetoothCodecConfig

use of android.bluetooth.BluetoothCodecConfig in project android_packages_apps_Settings by omnirom.

the class BluetoothBitPerSampleDialogPreferenceControllerTest 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(mPreference.getDefaultIndex());
    indexList.add(mController.convertCfgToBtnIndex(BluetoothCodecConfig.BITS_PER_SAMPLE_16));
    indexList.add(mController.convertCfgToBtnIndex(BluetoothCodecConfig.BITS_PER_SAMPLE_24));
    assertThat(mController.getSelectableIndex().containsAll(indexList)).isTrue();
    assertThat(indexList.containsAll(mController.getSelectableIndex())).isTrue();
}
Also used : BluetoothCodecStatus(android.bluetooth.BluetoothCodecStatus) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 42 with BluetoothCodecConfig

use of android.bluetooth.BluetoothCodecConfig in project android_packages_apps_Settings by omnirom.

the class BluetoothChannelModeDialogPreferenceControllerTest 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).setChannelMode(BluetoothCodecConfig.CHANNEL_MODE_STEREO);
}
Also used : BluetoothCodecStatus(android.bluetooth.BluetoothCodecStatus) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) Test(org.junit.Test)

Example 43 with BluetoothCodecConfig

use of android.bluetooth.BluetoothCodecConfig 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();
}
Also used : BluetoothCodecStatus(android.bluetooth.BluetoothCodecStatus) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 44 with BluetoothCodecConfig

use of android.bluetooth.BluetoothCodecConfig 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);
}
Also used : BluetoothCodecStatus(android.bluetooth.BluetoothCodecStatus) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) Test(org.junit.Test)

Example 45 with BluetoothCodecConfig

use of android.bluetooth.BluetoothCodecConfig 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);
}
Also used : BluetoothCodecStatus(android.bluetooth.BluetoothCodecStatus) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) Test(org.junit.Test)

Aggregations

BluetoothCodecConfig (android.bluetooth.BluetoothCodecConfig)45 BluetoothCodecStatus (android.bluetooth.BluetoothCodecStatus)17 Test (org.junit.Test)11 ArrayList (java.util.ArrayList)7 Resources (android.content.res.Resources)6 BluetoothA2dpConfigStore (com.android.settings.development.BluetoothA2dpConfigStore)6 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)6 Before (org.junit.Before)6 BluetoothDevice (android.bluetooth.BluetoothDevice)5 BluetoothA2dp (android.bluetooth.BluetoothA2dp)2