Update EffectUUID initialization
Avoid dynamic initialization global UUID variables
Bug: 271500140
Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit
Change-Id: Ia2acd4f371415bcf5d67de9788d8bf9a76ab5a98
diff --git a/media/libeffects/downmix/aidl/EffectDownmix.cpp b/media/libeffects/downmix/aidl/EffectDownmix.cpp
index 17d0736..7068c5c 100644
--- a/media/libeffects/downmix/aidl/EffectDownmix.cpp
+++ b/media/libeffects/downmix/aidl/EffectDownmix.cpp
@@ -17,19 +17,20 @@
#define LOG_TAG "AHAL_DownmixImpl"
#include <android-base/logging.h>
+#include <system/audio_effects/effect_uuid.h>
#include "EffectDownmix.h"
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::DownmixImpl;
+using aidl::android::hardware::audio::effect::getEffectImplUuidDownmix;
+using aidl::android::hardware::audio::effect::getEffectTypeUuidDownmix;
using aidl::android::hardware::audio::effect::IEffect;
-using aidl::android::hardware::audio::effect::kDownmixImplUUID;
-using aidl::android::hardware::audio::effect::kDownmixTypeUUID;
using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
std::shared_ptr<IEffect>* instanceSpp) {
- if (!in_impl_uuid || *in_impl_uuid != kDownmixImplUUID) {
+ if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidDownmix()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@@ -44,7 +45,7 @@
}
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
- if (!in_impl_uuid || *in_impl_uuid != kDownmixImplUUID) {
+ if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidDownmix()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@@ -56,11 +57,12 @@
const std::string DownmixImpl::kEffectName = "Multichannel Downmix To Stereo";
const Descriptor DownmixImpl::kDescriptor = {
- .common = {
- .id = {.type = kDownmixTypeUUID, .uuid = kDownmixImplUUID, .proxy = std::nullopt},
- .flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST},
- .name = DownmixImpl::kEffectName,
- .implementor = "The Android Open Source Project"}};
+ .common = {.id = {.type = getEffectTypeUuidDownmix(),
+ .uuid = getEffectImplUuidDownmix(),
+ .proxy = std::nullopt},
+ .flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST},
+ .name = DownmixImpl::kEffectName,
+ .implementor = "The Android Open Source Project"}};
ndk::ScopedAStatus DownmixImpl::getDescriptor(Descriptor* _aidl_return) {
RETURN_IF(!_aidl_return, EX_ILLEGAL_ARGUMENT, "Parameter:nullptr");
diff --git a/media/libeffects/downmix/aidl/EffectDownmix.h b/media/libeffects/downmix/aidl/EffectDownmix.h
index d590133..812d26b 100644
--- a/media/libeffects/downmix/aidl/EffectDownmix.h
+++ b/media/libeffects/downmix/aidl/EffectDownmix.h
@@ -21,7 +21,6 @@
#include "DownmixContext.h"
#include "effect-impl/EffectImpl.h"
-#include "effect-impl/EffectUUID.h"
namespace aidl::android::hardware::audio::effect {
diff --git a/media/libeffects/dynamicsproc/aidl/DynamicsProcessing.cpp b/media/libeffects/dynamicsproc/aidl/DynamicsProcessing.cpp
index ca578eb..e508d48 100644
--- a/media/libeffects/dynamicsproc/aidl/DynamicsProcessing.cpp
+++ b/media/libeffects/dynamicsproc/aidl/DynamicsProcessing.cpp
@@ -17,6 +17,7 @@
#define LOG_TAG "AHAL_DynamicsProcessingLibEffects"
#include <android-base/logging.h>
+#include <system/audio_effects/effect_uuid.h>
#include "DynamicsProcessing.h"
@@ -25,15 +26,16 @@
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::DynamicsProcessingImpl;
+using aidl::android::hardware::audio::effect::getEffectImplUuidDynamicsProcessing;
+using aidl::android::hardware::audio::effect::getEffectTypeUuidDynamicsProcessing;
using aidl::android::hardware::audio::effect::IEffect;
-using aidl::android::hardware::audio::effect::kDynamicsProcessingImplUUID;
using aidl::android::hardware::audio::effect::State;
using aidl::android::media::audio::common::AudioUuid;
using aidl::android::media::audio::common::PcmType;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
std::shared_ptr<IEffect>* instanceSpp) {
- if (!in_impl_uuid || *in_impl_uuid != kDynamicsProcessingImplUUID) {
+ if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidDynamicsProcessing()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@@ -48,7 +50,7 @@
}
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
- if (!in_impl_uuid || *in_impl_uuid != kDynamicsProcessingImplUUID) {
+ if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidDynamicsProcessing()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@@ -88,8 +90,8 @@
const Capability DynamicsProcessingImpl::kCapability = {.range = {DynamicsProcessingImpl::kRange}};
const Descriptor DynamicsProcessingImpl::kDescriptor = {
- .common = {.id = {.type = kDynamicsProcessingTypeUUID,
- .uuid = kDynamicsProcessingImplUUID,
+ .common = {.id = {.type = getEffectTypeUuidDynamicsProcessing(),
+ .uuid = getEffectImplUuidDynamicsProcessing(),
.proxy = std::nullopt},
.flags = {.type = Flags::Type::INSERT,
.insert = Flags::Insert::LAST,
diff --git a/media/libeffects/dynamicsproc/aidl/DynamicsProcessing.h b/media/libeffects/dynamicsproc/aidl/DynamicsProcessing.h
index 26b6ead..d094c69 100644
--- a/media/libeffects/dynamicsproc/aidl/DynamicsProcessing.h
+++ b/media/libeffects/dynamicsproc/aidl/DynamicsProcessing.h
@@ -19,7 +19,6 @@
#include <aidl/android/hardware/audio/effect/BnEffect.h>
#include "effect-impl/EffectImpl.h"
-#include "effect-impl/EffectUUID.h"
#include "DynamicsProcessingContext.h"
namespace aidl::android::hardware::audio::effect {
diff --git a/media/libeffects/hapticgenerator/aidl/EffectHapticGenerator.cpp b/media/libeffects/hapticgenerator/aidl/EffectHapticGenerator.cpp
index 7e22482..031477f 100644
--- a/media/libeffects/hapticgenerator/aidl/EffectHapticGenerator.cpp
+++ b/media/libeffects/hapticgenerator/aidl/EffectHapticGenerator.cpp
@@ -16,20 +16,22 @@
#define LOG_TAG "AHAL_HapticGeneratorImpl"
-#include "EffectHapticGenerator.h"
-
#include <android-base/logging.h>
#include <audio_effects/effect_hapticgenerator.h>
+#include <system/audio_effects/effect_uuid.h>
+
+#include "EffectHapticGenerator.h"
using aidl::android::hardware::audio::effect::Descriptor;
+using aidl::android::hardware::audio::effect::getEffectImplUuidHapticGenerator;
+using aidl::android::hardware::audio::effect::getEffectTypeUuidHapticGenerator;
using aidl::android::hardware::audio::effect::HapticGeneratorImpl;
using aidl::android::hardware::audio::effect::IEffect;
-using aidl::android::hardware::audio::effect::kHapticGeneratorImplUUID;
using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
std::shared_ptr<IEffect>* instanceSpp) {
- if (!in_impl_uuid || *in_impl_uuid != kHapticGeneratorImplUUID) {
+ if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidHapticGenerator()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@@ -44,7 +46,7 @@
}
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
- if (!in_impl_uuid || *in_impl_uuid != kHapticGeneratorImplUUID) {
+ if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidHapticGenerator()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@@ -56,8 +58,8 @@
const std::string HapticGeneratorImpl::kEffectName = "Haptic Generator";
const Descriptor HapticGeneratorImpl::kDescriptor = {
- .common = {.id = {.type = kHapticGeneratorTypeUUID,
- .uuid = kHapticGeneratorImplUUID,
+ .common = {.id = {.type = getEffectTypeUuidHapticGenerator(),
+ .uuid = getEffectImplUuidHapticGenerator(),
.proxy = std::nullopt},
.flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST},
.name = HapticGeneratorImpl::kEffectName,
diff --git a/media/libeffects/hapticgenerator/aidl/EffectHapticGenerator.h b/media/libeffects/hapticgenerator/aidl/EffectHapticGenerator.h
index 02ca392..fe9616a 100644
--- a/media/libeffects/hapticgenerator/aidl/EffectHapticGenerator.h
+++ b/media/libeffects/hapticgenerator/aidl/EffectHapticGenerator.h
@@ -20,7 +20,6 @@
#include "HapticGeneratorContext.h"
#include "effect-impl/EffectImpl.h"
-#include "effect-impl/EffectUUID.h"
namespace aidl::android::hardware::audio::effect {
diff --git a/media/libeffects/loudness/aidl/EffectLoudnessEnhancer.cpp b/media/libeffects/loudness/aidl/EffectLoudnessEnhancer.cpp
index 9d8bc80..a7d9282 100644
--- a/media/libeffects/loudness/aidl/EffectLoudnessEnhancer.cpp
+++ b/media/libeffects/loudness/aidl/EffectLoudnessEnhancer.cpp
@@ -17,19 +17,21 @@
#define LOG_TAG "AHAL_LoudnessEnhancerImpl"
#include <android-base/logging.h>
+#include <system/audio_effects/effect_uuid.h>
#include "EffectLoudnessEnhancer.h"
using aidl::android::hardware::audio::effect::Descriptor;
+using aidl::android::hardware::audio::effect::getEffectImplUuidLoudnessEnhancer;
+using aidl::android::hardware::audio::effect::getEffectTypeUuidLoudnessEnhancer;
using aidl::android::hardware::audio::effect::IEffect;
-using aidl::android::hardware::audio::effect::kLoudnessEnhancerImplUUID;
using aidl::android::hardware::audio::effect::LoudnessEnhancerImpl;
using aidl::android::hardware::audio::effect::State;
using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
std::shared_ptr<IEffect>* instanceSpp) {
- if (!in_impl_uuid || *in_impl_uuid != kLoudnessEnhancerImplUUID) {
+ if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidLoudnessEnhancer()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@@ -44,7 +46,7 @@
}
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
- if (!in_impl_uuid || *in_impl_uuid != kLoudnessEnhancerImplUUID) {
+ if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidLoudnessEnhancer()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@@ -56,8 +58,8 @@
const std::string LoudnessEnhancerImpl::kEffectName = "Loudness Enhancer";
const Descriptor LoudnessEnhancerImpl::kDescriptor = {
- .common = {.id = {.type = kLoudnessEnhancerTypeUUID,
- .uuid = kLoudnessEnhancerImplUUID,
+ .common = {.id = {.type = getEffectTypeUuidLoudnessEnhancer(),
+ .uuid = getEffectImplUuidLoudnessEnhancer(),
.proxy = std::nullopt},
.flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST},
.name = LoudnessEnhancerImpl::kEffectName,
diff --git a/media/libeffects/loudness/aidl/EffectLoudnessEnhancer.h b/media/libeffects/loudness/aidl/EffectLoudnessEnhancer.h
index 6402fd2..5b9e924 100644
--- a/media/libeffects/loudness/aidl/EffectLoudnessEnhancer.h
+++ b/media/libeffects/loudness/aidl/EffectLoudnessEnhancer.h
@@ -19,7 +19,6 @@
#include <aidl/android/hardware/audio/effect/BnEffect.h>
#include "effect-impl/EffectImpl.h"
-#include "effect-impl/EffectUUID.h"
#include "LoudnessEnhancerContext.h"
namespace aidl::android::hardware::audio::effect {
diff --git a/media/libeffects/lvm/wrapper/Aidl/BundleTypes.h b/media/libeffects/lvm/wrapper/Aidl/BundleTypes.h
index 520371b..b3371a3 100644
--- a/media/libeffects/lvm/wrapper/Aidl/BundleTypes.h
+++ b/media/libeffects/lvm/wrapper/Aidl/BundleTypes.h
@@ -18,7 +18,8 @@
#include <array>
#include <aidl/android/hardware/audio/effect/BnEffect.h>
-#include "effect-impl/EffectUUID.h"
+#include <system/audio_effects/effect_uuid.h>
+
#include "effect-impl/EffectTypes.h"
#include "LVM.h"
@@ -82,33 +83,36 @@
MAKE_RANGE(Equalizer, centerFreqMh, std::vector<int>({1}), std::vector<int>({}))};
static const Capability kEqCap = {.range = kEqRanges};
static const std::string kEqualizerEffectName = "EqualizerBundle";
-static const Descriptor kEqualizerDesc = {.common = {.id = {.type = kEqualizerTypeUUID,
- .uuid = kEqualizerBundleImplUUID,
- .proxy = kEqualizerProxyUUID},
- .flags = {.type = Flags::Type::INSERT,
- .insert = Flags::Insert::FIRST,
- .volume = Flags::Volume::CTRL},
- .name = kEqualizerEffectName,
- .implementor = "NXP Software Ltd."},
- .capability = kEqCap};
+static const Descriptor kEqualizerDesc = {
+ .common = {.id = {.type = getEffectTypeUuidEqualizer(),
+ .uuid = getEffectImplUuidEqualizerBundle(),
+ .proxy = getEffectImplUuidEqualizerProxy()},
+
+ .flags = {.type = Flags::Type::INSERT,
+ .insert = Flags::Insert::FIRST,
+ .volume = Flags::Volume::CTRL},
+ .name = kEqualizerEffectName,
+ .implementor = "NXP Software Ltd."},
+ .capability = kEqCap};
static const int mMaxStrengthSupported = 1000;
static const std::vector<Range::BassBoostRange> kBassBoostRanges = {
MAKE_RANGE(BassBoost, strengthPm, 0, mMaxStrengthSupported)};
static const Capability kBassBoostCap = {.range = kBassBoostRanges};
static const std::string kBassBoostEffectName = "Dynamic Bass Boost";
-static const Descriptor kBassBoostDesc = {.common = {.id = {.type = kBassBoostTypeUUID,
- .uuid = kBassBoostBundleImplUUID,
- .proxy = kBassBoostProxyUUID},
- .flags = {.type = Flags::Type::INSERT,
- .insert = Flags::Insert::FIRST,
- .volume = Flags::Volume::CTRL,
- .deviceIndication = true},
- .cpuLoad = BASS_BOOST_CUP_LOAD_ARM9E,
- .memoryUsage = BUNDLE_MEM_USAGE,
- .name = kBassBoostEffectName,
- .implementor = "NXP Software Ltd."},
- .capability = kBassBoostCap};
+static const Descriptor kBassBoostDesc = {
+ .common = {.id = {.type = getEffectTypeUuidBassBoost(),
+ .uuid = getEffectImplUuidBassBoostBundle(),
+ .proxy = getEffectImplUuidBassBoostProxy()},
+ .flags = {.type = Flags::Type::INSERT,
+ .insert = Flags::Insert::FIRST,
+ .volume = Flags::Volume::CTRL,
+ .deviceIndication = true},
+ .cpuLoad = BASS_BOOST_CUP_LOAD_ARM9E,
+ .memoryUsage = BUNDLE_MEM_USAGE,
+ .name = kBassBoostEffectName,
+ .implementor = "NXP Software Ltd."},
+ .capability = kBassBoostCap};
static const std::vector<Range::VirtualizerRange> kVirtualizerRanges = {
MAKE_RANGE(Virtualizer, strengthPm, 0, mMaxStrengthSupported)};
@@ -116,9 +120,9 @@
static const std::string kVirtualizerEffectName = "Virtualizer";
static const Descriptor kVirtualizerDesc = {
- .common = {.id = {.type = kVirtualizerTypeUUID,
- .uuid = kVirtualizerBundleImplUUID,
- .proxy = kVirtualizerProxyUUID},
+ .common = {.id = {.type = getEffectTypeUuidVirtualizer(),
+ .uuid = getEffectImplUuidVirtualizerBundle(),
+ .proxy = getEffectImplUuidVirtualizerProxy()},
.flags = {.type = Flags::Type::INSERT,
.insert = Flags::Insert::LAST,
.volume = Flags::Volume::CTRL,
@@ -133,17 +137,18 @@
MAKE_RANGE(Volume, levelDb, -9600, 0)};
static const Capability kVolumeCap = {.range = kVolumeRanges};
static const std::string kVolumeEffectName = "Volume";
-static const Descriptor kVolumeDesc = {.common = {.id = {.type = kVolumeTypeUUID,
- .uuid = kVolumeBundleImplUUID,
- .proxy = std::nullopt},
- .flags = {.type = Flags::Type::INSERT,
- .insert = Flags::Insert::LAST,
- .volume = Flags::Volume::CTRL},
- .cpuLoad = VOLUME_CUP_LOAD_ARM9E,
- .memoryUsage = BUNDLE_MEM_USAGE,
- .name = kVolumeEffectName,
- .implementor = "NXP Software Ltd."},
- .capability = kVolumeCap};
+static const Descriptor kVolumeDesc = {
+ .common = {.id = {.type = getEffectTypeUuidVolume(),
+ .uuid = getEffectImplUuidVolumeBundle(),
+ .proxy = std::nullopt},
+ .flags = {.type = Flags::Type::INSERT,
+ .insert = Flags::Insert::LAST,
+ .volume = Flags::Volume::CTRL},
+ .cpuLoad = VOLUME_CUP_LOAD_ARM9E,
+ .memoryUsage = BUNDLE_MEM_USAGE,
+ .name = kVolumeEffectName,
+ .implementor = "NXP Software Ltd."},
+ .capability = kVolumeCap};
/* The following tables have been computed using the actual levels measured by the output of
* white noise or pink noise (IEC268-1) for the EQ and BassBoost Effects. These are estimates of
diff --git a/media/libeffects/lvm/wrapper/Aidl/EffectBundleAidl.cpp b/media/libeffects/lvm/wrapper/Aidl/EffectBundleAidl.cpp
index b1a9ef0..cd9fb60 100644
--- a/media/libeffects/lvm/wrapper/Aidl/EffectBundleAidl.cpp
+++ b/media/libeffects/lvm/wrapper/Aidl/EffectBundleAidl.cpp
@@ -30,19 +30,21 @@
#include <LVM.h>
#include <limits.h>
+using aidl::android::hardware::audio::effect::getEffectImplUuidBassBoostBundle;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::EffectBundleAidl;
+using aidl::android::hardware::audio::effect::getEffectImplUuidEqualizerBundle;
using aidl::android::hardware::audio::effect::IEffect;
-using aidl::android::hardware::audio::effect::kBassBoostBundleImplUUID;
-using aidl::android::hardware::audio::effect::kEqualizerBundleImplUUID;
-using aidl::android::hardware::audio::effect::kVirtualizerBundleImplUUID;
-using aidl::android::hardware::audio::effect::kVolumeBundleImplUUID;
using aidl::android::hardware::audio::effect::State;
+using aidl::android::hardware::audio::effect::getEffectImplUuidVirtualizerBundle;
+using aidl::android::hardware::audio::effect::getEffectImplUuidVolumeBundle;
using aidl::android::media::audio::common::AudioUuid;
bool isUuidSupported(const AudioUuid* uuid) {
- return (*uuid == kEqualizerBundleImplUUID || *uuid == kBassBoostBundleImplUUID ||
- *uuid == kVirtualizerBundleImplUUID || *uuid == kVolumeBundleImplUUID);
+ return (*uuid == getEffectImplUuidBassBoostBundle() ||
+ *uuid == getEffectImplUuidEqualizerBundle() ||
+ *uuid == getEffectImplUuidVirtualizerBundle() ||
+ *uuid == getEffectImplUuidVolumeBundle());
}
extern "C" binder_exception_t createEffect(const AudioUuid* uuid,
@@ -66,13 +68,13 @@
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
- if (*in_impl_uuid == kEqualizerBundleImplUUID) {
+ if (*in_impl_uuid == getEffectImplUuidEqualizerBundle()) {
*_aidl_return = aidl::android::hardware::audio::effect::lvm::kEqualizerDesc;
- } else if (*in_impl_uuid == kBassBoostBundleImplUUID) {
+ } else if (*in_impl_uuid == getEffectImplUuidBassBoostBundle()) {
*_aidl_return = aidl::android::hardware::audio::effect::lvm:: kBassBoostDesc;
- } else if (*in_impl_uuid == kVirtualizerBundleImplUUID) {
+ } else if (*in_impl_uuid == getEffectImplUuidVirtualizerBundle()) {
*_aidl_return = aidl::android::hardware::audio::effect::lvm::kVirtualizerDesc;
- } else if (*in_impl_uuid == kVolumeBundleImplUUID) {
+ } else if (*in_impl_uuid == getEffectImplUuidVolumeBundle()) {
*_aidl_return = aidl::android::hardware::audio::effect::lvm::kVolumeDesc;
}
return EX_NONE;
@@ -82,19 +84,19 @@
EffectBundleAidl::EffectBundleAidl(const AudioUuid& uuid) {
LOG(DEBUG) << __func__ << uuid.toString();
- if (uuid == kEqualizerBundleImplUUID) {
+ if (uuid == getEffectImplUuidEqualizerBundle()) {
mType = lvm::BundleEffectType::EQUALIZER;
mDescriptor = &lvm::kEqualizerDesc;
mEffectName = &lvm::kEqualizerEffectName;
- } else if (uuid == kBassBoostBundleImplUUID) {
+ } else if (uuid == getEffectImplUuidBassBoostBundle()) {
mType = lvm::BundleEffectType::BASS_BOOST;
mDescriptor = &lvm::kBassBoostDesc;
mEffectName = &lvm::kBassBoostEffectName;
- } else if (uuid == kVirtualizerBundleImplUUID) {
+ } else if (uuid == getEffectImplUuidVirtualizerBundle()) {
mType = lvm::BundleEffectType::VIRTUALIZER;
mDescriptor = &lvm::kVirtualizerDesc;
mEffectName = &lvm::kVirtualizerEffectName;
- } else if (uuid == kVolumeBundleImplUUID) {
+ } else if (uuid == getEffectImplUuidVolumeBundle()) {
mType = lvm::BundleEffectType::VOLUME;
mDescriptor = &lvm::kVolumeDesc;
mEffectName = &lvm::kVolumeEffectName;
diff --git a/media/libeffects/lvm/wrapper/Aidl/EffectBundleAidl.h b/media/libeffects/lvm/wrapper/Aidl/EffectBundleAidl.h
index 0330e5a..ec1abe8 100644
--- a/media/libeffects/lvm/wrapper/Aidl/EffectBundleAidl.h
+++ b/media/libeffects/lvm/wrapper/Aidl/EffectBundleAidl.h
@@ -23,7 +23,6 @@
#include <android-base/logging.h>
#include "effect-impl/EffectImpl.h"
-#include "effect-impl/EffectUUID.h"
#include "BundleContext.h"
#include "BundleTypes.h"
diff --git a/media/libeffects/lvm/wrapper/Reverb/aidl/EffectReverb.cpp b/media/libeffects/lvm/wrapper/Reverb/aidl/EffectReverb.cpp
index e9bdf94..73141b6 100644
--- a/media/libeffects/lvm/wrapper/Reverb/aidl/EffectReverb.cpp
+++ b/media/libeffects/lvm/wrapper/Reverb/aidl/EffectReverb.cpp
@@ -31,17 +31,19 @@
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::EffectReverb;
+using aidl::android::hardware::audio::effect::getEffectImplUuidAuxEnvReverb;
+using aidl::android::hardware::audio::effect::getEffectImplUuidAuxPresetReverb;
+using aidl::android::hardware::audio::effect::getEffectImplUuidInsertEnvReverb;
+using aidl::android::hardware::audio::effect::getEffectImplUuidInsertPresetReverb;
using aidl::android::hardware::audio::effect::IEffect;
-using aidl::android::hardware::audio::effect::kAuxEnvReverbImplUUID;
-using aidl::android::hardware::audio::effect::kAuxPresetReverbImplUUID;
-using aidl::android::hardware::audio::effect::kInsertEnvReverbImplUUID;
-using aidl::android::hardware::audio::effect::kInsertPresetReverbImplUUID;
using aidl::android::hardware::audio::effect::State;
using aidl::android::media::audio::common::AudioUuid;
bool isReverbUuidSupported(const AudioUuid* uuid) {
- return (*uuid == kAuxEnvReverbImplUUID || *uuid == kInsertEnvReverbImplUUID ||
- *uuid == kAuxPresetReverbImplUUID || *uuid == kInsertPresetReverbImplUUID);
+ return (*uuid == getEffectImplUuidAuxEnvReverb() ||
+ *uuid == getEffectImplUuidAuxPresetReverb() ||
+ *uuid == getEffectImplUuidInsertEnvReverb() ||
+ *uuid == getEffectImplUuidInsertPresetReverb());
}
extern "C" binder_exception_t createEffect(const AudioUuid* uuid,
@@ -61,19 +63,18 @@
}
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
- if (!in_impl_uuid || !isReverbUuidSupported(in_impl_uuid)) {
+ if (*in_impl_uuid == getEffectImplUuidAuxEnvReverb()) {
+ *_aidl_return = aidl::android::hardware::audio::effect::lvm::kAuxEnvReverbDesc;
+ } else if (*in_impl_uuid == getEffectImplUuidInsertEnvReverb()) {
+ *_aidl_return = aidl::android::hardware::audio::effect::lvm::kInsertEnvReverbDesc;
+ } else if (*in_impl_uuid == getEffectImplUuidAuxPresetReverb()) {
+ *_aidl_return = aidl::android::hardware::audio::effect::lvm::kAuxPresetReverbDesc;
+ } else if (*in_impl_uuid == getEffectImplUuidInsertPresetReverb()) {
+ *_aidl_return = aidl::android::hardware::audio::effect::lvm::kInsertPresetReverbDesc;
+ } else {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
- if (*in_impl_uuid == kAuxEnvReverbImplUUID) {
- *_aidl_return = aidl::android::hardware::audio::effect::lvm::kAuxEnvReverbDesc;
- } else if (*in_impl_uuid == kInsertEnvReverbImplUUID) {
- *_aidl_return = aidl::android::hardware::audio::effect::lvm::kInsertEnvReverbDesc;
- } else if (*in_impl_uuid == kAuxPresetReverbImplUUID) {
- *_aidl_return = aidl::android::hardware::audio::effect::lvm::kAuxPresetReverbDesc;
- } else if (*in_impl_uuid == kInsertPresetReverbImplUUID) {
- *_aidl_return = aidl::android::hardware::audio::effect::lvm::kInsertPresetReverbDesc;
- }
return EX_NONE;
}
@@ -81,19 +82,19 @@
EffectReverb::EffectReverb(const AudioUuid& uuid) {
LOG(DEBUG) << __func__ << uuid.toString();
- if (uuid == kAuxEnvReverbImplUUID) {
+ if (uuid == getEffectImplUuidAuxEnvReverb()) {
mType = lvm::ReverbEffectType::AUX_ENV;
mDescriptor = &lvm::kAuxEnvReverbDesc;
mEffectName = &lvm::kAuxEnvReverbEffectName;
- } else if (uuid == kInsertEnvReverbImplUUID) {
+ } else if (uuid == getEffectImplUuidInsertEnvReverb()) {
mType = lvm::ReverbEffectType::INSERT_ENV;
mDescriptor = &lvm::kInsertEnvReverbDesc;
mEffectName = &lvm::kInsertEnvReverbEffectName;
- } else if (uuid == kAuxPresetReverbImplUUID) {
+ } else if (uuid == getEffectImplUuidAuxPresetReverb()) {
mType = lvm::ReverbEffectType::AUX_PRESET;
mDescriptor = &lvm::kAuxPresetReverbDesc;
mEffectName = &lvm::kAuxPresetReverbEffectName;
- } else if (uuid == kInsertPresetReverbImplUUID) {
+ } else if (uuid == getEffectImplUuidInsertPresetReverb()) {
mType = lvm::ReverbEffectType::INSERT_PRESET;
mDescriptor = &lvm::kInsertPresetReverbDesc;
mEffectName = &lvm::kInsertPresetReverbEffectName;
diff --git a/media/libeffects/lvm/wrapper/Reverb/aidl/ReverbTypes.h b/media/libeffects/lvm/wrapper/Reverb/aidl/ReverbTypes.h
index 8dcda87..37f9287 100644
--- a/media/libeffects/lvm/wrapper/Reverb/aidl/ReverbTypes.h
+++ b/media/libeffects/lvm/wrapper/Reverb/aidl/ReverbTypes.h
@@ -20,7 +20,8 @@
#include <android/binder_enums.h>
#include <audio_effects/effect_environmentalreverb.h>
#include <audio_effects/effect_presetreverb.h>
-#include "effect-impl/EffectUUID.h"
+#include <system/audio_effects/effect_uuid.h>
+
#include "effect-impl/EffectTypes.h"
// from Reverb/lib
#include "LVREV.h"
@@ -50,29 +51,31 @@
// NXP SW auxiliary environmental reverb
static const std::string kAuxEnvReverbEffectName = "Auxiliary Environmental Reverb";
-static const Descriptor kAuxEnvReverbDesc = {.common = {.id = {.type = kEnvReverbTypeUUID,
- .uuid = kAuxEnvReverbImplUUID,
- .proxy = std::nullopt},
- .flags = {.type = Flags::Type::AUXILIARY},
- .cpuLoad = kCpuLoadARM9E,
- .memoryUsage = kMemUsage,
- .name = kAuxEnvReverbEffectName,
- .implementor = "NXP Software Ltd."},
- .capability = kEnvReverbCap};
+static const Descriptor kAuxEnvReverbDesc = {
+ .common = {.id = {.type = getEffectTypeUuidEnvReverb(),
+ .uuid = getEffectImplUuidAuxEnvReverb(),
+ .proxy = std::nullopt},
+ .flags = {.type = Flags::Type::AUXILIARY},
+ .cpuLoad = kCpuLoadARM9E,
+ .memoryUsage = kMemUsage,
+ .name = kAuxEnvReverbEffectName,
+ .implementor = "NXP Software Ltd."},
+ .capability = kEnvReverbCap};
// NXP SW insert environmental reverb
static const std::string kInsertEnvReverbEffectName = "Insert Environmental Reverb";
-static const Descriptor kInsertEnvReverbDesc = {.common = {.id = {.type = kEnvReverbTypeUUID,
- .uuid = kInsertEnvReverbImplUUID,
- .proxy = std::nullopt},
- .flags = {.type = Flags::Type::INSERT,
- .insert = Flags::Insert::FIRST,
- .volume = Flags::Volume::CTRL},
- .cpuLoad = kCpuLoadARM9E,
- .memoryUsage = kMemUsage,
- .name = kInsertEnvReverbEffectName,
- .implementor = "NXP Software Ltd."},
- .capability = kEnvReverbCap};
+static const Descriptor kInsertEnvReverbDesc = {
+ .common = {.id = {.type = getEffectTypeUuidEnvReverb(),
+ .uuid = getEffectImplUuidInsertEnvReverb(),
+ .proxy = std::nullopt},
+ .flags = {.type = Flags::Type::INSERT,
+ .insert = Flags::Insert::FIRST,
+ .volume = Flags::Volume::CTRL},
+ .cpuLoad = kCpuLoadARM9E,
+ .memoryUsage = kMemUsage,
+ .name = kInsertEnvReverbEffectName,
+ .implementor = "NXP Software Ltd."},
+ .capability = kEnvReverbCap};
static const std::vector<PresetReverb::Presets> kSupportedPresets{
ndk::enum_range<PresetReverb::Presets>().begin(),
@@ -85,8 +88,8 @@
// NXP SW auxiliary preset reverb
static const std::string kAuxPresetReverbEffectName = "Auxiliary Preset Reverb";
static const Descriptor kAuxPresetReverbDesc = {
- .common = {.id = {.type = kPresetReverbTypeUUID,
- .uuid = kAuxPresetReverbImplUUID,
+ .common = {.id = {.type = getEffectTypeUuidPresetReverb(),
+ .uuid = getEffectImplUuidAuxPresetReverb(),
.proxy = std::nullopt},
.flags = {.type = Flags::Type::AUXILIARY},
.cpuLoad = kCpuLoadARM9E,
@@ -98,8 +101,8 @@
// NXP SW insert preset reverb
static const std::string kInsertPresetReverbEffectName = "Insert Preset Reverb";
static const Descriptor kInsertPresetReverbDesc = {
- .common = {.id = {.type = kPresetReverbTypeUUID,
- .uuid = kInsertPresetReverbImplUUID,
+ .common = {.id = {.type = getEffectTypeUuidPresetReverb(),
+ .uuid = getEffectImplUuidInsertPresetReverb(),
.proxy = std::nullopt},
.flags = {.type = Flags::Type::INSERT,
.insert = Flags::Insert::FIRST,
diff --git a/media/libeffects/preprocessing/aidl/EffectPreProcessing.cpp b/media/libeffects/preprocessing/aidl/EffectPreProcessing.cpp
index b9df915..e8ae8b3 100644
--- a/media/libeffects/preprocessing/aidl/EffectPreProcessing.cpp
+++ b/media/libeffects/preprocessing/aidl/EffectPreProcessing.cpp
@@ -24,19 +24,22 @@
#include "EffectPreProcessing.h"
+using aidl::android::hardware::audio::effect::getEffectImplUuidAcousticEchoCancelerSw;
+using aidl::android::hardware::audio::effect::getEffectImplUuidAutomaticGainControlV1Sw;
+using aidl::android::hardware::audio::effect::getEffectImplUuidAutomaticGainControlV2Sw;
+using aidl::android::hardware::audio::effect::getEffectImplUuidNoiseSuppressionSw;
+
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::EffectPreProcessing;
using aidl::android::hardware::audio::effect::IEffect;
-using aidl::android::hardware::audio::effect::kAcousticEchoCancelerSwImplUUID;
-using aidl::android::hardware::audio::effect::kAutomaticGainControlV1SwImplUUID;
-using aidl::android::hardware::audio::effect::kAutomaticGainControlV2SwImplUUID;
-using aidl::android::hardware::audio::effect::kNoiseSuppressionSwImplUUID;
using aidl::android::hardware::audio::effect::State;
using aidl::android::media::audio::common::AudioUuid;
bool isPreProcessingUuidSupported(const AudioUuid& uuid) {
- return (uuid == kAcousticEchoCancelerSwImplUUID || uuid == kAutomaticGainControlV1SwImplUUID ||
- uuid == kAutomaticGainControlV2SwImplUUID || uuid == kNoiseSuppressionSwImplUUID);
+ return uuid == getEffectImplUuidAcousticEchoCancelerSw() ||
+ uuid == getEffectImplUuidAutomaticGainControlV1Sw() ||
+ uuid == getEffectImplUuidAutomaticGainControlV2Sw() ||
+ uuid == getEffectImplUuidNoiseSuppressionSw();
}
extern "C" binder_exception_t createEffect(const AudioUuid* uuid,
@@ -60,13 +63,13 @@
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
- if (*in_impl_uuid == kAcousticEchoCancelerSwImplUUID) {
+ if (*in_impl_uuid == getEffectImplUuidAcousticEchoCancelerSw()) {
*_aidl_return = aidl::android::hardware::audio::effect::kAcousticEchoCancelerDesc;
- } else if (*in_impl_uuid == kAutomaticGainControlV1SwImplUUID) {
+ } else if (*in_impl_uuid == getEffectImplUuidAutomaticGainControlV1Sw()) {
*_aidl_return = aidl::android::hardware::audio::effect::kAutomaticGainControlV1Desc;
- } else if (*in_impl_uuid == kAutomaticGainControlV2SwImplUUID) {
+ } else if (*in_impl_uuid == getEffectImplUuidAutomaticGainControlV2Sw()) {
*_aidl_return = aidl::android::hardware::audio::effect::kAutomaticGainControlV2Desc;
- } else if (*in_impl_uuid == kNoiseSuppressionSwImplUUID) {
+ } else if (*in_impl_uuid == getEffectImplUuidNoiseSuppressionSw()) {
*_aidl_return = aidl::android::hardware::audio::effect::kNoiseSuppressionDesc;
}
return EX_NONE;
@@ -76,19 +79,19 @@
EffectPreProcessing::EffectPreProcessing(const AudioUuid& uuid) {
LOG(DEBUG) << __func__ << uuid.toString();
- if (uuid == kAcousticEchoCancelerSwImplUUID) {
+ if (uuid == getEffectImplUuidAcousticEchoCancelerSw()) {
mType = PreProcessingEffectType::ACOUSTIC_ECHO_CANCELLATION;
mDescriptor = &kAcousticEchoCancelerDesc;
mEffectName = &kAcousticEchoCancelerEffectName;
- } else if (uuid == kAutomaticGainControlV1SwImplUUID) {
+ } else if (uuid == getEffectImplUuidAutomaticGainControlV1Sw()) {
mType = PreProcessingEffectType::AUTOMATIC_GAIN_CONTROL_V1;
mDescriptor = &kAutomaticGainControlV1Desc;
mEffectName = &kAutomaticGainControlV1EffectName;
- } else if (uuid == kAutomaticGainControlV2SwImplUUID) {
+ } else if (uuid == getEffectImplUuidAutomaticGainControlV2Sw()) {
mType = PreProcessingEffectType::AUTOMATIC_GAIN_CONTROL_V2;
mDescriptor = &kAutomaticGainControlV2Desc;
mEffectName = &kAutomaticGainControlV2EffectName;
- } else if (uuid == kNoiseSuppressionSwImplUUID) {
+ } else if (uuid == getEffectImplUuidNoiseSuppressionSw()) {
mType = PreProcessingEffectType::NOISE_SUPPRESSION;
mDescriptor = &kNoiseSuppressionDesc;
mEffectName = &kNoiseSuppressionEffectName;
diff --git a/media/libeffects/preprocessing/aidl/PreProcessingTypes.h b/media/libeffects/preprocessing/aidl/PreProcessingTypes.h
index 2c880d4..4c2b8ba 100644
--- a/media/libeffects/preprocessing/aidl/PreProcessingTypes.h
+++ b/media/libeffects/preprocessing/aidl/PreProcessingTypes.h
@@ -16,15 +16,17 @@
#pragma once
+#include <optional>
+
#include <aidl/android/hardware/audio/effect/BnEffect.h>
#include <audio_effects/effect_aec.h>
#include <audio_effects/effect_agc.h>
#include <audio_effects/effect_agc2.h>
#include <audio_effects/effect_ns.h>
+#include <system/audio_effects/effect_uuid.h>
#include "effect-impl/EffectTypes.h"
-#include "effect-impl/EffectUUID.h"
namespace aidl::android::hardware::audio::effect {
@@ -34,9 +36,9 @@
MAKE_RANGE(AcousticEchoCanceler, AcousticEchoCanceler::echoDelayUs, 0, 500)};
static const Capability kAcousticEchoCancelerCap = {.range = kAcousticEchoCancelerRanges};
static const Descriptor kAcousticEchoCancelerDesc = {
- .common = {.id = {.type = kAcousticEchoCancelerTypeUUID,
- .uuid = kAcousticEchoCancelerSwImplUUID,
- .proxy = kEffectNullUuid},
+ .common = {.id = {.type = getEffectTypeUuidAcousticEchoCanceler(),
+ .uuid = getEffectImplUuidAcousticEchoCancelerSw(),
+ .proxy = std::nullopt},
.flags = {.type = Flags::Type::PRE_PROC, .deviceIndication = true},
.name = kAcousticEchoCancelerEffectName,
.implementor = "The Android Open Source Project"},
@@ -49,9 +51,9 @@
MAKE_RANGE(AutomaticGainControlV1, AutomaticGainControlV1::maxCompressionGainDb, 0, 9000)};
static const Capability kAutomaticGainControlV1Cap = {.range = kAutomaticGainControlV1Ranges};
static const Descriptor kAutomaticGainControlV1Desc = {
- .common = {.id = {.type = kAutomaticGainControlV1TypeUUID,
- .uuid = kAutomaticGainControlV1SwImplUUID,
- .proxy = kEffectNullUuid},
+ .common = {.id = {.type = getEffectTypeUuidAutomaticGainControlV1(),
+ .uuid = getEffectImplUuidAutomaticGainControlV1Sw(),
+ .proxy = std::nullopt},
.flags = {.type = Flags::Type::PRE_PROC, .deviceIndication = true},
.name = kAutomaticGainControlV1EffectName,
.implementor = "The Android Open Source Project"},
@@ -69,9 +71,9 @@
AutomaticGainControlV2::LevelEstimator::RMS)};
static const Capability kAutomaticGainControlV2Cap = {.range = kAutomaticGainControlV2Ranges};
static const Descriptor kAutomaticGainControlV2Desc = {
- .common = {.id = {.type = kAutomaticGainControlV2TypeUUID,
- .uuid = kAutomaticGainControlV2SwImplUUID,
- .proxy = kEffectNullUuid},
+ .common = {.id = {.type = getEffectTypeUuidAutomaticGainControlV2(),
+ .uuid = getEffectImplUuidAutomaticGainControlV2Sw(),
+ .proxy = std::nullopt},
.flags = {.type = Flags::Type::PRE_PROC, .deviceIndication = true},
.name = kAutomaticGainControlV2EffectName,
.implementor = "The Android Open Source Project"},
@@ -80,9 +82,9 @@
// Noise suppression
static const std::string kNoiseSuppressionEffectName = "Noise Suppression";
static const Descriptor kNoiseSuppressionDesc = {
- .common = {.id = {.type = kNoiseSuppressionTypeUUID,
- .uuid = kNoiseSuppressionSwImplUUID,
- .proxy = kEffectNullUuid},
+ .common = {.id = {.type = getEffectTypeUuidNoiseSuppression(),
+ .uuid = getEffectImplUuidNoiseSuppressionSw(),
+ .proxy = std::nullopt},
.flags = {.type = Flags::Type::PRE_PROC, .deviceIndication = true},
.name = kNoiseSuppressionEffectName,
.implementor = "The Android Open Source Project"}};
diff --git a/media/libeffects/visualizer/aidl/Visualizer.cpp b/media/libeffects/visualizer/aidl/Visualizer.cpp
index 6e7833c..53bfb41 100644
--- a/media/libeffects/visualizer/aidl/Visualizer.cpp
+++ b/media/libeffects/visualizer/aidl/Visualizer.cpp
@@ -17,18 +17,21 @@
#define LOG_TAG "AHAL_VisualizerLibEffects"
#include <android-base/logging.h>
+#include <system/audio_effects/effect_uuid.h>
+
#include "Visualizer.h"
using aidl::android::hardware::audio::effect::Descriptor;
+using aidl::android::hardware::audio::effect::getEffectImplUuidVisualizer;
+using aidl::android::hardware::audio::effect::getEffectTypeUuidVisualizer;
using aidl::android::hardware::audio::effect::IEffect;
-using aidl::android::hardware::audio::effect::VisualizerImpl;
-using aidl::android::hardware::audio::effect::kVisualizerImplUUID;
using aidl::android::hardware::audio::effect::State;
+using aidl::android::hardware::audio::effect::VisualizerImpl;
using aidl::android::media::audio::common::AudioUuid;
extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid,
std::shared_ptr<IEffect>* instanceSpp) {
- if (!in_impl_uuid || *in_impl_uuid != kVisualizerImplUUID) {
+ if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidVisualizer()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@@ -43,7 +46,7 @@
}
extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
- if (!in_impl_uuid || *in_impl_uuid != kVisualizerImplUUID) {
+ if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidVisualizer()) {
LOG(ERROR) << __func__ << "uuid not supported";
return EX_ILLEGAL_ARGUMENT;
}
@@ -65,8 +68,8 @@
const Capability VisualizerImpl::kCapability = {
.range = Range::make<Range::visualizer>(VisualizerImpl::kRanges)};
const Descriptor VisualizerImpl::kDescriptor = {
- .common = {.id = {.type = kVisualizerTypeUUID,
- .uuid = kVisualizerImplUUID,
+ .common = {.id = {.type = getEffectTypeUuidVisualizer(),
+ .uuid = getEffectImplUuidVisualizer(),
.proxy = std::nullopt},
.flags = {.type = Flags::Type::INSERT,
.insert = Flags::Insert::LAST,
diff --git a/media/libeffects/visualizer/aidl/Visualizer.h b/media/libeffects/visualizer/aidl/Visualizer.h
index f6e1d6d..ec725db 100644
--- a/media/libeffects/visualizer/aidl/Visualizer.h
+++ b/media/libeffects/visualizer/aidl/Visualizer.h
@@ -19,7 +19,6 @@
#include <aidl/android/hardware/audio/effect/BnEffect.h>
#include "effect-impl/EffectImpl.h"
-#include "effect-impl/EffectUUID.h"
#include "VisualizerContext.h"