AIDL effect: Add Equalizer parameters implementation and vts
Bug: 238913361
Test: atest VtsHalAudioEffectTargetTest
atest VtsHalAudioEffectFactoryTargetTest
atest VtsHalEqualizerTargetTest
Change-Id: I94b2283ca2aa0e45715e1c9ac3ea6ad809ec2a2c
diff --git a/audio/aidl/vts/EffectFactoryHelper.h b/audio/aidl/vts/EffectFactoryHelper.h
index cf94e58..63efae0 100644
--- a/audio/aidl/vts/EffectFactoryHelper.h
+++ b/audio/aidl/vts/EffectFactoryHelper.h
@@ -24,13 +24,14 @@
#include <android/binder_auto_utils.h>
#include "TestUtils.h"
+#include "effect-impl/EffectUUID.h"
using namespace android;
using aidl::android::hardware::audio::effect::Descriptor;
+using aidl::android::hardware::audio::effect::EffectNullUuid;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
-using aidl::android::hardware::audio::effect::Parameter;
using aidl::android::hardware::audio::effect::Processing;
using aidl::android::media::audio::common::AudioUuid;
@@ -69,7 +70,6 @@
}
void CreateEffects() {
- ASSERT_NE(mEffectFactory, nullptr);
for (const auto& id : mIds) {
std::shared_ptr<IEffect> effect;
EXPECT_IS_OK(mEffectFactory->createEffect(id.uuid, &effect));
@@ -80,6 +80,26 @@
}
}
+ void QueryAndCreateEffects(const AudioUuid& type = EffectNullUuid) {
+ std::vector<Descriptor::Identity> ids;
+ ASSERT_NE(mEffectFactory, nullptr);
+
+ if (type == EffectNullUuid) {
+ EXPECT_IS_OK(mEffectFactory->queryEffects(std::nullopt, std::nullopt, &ids));
+ } else {
+ EXPECT_IS_OK(mEffectFactory->queryEffects(type, std::nullopt, &ids));
+ }
+ for (const auto& id : ids) {
+ ASSERT_EQ(id.type, type);
+ std::shared_ptr<IEffect> effect;
+ EXPECT_IS_OK(mEffectFactory->createEffect(id.uuid, &effect));
+ EXPECT_NE(effect, nullptr) << id.toString();
+ if (effect) {
+ mEffectIdMap[effect] = id;
+ }
+ }
+ }
+
void CreateEffectsAndExpect(
const std::vector<std::pair<Descriptor::Identity, binder_exception_t>>& uuid_status) {
ASSERT_NE(mEffectFactory, nullptr);
@@ -126,8 +146,10 @@
std::shared_ptr<IFactory> GetFactory() { return mEffectFactory; }
const std::vector<Descriptor::Identity>& GetEffectIds() { return mIds; }
- const std::vector<Descriptor::Identity>& GetCompleteEffectIdList() { return mCompleteIds; }
- const std::map<std::shared_ptr<IEffect>, Descriptor::Identity>& GetEffectMap() {
+ const std::vector<Descriptor::Identity>& GetCompleteEffectIdList() const {
+ return mCompleteIds;
+ }
+ const std::map<std::shared_ptr<IEffect>, Descriptor::Identity>& GetEffectMap() const {
return mEffectIdMap;
}
void ClearEffectMap() { mEffectIdMap.clear(); }