Search in sources :

Example 6 with BluetoothCodecStatus

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

the class BluetoothQualityDialogPreferenceControllerTest method updateState_codeTypeIsLDAC_enablePreference.

@Test
public void updateState_codeTypeIsLDAC_enablePreference() {
    BluetoothCodecConfig[] mCodecConfigs = { mCodecConfigAAC, mCodecConfigLDAC };
    mCodecStatus = new BluetoothCodecStatus(mCodecConfigLDAC, null, mCodecConfigs);
    when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
    mController.onBluetoothServiceConnected(mBluetoothA2dp);
    mController.updateState(mPreference);
    assertThat(mPreference.isEnabled()).isTrue();
}
Also used : BluetoothCodecStatus(android.bluetooth.BluetoothCodecStatus) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) Test(org.junit.Test)

Example 7 with BluetoothCodecStatus

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

the class BluetoothSampleRateDialogPreferenceControllerTest method writeConfigurationValues_selectDefault_setHighest.

@Test
public void writeConfigurationValues_selectDefault_setHighest() {
    mCodecConfigSBC = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC);
    BluetoothCodecConfig[] mCodecConfigs = { mCodecConfigAAC, mCodecConfigSBC };
    mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
    when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
    mController.onBluetoothServiceConnected(mBluetoothA2dp);
    mController.writeConfigurationValues(0);
    verify(mBluetoothA2dpConfigStore).setSampleRate(BluetoothCodecConfig.SAMPLE_RATE_88200);
}
Also used : BluetoothCodecStatus(android.bluetooth.BluetoothCodecStatus) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) Test(org.junit.Test)

Example 8 with BluetoothCodecStatus

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

the class AbstractBluetoothDialogPreferenceControllerTest method getSelectableByCodecType_unavailable.

@Test
public void getSelectableByCodecType_unavailable() {
    mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
    when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
    mController.onBluetoothServiceConnected(mBluetoothA2dp);
    assertThat(mController.getSelectableByCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX)).isNull();
}
Also used : BluetoothCodecStatus(android.bluetooth.BluetoothCodecStatus) Test(org.junit.Test)

Example 9 with BluetoothCodecStatus

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

the class BluetoothCodecDialogPreferenceControllerTest method writeConfigurationValues_resetHighestConfig.

@Test
public void writeConfigurationValues_resetHighestConfig() {
    BluetoothCodecConfig[] mCodecConfigs = { mCodecConfigAAC, mCodecConfigSBC, mCodecConfigAPTX, mCodecConfigAPTXHD, mCodecConfigLDAC, mCodecConfigAAC, mCodecConfigSBC };
    mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
    when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
    mController.onBluetoothServiceConnected(mBluetoothA2dp);
    mController.writeConfigurationValues(2);
    verify(mBluetoothA2dpConfigStore, atLeastOnce()).setCodecPriority(BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST);
    verify(mBluetoothA2dpConfigStore, atLeastOnce()).setSampleRate(BluetoothCodecConfig.SAMPLE_RATE_88200);
    verify(mBluetoothA2dpConfigStore, atLeastOnce()).setBitsPerSample(BluetoothCodecConfig.BITS_PER_SAMPLE_24);
    verify(mBluetoothA2dpConfigStore, atLeastOnce()).setChannelMode(BluetoothCodecConfig.CHANNEL_MODE_STEREO);
}
Also used : BluetoothCodecStatus(android.bluetooth.BluetoothCodecStatus) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) Test(org.junit.Test)

Example 10 with BluetoothCodecStatus

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

the class AbstractBluetoothDialogPreferenceControllerTest method onIndexUpdated_checkFlow.

@Test
public void onIndexUpdated_checkFlow() {
    mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, null);
    when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
    when(mBluetoothA2dpConfigStore.createCodecConfig()).thenReturn(mCodecConfigAAC);
    mController.onBluetoothServiceConnected(mBluetoothA2dp);
    mController.onIndexUpdated(mCurrentConfig);
    verify(mController).writeConfigurationValues(mCurrentConfig);
    verify(mBluetoothA2dp).setCodecConfigPreference(mActiveDevice, mCodecConfigAAC);
    assertThat(mPreference.getSummary()).isEqualTo(SUMMARY);
}
Also used : BluetoothCodecStatus(android.bluetooth.BluetoothCodecStatus) Test(org.junit.Test)

Aggregations

BluetoothCodecStatus (android.bluetooth.BluetoothCodecStatus)26 BluetoothCodecConfig (android.bluetooth.BluetoothCodecConfig)17 Test (org.junit.Test)17 Resources (android.content.res.Resources)6 BluetoothDevice (android.bluetooth.BluetoothDevice)3 ArrayList (java.util.ArrayList)3 BluetoothA2dp (android.bluetooth.BluetoothA2dp)2 VisibleForTesting (androidx.annotation.VisibleForTesting)1