Implement audio devices and streams HAL delegating to legacy HAL

Changes made to the .hal definition:

  - introduce Effect ID returned by the IEffectsFactory that
    needs to be passed to IStream.{add|remove}Effect; otherwise
    it's impossible to retrieve the underlying HAL effect handle;

  - change "bus address" in DeviceAddress to "string" type;

  - fix signature of some methods w.r.t. returning Result;

  - remove unused "struct AudioPatch".

Bug: 30222631
Test: make
Change-Id: Icb51729ef57bb2a5b0b78609735e7481bc04f95c
diff --git a/audio/2.0/default/Android.mk b/audio/2.0/default/Android.mk
index a987b41..a5c0383 100644
--- a/audio/2.0/default/Android.mk
+++ b/audio/2.0/default/Android.mk
@@ -17,20 +17,53 @@
 LOCAL_PATH := $(call my-dir)
 
 include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.audio@2.0-impl
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_SRC_FILES := \
+    Conversions.cpp \
+    Device.cpp \
+    DevicesFactory.cpp \
+    ParametersUtil.cpp \
+    PrimaryDevice.cpp \
+    Stream.cpp \
+    StreamIn.cpp \
+    StreamOut.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+    libhidl \
+    libhwbinder \
+    libutils \
+    libhardware \
+    liblog \
+    android.hardware.audio@2.0 \
+    android.hardware.audio.common@2.0 \
+    android.hardware.audio.common@2.0-util \
+
+LOCAL_WHOLE_STATIC_LIBRARIES := libmedia_helper
+
+include $(BUILD_SHARED_LIBRARY)
+
+#
+# Service
+#
+
+include $(CLEAR_VARS)
 LOCAL_MODULE := android.hardware.audio@2.0-service
 LOCAL_INIT_RC := android.hardware.audio@2.0-service.rc
 LOCAL_MODULE_RELATIVE_PATH := hw
 LOCAL_SRC_FILES := \
-  service.cpp
+    service.cpp
 
 LOCAL_SHARED_LIBRARIES := \
-  libhidl \
-  liblog \
-  libhwbinder \
-  libutils \
-  libhardware \
-  android.hardware.soundtrigger@2.0 \
-  android.hardware.audio.common@2.0
+    libhidl \
+    liblog \
+    libhwbinder \
+    libutils \
+    libhardware \
+    android.hardware.audio@2.0 \
+    android.hardware.audio.common@2.0 \
+    android.hardware.audio.effect@2.0 \
+    android.hardware.soundtrigger@2.0 \
 
 ifeq ($(strip $(AUDIOSERVER_MULTILIB)),)
 LOCAL_MULTILIB := 32