diff options
author | Shunkai Yao <yaoshunkai@google.com> | 2023-03-06 18:41:27 +0000 |
---|---|---|
committer | Shunkai Yao <yaoshunkai@google.com> | 2023-03-20 01:48:10 +0000 |
commit | 4b3434f96efab51e863e9133336a49f30a859575 (patch) | |
tree | d996a124e41c2053705e39d43bdeee368b4793dd /audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp | |
parent | 2da977681b96a0b64924bc010bc1fc26981221c8 (diff) |
Update EffectUUID initialization
Avoid dynamic initialization global UUID variables
Bug: 271500140
Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit
Change-Id: I7574c1fe1ba0aaff1d9d29a9eed10de1aef33806
Diffstat (limited to 'audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp')
-rw-r--r-- | audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp index 21f5eb5636..7b9477dfa8 100644 --- a/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp @@ -28,6 +28,7 @@ #include <android/binder_interface_utils.h> #include <android/binder_manager.h> #include <android/binder_process.h> +#include <system/audio_effects/effect_uuid.h> #include <aidl/android/hardware/audio/effect/IFactory.h> @@ -38,10 +39,10 @@ using namespace android; using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectUuidNull; +using aidl::android::hardware::audio::effect::getEffectUuidZero; using aidl::android::hardware::audio::effect::IEffect; using aidl::android::hardware::audio::effect::IFactory; -using aidl::android::hardware::audio::effect::kEffectNullUuid; -using aidl::android::hardware::audio::effect::kEffectZeroUuid; using aidl::android::hardware::audio::effect::Processing; using aidl::android::media::audio::common::AudioSource; using aidl::android::media::audio::common::AudioStreamType; @@ -65,8 +66,8 @@ class EffectFactoryTest : public testing::TestWithParam<std::string> { std::unique_ptr<EffectFactoryHelper> mFactoryHelper; std::shared_ptr<IFactory> mEffectFactory; std::vector<std::shared_ptr<IEffect>> mEffects; - const Descriptor::Identity kNullId = {.uuid = kEffectNullUuid}; - const Descriptor::Identity kZeroId = {.uuid = kEffectZeroUuid}; + const Descriptor::Identity kNullId = {.uuid = getEffectUuidNull()}; + const Descriptor::Identity kZeroId = {.uuid = getEffectUuidZero()}; const Descriptor kNullDesc = {.common.id = kNullId}; const Descriptor kZeroDesc = {.common.id = kZeroId}; @@ -132,13 +133,13 @@ TEST_P(EffectFactoryTest, CanBeRestarted) { TEST_P(EffectFactoryTest, ExpectAllAospEffectTypes) { std::vector<Descriptor> descs; std::set<AudioUuid> typeUuidSet( - {aidl::android::hardware::audio::effect::kBassBoostTypeUUID, - aidl::android::hardware::audio::effect::kEqualizerTypeUUID, - aidl::android::hardware::audio::effect::kEnvReverbTypeUUID, - aidl::android::hardware::audio::effect::kPresetReverbTypeUUID, - aidl::android::hardware::audio::effect::kDynamicsProcessingTypeUUID, - aidl::android::hardware::audio::effect::kHapticGeneratorTypeUUID, - aidl::android::hardware::audio::effect::kVirtualizerTypeUUID}); + {aidl::android::hardware::audio::effect::getEffectTypeUuidBassBoost(), + aidl::android::hardware::audio::effect::getEffectTypeUuidEqualizer(), + aidl::android::hardware::audio::effect::getEffectTypeUuidEnvReverb(), + aidl::android::hardware::audio::effect::getEffectTypeUuidPresetReverb(), + aidl::android::hardware::audio::effect::getEffectTypeUuidDynamicsProcessing(), + aidl::android::hardware::audio::effect::getEffectTypeUuidHapticGenerator(), + aidl::android::hardware::audio::effect::getEffectTypeUuidVirtualizer()}); EXPECT_IS_OK(mEffectFactory->queryEffects(std::nullopt, std::nullopt, std::nullopt, &descs)); EXPECT_TRUE(descs.size() >= typeUuidSet.size()); @@ -155,19 +156,22 @@ TEST_P(EffectFactoryTest, ExpectAllAospEffectTypes) { TEST_P(EffectFactoryTest, QueryNullTypeUuid) { std::vector<Descriptor> descs; - EXPECT_IS_OK(mEffectFactory->queryEffects(kEffectNullUuid, std::nullopt, std::nullopt, &descs)); + EXPECT_IS_OK( + mEffectFactory->queryEffects(getEffectUuidNull(), std::nullopt, std::nullopt, &descs)); EXPECT_EQ(descs.size(), 0UL); } TEST_P(EffectFactoryTest, QueriedNullImplUuid) { std::vector<Descriptor> descs; - EXPECT_IS_OK(mEffectFactory->queryEffects(std::nullopt, kEffectNullUuid, std::nullopt, &descs)); + EXPECT_IS_OK( + mEffectFactory->queryEffects(std::nullopt, getEffectUuidNull(), std::nullopt, &descs)); EXPECT_EQ(descs.size(), 0UL); } TEST_P(EffectFactoryTest, QueriedNullProxyUuid) { std::vector<Descriptor> descs; - EXPECT_IS_OK(mEffectFactory->queryEffects(std::nullopt, std::nullopt, kEffectNullUuid, &descs)); + EXPECT_IS_OK( + mEffectFactory->queryEffects(std::nullopt, std::nullopt, getEffectUuidNull(), &descs)); EXPECT_EQ(descs.size(), 0UL); } |