diff options
author | Mikhail Naganov <mnaganov@google.com> | 2020-12-17 15:01:54 -0800 |
---|---|---|
committer | Mikhail Naganov <mnaganov@google.com> | 2021-01-07 10:32:06 -0800 |
commit | 3f1457b9537b1ff23704e17be7588dadf1e2884e (patch) | |
tree | 82878ed14f6c3b93734a211ffbaa75c5fd0aad32 /audio/core/all-versions/default/Stream.cpp | |
parent | daedb0dc2e582d6db90793045759a7acef6f1096 (diff) |
Audio: Add VTS tests for invalid enum-strings, Part 1
Add tests that try passing invalid enum-string values to HAL
methods taking enum-strings. Fix issues found in the default
wrapper.
Interface updates:
- Update AudioConfig structure to indicate whether
AudioOffloadInfo is specified.
- Add return value to IStreamIn.updateSinkMetadata
and IStreamOut.updateSourceMetadata to provide indication
of invalid arguments.
- Specify the behavior of IDevice.open{Input|Output}Stream
in the case of invalid arguments vs. rejected config.
Bug: 142480271
Test: atest VtsHalAudioV6_0TargetTest
Test: atest VtsHalAudioV7_0TargetTest
with side-loaded V7 default wrapper
Change-Id: I6bd7be3869cc7a8d5d00506565bbf0b3a050b630
Diffstat (limited to 'audio/core/all-versions/default/Stream.cpp')
-rw-r--r-- | audio/core/all-versions/default/Stream.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/audio/core/all-versions/default/Stream.cpp b/audio/core/all-versions/default/Stream.cpp index c74079d9ce..f964cbb804 100644 --- a/audio/core/all-versions/default/Stream.cpp +++ b/audio/core/all-versions/default/Stream.cpp @@ -17,6 +17,7 @@ #define LOG_TAG "StreamHAL" #include "core/default/Stream.h" +#include "common/all-versions/HidlSupport.h" #include "common/all-versions/default/EffectMap.h" #include "core/default/Conversions.h" #include "core/default/Util.h" @@ -37,6 +38,7 @@ namespace CPP_VERSION { namespace implementation { using ::android::hardware::audio::common::CPP_VERSION::implementation::HidlUtils; +using ::android::hardware::audio::common::utils::splitString; Stream::Stream(bool isInput, audio_stream_t* stream) : mIsInput(isInput), mStream(stream) { (void)mIsInput; // prevent 'unused field' warnings in pre-V7 versions. @@ -220,7 +222,7 @@ Return<void> Stream::getSupportedProfiles(getSupportedProfiles_cb _hidl_cb) { // Ensure that the separator is one character, despite that it's defined as a C string. static_assert(sizeof(AUDIO_PARAMETER_VALUE_LIST_SEPARATOR) == 2); std::vector<std::string> halFormats = - util::splitString(halListValue.string(), AUDIO_PARAMETER_VALUE_LIST_SEPARATOR[0]); + splitString(halListValue.string(), AUDIO_PARAMETER_VALUE_LIST_SEPARATOR[0]); hidl_vec<AudioFormat> formats; (void)HidlUtils::audioFormatsFromHal(halFormats, &formats); std::vector<AudioProfile> tempProfiles; @@ -235,7 +237,7 @@ Return<void> Stream::getSupportedProfiles(getSupportedProfiles_cb _hidl_cb) { result = getParam(AudioParameter::keyStreamSupportedSamplingRates, &halListValue, context); if (result != Result::OK) break; std::vector<std::string> halSampleRates = - util::splitString(halListValue.string(), AUDIO_PARAMETER_VALUE_LIST_SEPARATOR[0]); + splitString(halListValue.string(), AUDIO_PARAMETER_VALUE_LIST_SEPARATOR[0]); hidl_vec<uint32_t> sampleRates; sampleRates.resize(halSampleRates.size()); for (size_t i = 0; i < sampleRates.size(); ++i) { @@ -245,7 +247,7 @@ Return<void> Stream::getSupportedProfiles(getSupportedProfiles_cb _hidl_cb) { result = getParam(AudioParameter::keyStreamSupportedChannels, &halListValue, context); if (result != Result::OK) break; std::vector<std::string> halChannelMasks = - util::splitString(halListValue.string(), AUDIO_PARAMETER_VALUE_LIST_SEPARATOR[0]); + splitString(halListValue.string(), AUDIO_PARAMETER_VALUE_LIST_SEPARATOR[0]); hidl_vec<AudioChannelMask> channelMasks; (void)HidlUtils::audioChannelMasksFromHal(halChannelMasks, &channelMasks); // Create a profile. |