Fix matching device address using audio attributes.

The previous code works only with an assumption there's single tag
present (implicitly added one with device address).

Test: atest AudioServiceHostTest AudioHostTest AudioPolicyHostTest
Test: atest audiosystem_tests audiopolicy_tests
Bug: 244713292
Change-Id: I9a7241521fd7d9246275d1e4d77f6c3b06301163
diff --git a/services/audiopolicy/tests/audiopolicymanager_tests.cpp b/services/audiopolicy/tests/audiopolicymanager_tests.cpp
index e1bf414..ba5b6b2 100644
--- a/services/audiopolicy/tests/audiopolicymanager_tests.cpp
+++ b/services/audiopolicy/tests/audiopolicymanager_tests.cpp
@@ -1554,7 +1554,16 @@
             .withTags("addr=remote_submix_media"),
         DPTestParam(USAGE_MEDIA_ALARM_CRITERIA, /*expected_match=*/ true)
             .withUsage(AUDIO_USAGE_ASSISTANT)
-            .withTags("addr=remote_submix_media")));
+            .withTags("addr=remote_submix_media"),
+        DPTestParam(USAGE_MEDIA_ALARM_CRITERIA, /*expected_match=*/ true)
+            .withUsage(AUDIO_USAGE_ASSISTANT)
+            .withTags("sometag;addr=remote_submix_media;othertag=somevalue"),
+        DPTestParam(USAGE_MEDIA_ALARM_CRITERIA, /*expected_match=*/ true)
+            .withUsage(AUDIO_USAGE_ASSISTANT)
+            .withTags("addr=remote_submix_media;othertag"),
+        DPTestParam(USAGE_MEDIA_ALARM_CRITERIA, /*expected_match=*/ true)
+            .withUsage(AUDIO_USAGE_ASSISTANT)
+            .withTags("sometag;othertag;addr=remote_submix_media")));
 
 static constexpr audio_session_t TEST_SESSION_ID = static_cast<audio_session_t>(42);
 static constexpr audio_session_t OTHER_SESSION_ID = static_cast<audio_session_t>(77);