Merge changes I682d0133,I81cd1c13 into main

* changes:
  Add volume group addresses check among volume groups
  Add default volume group activation type to volume audio control HAL
diff --git a/automotive/audiocontrol/aidl/default/converter/src/CarAudioConfigurationXmlConverter.cpp b/automotive/audiocontrol/aidl/default/converter/src/CarAudioConfigurationXmlConverter.cpp
index d43b595..206ce0c 100644
--- a/automotive/audiocontrol/aidl/default/converter/src/CarAudioConfigurationXmlConverter.cpp
+++ b/automotive/audiocontrol/aidl/default/converter/src/CarAudioConfigurationXmlConverter.cpp
@@ -645,11 +645,9 @@
 bool parseVolumeGroupActivationEntry(const xsd::ActivationVolumeConfigEntryType& xsdEntry,
                                      api::VolumeActivationConfigurationEntry& entry) {
     if (!xsdEntry.hasInvocationType()) {
-        LOG(ERROR) << __func__ << " Activation config entry missing invocation type";
-        return false;
-    }
-
-    if (!parseVolumeActivationType(xsdEntry.getInvocationType(), entry.type)) {
+        // Legacy file had default invocation type as on playback changed
+        entry.type = api::VolumeInvocationType::ON_PLAYBACK_CHANGED;
+    } else if (!parseVolumeActivationType(xsdEntry.getInvocationType(), entry.type)) {
         LOG(ERROR) << __func__ << " Could not parse configuration entry type";
         return false;
     }
diff --git a/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp b/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp
index c01c0d6..6781a81 100644
--- a/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp
+++ b/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp
@@ -149,7 +149,9 @@
         return false;
     }
     if (groupDevices.contains(address)) {
-        message = " Audio device address can not repeat in the same volume group";
+        message =
+                " Audio device address can not repeat in the same volume group or within audio"
+                " zone configuration if not using configurable audio policy engine";
         return false;
     }
     groupDevices.insert(address);
@@ -196,7 +198,8 @@
 
 void validateVolumeGroupInfo(const AudioZoneConfig& audioZoneConfig,
                              const VolumeGroupConfig& volumeGroupConfig,
-                             const AudioDeviceConfiguration& deviceConfig) {
+                             const AudioDeviceConfiguration& deviceConfig,
+                             std::set<std::string>& groupDevices) {
     std::string zoneConfigName = testutils::toAlphaNumeric(ToString(audioZoneConfig.name));
     std::string volumeGroupName = testutils::toAlphaNumeric(ToString(volumeGroupConfig.name));
     std::string volumeGroupInfo =
@@ -209,7 +212,6 @@
         EXPECT_FALSE(volumeGroupConfig.name.empty())
                 << volumeGroupInfo << " must have a non-empty volume name";
     }
-    std::set<std::string> groupDevices;
     for (const auto& audioRoute : volumeGroupConfig.carAudioRoutes) {
         std::string routeMessage;
         EXPECT_TRUE(hasValidAudioRoute(audioRoute, routeMessage, groupDevices))
@@ -254,6 +256,7 @@
     std::set<std::string> contextInfoNames;
     EXPECT_FALSE(audioZoneConfig.volumeGroups.empty())
             << "Volume groups for zone config " << zoneConfigName.c_str();
+    std::set<std::string> groupDevices;
     for (const auto& volumeGroup : audioZoneConfig.volumeGroups) {
         ALOGI("Zone config name %s volume group test %s", zoneConfigName.c_str(),
               ToString(volumeGroup.name).c_str());
@@ -264,7 +267,11 @@
                     << "Context " << context << " repeats in zone config " << zoneConfigName;
             contextInfoNames.insert(context);
         }
-        validateVolumeGroupInfo(audioZoneConfig, volumeGroup, deviceConfig);
+        // Configurable audio policy engine can share devices among volume groups
+        if (deviceConfig.routingConfig == CONFIGURABLE_AUDIO_ENGINE_ROUTING) {
+            groupDevices.clear();
+        }
+        validateVolumeGroupInfo(audioZoneConfig, volumeGroup, deviceConfig, groupDevices);
     }
     const auto& audioZoneContexts = carAudioZone.audioZoneContext.audioContextInfos;
     std::map<std::string, AudioZoneContextInfo> infoNameToInfo;