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/libaaudio/examples/loopback/Android.bp b/media/libaaudio/examples/loopback/Android.bp
index 95de345..5b7d956 100644
--- a/media/libaaudio/examples/loopback/Android.bp
+++ b/media/libaaudio/examples/loopback/Android.bp
@@ -6,7 +6,7 @@
     static_libs: ["libsndfile"],
     shared_libs: [
         "libaaudio",
-        "libaudioutils_system",
+        "libaudioutils",
         ],
     header_libs: ["libaaudio_example_utils"],
 }
diff --git a/media/libaaudio/examples/loopback/jni/Android.mk b/media/libaaudio/examples/loopback/jni/Android.mk
index 7a24c99..aebe877 100644
--- a/media/libaaudio/examples/loopback/jni/Android.mk
+++ b/media/libaaudio/examples/loopback/jni/Android.mk
@@ -11,6 +11,6 @@
 LOCAL_SRC_FILES:= ../src/loopback.cpp
 LOCAL_CFLAGS := -Wall -Werror
 LOCAL_STATIC_LIBRARIES := libsndfile
-LOCAL_SHARED_LIBRARIES := libaaudio libaudioutils_system
+LOCAL_SHARED_LIBRARIES := libaaudio libaudioutils
 LOCAL_MODULE := aaudio_loopback
 include $(BUILD_EXECUTABLE)
diff --git a/media/libaudioclient/Android.bp b/media/libaudioclient/Android.bp
index c3bb8de..2df37a8 100644
--- a/media/libaudioclient/Android.bp
+++ b/media/libaudioclient/Android.bp
@@ -45,7 +45,7 @@
         "libutils",
         "libbinder",
         "libdl",
-        "libaudioutils_system",
+        "libaudioutils",
         "libaudiomanager",
         "libmedia_helper",
         "libmediametrics",
diff --git a/media/libaudiohal/2.0/Android.bp b/media/libaudiohal/2.0/Android.bp
index 0ab8981..574b435 100644
--- a/media/libaudiohal/2.0/Android.bp
+++ b/media/libaudiohal/2.0/Android.bp
@@ -6,6 +6,7 @@
         "DevicesFactoryHalHybrid.cpp",
         "DevicesFactoryHalLocal.cpp",
         "StreamHalLocal.cpp",
+
         "ConversionHelperHidl.cpp",
         "DeviceHalHidl.cpp",
         "DevicesFactoryHalHidl.cpp",
@@ -13,7 +14,6 @@
         "EffectHalHidl.cpp",
         "EffectsFactoryHalHidl.cpp",
         "StreamHalHidl.cpp",
-        "HidlUtils.cpp",
     ],
 
     export_include_dirs: ["."],
@@ -24,7 +24,7 @@
     ],
     shared_libs: [
         "libaudiohal_deathhandler",
-        "libaudioutils_system",
+        "libaudioutils",
         "libcutils",
         "liblog",
         "libutils",
@@ -37,6 +37,7 @@
         "libhidltransport",
         "android.hardware.audio@2.0",
         "android.hardware.audio.common@2.0",
+        "android.hardware.audio.common@2.0-util",
         "android.hardware.audio.effect@2.0",
         "android.hidl.allocator@1.0",
         "android.hidl.memory@1.0",
@@ -44,8 +45,7 @@
         "libmediautils",
     ],
     header_libs: [
-        "libaudiohal_headers",
-        "libaudiohal_util",
+        "libaudiohal_headers"
     ],
 
     export_shared_lib_headers: [
diff --git a/media/libaudiohal/2.0/EffectHalHidl.cpp b/media/libaudiohal/2.0/EffectHalHidl.cpp
index 87b1b41..4fb032c 100644
--- a/media/libaudiohal/2.0/EffectHalHidl.cpp
+++ b/media/libaudiohal/2.0/EffectHalHidl.cpp
@@ -18,6 +18,7 @@
 //#define LOG_NDEBUG 0
 
 #include <hwbinder/IPCThreadState.h>
+#include <media/EffectsFactoryApi.h>
 #include <utils/Log.h>
 
 #include "ConversionHelperHidl.h"
diff --git a/media/libaudiohal/2.0/HidlUtils.cpp b/media/libaudiohal/2.0/HidlUtils.cpp
deleted file mode 100644
index 228503f..0000000
--- a/media/libaudiohal/2.0/HidlUtils.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2016 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 "HidlUtils.h"
-
-#define AUDIO_HAL_VERSION V2_0
-#include <util/HidlUtils.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/media/libaudiohal/2.0/HidlUtils.h b/media/libaudiohal/2.0/HidlUtils.h
deleted file mode 100644
index 588b4dc..0000000
--- a/media/libaudiohal/2.0/HidlUtils.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2016 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_Hidl_Utils_H_
-#define android_hardware_audio_V2_0_Hidl_Utils_H_
-
-#include <android/hardware/audio/common/2.0/types.h>
-
-#define AUDIO_HAL_VERSION V2_0
-#include <util/HidlUtils.h>
-#undef AUDIO_HAL_VERSION
-
-#endif  // android_hardware_audio_V2_0_Hidl_Utils_H_
diff --git a/media/libaudiohal/Android.bp b/media/libaudiohal/Android.bp
index f4d41e5..7ecb9d8 100644
--- a/media/libaudiohal/Android.bp
+++ b/media/libaudiohal/Android.bp
@@ -19,7 +19,7 @@
     ],
 
     header_libs: [
-        "libaudiohal_headers",
+        "libaudiohal_headers"
     ]
 }
 
@@ -50,11 +50,4 @@
     name: "libaudiohal_headers",
 
     export_include_dirs: ["include"],
-
-    header_libs: [
-        "libaudiohal_legacy_headers",
-    ],
-    export_header_lib_headers: [
-        "libaudiohal_legacy_headers",
-    ],
 }
diff --git a/media/libaudiohal/legacy/Android.bp b/media/libaudiohal/legacy/Android.bp
deleted file mode 100644
index 780c5d6..0000000
--- a/media/libaudiohal/legacy/Android.bp
+++ /dev/null
@@ -1,12 +0,0 @@
-cc_library_headers {
-    name: "libaudiohal_legacy_headers",
-
-    export_include_dirs: ["include"],
-
-    header_libs: [
-        "libaudio_system_headers",
-    ],
-    export_header_lib_headers: [
-        "libaudio_system_headers",
-    ],
-}
diff --git a/media/libaudiohal/legacy/include/hardware/audio.h b/media/libaudiohal/legacy/include/hardware/audio.h
deleted file mode 100644
index 58f31d5..0000000
--- a/media/libaudiohal/legacy/include/hardware/audio.h
+++ /dev/null
@@ -1,746 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-// TODO: Remove parts unused by the system
-
-#ifndef ANDROID_AUDIO_HAL_INTERFACE_H
-#define ANDROID_AUDIO_HAL_INTERFACE_H
-
-#include <stdint.h>
-#include <strings.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <time.h>
-
-#include <cutils/bitops.h>
-
-#include <hardware/hardware.h>
-#include <system/audio.h>
-#include <hardware/audio_effect.h>
-
-__BEGIN_DECLS
-
-/**
- * The id of this module
- */
-#define AUDIO_HARDWARE_MODULE_ID "audio"
-
-/**
- * Name of the audio devices to open
- */
-#define AUDIO_HARDWARE_INTERFACE "audio_hw_if"
-
-
-/* Use version 0.1 to be compatible with first generation of audio hw module with version_major
- * hardcoded to 1. No audio module API change.
- */
-#define AUDIO_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1)
-#define AUDIO_MODULE_API_VERSION_CURRENT AUDIO_MODULE_API_VERSION_0_1
-
-/* First generation of audio devices had version hardcoded to 0. all devices with versions < 1.0
- * will be considered of first generation API.
- */
-#define AUDIO_DEVICE_API_VERSION_0_0 HARDWARE_DEVICE_API_VERSION(0, 0)
-#define AUDIO_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0)
-#define AUDIO_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION(2, 0)
-#define AUDIO_DEVICE_API_VERSION_3_0 HARDWARE_DEVICE_API_VERSION(3, 0)
-#define AUDIO_DEVICE_API_VERSION_CURRENT AUDIO_DEVICE_API_VERSION_3_0
-/* Minimal audio HAL version supported by the audio framework */
-#define AUDIO_DEVICE_API_VERSION_MIN AUDIO_DEVICE_API_VERSION_2_0
-
-/**************************************/
-
-/**
- *  standard audio parameters that the HAL may need to handle
- */
-
-/**
- *  audio device parameters
- */
-
-/* TTY mode selection */
-#define AUDIO_PARAMETER_KEY_TTY_MODE "tty_mode"
-#define AUDIO_PARAMETER_VALUE_TTY_OFF "tty_off"
-#define AUDIO_PARAMETER_VALUE_TTY_VCO "tty_vco"
-#define AUDIO_PARAMETER_VALUE_TTY_HCO "tty_hco"
-#define AUDIO_PARAMETER_VALUE_TTY_FULL "tty_full"
-
-/* Hearing Aid Compatibility - Telecoil (HAC-T) mode on/off */
-#define AUDIO_PARAMETER_KEY_HAC "HACSetting"
-#define AUDIO_PARAMETER_VALUE_HAC_ON "ON"
-#define AUDIO_PARAMETER_VALUE_HAC_OFF "OFF"
-
-/* A2DP sink address set by framework */
-#define AUDIO_PARAMETER_A2DP_SINK_ADDRESS "a2dp_sink_address"
-
-/* A2DP source address set by framework */
-#define AUDIO_PARAMETER_A2DP_SOURCE_ADDRESS "a2dp_source_address"
-
-/* Bluetooth SCO wideband */
-#define AUDIO_PARAMETER_KEY_BT_SCO_WB "bt_wbs"
-
-/**
- *  audio stream parameters
- */
-
-/* Enable AANC */
-#define AUDIO_PARAMETER_KEY_AANC "aanc_enabled"
-
-/**************************************/
-
-/* common audio stream parameters and operations */
-struct audio_stream {
-
-    /**
-     * Return the sampling rate in Hz - eg. 44100.
-     */
-    uint32_t (*get_sample_rate)(const struct audio_stream *stream);
-
-    /* currently unused - use set_parameters with key
-     *    AUDIO_PARAMETER_STREAM_SAMPLING_RATE
-     */
-    int (*set_sample_rate)(struct audio_stream *stream, uint32_t rate);
-
-    /**
-     * Return size of input/output buffer in bytes for this stream - eg. 4800.
-     * It should be a multiple of the frame size.  See also get_input_buffer_size.
-     */
-    size_t (*get_buffer_size)(const struct audio_stream *stream);
-
-    /**
-     * Return the channel mask -
-     *  e.g. AUDIO_CHANNEL_OUT_STEREO or AUDIO_CHANNEL_IN_STEREO
-     */
-    audio_channel_mask_t (*get_channels)(const struct audio_stream *stream);
-
-    /**
-     * Return the audio format - e.g. AUDIO_FORMAT_PCM_16_BIT
-     */
-    audio_format_t (*get_format)(const struct audio_stream *stream);
-
-    /* currently unused - use set_parameters with key
-     *     AUDIO_PARAMETER_STREAM_FORMAT
-     */
-    int (*set_format)(struct audio_stream *stream, audio_format_t format);
-
-    /**
-     * Put the audio hardware input/output into standby mode.
-     * Driver should exit from standby mode at the next I/O operation.
-     * Returns 0 on success and <0 on failure.
-     */
-    int (*standby)(struct audio_stream *stream);
-
-    /** dump the state of the audio input/output device */
-    int (*dump)(const struct audio_stream *stream, int fd);
-
-    /** Return the set of device(s) which this stream is connected to */
-    audio_devices_t (*get_device)(const struct audio_stream *stream);
-
-    /**
-     * Currently unused - set_device() corresponds to set_parameters() with key
-     * AUDIO_PARAMETER_STREAM_ROUTING for both input and output.
-     * AUDIO_PARAMETER_STREAM_INPUT_SOURCE is an additional information used by
-     * input streams only.
-     */
-    int (*set_device)(struct audio_stream *stream, audio_devices_t device);
-
-    /**
-     * set/get audio stream parameters. The function accepts a list of
-     * parameter key value pairs in the form: key1=value1;key2=value2;...
-     *
-     * Some keys are reserved for standard parameters (See AudioParameter class)
-     *
-     * If the implementation does not accept a parameter change while
-     * the output is active but the parameter is acceptable otherwise, it must
-     * return -ENOSYS.
-     *
-     * The audio flinger will put the stream in standby and then change the
-     * parameter value.
-     */
-    int (*set_parameters)(struct audio_stream *stream, const char *kv_pairs);
-
-    /*
-     * Returns a pointer to a heap allocated string. The caller is responsible
-     * for freeing the memory for it using free().
-     */
-    char * (*get_parameters)(const struct audio_stream *stream,
-                             const char *keys);
-    int (*add_audio_effect)(const struct audio_stream *stream,
-                             effect_handle_t effect);
-    int (*remove_audio_effect)(const struct audio_stream *stream,
-                             effect_handle_t effect);
-};
-typedef struct audio_stream audio_stream_t;
-
-/* type of asynchronous write callback events. Mutually exclusive */
-typedef enum {
-    STREAM_CBK_EVENT_WRITE_READY, /* non blocking write completed */
-    STREAM_CBK_EVENT_DRAIN_READY,  /* drain completed */
-    STREAM_CBK_EVENT_ERROR, /* stream hit some error, let AF take action */
-} stream_callback_event_t;
-
-typedef int (*stream_callback_t)(stream_callback_event_t event, void *param, void *cookie);
-
-/* type of drain requested to audio_stream_out->drain(). Mutually exclusive */
-typedef enum {
-    AUDIO_DRAIN_ALL,            /* drain() returns when all data has been played */
-    AUDIO_DRAIN_EARLY_NOTIFY    /* drain() returns a short time before all data
-                                   from the current track has been played to
-                                   give time for gapless track switch */
-} audio_drain_type_t;
-
-/**
- * audio_stream_out is the abstraction interface for the audio output hardware.
- *
- * It provides information about various properties of the audio output
- * hardware driver.
- */
-
-struct audio_stream_out {
-    /**
-     * Common methods of the audio stream out.  This *must* be the first member of audio_stream_out
-     * as users of this structure will cast a audio_stream to audio_stream_out pointer in contexts
-     * where it's known the audio_stream references an audio_stream_out.
-     */
-    struct audio_stream common;
-
-    /**
-     * Return the audio hardware driver estimated latency in milliseconds.
-     */
-    uint32_t (*get_latency)(const struct audio_stream_out *stream);
-
-    /**
-     * Use this method in situations where audio mixing is done in the
-     * hardware. This method serves as a direct interface with hardware,
-     * allowing you to directly set the volume as apposed to via the framework.
-     * This method might produce multiple PCM outputs or hardware accelerated
-     * codecs, such as MP3 or AAC.
-     */
-    int (*set_volume)(struct audio_stream_out *stream, float left, float right);
-
-    /**
-     * Write audio buffer to driver. Returns number of bytes written, or a
-     * negative status_t. If at least one frame was written successfully prior to the error,
-     * it is suggested that the driver return that successful (short) byte count
-     * and then return an error in the subsequent call.
-     *
-     * If set_callback() has previously been called to enable non-blocking mode
-     * the write() is not allowed to block. It must write only the number of
-     * bytes that currently fit in the driver/hardware buffer and then return
-     * this byte count. If this is less than the requested write size the
-     * callback function must be called when more space is available in the
-     * driver/hardware buffer.
-     */
-    ssize_t (*write)(struct audio_stream_out *stream, const void* buffer,
-                     size_t bytes);
-
-    /* return the number of audio frames written by the audio dsp to DAC since
-     * the output has exited standby
-     */
-    int (*get_render_position)(const struct audio_stream_out *stream,
-                               uint32_t *dsp_frames);
-
-    /**
-     * get the local time at which the next write to the audio driver will be presented.
-     * The units are microseconds, where the epoch is decided by the local audio HAL.
-     */
-    int (*get_next_write_timestamp)(const struct audio_stream_out *stream,
-                                    int64_t *timestamp);
-
-    /**
-     * set the callback function for notifying completion of non-blocking
-     * write and drain.
-     * Calling this function implies that all future write() and drain()
-     * must be non-blocking and use the callback to signal completion.
-     */
-    int (*set_callback)(struct audio_stream_out *stream,
-            stream_callback_t callback, void *cookie);
-
-    /**
-     * Notifies to the audio driver to stop playback however the queued buffers are
-     * retained by the hardware. Useful for implementing pause/resume. Empty implementation
-     * if not supported however should be implemented for hardware with non-trivial
-     * latency. In the pause state audio hardware could still be using power. User may
-     * consider calling suspend after a timeout.
-     *
-     * Implementation of this function is mandatory for offloaded playback.
-     */
-    int (*pause)(struct audio_stream_out* stream);
-
-    /**
-     * Notifies to the audio driver to resume playback following a pause.
-     * Returns error if called without matching pause.
-     *
-     * Implementation of this function is mandatory for offloaded playback.
-     */
-    int (*resume)(struct audio_stream_out* stream);
-
-    /**
-     * Requests notification when data buffered by the driver/hardware has
-     * been played. If set_callback() has previously been called to enable
-     * non-blocking mode, the drain() must not block, instead it should return
-     * quickly and completion of the drain is notified through the callback.
-     * If set_callback() has not been called, the drain() must block until
-     * completion.
-     * If type==AUDIO_DRAIN_ALL, the drain completes when all previously written
-     * data has been played.
-     * If type==AUDIO_DRAIN_EARLY_NOTIFY, the drain completes shortly before all
-     * data for the current track has played to allow time for the framework
-     * to perform a gapless track switch.
-     *
-     * Drain must return immediately on stop() and flush() call
-     *
-     * Implementation of this function is mandatory for offloaded playback.
-     */
-    int (*drain)(struct audio_stream_out* stream, audio_drain_type_t type );
-
-    /**
-     * Notifies to the audio driver to flush the queued data. Stream must already
-     * be paused before calling flush().
-     *
-     * Implementation of this function is mandatory for offloaded playback.
-     */
-   int (*flush)(struct audio_stream_out* stream);
-
-    /**
-     * Return a recent count of the number of audio frames presented to an external observer.
-     * This excludes frames which have been written but are still in the pipeline.
-     * The count is not reset to zero when output enters standby.
-     * Also returns the value of CLOCK_MONOTONIC as of this presentation count.
-     * The returned count is expected to be 'recent',
-     * but does not need to be the most recent possible value.
-     * However, the associated time should correspond to whatever count is returned.
-     * Example:  assume that N+M frames have been presented, where M is a 'small' number.
-     * Then it is permissible to return N instead of N+M,
-     * and the timestamp should correspond to N rather than N+M.
-     * The terms 'recent' and 'small' are not defined.
-     * They reflect the quality of the implementation.
-     *
-     * 3.0 and higher only.
-     */
-    int (*get_presentation_position)(const struct audio_stream_out *stream,
-                               uint64_t *frames, struct timespec *timestamp);
-
-    /**
-     * Called by the framework to start a stream operating in mmap mode.
-     * create_mmap_buffer must be called before calling start()
-     *
-     * \note Function only implemented by streams operating in mmap mode.
-     *
-     * \param[in] stream the stream object.
-     * \return 0 in case of success.
-     *         -ENOSYS if called out of sequence or on non mmap stream
-     */
-    int (*start)(const struct audio_stream_out* stream);
-
-    /**
-     * Called by the framework to stop a stream operating in mmap mode.
-     * Must be called after start()
-     *
-     * \note Function only implemented by streams operating in mmap mode.
-     *
-     * \param[in] stream the stream object.
-     * \return 0 in case of success.
-     *         -ENOSYS if called out of sequence or on non mmap stream
-     */
-    int (*stop)(const struct audio_stream_out* stream);
-
-    /**
-     * Called by the framework to retrieve information on the mmap buffer used for audio
-     * samples transfer.
-     *
-     * \note Function only implemented by streams operating in mmap mode.
-     *
-     * \param[in] stream the stream object.
-     * \param[in] min_size_frames minimum buffer size requested. The actual buffer
-     *        size returned in struct audio_mmap_buffer_info can be larger.
-     * \param[out] info address at which the mmap buffer information should be returned.
-     *
-     * \return 0 if the buffer was allocated.
-     *         -ENODEV in case of initialization error
-     *         -EINVAL if the requested buffer size is too large
-     *         -ENOSYS if called out of sequence (e.g. buffer already allocated)
-     */
-    int (*create_mmap_buffer)(const struct audio_stream_out *stream,
-                              int32_t min_size_frames,
-                              struct audio_mmap_buffer_info *info);
-
-    /**
-     * Called by the framework to read current read/write position in the mmap buffer
-     * with associated time stamp.
-     *
-     * \note Function only implemented by streams operating in mmap mode.
-     *
-     * \param[in] stream the stream object.
-     * \param[out] position address at which the mmap read/write position should be returned.
-     *
-     * \return 0 if the position is successfully returned.
-     *         -ENODATA if the position cannot be retrieved
-     *         -ENOSYS if called before create_mmap_buffer()
-     */
-    int (*get_mmap_position)(const struct audio_stream_out *stream,
-                             struct audio_mmap_position *position);
-};
-typedef struct audio_stream_out audio_stream_out_t;
-
-struct audio_stream_in {
-    /**
-     * Common methods of the audio stream in.  This *must* be the first member of audio_stream_in
-     * as users of this structure will cast a audio_stream to audio_stream_in pointer in contexts
-     * where it's known the audio_stream references an audio_stream_in.
-     */
-    struct audio_stream common;
-
-    /** set the input gain for the audio driver. This method is for
-     *  for future use */
-    int (*set_gain)(struct audio_stream_in *stream, float gain);
-
-    /** Read audio buffer in from audio driver. Returns number of bytes read, or a
-     *  negative status_t. If at least one frame was read prior to the error,
-     *  read should return that byte count and then return an error in the subsequent call.
-     */
-    ssize_t (*read)(struct audio_stream_in *stream, void* buffer,
-                    size_t bytes);
-
-    /**
-     * Return the amount of input frames lost in the audio driver since the
-     * last call of this function.
-     * Audio driver is expected to reset the value to 0 and restart counting
-     * upon returning the current value by this function call.
-     * Such loss typically occurs when the user space process is blocked
-     * longer than the capacity of audio driver buffers.
-     *
-     * Unit: the number of input audio frames
-     */
-    uint32_t (*get_input_frames_lost)(struct audio_stream_in *stream);
-
-    /**
-     * Return a recent count of the number of audio frames received and
-     * the clock time associated with that frame count.
-     *
-     * frames is the total frame count received. This should be as early in
-     *     the capture pipeline as possible. In general,
-     *     frames should be non-negative and should not go "backwards".
-     *
-     * time is the clock MONOTONIC time when frames was measured. In general,
-     *     time should be a positive quantity and should not go "backwards".
-     *
-     * The status returned is 0 on success, -ENOSYS if the device is not
-     * ready/available, or -EINVAL if the arguments are null or otherwise invalid.
-     */
-    int (*get_capture_position)(const struct audio_stream_in *stream,
-                                int64_t *frames, int64_t *time);
-
-    /**
-     * Called by the framework to start a stream operating in mmap mode.
-     * create_mmap_buffer must be called before calling start()
-     *
-     * \note Function only implemented by streams operating in mmap mode.
-     *
-     * \param[in] stream the stream object.
-     * \return 0 in case off success.
-     *         -ENOSYS if called out of sequence or on non mmap stream
-     */
-    int (*start)(const struct audio_stream_in* stream);
-
-    /**
-     * Called by the framework to stop a stream operating in mmap mode.
-     *
-     * \note Function only implemented by streams operating in mmap mode.
-     *
-     * \param[in] stream the stream object.
-     * \return 0 in case of success.
-     *         -ENOSYS if called out of sequence or on non mmap stream
-     */
-    int (*stop)(const struct audio_stream_in* stream);
-
-    /**
-     * Called by the framework to retrieve information on the mmap buffer used for audio
-     * samples transfer.
-     *
-     * \note Function only implemented by streams operating in mmap mode.
-     *
-     * \param[in] stream the stream object.
-     * \param[in] min_size_frames minimum buffer size requested. The actual buffer
-     *        size returned in struct audio_mmap_buffer_info can be larger.
-     * \param[out] info address at which the mmap buffer information should be returned.
-     *
-     * \return 0 if the buffer was allocated.
-     *         -ENODEV in case of initialization error
-     *         -EINVAL if the requested buffer size is too large
-     *         -ENOSYS if called out of sequence (e.g. buffer already allocated)
-     */
-    int (*create_mmap_buffer)(const struct audio_stream_in *stream,
-                              int32_t min_size_frames,
-                              struct audio_mmap_buffer_info *info);
-
-    /**
-     * Called by the framework to read current read/write position in the mmap buffer
-     * with associated time stamp.
-     *
-     * \note Function only implemented by streams operating in mmap mode.
-     *
-     * \param[in] stream the stream object.
-     * \param[out] position address at which the mmap read/write position should be returned.
-     *
-     * \return 0 if the position is successfully returned.
-     *         -ENODATA if the position cannot be retreived
-     *         -ENOSYS if called before mmap_read_position()
-     */
-    int (*get_mmap_position)(const struct audio_stream_in *stream,
-                             struct audio_mmap_position *position);
-};
-typedef struct audio_stream_in audio_stream_in_t;
-
-/**
- * return the frame size (number of bytes per sample).
- *
- * Deprecated: use audio_stream_out_frame_size() or audio_stream_in_frame_size() instead.
- */
-__attribute__((__deprecated__))
-static inline size_t audio_stream_frame_size(const struct audio_stream *s)
-{
-    size_t chan_samp_sz;
-    audio_format_t format = s->get_format(s);
-
-    if (audio_has_proportional_frames(format)) {
-        chan_samp_sz = audio_bytes_per_sample(format);
-        return popcount(s->get_channels(s)) * chan_samp_sz;
-    }
-
-    return sizeof(int8_t);
-}
-
-/**
- * return the frame size (number of bytes per sample) of an output stream.
- */
-static inline size_t audio_stream_out_frame_size(const struct audio_stream_out *s)
-{
-    size_t chan_samp_sz;
-    audio_format_t format = s->common.get_format(&s->common);
-
-    if (audio_has_proportional_frames(format)) {
-        chan_samp_sz = audio_bytes_per_sample(format);
-        return audio_channel_count_from_out_mask(s->common.get_channels(&s->common)) * chan_samp_sz;
-    }
-
-    return sizeof(int8_t);
-}
-
-/**
- * return the frame size (number of bytes per sample) of an input stream.
- */
-static inline size_t audio_stream_in_frame_size(const struct audio_stream_in *s)
-{
-    size_t chan_samp_sz;
-    audio_format_t format = s->common.get_format(&s->common);
-
-    if (audio_has_proportional_frames(format)) {
-        chan_samp_sz = audio_bytes_per_sample(format);
-        return audio_channel_count_from_in_mask(s->common.get_channels(&s->common)) * chan_samp_sz;
-    }
-
-    return sizeof(int8_t);
-}
-
-/**********************************************************************/
-
-/**
- * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM
- * and the fields of this data structure must begin with hw_module_t
- * followed by module specific information.
- */
-struct audio_module {
-    struct hw_module_t common;
-};
-
-struct audio_hw_device {
-    /**
-     * Common methods of the audio device.  This *must* be the first member of audio_hw_device
-     * as users of this structure will cast a hw_device_t to audio_hw_device pointer in contexts
-     * where it's known the hw_device_t references an audio_hw_device.
-     */
-    struct hw_device_t common;
-
-    /**
-     * used by audio flinger to enumerate what devices are supported by
-     * each audio_hw_device implementation.
-     *
-     * Return value is a bitmask of 1 or more values of audio_devices_t
-     *
-     * NOTE: audio HAL implementations starting with
-     * AUDIO_DEVICE_API_VERSION_2_0 do not implement this function.
-     * All supported devices should be listed in audio_policy.conf
-     * file and the audio policy manager must choose the appropriate
-     * audio module based on information in this file.
-     */
-    uint32_t (*get_supported_devices)(const struct audio_hw_device *dev);
-
-    /**
-     * check to see if the audio hardware interface has been initialized.
-     * returns 0 on success, -ENODEV on failure.
-     */
-    int (*init_check)(const struct audio_hw_device *dev);
-
-    /** set the audio volume of a voice call. Range is between 0.0 and 1.0 */
-    int (*set_voice_volume)(struct audio_hw_device *dev, float volume);
-
-    /**
-     * set the audio volume for all audio activities other than voice call.
-     * Range between 0.0 and 1.0. If any value other than 0 is returned,
-     * the software mixer will emulate this capability.
-     */
-    int (*set_master_volume)(struct audio_hw_device *dev, float volume);
-
-    /**
-     * Get the current master volume value for the HAL, if the HAL supports
-     * master volume control.  AudioFlinger will query this value from the
-     * primary audio HAL when the service starts and use the value for setting
-     * the initial master volume across all HALs.  HALs which do not support
-     * this method may leave it set to NULL.
-     */
-    int (*get_master_volume)(struct audio_hw_device *dev, float *volume);
-
-    /**
-     * set_mode is called when the audio mode changes. AUDIO_MODE_NORMAL mode
-     * is for standard audio playback, AUDIO_MODE_RINGTONE when a ringtone is
-     * playing, and AUDIO_MODE_IN_CALL when a call is in progress.
-     */
-    int (*set_mode)(struct audio_hw_device *dev, audio_mode_t mode);
-
-    /* mic mute */
-    int (*set_mic_mute)(struct audio_hw_device *dev, bool state);
-    int (*get_mic_mute)(const struct audio_hw_device *dev, bool *state);
-
-    /* set/get global audio parameters */
-    int (*set_parameters)(struct audio_hw_device *dev, const char *kv_pairs);
-
-    /*
-     * Returns a pointer to a heap allocated string. The caller is responsible
-     * for freeing the memory for it using free().
-     */
-    char * (*get_parameters)(const struct audio_hw_device *dev,
-                             const char *keys);
-
-    /* Returns audio input buffer size according to parameters passed or
-     * 0 if one of the parameters is not supported.
-     * See also get_buffer_size which is for a particular stream.
-     */
-    size_t (*get_input_buffer_size)(const struct audio_hw_device *dev,
-                                    const struct audio_config *config);
-
-    /** This method creates and opens the audio hardware output stream.
-     * The "address" parameter qualifies the "devices" audio device type if needed.
-     * The format format depends on the device type:
-     * - Bluetooth devices use the MAC address of the device in the form "00:11:22:AA:BB:CC"
-     * - USB devices use the ALSA card and device numbers in the form  "card=X;device=Y"
-     * - Other devices may use a number or any other string.
-     */
-
-    int (*open_output_stream)(struct audio_hw_device *dev,
-                              audio_io_handle_t handle,
-                              audio_devices_t devices,
-                              audio_output_flags_t flags,
-                              struct audio_config *config,
-                              struct audio_stream_out **stream_out,
-                              const char *address);
-
-    void (*close_output_stream)(struct audio_hw_device *dev,
-                                struct audio_stream_out* stream_out);
-
-    /** This method creates and opens the audio hardware input stream */
-    int (*open_input_stream)(struct audio_hw_device *dev,
-                             audio_io_handle_t handle,
-                             audio_devices_t devices,
-                             struct audio_config *config,
-                             struct audio_stream_in **stream_in,
-                             audio_input_flags_t flags,
-                             const char *address,
-                             audio_source_t source);
-
-    void (*close_input_stream)(struct audio_hw_device *dev,
-                               struct audio_stream_in *stream_in);
-
-    /** This method dumps the state of the audio hardware */
-    int (*dump)(const struct audio_hw_device *dev, int fd);
-
-    /**
-     * set the audio mute status for all audio activities.  If any value other
-     * than 0 is returned, the software mixer will emulate this capability.
-     */
-    int (*set_master_mute)(struct audio_hw_device *dev, bool mute);
-
-    /**
-     * Get the current master mute status for the HAL, if the HAL supports
-     * master mute control.  AudioFlinger will query this value from the primary
-     * audio HAL when the service starts and use the value for setting the
-     * initial master mute across all HALs.  HALs which do not support this
-     * method may leave it set to NULL.
-     */
-    int (*get_master_mute)(struct audio_hw_device *dev, bool *mute);
-
-    /**
-     * Routing control
-     */
-
-    /* Creates an audio patch between several source and sink ports.
-     * The handle is allocated by the HAL and should be unique for this
-     * audio HAL module. */
-    int (*create_audio_patch)(struct audio_hw_device *dev,
-                               unsigned int num_sources,
-                               const struct audio_port_config *sources,
-                               unsigned int num_sinks,
-                               const struct audio_port_config *sinks,
-                               audio_patch_handle_t *handle);
-
-    /* Release an audio patch */
-    int (*release_audio_patch)(struct audio_hw_device *dev,
-                               audio_patch_handle_t handle);
-
-    /* Fills the list of supported attributes for a given audio port.
-     * As input, "port" contains the information (type, role, address etc...)
-     * needed by the HAL to identify the port.
-     * As output, "port" contains possible attributes (sampling rates, formats,
-     * channel masks, gain controllers...) for this port.
-     */
-    int (*get_audio_port)(struct audio_hw_device *dev,
-                          struct audio_port *port);
-
-    /* Set audio port configuration */
-    int (*set_audio_port_config)(struct audio_hw_device *dev,
-                         const struct audio_port_config *config);
-
-};
-typedef struct audio_hw_device audio_hw_device_t;
-
-/** convenience API for opening and closing a supported device */
-
-static inline int audio_hw_device_open(const struct hw_module_t* module,
-                                       struct audio_hw_device** device)
-{
-    return module->methods->open(module, AUDIO_HARDWARE_INTERFACE,
-                                 TO_HW_DEVICE_T_OPEN(device));
-}
-
-static inline int audio_hw_device_close(struct audio_hw_device* device)
-{
-    return device->common.close(&device->common);
-}
-
-
-__END_DECLS
-
-#endif  // ANDROID_AUDIO_INTERFACE_H
diff --git a/media/libaudiohal/legacy/include/hardware/audio_effect.h b/media/libaudiohal/legacy/include/hardware/audio_effect.h
deleted file mode 100644
index 3366e17..0000000
--- a/media/libaudiohal/legacy/include/hardware/audio_effect.h
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * Copyright (C) 2011 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_AUDIO_EFFECT_H
-#define ANDROID_AUDIO_EFFECT_H
-
-#include <errno.h>
-#include <stdint.h>
-#include <strings.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-#include <cutils/bitops.h>
-
-#include <system/audio_effect.h>
-
-
-__BEGIN_DECLS
-
-
-/////////////////////////////////////////////////
-//      Common Definitions
-/////////////////////////////////////////////////
-
-#define EFFECT_MAKE_API_VERSION(M, m)  (((M)<<16) | ((m) & 0xFFFF))
-#define EFFECT_API_VERSION_MAJOR(v)    ((v)>>16)
-#define EFFECT_API_VERSION_MINOR(v)    ((m) & 0xFFFF)
-
-
-/////////////////////////////////////////////////
-//      Effect control interface
-/////////////////////////////////////////////////
-
-// Effect control interface version 2.0
-#define EFFECT_CONTROL_API_VERSION EFFECT_MAKE_API_VERSION(2,0)
-
-// Effect control interface structure: effect_interface_s
-// The effect control interface is exposed by each effect engine implementation. It consists of
-// a set of functions controlling the configuration, activation and process of the engine.
-// The functions are grouped in a structure of type effect_interface_s.
-//
-// Effect control interface handle: effect_handle_t
-// The effect_handle_t serves two purposes regarding the implementation of the effect engine:
-// - 1 it is the address of a pointer to an effect_interface_s structure where the functions
-// of the effect control API for a particular effect are located.
-// - 2 it is the address of the context of a particular effect instance.
-// A typical implementation in the effect library would define a structure as follows:
-// struct effect_module_s {
-//        const struct effect_interface_s *itfe;
-//        effect_config_t config;
-//        effect_context_t context;
-// }
-// The implementation of EffectCreate() function would then allocate a structure of this
-// type and return its address as effect_handle_t
-typedef struct effect_interface_s **effect_handle_t;
-
-// Effect control interface definition
-struct effect_interface_s {
-    ////////////////////////////////////////////////////////////////////////////////
-    //
-    //    Function:       process
-    //
-    //    Description:    Effect process function. Takes input samples as specified
-    //          (count and location) in input buffer descriptor and output processed
-    //          samples as specified in output buffer descriptor. If the buffer descriptor
-    //          is not specified the function must use either the buffer or the
-    //          buffer provider function installed by the EFFECT_CMD_SET_CONFIG command.
-    //          The effect framework will call the process() function after the EFFECT_CMD_ENABLE
-    //          command is received and until the EFFECT_CMD_DISABLE is received. When the engine
-    //          receives the EFFECT_CMD_DISABLE command it should turn off the effect gracefully
-    //          and when done indicate that it is OK to stop calling the process() function by
-    //          returning the -ENODATA status.
-    //
-    //    NOTE: the process() function implementation should be "real-time safe" that is
-    //      it should not perform blocking calls: malloc/free, sleep, read/write/open/close,
-    //      pthread_cond_wait/pthread_mutex_lock...
-    //
-    //    Input:
-    //          self:       handle to the effect interface this function
-    //              is called on.
-    //          inBuffer:   buffer descriptor indicating where to read samples to process.
-    //              If NULL, use the configuration passed by EFFECT_CMD_SET_CONFIG command.
-    //
-    //          outBuffer:   buffer descriptor indicating where to write processed samples.
-    //              If NULL, use the configuration passed by EFFECT_CMD_SET_CONFIG command.
-    //
-    //    Output:
-    //        returned value:    0 successful operation
-    //                          -ENODATA the engine has finished the disable phase and the framework
-    //                                  can stop calling process()
-    //                          -EINVAL invalid interface handle or
-    //                                  invalid input/output buffer description
-    ////////////////////////////////////////////////////////////////////////////////
-    int32_t (*process)(effect_handle_t self,
-                       audio_buffer_t *inBuffer,
-                       audio_buffer_t *outBuffer);
-    ////////////////////////////////////////////////////////////////////////////////
-    //
-    //    Function:       command
-    //
-    //    Description:    Send a command and receive a response to/from effect engine.
-    //
-    //    Input:
-    //          self:       handle to the effect interface this function
-    //              is called on.
-    //          cmdCode:    command code: the command can be a standardized command defined in
-    //              effect_command_e (see below) or a proprietary command.
-    //          cmdSize:    size of command in bytes
-    //          pCmdData:   pointer to command data
-    //          pReplyData: pointer to reply data
-    //
-    //    Input/Output:
-    //          replySize: maximum size of reply data as input
-    //                      actual size of reply data as output
-    //
-    //    Output:
-    //          returned value: 0       successful operation
-    //                          -EINVAL invalid interface handle or
-    //                                  invalid command/reply size or format according to
-    //                                  command code
-    //              The return code should be restricted to indicate problems related to this API
-    //              specification. Status related to the execution of a particular command should be
-    //              indicated as part of the reply field.
-    //
-    //          *pReplyData updated with command response
-    //
-    ////////////////////////////////////////////////////////////////////////////////
-    int32_t (*command)(effect_handle_t self,
-                       uint32_t cmdCode,
-                       uint32_t cmdSize,
-                       void *pCmdData,
-                       uint32_t *replySize,
-                       void *pReplyData);
-    ////////////////////////////////////////////////////////////////////////////////
-    //
-    //    Function:        get_descriptor
-    //
-    //    Description:    Returns the effect descriptor
-    //
-    //    Input:
-    //          self:       handle to the effect interface this function
-    //              is called on.
-    //
-    //    Input/Output:
-    //          pDescriptor:    address where to return the effect descriptor.
-    //
-    //    Output:
-    //        returned value:    0          successful operation.
-    //                          -EINVAL     invalid interface handle or invalid pDescriptor
-    //        *pDescriptor:     updated with the effect descriptor.
-    //
-    ////////////////////////////////////////////////////////////////////////////////
-    int32_t (*get_descriptor)(effect_handle_t self,
-                              effect_descriptor_t *pDescriptor);
-    ////////////////////////////////////////////////////////////////////////////////
-    //
-    //    Function:       process_reverse
-    //
-    //    Description:    Process reverse stream function. This function is used to pass
-    //          a reference stream to the effect engine. If the engine does not need a reference
-    //          stream, this function pointer can be set to NULL.
-    //          This function would typically implemented by an Echo Canceler.
-    //
-    //    Input:
-    //          self:       handle to the effect interface this function
-    //              is called on.
-    //          inBuffer:   buffer descriptor indicating where to read samples to process.
-    //              If NULL, use the configuration passed by EFFECT_CMD_SET_CONFIG_REVERSE command.
-    //
-    //          outBuffer:   buffer descriptor indicating where to write processed samples.
-    //              If NULL, use the configuration passed by EFFECT_CMD_SET_CONFIG_REVERSE command.
-    //              If the buffer and buffer provider in the configuration received by
-    //              EFFECT_CMD_SET_CONFIG_REVERSE are also NULL, do not return modified reverse
-    //              stream data
-    //
-    //    Output:
-    //        returned value:    0 successful operation
-    //                          -ENODATA the engine has finished the disable phase and the framework
-    //                                  can stop calling process_reverse()
-    //                          -EINVAL invalid interface handle or
-    //                                  invalid input/output buffer description
-    ////////////////////////////////////////////////////////////////////////////////
-    int32_t (*process_reverse)(effect_handle_t self,
-                               audio_buffer_t *inBuffer,
-                               audio_buffer_t *outBuffer);
-};
-
-/////////////////////////////////////////////////
-//      Effect library interface
-/////////////////////////////////////////////////
-
-// Effect library interface version 3.0
-// Note that EffectsFactory.c only checks the major version component, so changes to the minor
-// number can only be used for fully backwards compatible changes
-#define EFFECT_LIBRARY_API_VERSION EFFECT_MAKE_API_VERSION(3,0)
-
-#define AUDIO_EFFECT_LIBRARY_TAG ((('A') << 24) | (('E') << 16) | (('L') << 8) | ('T'))
-
-// Every effect library must have a data structure named AUDIO_EFFECT_LIBRARY_INFO_SYM
-// and the fields of this data structure must begin with audio_effect_library_t
-
-typedef struct audio_effect_library_s {
-    // tag must be initialized to AUDIO_EFFECT_LIBRARY_TAG
-    uint32_t tag;
-    // Version of the effect library API : 0xMMMMmmmm MMMM: Major, mmmm: minor
-    uint32_t version;
-    // Name of this library
-    const char *name;
-    // Author/owner/implementor of the library
-    const char *implementor;
-
-    ////////////////////////////////////////////////////////////////////////////////
-    //
-    //    Function:        create_effect
-    //
-    //    Description:    Creates an effect engine of the specified implementation uuid 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:
-    //          uuid:    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 in
-    //              audio HAL.
-    //              For future use especially with tunneled HW accelerated effects
-    //
-    //    Input/Output:
-    //          pHandle:        address where to return the effect interface handle.
-    //
-    //    Output:
-    //        returned value:    0          successful operation.
-    //                          -ENODEV     library failed to initialize
-    //                          -EINVAL     invalid pEffectUuid or pHandle
-    //                          -ENOENT     no effect with this uuid found
-    //        *pHandle:         updated with the effect interface handle.
-    //
-    ////////////////////////////////////////////////////////////////////////////////
-    int32_t (*create_effect)(const effect_uuid_t *uuid,
-                             int32_t sessionId,
-                             int32_t ioId,
-                             effect_handle_t *pHandle);
-
-    ////////////////////////////////////////////////////////////////////////////////
-    //
-    //    Function:        release_effect
-    //
-    //    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     library failed to initialize
-    //                          -EINVAL     invalid interface handle
-    //
-    ////////////////////////////////////////////////////////////////////////////////
-    int32_t (*release_effect)(effect_handle_t handle);
-
-    ////////////////////////////////////////////////////////////////////////////////
-    //
-    //    Function:        get_descriptor
-    //
-    //    Description:    Returns the descriptor of the effect engine which implementation UUID is
-    //          given as argument.
-    //
-    //    Input/Output:
-    //          uuid:           pointer to the effect uuid.
-    //          pDescriptor:    address where to return the effect descriptor.
-    //
-    //    Output:
-    //        returned value:    0          successful operation.
-    //                          -ENODEV     library failed to initialize
-    //                          -EINVAL     invalid pDescriptor or uuid
-    //        *pDescriptor:     updated with the effect descriptor.
-    //
-    ////////////////////////////////////////////////////////////////////////////////
-    int32_t (*get_descriptor)(const effect_uuid_t *uuid,
-                              effect_descriptor_t *pDescriptor);
-} audio_effect_library_t;
-
-// Name of the hal_module_info
-#define AUDIO_EFFECT_LIBRARY_INFO_SYM         AELI
-
-// Name of the hal_module_info as a string
-#define AUDIO_EFFECT_LIBRARY_INFO_SYM_AS_STR  "AELI"
-
-__END_DECLS
-
-#endif  // ANDROID_AUDIO_EFFECT_H
diff --git a/media/libaudiohal/util/Android.bp b/media/libaudiohal/util/Android.bp
deleted file mode 100644
index 5229f36..0000000
--- a/media/libaudiohal/util/Android.bp
+++ /dev/null
@@ -1,13 +0,0 @@
-cc_library_headers {
-    name: "libaudiohal_util",
-
-    export_include_dirs: ["include"],
-
-    header_libs: [
-        "libaudio_system_headers",
-    ],
-    export_header_lib_headers: [
-        "libaudio_system_headers",
-    ],
-}
-
diff --git a/media/libaudiohal/util/include/util/HidlUtils.h b/media/libaudiohal/util/include/util/HidlUtils.h
deleted file mode 100644
index 1654ac6..0000000
--- a/media/libaudiohal/util/include/util/HidlUtils.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2016 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
-
-#include <memory>
-
-#include <system/audio.h>
-
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioConfig;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioGain;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioGainConfig;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioOffloadInfo;
-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::Uuid;
-using ::android::hardware::hidl_vec;
-
-namespace android {
-namespace hardware {
-namespace audio {
-namespace common {
-namespace AUDIO_HAL_VERSION {
-
-class HidlUtils {
-   public:
-    static void audioConfigFromHal(const audio_config_t& halConfig, AudioConfig* config);
-    static void audioConfigToHal(const AudioConfig& config, audio_config_t* halConfig);
-    static void audioGainConfigFromHal(const struct audio_gain_config& halConfig,
-                                       AudioGainConfig* config);
-    static void audioGainConfigToHal(const AudioGainConfig& config,
-                                     struct audio_gain_config* halConfig);
-    static void audioGainFromHal(const struct audio_gain& halGain, AudioGain* gain);
-    static void audioGainToHal(const AudioGain& gain, struct audio_gain* halGain);
-    static void audioOffloadInfoFromHal(const audio_offload_info_t& halOffload,
-                                        AudioOffloadInfo* offload);
-    static void audioOffloadInfoToHal(const AudioOffloadInfo& offload,
-                                      audio_offload_info_t* halOffload);
-    static void audioPortConfigFromHal(const struct audio_port_config& halConfig,
-                                       AudioPortConfig* config);
-    static void audioPortConfigToHal(const AudioPortConfig& config,
-                                     struct audio_port_config* halConfig);
-    static void audioPortConfigsFromHal(unsigned int numHalConfigs,
-                                        const struct audio_port_config* halConfigs,
-                                        hidl_vec<AudioPortConfig>* configs);
-    static std::unique_ptr<audio_port_config[]> audioPortConfigsToHal(
-        const hidl_vec<AudioPortConfig>& configs);
-    static void audioPortFromHal(const struct audio_port& halPort, AudioPort* port);
-    static void audioPortToHal(const AudioPort& port, struct audio_port* halPort);
-    static void uuidFromHal(const audio_uuid_t& halUuid, Uuid* uuid);
-    static void uuidToHal(const Uuid& uuid, audio_uuid_t* halUuid);
-};
-
-}  // namespace AUDIO_HAL_VERSION
-}  // namespace common
-}  // namespace audio
-}  // namespace hardware
-}  // namespace android
diff --git a/media/libaudiohal/util/include/util/HidlUtils.impl.h b/media/libaudiohal/util/include/util/HidlUtils.impl.h
deleted file mode 100644
index 935f307..0000000
--- a/media/libaudiohal/util/include/util/HidlUtils.impl.h
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * Copyright (C) 2016 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
-
-#include <string.h>
-
-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::AudioGainMode;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMixLatencyClass;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortConfigMask;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortRole;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortType;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioStreamType;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioUsage;
-
-namespace android {
-namespace hardware {
-namespace audio {
-namespace common {
-namespace AUDIO_HAL_VERSION {
-
-void HidlUtils::audioConfigFromHal(const audio_config_t& halConfig, AudioConfig* config) {
-    config->sampleRateHz = halConfig.sample_rate;
-    config->channelMask = AudioChannelMask(halConfig.channel_mask);
-    config->format = AudioFormat(halConfig.format);
-    audioOffloadInfoFromHal(halConfig.offload_info, &config->offloadInfo);
-    config->frameCount = halConfig.frame_count;
-}
-
-void HidlUtils::audioConfigToHal(const AudioConfig& config, audio_config_t* halConfig) {
-    memset(halConfig, 0, sizeof(audio_config_t));
-    halConfig->sample_rate = config.sampleRateHz;
-    halConfig->channel_mask = static_cast<audio_channel_mask_t>(config.channelMask);
-    halConfig->format = static_cast<audio_format_t>(config.format);
-    audioOffloadInfoToHal(config.offloadInfo, &halConfig->offload_info);
-    halConfig->frame_count = config.frameCount;
-}
-
-void HidlUtils::audioGainConfigFromHal(const struct audio_gain_config& halConfig,
-                                       AudioGainConfig* config) {
-    config->index = halConfig.index;
-    config->mode = AudioGainMode(halConfig.mode);
-    config->channelMask = AudioChannelMask(halConfig.channel_mask);
-    for (size_t i = 0; i < sizeof(audio_channel_mask_t) * 8; ++i) {
-        config->values[i] = halConfig.values[i];
-    }
-    config->rampDurationMs = halConfig.ramp_duration_ms;
-}
-
-void HidlUtils::audioGainConfigToHal(const AudioGainConfig& config,
-                                     struct audio_gain_config* halConfig) {
-    halConfig->index = config.index;
-    halConfig->mode = static_cast<audio_gain_mode_t>(config.mode);
-    halConfig->channel_mask = static_cast<audio_channel_mask_t>(config.channelMask);
-    memset(halConfig->values, 0, sizeof(halConfig->values));
-    for (size_t i = 0; i < sizeof(audio_channel_mask_t) * 8; ++i) {
-        halConfig->values[i] = config.values[i];
-    }
-    halConfig->ramp_duration_ms = config.rampDurationMs;
-}
-
-void HidlUtils::audioGainFromHal(const struct audio_gain& halGain, AudioGain* gain) {
-    gain->mode = AudioGainMode(halGain.mode);
-    gain->channelMask = AudioChannelMask(halGain.channel_mask);
-    gain->minValue = halGain.min_value;
-    gain->maxValue = halGain.max_value;
-    gain->defaultValue = halGain.default_value;
-    gain->stepValue = halGain.step_value;
-    gain->minRampMs = halGain.min_ramp_ms;
-    gain->maxRampMs = halGain.max_ramp_ms;
-}
-
-void HidlUtils::audioGainToHal(const AudioGain& gain, struct audio_gain* halGain) {
-    halGain->mode = static_cast<audio_gain_mode_t>(gain.mode);
-    halGain->channel_mask = static_cast<audio_channel_mask_t>(gain.channelMask);
-    halGain->min_value = gain.minValue;
-    halGain->max_value = gain.maxValue;
-    halGain->default_value = gain.defaultValue;
-    halGain->step_value = gain.stepValue;
-    halGain->min_ramp_ms = gain.minRampMs;
-    halGain->max_ramp_ms = gain.maxRampMs;
-}
-
-void HidlUtils::audioOffloadInfoFromHal(const audio_offload_info_t& halOffload,
-                                        AudioOffloadInfo* offload) {
-    offload->sampleRateHz = halOffload.sample_rate;
-    offload->channelMask = AudioChannelMask(halOffload.channel_mask);
-    offload->format = AudioFormat(halOffload.format);
-    offload->streamType = AudioStreamType(halOffload.stream_type);
-    offload->bitRatePerSecond = halOffload.bit_rate;
-    offload->durationMicroseconds = halOffload.duration_us;
-    offload->hasVideo = halOffload.has_video;
-    offload->isStreaming = halOffload.is_streaming;
-    offload->bitWidth = halOffload.bit_width;
-    offload->bufferSize = halOffload.offload_buffer_size;
-    offload->usage = static_cast<AudioUsage>(halOffload.usage);
-}
-
-void HidlUtils::audioOffloadInfoToHal(const AudioOffloadInfo& offload,
-                                      audio_offload_info_t* halOffload) {
-    *halOffload = AUDIO_INFO_INITIALIZER;
-    halOffload->sample_rate = offload.sampleRateHz;
-    halOffload->channel_mask = static_cast<audio_channel_mask_t>(offload.channelMask);
-    halOffload->format = static_cast<audio_format_t>(offload.format);
-    halOffload->stream_type = static_cast<audio_stream_type_t>(offload.streamType);
-    halOffload->bit_rate = offload.bitRatePerSecond;
-    halOffload->duration_us = offload.durationMicroseconds;
-    halOffload->has_video = offload.hasVideo;
-    halOffload->is_streaming = offload.isStreaming;
-    halOffload->bit_width = offload.bitWidth;
-    halOffload->offload_buffer_size = offload.bufferSize;
-    halOffload->usage = static_cast<audio_usage_t>(offload.usage);
-}
-
-void HidlUtils::audioPortConfigFromHal(const struct audio_port_config& halConfig,
-                                       AudioPortConfig* config) {
-    config->id = halConfig.id;
-    config->role = AudioPortRole(halConfig.role);
-    config->type = AudioPortType(halConfig.type);
-    config->configMask = AudioPortConfigMask(halConfig.config_mask);
-    config->sampleRateHz = halConfig.sample_rate;
-    config->channelMask = AudioChannelMask(halConfig.channel_mask);
-    config->format = AudioFormat(halConfig.format);
-    audioGainConfigFromHal(halConfig.gain, &config->gain);
-    switch (halConfig.type) {
-        case AUDIO_PORT_TYPE_NONE:
-            break;
-        case AUDIO_PORT_TYPE_DEVICE: {
-            config->ext.device.hwModule = halConfig.ext.device.hw_module;
-            config->ext.device.type = AudioDevice(halConfig.ext.device.type);
-            memcpy(config->ext.device.address.data(), halConfig.ext.device.address,
-                   AUDIO_DEVICE_MAX_ADDRESS_LEN);
-            break;
-        }
-        case AUDIO_PORT_TYPE_MIX: {
-            config->ext.mix.hwModule = halConfig.ext.mix.hw_module;
-            config->ext.mix.ioHandle = halConfig.ext.mix.handle;
-            if (halConfig.role == AUDIO_PORT_ROLE_SOURCE) {
-                config->ext.mix.useCase.source = AudioSource(halConfig.ext.mix.usecase.source);
-            } else if (halConfig.role == AUDIO_PORT_ROLE_SINK) {
-                config->ext.mix.useCase.stream = AudioStreamType(halConfig.ext.mix.usecase.stream);
-            }
-            break;
-        }
-        case AUDIO_PORT_TYPE_SESSION: {
-            config->ext.session.session = halConfig.ext.session.session;
-            break;
-        }
-    }
-}
-
-void HidlUtils::audioPortConfigToHal(const AudioPortConfig& config,
-                                     struct audio_port_config* halConfig) {
-    memset(halConfig, 0, sizeof(audio_port_config));
-    halConfig->id = config.id;
-    halConfig->role = static_cast<audio_port_role_t>(config.role);
-    halConfig->type = static_cast<audio_port_type_t>(config.type);
-    halConfig->config_mask = static_cast<unsigned int>(config.configMask);
-    halConfig->sample_rate = config.sampleRateHz;
-    halConfig->channel_mask = static_cast<audio_channel_mask_t>(config.channelMask);
-    halConfig->format = static_cast<audio_format_t>(config.format);
-    audioGainConfigToHal(config.gain, &halConfig->gain);
-    switch (config.type) {
-        case AudioPortType::NONE:
-            break;
-        case AudioPortType::DEVICE: {
-            halConfig->ext.device.hw_module = config.ext.device.hwModule;
-            halConfig->ext.device.type = static_cast<audio_devices_t>(config.ext.device.type);
-            memcpy(halConfig->ext.device.address, config.ext.device.address.data(),
-                   AUDIO_DEVICE_MAX_ADDRESS_LEN);
-            break;
-        }
-        case AudioPortType::MIX: {
-            halConfig->ext.mix.hw_module = config.ext.mix.hwModule;
-            halConfig->ext.mix.handle = config.ext.mix.ioHandle;
-            if (config.role == AudioPortRole::SOURCE) {
-                halConfig->ext.mix.usecase.source =
-                    static_cast<audio_source_t>(config.ext.mix.useCase.source);
-            } else if (config.role == AudioPortRole::SINK) {
-                halConfig->ext.mix.usecase.stream =
-                    static_cast<audio_stream_type_t>(config.ext.mix.useCase.stream);
-            }
-            break;
-        }
-        case AudioPortType::SESSION: {
-            halConfig->ext.session.session =
-                static_cast<audio_session_t>(config.ext.session.session);
-            break;
-        }
-    }
-}
-
-void HidlUtils::audioPortConfigsFromHal(unsigned int numHalConfigs,
-                                        const struct audio_port_config* halConfigs,
-                                        hidl_vec<AudioPortConfig>* configs) {
-    configs->resize(numHalConfigs);
-    for (unsigned int i = 0; i < numHalConfigs; ++i) {
-        audioPortConfigFromHal(halConfigs[i], &(*configs)[i]);
-    }
-}
-
-std::unique_ptr<audio_port_config[]> HidlUtils::audioPortConfigsToHal(
-    const hidl_vec<AudioPortConfig>& configs) {
-    std::unique_ptr<audio_port_config[]> halConfigs(new audio_port_config[configs.size()]);
-    for (size_t i = 0; i < configs.size(); ++i) {
-        audioPortConfigToHal(configs[i], &halConfigs[i]);
-    }
-    return halConfigs;
-}
-
-void HidlUtils::audioPortFromHal(const struct audio_port& halPort, AudioPort* port) {
-    port->id = halPort.id;
-    port->role = AudioPortRole(halPort.role);
-    port->type = AudioPortType(halPort.type);
-    port->name.setToExternal(halPort.name, strlen(halPort.name));
-    port->sampleRates.resize(halPort.num_sample_rates);
-    for (size_t i = 0; i < halPort.num_sample_rates; ++i) {
-        port->sampleRates[i] = halPort.sample_rates[i];
-    }
-    port->channelMasks.resize(halPort.num_channel_masks);
-    for (size_t i = 0; i < halPort.num_channel_masks; ++i) {
-        port->channelMasks[i] = AudioChannelMask(halPort.channel_masks[i]);
-    }
-    port->formats.resize(halPort.num_formats);
-    for (size_t i = 0; i < halPort.num_formats; ++i) {
-        port->formats[i] = AudioFormat(halPort.formats[i]);
-    }
-    port->gains.resize(halPort.num_gains);
-    for (size_t i = 0; i < halPort.num_gains; ++i) {
-        audioGainFromHal(halPort.gains[i], &port->gains[i]);
-    }
-    audioPortConfigFromHal(halPort.active_config, &port->activeConfig);
-    switch (halPort.type) {
-        case AUDIO_PORT_TYPE_NONE:
-            break;
-        case AUDIO_PORT_TYPE_DEVICE: {
-            port->ext.device.hwModule = halPort.ext.device.hw_module;
-            port->ext.device.type = AudioDevice(halPort.ext.device.type);
-            memcpy(port->ext.device.address.data(), halPort.ext.device.address,
-                   AUDIO_DEVICE_MAX_ADDRESS_LEN);
-            break;
-        }
-        case AUDIO_PORT_TYPE_MIX: {
-            port->ext.mix.hwModule = halPort.ext.mix.hw_module;
-            port->ext.mix.ioHandle = halPort.ext.mix.handle;
-            port->ext.mix.latencyClass = AudioMixLatencyClass(halPort.ext.mix.latency_class);
-            break;
-        }
-        case AUDIO_PORT_TYPE_SESSION: {
-            port->ext.session.session = halPort.ext.session.session;
-            break;
-        }
-    }
-}
-
-void HidlUtils::audioPortToHal(const AudioPort& port, struct audio_port* halPort) {
-    memset(halPort, 0, sizeof(audio_port));
-    halPort->id = port.id;
-    halPort->role = static_cast<audio_port_role_t>(port.role);
-    halPort->type = static_cast<audio_port_type_t>(port.type);
-    memcpy(halPort->name, port.name.c_str(),
-           std::min(port.name.size(), static_cast<size_t>(AUDIO_PORT_MAX_NAME_LEN)));
-    halPort->num_sample_rates =
-        std::min(port.sampleRates.size(), static_cast<size_t>(AUDIO_PORT_MAX_SAMPLING_RATES));
-    for (size_t i = 0; i < halPort->num_sample_rates; ++i) {
-        halPort->sample_rates[i] = port.sampleRates[i];
-    }
-    halPort->num_channel_masks =
-        std::min(port.channelMasks.size(), static_cast<size_t>(AUDIO_PORT_MAX_CHANNEL_MASKS));
-    for (size_t i = 0; i < halPort->num_channel_masks; ++i) {
-        halPort->channel_masks[i] = static_cast<audio_channel_mask_t>(port.channelMasks[i]);
-    }
-    halPort->num_formats =
-        std::min(port.formats.size(), static_cast<size_t>(AUDIO_PORT_MAX_FORMATS));
-    for (size_t i = 0; i < halPort->num_formats; ++i) {
-        halPort->formats[i] = static_cast<audio_format_t>(port.formats[i]);
-    }
-    halPort->num_gains = std::min(port.gains.size(), static_cast<size_t>(AUDIO_PORT_MAX_GAINS));
-    for (size_t i = 0; i < halPort->num_gains; ++i) {
-        audioGainToHal(port.gains[i], &halPort->gains[i]);
-    }
-    audioPortConfigToHal(port.activeConfig, &halPort->active_config);
-    switch (port.type) {
-        case AudioPortType::NONE:
-            break;
-        case AudioPortType::DEVICE: {
-            halPort->ext.device.hw_module = port.ext.device.hwModule;
-            halPort->ext.device.type = static_cast<audio_devices_t>(port.ext.device.type);
-            memcpy(halPort->ext.device.address, port.ext.device.address.data(),
-                   AUDIO_DEVICE_MAX_ADDRESS_LEN);
-            break;
-        }
-        case AudioPortType::MIX: {
-            halPort->ext.mix.hw_module = port.ext.mix.hwModule;
-            halPort->ext.mix.handle = port.ext.mix.ioHandle;
-            halPort->ext.mix.latency_class =
-                static_cast<audio_mix_latency_class_t>(port.ext.mix.latencyClass);
-            break;
-        }
-        case AudioPortType::SESSION: {
-            halPort->ext.session.session = static_cast<audio_session_t>(port.ext.session.session);
-            break;
-        }
-    }
-}
-
-void HidlUtils::uuidFromHal(const audio_uuid_t& halUuid, Uuid* uuid) {
-    uuid->timeLow = halUuid.timeLow;
-    uuid->timeMid = halUuid.timeMid;
-    uuid->versionAndTimeHigh = halUuid.timeHiAndVersion;
-    uuid->variantAndClockSeqHigh = halUuid.clockSeq;
-    memcpy(uuid->node.data(), halUuid.node, uuid->node.size());
-}
-
-void HidlUtils::uuidToHal(const Uuid& uuid, audio_uuid_t* halUuid) {
-    halUuid->timeLow = uuid.timeLow;
-    halUuid->timeMid = uuid.timeMid;
-    halUuid->timeHiAndVersion = uuid.versionAndTimeHigh;
-    halUuid->clockSeq = uuid.variantAndClockSeqHigh;
-    memcpy(halUuid->node, uuid.node.data(), uuid.node.size());
-}
-
-}  // namespace AUDIO_HAL_VERSION
-}  // namespace common
-}  // namespace audio
-}  // namespace hardware
-}  // namespace android
diff --git a/media/libaudioprocessing/Android.mk b/media/libaudioprocessing/Android.mk
index f74834d..da1ecc2 100644
--- a/media/libaudioprocessing/Android.mk
+++ b/media/libaudioprocessing/Android.mk
@@ -20,7 +20,7 @@
 
 LOCAL_SHARED_LIBRARIES := \
     libaudiohal \
-    libaudioutils_system \
+    libaudioutils \
     libcutils \
     liblog \
     libnbaio \
diff --git a/media/libaudioprocessing/tests/Android.mk b/media/libaudioprocessing/tests/Android.mk
index 53059ff..23e1c3a 100644
--- a/media/libaudioprocessing/tests/Android.mk
+++ b/media/libaudioprocessing/tests/Android.mk
@@ -8,7 +8,7 @@
 include $(CLEAR_VARS)
 
 LOCAL_SHARED_LIBRARIES := \
-    libaudioutils_system \
+    libaudioutils \
     libaudioprocessing \
     libcutils \
     liblog \
@@ -44,7 +44,7 @@
 
 LOCAL_SHARED_LIBRARIES := \
     libaudioprocessing \
-    libaudioutils_system \
+    libaudioutils \
     libcutils \
     liblog \
     libutils \
@@ -73,7 +73,7 @@
 
 LOCAL_SHARED_LIBRARIES := \
     libaudioprocessing \
-    libaudioutils_system \
+    libaudioutils \
     libcutils \
     liblog \
     libutils \
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)
diff --git a/media/libmedia/Android.bp b/media/libmedia/Android.bp
index 435abac..fd7400a 100644
--- a/media/libmedia/Android.bp
+++ b/media/libmedia/Android.bp
@@ -12,8 +12,12 @@
     ],
 }
 
-cc_defaults {
-    name: "libmedia_helper_defaults",
+cc_library {
+    name: "libmedia_helper",
+    vendor_available: true,
+    vndk: {
+        enabled: true,
+    },
     srcs: ["AudioParameter.cpp", "TypeConverter.cpp"],
     cflags: [
         "-Werror",
@@ -24,23 +28,9 @@
     header_libs: [
         "libmedia_headers",
         "libaudioclient_headers",
-    ],
-    clang: true,
-}
-cc_library {
-    name: "libmedia_helper",
-    defaults: ["libmedia_helper_defaults"],
-    header_libs: [
         "libaudio_system_headers",
     ],
-}
-cc_library {
-    name: "libmedia_helper@2.0",
-    vendor: true,
-    defaults: ["libmedia_helper_defaults"],
-    header_libs: [
-        "android.hardware.audio.common.legacy@2.0",
-    ],
+    clang: true,
 }
 
 cc_library_shared {
@@ -216,7 +206,7 @@
         "libmediaextractor",
         "libgui",
         "libdl",
-        "libaudioutils_system",
+        "libaudioutils",
         "libaudioclient",
         "libmedia_omx",
     ],
diff --git a/media/libnbaio/Android.bp b/media/libnbaio/Android.bp
index cdc7f76..a4df38d 100644
--- a/media/libnbaio/Android.bp
+++ b/media/libnbaio/Android.bp
@@ -8,6 +8,7 @@
     ],
     header_libs: [
         "libaudioclient_headers",
+        "libaudio_system_headers",
         "libmedia_headers",
     ],
     export_header_lib_headers: [
@@ -16,6 +17,7 @@
     ],
 
     shared_libs: [
+        "libaudioutils",
         "liblog",
         "libutils",
     ],
@@ -27,17 +29,9 @@
 // link against libnbaio and system modules can't link against libnbaio_mono. The rest of libnbaio
 // pulls in too many other dependencies.
 cc_library_shared {
-    name: "libnbaio_mono@2.0",
+    name: "libnbaio_mono",
     vendor: true,
     defaults: ["libnbaio_mono_defaults"],
-
-    shared_libs: [
-        "libaudioutils",
-    ],
-
-    header_libs: [
-        "android.hardware.audio.common.legacy@2.0",
-    ],
 }
 
 cc_library_shared {
@@ -60,17 +54,13 @@
     // static_libs: ["libsndfile"],
 
     shared_libs: [
-        "libaudioutils_system",
+        "libaudioutils",
         "libbinder",
         "libcutils",
         "liblog",
         "libutils",
     ],
 
-    header_libs: [
-        "libaudio_system_headers",
-    ],
-
     cflags: [
         "-Werror",
         "-Wall",
diff --git a/media/libnblog/Android.bp b/media/libnblog/Android.bp
index b54ffe4..74aaf77 100644
--- a/media/libnblog/Android.bp
+++ b/media/libnblog/Android.bp
@@ -9,7 +9,7 @@
     ],
 
     shared_libs: [
-        "libaudioutils_system",
+        "libaudioutils",
         "libbinder",
         "libcutils",
         "liblog",
diff --git a/media/libstagefright/Android.bp b/media/libstagefright/Android.bp
index 12cfe77..c3d9c24 100644
--- a/media/libstagefright/Android.bp
+++ b/media/libstagefright/Android.bp
@@ -84,7 +84,7 @@
     ],
 
     shared_libs: [
-        "libaudioutils_system",
+        "libaudioutils",
         "libbinder",
         "libcamera_client",
         "libcutils",
diff --git a/media/libstagefright/codecs/amrnb/dec/Android.bp b/media/libstagefright/codecs/amrnb/dec/Android.bp
index 026c4d6..e4a2607 100644
--- a/media/libstagefright/codecs/amrnb/dec/Android.bp
+++ b/media/libstagefright/codecs/amrnb/dec/Android.bp
@@ -129,7 +129,7 @@
 
     shared_libs: [
         "libstagefright_amrnb_common",
-        "libaudioutils_system",
+        "libaudioutils",
         "liblog",
     ],
 
diff --git a/media/libstagefright/codecs/amrwb/Android.bp b/media/libstagefright/codecs/amrwb/Android.bp
index e500146..14a73d6 100644
--- a/media/libstagefright/codecs/amrwb/Android.bp
+++ b/media/libstagefright/codecs/amrwb/Android.bp
@@ -78,7 +78,7 @@
 
     local_include_dirs: ["src"],
 
-    shared_libs: ["libaudioutils_system"],
+    shared_libs: ["libaudioutils"],
 
     sanitize: {
         misc_undefined: [
diff --git a/media/libstagefright/codecs/mp3dec/Android.bp b/media/libstagefright/codecs/mp3dec/Android.bp
index 60ad5e3..e6eb32b 100644
--- a/media/libstagefright/codecs/mp3dec/Android.bp
+++ b/media/libstagefright/codecs/mp3dec/Android.bp
@@ -151,5 +151,5 @@
         "libsndfile",
     ],
 
-    shared_libs: ["libaudioutils_system"],
+    shared_libs: ["libaudioutils"],
 }