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/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