Revert "audio: Parse module configurations from the APM XML files"

Revert submission 2770886-AidlAudioHalModuleConfig

Reason for revert: Breaks BluetoothInstrumentationTests on main downstream

Reverted changes: /q/submissionid:2770886-AidlAudioHalModuleConfig

Bug: 305291602
Change-Id: I0076c88877943d9498f90c477e78a2be5d390150
This commit is contained in:
Mikhail Naganov
2023-10-13 23:38:25 +00:00
parent 5eea7fb0d7
commit af75a679c9
25 changed files with 412 additions and 795 deletions

View File

@@ -25,7 +25,6 @@
#include <android/binder_ibinder_platform.h>
#include <error/expected_utils.h>
#include "core-impl/Configuration.h"
#include "core-impl/Module.h"
#include "core-impl/ModuleBluetooth.h"
#include "core-impl/ModulePrimary.h"
@@ -133,36 +132,21 @@ bool findAudioProfile(const AudioPort& port, const AudioFormatDescription& forma
} // namespace
// static
std::shared_ptr<Module> Module::createInstance(Type type, std::unique_ptr<Configuration>&& config) {
std::shared_ptr<Module> Module::createInstance(Type type) {
switch (type) {
case Type::DEFAULT:
return ndk::SharedRefBase::make<ModulePrimary>(std::move(config));
return ndk::SharedRefBase::make<ModulePrimary>();
case Type::R_SUBMIX:
return ndk::SharedRefBase::make<ModuleRemoteSubmix>(std::move(config));
return ndk::SharedRefBase::make<ModuleRemoteSubmix>();
case Type::STUB:
return ndk::SharedRefBase::make<ModuleStub>(std::move(config));
return ndk::SharedRefBase::make<ModuleStub>();
case Type::USB:
return ndk::SharedRefBase::make<ModuleUsb>(std::move(config));
return ndk::SharedRefBase::make<ModuleUsb>();
case Type::BLUETOOTH:
return ndk::SharedRefBase::make<ModuleBluetooth>(std::move(config));
return ndk::SharedRefBase::make<ModuleBluetooth>();
}
}
// static
std::optional<Module::Type> Module::typeFromString(const std::string& type) {
if (type == "default")
return Module::Type::DEFAULT;
else if (type == "r_submix")
return Module::Type::R_SUBMIX;
else if (type == "stub")
return Module::Type::STUB;
else if (type == "usb")
return Module::Type::USB;
else if (type == "bluetooth")
return Module::Type::BLUETOOTH;
return {};
}
std::ostream& operator<<(std::ostream& os, Module::Type t) {
switch (t) {
case Module::Type::DEFAULT:
@@ -332,8 +316,26 @@ std::set<int32_t> Module::portIdsFromPortConfigIds(C portConfigIds) {
return result;
}
std::unique_ptr<Module::Configuration> Module::initializeConfig() {
return internal::getConfiguration(getType());
std::unique_ptr<internal::Configuration> Module::initializeConfig() {
std::unique_ptr<internal::Configuration> config;
switch (getType()) {
case Type::DEFAULT:
config = std::move(internal::getPrimaryConfiguration());
break;
case Type::R_SUBMIX:
config = std::move(internal::getRSubmixConfiguration());
break;
case Type::STUB:
config = std::move(internal::getStubConfiguration());
break;
case Type::USB:
config = std::move(internal::getUsbConfiguration());
break;
case Type::BLUETOOTH:
config = std::move(internal::getBluetoothConfiguration());
break;
}
return config;
}
std::vector<AudioRoute*> Module::getAudioRoutesForAudioPortImpl(int32_t portId) {
@@ -348,7 +350,7 @@ std::vector<AudioRoute*> Module::getAudioRoutesForAudioPortImpl(int32_t portId)
return result;
}
Module::Configuration& Module::getConfig() {
internal::Configuration& Module::getConfig() {
if (!mConfig) {
mConfig = std::move(initializeConfig());
}
@@ -795,7 +797,7 @@ ndk::ScopedAStatus Module::openInputStream(const OpenInputStreamArguments& in_ar
context.fillDescriptor(&_aidl_return->desc);
std::shared_ptr<StreamIn> stream;
RETURN_STATUS_IF_ERROR(createInputStream(std::move(context), in_args.sinkMetadata,
getConfig().microphones, &stream));
mConfig->microphones, &stream));
StreamWrapper streamWrapper(stream);
if (auto patchIt = mPatches.find(in_args.portConfigId); patchIt != mPatches.end()) {
RETURN_STATUS_IF_ERROR(