Search in sources :

Example 6 with BluetoothCodecConfig

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

the class BluetoothSampleRateDialogPreferenceControllerTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    mBluetoothA2dpConfigStore = spy(new BluetoothA2dpConfigStore());
    mActiveDevice = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(DEVICE_ADDRESS);
    mController = spy(new BluetoothSampleRateDialogPreferenceController(mContext, mLifecycle, mBluetoothA2dpConfigStore));
    mPreference = new BluetoothSampleRateDialogPreference(mContext);
    when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
    mController.displayPreference(mScreen);
    mCodecConfigAAC = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC, BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT, BluetoothCodecConfig.SAMPLE_RATE_48000 | BluetoothCodecConfig.SAMPLE_RATE_88200, BluetoothCodecConfig.BITS_PER_SAMPLE_NONE, BluetoothCodecConfig.CHANNEL_MODE_NONE, 0, 0, 0, 0);
    mCodecConfigSBC = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC, BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT, BluetoothCodecConfig.SAMPLE_RATE_96000, BluetoothCodecConfig.BITS_PER_SAMPLE_NONE, BluetoothCodecConfig.CHANNEL_MODE_NONE, 0, 0, 0, 0);
    when(mBluetoothA2dp.getActiveDevice()).thenReturn(mActiveDevice);
}
Also used : BluetoothA2dpConfigStore(com.android.settings.development.BluetoothA2dpConfigStore) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) Before(org.junit.Before)

Example 7 with BluetoothCodecConfig

use of android.bluetooth.BluetoothCodecConfig 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 BluetoothCodecConfig

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

the class BluetoothBitPerSampleDialogPreferenceControllerTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    mBluetoothA2dpConfigStore = spy(new BluetoothA2dpConfigStore());
    mActiveDevice = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(DEVICE_ADDRESS);
    mController = spy(new BluetoothBitPerSampleDialogPreferenceController(mContext, mLifecycle, mBluetoothA2dpConfigStore));
    mPreference = new BluetoothBitPerSampleDialogPreference(mContext);
    when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
    mController.displayPreference(mScreen);
    mCodecConfigAAC = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC, BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT, BluetoothCodecConfig.SAMPLE_RATE_NONE, BluetoothCodecConfig.BITS_PER_SAMPLE_16 | BluetoothCodecConfig.BITS_PER_SAMPLE_24, BluetoothCodecConfig.CHANNEL_MODE_NONE, 0, 0, 0, 0);
    mCodecConfigSBC = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC, BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT, BluetoothCodecConfig.SAMPLE_RATE_NONE, BluetoothCodecConfig.BITS_PER_SAMPLE_24, BluetoothCodecConfig.CHANNEL_MODE_NONE, 0, 0, 0, 0);
    when(mBluetoothA2dp.getActiveDevice()).thenReturn(mActiveDevice);
}
Also used : BluetoothA2dpConfigStore(com.android.settings.development.BluetoothA2dpConfigStore) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) Before(org.junit.Before)

Example 9 with BluetoothCodecConfig

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

the class BluetoothChannelModeDialogPreferenceControllerTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    mBluetoothA2dpConfigStore = spy(new BluetoothA2dpConfigStore());
    mActiveDevice = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(DEVICE_ADDRESS);
    mController = new BluetoothChannelModeDialogPreferenceController(mContext, mLifecycle, mBluetoothA2dpConfigStore);
    mPreference = new BluetoothChannelModeDialogPreference(mContext);
    when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
    mController.displayPreference(mScreen);
    mCodecConfigAAC = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC, BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT, BluetoothCodecConfig.SAMPLE_RATE_NONE, BluetoothCodecConfig.BITS_PER_SAMPLE_NONE, BluetoothCodecConfig.CHANNEL_MODE_STEREO, 0, 0, 0, 0);
    mCodecConfigSBC = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC, BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT, BluetoothCodecConfig.SAMPLE_RATE_NONE, BluetoothCodecConfig.BITS_PER_SAMPLE_NONE, BluetoothCodecConfig.CHANNEL_MODE_MONO | BluetoothCodecConfig.CHANNEL_MODE_STEREO, 0, 0, 0, 0);
    when(mBluetoothA2dp.getActiveDevice()).thenReturn(mActiveDevice);
}
Also used : BluetoothA2dpConfigStore(com.android.settings.development.BluetoothA2dpConfigStore) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) Before(org.junit.Before)

Example 10 with BluetoothCodecConfig

use of android.bluetooth.BluetoothCodecConfig 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)

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