Revert "Audio V4: Split system and vendor Audio.h"

This reverts commit f8ad7f85e9891b2614338330c75ae9e946fccc5a.

Reason for revert: Breaks the build of multiple devices

Change-Id: I24f17a0fa0c7ba171c4a3639f890e7f4e42f6b1e
diff --git a/media/libeffects/config/Android.bp b/media/libeffects/config/Android.bp
index 4a1653a..3e88c7c 100644
--- a/media/libeffects/config/Android.bp
+++ b/media/libeffects/config/Android.bp
@@ -1,6 +1,7 @@
 // Effect configuration
 cc_library_shared {
     name: "libeffectsconfig",
+    vendor_available: true,
 
     srcs: ["src/EffectsConfig.cpp"],
 
@@ -19,29 +20,3 @@
 
     export_include_dirs: ["include"],
 }
-
-cc_library_shared {
-    name: "libeffectsconfig@2.0",
-    vendor: true,
-
-    srcs: ["src/EffectsConfig.cpp"],
-
-    cflags: [
-        "-Wall",
-        "-Werror",
-    ],
-
-    shared_libs: [
-        "liblog",
-        "libtinyxml2",
-    ],
-
-    export_include_dirs: ["include"],
-
-    header_libs: [
-        "android.hardware.audio.common.legacy@2.0",
-    ],
-    export_header_lib_headers: [
-        "android.hardware.audio.common.legacy@2.0",
-    ],
-}
diff --git a/media/libeffects/downmix/Android.mk b/media/libeffects/downmix/Android.mk
index f32b7e7..a5fbf14 100644
--- a/media/libeffects/downmix/Android.mk
+++ b/media/libeffects/downmix/Android.mk
@@ -17,14 +17,12 @@
 LOCAL_MODULE_RELATIVE_PATH := soundfx
 
 LOCAL_C_INCLUDES := \
+	$(call include-path-for, audio-effects) \
 	$(call include-path-for, audio-utils)
 
 #-DBUILD_FLOAT
 LOCAL_CFLAGS += -fvisibility=hidden
 LOCAL_CFLAGS += -Wall -Werror
 
-LOCAL_HEADER_LIBRARIES += \
-    libhardware_headers \
-    android.hardware.audio.effect.legacy@2.0 \
-
+LOCAL_HEADER_LIBRARIES += libhardware_headers
 include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libeffects/factory/Android.bp b/media/libeffects/factory/Android.bp
index fded0b7..ddbfdd8 100644
--- a/media/libeffects/factory/Android.bp
+++ b/media/libeffects/factory/Android.bp
@@ -1,3 +1,11 @@
+cc_library_headers {
+    name: "libeffects_headers",
+    vendor_available: true,
+    export_include_dirs: ["include"],
+    header_libs: ["libhardware_headers"],
+    export_header_lib_headers: ["libhardware_headers"],
+}
+
 // Effect factory library
 cc_library_shared {
     name: "libeffects",
@@ -13,20 +21,21 @@
         "libcutils",
         "liblog",
         "libdl",
-        "libeffectsconfig@2.0",
+        "libeffectsconfig",
     ],
     cflags: ["-fvisibility=hidden"],
 
-    export_include_dirs: ["."],
+    local_include_dirs:["include/media"],
 
     header_libs: [
-        "android.hardware.audio.effect.legacy@2.0",
+        "libaudioeffects",
+        "libeffects_headers",
     ],
-    export_header_lib_headers: ["android.hardware.audio.effect.legacy@2.0"],
+    export_header_lib_headers: ["libeffects_headers"],
 }
 
 cc_binary {
-    name: "dumpEffectConfigFile@2.0",
+    name: "dumpEffectConfigFile",
     vendor: true,
     srcs: ["test/DumpConfig.cpp"],
 
@@ -38,12 +47,10 @@
         "-Werror",
     ],
 
-    header_libs: [
-        "android.hardware.audio.effect.legacy@2.0",
-    ],
 
     shared_libs: [
-        "libeffectsconfig@2.0",
+        "libeffectsconfig",
         "libeffects",
     ],
+    local_include_dirs:[".", "include"],
 }
diff --git a/media/libeffects/factory/include/media/EffectsFactoryApi.h b/media/libeffects/factory/include/media/EffectsFactoryApi.h
new file mode 100644
index 0000000..a5a12eb
--- /dev/null
+++ b/media/libeffects/factory/include/media/EffectsFactoryApi.h
@@ -0,0 +1,189 @@
+/*
+ * Copyright (C) 2010 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_EFFECTSFACTORYAPI_H_
+#define ANDROID_EFFECTSFACTORYAPI_H_
+
+#include <cutils/compiler.h>
+#include <errno.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <hardware/audio_effect.h>
+
+#if __cplusplus
+extern "C" {
+#endif
+
+/////////////////////////////////////////////////
+//      Effect factory interface
+/////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////
+//
+//    Function:       EffectQueryNumberEffects
+//
+//    Description:    Returns the number of different effects in all loaded libraries.
+//          Each effect must have a different effect uuid (see
+//          effect_descriptor_t). This function together with EffectQueryEffect()
+//          is used to enumerate all effects present in all loaded libraries.
+//          Each time EffectQueryNumberEffects() is called, the factory must
+//          reset the index of the effect descriptor returned by next call to
+//          EffectQueryEffect() to restart enumeration from the beginning.
+//
+//    Input/Output:
+//          pNumEffects:    address where the number of effects should be returned.
+//
+//    Output:
+//        returned value:    0          successful operation.
+//                          -ENODEV     factory failed to initialize
+//                          -EINVAL     invalid pNumEffects
+//        *pNumEffects:     updated with number of effects in factory
+//
+////////////////////////////////////////////////////////////////////////////////
+ANDROID_API
+int EffectQueryNumberEffects(uint32_t *pNumEffects);
+
+////////////////////////////////////////////////////////////////////////////////
+//
+//    Function:       EffectQueryEffect
+//
+//    Description:    Returns a descriptor of the next available effect.
+//          See effect_descriptor_t for a details on effect descriptor.
+//          This function together with EffectQueryNumberEffects() is used to enumerate all
+//          effects present in all loaded libraries. The enumeration sequence is:
+//              EffectQueryNumberEffects(&num_effects);
+//              for (i = 0; i < num_effects; i++)
+//                  EffectQueryEffect(i,...);
+//
+//    Input/Output:
+//          pDescriptor:    address where to return the effect descriptor.
+//
+//    Output:
+//        returned value:    0          successful operation.
+//                          -ENOENT     no more effect available
+//                          -ENODEV     factory failed to initialize
+//                          -EINVAL     invalid pDescriptor
+//                          -ENOSYS     effect list has changed since last execution of
+//                                      EffectQueryNumberEffects()
+//        *pDescriptor:     updated with the effect descriptor.
+//
+////////////////////////////////////////////////////////////////////////////////
+ANDROID_API
+int EffectQueryEffect(uint32_t index, effect_descriptor_t *pDescriptor);
+
+////////////////////////////////////////////////////////////////////////////////
+//
+//    Function:       EffectCreate
+//
+//    Description:    Creates an effect engine of the specified type and returns an
+//          effect control interface on this engine. The function will allocate the
+//          resources for an instance of the requested effect engine and return
+//          a handle on the effect control interface.
+//
+//    Input:
+//          pEffectUuid:    pointer to the effect uuid.
+//          sessionId:  audio session to which this effect instance will be attached. All effects
+//              created with the same session ID are connected in series and process the same signal
+//              stream.  Knowing that two effects are part of the same effect chain can help the
+//              library implement some kind of optimizations.
+//          ioId:   identifies the output or input stream this effect is directed to at audio HAL.
+//              For future use especially with tunneled HW accelerated effects
+//
+//    Input/Output:
+//          pHandle:        address where to return the effect handle.
+//
+//    Output:
+//        returned value:    0          successful operation.
+//                          -ENODEV     factory failed to initialize
+//                          -EINVAL     invalid pEffectUuid or pHandle
+//                          -ENOENT     no effect with this uuid found
+//        *pHandle:         updated with the effect handle.
+//
+////////////////////////////////////////////////////////////////////////////////
+ANDROID_API
+int EffectCreate(const effect_uuid_t *pEffectUuid, int32_t sessionId, int32_t ioId,
+        effect_handle_t *pHandle);
+
+////////////////////////////////////////////////////////////////////////////////
+//
+//    Function:       EffectRelease
+//
+//    Description:    Releases the effect engine whose handle is given as argument.
+//          All resources allocated to this particular instance of the effect are
+//          released.
+//
+//    Input:
+//          handle:    handle on the effect interface to be released.
+//
+//    Output:
+//        returned value:    0          successful operation.
+//                          -ENODEV     factory failed to initialize
+//                          -EINVAL     invalid interface handle
+//
+////////////////////////////////////////////////////////////////////////////////
+ANDROID_API
+int EffectRelease(effect_handle_t handle);
+
+////////////////////////////////////////////////////////////////////////////////
+//
+//    Function:       EffectGetDescriptor
+//
+//    Description:    Returns the descriptor of the effect which uuid is pointed
+//          to by first argument.
+//
+//    Input:
+//          pEffectUuid:    pointer to the effect uuid.
+//
+//    Input/Output:
+//          pDescriptor:    address where to return the effect descriptor.
+//
+//    Output:
+//        returned value:    0          successful operation.
+//                          -ENODEV     factory failed to initialize
+//                          -EINVAL     invalid pEffectUuid or pDescriptor
+//                          -ENOENT     no effect with this uuid found
+//        *pDescriptor:     updated with the effect descriptor.
+//
+////////////////////////////////////////////////////////////////////////////////
+ANDROID_API
+int EffectGetDescriptor(const effect_uuid_t *pEffectUuid, effect_descriptor_t *pDescriptor);
+
+////////////////////////////////////////////////////////////////////////////////
+//
+//    Function:       EffectIsNullUuid
+//
+//    Description:    Helper function to compare effect uuid to EFFECT_UUID_NULL
+//
+//    Input:
+//          pEffectUuid: pointer to effect uuid to compare to EFFECT_UUID_NULL.
+//
+//    Output:
+//        returned value:    0 if uuid is different from EFFECT_UUID_NULL.
+//                           1 if uuid is equal to EFFECT_UUID_NULL.
+//
+////////////////////////////////////////////////////////////////////////////////
+ANDROID_API
+int EffectIsNullUuid(const effect_uuid_t *pEffectUuid);
+
+ANDROID_API
+int EffectDumpEffects(int fd);
+
+#if __cplusplus
+}  // extern "C"
+#endif
+
+
+#endif /*ANDROID_EFFECTSFACTORYAPI_H_*/
diff --git a/media/libeffects/loudness/Android.mk b/media/libeffects/loudness/Android.mk
index 8a4b451..712cbd5 100644
--- a/media/libeffects/loudness/Android.mk
+++ b/media/libeffects/loudness/Android.mk
@@ -19,6 +19,6 @@
 LOCAL_MODULE:= libldnhncr
 
 LOCAL_HEADER_LIBRARIES := \
-    android.hardware.audio.effect.legacy@2.0 \
+    libaudioeffects
 
 include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libeffects/lvm/wrapper/Android.mk b/media/libeffects/lvm/wrapper/Android.mk
index 4673f6c..341dbc2 100644
--- a/media/libeffects/lvm/wrapper/Android.mk
+++ b/media/libeffects/lvm/wrapper/Android.mk
@@ -35,10 +35,7 @@
 	$(call include-path-for, audio-effects) \
 	$(call include-path-for, audio-utils) \
 
-LOCAL_HEADER_LIBRARIES += \
-    libhardware_headers \
-    android.hardware.audio.effect.legacy@2.0 \
-
+LOCAL_HEADER_LIBRARIES += libhardware_headers
 include $(BUILD_SHARED_LIBRARY)
 
 
@@ -70,11 +67,10 @@
     $(LOCAL_PATH)/Reverb \
     $(LOCAL_PATH)/../lib/Common/lib/ \
     $(LOCAL_PATH)/../lib/Reverb/lib/ \
+    $(call include-path-for, audio-effects) \
     $(call include-path-for, audio-utils) \
 
-LOCAL_HEADER_LIBRARIES += \
-    libhardware_headers \
-    android.hardware.audio.effect.legacy@2.0 \
+LOCAL_HEADER_LIBRARIES += libhardware_headers
 
 LOCAL_SANITIZE := integer_overflow
 
diff --git a/media/libeffects/preprocessing/Android.mk b/media/libeffects/preprocessing/Android.mk
index 3f81047..358da8b 100644
--- a/media/libeffects/preprocessing/Android.mk
+++ b/media/libeffects/preprocessing/Android.mk
@@ -32,8 +32,5 @@
 LOCAL_CFLAGS += -fvisibility=hidden
 LOCAL_CFLAGS += -Wall -Werror
 
-LOCAL_HEADER_LIBRARIES += \
-    libhardware_headers \
-    android.hardware.audio.effect.legacy@2.0
-
+LOCAL_HEADER_LIBRARIES += libhardware_headers
 include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libeffects/proxy/Android.bp b/media/libeffects/proxy/Android.bp
deleted file mode 100644
index 1cf1b69..0000000
--- a/media/libeffects/proxy/Android.bp
+++ /dev/null
@@ -1,26 +0,0 @@
-cc_library_shared {
-    name: "libeffectproxy",
-    relative_install_path: "soundfx",
-
-    vendor: true,
-    srcs: ["EffectProxy.cpp"],
-
-    include_dirs: ["."],
-
-    cflags: [
-        "-fvisibility=hidden",
-        "-Wall",
-        "-Werror",
-    ],
-
-    shared_libs: [
-        "liblog",
-        "libcutils",
-        "libutils",
-        "libdl",
-        "libeffects",
-    ],
-    header_libs: [
-        "android.hardware.audio.effect.legacy@2.0",
-    ],
-}
diff --git a/media/libeffects/proxy/Android.mk b/media/libeffects/proxy/Android.mk
new file mode 100644
index 0000000..c4de30d
--- /dev/null
+++ b/media/libeffects/proxy/Android.mk
@@ -0,0 +1,35 @@
+# Copyright 2013 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.
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+LOCAL_MODULE:= libeffectproxy
+LOCAL_MODULE_RELATIVE_PATH := soundfx
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_VENDOR_MODULE := true
+LOCAL_SRC_FILES := \
+        EffectProxy.cpp
+
+LOCAL_CFLAGS+= -fvisibility=hidden
+LOCAL_CFLAGS += -Wall -Werror
+
+LOCAL_SHARED_LIBRARIES := liblog libcutils libutils libdl libeffects
+
+LOCAL_C_INCLUDES := \
+        system/media/audio_effects/include \
+        frameworks/av/media/libeffects/factory
+
+include $(BUILD_SHARED_LIBRARY)
+
diff --git a/media/libeffects/visualizer/Android.mk b/media/libeffects/visualizer/Android.mk
index ba23fba..70409de 100644
--- a/media/libeffects/visualizer/Android.mk
+++ b/media/libeffects/visualizer/Android.mk
@@ -22,8 +22,5 @@
 	$(call include-path-for, audio-effects)
 
 
-LOCAL_HEADER_LIBRARIES += \
-    libhardware_headers \
-    android.hardware.audio.effect.legacy@2.0 \
-
+LOCAL_HEADER_LIBRARIES += libhardware_headers
 include $(BUILD_SHARED_LIBRARY)