Audio HAL: Factorize V2 and V4 like libaudiohal

Use the same technique developed for the simpler libaudiohal to
factorize the audio HAL impl.

Generated with script:

set -euo pipefail

cd hardware/interfaces/audio

# Make 2.0 and 4.0 files mostly identical by removing all 2.0, V4.0...
# and replacing it by CPP_VERSION and FILE_VERSION
# This allow both implementation to be mostly identical, except for code difference
# Also remove IncludeGuard.h as it will be included from compiler flag
# Also update license to 2018
find -name *.cpp -o -name *h |
    grep -v -e service.cpp |
    xargs sed -Ei \
        -e 's/(#.*)V[42]_0_(.*_H_?)$/\1\2/' \
        -e 's/(LOG_TAG.*)[24]_0/\1/' \
        -e '/#ifndef AUDIO_HAL_VERSION/,/#endif/d' \
        -e '/^#.*def.*AUDIO_HAL_VERSION\b/d' \
        -e's/V[42]_0/CPP_VERSION/' \
        -e 's/(#include ).(android.*)[24].0(.*).$/\1PATH(\2FILE_VERSION\3)/' \
        -e 's|(#include) .(.*)[24].0/(default/.*).$|\1 "\2\3"|' \
        -e 's/\bAUDIO_HAL_VERSION\b/CPP_VERSION/' \
        -e '/IncludeGuard.h/d' \
        -e 's/(Copyright .C. 201)./\18/'

# set MAJOR_VERSION instead of having a different macro for each version
# this allow to do preprocessor arithmetic (eg: MAJOR_VERSION >= 4)
for v in 2 4; do
    find -ipath '*/'$v'.0/*/Android.bp' |
        xargs sed -i -e '/cflags:/,/^$/d' -e '/vndk/{:a;/}/!{N;ba};d}' -e '$i\
    cflags: [\
        "-DMAJOR_VERSION='$v'",\
        "-DMINOR_VERSION=0",\
        "-include common/all-versions/VersionMacro.h",\
    ]'; done

# replace# ifdef VERSION_X by #if MAJOR_VERSION == X
find -path *all-versions/*.h |
    xargs sed -Ei -e 's/def.*AUDIO_HAL_VERSION_([24])_0.*/ MAJOR_VERSION == \1/' \
                  -e 'T;s/ +/ /'

# copy all-versions impl in each version impl
find -path '*/[24].0/*.[hc]*' |
    grep -ve all-versions -e test |
    xargs -P99 -n4 sed -i -Ee '/include <.*all-versions.default/!b' \
        -e 's#.*<#find -path */#' -e 's/>$/|xargs tail -n +16/' -e e

# remove all-versions impl
rm -r {core,effect}/all-versions/

# merge version impl into a single all-version
for dir in core/*.0/vts/functional/*.0/ ;do
    dest=$(echo $dir | sed 's#/..0/#/all-versions/#')
    mkdir -p $dest
    mv -T $dir $dest
done

find -mindepth 3 -path '*/2.0/*' -a \( -name '*cpp' -o -name '*h' \) |
    grep -v 'all-versions' |
    sed -E 'h;s/2/4/g;H;s/4.0/all-versions/;s/4.0//;H;g;s/\n/ /g;'|
    xargs -P99 -L1 sh -c '
        set -euo pipefail
        mkdir -p $(dirname $2);
        diff --old-group-format="#if MAJOR_VERSION == 2
%<#endif
" \
             --new-group-format="#if MAJOR_VERSION == 4
%>#endif
"       $0 $1 > $2 || true;
        rm $0 $1'

# merge the X.0 Android.bp & OWNERS in the all-versions
for dir in common effect core; do
    for sub in default vts/functional; do
        test -f $dir/2.0/$sub/Android.bp || continue
        awk 1 $dir/*.0/$sub/Android.bp >> $dir/all-versions/$sub/Android.bp
        # delete licenses except for the first one and add whitelines
        sed -i -e '/^}$/{N;/^}\n$/!s/\n/&\n/}' $dir/all-versions/$sub/Android.bp
        sed -i -e '1,17b;/^\/\//,/^$/{d}' $dir/all-versions/$sub/Android.bp
    done
    for sub in default vts; do
        test -d $dir/2.0/$sub || continue
        test -f $dir/2.0/$sub/OWNERS &&
            awk 1 $dir/*.0/$sub/OWNERS | sort -u > $dir/all-versions/$sub/OWNERS ||
            true
        rm -r $dir/*.0/$sub
    done
done

# delete all-versions-impl dependencies
find -name 'Android.bp' | xargs sed -i -e '/all-versions-impl/d'

# cleanup unused files
rm common/all-versions/default/include/common/all-versions/default/HidlUtils*
rm common/all-versions/util/include/common/all-versions/IncludeGuard.h
find -depth -type d -empty -delete

# Clamp consecutive number of empty lines to 2
find -name *.cpp -o -name *h | xargs sed -Ei ':a;/^\n*$/{N;ba};s/\n\n+/\n\n/'

# transform #endif\n#if to #elif
find -name *.cpp -o -name *h | xargs sed -i '/^#endif/{N;s/.*\n#if/#elif/}'

# remove leftover include guard in cpp
find -name *.cpp |xargs sed -Ei '/^#.*_H_?$/d'

# apply clang-format
find -name *cpp -o -name *h |
    xargs ../../../prebuilts/clang/host/linux-x86/clang-stable/bin/clang-format --style file -i
# clang format breaks PATH(a/b) to PATH(a / b), remove the space surrounding /
find -name *cpp -o -name *h | xargs sed -i "/#include PATH/s# / #/#g"

Test: compile
Bug: 118203066
Change-Id: I3692a444307afc5f71064fe0b9e6b8af3c9ff1dd
Signed-off-by: Kevin Rocard <krocard@google.com>
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/AcousticEchoCancelerEffect.impl.h b/audio/effect/all-versions/default/AcousticEchoCancelerEffect.cpp
similarity index 94%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/AcousticEchoCancelerEffect.impl.h
rename to audio/effect/all-versions/default/AcousticEchoCancelerEffect.cpp
index 8ad80a2..0b60622 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/AcousticEchoCancelerEffect.impl.h
+++ b/audio/effect/all-versions/default/AcousticEchoCancelerEffect.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,9 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "AEC_Effect_HAL"
+
+#include "AcousticEchoCancelerEffect.h"
 
 #include <android/log.h>
 #include <system/audio_effects/effect_aec.h>
@@ -25,7 +27,7 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 AcousticEchoCancelerEffect::AcousticEchoCancelerEffect(effect_handle_t handle)
@@ -33,7 +35,7 @@
 
 AcousticEchoCancelerEffect::~AcousticEchoCancelerEffect() {}
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
 Return<Result> AcousticEchoCancelerEffect::init() {
     return mEffect->init();
 }
@@ -163,7 +165,7 @@
     return mEffect->close();
 }
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IAcousticEchoCancelerEffect
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IAcousticEchoCancelerEffect
 // follow.
 Return<Result> AcousticEchoCancelerEffect::setEchoDelay(uint32_t echoDelayMs) {
     return mEffect->setParam(AEC_PARAM_ECHO_DELAY, echoDelayMs);
@@ -174,7 +176,7 @@
 }
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/AcousticEchoCancelerEffect.h b/audio/effect/all-versions/default/AcousticEchoCancelerEffect.h
similarity index 85%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/AcousticEchoCancelerEffect.h
rename to audio/effect/all-versions/default/AcousticEchoCancelerEffect.h
index 37744b3..c18f88b 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/AcousticEchoCancelerEffect.h
+++ b/audio/effect/all-versions/default/AcousticEchoCancelerEffect.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_ACOUSTICECHOCANCELEREFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_ACOUSTICECHOCANCELEREFFECT_H
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IAcousticEchoCancelerEffect.h)
+
+#include "Effect.h"
 
 #include <hidl/Status.h>
 
@@ -26,7 +31,7 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 using ::android::sp;
@@ -34,13 +39,13 @@
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IAcousticEchoCancelerEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+using ::android::hardware::audio::effect::CPP_VERSION::IAcousticEchoCancelerEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::Result;
 
 struct AcousticEchoCancelerEffect : public IAcousticEchoCancelerEffect {
     explicit AcousticEchoCancelerEffect(effect_handle_t handle);
 
-    // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+    // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
     Return<Result> init() override;
     Return<Result> setConfig(
         const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -85,7 +90,7 @@
     Return<Result> close() override;
 
     // Methods from
-    // ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IAcousticEchoCancelerEffect follow.
+    // ::android::hardware::audio::effect::CPP_VERSION::IAcousticEchoCancelerEffect follow.
     Return<Result> setEchoDelay(uint32_t echoDelayMs) override;
     Return<void> getEchoDelay(getEchoDelay_cb _hidl_cb) override;
 
@@ -96,8 +101,10 @@
 };
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
 }  // namespace android
+
+#endif  // ANDROID_HARDWARE_AUDIO_EFFECT_ACOUSTICECHOCANCELEREFFECT_H
diff --git a/audio/effect/all-versions/default/Android.bp b/audio/effect/all-versions/default/Android.bp
index ed2a093..ce41481 100644
--- a/audio/effect/all-versions/default/Android.bp
+++ b/audio/effect/all-versions/default/Android.bp
@@ -1,10 +1,25 @@
-cc_library_headers {
-    name: "android.hardware.audio.effect@all-versions-impl",
+cc_library_shared {
+    name: "android.hardware.audio.effect@2.0-impl",
     defaults: ["hidl_defaults"],
     vendor: true,
     relative_install_path: "hw",
-
-    export_include_dirs: ["include"],
+    srcs: [
+        "AcousticEchoCancelerEffect.cpp",
+        "AudioBufferManager.cpp",
+        "AutomaticGainControlEffect.cpp",
+        "BassBoostEffect.cpp",
+        "Conversions.cpp",
+        "DownmixEffect.cpp",
+        "Effect.cpp",
+        "EffectsFactory.cpp",
+        "EnvironmentalReverbEffect.cpp",
+        "EqualizerEffect.cpp",
+        "LoudnessEnhancerEffect.cpp",
+        "NoiseSuppressionEffect.cpp",
+        "PresetReverbEffect.cpp",
+        "VirtualizerEffect.cpp",
+        "VisualizerEffect.cpp",
+    ],
 
     shared_libs: [
         "libbase",
@@ -17,15 +32,78 @@
         "liblog",
         "libutils",
         "android.hardware.audio.common-util",
+        "android.hardware.audio.common@2.0",
+        "android.hardware.audio.common@2.0-util",
+        "android.hardware.audio.effect@2.0",
         "android.hidl.memory@1.0",
     ],
 
     header_libs: [
+        "android.hardware.audio.common.util@all-versions",
         "libaudio_system_headers",
         "libaudioclient_headers",
         "libeffects_headers",
         "libhardware_headers",
         "libmedia_headers",
-        "android.hardware.audio.common.util@all-versions",
     ],
+    cflags: [
+        "-DMAJOR_VERSION=2",
+        "-DMINOR_VERSION=0",
+        "-include common/all-versions/VersionMacro.h",
+    ]
+}
+
+cc_library_shared {
+    name: "android.hardware.audio.effect@4.0-impl",
+    defaults: ["hidl_defaults"],
+    vendor: true,
+    relative_install_path: "hw",
+    srcs: [
+        "AcousticEchoCancelerEffect.cpp",
+        "AudioBufferManager.cpp",
+        "AutomaticGainControlEffect.cpp",
+        "BassBoostEffect.cpp",
+        "Conversions.cpp",
+        "DownmixEffect.cpp",
+        "Effect.cpp",
+        "EffectsFactory.cpp",
+        "EnvironmentalReverbEffect.cpp",
+        "EqualizerEffect.cpp",
+        "LoudnessEnhancerEffect.cpp",
+        "NoiseSuppressionEffect.cpp",
+        "PresetReverbEffect.cpp",
+        "VirtualizerEffect.cpp",
+        "VisualizerEffect.cpp",
+    ],
+
+    shared_libs: [
+        "libbase",
+        "libcutils",
+        "libeffects",
+        "libfmq",
+        "libhidlbase",
+        "libhidlmemory",
+        "libhidltransport",
+        "liblog",
+        "libutils",
+        "android.hardware.audio.common-util",
+        "android.hardware.audio.common@4.0",
+        "android.hardware.audio.common@4.0-util",
+        "android.hardware.audio.effect@4.0",
+        "android.hidl.memory@1.0",
+    ],
+
+    header_libs: [
+        "android.hardware.audio.common.util@all-versions",
+        "libaudio_system_headers",
+        "libaudioclient_headers",
+        "libeffects_headers",
+        "libhardware_headers",
+        "libmedia_headers",
+    ],
+    cflags: [
+        "-DMAJOR_VERSION=4",
+        "-DMINOR_VERSION=0",
+        "-include common/all-versions/VersionMacro.h",
+    ]
 }
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/AudioBufferManager.impl.h b/audio/effect/all-versions/default/AudioBufferManager.cpp
similarity index 93%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/AudioBufferManager.impl.h
rename to audio/effect/all-versions/default/AudioBufferManager.cpp
index 71ccd2d..9a638fd 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/AudioBufferManager.impl.h
+++ b/audio/effect/all-versions/default/AudioBufferManager.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#include "AudioBufferManager.h"
 
 #include <atomic>
 
@@ -53,7 +53,7 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 AudioBufferWrapper::AudioBufferWrapper(const AudioBuffer& buffer)
@@ -83,7 +83,7 @@
 }
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/AudioBufferManager.h b/audio/effect/all-versions/default/AudioBufferManager.h
similarity index 75%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/AudioBufferManager.h
rename to audio/effect/all-versions/default/AudioBufferManager.h
index 34dea2d..8b956cd 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/AudioBufferManager.h
+++ b/audio/effect/all-versions/default/AudioBufferManager.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,10 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_AUDIO_BUFFER_MANAGER_H_
+#define ANDROID_HARDWARE_AUDIO_EFFECT_AUDIO_BUFFER_MANAGER_H_
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/types.h)
 
 #include <mutex>
 
@@ -24,14 +27,14 @@
 #include <utils/RefBase.h>
 #include <utils/Singleton.h>
 
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer;
+using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer;
 using ::android::hidl::memory::V1_0::IMemory;
 
 namespace android {
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 class AudioBufferWrapper : public RefBase {
@@ -51,13 +54,13 @@
 };
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
 }  // namespace android
 
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::implementation::AudioBufferWrapper;
+using ::android::hardware::audio::effect::CPP_VERSION::implementation::AudioBufferWrapper;
 
 namespace android {
 
@@ -67,7 +70,7 @@
     bool wrap(const AudioBuffer& buffer, sp<AudioBufferWrapper>* wrapper);
 
    private:
-    friend class hardware::audio::effect::AUDIO_HAL_VERSION::implementation::AudioBufferWrapper;
+    friend class hardware::audio::effect::CPP_VERSION::implementation::AudioBufferWrapper;
 
     // Called by AudioBufferWrapper.
     void removeEntry(uint64_t id);
@@ -77,3 +80,5 @@
 };
 
 }  // namespace android
+
+#endif  // ANDROID_HARDWARE_AUDIO_EFFECT_AUDIO_BUFFER_MANAGER_H_
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/AutomaticGainControlEffect.impl.h b/audio/effect/all-versions/default/AutomaticGainControlEffect.cpp
similarity index 95%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/AutomaticGainControlEffect.impl.h
rename to audio/effect/all-versions/default/AutomaticGainControlEffect.cpp
index e2e751e..651dd1b 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/AutomaticGainControlEffect.impl.h
+++ b/audio/effect/all-versions/default/AutomaticGainControlEffect.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,9 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "AGC_Effect_HAL"
+
+#include "AutomaticGainControlEffect.h"
 
 #include <android/log.h>
 
@@ -24,7 +26,7 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 AutomaticGainControlEffect::AutomaticGainControlEffect(effect_handle_t handle)
@@ -46,7 +48,7 @@
     halProperties->limiterEnabled = properties.limiterEnabled;
 }
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
 Return<Result> AutomaticGainControlEffect::init() {
     return mEffect->init();
 }
@@ -176,7 +178,7 @@
     return mEffect->close();
 }
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IAutomaticGainControlEffect
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IAutomaticGainControlEffect
 // follow.
 Return<Result> AutomaticGainControlEffect::setTargetLevel(int16_t targetLevelMb) {
     return mEffect->setParam(AGC_PARAM_TARGET_LEVEL, targetLevelMb);
@@ -219,7 +221,7 @@
 }
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/AutomaticGainControlEffect.h b/audio/effect/all-versions/default/AutomaticGainControlEffect.h
similarity index 87%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/AutomaticGainControlEffect.h
rename to audio/effect/all-versions/default/AutomaticGainControlEffect.h
index fce6cd6..a281b1d 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/AutomaticGainControlEffect.h
+++ b/audio/effect/all-versions/default/AutomaticGainControlEffect.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_AUTOMATICGAINCONTROLEFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_AUTOMATICGAINCONTROLEFFECT_H
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IAutomaticGainControlEffect.h)
+
+#include "Effect.h"
 
 #include <system/audio_effects/effect_agc.h>
 
@@ -28,7 +33,7 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 using ::android::sp;
@@ -36,13 +41,13 @@
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IAutomaticGainControlEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+using ::android::hardware::audio::effect::CPP_VERSION::IAutomaticGainControlEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::Result;
 
 struct AutomaticGainControlEffect : public IAutomaticGainControlEffect {
     explicit AutomaticGainControlEffect(effect_handle_t handle);
 
-    // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+    // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
     Return<Result> init() override;
     Return<Result> setConfig(
         const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -87,7 +92,7 @@
     Return<Result> close() override;
 
     // Methods from
-    // ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IAutomaticGainControlEffect follow.
+    // ::android::hardware::audio::effect::CPP_VERSION::IAutomaticGainControlEffect follow.
     Return<Result> setTargetLevel(int16_t targetLevelMb) override;
     Return<void> getTargetLevel(getTargetLevel_cb _hidl_cb) override;
     Return<Result> setCompGain(int16_t compGainMb) override;
@@ -110,8 +115,10 @@
 };
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
 }  // namespace android
+
+#endif  // ANDROID_HARDWARE_AUDIO_EFFECT_AUTOMATICGAINCONTROLEFFECT_H
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/BassBoostEffect.impl.h b/audio/effect/all-versions/default/BassBoostEffect.cpp
similarity index 93%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/BassBoostEffect.impl.h
rename to audio/effect/all-versions/default/BassBoostEffect.cpp
index 7bcb4a3..6f7763d 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/BassBoostEffect.impl.h
+++ b/audio/effect/all-versions/default/BassBoostEffect.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,9 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "BassBoost_HAL"
+
+#include "BassBoostEffect.h"
 
 #include <android/log.h>
 #include <system/audio_effects/effect_bassboost.h>
@@ -25,14 +27,14 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 BassBoostEffect::BassBoostEffect(effect_handle_t handle) : mEffect(new Effect(handle)) {}
 
 BassBoostEffect::~BassBoostEffect() {}
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
 Return<Result> BassBoostEffect::init() {
     return mEffect->init();
 }
@@ -159,7 +161,7 @@
     return mEffect->close();
 }
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IBassBoostEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IBassBoostEffect follow.
 Return<void> BassBoostEffect::isStrengthSupported(isStrengthSupported_cb _hidl_cb) {
     return mEffect->getIntegerParam(BASSBOOST_PARAM_STRENGTH_SUPPORTED, _hidl_cb);
 }
@@ -173,7 +175,7 @@
 }
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/BassBoostEffect.h b/audio/effect/all-versions/default/BassBoostEffect.h
similarity index 85%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/BassBoostEffect.h
rename to audio/effect/all-versions/default/BassBoostEffect.h
index b79e7a4..a184ac2 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/BassBoostEffect.h
+++ b/audio/effect/all-versions/default/BassBoostEffect.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,14 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_BASSBOOSTEFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_BASSBOOSTEFFECT_H
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IBassBoostEffect.h)
+
+#include <hidl/MQDescriptor.h>
+
+#include "Effect.h"
 
 #include <hidl/Status.h>
 
@@ -26,7 +33,7 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 using ::android::sp;
@@ -34,13 +41,13 @@
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IBassBoostEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+using ::android::hardware::audio::effect::CPP_VERSION::IBassBoostEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::Result;
 
 struct BassBoostEffect : public IBassBoostEffect {
     explicit BassBoostEffect(effect_handle_t handle);
 
-    // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+    // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
     Return<Result> init() override;
     Return<Result> setConfig(
         const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -84,7 +91,7 @@
                                               const hidl_vec<uint8_t>& configData) override;
     Return<Result> close() override;
 
-    // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IBassBoostEffect follow.
+    // Methods from ::android::hardware::audio::effect::CPP_VERSION::IBassBoostEffect follow.
     Return<void> isStrengthSupported(isStrengthSupported_cb _hidl_cb) override;
     Return<Result> setStrength(uint16_t strength) override;
     Return<void> getStrength(getStrength_cb _hidl_cb) override;
@@ -96,8 +103,10 @@
 };
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
 }  // namespace android
+
+#endif  // ANDROID_HARDWARE_AUDIO_EFFECT_BASSBOOSTEFFECT_H
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.impl.h b/audio/effect/all-versions/default/Conversions.cpp
similarity index 86%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.impl.h
rename to audio/effect/all-versions/default/Conversions.cpp
index 0884d8f..50b0562 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.impl.h
+++ b/audio/effect/all-versions/default/Conversions.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,21 +14,24 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#include "Conversions.h"
+#include "HidlUtils.h"
+
+using ::android::hardware::audio::common::CPP_VERSION::HidlUtils;
 
 #include <memory.h>
 #include <stdio.h>
 
 #include <common/all-versions/VersionUtils.h>
 
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::HidlUtils;
+using ::android::hardware::audio::common::CPP_VERSION::HidlUtils;
 using ::android::hardware::audio::common::utils::EnumBitfield;
 
 namespace android {
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 void effectDescriptorFromHal(const effect_descriptor_t& halDescriptor,
@@ -52,7 +55,7 @@
 }
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.h b/audio/effect/all-versions/default/Conversions.h
similarity index 71%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.h
rename to audio/effect/all-versions/default/Conversions.h
index 3f9317f..75aab24 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.h
+++ b/audio/effect/all-versions/default/Conversions.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,10 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_CONVERSIONS_H_
+#define ANDROID_HARDWARE_AUDIO_EFFECT_CONVERSIONS_H_
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/types.h)
 
 #include <string>
 
@@ -24,18 +27,20 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor;
 
 void effectDescriptorFromHal(const effect_descriptor_t& halDescriptor,
                              EffectDescriptor* descriptor);
 std::string uuidToString(const effect_uuid_t& halUuid);
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
 }  // namespace android
+
+#endif  // ANDROID_HARDWARE_AUDIO_EFFECT_CONVERSIONS_H_
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/DownmixEffect.impl.h b/audio/effect/all-versions/default/DownmixEffect.cpp
similarity index 93%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/DownmixEffect.impl.h
rename to audio/effect/all-versions/default/DownmixEffect.cpp
index abef10e..94da70e 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/DownmixEffect.impl.h
+++ b/audio/effect/all-versions/default/DownmixEffect.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,9 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "Downmix_HAL"
+
+#include "DownmixEffect.h"
 
 #include <android/log.h>
 #include <system/audio_effects/effect_downmix.h>
@@ -25,14 +27,14 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 DownmixEffect::DownmixEffect(effect_handle_t handle) : mEffect(new Effect(handle)) {}
 
 DownmixEffect::~DownmixEffect() {}
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
 Return<Result> DownmixEffect::init() {
     return mEffect->init();
 }
@@ -159,7 +161,7 @@
     return mEffect->close();
 }
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IDownmixEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IDownmixEffect follow.
 Return<Result> DownmixEffect::setType(IDownmixEffect::Type preset) {
     return mEffect->setParam(DOWNMIX_PARAM_TYPE, static_cast<downmix_type_t>(preset));
 }
@@ -172,7 +174,7 @@
 }
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/DownmixEffect.h b/audio/effect/all-versions/default/DownmixEffect.h
similarity index 86%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/DownmixEffect.h
rename to audio/effect/all-versions/default/DownmixEffect.h
index dbbb64c..6d34c28 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/DownmixEffect.h
+++ b/audio/effect/all-versions/default/DownmixEffect.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_DOWNMIXEFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_DOWNMIXEFFECT_H
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IDownmixEffect.h)
+
+#include "Effect.h"
 
 #include <hidl/Status.h>
 
@@ -26,7 +31,7 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 using ::android::sp;
@@ -34,13 +39,13 @@
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IDownmixEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+using ::android::hardware::audio::effect::CPP_VERSION::IDownmixEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::Result;
 
 struct DownmixEffect : public IDownmixEffect {
     explicit DownmixEffect(effect_handle_t handle);
 
-    // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+    // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
     Return<Result> init() override;
     Return<Result> setConfig(
         const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -84,7 +89,7 @@
                                               const hidl_vec<uint8_t>& configData) override;
     Return<Result> close() override;
 
-    // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IDownmixEffect follow.
+    // Methods from ::android::hardware::audio::effect::CPP_VERSION::IDownmixEffect follow.
     Return<Result> setType(IDownmixEffect::Type preset) override;
     Return<void> getType(getType_cb _hidl_cb) override;
 
@@ -95,8 +100,10 @@
 };
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
 }  // namespace android
+
+#endif  // ANDROID_HARDWARE_AUDIO_EFFECT_DOWNMIXEFFECT_H
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/Effect.impl.h b/audio/effect/all-versions/default/Effect.cpp
similarity index 97%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/Effect.impl.h
rename to audio/effect/all-versions/default/Effect.cpp
index 61c9805..3e5148f 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/Effect.impl.h
+++ b/audio/effect/all-versions/default/Effect.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,14 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#include <memory.h>
+
+#define LOG_TAG "EffectHAL"
+#define ATRACE_TAG ATRACE_TAG_AUDIO
+
+#include "Conversions.h"
+#include "Effect.h"
+#include "common/all-versions/default/EffectMap.h"
 
 #include <memory.h>
 
@@ -30,13 +37,13 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioFormat;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::AudioChannelBitfield;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::MessageQueueFlagBits;
+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;
 
 namespace {
 
@@ -479,7 +486,7 @@
                                       &halParamBuffer[0]);
 }
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
 Return<Result> Effect::init() {
     return sendCommandReturningStatus(EFFECT_CMD_INIT, "INIT");
 }
@@ -707,7 +714,7 @@
 }
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/Effect.h b/audio/effect/all-versions/default/Effect.h
similarity index 88%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/Effect.h
rename to audio/effect/all-versions/default/Effect.h
index 0b62ccc..f6a12d9 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/Effect.h
+++ b/audio/effect/all-versions/default/Effect.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_EFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_EFFECT_H
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IEffect.h)
+
+#include "AudioBufferManager.h"
 
 #include <atomic>
 #include <memory>
@@ -34,7 +39,7 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 using ::android::sp;
@@ -42,20 +47,20 @@
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::Uuid;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::AudioDeviceBitfield;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectFeature;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+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;
 
 struct Effect : public IEffect {
     typedef MessageQueue<Result, kSynchronizedReadWrite> StatusMQ;
@@ -64,7 +69,7 @@
 
     explicit Effect(effect_handle_t handle);
 
-    // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+    // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
     Return<Result> init() override;
     Return<Result> setConfig(
         const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -234,8 +239,10 @@
 };
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
 }  // namespace android
+
+#endif  // ANDROID_HARDWARE_AUDIO_EFFECT_EFFECT_H
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/EffectsFactory.impl.h b/audio/effect/all-versions/default/EffectsFactory.cpp
similarity index 88%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/EffectsFactory.impl.h
rename to audio/effect/all-versions/default/EffectsFactory.cpp
index f3256f1..d2d8a46 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/EffectsFactory.impl.h
+++ b/audio/effect/all-versions/default/EffectsFactory.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,25 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "EffectFactoryHAL"
+#include "EffectsFactory.h"
+#include "AcousticEchoCancelerEffect.h"
+#include "AutomaticGainControlEffect.h"
+#include "BassBoostEffect.h"
+#include "Conversions.h"
+#include "DownmixEffect.h"
+#include "Effect.h"
+#include "EnvironmentalReverbEffect.h"
+#include "EqualizerEffect.h"
+#include "HidlUtils.h"
+#include "LoudnessEnhancerEffect.h"
+#include "NoiseSuppressionEffect.h"
+#include "PresetReverbEffect.h"
+#include "VirtualizerEffect.h"
+#include "VisualizerEffect.h"
+#include "common/all-versions/default/EffectMap.h"
+
+using ::android::hardware::audio::common::CPP_VERSION::HidlUtils;
 
 #include <android/log.h>
 #include <media/EffectsFactoryApi.h>
@@ -30,13 +48,13 @@
 #include <system/audio_effects/effect_virtualizer.h>
 #include <system/audio_effects/effect_visualizer.h>
 
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::HidlUtils;
+using ::android::hardware::audio::common::CPP_VERSION::HidlUtils;
 
 namespace android {
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 // static
@@ -69,7 +87,7 @@
     return new Effect(handle);
 }
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectsFactory follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffectsFactory follow.
 Return<void> EffectsFactory::getAllDescriptors(getAllDescriptors_cb _hidl_cb) {
     Result retval(Result::OK);
     hidl_vec<EffectDescriptor> result;
@@ -189,7 +207,7 @@
 }
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/EffectsFactory.h b/audio/effect/all-versions/default/EffectsFactory.h
similarity index 66%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/EffectsFactory.h
rename to audio/effect/all-versions/default/EffectsFactory.h
index dd37434..0cbfaa2 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/EffectsFactory.h
+++ b/audio/effect/all-versions/default/EffectsFactory.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,14 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_EFFECTSFACTORY_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_EFFECTSFACTORY_H
+
+#include <system/audio_effect.h>
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IEffectsFactory.h)
+
+#include <hidl/MQDescriptor.h>
 
 #include <hardware/audio_effect.h>
 #include <system/audio_effect.h>
@@ -26,7 +33,7 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 using ::android::sp;
@@ -34,20 +41,20 @@
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::Uuid;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectsFactory;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+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;
 
 struct EffectsFactory : public IEffectsFactory {
-    // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectsFactory follow.
+    // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffectsFactory follow.
     Return<void> getAllDescriptors(getAllDescriptors_cb _hidl_cb) override;
     Return<void> getDescriptor(const Uuid& uid, getDescriptor_cb _hidl_cb) override;
     Return<void> createEffect(const Uuid& uid, int32_t session, int32_t ioHandle,
                               createEffect_cb _hidl_cb) override;
     Return<void> debugDump(
-        const hidl_handle& fd);  //< in V2_0::IEffectsFactory only, alias of debug
+        const hidl_handle& fd);  //< in CPP_VERSION::IEffectsFactory only, alias of debug
     Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
 
    private:
@@ -58,8 +65,10 @@
 extern "C" IEffectsFactory* HIDL_FETCH_IEffectsFactory(const char* name);
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
 }  // namespace android
+
+#endif  // ANDROID_HARDWARE_AUDIO_EFFECT_EFFECTSFACTORY_H
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/EnvironmentalReverbEffect.impl.h b/audio/effect/all-versions/default/EnvironmentalReverbEffect.cpp
similarity index 96%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/EnvironmentalReverbEffect.impl.h
rename to audio/effect/all-versions/default/EnvironmentalReverbEffect.cpp
index 39a4092..1ade7b8 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/EnvironmentalReverbEffect.impl.h
+++ b/audio/effect/all-versions/default/EnvironmentalReverbEffect.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,10 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "EnvReverb_HAL"
+#include <android/log.h>
+
+#include "EnvironmentalReverbEffect.h"
 
 #include <android/log.h>
 
@@ -24,7 +27,7 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 EnvironmentalReverbEffect::EnvironmentalReverbEffect(effect_handle_t handle)
@@ -60,7 +63,7 @@
     halProperties->density = properties.density;
 }
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
 Return<Result> EnvironmentalReverbEffect::init() {
     return mEffect->init();
 }
@@ -190,7 +193,7 @@
     return mEffect->close();
 }
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEnvironmentalReverbEffect
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEnvironmentalReverbEffect
 // follow.
 Return<Result> EnvironmentalReverbEffect::setBypass(bool bypass) {
     return mEffect->setParam(REVERB_PARAM_BYPASS, bypass);
@@ -297,7 +300,7 @@
 }
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/EnvironmentalReverbEffect.h b/audio/effect/all-versions/default/EnvironmentalReverbEffect.h
similarity index 80%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/EnvironmentalReverbEffect.h
rename to audio/effect/all-versions/default/EnvironmentalReverbEffect.h
index 2215cf8..7e6597b 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/EnvironmentalReverbEffect.h
+++ b/audio/effect/all-versions/default/EnvironmentalReverbEffect.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,14 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_ENVIRONMENTALREVERBEFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_ENVIRONMENTALREVERBEFFECT_H
+
+#include <system/audio_effects/effect_environmentalreverb.h>
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IEnvironmentalReverbEffect.h)
+
+#include "Effect.h"
 
 #include <system/audio_effects/effect_environmentalreverb.h>
 
@@ -28,7 +35,7 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 using ::android::sp;
@@ -36,23 +43,23 @@
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEnvironmentalReverbEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+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;
 
 struct EnvironmentalReverbEffect : public IEnvironmentalReverbEffect {
     explicit EnvironmentalReverbEffect(effect_handle_t handle);
 
-    // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+    // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
     Return<Result> init() override;
     Return<Result> setConfig(
         const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -97,7 +104,7 @@
     Return<Result> close() override;
 
     // Methods from
-    // ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEnvironmentalReverbEffect follow.
+    // ::android::hardware::audio::effect::CPP_VERSION::IEnvironmentalReverbEffect follow.
     Return<Result> setBypass(bool bypass) override;
     Return<void> getBypass(getBypass_cb _hidl_cb) override;
     Return<Result> setRoomLevel(int16_t roomLevel) override;
@@ -136,8 +143,10 @@
 };
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
 }  // namespace android
+
+#endif  // ANDROID_HARDWARE_AUDIO_EFFECT_ENVIRONMENTALREVERBEFFECT_H
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/EqualizerEffect.impl.h b/audio/effect/all-versions/default/EqualizerEffect.cpp
similarity index 96%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/EqualizerEffect.impl.h
rename to audio/effect/all-versions/default/EqualizerEffect.cpp
index db6bed8..f6177b7 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/EqualizerEffect.impl.h
+++ b/audio/effect/all-versions/default/EqualizerEffect.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,9 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "Equalizer_HAL"
+
+#include "EqualizerEffect.h"
 
 #include <memory.h>
 
@@ -26,7 +28,7 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 EqualizerEffect::EqualizerEffect(effect_handle_t handle) : mEffect(new Effect(handle)) {}
@@ -55,7 +57,7 @@
     return halBuffer;
 }
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
 Return<Result> EqualizerEffect::init() {
     return mEffect->init();
 }
@@ -182,7 +184,7 @@
     return mEffect->close();
 }
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEqualizerEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEqualizerEffect follow.
 Return<void> EqualizerEffect::getNumBands(getNumBands_cb _hidl_cb) {
     return mEffect->getIntegerParam(EQ_PARAM_NUM_BANDS, _hidl_cb);
 }
@@ -285,7 +287,7 @@
 }
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/EqualizerEffect.h b/audio/effect/all-versions/default/EqualizerEffect.h
similarity index 79%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/EqualizerEffect.h
rename to audio/effect/all-versions/default/EqualizerEffect.h
index e150465..5e1e2b9 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/EqualizerEffect.h
+++ b/audio/effect/all-versions/default/EqualizerEffect.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_EQUALIZEREFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_EQUALIZEREFFECT_H
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IEqualizerEffect.h)
+
+#include "Effect.h"
 
 #include <vector>
 
@@ -30,7 +35,7 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 using ::android::sp;
@@ -38,23 +43,23 @@
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEqualizerEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+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::IEqualizerEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::Result;
 
 struct EqualizerEffect : public IEqualizerEffect {
     explicit EqualizerEffect(effect_handle_t handle);
 
-    // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+    // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
     Return<Result> init() override;
     Return<Result> setConfig(
         const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -98,7 +103,7 @@
                                               const hidl_vec<uint8_t>& configData) override;
     Return<Result> close() override;
 
-    // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEqualizerEffect follow.
+    // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEqualizerEffect follow.
     Return<void> getNumBands(getNumBands_cb _hidl_cb) override;
     Return<void> getLevelRange(getLevelRange_cb _hidl_cb) override;
     Return<Result> setBandLevel(uint16_t band, int16_t level) override;
@@ -124,8 +129,10 @@
 };
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
 }  // namespace android
+
+#endif  // ANDROID_HARDWARE_AUDIO_EFFECT_EQUALIZEREFFECT_H
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/LoudnessEnhancerEffect.impl.h b/audio/effect/all-versions/default/LoudnessEnhancerEffect.cpp
similarity index 94%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/LoudnessEnhancerEffect.impl.h
rename to audio/effect/all-versions/default/LoudnessEnhancerEffect.cpp
index 88210e9..6918bdf 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/LoudnessEnhancerEffect.impl.h
+++ b/audio/effect/all-versions/default/LoudnessEnhancerEffect.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,9 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "LoudnessEnhancer_HAL"
+
+#include "LoudnessEnhancerEffect.h"
 
 #include <system/audio_effects/effect_loudnessenhancer.h>
 
@@ -27,7 +29,7 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 LoudnessEnhancerEffect::LoudnessEnhancerEffect(effect_handle_t handle)
@@ -35,7 +37,7 @@
 
 LoudnessEnhancerEffect::~LoudnessEnhancerEffect() {}
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
 Return<Result> LoudnessEnhancerEffect::init() {
     return mEffect->init();
 }
@@ -162,7 +164,7 @@
     return mEffect->close();
 }
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::ILoudnessEnhancerEffect
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::ILoudnessEnhancerEffect
 // follow.
 Return<Result> LoudnessEnhancerEffect::setTargetGain(int32_t targetGainMb) {
     return mEffect->setParam(LOUDNESS_ENHANCER_DEFAULT_TARGET_GAIN_MB, targetGainMb);
@@ -182,7 +184,7 @@
 }
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/LoudnessEnhancerEffect.h b/audio/effect/all-versions/default/LoudnessEnhancerEffect.h
similarity index 75%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/LoudnessEnhancerEffect.h
rename to audio/effect/all-versions/default/LoudnessEnhancerEffect.h
index 182e791..6eb8a8c 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/LoudnessEnhancerEffect.h
+++ b/audio/effect/all-versions/default/LoudnessEnhancerEffect.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_LOUDNESSENHANCEREFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_LOUDNESSENHANCEREFFECT_H
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/ILoudnessEnhancerEffect.h)
+
+#include "Effect.h"
 
 #include <hidl/Status.h>
 
@@ -26,7 +31,7 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 using ::android::sp;
@@ -34,23 +39,23 @@
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::ILoudnessEnhancerEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+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;
 
 struct LoudnessEnhancerEffect : public ILoudnessEnhancerEffect {
     explicit LoudnessEnhancerEffect(effect_handle_t handle);
 
-    // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+    // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
     Return<Result> init() override;
     Return<Result> setConfig(
         const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -94,7 +99,7 @@
                                               const hidl_vec<uint8_t>& configData) override;
     Return<Result> close() override;
 
-    // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::ILoudnessEnhancerEffect
+    // Methods from ::android::hardware::audio::effect::CPP_VERSION::ILoudnessEnhancerEffect
     // follow.
     Return<Result> setTargetGain(int32_t targetGainMb) override;
     Return<void> getTargetGain(getTargetGain_cb _hidl_cb) override;
@@ -106,8 +111,10 @@
 };
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
 }  // namespace android
+
+#endif  // ANDROID_HARDWARE_AUDIO_EFFECT_LOUDNESSENHANCEREFFECT_H
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/NoiseSuppressionEffect.impl.h b/audio/effect/all-versions/default/NoiseSuppressionEffect.cpp
similarity index 95%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/NoiseSuppressionEffect.impl.h
rename to audio/effect/all-versions/default/NoiseSuppressionEffect.cpp
index f32399c..4756719 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/NoiseSuppressionEffect.impl.h
+++ b/audio/effect/all-versions/default/NoiseSuppressionEffect.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,9 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "NS_Effect_HAL"
+
+#include "NoiseSuppressionEffect.h"
 
 #include <android/log.h>
 
@@ -24,7 +26,7 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 NoiseSuppressionEffect::NoiseSuppressionEffect(effect_handle_t handle)
@@ -44,7 +46,7 @@
     halProperties->type = static_cast<uint32_t>(properties.type);
 }
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
 Return<Result> NoiseSuppressionEffect::init() {
     return mEffect->init();
 }
@@ -171,7 +173,7 @@
     return mEffect->close();
 }
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::INoiseSuppressionEffect
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::INoiseSuppressionEffect
 // follow.
 Return<Result> NoiseSuppressionEffect::setSuppressionLevel(INoiseSuppressionEffect::Level level) {
     return mEffect->setParam(NS_PARAM_LEVEL, static_cast<int32_t>(level));
@@ -212,7 +214,7 @@
 }
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/NoiseSuppressionEffect.h b/audio/effect/all-versions/default/NoiseSuppressionEffect.h
similarity index 77%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/NoiseSuppressionEffect.h
rename to audio/effect/all-versions/default/NoiseSuppressionEffect.h
index c70d768..af62dd1 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/NoiseSuppressionEffect.h
+++ b/audio/effect/all-versions/default/NoiseSuppressionEffect.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_NOISESUPPRESSIONEFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_NOISESUPPRESSIONEFFECT_H
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/INoiseSuppressionEffect.h)
+
+#include "Effect.h"
 
 #include <system/audio_effects/effect_ns.h>
 
@@ -28,7 +33,7 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 using ::android::sp;
@@ -36,23 +41,23 @@
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::INoiseSuppressionEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+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;
 
 struct NoiseSuppressionEffect : public INoiseSuppressionEffect {
     explicit NoiseSuppressionEffect(effect_handle_t handle);
 
-    // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+    // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
     Return<Result> init() override;
     Return<Result> setConfig(
         const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -96,7 +101,7 @@
                                               const hidl_vec<uint8_t>& configData) override;
     Return<Result> close() override;
 
-    // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::INoiseSuppressionEffect
+    // Methods from ::android::hardware::audio::effect::CPP_VERSION::INoiseSuppressionEffect
     // follow.
     Return<Result> setSuppressionLevel(INoiseSuppressionEffect::Level level) override;
     Return<void> getSuppressionLevel(getSuppressionLevel_cb _hidl_cb) override;
@@ -118,8 +123,10 @@
 };
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
 }  // namespace android
+
+#endif  // ANDROID_HARDWARE_AUDIO_EFFECT_NOISESUPPRESSIONEFFECT_H
diff --git a/audio/effect/all-versions/default/OWNERS b/audio/effect/all-versions/default/OWNERS
new file mode 100644
index 0000000..6fdc97c
--- /dev/null
+++ b/audio/effect/all-versions/default/OWNERS
@@ -0,0 +1,3 @@
+elaurent@google.com
+krocard@google.com
+mnaganov@google.com
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/PresetReverbEffect.impl.h b/audio/effect/all-versions/default/PresetReverbEffect.cpp
similarity index 93%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/PresetReverbEffect.impl.h
rename to audio/effect/all-versions/default/PresetReverbEffect.cpp
index eab68fb..97723f5 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/PresetReverbEffect.impl.h
+++ b/audio/effect/all-versions/default/PresetReverbEffect.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,9 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "PresetReverb_HAL"
+
+#include "PresetReverbEffect.h"
 
 #include <android/log.h>
 #include <system/audio_effects/effect_presetreverb.h>
@@ -25,14 +27,14 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 PresetReverbEffect::PresetReverbEffect(effect_handle_t handle) : mEffect(new Effect(handle)) {}
 
 PresetReverbEffect::~PresetReverbEffect() {}
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
 Return<Result> PresetReverbEffect::init() {
     return mEffect->init();
 }
@@ -159,7 +161,7 @@
     return mEffect->close();
 }
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IPresetReverbEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IPresetReverbEffect follow.
 Return<Result> PresetReverbEffect::setPreset(IPresetReverbEffect::Preset preset) {
     return mEffect->setParam(REVERB_PARAM_PRESET, static_cast<t_reverb_presets>(preset));
 }
@@ -172,7 +174,7 @@
 }
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/PresetReverbEffect.h b/audio/effect/all-versions/default/PresetReverbEffect.h
similarity index 75%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/PresetReverbEffect.h
rename to audio/effect/all-versions/default/PresetReverbEffect.h
index e5d77f0..aa864b0 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/PresetReverbEffect.h
+++ b/audio/effect/all-versions/default/PresetReverbEffect.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_PRESETREVERBEFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_PRESETREVERBEFFECT_H
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IPresetReverbEffect.h)
+
+#include "Effect.h"
 
 #include <hidl/Status.h>
 
@@ -26,7 +31,7 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 using ::android::sp;
@@ -34,23 +39,23 @@
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IPresetReverbEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+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;
 
 struct PresetReverbEffect : public IPresetReverbEffect {
     explicit PresetReverbEffect(effect_handle_t handle);
 
-    // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+    // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
     Return<Result> init() override;
     Return<Result> setConfig(
         const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -94,7 +99,7 @@
                                               const hidl_vec<uint8_t>& configData) override;
     Return<Result> close() override;
 
-    // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IPresetReverbEffect
+    // Methods from ::android::hardware::audio::effect::CPP_VERSION::IPresetReverbEffect
     // follow.
     Return<Result> setPreset(IPresetReverbEffect::Preset preset) override;
     Return<void> getPreset(getPreset_cb _hidl_cb) override;
@@ -106,8 +111,10 @@
 };
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
 }  // namespace android
+
+#endif  // ANDROID_HARDWARE_AUDIO_EFFECT_PRESETREVERBEFFECT_H
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/VirtualizerEffect.impl.h b/audio/effect/all-versions/default/VirtualizerEffect.cpp
similarity index 95%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/VirtualizerEffect.impl.h
rename to audio/effect/all-versions/default/VirtualizerEffect.cpp
index 23b09a89..4d597c7 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/VirtualizerEffect.impl.h
+++ b/audio/effect/all-versions/default/VirtualizerEffect.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,9 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "Virtualizer_HAL"
+
+#include "VirtualizerEffect.h"
 
 #include <memory.h>
 
@@ -27,7 +29,7 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 VirtualizerEffect::VirtualizerEffect(effect_handle_t handle) : mEffect(new Effect(handle)) {}
@@ -44,7 +46,7 @@
     }
 }
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
 Return<Result> VirtualizerEffect::init() {
     return mEffect->init();
 }
@@ -171,7 +173,7 @@
     return mEffect->close();
 }
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IVirtualizerEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IVirtualizerEffect follow.
 Return<bool> VirtualizerEffect::isStrengthSupported() {
     bool halSupported = false;
     mEffect->getParam(VIRTUALIZER_PARAM_STRENGTH_SUPPORTED, halSupported);
@@ -224,7 +226,7 @@
 }
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/VirtualizerEffect.h b/audio/effect/all-versions/default/VirtualizerEffect.h
similarity index 75%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/VirtualizerEffect.h
rename to audio/effect/all-versions/default/VirtualizerEffect.h
index 544db1e..87b53d6 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/VirtualizerEffect.h
+++ b/audio/effect/all-versions/default/VirtualizerEffect.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_VIRTUALIZEREFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_VIRTUALIZEREFFECT_H
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IVirtualizerEffect.h)
+
+#include "Effect.h"
 
 #include <hidl/Status.h>
 
@@ -26,7 +31,7 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 using ::android::sp;
@@ -34,25 +39,25 @@
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::AudioChannelBitfield;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IVirtualizerEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+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;
 
 struct VirtualizerEffect : public IVirtualizerEffect {
     explicit VirtualizerEffect(effect_handle_t handle);
 
-    // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+    // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
     Return<Result> init() override;
     Return<Result> setConfig(
         const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -96,7 +101,7 @@
                                               const hidl_vec<uint8_t>& configData) override;
     Return<Result> close() override;
 
-    // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IVirtualizerEffect
+    // Methods from ::android::hardware::audio::effect::CPP_VERSION::IVirtualizerEffect
     // follow.
     Return<bool> isStrengthSupported() override;
     Return<Result> setStrength(uint16_t strength) override;
@@ -116,8 +121,10 @@
 };
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
 }  // namespace android
+
+#endif  // ANDROID_HARDWARE_AUDIO_EFFECT_VIRTUALIZEREFFECT_H
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/VisualizerEffect.impl.h b/audio/effect/all-versions/default/VisualizerEffect.cpp
similarity index 95%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/VisualizerEffect.impl.h
rename to audio/effect/all-versions/default/VisualizerEffect.cpp
index 9f2195b..77bf46b 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/VisualizerEffect.impl.h
+++ b/audio/effect/all-versions/default/VisualizerEffect.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,9 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "Visualizer_HAL"
+
+#include "VisualizerEffect.h"
 
 #include <android/log.h>
 #include <system/audio_effects/effect_visualizer.h>
@@ -25,7 +27,7 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 VisualizerEffect::VisualizerEffect(effect_handle_t handle)
@@ -33,7 +35,7 @@
 
 VisualizerEffect::~VisualizerEffect() {}
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
 Return<Result> VisualizerEffect::init() {
     return mEffect->init();
 }
@@ -160,7 +162,7 @@
     return mEffect->close();
 }
 
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IVisualizerEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IVisualizerEffect follow.
 Return<Result> VisualizerEffect::setCaptureSize(uint16_t captureSize) {
     Result retval = mEffect->setParam(VISUALIZER_PARAM_CAPTURE_SIZE, captureSize);
     if (retval == Result::OK) {
@@ -247,7 +249,7 @@
 }
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/VisualizerEffect.h b/audio/effect/all-versions/default/VisualizerEffect.h
similarity index 77%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/VisualizerEffect.h
rename to audio/effect/all-versions/default/VisualizerEffect.h
index e207fc0..0a13a2b 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/VisualizerEffect.h
+++ b/audio/effect/all-versions/default/VisualizerEffect.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
  * limitations under the License.
  */
 
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_VISUALIZEREFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_VISUALIZEREFFECT_H
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IVisualizerEffect.h)
+
+#include "Effect.h"
 
 #include <hidl/Status.h>
 
@@ -26,7 +31,7 @@
 namespace hardware {
 namespace audio {
 namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
 namespace implementation {
 
 using ::android::sp;
@@ -34,23 +39,23 @@
 using ::android::hardware::hidl_vec;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IVisualizerEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+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;
 
 struct VisualizerEffect : public IVisualizerEffect {
     explicit VisualizerEffect(effect_handle_t handle);
 
-    // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+    // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
     Return<Result> init() override;
     Return<Result> setConfig(
         const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -94,7 +99,7 @@
                                               const hidl_vec<uint8_t>& configData) override;
     Return<Result> close() override;
 
-    // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IVisualizerEffect follow.
+    // Methods from ::android::hardware::audio::effect::CPP_VERSION::IVisualizerEffect follow.
     Return<Result> setCaptureSize(uint16_t captureSize) override;
     Return<void> getCaptureSize(getCaptureSize_cb _hidl_cb) override;
     Return<Result> setScalingMode(IVisualizerEffect::ScalingMode scalingMode) override;
@@ -115,8 +120,10 @@
 };
 
 }  // namespace implementation
-}  // namespace AUDIO_HAL_VERSION
+}  // namespace CPP_VERSION
 }  // namespace effect
 }  // namespace audio
 }  // namespace hardware
 }  // namespace android
+
+#endif  // ANDROID_HARDWARE_AUDIO_EFFECT_VISUALIZEREFFECT_H