Audio V4: Make device default wrapper device independent
Bug: 38184704
Test: compile
Change-Id: I077d2d6176ba5d60c1994345b3164641ed5b4608
Signed-off-by: Kevin Rocard <krocard@google.com>
diff --git a/audio/common/all-versions/util/Android.bp b/audio/common/all-versions/util/Android.bp
new file mode 100644
index 0000000..5d33a3a
--- /dev/null
+++ b/audio/common/all-versions/util/Android.bp
@@ -0,0 +1,10 @@
+cc_library_headers {
+ 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/IncludeGuard.h b/audio/common/all-versions/util/include/common/all-versions/IncludeGuard.h
new file mode 100644
index 0000000..2d54816
--- /dev/null
+++ b/audio/common/all-versions/util/include/common/all-versions/IncludeGuard.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2017 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 AUDIO_HAL_VERSION
+#error "AUDIO_HAL_VERSION must be set before including this file."
+#endif
diff --git a/audio/device/2.0/default/Android.bp b/audio/device/2.0/default/Android.bp
new file mode 100644
index 0000000..d0c466b
--- /dev/null
+++ b/audio/device/2.0/default/Android.bp
@@ -0,0 +1,49 @@
+cc_library_shared {
+ name: "android.hardware.audio@2.0-impl",
+ relative_install_path: "hw",
+ proprietary: true,
+ vendor: true,
+ srcs: [
+ "Conversions.cpp",
+ "Device.cpp",
+ "DevicesFactory.cpp",
+ "ParametersUtil.cpp",
+ "PrimaryDevice.cpp",
+ "Stream.cpp",
+ "StreamIn.cpp",
+ "StreamOut.cpp",
+ ],
+
+ defaults: ["hidl_defaults"],
+
+ export_include_dirs: ["include"],
+
+ shared_libs: [
+ "libbase",
+ "libcutils",
+ "libfmq",
+ "libhardware",
+ "libhidlbase",
+ "libhidltransport",
+ "liblog",
+ "libutils",
+ "android.hardware.audio@2.0",
+ "android.hardware.audio.common@2.0",
+ "android.hardware.audio.common@2.0-util",
+ "android.hardware.audio.common-util",
+ ],
+
+ header_libs: [
+ "android.hardware.audio.common.util@all-versions",
+ "android.hardware.audio@all-versions-impl",
+ "libaudioclient_headers",
+ "libaudio_system_headers",
+ "libhardware_headers",
+ "libmedia_headers",
+ ],
+
+ whole_static_libs: [
+ "libmedia_helper",
+ ],
+
+}
diff --git a/audio/device/2.0/default/Conversions.cpp b/audio/device/2.0/default/Conversions.cpp
new file mode 100644
index 0000000..db5d8d0
--- /dev/null
+++ b/audio/device/2.0/default/Conversions.cpp
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include "device/2.0/default/Conversions.h"
+
+#define AUDIO_HAL_VERSION V2_0
+#include <device/all-versions/default/Conversions.impl.h>
+#undef AUDIO_HAL_VERSION
diff --git a/audio/device/2.0/default/Device.cpp b/audio/device/2.0/default/Device.cpp
new file mode 100644
index 0000000..d5bbae8
--- /dev/null
+++ b/audio/device/2.0/default/Device.cpp
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#define LOG_TAG "DeviceHAL"
+
+#include "device/2.0/default/Device.h"
+#include <HidlUtils.h>
+#include "device/2.0/default/Conversions.h"
+#include "device/2.0/default/StreamIn.h"
+#include "device/2.0/default/StreamOut.h"
+#include "device/all-versions/default/Util.h"
+
+#define AUDIO_HAL_VERSION V2_0
+#include <device/all-versions/default/Device.impl.h>
+#undef AUDIO_HAL_VERSION
diff --git a/audio/device/2.0/default/DevicesFactory.cpp b/audio/device/2.0/default/DevicesFactory.cpp
new file mode 100644
index 0000000..4732404
--- /dev/null
+++ b/audio/device/2.0/default/DevicesFactory.cpp
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#define LOG_TAG "DevicesFactoryHAL"
+
+#include "device/2.0/default/DevicesFactory.h"
+#include "device/2.0/default/Device.h"
+#include "device/2.0/default/PrimaryDevice.h"
+
+#define AUDIO_HAL_VERSION V2_0
+#include <device/all-versions/default/DevicesFactory.impl.h>
+#undef AUDIO_HAL_VERSION
diff --git a/audio/device/2.0/default/OWNERS b/audio/device/2.0/default/OWNERS
new file mode 100644
index 0000000..6fdc97c
--- /dev/null
+++ b/audio/device/2.0/default/OWNERS
@@ -0,0 +1,3 @@
+elaurent@google.com
+krocard@google.com
+mnaganov@google.com
diff --git a/audio/device/2.0/default/ParametersUtil.cpp b/audio/device/2.0/default/ParametersUtil.cpp
new file mode 100644
index 0000000..8fabf5f
--- /dev/null
+++ b/audio/device/2.0/default/ParametersUtil.cpp
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include "device/2.0/default/ParametersUtil.h"
+
+#define AUDIO_HAL_VERSION V2_0
+#include <device/all-versions/default/ParametersUtil.impl.h>
+#undef AUDIO_HAL_VERSION
diff --git a/audio/device/2.0/default/PrimaryDevice.cpp b/audio/device/2.0/default/PrimaryDevice.cpp
new file mode 100644
index 0000000..1f6e7b5
--- /dev/null
+++ b/audio/device/2.0/default/PrimaryDevice.cpp
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#define LOG_TAG "PrimaryDeviceHAL"
+
+#include "device/2.0/default/PrimaryDevice.h"
+#include "device/all-versions/default/Util.h"
+
+#define AUDIO_HAL_VERSION V2_0
+#include <device/all-versions/default/PrimaryDevice.impl.h>
+#undef AUDIO_HAL_VERSION
diff --git a/audio/device/2.0/default/Stream.cpp b/audio/device/2.0/default/Stream.cpp
new file mode 100644
index 0000000..bdc6146
--- /dev/null
+++ b/audio/device/2.0/default/Stream.cpp
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#define LOG_TAG "StreamHAL"
+
+#include "device/2.0/default/Stream.h"
+#include "common/all-versions/default/EffectMap.h"
+#include "device/2.0/default/Conversions.h"
+
+#define AUDIO_HAL_VERSION V2_0
+#include <device/all-versions/default/Stream.impl.h>
+#undef AUDIO_HAL_VERSION
diff --git a/audio/device/2.0/default/StreamIn.cpp b/audio/device/2.0/default/StreamIn.cpp
new file mode 100644
index 0000000..f97f6b3
--- /dev/null
+++ b/audio/device/2.0/default/StreamIn.cpp
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#define LOG_TAG "StreamInHAL"
+
+#include "device/2.0/default/StreamIn.h"
+#include "device/all-versions/default/Util.h"
+
+#define AUDIO_HAL_VERSION V2_0
+#include <device/all-versions/default/StreamIn.impl.h>
+#undef AUDIO_HAL_VERSION
diff --git a/audio/device/2.0/default/StreamOut.cpp b/audio/device/2.0/default/StreamOut.cpp
new file mode 100644
index 0000000..152c4d2
--- /dev/null
+++ b/audio/device/2.0/default/StreamOut.cpp
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#define LOG_TAG "StreamOutHAL"
+
+#include "device/2.0/default/StreamOut.h"
+#include "device/all-versions/default/Util.h"
+
+#define AUDIO_HAL_VERSION V2_0
+#include <device/all-versions/default/StreamOut.impl.h>
+#undef AUDIO_HAL_VERSION
diff --git a/audio/device/2.0/default/include/device/2.0/default/Conversions.h b/audio/device/2.0/default/include/device/2.0/default/Conversions.h
new file mode 100644
index 0000000..4579361
--- /dev/null
+++ b/audio/device/2.0/default/include/device/2.0/default/Conversions.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2017 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_AUDIO_V2_0_CONVERSIONS_H_
+#define ANDROID_HARDWARE_AUDIO_V2_0_CONVERSIONS_H_
+
+#include <android/hardware/audio/2.0/types.h>
+
+#define AUDIO_HAL_VERSION V2_0
+#include <device/all-versions/default/Conversions.h>
+#undef AUDIO_HAL_VERSION
+
+#endif // ANDROID_HARDWARE_AUDIO_V2_0_CONVERSIONS_H_
diff --git a/audio/device/2.0/default/include/device/2.0/default/Device.h b/audio/device/2.0/default/include/device/2.0/default/Device.h
new file mode 100644
index 0000000..d28f6ba
--- /dev/null
+++ b/audio/device/2.0/default/include/device/2.0/default/Device.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2017 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_AUDIO_V2_0_DEVICE_H
+#define ANDROID_HARDWARE_AUDIO_V2_0_DEVICE_H
+
+#include <android/hardware/audio/2.0/IDevice.h>
+
+#include "ParametersUtil.h"
+
+#define AUDIO_HAL_VERSION V2_0
+#include <device/all-versions/default/Device.h>
+#undef AUDIO_HAL_VERSION
+
+#endif // ANDROID_HARDWARE_AUDIO_V2_0_DEVICE_H
diff --git a/audio/device/2.0/default/include/device/2.0/default/DevicesFactory.h b/audio/device/2.0/default/include/device/2.0/default/DevicesFactory.h
new file mode 100644
index 0000000..919154a
--- /dev/null
+++ b/audio/device/2.0/default/include/device/2.0/default/DevicesFactory.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2017 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_AUDIO_V2_0_DEVICESFACTORY_H
+#define ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H
+
+#include <android/hardware/audio/2.0/IDevicesFactory.h>
+
+#define AUDIO_HAL_VERSION V2_0
+#include <device/all-versions/default/DevicesFactory.h>
+#undef AUDIO_HAL_VERSION
+
+#endif // ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H
diff --git a/audio/device/2.0/default/include/device/2.0/default/ParametersUtil.h b/audio/device/2.0/default/include/device/2.0/default/ParametersUtil.h
new file mode 100644
index 0000000..7d4c46f
--- /dev/null
+++ b/audio/device/2.0/default/include/device/2.0/default/ParametersUtil.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2017 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_AUDIO_V2_0_PARAMETERS_UTIL_H_
+#define ANDROID_HARDWARE_AUDIO_V2_0_PARAMETERS_UTIL_H_
+
+#include <android/hardware/audio/2.0/types.h>
+
+#define AUDIO_HAL_VERSION V2_0
+#include <device/all-versions/default/ParametersUtil.h>
+#undef AUDIO_HAL_VERSION
+
+#endif // ANDROID_HARDWARE_AUDIO_V2_0_PARAMETERS_UTIL_H_
diff --git a/audio/device/2.0/default/include/device/2.0/default/PrimaryDevice.h b/audio/device/2.0/default/include/device/2.0/default/PrimaryDevice.h
new file mode 100644
index 0000000..e1fb4fe
--- /dev/null
+++ b/audio/device/2.0/default/include/device/2.0/default/PrimaryDevice.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2017 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_AUDIO_V2_0_PRIMARYDEVICE_H
+#define ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H
+
+#include <android/hardware/audio/2.0/IPrimaryDevice.h>
+
+#include "Device.h"
+
+#define AUDIO_HAL_VERSION V2_0
+#include <device/all-versions/default/PrimaryDevice.h>
+#undef AUDIO_HAL_VERSION
+
+#endif // ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H
diff --git a/audio/device/2.0/default/include/device/2.0/default/Stream.h b/audio/device/2.0/default/include/device/2.0/default/Stream.h
new file mode 100644
index 0000000..d059117
--- /dev/null
+++ b/audio/device/2.0/default/include/device/2.0/default/Stream.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2017 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_AUDIO_V2_0_STREAM_H
+#define ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H
+
+#include <android/hardware/audio/2.0/IStream.h>
+
+#include "ParametersUtil.h"
+
+#define AUDIO_HAL_VERSION V2_0
+#include <device/all-versions/default/Stream.h>
+#undef AUDIO_HAL_VERSION
+
+#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H
diff --git a/audio/device/2.0/default/include/device/2.0/default/StreamIn.h b/audio/device/2.0/default/include/device/2.0/default/StreamIn.h
new file mode 100644
index 0000000..28481f9
--- /dev/null
+++ b/audio/device/2.0/default/include/device/2.0/default/StreamIn.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2017 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_AUDIO_V2_0_STREAMIN_H
+#define ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H
+
+#include <android/hardware/audio/2.0/IStreamIn.h>
+
+#include "Device.h"
+#include "Stream.h"
+
+#define AUDIO_HAL_VERSION V2_0
+#include <device/all-versions/default/StreamIn.h>
+#undef AUDIO_HAL_VERSION
+
+#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H
diff --git a/audio/device/2.0/default/include/device/2.0/default/StreamOut.h b/audio/device/2.0/default/include/device/2.0/default/StreamOut.h
new file mode 100644
index 0000000..7ab7178
--- /dev/null
+++ b/audio/device/2.0/default/include/device/2.0/default/StreamOut.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2017 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_AUDIO_V2_0_STREAMOUT_H
+#define ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H
+
+#include <android/hardware/audio/2.0/IStreamOut.h>
+
+#include "Device.h"
+#include "Stream.h"
+
+#define AUDIO_HAL_VERSION V2_0
+#include <device/all-versions/default/StreamOut.h>
+#undef AUDIO_HAL_VERSION
+
+#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H
diff --git a/audio/device/all-versions/default/Android.bp b/audio/device/all-versions/default/Android.bp
index 4ad1aad..3029359 100644
--- a/audio/device/all-versions/default/Android.bp
+++ b/audio/device/all-versions/default/Android.bp
@@ -1,21 +1,13 @@
-cc_library_shared {
- name: "android.hardware.audio@2.0-impl",
+cc_library_headers {
+ name: "android.hardware.audio@all-versions-impl",
relative_install_path: "hw",
proprietary: true,
vendor: true,
- srcs: [
- "Conversions.cpp",
- "Device.cpp",
- "DevicesFactory.cpp",
- "ParametersUtil.cpp",
- "PrimaryDevice.cpp",
- "Stream.cpp",
- "StreamIn.cpp",
- "StreamOut.cpp",
- ],
defaults: ["hidl_defaults"],
+ export_include_dirs: ["include"],
+
shared_libs: [
"libbase",
"libcutils",
@@ -25,9 +17,6 @@
"libhidltransport",
"liblog",
"libutils",
- "android.hardware.audio@2.0",
- "android.hardware.audio.common@2.0",
- "android.hardware.audio.common@2.0-util",
"android.hardware.audio.common-util",
],
@@ -36,10 +25,6 @@
"libaudio_system_headers",
"libhardware_headers",
"libmedia_headers",
+ "android.hardware.audio.common.util@all-versions",
],
-
- whole_static_libs: [
- "libmedia_helper",
- ],
-
}
diff --git a/audio/device/all-versions/default/Conversions.h b/audio/device/all-versions/default/include/device/all-versions/default/Conversions.h
similarity index 75%
rename from audio/device/all-versions/default/Conversions.h
rename to audio/device/all-versions/default/include/device/all-versions/default/Conversions.h
index ebda5c5..fa05350 100644
--- a/audio/device/all-versions/default/Conversions.h
+++ b/audio/device/all-versions/default/include/device/all-versions/default/Conversions.h
@@ -14,28 +14,24 @@
* limitations under the License.
*/
-#ifndef android_hardware_audio_V2_0_Conversions_H_
-#define android_hardware_audio_V2_0_Conversions_H_
+#include <common/all-versions/IncludeGuard.h>
#include <string>
-#include <android/hardware/audio/2.0/types.h>
#include <system/audio.h>
namespace android {
namespace hardware {
namespace audio {
-namespace V2_0 {
+namespace AUDIO_HAL_VERSION {
namespace implementation {
-using ::android::hardware::audio::V2_0::DeviceAddress;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
std::string deviceAddressToHal(const DeviceAddress& address);
} // namespace implementation
-} // namespace V2_0
+} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
-
-#endif // android_hardware_audio_V2_0_Conversions_H_
diff --git a/audio/device/all-versions/default/Conversions.cpp b/audio/device/all-versions/default/include/device/all-versions/default/Conversions.impl.h
similarity index 95%
rename from audio/device/all-versions/default/Conversions.cpp
rename to audio/device/all-versions/default/include/device/all-versions/default/Conversions.impl.h
index edd49c5..3f3f936 100644
--- a/audio/device/all-versions/default/Conversions.cpp
+++ b/audio/device/all-versions/default/include/device/all-versions/default/Conversions.impl.h
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-#include <stdio.h>
+#include <common/all-versions/IncludeGuard.h>
-#include "Conversions.h"
+#include <stdio.h>
namespace android {
namespace hardware {
namespace audio {
-namespace V2_0 {
+namespace AUDIO_HAL_VERSION {
namespace implementation {
std::string deviceAddressToHal(const DeviceAddress& address) {
@@ -55,7 +55,7 @@
}
} // namespace implementation
-} // namespace V2_0
+} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
diff --git a/audio/device/all-versions/default/Device.h b/audio/device/all-versions/default/include/device/all-versions/default/Device.h
similarity index 75%
rename from audio/device/all-versions/default/Device.h
rename to audio/device/all-versions/default/include/device/all-versions/default/Device.h
index b62e696..224823c 100644
--- a/audio/device/all-versions/default/Device.h
+++ b/audio/device/all-versions/default/include/device/all-versions/default/Device.h
@@ -14,41 +14,37 @@
* limitations under the License.
*/
-#ifndef ANDROID_HARDWARE_AUDIO_V2_0_DEVICE_H
-#define ANDROID_HARDWARE_AUDIO_V2_0_DEVICE_H
+#include <common/all-versions/IncludeGuard.h>
#include <memory>
#include <hardware/audio.h>
#include <media/AudioParameter.h>
-#include <android/hardware/audio/2.0/IDevice.h>
#include <hidl/Status.h>
#include <hidl/MQDescriptor.h>
-#include "ParametersUtil.h"
-
namespace android {
namespace hardware {
namespace audio {
-namespace V2_0 {
+namespace AUDIO_HAL_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::V2_0::AudioConfig;
-using ::android::hardware::audio::common::V2_0::AudioHwSync;
-using ::android::hardware::audio::common::V2_0::AudioInputFlag;
-using ::android::hardware::audio::common::V2_0::AudioOutputFlag;
-using ::android::hardware::audio::common::V2_0::AudioPatchHandle;
-using ::android::hardware::audio::common::V2_0::AudioPort;
-using ::android::hardware::audio::common::V2_0::AudioPortConfig;
-using ::android::hardware::audio::common::V2_0::AudioSource;
-using ::android::hardware::audio::V2_0::DeviceAddress;
-using ::android::hardware::audio::V2_0::IDevice;
-using ::android::hardware::audio::V2_0::IStreamIn;
-using ::android::hardware::audio::V2_0::IStreamOut;
-using ::android::hardware::audio::V2_0::ParameterValue;
-using ::android::hardware::audio::V2_0::Result;
+using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioConfig;
+using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioHwSync;
+using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioInputFlag;
+using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioOutputFlag;
+using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPatchHandle;
+using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPort;
+using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortConfig;
+using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
@@ -58,7 +54,7 @@
struct Device : public IDevice, public ParametersUtil {
explicit Device(audio_hw_device_t* device);
- // Methods from ::android::hardware::audio::V2_0::IDevice follow.
+ // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow.
Return<Result> initCheck() override;
Return<Result> setMasterVolume(float volume) override;
Return<void> getMasterVolume(getMasterVolume_cb _hidl_cb) override;
@@ -107,9 +103,7 @@
};
} // namespace implementation
-} // namespace V2_0
+} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
-
-#endif // ANDROID_HARDWARE_AUDIO_V2_0_DEVICE_H
diff --git a/audio/device/all-versions/default/Device.cpp b/audio/device/all-versions/default/include/device/all-versions/default/Device.impl.h
similarity index 96%
rename from audio/device/all-versions/default/Device.cpp
rename to audio/device/all-versions/default/include/device/all-versions/default/Device.impl.h
index dae07ab..b295082 100644
--- a/audio/device/all-versions/default/Device.cpp
+++ b/audio/device/all-versions/default/include/device/all-versions/default/Device.impl.h
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-#define LOG_TAG "DeviceHAL"
+#include <common/all-versions/IncludeGuard.h>
+
//#define LOG_NDEBUG 0
#include <memory.h>
@@ -23,19 +24,13 @@
#include <android/log.h>
-#include "Conversions.h"
-#include "Device.h"
-#include "HidlUtils.h"
-#include "StreamIn.h"
-#include "StreamOut.h"
-#include "Util.h"
-
-using ::android::hardware::audio::common::V2_0::HidlUtils;
+using ::android::hardware::audio::common::AUDIO_HAL_VERSION::HidlUtils;
+using ::android::hardware::audio::all_versions::implementation::isGainNormalized;
namespace android {
namespace hardware {
namespace audio {
-namespace V2_0 {
+namespace AUDIO_HAL_VERSION {
namespace implementation {
Device::Device(audio_hw_device_t* device) : mDevice(device) {}
@@ -82,7 +77,7 @@
return mDevice->set_parameters(mDevice, keysAndValues);
}
-// Methods from ::android::hardware::audio::V2_0::IDevice follow.
+// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow.
Return<Result> Device::initCheck() {
return analyzeStatus("init_check", mDevice->init_check(mDevice));
}
@@ -288,7 +283,7 @@
}
} // namespace implementation
-} // namespace V2_0
+} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
diff --git a/audio/device/all-versions/default/DevicesFactory.h b/audio/device/all-versions/default/include/device/all-versions/default/DevicesFactory.h
similarity index 74%
rename from audio/device/all-versions/default/DevicesFactory.h
rename to audio/device/all-versions/default/include/device/all-versions/default/DevicesFactory.h
index 39437c1..769adaa 100644
--- a/audio/device/all-versions/default/DevicesFactory.h
+++ b/audio/device/all-versions/default/include/device/all-versions/default/DevicesFactory.h
@@ -14,24 +14,22 @@
* limitations under the License.
*/
-#ifndef ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H
-#define ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H
+#include <common/all-versions/IncludeGuard.h>
#include <hardware/audio.h>
-#include <android/hardware/audio/2.0/IDevicesFactory.h>
#include <hidl/Status.h>
#include <hidl/MQDescriptor.h>
namespace android {
namespace hardware {
namespace audio {
-namespace V2_0 {
+namespace AUDIO_HAL_VERSION {
namespace implementation {
-using ::android::hardware::audio::V2_0::IDevice;
-using ::android::hardware::audio::V2_0::IDevicesFactory;
-using ::android::hardware::audio::V2_0::Result;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevicesFactory;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
@@ -39,7 +37,7 @@
using ::android::sp;
struct DevicesFactory : public IDevicesFactory {
- // Methods from ::android::hardware::audio::V2_0::IDevicesFactory follow.
+ // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevicesFactory follow.
Return<void> openDevice(IDevicesFactory::Device device, openDevice_cb _hidl_cb) override;
private:
@@ -50,9 +48,7 @@
extern "C" IDevicesFactory* HIDL_FETCH_IDevicesFactory(const char* name);
} // namespace implementation
-} // namespace V2_0
+} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
-
-#endif // ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H
diff --git a/audio/device/all-versions/default/DevicesFactory.cpp b/audio/device/all-versions/default/include/device/all-versions/default/DevicesFactory.impl.h
similarity index 90%
rename from audio/device/all-versions/default/DevicesFactory.cpp
rename to audio/device/all-versions/default/include/device/all-versions/default/DevicesFactory.impl.h
index 2625ac7..014b4d8 100644
--- a/audio/device/all-versions/default/DevicesFactory.cpp
+++ b/audio/device/all-versions/default/include/device/all-versions/default/DevicesFactory.impl.h
@@ -14,20 +14,16 @@
* limitations under the License.
*/
-#define LOG_TAG "DevicesFactoryHAL"
+#include <common/all-versions/IncludeGuard.h>
#include <string.h>
#include <android/log.h>
-#include "Device.h"
-#include "DevicesFactory.h"
-#include "PrimaryDevice.h"
-
namespace android {
namespace hardware {
namespace audio {
-namespace V2_0 {
+namespace AUDIO_HAL_VERSION {
namespace implementation {
// static
@@ -77,7 +73,7 @@
return rc;
}
-// Methods from ::android::hardware::audio::V2_0::IDevicesFactory follow.
+// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevicesFactory follow.
Return<void> DevicesFactory::openDevice(IDevicesFactory::Device device, openDevice_cb _hidl_cb) {
audio_hw_device_t* halDevice;
Result retval(Result::INVALID_ARGUMENTS);
@@ -89,7 +85,8 @@
if (device == IDevicesFactory::Device::PRIMARY) {
result = new PrimaryDevice(halDevice);
} else {
- result = new ::android::hardware::audio::V2_0::implementation::Device(halDevice);
+ result = new ::android::hardware::audio::AUDIO_HAL_VERSION::implementation::Device(
+ halDevice);
}
retval = Result::OK;
} else if (halStatus == -EINVAL) {
@@ -105,7 +102,7 @@
}
} // namespace implementation
-} // namespace V2_0
+} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
diff --git a/audio/device/all-versions/default/ParametersUtil.h b/audio/device/all-versions/default/include/device/all-versions/default/ParametersUtil.h
similarity index 84%
rename from audio/device/all-versions/default/ParametersUtil.h
rename to audio/device/all-versions/default/include/device/all-versions/default/ParametersUtil.h
index 671c9e3..df5adee 100644
--- a/audio/device/all-versions/default/ParametersUtil.h
+++ b/audio/device/all-versions/default/include/device/all-versions/default/ParametersUtil.h
@@ -14,24 +14,22 @@
* limitations under the License.
*/
-#ifndef android_hardware_audio_V2_0_ParametersUtil_H_
-#define android_hardware_audio_V2_0_ParametersUtil_H_
+#include <common/all-versions/IncludeGuard.h>
#include <functional>
#include <memory>
-#include <android/hardware/audio/2.0/types.h>
#include <hidl/HidlSupport.h>
#include <media/AudioParameter.h>
namespace android {
namespace hardware {
namespace audio {
-namespace V2_0 {
+namespace AUDIO_HAL_VERSION {
namespace implementation {
-using ::android::hardware::audio::V2_0::ParameterValue;
-using ::android::hardware::audio::V2_0::Result;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
@@ -58,9 +56,7 @@
};
} // namespace implementation
-} // namespace V2_0
+} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
-
-#endif // android_hardware_audio_V2_0_ParametersUtil_H_
diff --git a/audio/device/all-versions/default/ParametersUtil.cpp b/audio/device/all-versions/default/include/device/all-versions/default/ParametersUtil.impl.h
similarity index 97%
rename from audio/device/all-versions/default/ParametersUtil.cpp
rename to audio/device/all-versions/default/include/device/all-versions/default/ParametersUtil.impl.h
index 75b672d..a858a48 100644
--- a/audio/device/all-versions/default/ParametersUtil.cpp
+++ b/audio/device/all-versions/default/include/device/all-versions/default/ParametersUtil.impl.h
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-#include "ParametersUtil.h"
+#include <common/all-versions/IncludeGuard.h>
namespace android {
namespace hardware {
namespace audio {
-namespace V2_0 {
+namespace AUDIO_HAL_VERSION {
namespace implementation {
/** Converts a status_t in Result according to the rules of AudioParameter::get*
@@ -159,7 +159,7 @@
}
} // namespace implementation
-} // namespace V2_0
+} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
diff --git a/audio/device/all-versions/default/PrimaryDevice.h b/audio/device/all-versions/default/include/device/all-versions/default/PrimaryDevice.h
similarity index 75%
rename from audio/device/all-versions/default/PrimaryDevice.h
rename to audio/device/all-versions/default/include/device/all-versions/default/PrimaryDevice.h
index 6b5accc..240b221 100644
--- a/audio/device/all-versions/default/PrimaryDevice.h
+++ b/audio/device/all-versions/default/include/device/all-versions/default/PrimaryDevice.h
@@ -14,36 +14,32 @@
* limitations under the License.
*/
-#ifndef ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H
-#define ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H
+#include <common/all-versions/IncludeGuard.h>
-#include <android/hardware/audio/2.0/IPrimaryDevice.h>
#include <hidl/Status.h>
#include <hidl/MQDescriptor.h>
-#include "Device.h"
-
namespace android {
namespace hardware {
namespace audio {
-namespace V2_0 {
+namespace AUDIO_HAL_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::V2_0::AudioConfig;
-using ::android::hardware::audio::common::V2_0::AudioInputFlag;
-using ::android::hardware::audio::common::V2_0::AudioMode;
-using ::android::hardware::audio::common::V2_0::AudioOutputFlag;
-using ::android::hardware::audio::common::V2_0::AudioPort;
-using ::android::hardware::audio::common::V2_0::AudioPortConfig;
-using ::android::hardware::audio::common::V2_0::AudioSource;
-using ::android::hardware::audio::V2_0::DeviceAddress;
-using ::android::hardware::audio::V2_0::IDevice;
-using ::android::hardware::audio::V2_0::IPrimaryDevice;
-using ::android::hardware::audio::V2_0::IStreamIn;
-using ::android::hardware::audio::V2_0::IStreamOut;
-using ::android::hardware::audio::V2_0::ParameterValue;
-using ::android::hardware::audio::V2_0::Result;
+using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioConfig;
+using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioInputFlag;
+using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode;
+using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioOutputFlag;
+using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPort;
+using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortConfig;
+using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::IPrimaryDevice;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
@@ -53,7 +49,7 @@
struct PrimaryDevice : public IPrimaryDevice {
explicit PrimaryDevice(audio_hw_device_t* device);
- // Methods from ::android::hardware::audio::V2_0::IDevice follow.
+ // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow.
Return<Result> initCheck() override;
Return<Result> setMasterVolume(float volume) override;
Return<void> getMasterVolume(getMasterVolume_cb _hidl_cb) override;
@@ -83,7 +79,7 @@
Return<Result> setParameters(const hidl_vec<ParameterValue>& parameters) override;
Return<void> debugDump(const hidl_handle& fd) override;
- // Methods from ::android::hardware::audio::V2_0::IPrimaryDevice follow.
+ // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IPrimaryDevice follow.
Return<Result> setVoiceVolume(float volume) override;
Return<Result> setMode(AudioMode mode) override;
Return<void> getBtScoNrecEnabled(getBtScoNrecEnabled_cb _hidl_cb) override;
@@ -102,9 +98,7 @@
};
} // namespace implementation
-} // namespace V2_0
+} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
-
-#endif // ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H
diff --git a/audio/device/all-versions/default/PrimaryDevice.cpp b/audio/device/all-versions/default/include/device/all-versions/default/PrimaryDevice.impl.h
similarity index 94%
rename from audio/device/all-versions/default/PrimaryDevice.cpp
rename to audio/device/all-versions/default/include/device/all-versions/default/PrimaryDevice.impl.h
index 2c02a71..3ce047a 100644
--- a/audio/device/all-versions/default/PrimaryDevice.cpp
+++ b/audio/device/all-versions/default/include/device/all-versions/default/PrimaryDevice.impl.h
@@ -14,22 +14,19 @@
* limitations under the License.
*/
-#define LOG_TAG "PrimaryDeviceHAL"
-
-#include "PrimaryDevice.h"
-#include "Util.h"
+#include <common/all-versions/IncludeGuard.h>
namespace android {
namespace hardware {
namespace audio {
-namespace V2_0 {
+namespace AUDIO_HAL_VERSION {
namespace implementation {
PrimaryDevice::PrimaryDevice(audio_hw_device_t* device) : mDevice(new Device(device)) {}
PrimaryDevice::~PrimaryDevice() {}
-// Methods from ::android::hardware::audio::V2_0::IDevice follow.
+// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow.
Return<Result> PrimaryDevice::initCheck() {
return mDevice->initCheck();
}
@@ -118,9 +115,9 @@
return mDevice->debugDump(fd);
}
-// Methods from ::android::hardware::audio::V2_0::IPrimaryDevice follow.
+// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IPrimaryDevice follow.
Return<Result> PrimaryDevice::setVoiceVolume(float volume) {
- if (!isGainNormalized(volume)) {
+ if (!all_versions::implementation::isGainNormalized(volume)) {
ALOGW("Can not set a voice volume (%f) outside [0,1]", volume);
return Result::INVALID_ARGUMENTS;
}
@@ -192,7 +189,7 @@
}
} // namespace implementation
-} // namespace V2_0
+} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
diff --git a/audio/device/all-versions/default/Stream.h b/audio/device/all-versions/default/include/device/all-versions/default/Stream.h
similarity index 89%
rename from audio/device/all-versions/default/Stream.h
rename to audio/device/all-versions/default/include/device/all-versions/default/Stream.h
index 17e5c39..4196dec 100644
--- a/audio/device/all-versions/default/Stream.h
+++ b/audio/device/all-versions/default/include/device/all-versions/default/Stream.h
@@ -14,32 +14,28 @@
* limitations under the License.
*/
-#ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H
-#define ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H
+#include <common/all-versions/IncludeGuard.h>
#include <vector>
-#include <android/hardware/audio/2.0/IStream.h>
#include <hardware/audio.h>
#include <hidl/Status.h>
#include <hidl/MQDescriptor.h>
-#include "ParametersUtil.h"
-
namespace android {
namespace hardware {
namespace audio {
-namespace V2_0 {
+namespace AUDIO_HAL_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::V2_0::AudioChannelMask;
-using ::android::hardware::audio::common::V2_0::AudioDevice;
-using ::android::hardware::audio::common::V2_0::AudioFormat;
-using ::android::hardware::audio::V2_0::DeviceAddress;
-using ::android::hardware::audio::V2_0::IStream;
-using ::android::hardware::audio::V2_0::ParameterValue;
-using ::android::hardware::audio::V2_0::Result;
+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::AudioFormat;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::IStream;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
@@ -56,7 +52,7 @@
*/
static constexpr uint32_t MAX_BUFFER_SIZE = 2 << 30 /* == 1GiB */;
- // Methods from ::android::hardware::audio::V2_0::IStream follow.
+ // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
Return<uint64_t> getFrameSize() override;
Return<uint64_t> getFrameCount() override;
Return<uint64_t> getBufferSize() override;
@@ -178,9 +174,7 @@
}
} // namespace implementation
-} // namespace V2_0
+} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
-
-#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H
diff --git a/audio/device/all-versions/default/Stream.cpp b/audio/device/all-versions/default/include/device/all-versions/default/Stream.impl.h
similarity index 96%
rename from audio/device/all-versions/default/Stream.cpp
rename to audio/device/all-versions/default/include/device/all-versions/default/Stream.impl.h
index 0833123..92cff72 100644
--- a/audio/device/all-versions/default/Stream.cpp
+++ b/audio/device/all-versions/default/include/device/all-versions/default/Stream.impl.h
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-#include <inttypes.h>
+#include <common/all-versions/IncludeGuard.h>
-#define LOG_TAG "StreamHAL"
+#include <inttypes.h>
#include <android/log.h>
#include <hardware/audio.h>
@@ -25,14 +25,10 @@
#include <utils/SortedVector.h>
#include <utils/Vector.h>
-#include "Conversions.h"
-#include "Stream.h"
-#include "common/all-versions/default/EffectMap.h"
-
namespace android {
namespace hardware {
namespace audio {
-namespace V2_0 {
+namespace AUDIO_HAL_VERSION {
namespace implementation {
Stream::Stream(audio_stream_t* stream) : mStream(stream) {}
@@ -82,7 +78,7 @@
return mStream->set_parameters(mStream, keysAndValues);
}
-// Methods from ::android::hardware::audio::V2_0::IStream follow.
+// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
Return<uint64_t> Stream::getFrameSize() {
// Needs to be implemented by interface subclasses. But can't be declared as pure virtual,
// since interface subclasses implementation do not inherit from this class.
@@ -274,7 +270,7 @@
}
} // namespace implementation
-} // namespace V2_0
+} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
diff --git a/audio/device/all-versions/default/StreamIn.h b/audio/device/all-versions/default/include/device/all-versions/default/StreamIn.h
similarity index 82%
rename from audio/device/all-versions/default/StreamIn.h
rename to audio/device/all-versions/default/include/device/all-versions/default/StreamIn.h
index dfb806a..7380dae 100644
--- a/audio/device/all-versions/default/StreamIn.h
+++ b/audio/device/all-versions/default/include/device/all-versions/default/StreamIn.h
@@ -14,37 +14,32 @@
* limitations under the License.
*/
-#ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H
-#define ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H
+#include <common/all-versions/IncludeGuard.h>
#include <atomic>
#include <memory>
-#include <android/hardware/audio/2.0/IStreamIn.h>
#include <fmq/EventFlag.h>
#include <fmq/MessageQueue.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <utils/Thread.h>
-#include "Device.h"
-#include "Stream.h"
-
namespace android {
namespace hardware {
namespace audio {
-namespace V2_0 {
+namespace AUDIO_HAL_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::V2_0::AudioChannelMask;
-using ::android::hardware::audio::common::V2_0::AudioDevice;
-using ::android::hardware::audio::common::V2_0::AudioFormat;
-using ::android::hardware::audio::common::V2_0::AudioSource;
-using ::android::hardware::audio::V2_0::DeviceAddress;
-using ::android::hardware::audio::V2_0::IStream;
-using ::android::hardware::audio::V2_0::IStreamIn;
-using ::android::hardware::audio::V2_0::ParameterValue;
-using ::android::hardware::audio::V2_0::Result;
+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::AudioFormat;
+using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::IStream;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
@@ -58,7 +53,7 @@
StreamIn(const sp<Device>& device, audio_stream_in_t* stream);
- // Methods from ::android::hardware::audio::V2_0::IStream follow.
+ // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
Return<uint64_t> getFrameSize() override;
Return<uint64_t> getFrameCount() override;
Return<uint64_t> getBufferSize() override;
@@ -85,7 +80,7 @@
Return<void> debugDump(const hidl_handle& fd) override;
Return<Result> close() override;
- // Methods from ::android::hardware::audio::V2_0::IStreamIn follow.
+ // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn follow.
Return<void> getAudioSource(getAudioSource_cb _hidl_cb) override;
Return<Result> setGain(float gain) override;
Return<void> prepareForReading(uint32_t frameSize, uint32_t framesCount,
@@ -117,9 +112,7 @@
};
} // namespace implementation
-} // namespace V2_0
+} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
-
-#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H
diff --git a/audio/device/all-versions/default/StreamIn.cpp b/audio/device/all-versions/default/include/device/all-versions/default/StreamIn.impl.h
similarity index 95%
rename from audio/device/all-versions/default/StreamIn.cpp
rename to audio/device/all-versions/default/include/device/all-versions/default/StreamIn.impl.h
index 7c87202..abee225 100644
--- a/audio/device/all-versions/default/StreamIn.cpp
+++ b/audio/device/all-versions/default/include/device/all-versions/default/StreamIn.impl.h
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-#define LOG_TAG "StreamInHAL"
+#include <common/all-versions/IncludeGuard.h>
+
//#define LOG_NDEBUG 0
#define ATRACE_TAG ATRACE_TAG_AUDIO
@@ -23,18 +24,16 @@
#include <utils/Trace.h>
#include <memory>
-#include "StreamIn.h"
-#include "Util.h"
-
-using ::android::hardware::audio::V2_0::MessageQueueFlagBits;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::MessageQueueFlagBits;
+using ::android::hardware::audio::all_versions::implementation::isGainNormalized;
namespace android {
namespace hardware {
namespace audio {
-namespace V2_0 {
+namespace AUDIO_HAL_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::V2_0::ThreadInfo;
+using ::android::hardware::audio::common::AUDIO_HAL_VERSION::ThreadInfo;
namespace {
@@ -163,7 +162,7 @@
mStream = nullptr;
}
-// Methods from ::android::hardware::audio::V2_0::IStream follow.
+// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
Return<uint64_t> StreamIn::getFrameSize() {
return audio_stream_in_frame_size(mStream);
}
@@ -285,7 +284,7 @@
return Result::OK;
}
-// Methods from ::android::hardware::audio::V2_0::IStreamIn follow.
+// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn follow.
Return<void> StreamIn::getAudioSource(getAudioSource_cb _hidl_cb) {
int halSource;
Result retval = mStreamCommon->getParam(AudioParameter::keyInputSource, &halSource);
@@ -417,7 +416,7 @@
}
} // namespace implementation
-} // namespace V2_0
+} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
diff --git a/audio/device/all-versions/default/StreamOut.h b/audio/device/all-versions/default/include/device/all-versions/default/StreamOut.h
similarity index 82%
rename from audio/device/all-versions/default/StreamOut.h
rename to audio/device/all-versions/default/include/device/all-versions/default/StreamOut.h
index 35960c5..4cfe2e3 100644
--- a/audio/device/all-versions/default/StreamOut.h
+++ b/audio/device/all-versions/default/include/device/all-versions/default/StreamOut.h
@@ -14,39 +14,34 @@
* limitations under the License.
*/
-#ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H
-#define ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H
+#include <common/all-versions/IncludeGuard.h>
#include <atomic>
#include <memory>
-#include <android/hardware/audio/2.0/IStreamOut.h>
#include <fmq/EventFlag.h>
#include <fmq/MessageQueue.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <utils/Thread.h>
-#include "Device.h"
-#include "Stream.h"
-
namespace android {
namespace hardware {
namespace audio {
-namespace V2_0 {
+namespace AUDIO_HAL_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::V2_0::AudioChannelMask;
-using ::android::hardware::audio::common::V2_0::AudioDevice;
-using ::android::hardware::audio::common::V2_0::AudioFormat;
-using ::android::hardware::audio::V2_0::AudioDrain;
-using ::android::hardware::audio::V2_0::DeviceAddress;
-using ::android::hardware::audio::V2_0::IStream;
-using ::android::hardware::audio::V2_0::IStreamOut;
-using ::android::hardware::audio::V2_0::IStreamOutCallback;
-using ::android::hardware::audio::V2_0::ParameterValue;
-using ::android::hardware::audio::V2_0::Result;
-using ::android::hardware::audio::V2_0::TimeSpec;
+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::AudioFormat;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::AudioDrain;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::IStream;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOutCallback;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
+using ::android::hardware::audio::AUDIO_HAL_VERSION::TimeSpec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
@@ -60,7 +55,7 @@
StreamOut(const sp<Device>& device, audio_stream_out_t* stream);
- // Methods from ::android::hardware::audio::V2_0::IStream follow.
+ // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
Return<uint64_t> getFrameSize() override;
Return<uint64_t> getFrameCount() override;
Return<uint64_t> getBufferSize() override;
@@ -87,7 +82,7 @@
Return<void> debugDump(const hidl_handle& fd) override;
Return<Result> close() override;
- // Methods from ::android::hardware::audio::V2_0::IStreamOut follow.
+ // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut follow.
Return<uint32_t> getLatency() override;
Return<Result> setVolume(float left, float right) override;
Return<void> prepareForWriting(uint32_t frameSize, uint32_t framesCount,
@@ -131,9 +126,7 @@
};
} // namespace implementation
-} // namespace V2_0
+} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
-
-#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H
diff --git a/audio/device/all-versions/default/StreamOut.cpp b/audio/device/all-versions/default/include/device/all-versions/default/StreamOut.impl.h
similarity index 96%
rename from audio/device/all-versions/default/StreamOut.cpp
rename to audio/device/all-versions/default/include/device/all-versions/default/StreamOut.impl.h
index d811a40..bdbeb38 100644
--- a/audio/device/all-versions/default/StreamOut.cpp
+++ b/audio/device/all-versions/default/include/device/all-versions/default/StreamOut.impl.h
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-#define LOG_TAG "StreamOutHAL"
+#include <common/all-versions/IncludeGuard.h>
+
//#define LOG_NDEBUG 0
#define ATRACE_TAG ATRACE_TAG_AUDIO
@@ -24,16 +25,14 @@
#include <hardware/audio.h>
#include <utils/Trace.h>
-#include "StreamOut.h"
-#include "Util.h"
-
namespace android {
namespace hardware {
namespace audio {
-namespace V2_0 {
+namespace AUDIO_HAL_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::V2_0::ThreadInfo;
+using ::android::hardware::audio::common::AUDIO_HAL_VERSION::ThreadInfo;
+using ::android::hardware::audio::all_versions::implementation::isGainNormalized;
namespace {
@@ -167,7 +166,7 @@
mStream = nullptr;
}
-// Methods from ::android::hardware::audio::V2_0::IStream follow.
+// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
Return<uint64_t> StreamOut::getFrameSize() {
return audio_stream_out_frame_size(mStream);
}
@@ -273,7 +272,7 @@
return Result::OK;
}
-// Methods from ::android::hardware::audio::V2_0::IStreamOut follow.
+// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut follow.
Return<uint32_t> StreamOut::getLatency() {
return mStream->get_latency(mStream);
}
@@ -514,7 +513,7 @@
}
} // namespace implementation
-} // namespace V2_0
+} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
diff --git a/audio/device/all-versions/default/Util.h b/audio/device/all-versions/default/include/device/all-versions/default/Util.h
similarity index 80%
rename from audio/device/all-versions/default/Util.h
rename to audio/device/all-versions/default/include/device/all-versions/default/Util.h
index 72eea50..39d9dbd 100644
--- a/audio/device/all-versions/default/Util.h
+++ b/audio/device/all-versions/default/include/device/all-versions/default/Util.h
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-#ifndef ANDROID_HARDWARE_AUDIO_V2_0_UTIL_H
-#define ANDROID_HARDWARE_AUDIO_V2_0_UTIL_H
+#ifndef ANDROID_HARDWARE_AUDIO_DEVICE_ALL_VERSIONS_UTIL_H
+#define ANDROID_HARDWARE_AUDIO_DEVICE_ALL_VERSIONS_UTIL_H
namespace android {
namespace hardware {
namespace audio {
-namespace V2_0 {
+namespace all_versions {
namespace implementation {
/** @return true if gain is between 0 and 1 included. */
@@ -29,9 +29,9 @@
}
} // namespace implementation
-} // namespace V2_0
+} // namespace all_versions
} // namespace audio
} // namespace hardware
} // namespace android
-#endif // ANDROID_HARDWARE_AUDIO_V2_0_UTIL_H
+#endif // ANDROID_HARDWARE_AUDIO_DEVICE_ALL_VERSIONS_UTIL_H