audio: Provide code for parsing surround sound config from XML
The main change is to convert the result of parsing from XSDC
types to AIDL, and add a VTS test for IConfig.getSurroundSoundConfig.
Extra changes:
- add 'Unchecked' suffix to conversion functions that do not
wrap the result into ConversionResult;
- enable more compile-time checks for the default AIDL service,
fix issues found.
Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Icf578b8d28647e6355ed5328599c77d2ca1234f9
diff --git a/audio/aidl/default/Config.cpp b/audio/aidl/default/Config.cpp
index e87af07..d1023da 100644
--- a/audio/aidl/default/Config.cpp
+++ b/audio/aidl/default/Config.cpp
@@ -27,9 +27,16 @@
namespace aidl::android::hardware::audio::core {
ndk::ScopedAStatus Config::getSurroundSoundConfig(SurroundSoundConfig* _aidl_return) {
- SurroundSoundConfig surroundSoundConfig;
- // TODO: parse from XML; for now, use empty config as default
- *_aidl_return = std::move(surroundSoundConfig);
+ static const SurroundSoundConfig surroundSoundConfig = [this]() {
+ SurroundSoundConfig surroundCfg;
+ if (mAudioPolicyConverter.getStatus() == ::android::OK) {
+ surroundCfg = mAudioPolicyConverter.getSurroundSoundConfig();
+ } else {
+ LOG(WARNING) << __func__ << mAudioPolicyConverter.getError();
+ }
+ return surroundCfg;
+ }();
+ *_aidl_return = surroundSoundConfig;
LOG(DEBUG) << __func__ << ": returning " << _aidl_return->toString();
return ndk::ScopedAStatus::ok();
}