From 4e9c4061ca9a925c4fd5fcaa9ff3ee88776d957d Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Fri, 8 Nov 2019 15:15:09 -0800 Subject: [PATCH] audio vts: Remove explicit dependency on the new types Avoid using the new ChannelMaskSet and SampleRateSet types directly to simplify upstreaming. Bug: 141989952 Bug: 141847510 Test: atest VtsHalAudioV5_0TargetTest Change-Id: I4477334be0375a95d79324a3ab38b03eb3f9998f --- .../functional/6.0/AudioPrimaryHidlHalTest.cpp | 18 ++++++++++++------ .../all-versions/vts/functional/ConfigHelper.h | 4 ++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/audio/core/all-versions/vts/functional/6.0/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/6.0/AudioPrimaryHidlHalTest.cpp index c56445cc9e..30f8a7ade7 100644 --- a/audio/core/all-versions/vts/functional/6.0/AudioPrimaryHidlHalTest.cpp +++ b/audio/core/all-versions/vts/functional/6.0/AudioPrimaryHidlHalTest.cpp @@ -73,9 +73,12 @@ const std::vector& getOutputDeviceConfigParameters() { getCachedPolicyConfig().getModuleFromName(std::get(device)); for (const auto& ioProfile : module->getOutputProfiles()) { for (const auto& profile : ioProfile->getAudioProfiles()) { - auto configs = ConfigHelper::combineAudioConfig(profile->getChannels(), - profile->getSampleRates(), - profile->getFormat()); + const auto& channels = profile->getChannels(); + const auto& sampleRates = profile->getSampleRates(); + auto configs = ConfigHelper::combineAudioConfig( + vector(channels.begin(), channels.end()), + vector(sampleRates.begin(), sampleRates.end()), + profile->getFormat()); auto flags = ioProfile->getFlags(); for (auto& config : configs) { // Some combinations of flags declared in the config file require special @@ -125,9 +128,12 @@ const std::vector& getInputDeviceConfigParameters() { getCachedPolicyConfig().getModuleFromName(std::get(device)); for (const auto& ioProfile : module->getInputProfiles()) { for (const auto& profile : ioProfile->getAudioProfiles()) { - auto configs = ConfigHelper::combineAudioConfig(profile->getChannels(), - profile->getSampleRates(), - profile->getFormat()); + const auto& channels = profile->getChannels(); + const auto& sampleRates = profile->getSampleRates(); + auto configs = ConfigHelper::combineAudioConfig( + vector(channels.begin(), channels.end()), + vector(sampleRates.begin(), sampleRates.end()), + profile->getFormat()); for (const auto& config : configs) { result.emplace_back(device, config, AudioInputFlag(ioProfile->getFlags())); } diff --git a/audio/core/all-versions/vts/functional/ConfigHelper.h b/audio/core/all-versions/vts/functional/ConfigHelper.h index 604c0c50e6..48aae8c5b3 100644 --- a/audio/core/all-versions/vts/functional/ConfigHelper.h +++ b/audio/core/all-versions/vts/functional/ConfigHelper.h @@ -79,8 +79,8 @@ struct ConfigHelper { return {}; } - static vector combineAudioConfig(android::ChannelMaskSet channelMasks, - android::SampleRateSet sampleRates, + static vector combineAudioConfig(vector channelMasks, + vector sampleRates, audio_format_t format) { vector configs; configs.reserve(channelMasks.size() * sampleRates.size());