Merge "Fix A2dpProfileTest#getLabelDeviceConnectedWithHighQualityCodec" into oc-mr1-dev
diff --git a/packages/SettingsLib/tests/robotests/src/android/bluetooth/BluetoothCodecConfig.java b/packages/SettingsLib/tests/robotests/src/android/bluetooth/BluetoothCodecConfig.java
index 656ab86..14b0d59 100644
--- a/packages/SettingsLib/tests/robotests/src/android/bluetooth/BluetoothCodecConfig.java
+++ b/packages/SettingsLib/tests/robotests/src/android/bluetooth/BluetoothCodecConfig.java
@@ -21,5 +21,6 @@
*/
public class BluetoothCodecConfig {
public boolean isMandatoryCodec() { return true; }
- public String getCodecName() { return null;}
+ public String getCodecName() { return null; }
+ public int getCodecType() { return -1; }
}
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/A2dpProfileTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/A2dpProfileTest.java
index 07a0e11..4a73c1b 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/A2dpProfileTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/A2dpProfileTest.java
@@ -21,6 +21,7 @@
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile;
import android.content.Context;
+import android.content.res.Resources;
import com.android.settingslib.R;
import com.android.settingslib.TestConfig;
@@ -133,6 +134,8 @@
// Strings to use in fake resource lookups.
private static String KNOWN_CODEC_LABEL = "Use high quality audio: %1$s";
private static String UNKNOWN_CODEC_LABEL = "Use high quality audio";
+ private static String[] CODEC_NAMES =
+ new String[] { "Default", "SBC", "AAC", "aptX", "aptX HD", "LDAC" };
/**
* Helper for setting up several tests of getHighQualityAudioOptionLabel
@@ -147,6 +150,11 @@
when(mContext.getString(eq(R.string.bluetooth_profile_a2dp_high_quality_unknown_codec)))
.thenReturn(UNKNOWN_CODEC_LABEL);
+ final Resources res = mock(Resources.class);
+ when(mContext.getResources()).thenReturn(res);
+ when(res.getStringArray(eq(R.array.bluetooth_a2dp_codec_titles)))
+ .thenReturn(CODEC_NAMES);
+
// Most tests want to simulate optional codecs being supported by the device, so do that
// by default here.
when(mBluetoothA2dpWrapper.supportsOptionalCodecs(any())).thenReturn(
@@ -196,7 +204,8 @@
when(status.getCodecsSelectableCapabilities()).thenReturn(configs);
when(config.isMandatoryCodec()).thenReturn(false);
- when(config.getCodecName()).thenReturn("PiedPiper");
+ when(config.getCodecType()).thenReturn(4);
+ when(config.getCodecName()).thenReturn("LDAC");
assertThat(mProfile.getHighQualityAudioOptionLabel(mDevice)).isEqualTo(
String.format(KNOWN_CODEC_LABEL, config.getCodecName()));
}