audio: Fix update of an existing patch

The code for updating the existing patch did not modify
the patch stored in the module's list of patches.

Added a test which switches the patch to another port
config and validates that 'Module.getAudioPatches' returns
the updated patch.

Bug: 302573756
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I0e3412b9387cd451436a48af116dc5a940d868cf
This commit is contained in:
Mikhail Naganov
2023-09-29 15:49:35 -07:00
parent 87e6b60eb3
commit dc41773ba3
2 changed files with 55 additions and 2 deletions

View File

@@ -515,7 +515,7 @@ ndk::ScopedAStatus Module::connectExternalDevice(const AudioPort& in_templateIdA
}
}
connectedPort.id = ++getConfig().nextPortId;
connectedPort.id = getConfig().nextPortId++;
auto [connectedPortsIt, _] =
mConnectedDevicePorts.insert(std::pair(connectedPort.id, std::set<int32_t>()));
LOG(DEBUG) << __func__ << ": template port " << templateId << " external device connected, "
@@ -865,6 +865,7 @@ ndk::ScopedAStatus Module::setAudioPatch(const AudioPatch& in_requested, AudioPa
patches.push_back(*_aidl_return);
} else {
oldPatch = *existing;
*existing = *_aidl_return;
}
patchesBackup = mPatches;
registerPatch(*_aidl_return);