Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b06a492b authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

audio: Preserve 'usecase' for in IModule::setAudioPortConfig

The field AudioPortConfig.ext.mix.usecase is provided by
the client, thus is needs to be treated the same way as
'.handle'.

Bug: 302736184
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I45050e8530cd236f5e582585f583df477fc7ae8a
parent 98aba894
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -1165,9 +1165,12 @@ ndk::ScopedAStatus Module::setAudioPortConfigImpl(
    if (in_requested.ext.getTag() != AudioPortExt::Tag::unspecified) {
        if (in_requested.ext.getTag() == out_suggested->ext.getTag()) {
            if (out_suggested->ext.getTag() == AudioPortExt::Tag::mix) {
                // 'AudioMixPortExt.handle' is set by the client, copy from in_requested
                out_suggested->ext.get<AudioPortExt::Tag::mix>().handle =
                        in_requested.ext.get<AudioPortExt::Tag::mix>().handle;
                // 'AudioMixPortExt.handle' and '.usecase' are set by the client,
                // copy from in_requested.
                const auto& src = in_requested.ext.get<AudioPortExt::Tag::mix>();
                auto& dst = out_suggested->ext.get<AudioPortExt::Tag::mix>();
                dst.handle = src.handle;
                dst.usecase = src.usecase;
            }
        } else {
            LOG(WARNING) << __func__ << ": requested ext tag "