Audio HAL: Align V2 and V4 VTS

It was thought that the V2 VTS were not going to be supported after V4
VTS were created. Thus a large portion of the code was copy paste and
modified.

That assumption ended up wrong as a lot of OEM reported bugs that needed
to be fixed in both versions.

As a result align the code of both version VTS as much as possible.
The code will be merged in a follow up patch.

Bug: 118203066
Test: compile
Change-Id: I994232db237b5d7c52e7d796f199ab3c6eec21f4
Signed-off-by: Kevin Rocard <krocard@google.com>
diff --git a/audio/effect/2.0/vts/functional/VtsHalAudioEffectTargetTest.cpp b/audio/effect/2.0/vts/functional/VtsHalAudioEffectTargetTest.cpp
index ea755ae..078e420 100644
--- a/audio/effect/2.0/vts/functional/VtsHalAudioEffectTargetTest.cpp
+++ b/audio/effect/2.0/vts/functional/VtsHalAudioEffectTargetTest.cpp
@@ -26,6 +26,8 @@
 #include <android/hidl/allocator/1.0/IAllocator.h>
 #include <android/hidl/memory/1.0/IMemory.h>
 
+#include <common/all-versions/VersionUtils.h>
+
 #include <VtsHalHidlTargetTestBase.h>
 #include <VtsHalHidlTargetTestEnvBase.h>
 
@@ -37,6 +39,7 @@
 using android::hardware::MQDescriptorSync;
 using android::hardware::Return;
 using android::hardware::Void;
+using android::hardware::audio::common::utils::mkEnumBitfield;
 using android::hardware::audio::common::V2_0::AudioDevice;
 using android::hardware::audio::common::V2_0::AudioHandleConsts;
 using android::hardware::audio::common::V2_0::AudioMode;
@@ -396,7 +399,7 @@
 
 TEST_F(AudioEffectHidlTest, SetDevice) {
     description("Verify that SetDevice works for an output chain effect");
-    Return<Result> ret = effect->setDevice(AudioDevice::OUT_SPEAKER);
+    Return<Result> ret = effect->setDevice(mkEnumBitfield(AudioDevice::OUT_SPEAKER));
     EXPECT_TRUE(ret.isOk());
     EXPECT_EQ(Result::OK, ret);
 }
@@ -446,7 +449,7 @@
 
 TEST_F(AudioEffectHidlTest, SetInputDevice) {
     description("Verify that SetInputDevice does not crash");
-    Return<Result> ret = effect->setInputDevice(AudioDevice::IN_BUILTIN_MIC);
+    Return<Result> ret = effect->setInputDevice(mkEnumBitfield(AudioDevice::IN_BUILTIN_MIC));
     EXPECT_TRUE(ret.isOk());
 }