audio: Add fields belonged to APM XSD schema to HAL structs
Since APM XML configuration is being replaced with data
provided by the HAL, add data fields used to be in the APM XSD
schema to HAL structures. Summary of changes:
- Audio*Flags enum types moved to HAL types because flags
are specified for mixPorts in the APM config;
- AudioGainSys.useForVolume -> AudioGain
- added AudioPort.flags because they are specified in the
APM config for mixPorts; since AudioIoFlags is a union,
it will be used for determining the mix port role;
- AudioPortConfigSys.flags -> AudioPortConfig
this is for symmetry with AudioPort;
In C++:
- DeviceDescriptor.mEncodedFormats -> DeviceDescriptorBase
- IOProfile.max{Open|Active}Count -> AudioPort
- IOProfile.recommendedMuteDurationMs -> AudioPort
Flags are not moved out from PolicyAudioPort to AudioPort as it's
a non-trivial change.
Bug: 198812639
Test: atest audiofoundation_parcelable_test
Test: atest audiopolicy_tests
Change-Id: I7aca107f7e7f20c6cd97080327cb9e4589cbe544
diff --git a/media/libaudiofoundation/AudioGain.cpp b/media/libaudiofoundation/AudioGain.cpp
index 1a8fbf0..47e0edb 100644
--- a/media/libaudiofoundation/AudioGain.cpp
+++ b/media/libaudiofoundation/AudioGain.cpp
@@ -122,20 +122,20 @@
ConversionResult<AudioGain::Aidl> AudioGain::toParcelable() const {
media::audio::common::AudioGain aidl = VALUE_OR_RETURN(
legacy2aidl_audio_gain_AudioGain(mGain, mIsInput));
+ aidl.useForVolume = mUseForVolume;
media::AudioGainSys aidlSys;
aidlSys.index = VALUE_OR_RETURN(convertIntegral<int32_t>(mIndex));
aidlSys.isInput = mIsInput;
- aidlSys.useForVolume = mUseForVolume;
return std::make_pair(aidl, aidlSys);
}
ConversionResult<sp<AudioGain>> AudioGain::fromParcelable(const AudioGain::Aidl& aidl) {
+ const media::audio::common::AudioGain& hal = aidl.first;
const media::AudioGainSys& sys = aidl.second;
auto index = VALUE_OR_RETURN(convertIntegral<int>(sys.index));
sp<AudioGain> legacy = sp<AudioGain>::make(index, sys.isInput);
- legacy->mGain = VALUE_OR_RETURN(
- aidl2legacy_AudioGain_audio_gain(aidl.first, sys.isInput));
- legacy->mUseForVolume = sys.useForVolume;
+ legacy->mGain = VALUE_OR_RETURN(aidl2legacy_AudioGain_audio_gain(hal, sys.isInput));
+ legacy->mUseForVolume = hal.useForVolume;
return legacy;
}