AIDL effect: Add queryProcess in IFactory
Bug: 238913361
Test: atest VtsHalAudioEffectTargetTest; atest VtsHalAudioEffectFactoryTargetTest
Change-Id: I5518ceaa0ea744e30803fc23996e2a2b48398024
diff --git a/audio/aidl/vts/EffectFactoryHelper.h b/audio/aidl/vts/EffectFactoryHelper.h
index 3cbca45..cf94e58 100644
--- a/audio/aidl/vts/EffectFactoryHelper.h
+++ b/audio/aidl/vts/EffectFactoryHelper.h
@@ -31,6 +31,7 @@
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;
class EffectFactoryHelper {
@@ -57,6 +58,16 @@
mIds = *_aidl_return;
}
+ void QueryProcessing(const std::optional<Processing::Type>& in_type,
+ std::vector<Processing>* _aidl_return) {
+ ASSERT_NE(mEffectFactory, nullptr);
+ EXPECT_IS_OK(mEffectFactory->queryProcessing(in_type, _aidl_return));
+ // only update the whole list if no filter applied
+ if (!in_type.has_value()) {
+ mProcesses = *_aidl_return;
+ }
+ }
+
void CreateEffects() {
ASSERT_NE(mEffectFactory, nullptr);
for (const auto& id : mIds) {
@@ -127,6 +138,7 @@
AudioHalBinderServiceUtil binderUtil;
std::vector<Descriptor::Identity> mIds;
std::vector<Descriptor::Identity> mCompleteIds;
+ std::vector<Processing> mProcesses;
std::map<std::shared_ptr<IEffect>, Descriptor::Identity> mEffectIdMap;
};
diff --git a/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp
index dd17a6f..454ce29 100644
--- a/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp
@@ -38,6 +38,7 @@
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::IFactory;
+using aidl::android::hardware::audio::effect::Processing;
using aidl::android::media::audio::common::AudioUuid;
/// Effect factory testing.
@@ -222,6 +223,12 @@
EXPECT_EQ(effectMap.size(), 0UL);
}
+TEST_P(EffectFactoryTest, QueryProcess) {
+ std::vector<Processing> processing;
+ mFactory.QueryProcessing(std::nullopt, &processing);
+ // TODO: verify the number of process in example implementation after audio_effects.xml migrated
+}
+
INSTANTIATE_TEST_SUITE_P(EffectFactoryTest, EffectFactoryTest,
testing::ValuesIn(android::getAidlHalInstanceNames(IFactory::descriptor)),
android::PrintInstanceNameToString);