Merge "Phone fails to switch channel mode from stereo to mono" into stage-aosp-master am: f2295126b6 am: ebc8a9fd1c am: 04e10ffc28

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/15942380

Change-Id: I073a5c88f41f227c315ac072ad026b6be424efda
This commit is contained in:
Roopa Sattiraju
2021-10-14 18:57:53 +00:00
committed by Automerger Merge Worker
3 changed files with 51 additions and 3 deletions

View File

@@ -19,6 +19,7 @@ package com.android.settings.development.bluetooth;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -108,6 +109,8 @@ public class BluetoothCodecDialogPreferenceControllerTest {
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC};
mCodecStatus = new BluetoothCodecStatus(mCodecConfigSBC, null, mCodecConfigs);
when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
when(mBluetoothA2dp.isOptionalCodecsEnabled(mActiveDevice)).thenReturn(
BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.writeConfigurationValues(0);
@@ -172,4 +175,37 @@ public class BluetoothCodecDialogPreferenceControllerTest {
verify(mCallback).onBluetoothCodecChanged();
}
@Test
public void onHDAudioEnabled_optionalCodecEnabled_setsCodecTypeAsAAC() {
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC};
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC,
/* codecsLocalCapabilities= */ null,
mCodecConfigs);
when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
when(mBluetoothA2dp.isOptionalCodecsEnabled(mActiveDevice)).thenReturn(
BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.onHDAudioEnabled(/* enabled= */ true);
verify(mBluetoothA2dpConfigStore, atLeastOnce()).setCodecType(
eq(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC));
}
@Test
public void onHDAudioEnabled_optionalCodecDisabled_setsCodecTypeAsSBC() {
BluetoothCodecConfig[] mCodecConfigs = {mCodecConfigAAC, mCodecConfigSBC};
mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC,
/* codecsLocalCapabilities= */ null,
mCodecConfigs);
when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
when(mBluetoothA2dp.isOptionalCodecsEnabled(mActiveDevice)).thenReturn(
BluetoothA2dp.OPTIONAL_CODECS_PREF_DISABLED);
mController.onBluetoothServiceConnected(mBluetoothA2dp);
mController.onHDAudioEnabled(/* enabled= */ false);
verify(mBluetoothA2dpConfigStore, atLeastOnce()).setCodecType(
eq(BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC));
}
}