Fix audio control device to context test
Added a fix to check if the audio device repeats since the original
change did not correctly add the context to the already set volume
group contexts list.
Bug: 359686069
Test: atest VtsAidlHalAudioControlTest
Flag: EXEMPT HAL interface
Change-Id: Iee3751349d6609c93e383c2b83fc8525e8335cac
diff --git a/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp b/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp
index 6e646a6..c01c0d6 100644
--- a/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp
+++ b/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp
@@ -125,11 +125,12 @@
}
std::set<std::string> contextInRoute;
for (const auto& context : entry.contextNames) {
- if (!contextInRoute.contains(ToString(context))) {
- continue;
+ std::string contextString = ToString(context);
+ if (contextInRoute.contains(contextString)) {
+ message = " Context " + contextString + " repeats for DeviceToContextEntry";
+ return false;
}
- message = " Context can not repeat for the same DeviceToContextEntry";
- return false;
+ groupDevices.insert(contextString);
}
audiomediacommon::AudioDeviceDescription description;
if (!testutils::getAudioPortDeviceDescriptor(entry.device, description)) {