Adding super-set of index channel masks to USB Peripheral Profiles.
This will allow the CTSVerifier Attributes Test to pass on devices with QualCOM & Legacy HAL.
Adding additional information to Mismatch messages.
Bug: 119142968
Test: Build CTSVerifier, run USB Audio Attributes test.
Change-Id: I0c27054af533c60945d31568e6ec71cbdf321531
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralAttributesActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralAttributesActivity.java
index ef67708..5029160 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralAttributesActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralAttributesActivity.java
@@ -70,21 +70,27 @@
if (deviceInfo.getChannelCounts().length == 0) {
sb.append("Output - No Peripheral Channel Counts\n");
} else if (!ListsHelper.isSubset(deviceInfo.getChannelCounts(), attribs.mChannelCounts)) {
- sb.append("Output - Channel Counts Mismatch\n");
+ sb.append("Output - Channel Counts Mismatch" +
+ " d" + ListsHelper.textFormatDecimal(deviceInfo.getChannelCounts()) +
+ " p" + ListsHelper.textFormatDecimal(attribs.mChannelCounts) +"\n");
}
// Encodings
if (deviceInfo.getEncodings().length == 0) {
sb.append("Output - No Peripheral Encodings\n");
} else if (!ListsHelper.isSubset(deviceInfo.getEncodings(), attribs.mEncodings)) {
- sb.append("Output - Encodings Mismatch\n");
+ sb.append("Output - Encodings Mismatch" +
+ " d" + ListsHelper.textFormatHex(deviceInfo.getEncodings()) +
+ " p" + ListsHelper.textFormatHex(attribs.mEncodings) + "\n");
}
// Sample Rates
if (deviceInfo.getSampleRates().length == 0) {
sb.append("Output - No Peripheral Sample Rates\n");
} else if (!ListsHelper.isSubset(deviceInfo.getSampleRates(), attribs.mSampleRates)) {
- sb.append("Output - Sample Rates Mismatch\n");
+ sb.append("Output - Sample Rates Mismatch" +
+ " d" + ListsHelper.textFormatHex(deviceInfo.getSampleRates()) +
+ " p" + ListsHelper.textFormatHex(attribs.mSampleRates) + "\n");
}
// Channel Masks
@@ -95,13 +101,17 @@
// Channel Index Masks
if (!ListsHelper.isSubset(deviceInfo.getChannelIndexMasks(),
attribs.mChannelIndexMasks)) {
- sb.append("Output - Channel Index Masks Mismatch\n");
+ sb.append("Output - Channel Index Masks Mismatch" +
+ " d" + ListsHelper.textFormatHex(deviceInfo.getChannelIndexMasks()) +
+ " p" + ListsHelper.textFormatHex(attribs.mChannelIndexMasks) + "\n");
}
// Channel Position Masks
if (!ListsHelper.isSubset(deviceInfo.getChannelMasks(),
attribs.mChannelPositionMasks)) {
- sb.append("Output - Channel Position Masks Mismatch\n");
+ sb.append("Output - Channel Position Masks Mismatch" +
+ " d" + ListsHelper.textFormatHex(deviceInfo.getChannelMasks()) +
+ " p" + ListsHelper.textFormatHex(attribs.mChannelPositionMasks) + "\n");
}
}
@@ -128,21 +138,27 @@
if (deviceInfo.getChannelCounts().length == 0) {
sb.append("Input - No Peripheral Channel Counts\n");
} else if (!ListsHelper.isSubset(deviceInfo.getChannelCounts(), attribs.mChannelCounts)) {
- sb.append("Input - Channel Counts Mismatch\n");
+ sb.append("Input - Channel Counts Mismatch" +
+ " d" + ListsHelper.textFormatDecimal(deviceInfo.getChannelCounts()) +
+ " p" + ListsHelper.textFormatDecimal(attribs.mChannelCounts) + "\n");
}
// Encodings
if (deviceInfo.getEncodings().length == 0) {
sb.append("Input - No Peripheral Encodings\n");
} else if (!ListsHelper.isSubset(deviceInfo.getEncodings(), attribs.mEncodings)) {
- sb.append("Input - Encodings Mismatch\n");
+ sb.append("Input - Encodings Mismatch" +
+ " d" + ListsHelper.textFormatHex(deviceInfo.getEncodings()) +
+ " p" + ListsHelper.textFormatHex(attribs.mEncodings) + "\n");
}
// Sample Rates
if (deviceInfo.getSampleRates().length == 0) {
sb.append("Input - No Peripheral Sample Rates\n");
} else if (!ListsHelper.isSubset(deviceInfo.getSampleRates(), attribs.mSampleRates)) {
- sb.append("Input - Sample Rates Mismatch\n");
+ sb.append("Input - Sample Rates Mismatch" +
+ " d" + ListsHelper.textFormatDecimal(deviceInfo.getSampleRates()) +
+ " p" + ListsHelper.textFormatDecimal(attribs.mSampleRates) + "\n");
}
// Channel Masks
@@ -152,11 +168,15 @@
} else {
if (!ListsHelper.isSubset(deviceInfo.getChannelIndexMasks(),
attribs.mChannelIndexMasks)) {
- sb.append("Input - Channel Index Masks Mismatch\n");
+ sb.append("Input - Channel Index Masks Mismatch" +
+ " d" + ListsHelper.textFormatHex(deviceInfo.getChannelIndexMasks()) +
+ " p" + ListsHelper.textFormatHex(attribs.mChannelIndexMasks) + "\n");
}
if (!ListsHelper.isSubset(deviceInfo.getChannelMasks(),
attribs.mChannelPositionMasks)) {
- sb.append("Input - Channel Position Masks Mismatch\n");
+ sb.append("Input - Channel Position Masks Mismatch" +
+ " d" + ListsHelper.textFormatHex(deviceInfo.getChannelMasks()) +
+ " p" + ListsHelper.textFormatHex(attribs.mChannelPositionMasks) + "\n");
}
}
if (sb.toString().length() == 0){
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ListsHelper.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ListsHelper.java
index 97822d0..565826e 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ListsHelper.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ListsHelper.java
@@ -60,4 +60,30 @@
return true;
}
+
+ static public String textFormatHex(int[] list) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("[");
+ for (int index = 0; index < list.length; index++) {
+ sb.append("0x" + Integer.toHexString(list[index]));
+ if (index < list.length-1) {
+ sb.append(", ");
+ }
+ }
+ sb.append("]");
+ return sb.toString();
+ }
+
+ static public String textFormatDecimal(int[] list) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("[");
+ for (int index = 0; index < list.length; index++) {
+ sb.append("0x" + list[index]);
+ if (index < list.length-1) {
+ sb.append(", ");
+ }
+ }
+ sb.append("]");
+ return sb.toString();
+ }
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ProfileManager.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ProfileManager.java
index 97fdf05..514d4b2 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ProfileManager.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ProfileManager.java
@@ -49,31 +49,31 @@
"<ProfileList Version=\"1.0.0\">" +
"<PeripheralProfile ProfileName=\"AudioBox USB 96\" ProfileDescription=\"PreSonus AudioBox USB 96\" ProductName=\"USB-Audio - AudioBox USB 96\">" +
"<OutputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\"/>" +
- "<InputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\"/>" +
+ "<InputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"1,3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\"/>" +
"</PeripheralProfile>" +
- "<PeripheralProfile ProfileName=\"Audio Interface\" ProfileDescription=\"Presonus AudioVox 44VSL\" ProductName=\"USB-Audio - AudioBox 44 VSL\">" +
- "<OutputDevInfo ChanCounts=\"2,4\" ChanPosMasks=\"12\" ChanIndexMasks=\"15\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
- "<InputDevInfo ChanCounts=\"1,2,4\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"15\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
+ "<PeripheralProfile ProfileName=\"AudioBox 44VSL\" ProfileDescription=\"Presonus AudioBox 44VSL\" ProductName=\"USB-Audio - AudioBox 44 VSL\">" +
+ "<OutputDevInfo ChanCounts=\"2,3,4\" ChanPosMasks=\"12\" ChanIndexMasks=\"3,7,15\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
+ "<InputDevInfo ChanCounts=\"1,2,3,4\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"1,3,7,15\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
"</PeripheralProfile>" +
"<PeripheralProfile ProfileName=\"AudioBox 22VSL\" ProfileDescription=\"Presonus AudioBox 22VSL\" ProductName=\"USB-Audio - AudioBox 22 VSL\">" +
"<OutputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
- "<InputDevInfo ChanCounts=\"1,2\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
+ "<InputDevInfo ChanCounts=\"1,2\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"1,3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
"</PeripheralProfile>" +
"<PeripheralProfile ProfileName=\"AudioBox USB\" ProfileDescription=\"Presonus AudioBox USB\" ProductName=\"USB-Audio - AudioBox USB\">" +
"<OutputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"44100,48000\" />" +
- "<InputDevInfo ChanCounts=\"1,2\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"44100,48000\" />" +
+ "<InputDevInfo ChanCounts=\"1,2\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"1,3\" Encodings=\"4\" SampleRates=\"44100,48000\" />" +
"</PeripheralProfile>" +
"<PeripheralProfile ProfileName=\"Focusrite 2i4\" ProfileDescription=\"Focusrite Scarlett 2i4\" ProductName=\"USB-Audio - Scarlett 2i4 USB\">" +
"<OutputDevInfo ChanCounts=\"2,3,4\" ChanPosMasks=\"12\" ChanIndexMasks=\"3,7,15\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\"/>" +
- "<InputDevInfo ChanCounts=\"1,2\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\"/>" +
+ "<InputDevInfo ChanCounts=\"1,2\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"1,3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\"/>" +
"</PeripheralProfile>" +
"<PeripheralProfile ProfileName=\"Behringer UMC204HD\" ProfileDescription=\"Behringer UMC204HD\" ProductName=\"USB-Audio - UMC204HD 192k\">" +
"<OutputDevInfo ChanCounts=\"2,4\" ChanPosMasks=\"12\" ChanIndexMasks=\"15\" Encodings=\"2,4\" SampleRates=\"44100,48000,88200,96000,176400,192000\"/>" +
- "<InputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000,176400,192000\"/>" +
+ "<InputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"1,3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000,176400,192000\"/>" +
"</PeripheralProfile>" +
"<PeripheralProfile ProfileName=\"Roland Rubix24\" ProfileDescription=\"Roland Rubix24\" ProductName=\"USB-Audio - Rubix24\">" +
"<OutputDevInfo ChanCounts=\"2,4\" ChanPosMasks=\"12\" ChanIndexMasks=\"15\" Encodings=\"4\" SampleRates=\"44100,48000,96000,192000\"/>" +
- "<InputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"44100,48000,96000,192000\"/>" +
+ "<InputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"1,3\" Encodings=\"4\" SampleRates=\"44100,48000,96000,192000\"/>" +
"</PeripheralProfile>" +
"<PeripheralProfile ProfileName=\"Pixel USB-C Dongle + Wired Analog Headset\" ProfileDescription=\"Reference USB Dongle\" ProductName=\"USB-Audio - USB-C to 3.5mm-Headphone Adapte\">" +
"<OutputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"48000\" />" +