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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations