use of com.android.settingslib.bluetooth.A2dpProfile in project android_packages_apps_Settings by omnirom.
the class BluetoothDetailsProfilesControllerTest method highQualityAudio_prefIsPresentWhenSupported.
@Test
public void highQualityAudio_prefIsPresentWhenSupported() {
setupDevice(makeDefaultDeviceConfig());
addMockA2dpProfile(true, true, true);
showScreen(mController);
SwitchPreference pref = getHighQualityAudioPref();
assertThat(pref.getKey()).isEqualTo(BluetoothDetailsProfilesController.HIGH_QUALITY_AUDIO_PREF_TAG);
// Make sure the preference works when clicked on.
pref.performClick();
A2dpProfile profile = (A2dpProfile) mConnectableProfiles.get(0);
verify(profile).setHighQualityAudioEnabled(mDevice, false);
pref.performClick();
verify(profile).setHighQualityAudioEnabled(mDevice, true);
}
use of com.android.settingslib.bluetooth.A2dpProfile in project android_packages_apps_Settings by omnirom.
the class BluetoothDetailsProfilesControllerTest method highQualityAudio_mediaAudioDisabledAndReEnabled.
@Test
public void highQualityAudio_mediaAudioDisabledAndReEnabled() {
setupDevice(makeDefaultDeviceConfig());
A2dpProfile audioProfile = addMockA2dpProfile(true, true, true);
showScreen(mController);
assertThat(mProfiles.getPreferenceCount()).isEqualTo(3);
// Disabling media audio should cause the high quality audio switch to disappear, but not
// the regular audio one.
SwitchPreference audioPref = (SwitchPreference) mScreen.findPreference(audioProfile.toString());
audioPref.performClick();
verify(audioProfile).setEnabled(mDevice, false);
when(audioProfile.isEnabled(mDevice)).thenReturn(false);
mController.onDeviceAttributesChanged();
assertThat(audioPref.isVisible()).isTrue();
SwitchPreference highQualityAudioPref = getHighQualityAudioPref();
assertThat(highQualityAudioPref.isVisible()).isFalse();
// And re-enabling media audio should make high quality switch to reappear.
audioPref.performClick();
verify(audioProfile).setEnabled(mDevice, true);
when(audioProfile.isEnabled(mDevice)).thenReturn(true);
mController.onDeviceAttributesChanged();
highQualityAudioPref = getHighQualityAudioPref();
assertThat(highQualityAudioPref.isVisible()).isTrue();
}
Aggregations