From adf84c03b8f9435998ac6d4e4b1a3d405e974ab1 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Wed, 3 Nov 2021 20:15:36 +0000 Subject: [PATCH] audio: Fix handling of dynamic profiles in VtsHalAudioV7_0TargetTest The profiles generator wasn't loading correctly from the Audio Policy Manager config file profiles with unpopulated attributes, which is typical for dynamic profiles. Bug: 204314749 Test: atest HalAudioV7_0GeneratorTest Change-Id: I514a4e03da165cacb5dbaaa16470130895681484 --- .../vts/functional/7.0/Generators.cpp | 6 + .../all-versions/vts/functional/Android.bp | 1 + .../tests/HalAudioV7_0GeneratorTest.xml | 1 + .../tests/apm_config_b_204314749_7_0.xml | 263 ++++++++++++++++++ .../vts/functional/tests/generators_tests.cpp | 8 +- 5 files changed, 278 insertions(+), 1 deletion(-) create mode 100644 audio/core/all-versions/vts/functional/tests/apm_config_b_204314749_7_0.xml diff --git a/audio/core/all-versions/vts/functional/7.0/Generators.cpp b/audio/core/all-versions/vts/functional/7.0/Generators.cpp index d2ba3397af..8c92cbd161 100644 --- a/audio/core/all-versions/vts/functional/7.0/Generators.cpp +++ b/audio/core/all-versions/vts/functional/7.0/Generators.cpp @@ -102,6 +102,9 @@ std::vector generateOutputDeviceConfigParameters(bool one if (mixPort.getRole() != xsd::Role::source) continue; // not an output profile auto [flags, isOffload] = generateOutFlags(mixPort); for (const auto& profile : mixPort.getProfile()) { + if (!profile.hasFormat() || !profile.hasSamplingRates() || + !profile.hasChannelMasks()) + continue; auto configs = combineAudioConfig(profile.getChannelMasks(), profile.getSamplingRates(), profile.getFormat()); for (auto& config : configs) { @@ -231,6 +234,9 @@ std::vector generateInputDeviceConfigParameters(bool oneP std::back_inserter(flags), [](auto flag) { return toString(flag); }); } for (const auto& profile : mixPort.getProfile()) { + if (!profile.hasFormat() || !profile.hasSamplingRates() || + !profile.hasChannelMasks()) + continue; auto configs = combineAudioConfig(profile.getChannelMasks(), profile.getSamplingRates(), profile.getFormat()); for (const auto& config : configs) { diff --git a/audio/core/all-versions/vts/functional/Android.bp b/audio/core/all-versions/vts/functional/Android.bp index e446a7f2cf..c576060b2e 100644 --- a/audio/core/all-versions/vts/functional/Android.bp +++ b/audio/core/all-versions/vts/functional/Android.bp @@ -239,6 +239,7 @@ cc_test { data: [ "tests/apm_config_no_vx_7_0.xml", "tests/apm_config_with_vx_7_0.xml", + "tests/apm_config_b_204314749_7_0.xml", ], test_config: "tests/HalAudioV7_0GeneratorTest.xml", } diff --git a/audio/core/all-versions/vts/functional/tests/HalAudioV7_0GeneratorTest.xml b/audio/core/all-versions/vts/functional/tests/HalAudioV7_0GeneratorTest.xml index 2e794554c8..3dc5b33e40 100644 --- a/audio/core/all-versions/vts/functional/tests/HalAudioV7_0GeneratorTest.xml +++ b/audio/core/all-versions/vts/functional/tests/HalAudioV7_0GeneratorTest.xml @@ -24,6 +24,7 @@