Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a2bf437d authored by Oscar Azucena's avatar Oscar Azucena Committed by Android (Google) Code Review
Browse files

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
parents 54cfa4f8 3caebd9b
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -645,11 +645,9 @@ bool parseVolumeActivationType(const xsd::ActivationType& xsdType,
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;
    }
+11 −4
Original line number Diff line number Diff line
@@ -149,7 +149,9 @@ bool hasValidAudioRoute(const DeviceToContextEntry& entry, std::string& message,
        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 @@ bool hadValidAudioFadeConfiguration(const AudioFadeConfiguration& fadeConfigurat

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 @@ void validateVolumeGroupInfo(const AudioZoneConfig& audioZoneConfig,
        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 @@ void validateAudioZoneConfiguration(const AudioZone& carAudioZone,
    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 @@ void validateAudioZoneConfiguration(const AudioZone& carAudioZone,
                    << "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;