diff --git a/audio/aidl/default/XsdcConversion.cpp b/audio/aidl/default/XsdcConversion.cpp index 2feb0c3b8c..9e303471cd 100644 --- a/audio/aidl/default/XsdcConversion.cpp +++ b/audio/aidl/default/XsdcConversion.cpp @@ -141,11 +141,12 @@ ConversionResult createAudioPortExt(const ap_xsd::MixPorts::MixPor } ConversionResult convertGainModeToAidl(const std::vector& gainModeVec) { - static const char gainModeSeparator = ' '; int gainModeMask = 0; for (const ap_xsd::AudioGainMode& gainMode : gainModeVec) { - gainModeMask |= static_cast(::android::GainModeConverter::maskFromString( - ap_xsd::toString(gainMode), &gainModeSeparator)); + audio_gain_mode_t legacyGainMode; + if (::android::GainModeConverter::fromString(ap_xsd::toString(gainMode), legacyGainMode)) { + gainModeMask |= static_cast(legacyGainMode); + } } return gainModeMask; } @@ -204,22 +205,25 @@ ConversionResult convertAudioProfileToAidl(const ap_xsd::Profile& ConversionResult convertIoFlagsToAidl( const std::vector& flags, const ap_xsd::Role role, bool flagsForMixPort) { - static const char flagSeparator = ' '; int flagMask = 0; if ((role == ap_xsd::Role::sink && flagsForMixPort) || (role == ap_xsd::Role::source && !flagsForMixPort)) { for (const ap_xsd::AudioInOutFlag& flag : flags) { - flagMask |= static_cast(::android::InputFlagConverter::maskFromString( - ap_xsd::toString(flag), &flagSeparator)); + audio_input_flags_t legacyFlag; + if (::android::InputFlagConverter::fromString(ap_xsd::toString(flag), legacyFlag)) { + flagMask |= static_cast(legacyFlag); + } } return AudioIoFlags::make(flagMask); } else { for (const ap_xsd::AudioInOutFlag& flag : flags) { - flagMask |= static_cast(::android::OutputFlagConverter::maskFromString( - ap_xsd::toString(flag), &flagSeparator)); + audio_output_flags_t legacyFlag; + if (::android::OutputFlagConverter::fromString(ap_xsd::toString(flag), legacyFlag)) { + flagMask |= static_cast(legacyFlag); + } } + return AudioIoFlags::make(flagMask); } - return AudioIoFlags::make(flagMask); } ConversionResult convertDevicePortToAidl(