From 910a8153b2b667d7bcdc504992c16b2c08b68c28 Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Thu, 1 Feb 2024 23:11:28 +0000 Subject: [PATCH] Effect: verify all AIDL IEffect versions are same as IFactory Bug: 322780092 Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit Change-Id: If47f70b9d8f72a45f3ecf927294fb93fda28851b --- .../VtsHalAudioEffectFactoryTargetTest.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp index adf1da77cd..4e86ec3e13 100644 --- a/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp @@ -296,6 +296,25 @@ TEST_P(EffectFactoryTest, QueryProcess) { [&](const auto& proc) { return processingSet.find(proc) != processingSet.end(); })); } +// Make sure all effect instances have same HAL version number as IFactory. +TEST_P(EffectFactoryTest, VersionNumberForAllEffectsEqualsToIFactory) { + std::vector descs; + EXPECT_IS_OK(mEffectFactory->queryEffects(std::nullopt, std::nullopt, std::nullopt, &descs)); + EXPECT_NE(descs.size(), 0UL); + + std::vector> effects = createWithDescs(descs); + int factoryVersion = 0; + EXPECT_IS_OK(mEffectFactory->getInterfaceVersion(&factoryVersion)); + + for (const auto& effect : effects) { + int effectVersion = 0; + EXPECT_NE(nullptr, effect); + EXPECT_IS_OK(effect->getInterfaceVersion(&effectVersion)); + EXPECT_EQ(factoryVersion, effectVersion); + } + ASSERT_NO_FATAL_FAILURE(destroyEffects(effects)); +} + INSTANTIATE_TEST_SUITE_P(EffectFactoryTest, EffectFactoryTest, testing::ValuesIn(android::getAidlHalInstanceNames(IFactory::descriptor)), android::PrintInstanceNameToString);