Merge "Support passing entire effect_param_t as vendor extension" am: afb60c5bb1 am: 1831d7794b

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2640842

Change-Id: If67ba330afbe02ebd34b01b97711891110f891c2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Shunkai Yao
2023-06-30 02:00:07 +00:00
committed by Automerger Merge Worker
3 changed files with 20 additions and 14 deletions

View File

@@ -18,6 +18,7 @@
#include <string> #include <string>
#define LOG_TAG "AHAL_EffectConfig" #define LOG_TAG "AHAL_EffectConfig"
#include <android-base/logging.h> #include <android-base/logging.h>
#include <system/audio_aidl_utils.h>
#include <system/audio_effects/audio_effects_conf.h> #include <system/audio_effects/audio_effects_conf.h>
#include <system/audio_effects/effect_uuid.h> #include <system/audio_effects/effect_uuid.h>
@@ -162,7 +163,7 @@ bool EffectConfig::parseLibraryUuid(const tinyxml2::XMLElement& xml,
RETURN_VALUE_IF((libraryUuid.uuid == getEffectUuidZero()), false, "invalidUuidAttribute"); RETURN_VALUE_IF((libraryUuid.uuid == getEffectUuidZero()), false, "invalidUuidAttribute");
LOG(DEBUG) << __func__ << (isProxy ? " proxy " : libraryUuid.name) << " : " LOG(DEBUG) << __func__ << (isProxy ? " proxy " : libraryUuid.name) << " : "
<< libraryUuid.uuid.toString(); << ::android::audio::utils::toString(libraryUuid.uuid);
return true; return true;
} }
@@ -250,6 +251,7 @@ bool EffectConfig::findUuid(const std::string& xmlEffectName, AudioUuid* uuid) {
V("downmix", Downmix) \ V("downmix", Downmix) \
V("dynamics_processing", DynamicsProcessing) \ V("dynamics_processing", DynamicsProcessing) \
V("equalizer", Equalizer) \ V("equalizer", Equalizer) \
V("extensioneffect", Extension) \
V("haptic_generator", HapticGenerator) \ V("haptic_generator", HapticGenerator) \
V("loudness_enhancer", LoudnessEnhancer) \ V("loudness_enhancer", LoudnessEnhancer) \
V("env_reverb", EnvReverb) \ V("env_reverb", EnvReverb) \

View File

@@ -25,6 +25,7 @@
#include <android-base/logging.h> #include <android-base/logging.h>
#include <android/binder_ibinder_platform.h> #include <android/binder_ibinder_platform.h>
#include <system/audio_aidl_utils.h>
#include <system/audio_effects/effect_uuid.h> #include <system/audio_effects/effect_uuid.h>
#include <system/thread_defs.h> #include <system/thread_defs.h>
@@ -47,7 +48,7 @@ Factory::~Factory() {
for (const auto& it : mEffectMap) { for (const auto& it : mEffectMap) {
if (auto spEffect = it.first.lock()) { if (auto spEffect = it.first.lock()) {
LOG(ERROR) << __func__ << " erase remaining instance UUID " LOG(ERROR) << __func__ << " erase remaining instance UUID "
<< it.second.first.toString(); << ::android::audio::utils::toString(it.second.first);
destroyEffectImpl(spEffect); destroyEffectImpl(spEffect);
} }
} }
@@ -123,7 +124,7 @@ ndk::ScopedAStatus Factory::queryProcessing(const std::optional<Processing::Type
ndk::ScopedAStatus Factory::createEffect(const AudioUuid& in_impl_uuid, ndk::ScopedAStatus Factory::createEffect(const AudioUuid& in_impl_uuid,
std::shared_ptr<IEffect>* _aidl_return) { std::shared_ptr<IEffect>* _aidl_return) {
LOG(DEBUG) << __func__ << ": UUID " << in_impl_uuid.toString(); LOG(DEBUG) << __func__ << ": UUID " << ::android::audio::utils::toString(in_impl_uuid);
if (mEffectLibMap.count(in_impl_uuid)) { if (mEffectLibMap.count(in_impl_uuid)) {
auto& entry = mEffectLibMap[in_impl_uuid]; auto& entry = mEffectLibMap[in_impl_uuid];
getDlSyms(entry); getDlSyms(entry);
@@ -163,7 +164,8 @@ ndk::ScopedAStatus Factory::destroyEffectImpl(const std::shared_ptr<IEffect>& in
"dlNulldestroyEffectFunc"); "dlNulldestroyEffectFunc");
RETURN_IF_BINDER_EXCEPTION(interface->destroyEffectFunc(in_handle)); RETURN_IF_BINDER_EXCEPTION(interface->destroyEffectFunc(in_handle));
} else { } else {
LOG(ERROR) << __func__ << ": UUID " << uuid.toString() << " does not exist in libMap!"; LOG(ERROR) << __func__ << ": UUID " << ::android::audio::utils::toString(uuid)
<< " does not exist in libMap!";
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
} }
mEffectMap.erase(effectIt); mEffectMap.erase(effectIt);
@@ -207,8 +209,8 @@ bool Factory::openEffectLibrary(const AudioUuid& impl, const std::string& path)
return false; return false;
} }
LOG(INFO) << __func__ << " dlopen lib:" << path << "\nimpl:" << impl.toString() LOG(INFO) << __func__ << " dlopen lib:" << path
<< "\nhandle:" << libHandle; << "\nimpl:" << ::android::audio::utils::toString(impl) << "\nhandle:" << libHandle;
auto interface = new effect_dl_interface_s{nullptr, nullptr, nullptr}; auto interface = new effect_dl_interface_s{nullptr, nullptr, nullptr};
mEffectLibMap.insert( mEffectLibMap.insert(
{impl, {impl,
@@ -228,8 +230,10 @@ void Factory::createIdentityWithConfig(const EffectConfig::LibraryUuid& configLi
id.uuid = configLib.uuid; id.uuid = configLib.uuid;
id.proxy = proxyUuid; id.proxy = proxyUuid;
LOG(DEBUG) << __func__ << " loading lib " << path->second << ": typeUuid " LOG(DEBUG) << __func__ << " loading lib " << path->second << ": typeUuid "
<< id.type.toString() << "\nimplUuid " << id.uuid.toString() << " proxyUuid " << ::android::audio::utils::toString(id.type) << "\nimplUuid "
<< (proxyUuid.has_value() ? proxyUuid->toString() : "null"); << ::android::audio::utils::toString(id.uuid) << " proxyUuid "
<< (proxyUuid.has_value() ? ::android::audio::utils::toString(proxyUuid.value())
: "null");
if (openEffectLibrary(id.uuid, path->second)) { if (openEffectLibrary(id.uuid, path->second)) {
mIdentitySet.insert(std::move(id)); mIdentitySet.insert(std::move(id));
} }

View File

@@ -30,8 +30,8 @@
using aidl::android::hardware::audio::effect::DefaultExtension; using aidl::android::hardware::audio::effect::DefaultExtension;
using aidl::android::hardware::audio::effect::Descriptor; using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::ExtensionEffect; using aidl::android::hardware::audio::effect::ExtensionEffect;
using aidl::android::hardware::audio::effect::getEffectUuidExtensionImpl; using aidl::android::hardware::audio::effect::getEffectImplUuidExtension;
using aidl::android::hardware::audio::effect::getEffectUuidExtensionType; using aidl::android::hardware::audio::effect::getEffectTypeUuidExtension;
using aidl::android::hardware::audio::effect::IEffect; using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::Range; using aidl::android::hardware::audio::effect::Range;
using aidl::android::hardware::audio::effect::VendorExtension; using aidl::android::hardware::audio::effect::VendorExtension;
@@ -39,7 +39,7 @@ using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
std::shared_ptr<IEffect>* instanceSpp) { std::shared_ptr<IEffect>* instanceSpp) {
if (!in_impl_uuid || *in_impl_uuid != getEffectUuidExtensionImpl()) { if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidExtension()) {
LOG(ERROR) << __func__ << "uuid not supported"; LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT; return EX_ILLEGAL_ARGUMENT;
} }
@@ -54,7 +54,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
} }
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) { extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
if (!in_impl_uuid || *in_impl_uuid != getEffectUuidExtensionImpl()) { if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidExtension()) {
LOG(ERROR) << __func__ << "uuid not supported"; LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT; return EX_ILLEGAL_ARGUMENT;
} }
@@ -67,8 +67,8 @@ namespace aidl::android::hardware::audio::effect {
const std::string ExtensionEffect::kEffectName = "ExtensionEffectExample"; const std::string ExtensionEffect::kEffectName = "ExtensionEffectExample";
const Descriptor ExtensionEffect::kDescriptor = { const Descriptor ExtensionEffect::kDescriptor = {
.common = {.id = {.type = getEffectUuidExtensionType(), .common = {.id = {.type = getEffectTypeUuidExtension(),
.uuid = getEffectUuidExtensionImpl(), .uuid = getEffectImplUuidExtension(),
.proxy = std::nullopt}, .proxy = std::nullopt},
.name = ExtensionEffect::kEffectName, .name = ExtensionEffect::kEffectName,
.implementor = "The Android Open Source Project"}}; .implementor = "The Android Open Source Project"}};