Audio HAL: Cleanup implementation
Rename files so that, if they are in a X.0 folder, their name does
not contain that version number. That allows for easier copy paste
when creating a new version.
Conversion.h was included from the all-versions instead of the X.0
headers. This in incoherent with the other headers.
Add VersionMacro.h that will be used in the follow up patch.
Also remove shim from VNDK as only stable ABI&API libraries should be
part of it.
Test: Compile
Bug: 118203066
Change-Id: I9cd77b3df5ccede5ae51c3cc94fab5939c51d9ef
Signed-off-by: Kevin Rocard <krocard@google.com>
diff --git a/audio/common/all-versions/default/Android.bp b/audio/common/all-versions/default/Android.bp
index 4a27bb7..c24f4b0 100644
--- a/audio/common/all-versions/default/Android.bp
+++ b/audio/common/all-versions/default/Android.bp
@@ -17,9 +17,6 @@
name: "android.hardware.audio.common-util",
defaults: ["hidl_defaults"],
vendor_available: true,
- vndk: {
- enabled: true,
- },
srcs: [
"EffectMap.cpp",
],
diff --git a/audio/common/all-versions/util/Android.bp b/audio/common/all-versions/util/Android.bp
index 5d33a3a..3c7e62e 100644
--- a/audio/common/all-versions/util/Android.bp
+++ b/audio/common/all-versions/util/Android.bp
@@ -2,9 +2,6 @@
name: "android.hardware.audio.common.util@all-versions",
defaults: ["hidl_defaults"],
vendor_available: true,
- vndk: {
- enabled: true,
- },
export_include_dirs: ["include"],
}
diff --git a/audio/common/all-versions/util/include/common/all-versions/VersionMacro.h b/audio/common/all-versions/util/include/common/all-versions/VersionMacro.h
new file mode 100644
index 0000000..dc54cee
--- /dev/null
+++ b/audio/common/all-versions/util/include/common/all-versions/VersionMacro.h
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_VERSION_MACRO_H
+#define ANDROID_HARDWARE_VERSION_MACRO_H
+
+#if !defined(MAJOR_VERSION) || !defined(MINOR_VERSION)
+#error "MAJOR_VERSION and MINOR_VERSION must be defined"
+#endif
+
+/** Allows macro expansion for x and add surrounding `<>`.
+ * Is intended to be used for version dependant includes as
+ * `#include` do not macro expand if starting with < or "
+ * Example usage:
+ * #include PATH(path/to/FILE_VERSION/file)
+ * @note: uses the implementation-define "Computed Includes" feature.
+ */
+#define PATH(x) <x>
+
+#define CONCAT_3(a, b, c) a##b##c
+#define EXPAND_CONCAT_3(a, b, c) CONCAT_3(a, b, c)
+/** The directory name of the version: <major>.<minor> */
+#define FILE_VERSION EXPAND_CONCAT_3(MAJOR_VERSION, ., MINOR_VERSION)
+
+#define CONCAT_4(a, b, c, d) a##b##c##d
+#define EXPAND_CONCAT_4(a, b, c, d) CONCAT_4(a, b, c, d)
+/** The c++ namespace of the version: V<major>_<minor> */
+#define CPP_VERSION EXPAND_CONCAT_4(V, MAJOR_VERSION, _, MINOR_VERSION)
+
+#endif // ANDROID_HARDWARE_VERSION_MACRO_H
diff --git a/audio/core/2.0/default/ParametersUtil.cpp b/audio/core/2.0/default/ParametersUtil.cpp
index 963e291..602b212 100644
--- a/audio/core/2.0/default/ParametersUtil.cpp
+++ b/audio/core/2.0/default/ParametersUtil.cpp
@@ -15,6 +15,7 @@
*/
#include "core/2.0/default/ParametersUtil.h"
+#include "core/2.0/default/Conversions.h"
#include "core/2.0/default/Util.h"
#define AUDIO_HAL_VERSION V2_0
diff --git a/audio/core/2.0/default/StreamIn.cpp b/audio/core/2.0/default/StreamIn.cpp
index 2021df1..cfd2abb 100644
--- a/audio/core/2.0/default/StreamIn.cpp
+++ b/audio/core/2.0/default/StreamIn.cpp
@@ -17,6 +17,7 @@
#define LOG_TAG "StreamInHAL"
#include "core/2.0/default/StreamIn.h"
+#include "core/2.0/default/Conversions.h"
#include "core/2.0/default/Util.h"
#define AUDIO_HAL_VERSION V2_0
diff --git a/audio/core/4.0/default/ParametersUtil.cpp b/audio/core/4.0/default/ParametersUtil.cpp
index 2cc9fb5..b90a8e7 100644
--- a/audio/core/4.0/default/ParametersUtil.cpp
+++ b/audio/core/4.0/default/ParametersUtil.cpp
@@ -15,6 +15,7 @@
*/
#include "core/4.0/default/ParametersUtil.h"
+#include "core/4.0/default/Conversions.h"
#include "core/4.0/default/Util.h"
#define AUDIO_HAL_VERSION V4_0
diff --git a/audio/core/4.0/default/StreamIn.cpp b/audio/core/4.0/default/StreamIn.cpp
index 718bd25..11a7a80 100644
--- a/audio/core/4.0/default/StreamIn.cpp
+++ b/audio/core/4.0/default/StreamIn.cpp
@@ -17,6 +17,7 @@
#define LOG_TAG "StreamInHAL"
#include "core/4.0/default/StreamIn.h"
+#include "core/4.0/default/Conversions.h"
#include "core/4.0/default/Util.h"
#define AUDIO_HAL_VERSION V4_0
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/ParametersUtil.impl.h b/audio/core/all-versions/default/include/core/all-versions/default/ParametersUtil.impl.h
index 34bc53c..39bd66a 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/ParametersUtil.impl.h
+++ b/audio/core/all-versions/default/include/core/all-versions/default/ParametersUtil.impl.h
@@ -15,7 +15,6 @@
*/
#include <common/all-versions/IncludeGuard.h>
-#include <core/all-versions/default/Conversions.h>
#include <system/audio.h>
namespace android {
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/Stream.impl.h b/audio/core/all-versions/default/include/core/all-versions/default/Stream.impl.h
index 381a441..3066800 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/Stream.impl.h
+++ b/audio/core/all-versions/default/include/core/all-versions/default/Stream.impl.h
@@ -108,7 +108,7 @@
}
#ifdef AUDIO_HAL_VERSION_2_0
_hidl_cb(sampleRates);
-#elif AUDIO_HAL_VERSION_4_0
+#elif defined(AUDIO_HAL_VERSION_4_0)
_hidl_cb(result, sampleRates);
#endif
return Void();
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/StreamIn.impl.h b/audio/core/all-versions/default/include/core/all-versions/default/StreamIn.impl.h
index aeb58db..4eb4ef9 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/StreamIn.impl.h
+++ b/audio/core/all-versions/default/include/core/all-versions/default/StreamIn.impl.h
@@ -25,7 +25,7 @@
#include <memory>
using ::android::hardware::audio::AUDIO_HAL_VERSION::MessageQueueFlagBits;
-#include "Conversions.h"
+using ::android::hardware::audio::common::AUDIO_HAL_VERSION::ThreadInfo;
namespace android {
namespace hardware {
@@ -33,8 +33,6 @@
namespace AUDIO_HAL_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::ThreadInfo;
-
namespace {
class ReadThread : public Thread {
diff --git a/audio/effect/2.0/vts/functional/Android.bp b/audio/effect/2.0/vts/functional/Android.bp
index 1760e01..f3fefc3 100644
--- a/audio/effect/2.0/vts/functional/Android.bp
+++ b/audio/effect/2.0/vts/functional/Android.bp
@@ -18,7 +18,7 @@
name: "VtsHalAudioEffectV2_0TargetTest",
defaults: ["VtsHalTargetTestDefaults"],
srcs: [
- "VtsHalAudioEffectV2_0TargetTest.cpp",
+ "VtsHalAudioEffectTargetTest.cpp",
"ValidateAudioEffectsConfiguration.cpp"
],
static_libs: [
diff --git a/audio/effect/2.0/vts/functional/VtsHalAudioEffectV2_0TargetTest.cpp b/audio/effect/2.0/vts/functional/VtsHalAudioEffectTargetTest.cpp
similarity index 100%
rename from audio/effect/2.0/vts/functional/VtsHalAudioEffectV2_0TargetTest.cpp
rename to audio/effect/2.0/vts/functional/VtsHalAudioEffectTargetTest.cpp
diff --git a/audio/effect/2.0/xml/audio_effects_conf_V2_0.xsd b/audio/effect/2.0/xml/audio_effects_conf.xsd
similarity index 100%
rename from audio/effect/2.0/xml/audio_effects_conf_V2_0.xsd
rename to audio/effect/2.0/xml/audio_effects_conf.xsd
diff --git a/audio/effect/4.0/vts/functional/Android.bp b/audio/effect/4.0/vts/functional/Android.bp
index d6f8643..4589e51 100644
--- a/audio/effect/4.0/vts/functional/Android.bp
+++ b/audio/effect/4.0/vts/functional/Android.bp
@@ -18,7 +18,7 @@
name: "VtsHalAudioEffectV4_0TargetTest",
defaults: ["VtsHalTargetTestDefaults"],
srcs: [
- "VtsHalAudioEffectV4_0TargetTest.cpp",
+ "VtsHalAudioEffectTargetTest.cpp",
"ValidateAudioEffectsConfiguration.cpp"
],
static_libs: [
diff --git a/audio/effect/4.0/vts/functional/VtsHalAudioEffectV4_0TargetTest.cpp b/audio/effect/4.0/vts/functional/VtsHalAudioEffectTargetTest.cpp
similarity index 100%
rename from audio/effect/4.0/vts/functional/VtsHalAudioEffectV4_0TargetTest.cpp
rename to audio/effect/4.0/vts/functional/VtsHalAudioEffectTargetTest.cpp
diff --git a/audio/effect/4.0/xml/audio_effects_conf.xsd b/audio/effect/4.0/xml/audio_effects_conf.xsd
new file mode 120000
index 0000000..9d85fa7
--- /dev/null
+++ b/audio/effect/4.0/xml/audio_effects_conf.xsd
@@ -0,0 +1 @@
+../../2.0/xml/audio_effects_conf.xsd
\ No newline at end of file
diff --git a/audio/effect/4.0/xml/audio_effects_conf_V4_0.xsd b/audio/effect/4.0/xml/audio_effects_conf_V4_0.xsd
deleted file mode 120000
index 82d569a..0000000
--- a/audio/effect/4.0/xml/audio_effects_conf_V4_0.xsd
+++ /dev/null
@@ -1 +0,0 @@
-../../2.0/xml/audio_effects_conf_V2_0.xsd
\ No newline at end of file