From 3907f767d9a8fb6f85cde98061cc06c77ca46980 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Thu, 13 Dec 2018 09:42:17 -0800 Subject: [PATCH] Audio HAL: Simplify types updates for 'common' and 'effect' packages Instead of importing every single type individually ("using "), import entire namespaces of ::android::hardware::audio::common::CPP_VERSION and ::android::hardware::audio::effect::CPP_VERSION inside the "implementation" namespace in the default implementation. This simplifies modifying types, as it is not needed anymore to surround "using " directives with #if MAJOR_VERSION ... Note that the contents of the namespaces are imported inside the "implementation" namespace, which reduces risks of name collision Test: make Change-Id: I5daa0ed91203726d1df67408ac9af728c247704a --- audio/effect/all-versions/default/Effect.cpp | 5 ++--- audio/effect/all-versions/default/Effect.h | 15 ++------------- .../effect/all-versions/default/EffectsFactory.h | 7 ++----- .../default/EnvironmentalReverbEffect.h | 14 ++------------ .../all-versions/default/LoudnessEnhancerEffect.h | 14 ++------------ .../all-versions/default/NoiseSuppressionEffect.h | 14 ++------------ .../all-versions/default/PresetReverbEffect.h | 14 ++------------ .../all-versions/default/VirtualizerEffect.h | 15 ++------------- .../all-versions/default/VisualizerEffect.h | 14 ++------------ 9 files changed, 18 insertions(+), 94 deletions(-) diff --git a/audio/effect/all-versions/default/Effect.cpp b/audio/effect/all-versions/default/Effect.cpp index 3e5148fabb..a25c946eec 100644 --- a/audio/effect/all-versions/default/Effect.cpp +++ b/audio/effect/all-versions/default/Effect.cpp @@ -40,10 +40,9 @@ namespace effect { namespace CPP_VERSION { namespace implementation { -using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask; -using ::android::hardware::audio::common::CPP_VERSION::AudioFormat; using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioChannelBitfield; -using ::android::hardware::audio::effect::CPP_VERSION::MessageQueueFlagBits; +using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::effect::CPP_VERSION; namespace { diff --git a/audio/effect/all-versions/default/Effect.h b/audio/effect/all-versions/default/Effect.h index f6a12d95e5..1a2b0393ad 100644 --- a/audio/effect/all-versions/default/Effect.h +++ b/audio/effect/all-versions/default/Effect.h @@ -47,20 +47,9 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::common::CPP_VERSION::AudioDevice; -using ::android::hardware::audio::common::CPP_VERSION::AudioMode; -using ::android::hardware::audio::common::CPP_VERSION::AudioSource; -using ::android::hardware::audio::common::CPP_VERSION::Uuid; using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioDeviceBitfield; -using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer; -using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig; -using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig; -using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor; -using ::android::hardware::audio::effect::CPP_VERSION::EffectFeature; -using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter; -using ::android::hardware::audio::effect::CPP_VERSION::IEffect; -using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback; -using ::android::hardware::audio::effect::CPP_VERSION::Result; +using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::effect::CPP_VERSION; struct Effect : public IEffect { typedef MessageQueue StatusMQ; diff --git a/audio/effect/all-versions/default/EffectsFactory.h b/audio/effect/all-versions/default/EffectsFactory.h index 0cbfaa20b7..f0d09ec3a4 100644 --- a/audio/effect/all-versions/default/EffectsFactory.h +++ b/audio/effect/all-versions/default/EffectsFactory.h @@ -41,11 +41,8 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::common::CPP_VERSION::Uuid; -using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor; -using ::android::hardware::audio::effect::CPP_VERSION::IEffect; -using ::android::hardware::audio::effect::CPP_VERSION::IEffectsFactory; -using ::android::hardware::audio::effect::CPP_VERSION::Result; +using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::effect::CPP_VERSION; struct EffectsFactory : public IEffectsFactory { // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffectsFactory follow. diff --git a/audio/effect/all-versions/default/EnvironmentalReverbEffect.h b/audio/effect/all-versions/default/EnvironmentalReverbEffect.h index 7e6597bae6..d06c3fc77b 100644 --- a/audio/effect/all-versions/default/EnvironmentalReverbEffect.h +++ b/audio/effect/all-versions/default/EnvironmentalReverbEffect.h @@ -43,18 +43,8 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::common::CPP_VERSION::AudioDevice; -using ::android::hardware::audio::common::CPP_VERSION::AudioMode; -using ::android::hardware::audio::common::CPP_VERSION::AudioSource; -using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer; -using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig; -using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig; -using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor; -using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter; -using ::android::hardware::audio::effect::CPP_VERSION::IEffect; -using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback; -using ::android::hardware::audio::effect::CPP_VERSION::IEnvironmentalReverbEffect; -using ::android::hardware::audio::effect::CPP_VERSION::Result; +using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::effect::CPP_VERSION; struct EnvironmentalReverbEffect : public IEnvironmentalReverbEffect { explicit EnvironmentalReverbEffect(effect_handle_t handle); diff --git a/audio/effect/all-versions/default/LoudnessEnhancerEffect.h b/audio/effect/all-versions/default/LoudnessEnhancerEffect.h index 6eb8a8c293..06c521ca82 100644 --- a/audio/effect/all-versions/default/LoudnessEnhancerEffect.h +++ b/audio/effect/all-versions/default/LoudnessEnhancerEffect.h @@ -39,18 +39,8 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::common::CPP_VERSION::AudioDevice; -using ::android::hardware::audio::common::CPP_VERSION::AudioMode; -using ::android::hardware::audio::common::CPP_VERSION::AudioSource; -using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer; -using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig; -using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig; -using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor; -using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter; -using ::android::hardware::audio::effect::CPP_VERSION::IEffect; -using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback; -using ::android::hardware::audio::effect::CPP_VERSION::ILoudnessEnhancerEffect; -using ::android::hardware::audio::effect::CPP_VERSION::Result; +using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::effect::CPP_VERSION; struct LoudnessEnhancerEffect : public ILoudnessEnhancerEffect { explicit LoudnessEnhancerEffect(effect_handle_t handle); diff --git a/audio/effect/all-versions/default/NoiseSuppressionEffect.h b/audio/effect/all-versions/default/NoiseSuppressionEffect.h index af62dd1af4..f31ba3b923 100644 --- a/audio/effect/all-versions/default/NoiseSuppressionEffect.h +++ b/audio/effect/all-versions/default/NoiseSuppressionEffect.h @@ -41,18 +41,8 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::common::CPP_VERSION::AudioDevice; -using ::android::hardware::audio::common::CPP_VERSION::AudioMode; -using ::android::hardware::audio::common::CPP_VERSION::AudioSource; -using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer; -using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig; -using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig; -using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor; -using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter; -using ::android::hardware::audio::effect::CPP_VERSION::IEffect; -using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback; -using ::android::hardware::audio::effect::CPP_VERSION::INoiseSuppressionEffect; -using ::android::hardware::audio::effect::CPP_VERSION::Result; +using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::effect::CPP_VERSION; struct NoiseSuppressionEffect : public INoiseSuppressionEffect { explicit NoiseSuppressionEffect(effect_handle_t handle); diff --git a/audio/effect/all-versions/default/PresetReverbEffect.h b/audio/effect/all-versions/default/PresetReverbEffect.h index aa864b0b55..8971976825 100644 --- a/audio/effect/all-versions/default/PresetReverbEffect.h +++ b/audio/effect/all-versions/default/PresetReverbEffect.h @@ -39,18 +39,8 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::common::CPP_VERSION::AudioDevice; -using ::android::hardware::audio::common::CPP_VERSION::AudioMode; -using ::android::hardware::audio::common::CPP_VERSION::AudioSource; -using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer; -using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig; -using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig; -using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor; -using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter; -using ::android::hardware::audio::effect::CPP_VERSION::IEffect; -using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback; -using ::android::hardware::audio::effect::CPP_VERSION::IPresetReverbEffect; -using ::android::hardware::audio::effect::CPP_VERSION::Result; +using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::effect::CPP_VERSION; struct PresetReverbEffect : public IPresetReverbEffect { explicit PresetReverbEffect(effect_handle_t handle); diff --git a/audio/effect/all-versions/default/VirtualizerEffect.h b/audio/effect/all-versions/default/VirtualizerEffect.h index 87b53d66ab..e7302f9f8b 100644 --- a/audio/effect/all-versions/default/VirtualizerEffect.h +++ b/audio/effect/all-versions/default/VirtualizerEffect.h @@ -39,20 +39,9 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask; -using ::android::hardware::audio::common::CPP_VERSION::AudioDevice; -using ::android::hardware::audio::common::CPP_VERSION::AudioMode; -using ::android::hardware::audio::common::CPP_VERSION::AudioSource; using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioChannelBitfield; -using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer; -using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig; -using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig; -using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor; -using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter; -using ::android::hardware::audio::effect::CPP_VERSION::IEffect; -using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback; -using ::android::hardware::audio::effect::CPP_VERSION::IVirtualizerEffect; -using ::android::hardware::audio::effect::CPP_VERSION::Result; +using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::effect::CPP_VERSION; struct VirtualizerEffect : public IVirtualizerEffect { explicit VirtualizerEffect(effect_handle_t handle); diff --git a/audio/effect/all-versions/default/VisualizerEffect.h b/audio/effect/all-versions/default/VisualizerEffect.h index 0a13a2bf1f..42c77a2103 100644 --- a/audio/effect/all-versions/default/VisualizerEffect.h +++ b/audio/effect/all-versions/default/VisualizerEffect.h @@ -39,18 +39,8 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::common::CPP_VERSION::AudioDevice; -using ::android::hardware::audio::common::CPP_VERSION::AudioMode; -using ::android::hardware::audio::common::CPP_VERSION::AudioSource; -using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer; -using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig; -using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig; -using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor; -using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter; -using ::android::hardware::audio::effect::CPP_VERSION::IEffect; -using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback; -using ::android::hardware::audio::effect::CPP_VERSION::IVisualizerEffect; -using ::android::hardware::audio::effect::CPP_VERSION::Result; +using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::effect::CPP_VERSION; struct VisualizerEffect : public IVisualizerEffect { explicit VisualizerEffect(effect_handle_t handle);