Merge "Fix audio control device to context test" into main
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)) {