Audio V4: Introduce 4.0 shim to HIDL

The difference between the 2.0 and the 4.0 is very small
by design and most of the modification have been made in a
retro compatible way
The intent is to be able to merge the two implementation
but it could not be done in this patch due to time constrains.

Bug: 38184704
Test: compile
Change-Id: I4738928313b7fd1f6332c0f22bb802d4fba41d82
Signed-off-by: Kevin Rocard <krocard@google.com>
diff --git a/media/libaudiohal/4.0/EffectHalHidl.cpp b/media/libaudiohal/4.0/EffectHalHidl.cpp
index 32d5cea..c99c4c8 100644
--- a/media/libaudiohal/4.0/EffectHalHidl.cpp
+++ b/media/libaudiohal/4.0/EffectHalHidl.cpp
@@ -17,6 +17,7 @@
 #define LOG_TAG "EffectHalHidl"
 //#define LOG_NDEBUG 0
 
+#include <common/all-versions/VersionUtils.h>
 #include <hwbinder/IPCThreadState.h>
 #include <media/EffectsFactoryApi.h>
 #include <utils/Log.h>
@@ -34,6 +35,7 @@
 using ::android::hardware::audio::common::V4_0::HidlUtils;
 using ::android::hardware::audio::common::V4_0::AudioChannelMask;
 using ::android::hardware::audio::common::V4_0::AudioFormat;
+using ::android::hardware::audio::common::utils::mkEnumConverter;
 using ::android::hardware::hidl_vec;
 using ::android::hardware::MQDescriptorSync;
 using ::android::hardware::Return;
@@ -76,10 +78,10 @@
 void EffectHalHidl::effectBufferConfigFromHal(
         const buffer_config_t& halConfig, EffectBufferConfig* config) {
     config->samplingRateHz = halConfig.samplingRate;
-    config->channels = AudioChannelMask(halConfig.channels);
+    config->channels = mkEnumConverter<AudioChannelMask>(halConfig.channels);
     config->format = AudioFormat(halConfig.format);
     config->accessMode = EffectBufferAccess(halConfig.accessMode);
-    config->mask = EffectConfigParameters(halConfig.mask);
+    config->mask = mkEnumConverter<EffectConfigParameters>(halConfig.mask);
 }
 
 // static