Delete the legacy audio hal

This only worked with vsoc/qemu.

Bug: 144111429
Test: Run launch_cvd -vm_manager=qemu_cli
Change-Id: I7a521962b8e15d245b482f04203937399b7a6893
diff --git a/guest/hals/audio/legacy/Android.mk b/guest/hals/audio/legacy/Android.mk
deleted file mode 100644
index 8d4ef0a..0000000
--- a/guest/hals/audio/legacy/Android.mk
+++ /dev/null
@@ -1,65 +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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-ifeq (0, $(shell test $(PLATFORM_SDK_VERSION) -ge 21; echo $$?))
-LOCAL_MODULE_RELATIVE_PATH := hw
-else
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
-endif
-LOCAL_MODULE_TAGS := optional
-LOCAL_MULTILIB := first
-
-LOCAL_SHARED_LIBRARIES := \
-    libbase \
-    liblog \
-    libcutils \
-    cuttlefish_auto_resources \
-    libcuttlefish_fs \
-    cuttlefish_time \
-    vsoc_lib
-
-LOCAL_HEADER_LIBRARIES := \
-    libhardware_headers
-
-LOCAL_SRC_FILES := \
-    audio_hal.cpp \
-    vsoc_audio.cpp \
-    vsoc_audio_input_stream.cpp \
-    vsoc_audio_output_stream.cpp
-
-LOCAL_C_INCLUDES := \
-    device/google/cuttlefish_common \
-    device/google/cuttlefish_kernel \
-    $(VSOC_STLPORT_INCLUDES) \
-    frameworks/native/include/media/hardware \
-    $(call include-path-for, audio)
-
-LOCAL_STATIC_LIBRARIES := \
-    libcutils \
-    libcuttlefish_remoter_framework \
-    $(VSOC_STLPORT_STATIC_LIBS)
-
-LOCAL_CFLAGS := \
-    -Wall -Werror -std=c++17 \
-    $(VSOC_VERSION_CFLAGS)
-
-
-LOCAL_MODULE := audio.primary.cutf_ivsh
-LOCAL_VENDOR_MODULE := true
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/guest/hals/audio/legacy/audio_hal.cpp b/guest/hals/audio/legacy/audio_hal.cpp
deleted file mode 100644
index a865d46..0000000
--- a/guest/hals/audio/legacy/audio_hal.cpp
+++ /dev/null
@@ -1,35 +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 "guest/hals/audio/legacy/vsoc_audio.h"
-
-#include "guest/hals/audio/legacy/audio_hal.h"
-
-static hw_module_methods_t hal_module_methods = {
-  .open = cvd::GceAudio::Open,
-};
-
-
-audio_module HAL_MODULE_INFO_SYM = {
-  .common = {
-    .tag = HARDWARE_MODULE_TAG,
-    .module_api_version = AUDIO_MODULE_API_VERSION_0_1,
-    .hal_api_version = HARDWARE_HAL_API_VERSION,
-    .id = AUDIO_HARDWARE_MODULE_ID,
-    .name = "GCE Audio HW HAL",
-    .author = "The Android Open Source Project",
-    .methods = &hal_module_methods,
-  },
-};
diff --git a/guest/hals/audio/legacy/audio_hal.h b/guest/hals/audio/legacy/audio_hal.h
deleted file mode 100644
index db547ff..0000000
--- a/guest/hals/audio/legacy/audio_hal.h
+++ /dev/null
@@ -1,38 +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.
- */
-#pragma once
-
-#define AUDIO_DEBUG 0
-
-#if AUDIO_DEBUG
-#  define D(...) ALOGD(__VA_ARGS__)
-#else
-#  define D(...) ((void)0)
-#endif
-
-#include <errno.h>
-#include <string.h>
-#include <log/log.h>
-
-#include <hardware/hardware.h>
-
-#pragma GCC diagnostic push
-#pragma  GCC diagnostic ignored "-Wparentheses"
-#pragma  GCC diagnostic ignored "-Wgnu-designator"
-#include <system/audio.h>
-#pragma GCC diagnostic pop
-
-#include <hardware/audio.h>
diff --git a/guest/hals/audio/legacy/policy/Android.mk b/guest/hals/audio/legacy/policy/Android.mk
deleted file mode 100644
index 0b2ef8c..0000000
--- a/guest/hals/audio/legacy/policy/Android.mk
+++ /dev/null
@@ -1,45 +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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-ifeq (0, $(shell test $(PLATFORM_SDK_VERSION) -ge 21; echo $$?))
-LOCAL_MODULE_RELATIVE_PATH := hw
-else
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
-endif
-LOCAL_MODULE_TAGS := optional
-LOCAL_MULTILIB := first
-
-LOCAL_SHARED_LIBRARIES := \
-    liblog \
-    libcutils
-
-LOCAL_SRC_FILES := \
-    vsoc_audio_policy_hal.cpp
-
-LOCAL_C_INCLUDES := \
-    device/google/cuttlefish_common \
-    $(VSOC_STLPORT_INCLUDES) \
-    frameworks/native/include/media/hardware \
-    $(call include-path-for, audio)
-
-LOCAL_CFLAGS := -Wall -Werror
-
-LOCAL_MODULE := audio_policy.vsoc
-LOCAL_VENDOR_MODULE := true
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/guest/hals/audio/legacy/policy/vsoc_audio_policy_hal.cpp b/guest/hals/audio/legacy/policy/vsoc_audio_policy_hal.cpp
deleted file mode 100644
index 53c3127..0000000
--- a/guest/hals/audio/legacy/policy/vsoc_audio_policy_hal.cpp
+++ /dev/null
@@ -1,156 +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 <errno.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <hardware/hardware.h>
-#include <system/audio.h>
-#include <system/audio_policy.h>
-#include <hardware/audio_policy.h>
-
-#include "guest/hals/audio/legacy/policy/vsoc_audio_policy_hal.h"
-
-namespace cvd {
-
-int GceAudioPolicy::Create(
-    const audio_policy_device* device,
-    audio_policy_service_ops* aps_ops,
-    void* service, audio_policy** ap) {
-  D("%s", __FUNCTION__);
-  audio_policy_device* dev;
-  gce_audio_policy* dap;
-  int ret;
-
-  *ap = NULL;
-
-  if (!service || !aps_ops) {
-    return -EINVAL;
-  }
-
-  dap = (gce_audio_policy*) calloc(1, sizeof(*dap));
-  if (!dap) {
-    return -ENOMEM;
-  }
-
-  dap->policy.set_device_connection_state =
-      &GceAudioPolicy::SetDeviceConnectionState;
-  dap->policy.get_device_connection_state =
-      &GceAudioPolicy::GetDeviceConnectionState;
-  dap->policy.set_phone_state = &GceAudioPolicy::SetPhoneState;
-  dap->policy.set_ringer_mode = &GceAudioPolicy::SetRingerMode;
-  dap->policy.set_force_use = &GceAudioPolicy::SetForceUse;
-  dap->policy.get_force_use = &GceAudioPolicy::GetForceUse;
-  dap->policy.set_can_mute_enforced_audible =
-      &GceAudioPolicy::SetCanMuteEnforcedAudible;
-  dap->policy.init_check = &GceAudioPolicy::InitCheck;
-  dap->policy.get_output = &GceAudioPolicy::GetOutput;
-  dap->policy.start_output = &GceAudioPolicy::StartOutput;
-  dap->policy.stop_output = &GceAudioPolicy::StopOutput;
-  dap->policy.release_output = &GceAudioPolicy::ReleaseOutput;
-  dap->policy.get_input = &GceAudioPolicy::GetInput;
-  dap->policy.start_input = &GceAudioPolicy::StartInput;
-  dap->policy.stop_input = &GceAudioPolicy::StopInput;
-  dap->policy.release_input = &GceAudioPolicy::ReleaseInput;
-  dap->policy.init_stream_volume = &GceAudioPolicy::InitStreamVolume;
-  dap->policy.set_stream_volume_index = &GceAudioPolicy::SetStreamVolumeIndex;
-  dap->policy.get_stream_volume_index = &GceAudioPolicy::GetStreamVolumeIndex;
-  dap->policy.set_stream_volume_index_for_device =
-      &GceAudioPolicy::SetStreamVolumeIndexForDevice;
-  dap->policy.get_stream_volume_index_for_device =
-      &GceAudioPolicy::GetStreamVolumeIndexForDevice;
-  dap->policy.get_strategy_for_stream = &GceAudioPolicy::GetStrategyForStream;
-  dap->policy.get_devices_for_stream = &GceAudioPolicy::GetDevicesForStream;
-  dap->policy.get_output_for_effect = &GceAudioPolicy::GetOutputForEffect;
-  dap->policy.register_effect = &GceAudioPolicy::RegisterEffect;
-  dap->policy.unregister_effect = &GceAudioPolicy::UnregisterEffect;
-  dap->policy.set_effect_enabled = &GceAudioPolicy::SetEffectEnabled;
-  dap->policy.is_stream_active = &GceAudioPolicy::IsStreamActive;
-  dap->policy.dump = &GceAudioPolicy::Dump;
-#ifdef ENABLE_OFFLOAD
-  dap->policy.is_offload_supported = &GceAudioPolicy::IsOffloadSupported;
-#endif
-
-  dap->service = service;
-  dap->aps_ops = aps_ops;
-
-  *ap = &dap->policy;
-  return 0;
-}
-
-
-int GceAudioPolicy::Destroy(const audio_policy_device* ap_dev,
-                            audio_policy* ap) {
-  D("%s", __FUNCTION__);
-  free(ap);
-  return 0;
-}
-
-
-int GceAudioPolicy::Close(hw_device_t* device) {
-  D("%s", __FUNCTION__);
-  free(device);
-  return 0;
-}
-
-
-int GceAudioPolicy::Open(
-    const hw_module_t* module, const char* name, hw_device_t** device) {
-  D("%s", __FUNCTION__);
-  audio_policy_device* dev;
-
-  *device = NULL;
-
-  if (strcmp(name, AUDIO_POLICY_INTERFACE) != 0) {
-    return -EINVAL;
-  }
-
-  dev = (audio_policy_device*) calloc(1, sizeof(*dev));
-  if (!dev) {
-    return -ENOMEM;
-  }
-
-  dev->common.tag = HARDWARE_DEVICE_TAG;
-  dev->common.version = 0;
-  dev->common.module = (hw_module_t*) module;
-  dev->common.close = &GceAudioPolicy::Close;
-  dev->create_audio_policy = &GceAudioPolicy::Create;
-  dev->destroy_audio_policy = &GceAudioPolicy::Destroy;
-
-  *device = &dev->common;
-
-  return 0;
-}
-
-}
-
-static hw_module_methods_t gce_audio_policy_module_methods = {
-  .open = &cvd::GceAudioPolicy::Open,
-};
-
-
-audio_policy_module HAL_MODULE_INFO_SYM = {
-  .common = {
-    .tag           = HARDWARE_MODULE_TAG,
-    .version_major = 1,
-    .version_minor = 0,
-    .id            = AUDIO_POLICY_HARDWARE_MODULE_ID,
-    .name          = "GCE Audio Policy HAL",
-    .author        = "The Android Open Source Project",
-    .methods       = &gce_audio_policy_module_methods,
-  },
-};
diff --git a/guest/hals/audio/legacy/policy/vsoc_audio_policy_hal.h b/guest/hals/audio/legacy/policy/vsoc_audio_policy_hal.h
deleted file mode 100644
index 00ea3d1..0000000
--- a/guest/hals/audio/legacy/policy/vsoc_audio_policy_hal.h
+++ /dev/null
@@ -1,245 +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.
- */
-#pragma once
-
-#include <errno.h>
-#include <string.h>
-#include <log/log.h>
-
-#include <hardware/hardware.h>
-#include <system/audio.h>
-#include <hardware/audio.h>
-
-#define AUDIO_DEBUG 1
-
-#if AUDIO_DEBUG
-#  define D(...) ALOGD(__VA_ARGS__)
-#else
-#  define D(...) ((void)0)
-#endif
-
-#define LOG_TAG "GceAudioPolicy"
-
-namespace avd {
-
-struct gce_audio_policy {
-  audio_policy policy;
-
-  audio_policy_service_ops* aps_ops;
-  void* service;
-};
-
-
-class GceAudioPolicy {
- public:
-  GceAudioPolicy() {}
-  ~GceAudioPolicy() {}
-
-  static int Open(
-      const hw_module_t* module, const char* name, hw_device_t** device);
-  static int Create(const audio_policy_device* device,
-      audio_policy_service_ops* aps_ops, void* service,
-      audio_policy** ap);
-  static int Destroy(const audio_policy_device* ap_dev,
-                     audio_policy* ap);
-  static int Close(hw_device_t* device);
-
-  static int SetDeviceConnectionState(
-      audio_policy* pol, audio_devices_t device,
-      audio_policy_dev_state_t state, const char* device_address) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return -ENOSYS;
-  }
-
-  static audio_policy_dev_state_t GetDeviceConnectionState(
-      const audio_policy* pol, audio_devices_t device,
-      const char* device_address) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE;
-  }
-
-  static void SetPhoneState(audio_policy* pol, audio_mode_t state) {
-    ALOGE("%s: not supported", __FUNCTION__);
-  }
-
-  static void SetRingerMode(audio_policy* pol, uint32_t mode,
-                            uint32_t mask) {
-    ALOGW("%s: deprecated", __FUNCTION__);
-  }
-
-  static void SetForceUse(
-      audio_policy* pol, audio_policy_force_use_t usage,
-    audio_policy_forced_cfg_t config) {
-    ALOGE("%s: not supported", __FUNCTION__);
-  }
-
-  static audio_policy_forced_cfg_t GetForceUse(
-      const audio_policy* pol, audio_policy_force_use_t usage) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return AUDIO_POLICY_FORCE_NONE;
-  }
-
-  static void SetCanMuteEnforcedAudible(
-      audio_policy* pol, bool can_mute) {
-    ALOGE("%s: not supported", __FUNCTION__);
-  }
-
-  static int InitCheck(const audio_policy* pol) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return 0;
-  }
-
-  static audio_io_handle_t GetOutput(
-      audio_policy* pol, audio_stream_type_t stream,
-      uint32_t sampling_rate, audio_format_t format,
-      audio_channel_mask_t channelMask, audio_output_flags_t flags
-#ifdef ENABLE_OFFLOAD
-      , const audio_offload_info_t* info
-#endif
-      ) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return 0;
-  }
-
-  static int StartOutput(audio_policy* pol, audio_io_handle_t output,
-                         audio_stream_type_t stream, int session) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return -ENOSYS;
-  }
-
-  static int StopOutput(audio_policy* pol, audio_io_handle_t output,
-                        audio_stream_type_t stream, int session) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return -ENOSYS;
-  }
-
-  static void ReleaseOutput(
-      audio_policy* pol, audio_io_handle_t output) {
-    ALOGE("%s: not supported", __FUNCTION__);
-  }
-
-  static audio_io_handle_t GetInput(
-      audio_policy* pol, audio_source_t inputSource,
-      uint32_t sampling_rate, audio_format_t format,
-      audio_channel_mask_t channelMask, audio_in_acoustics_t acoustics) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return 0;
-  }
-
-  static int StartInput(audio_policy* pol, audio_io_handle_t input) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return -ENOSYS;
-  }
-
-  static int StopInput(audio_policy* pol, audio_io_handle_t input) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return -ENOSYS;
-  }
-
-  static void ReleaseInput(
-      audio_policy* pol, audio_io_handle_t input) {
-    ALOGE("%s: not supported", __FUNCTION__);
-  }
-
-  static void InitStreamVolume(audio_policy* pol,
-                               audio_stream_type_t stream, int index_min,
-                               int index_max) {
-    ALOGE("%s: not supported", __FUNCTION__);
-  }
-
-  static int SetStreamVolumeIndex(audio_policy* pol,
-                                  audio_stream_type_t stream, int index) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return -ENOSYS;
-  }
-
-  static int GetStreamVolumeIndex(const audio_policy* pol,
-                                  audio_stream_type_t stream, int* index) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return -ENOSYS;
-  }
-
-  static int SetStreamVolumeIndexForDevice(
-      audio_policy* pol, audio_stream_type_t stream,
-      int index, audio_devices_t device) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return -ENOSYS;
-  }
-
-  static int GetStreamVolumeIndexForDevice(
-      const audio_policy* pol, audio_stream_type_t stream,
-      int* index, audio_devices_t device) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return -ENOSYS;
-  }
-
-  static uint32_t GetStrategyForStream(const audio_policy* pol,
-                                       audio_stream_type_t stream) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return 0;
-  }
-
-  static audio_devices_t GetDevicesForStream(const audio_policy* pol,
-                                             audio_stream_type_t stream) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return 0;
-  }
-
-  static audio_io_handle_t GetOutputForEffect(
-      audio_policy* pol, const effect_descriptor_s* desc) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return 0;
-  }
-
-  static int RegisterEffect(
-      audio_policy* pol, const effect_descriptor_s* desc,
-      audio_io_handle_t output, uint32_t strategy, int session, int id) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return -ENOSYS;
-  }
-
-  static int UnregisterEffect(audio_policy* pol, int id) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return -ENOSYS;
-  }
-
-  static int SetEffectEnabled(audio_policy* pol, int id, bool enabled) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return -ENOSYS;
-  }
-
-  static bool IsStreamActive(
-      const audio_policy* pol, audio_stream_type_t stream,
-      uint32_t in_past_ms) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return false;
-  }
-
-  static int Dump(const audio_policy* pol, int fd) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return -ENOSYS;
-  }
-
-#ifdef ENABLE_OFFLOAD
-  static bool IsOffloadSupported(const audio_policy* pol,
-                                 const audio_offload_info_t* info) {
-    ALOGE("%s: not supported", __FUNCTION__);
-    return false;
-  }
-#endif
-};
-
-}
diff --git a/guest/hals/audio/legacy/vsoc_audio.cpp b/guest/hals/audio/legacy/vsoc_audio.cpp
deleted file mode 100644
index 040e1e7..0000000
--- a/guest/hals/audio/legacy/vsoc_audio.cpp
+++ /dev/null
@@ -1,387 +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 "guest/hals/audio/legacy/audio_hal.h"
-
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <fcntl.h>
-
-extern "C" {
-#include <cutils/str_parms.h>
-}
-
-#include "common/libs/auto_resources/auto_resources.h"
-#include "common/libs/fs/shared_select.h"
-#include "common/libs/threads/cuttlefish_thread.h"
-#include "common/libs/threads/thunkers.h"
-#include "common/vsoc/lib/circqueue_impl.h"
-#include "guest/hals/audio/legacy/vsoc_audio.h"
-#include "guest/hals/audio/legacy/vsoc_audio_input_stream.h"
-#include "guest/hals/audio/legacy/vsoc_audio_output_stream.h"
-#include "guest/libs/remoter/remoter_framework_pkt.h"
-
-using cvd::LockGuard;
-using cvd::Mutex;
-
-namespace cvd {
-
-GceAudio::~GceAudio() { }
-
-int GceAudio::Close() {
-  D("GceAudio::%s", __FUNCTION__);
-  {
-    LockGuard<Mutex> guard(lock_);
-    for (std::list<GceAudioOutputStream*>::iterator it = output_list_.begin();
-         it != output_list_.end(); ++it) {
-      delete *it;
-    }
-    for (input_map_t::iterator it = input_map_.begin();
-         it != input_map_.end(); ++it) {
-      delete it->second;
-    }
-  }
-  delete this;
-  return 0;
-}
-
-size_t GceAudio::GetInputBufferSize(const audio_config*) const {
-  return IN_BUFFER_BYTES;
-}
-
-uint32_t GceAudio::GetSupportedDevices() const {
-  return AUDIO_DEVICE_OUT_EARPIECE |
-      AUDIO_DEVICE_OUT_SPEAKER |
-      AUDIO_DEVICE_OUT_DEFAULT |
-      AUDIO_DEVICE_IN_COMMUNICATION |
-      AUDIO_DEVICE_IN_BUILTIN_MIC |
-      AUDIO_DEVICE_IN_WIRED_HEADSET |
-      AUDIO_DEVICE_IN_VOICE_CALL |
-      AUDIO_DEVICE_IN_DEFAULT;
-}
-
-int GceAudio::InitCheck() const {
-  D("GceAudio::%s", __FUNCTION__);
-  return 0;
-}
-
-int GceAudio::SetMicMute(bool state) {
-  D("GceAudio::%s", __FUNCTION__);
-  LockGuard<Mutex> guard(lock_);
-  mic_muted_ = state;
-  return 0;
-}
-
-int GceAudio::GetMicMute(bool *state) const {
-  D("GceAudio::%s", __FUNCTION__);
-  LockGuard<Mutex> guard(lock_);
-  *state = mic_muted_;
-  return 0;
-}
-
-int GceAudio::OpenInputStream(audio_io_handle_t handle,
-                              audio_devices_t devices,
-                              audio_config *config,
-                              audio_stream_in **stream_in,
-                              audio_input_flags_t /*flags*/,
-                              const char * /*address*/,
-                              audio_source_t /*source*/) {
-  GceAudioInputStream* new_stream;
-  int rval = GceAudioInputStream::Open(
-      this, handle, devices, *config, &new_stream);
-  uint32_t stream_number;
-  if (new_stream) {
-    LockGuard<Mutex> guard(lock_);
-    stream_number = next_stream_number_++;
-    input_map_[stream_number] = new_stream;
-  }
-  // This should happen after the lock is released, hence the double check
-  if (new_stream) {
-    SendStreamUpdate(new_stream->GetStreamDescriptor(
-        stream_number, gce_audio_message::OPEN_INPUT_STREAM), MSG_DONTWAIT);
-  }
-  *stream_in = new_stream;
-  return rval;
-}
-
-
-void GceAudio::CloseInputStream(audio_stream_in *stream) {
-  GceAudioInputStream* astream = static_cast<GceAudioInputStream*>(stream);
-  gce_audio_message descriptor;
-  {
-    LockGuard<Mutex> guard(lock_);
-    // TODO(ghartman): This could be optimized if stream knew it's number.
-    for (input_map_t::iterator it = input_map_.begin();
-         it != input_map_.end(); ++it) {
-      if (it->second == stream) {
-        descriptor = it->second->GetStreamDescriptor(
-            it->first, gce_audio_message::CLOSE_INPUT_STREAM);
-        input_map_.erase(it);
-        break;
-      }
-    }
-  }
-  SendStreamUpdate(descriptor, MSG_DONTWAIT);
-  delete astream;
-}
-
-
-int GceAudio::OpenOutputStream(audio_io_handle_t handle,
-                               audio_devices_t devices,
-                               audio_output_flags_t flags,
-                               audio_config *config,
-                               audio_stream_out **stream_out,
-                               const char * /*address*/) {
-  GceAudioOutputStream* new_stream;
-  int rval;
-  {
-    LockGuard<Mutex> guard(lock_);
-    rval = GceAudioOutputStream::Open(
-        this, handle, devices, flags, config, next_stream_number_++,
-        &new_stream);
-    if (new_stream) {
-      output_list_.push_back(new_stream);
-    }
-  }
-  if (new_stream) {
-    SendStreamUpdate(new_stream->GetStreamDescriptor(
-        gce_audio_message::OPEN_OUTPUT_STREAM), MSG_DONTWAIT);
-  }
-  *stream_out = new_stream;
-  return rval;
-}
-
-void GceAudio::CloseOutputStream(audio_stream_out *stream) {
-  GceAudioOutputStream* astream = static_cast<GceAudioOutputStream*>(stream);
-  gce_audio_message close;
-  {
-    LockGuard<Mutex> guard(lock_);
-    output_list_.remove(astream);
-    close = astream->GetStreamDescriptor(
-        gce_audio_message::CLOSE_OUTPUT_STREAM);
-  }
-  SendStreamUpdate(close, MSG_DONTWAIT);
-  delete astream;
-}
-
-int GceAudio::Dump(int fd) const {
-  LockGuard<Mutex> guard(lock_);
-  dprintf(
-      fd,
-      "\nadev_dump:\n"
-      "\tmic_mute: %s\n"
-      "\tnum_outputs: %zu\n"
-      "\tnum_inputs: %zu\n\n",
-      mic_muted_ ? "true": "false",
-      output_list_.size(), input_map_.size());
-
-  for (std::list<GceAudioOutputStream*>::const_iterator it =
-           output_list_.begin();
-       it != output_list_.end(); ++it) {
-    (*it)->common.dump(&(*it)->common, fd);
-  }
-
-  for (input_map_t::const_iterator it = input_map_.begin();
-       it != input_map_.end(); ++it) {
-    (*it).second->common.dump(&(*it).second->common, fd);
-  }
-
-  return 0;
-}
-
-ssize_t GceAudio::SendMsg(const msghdr& msg, int /* flags */) {
-    intptr_t res = audio_data_rv_->data()->audio_queue.Writev(
-            audio_data_rv_,
-            msg.msg_iov,
-            msg.msg_iovlen,
-            true /* non_blocking */);
-
-    if (res < 0) {
-        ALOGV("GceAudio::%s: CircularPacketQueue::Write returned %" PRIiPTR,
-              __FUNCTION__,
-              res);
-    }
-
-    return static_cast<ssize_t>(res);
-}
-
-ssize_t GceAudio::SendStreamUpdate(
-    const gce_audio_message& stream_info, int flags) {
-  msghdr msg;
-  iovec msg_iov[1];
-  msg_iov[0].iov_base = const_cast<gce_audio_message*>(&stream_info);
-  msg_iov[0].iov_len = sizeof(gce_audio_message);
-  msg.msg_name = NULL;
-  msg.msg_namelen = 0;
-  msg.msg_iov = msg_iov;
-  msg.msg_iovlen = arraysize(msg_iov);
-  msg.msg_control = NULL;
-  msg.msg_controllen = 0;
-  msg.msg_flags = 0;
-  return SendMsg(msg, flags);
-}
-
-int GceAudio::SetVoiceVolume(float volume) {
-  D("GceAudio::%s: set voice volume %f", __FUNCTION__, volume);
-  voice_volume_ = volume;
-  return 0;
-}
-
-int GceAudio::SetMasterVolume(float volume) {
-  D("GceAudio::%s: set master volume %f", __FUNCTION__, volume);
-  master_volume_ = volume;
-  return 0;
-}
-
-int GceAudio::GetMasterVolume(float* volume) {
-  D("GceAudio::%s: get master volume %f", __FUNCTION__, master_volume_);
-  *volume = master_volume_;
-  return 0;
-}
-
-int GceAudio::SetMasterMute(bool muted) {
-  D("GceAudio::%s: set master muted %d", __FUNCTION__, muted);
-  master_muted_ = muted;
-  return 0;
-}
-
-int GceAudio::GetMasterMute(bool* muted) {
-  D("GceAudio::%s: get master muted %d", __FUNCTION__, master_muted_);
-  *muted = master_muted_;
-  return 0;
-}
-
-int GceAudio::SetMode(audio_mode_t mode) {
-  D("GceAudio::%s: new mode %d", __FUNCTION__, mode);
-  mode_ = mode;
-  return 0;
-}
-
-int GceAudio::Open(const hw_module_t* module, const char* name,
-                   hw_device_t** device) {
-  D("GceAudio::%s", __FUNCTION__);
-
-  if (strcmp(name, AUDIO_HARDWARE_INTERFACE)) {
-    ALOGE("GceAudio::%s: invalid module name %s (expected %s)",
-          __FUNCTION__, name, AUDIO_HARDWARE_INTERFACE);
-    return -EINVAL;
-  }
-
-  GceAudio* rval = new GceAudio;
-
-  rval->audio_data_rv_ = AudioDataRegionView::GetInstance();
-  rval->audio_worker_ = rval->audio_data_rv_->StartWorker();
-
-  rval->common.tag = HARDWARE_DEVICE_TAG;
-  rval->common.version = version_;
-  rval->common.module = const_cast<hw_module_t *>(module);
-  rval->common.close = cvd::thunk<hw_device_t, &GceAudio::Close>;
-
-#if !defined(AUDIO_DEVICE_API_VERSION_2_0)
-  // This HAL entry is supported only on AUDIO_DEVICE_API_VERSION_1_0.
-  // In fact, with version 2.0 the device numbers were orgainized in a
-  // way that makes the return value nonsense.
-  // Skipping the assignment is ok: the memset in the constructor already
-  // put a NULL here.
-  rval->get_supported_devices =
-      cvd::thunk<audio_hw_device, &GceAudio::GetSupportedDevices>;
-#endif
-  rval->init_check = cvd::thunk<audio_hw_device, &GceAudio::InitCheck>;
-
-  rval->set_voice_volume =
-      cvd::thunk<audio_hw_device, &GceAudio::SetVoiceVolume>;
-  rval->set_master_volume =
-      cvd::thunk<audio_hw_device, &GceAudio::SetMasterVolume>;
-  rval->get_master_volume =
-      cvd::thunk<audio_hw_device, &GceAudio::GetMasterVolume>;
-
-#if defined(AUDIO_DEVICE_API_VERSION_2_0)
-  rval->set_master_mute =
-      cvd::thunk<audio_hw_device, &GceAudio::SetMasterMute>;
-  rval->get_master_mute =
-      cvd::thunk<audio_hw_device, &GceAudio::GetMasterMute>;
-#endif
-
-  rval->set_mode = cvd::thunk<audio_hw_device, &GceAudio::SetMode>;
-  rval->set_mic_mute = cvd::thunk<audio_hw_device, &GceAudio::SetMicMute>;
-  rval->get_mic_mute = cvd::thunk<audio_hw_device, &GceAudio::GetMicMute>;
-
-  rval->set_parameters = cvd::thunk<audio_hw_device, &GceAudio::SetParameters>;
-  rval->get_parameters = cvd::thunk<audio_hw_device, &GceAudio::GetParameters>;
-
-  rval->get_input_buffer_size =
-      cvd::thunk<audio_hw_device, &GceAudio::GetInputBufferSize>;
-
-  rval->open_input_stream =
-      cvd::thunk<audio_hw_device, &GceAudio::OpenInputStreamCurrentHAL>;
-  rval->close_input_stream =
-      cvd::thunk<audio_hw_device, &GceAudio::CloseInputStream>;
-
-  rval->open_output_stream =
-      cvd::thunk<audio_hw_device, &GceAudio::OpenOutputStreamCurrentHAL>;
-  rval->close_output_stream =
-      cvd::thunk<audio_hw_device, &GceAudio::CloseOutputStream>;
-
-  rval->dump = cvd::thunk<audio_hw_device, &GceAudio::Dump>;
-
-  *device = &rval->common;
-  return 0;
-}
-
-int GceAudio::SetParameters(const char *kvpairs) {
-  ALOGE("GceAudio::%s: not implemented", __FUNCTION__);
-  if (kvpairs) D("GceAudio::%s: kvpairs %s", __FUNCTION__, kvpairs);
-  return 0;
-}
-
-
-char* GceAudio::GetParameters(const char *keys) const {
-  ALOGE("GceAudio::%s: not implemented", __FUNCTION__);
-  if (keys) D("GceAudio::%s: kvpairs %s", __FUNCTION__, keys);
-  return strdup("");
-}
-
-int GceAudio::SetStreamParameters(
-    struct audio_stream *stream, const char *kv_pairs) {
-  struct str_parms *parms = str_parms_create_str(kv_pairs);
-  if (!parms) {
-    return 0;
-  }
-  int sample_rate;
-  if (str_parms_get_int(parms, AUDIO_PARAMETER_STREAM_SAMPLING_RATE,
-                        &sample_rate) >= 0) {
-    stream->set_sample_rate(stream, sample_rate);
-  }
-  int format;
-  if (str_parms_get_int(parms, AUDIO_PARAMETER_STREAM_FORMAT,
-                        &format) >= 0) {
-    stream->set_format(stream, static_cast<audio_format_t>(format));
-  }
-  int routing;
-  if (str_parms_get_int(parms, AUDIO_PARAMETER_STREAM_ROUTING,
-                        &routing) >= 0) {
-    stream->set_device(stream, static_cast<audio_devices_t>(routing));
-  }
-  if (str_parms_get_int(parms, AUDIO_PARAMETER_STREAM_INPUT_SOURCE,
-                        &routing) >= 0) {
-    stream->set_device(stream, static_cast<audio_devices_t>(routing));
-  }
-  str_parms_destroy(parms);
-  return 0;
-}
-
-}
diff --git a/guest/hals/audio/legacy/vsoc_audio.h b/guest/hals/audio/legacy/vsoc_audio.h
deleted file mode 100644
index 7b96878..0000000
--- a/guest/hals/audio/legacy/vsoc_audio.h
+++ /dev/null
@@ -1,306 +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.
- */
-#pragma once
-
-#include <list>
-#include <map>
-#include <memory>
-
-#include "common/libs/fs/shared_fd.h"
-#include "common/libs/threads/cuttlefish_thread.h"
-#include "common/vsoc/lib/audio_data_region_view.h"
-#include "common/vsoc/lib/vsoc_audio_message.h"
-#include "guest/hals/audio/legacy/audio_hal.h"
-#include "guest/hals/audio/legacy/vsoc_audio_input_stream.h"
-
-namespace cvd {
-
-class GceAudioInputStream;
-class GceAudioOutputStream;
-
-class GceAudio : public audio_hw_device {
- public:
-  // This common code manipulates the parameters of input and output streams.
-  static int SetStreamParameters(struct audio_stream *, const char *);
-
-  ~GceAudio();
-
-  // Non-HAL methods that are part of the GCE implementation.
-  // Most of these are used by the input and output streams.
-
-  // Returns true if the microphone is muted. Used by input streams.
-  bool IsMicrophoneMuted() {
-    cvd::LockGuard<cvd::Mutex> guard(lock_);
-    return mic_muted_;
-  }
-
-  // Send a message to the connected streamer.
-  // Returns:
-  //   0 if there is no streamer.
-  //   >0 if the message was sent.
-  //   -1 if there was an error.
-  ssize_t SendMsg(const msghdr&, int flags);
-
-  // Sends a stream update to the connected streamer.
-  // Stream updates have no frames. Use SendMsg if the message has frames.
-  //   0 if there is no streamer.
-  //   >0 if the message was sent.
-  //   -1 if there was an error.
-  ssize_t SendStreamUpdate(
-      const gce_audio_message& stream_info, int flags);
-
-  // Callbacks for the Android audio_module HAL interface.
-  // Most of the comments below are copied from
-  // libhardware/include/hardware/audio.h
-  //
-  // Where the is a conflict the comments there apply.
-  // By default these methods return 0 on success -<errno> for failure.
-
-  // Opens the device.
-  static int Open(const hw_module_t* module, const char* name,
-                  hw_device_t** device);
-
-  // Closes the device, closing any open input streams and output streams.
-  int Close();
-
-  // Closes the input stream, throwing away any data in the buffer.
-  void CloseInputStream(audio_stream_in* stream);
-
-  // Closes the output stream without waiting for the buffer to clear.
-  void CloseOutputStream(audio_stream_out* stream);
-
-  // 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.
-  // TODO(ghartman): Implement this as part of HAL 3.0
-  //int CreateAudioPatch(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);
-
-  // dumps the state of the audio hardware to the given fd.
-  // This information can be retrieved using the dumpsys utility.
-  int Dump(int fd) const;
-
-  // 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.
-  // TODO(ghartman): Implement this as part of HAL 3.0
-  // int GetAudioPort(struct audio_port *port);
-
-  // Sets audio port configuration
-  // TODO(ghartman): Implement this as part of HAL 3.0
-  // int SetAudioPortConfig(const struct audio_port_config *config);
-
-  size_t GetInputBufferSize(const audio_config*) const;
-
-  // Gets 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 GetMasterVolume(float* /*volume*/);
-
-  // 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 GetMasterMute(bool* muted);
-
-  // Gets the audio mute status for the microphone.
-  int GetMicMute(bool* state) const;
-
-  // Retrieves the global audio parameters.
-  // TODO(ghartman): Implement this.
-  char* GetParameters(const char* keys) const;
-
-  // Enumerates what devices are supported by each audio_hw_device
-  // implementation.
-  // Return value is a bitmask of 1 or more values of audio_devices_t
-  // used by audio flinger.
-  // NOTE: audio HAL implementations starting with
-  // AUDIO_DEVICE_API_VERSION_2_0 do not implement this function.
-  // AUDIO_DEVICE_API_VERSION_2_0 was the current version as of JB-MR1
-  // 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 GetSupportedDevices() const;
-
-  // Checks to see if the audio hardware interface has been initialized.
-  // Always returns 0 to indicate success, but -ENODEV is also allowed to
-  // indicate failure.
-  int InitCheck() const;
-
-  // Creates an additional hardware input stream.
-  // Additional parameters were added in the 3.0 version of the HAL.
-  // These defaults make it easier to implement a cross-branch device.
-  int OpenInputStream(
-      audio_io_handle_t handle,
-      audio_devices_t devices, audio_config *config,
-      audio_stream_in **stream_in,
-      audio_input_flags_t flags = AUDIO_INPUT_FLAG_NONE,
-      const char* address = 0,
-      audio_source_t source = AUDIO_SOURCE_DEFAULT);
-
-  // Creates an additional output stream.
-  // The "address" parameter qualifies the "devices" audio device type if
-  // needed. On GCE we ignore it for now because we simulate a single SoC
-  // hw devices.
-  //
-  // 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 OpenOutputStream(
-      audio_io_handle_t handle,
-      audio_devices_t devices, audio_output_flags_t flags,
-      audio_config* config, audio_stream_out** stream_out,
-      const char* address = 0);
-
-  // Releases an audio patch.
-  // TODO(ghartman): Implement this as part of HAL 3.0
-  //int ReleaseAudioPatch(audio_patch_handle_t handle);
-
-  // Sets the audio mute status for all audio activities.  If any value other
-  // than 0 is returned, the software mixer will emulate this capability.
-  // The GCE implementation always returns 0.
-  int SetMasterMute(bool muted);
-
-  // Sets 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.
-  // The GCE implementation always returns 0.
-  int SetMasterVolume(float volume);
-
-  // Sets the audio mute status for the microphone.
-  int SetMicMute(bool state);
-
-  // 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 SetMode(audio_mode_t mode);
-
-  // Sets the global audio parameters.
-  // TODO(ghartman): Create a sensible implementation.
-  int SetParameters(const char* kvpairs);
-
-  // Sets the audio volume of a voice call. Range is between 0.0 and 1.0
-  int SetVoiceVolume(float volume);
-
-
- private:
-  // HAL 3.0 modifies the signatures of OpenInputStream and OpenOutputStream.
-  // We don't want to fork the implementation, and we don't want #ifdefs all
-  // over the code. The current implementation defines OpenInputStream and
-  // OpenOutputStream with default values for the paramteres that were added,
-  // and then generates a HAL-specific wrapper to be used in the function
-  // table.
-#if defined(AUDIO_DEVICE_API_VERSION_3_0)
-  typedef int OpenInputStreamHAL_t(
-      audio_io_handle_t, audio_devices_t, audio_config*, audio_stream_in**,
-      audio_input_flags_t, const char*, audio_source_t);
-
-  int OpenInputStreamCurrentHAL(
-      audio_io_handle_t a, audio_devices_t b, audio_config* c,
-      audio_stream_in** d, audio_input_flags_t e, const char* f,
-      audio_source_t g) {
-    return OpenInputStream(a, b, c, d, e, f, g);
-  }
-
-  typedef int OpenOutputStreamHAL_t(
-      audio_io_handle_t, audio_devices_t, audio_output_flags_t,
-      audio_config*, audio_stream_out**,
-      const char*);
-
-  int OpenOutputStreamCurrentHAL(
-      audio_io_handle_t a, audio_devices_t b, audio_output_flags_t c,
-      audio_config* d, audio_stream_out** e,
-      const char* f) {
-    return OpenOutputStream(a, b, c, d, e, f);
-  }
-#else
-  typedef int OpenInputStreamHAL_t(
-      audio_io_handle_t, audio_devices_t, audio_config*, audio_stream_in**);
-
-  int OpenInputStreamCurrentHAL(
-      audio_io_handle_t a, audio_devices_t b, audio_config* c,
-      audio_stream_in** d) {
-    return OpenInputStream(a, b, c, d);
-  }
-
-  typedef int OpenOutputStreamHAL_t(
-      audio_io_handle_t, audio_devices_t, audio_output_flags_t,
-      audio_config*, audio_stream_out**);
-
-  int OpenOutputStreamCurrentHAL(
-      audio_io_handle_t a, audio_devices_t b, audio_output_flags_t c,
-      audio_config* d, audio_stream_out** e) {
-    return OpenOutputStream(a, b, c, d, e);
-  }
-#endif
-
-  //TODO(ghartman): Update this when we support 3.0.
-#if defined(AUDIO_DEVICE_API_VERSION_2_0)
-  static const unsigned int version_ = AUDIO_DEVICE_API_VERSION_2_0;
-#else
-  static const unsigned int version_ = AUDIO_DEVICE_API_VERSION_1_0;
-#endif
-
-  using AudioDataRegionView = vsoc::audio_data::AudioDataRegionView;
-  AudioDataRegionView* audio_data_rv_{};
-  std::unique_ptr<vsoc::RegionWorker> audio_worker_;
-
-  // Lock to protect the data below.
-  mutable cvd::Mutex lock_;
-  // State that is managed at the device level.
-  float voice_volume_;
-  float master_volume_;
-  bool master_muted_;
-  bool mic_muted_;
-  audio_mode_t mode_;
-  // There can be multiple input and output streams. This field is used
-  // to assign each one a unique identifier.
-  // TODO(ghartman): This can wrap after 2^32 streams. Ideally we should check
-  // the output_list_ to ensure that the stream number hasn't been assigned.
-  // However, streams don't really appear and disapper that often.
-  // We use the same counter for both input and output streams to make things
-  // a little easier on the client.
-  uint32_t next_stream_number_;
-  // List of the currently active output streams.
-  // Used to clean things up Close()
-  std::list<GceAudioOutputStream *> output_list_;
-  // List of the currently active input streams.
-  // Used to clean things up Close()
-  typedef std::map<uint32_t, GceAudioInputStream *> input_map_t;
-  input_map_t input_map_;
-
-  GceAudio() :
-      audio_hw_device(),
-      voice_volume_(0.0),
-      master_volume_(0.0),
-      master_muted_(false),
-      mic_muted_(false),
-      mode_(AUDIO_MODE_NORMAL),
-      next_stream_number_(1) { }
-};
-
-}
diff --git a/guest/hals/audio/legacy/vsoc_audio_input_stream.cpp b/guest/hals/audio/legacy/vsoc_audio_input_stream.cpp
deleted file mode 100644
index bb9e196..0000000
--- a/guest/hals/audio/legacy/vsoc_audio_input_stream.cpp
+++ /dev/null
@@ -1,184 +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 <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <cstdint>
-#include <cinttypes>
-
-extern "C"{
-#include <cutils/str_parms.h>
-}
-
-#include "common/libs/auto_resources/auto_resources.h"
-#include "common/libs/threads/thunkers.h"
-#include "guest/hals/audio/legacy/audio_hal.h"
-#include "guest/hals/audio/legacy/vsoc_audio.h"
-#include "guest/hals/audio/legacy/vsoc_audio_input_stream.h"
-
-namespace cvd {
-
-#if defined(AUDIO_DEVICE_API_VERSION_3_0)
-static inline size_t GceAudioFrameSize(const audio_stream_in* s) {
-  return audio_stream_in_frame_size(s);
-}
-#elif defined(AUDIO_DEVICE_API_VERSION_2_0)
-static inline size_t GceAudioFrameSize(const audio_stream_in* s) {
-
-  return audio_stream_frame_size(&s->common);
-}
-#else
-static inline size_t GceAudioFrameSize(audio_stream_in* s) {
-
-  return audio_stream_frame_size(&s->common);
-}
-#endif
-
-GceAudioInputStream::GceAudioInputStream(
-    cvd::GceAudio* dev, audio_devices_t devices, const audio_config& config)
-    : audio_stream_in(),
-      dev_(dev),
-      config_(config),
-      gain_(0.0),
-      device_(devices) {
-  common.get_sample_rate =
-      cvd::thunk<audio_stream, &GceAudioInputStream::GetSampleRate>;
-  common.set_sample_rate =
-      cvd::thunk<audio_stream, &GceAudioInputStream::SetSampleRate>;
-  common.get_buffer_size =
-      cvd::thunk<audio_stream, &GceAudioInputStream::GetBufferSize>;
-  common.get_channels =
-      cvd::thunk<audio_stream, &GceAudioInputStream::GetChannels>;
-  common.get_device = cvd::thunk<audio_stream, &GceAudioInputStream::GetDevice>;
-  common.set_device = cvd::thunk<audio_stream, &GceAudioInputStream::SetDevice>;
-  common.get_format = cvd::thunk<audio_stream, &GceAudioInputStream::GetFormat>;
-  common.set_format = cvd::thunk<audio_stream, &GceAudioInputStream::SetFormat>;
-  common.standby = cvd::thunk<audio_stream, &GceAudioInputStream::Standby>;
-  common.dump = cvd::thunk<audio_stream, &GceAudioInputStream::Dump>;
-  common.set_parameters = GceAudio::SetStreamParameters;
-  common.get_parameters =
-      cvd::thunk<audio_stream, &GceAudioInputStream::GetParameters>;
-  common.add_audio_effect =
-      cvd::thunk<audio_stream, &GceAudioInputStream::AddAudioEffect>;
-  common.remove_audio_effect = cvd::thunk<audio_stream,
-    &GceAudioInputStream::RemoveAudioEffect>;
-  set_gain = cvd::thunk<audio_stream_in, &GceAudioInputStream::SetGain>;
-  read = cvd::thunk<audio_stream_in,
-    &GceAudioInputStream::Read>;
-  get_input_frames_lost = cvd::thunk<audio_stream_in,
-    &GceAudioInputStream::GetInputFramesLost>;
-  frame_size_ = GceAudioFrameSize(this);
-  buffer_model_.reset(
-      new SimulatedInputBuffer(config_.sample_rate, GetBufferSize() /
-                               frame_size_));
-  reported_lost_frames_ = 0;
-}
-
-gce_audio_message GceAudioInputStream::GetStreamDescriptor(
-    uint32_t stream_number, gce_audio_message::message_t event) {
-  gce_audio_message rval;
-  rval.message_type = event;
-  rval.stream_number = stream_number;
-  rval.frame_num = buffer_model_->GetCurrentItemNum();
-  rval.time_presented =
-      buffer_model_->GetLastUpdatedTime().SinceEpoch().GetTS();
-  rval.frame_rate = config_.sample_rate;
-  rval.channel_mask = config_.channel_mask;
-  rval.format = config_.format;
-  rval.frame_size = frame_size_;
-  return rval;
-}
-
-int GceAudioInputStream::Open(GceAudio* dev,
-                              audio_io_handle_t /*handle*/,
-                              audio_devices_t devices,
-                              const audio_config& config,
-                              GceAudioInputStream** stream_in) {
-  D("GceAudioInputStream::%s", __FUNCTION__);
-  *stream_in = new GceAudioInputStream(dev, devices, config);
-  return 0;
-}
-
-int GceAudioInputStream::SetFormat(audio_format_t format) {
-  config_.format = format;
-  frame_size_ = GceAudioFrameSize(this);
-  return 0;
-}
-
-int GceAudioInputStream::Dump(int fd) const {
-  D("GceAudioInputStream::%s", __FUNCTION__);
-  dprintf(
-      fd,
-      "\tInputSteam Dump:\n"
-      "\t\tsample rate: %u\n"
-      "\t\tbuffer size: %zu\n"
-      "\t\tchannel mask: %08x\n"
-      "\t\tformat: %d\n"
-      "\t\tdevice: %08x\n"
-      "\t\taudio dev: %p\n\n",
-      GetSampleRate(), GetBufferSize(),
-      GetChannels(), GetFormat(), device_, dev_);
-  return 0;
-}
-
-int GceAudioInputStream::SetSampleRate(uint32_t sample_rate) {
-  if (sample_rate != config_.sample_rate) {
-    config_.sample_rate = sample_rate;
-    buffer_model_.reset(
-        new SimulatedInputBuffer(sample_rate, GetBufferSize() / frame_size_));
-    reported_lost_frames_ = 0;
-  }
-  return 0;
-}
-
-char* GceAudioInputStream::GetParameters(const char* keys) const {
-  D("GceAudioInputStream::%s", __FUNCTION__);
-  if (keys) D("GceAudioInputStream::%s keys %s", __FUNCTION__, keys);
-
-  str_parms* query = str_parms_create_str(keys);
-  str_parms* reply = str_parms_create();
-
-  char value[256];
-  int ret = str_parms_get_str(query, AUDIO_PARAMETER_STREAM_ROUTING,
-                              value, sizeof(value));
-  char* str;
-  if (ret >= 0) {
-    str_parms_add_int(reply, AUDIO_PARAMETER_STREAM_ROUTING, device_);
-    str = strdup(str_parms_to_str(reply));
-  } else {
-    str = strdup(keys);
-  }
-  str_parms_destroy(query);
-  str_parms_destroy(reply);
-  return str;
-}
-
-
-ssize_t GceAudioInputStream::Read(void* buffer, size_t bytes) {
-  int64_t available = buffer_model_->RemoveFromInputBuffer(
-      bytes / frame_size_, false) * frame_size_;
-  ssize_t rval = available;
-  if ((rval != available) || (rval < 0)) {
-    ALOGE("GceAudioInputStream:%s got bad value from "
-          "RemoveFromInputBuffer %" PRId64, __FUNCTION__, available);
-    return -1;
-  }
-  memset(buffer, 0, rval);
-  return rval;
-}
-
-}
diff --git a/guest/hals/audio/legacy/vsoc_audio_input_stream.h b/guest/hals/audio/legacy/vsoc_audio_input_stream.h
deleted file mode 100644
index 222194c..0000000
--- a/guest/hals/audio/legacy/vsoc_audio_input_stream.h
+++ /dev/null
@@ -1,169 +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.
- */
-#pragma once
-
-#include <memory>
-
-#include "common/libs/utils/simulated_buffer.h"
-#include "common/vsoc/lib/vsoc_audio_message.h"
-#include "guest/hals/audio/legacy/audio_hal.h"
-
-namespace cvd {
-
-namespace {
-static const int IN_BUFFER_BYTES = 4096;
-}
-
-class GceAudio;
-
-// Defines static callback functions for generic_stream_in HAL interface.
-class GceAudioInputStream : public audio_stream_in {
- public:
-  // These methods are internal to the GCE audio implementation.
-  // Factory for new input streams.
-  static int Open(
-      GceAudio* dev, audio_io_handle_t handle,
-      audio_devices_t devices, const audio_config& config,
-      GceAudioInputStream** stream_in);
-
-  // Gets a description of this stream
-  gce_audio_message GetStreamDescriptor(
-      uint32_t stream_number, gce_audio_message::message_t event);
-
-  // audio_stream_in implementation. These definitions follow the ones
-  // in hardware/libhardware/include/hardware/audio.h
-
-  // Returns the sampling rate in Hz - eg. 44100.
-  uint32_t GetSampleRate() const { return config_.sample_rate; }
-
-  // Sets the sample rate
-  // no direct calls from JB and later, but called indirectly from
-  // GceAudio::SetStreamParamters when it finds
-  // AUDIO_PARAMETER_STREAM_SAMPLING_RATE
-  int SetSampleRate(uint32_t rate);
-
-  // Returns the 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 GetBufferSize() const {
-    return IN_BUFFER_BYTES;
-  }
-
-  // Returns the channel mask -
-  //   e.g. AUDIO_CHANNEL_OUT_STEREO or AUDIO_CHANNEL_IN_STEREO
-  audio_channel_mask_t GetChannels() const {
-    return config_.channel_mask;
-  }
-
-  // Returns the audio format - e.g. AUDIO_FORMAT_PCM_16_BIT
-  audio_format_t GetFormat() const {
-    return config_.format;
-  }
-
-  // Sets the audio format
-  // no direct calls from JB and later, but called indirectly from
-  // GceAudio::SetStreamParamters when it finds
-  //   AUDIO_PARAMETER_STREAM_FORMAT
-  int SetFormat(audio_format_t format);
-
-  // Puts 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() { return 0; }
-
-  // Dumps the state of the audio input/output device
-  int Dump(int fd) const;
-
-  // Returns the set of device(s) which this stream is connected to
-  audio_devices_t GetDevice() const {
-    return device_;
-  }
-
-  // Sets the device this stream is connected to.
-  // no direct calls from JB and later, but called indirectly from
-  // GceAudio::SetStreamParamters when it finds
-  //   AUDIO_PARAMETER_STREAM_ROUTING for both input and output.
-  //   AUDIO_PARAMETER_STREAM_INPUT_SOURCE is an additional information used by
-  //                                       input streams only.
-  int SetDevice(audio_devices_t device) { device_ = device; return 0; }
-
-  // sets 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.
-  // Uses GceAudio::SetStreamParameters
-
-  // Returns a pointer to a heap allocated string. The caller is responsible
-  // for freeing the memory for it using free().
-  char* GetParameters(const char* keys) const;
-
-  int AddAudioEffect(effect_handle_t /*effect*/) const {
-    return 0;
-  }
-
-  int RemoveAudioEffect(effect_handle_t /*effect*/) const {
-    return 0;
-  }
-
-  // Input stream specific methods
-
-  // Sets the input gain for the audio driver. This method is for
-  // for future use as of M.
-  int SetGain(float gain) {
-    gain_ = gain;
-    return 0;
-  }
-
-  // Reads audio buffer in from audio driver. Returns number of bytes read, or
-  // a negative android::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(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 GetInputFramesLost() {
-    int64_t cur_lost_frames = buffer_model_->GetLostInputItems();
-    uint32_t rval = cur_lost_frames - reported_lost_frames_;
-    reported_lost_frames_ = cur_lost_frames;
-    return rval;
-  }
-
- private:
-  GceAudioInputStream(cvd::GceAudio* dev, audio_devices_t devices,
-                      const audio_config& config);
-  std::unique_ptr<SimulatedInputBuffer> buffer_model_;
-  cvd::GceAudio *dev_;
-  audio_config config_;
-  float gain_;
-  audio_devices_t device_;
-  size_t frame_size_;
-  int64_t reported_lost_frames_;
-};
-
-}
diff --git a/guest/hals/audio/legacy/vsoc_audio_output_stream.cpp b/guest/hals/audio/legacy/vsoc_audio_output_stream.cpp
deleted file mode 100644
index 571f95e..0000000
--- a/guest/hals/audio/legacy/vsoc_audio_output_stream.cpp
+++ /dev/null
@@ -1,322 +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 <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <memory>
-
-#include <cutils/sockets.h>
-extern "C"{
-#include <cutils/str_parms.h>
-}
-
-#include "common/libs/auto_resources/auto_resources.h"
-#include "common/libs/threads/thunkers.h"
-#include "common/libs/time/monotonic_time.h"
-#include "guest/hals/audio/legacy/audio_hal.h"
-#include "guest/hals/audio/legacy/vsoc_audio.h"
-#include "guest/hals/audio/legacy/vsoc_audio_output_stream.h"
-#include "guest/libs/remoter/remoter_framework_pkt.h"
-
-#if defined(AUDIO_DEVICE_API_VERSION_3_0)
-static inline size_t GceAudioFrameSize(const audio_stream_out* s) {
-  return audio_stream_out_frame_size(s);
-}
-#elif defined(AUDIO_DEVICE_API_VERSION_2_0)
-static inline size_t GceAudioFrameSize(const audio_stream_out* s) {
-
-  return audio_stream_frame_size(&s->common);
-}
-#else
-static inline size_t GceAudioFrameSize(audio_stream_out* s) {
-
-  return audio_stream_frame_size(&s->common);
-}
-#endif
-
-namespace cvd {
-
-const size_t GceAudioOutputStream::kOutBufferSize;
-const size_t GceAudioOutputStream::kOutLatency;
-
-GceAudioOutputStream::GceAudioOutputStream(GceAudio* dev) :
-    audio_stream_out(),
-    dev_(dev),
-    device_(AUDIO_DEVICE_OUT_DEFAULT),
-    frame_count_(0),
-    left_volume_(0.0),
-    right_volume_(0.0) { }
-
-int GceAudioOutputStream::Dump(int fd) const {
-  D("GceAudioOutputStream::%s", __FUNCTION__);
-  dprintf(
-      fd,
-      "\tout_dump:\n"
-      "\t\tsample rate: %u\n"
-      "\t\tbuffer size: %zu\n"
-      "\t\tchannel mask: %08x\n"
-      "\t\tformat: %d\n"
-      "\t\tdevice: %08x\n"
-      "\t\taudio dev: %p\n\n",
-      GetSampleRate(),
-      GetBufferSize(),
-      GetChannels(),
-      GetFormat(),
-      device_,
-      dev_);
-  return 0;
-}
-
-int GceAudioOutputStream::GetNextWriteTimestamp(int64_t* nstime) const {
-  *nstime = cvd::time::Nanoseconds(
-      buffer_->GetNextOutputBufferItemTime().SinceEpoch()).count();
-  return 0;
-}
-
-namespace {
-struct StrParmsDestroyer {
-  void operator()(str_parms* parms) const {
-    if (parms) {
-      str_parms_destroy(parms);
-    }
-  }
-};
-
-typedef std::unique_ptr<str_parms, StrParmsDestroyer> StrParmsPtr;
-}
-
-int GceAudioOutputStream::SetParameters(const char* kv_pairs) {
-  int err = 0;
-  StrParmsPtr parms(str_parms_create_str(kv_pairs));
-  {
-    int fmt = 0;
-    if (str_parms_get_int(parms.get(), AUDIO_PARAMETER_STREAM_FORMAT, &fmt)
-        == 0) {
-      SetFormat(static_cast<audio_format_t>(fmt));
-    }
-  }
-  {
-    int sample_rate = 0;
-    if (str_parms_get_int(parms.get(), AUDIO_PARAMETER_STREAM_SAMPLING_RATE,
-                          &sample_rate) == 0) {
-      SetSampleRate(static_cast<uint32_t>(sample_rate));
-    }
-  }
-  {
-    int routing = 0;
-    if (str_parms_get_int(parms.get(), AUDIO_PARAMETER_STREAM_ROUTING,
-                          &routing) == 0) {
-      device_ = static_cast<uint32_t>(routing);
-    }
-  }
-  {
-    int channels = 0;
-    if (str_parms_get_int(parms.get(), AUDIO_PARAMETER_STREAM_CHANNELS,
-                          &channels) == 0) {
-      message_header_.channel_mask = static_cast<audio_channel_mask_t>(channels);
-    }
-  }
-  {
-    int frame_count = 0;
-    if (str_parms_get_int(parms.get(), AUDIO_PARAMETER_STREAM_FRAME_COUNT,
-                          &frame_count) == 0) {
-      frame_count_ = static_cast<size_t>(frame_count);
-    }
-  }
-  {
-    int input_source = 0;
-    if (str_parms_get_int(parms.get(), AUDIO_PARAMETER_STREAM_INPUT_SOURCE,
-                          &input_source) == 0){
-      ALOGE("GceAudioOutputStream::%s AUDIO_PARAMETER_STREAM_INPUT_SOURCE"
-            " passed to an output stream", __FUNCTION__);
-      err = -EINVAL;
-    }
-  }
-  return err;
-}
-
-void GceAudioOutputStream::AddIntIfKeyPresent(
-    /*const */ str_parms* query, str_parms* reply, const char* key, int value) {
-  if (str_parms_get_str(query, key, NULL, 0) >= 0) {
-    str_parms_add_int(reply, key, value);
-  }
-}
-
-
-char* GceAudioOutputStream::GetParameters(const char* keys) const {
-  D("GceAudioOutputStream::%s", __FUNCTION__);
-  if (keys) D("%s keys %s", __FUNCTION__, keys);
-
-  StrParmsPtr query(str_parms_create_str(keys));
-  StrParmsPtr reply(str_parms_create());
-
-  AddIntIfKeyPresent(query.get(), reply.get(),
-                     AUDIO_PARAMETER_STREAM_FORMAT,
-                     static_cast<int>(GetFormat()));
-  AddIntIfKeyPresent(query.get(), reply.get(),
-                     AUDIO_PARAMETER_STREAM_SAMPLING_RATE,
-                     static_cast<int>(GetSampleRate()));
-  AddIntIfKeyPresent(query.get(), reply.get(),
-                     AUDIO_PARAMETER_STREAM_ROUTING,
-                     static_cast<int>(device_));
-  AddIntIfKeyPresent(query.get(), reply.get(),
-                     AUDIO_PARAMETER_STREAM_CHANNELS,
-                     static_cast<int>(message_header_.channel_mask));
-  AddIntIfKeyPresent(query.get(), reply.get(),
-                     AUDIO_PARAMETER_STREAM_FRAME_COUNT,
-                     static_cast<int>(frame_count_));
-
-  char *str = str_parms_to_str(reply.get());
-  return str;
-}
-
-int GceAudioOutputStream::GetRenderPosition(uint32_t* dsp_frames) const {
-  *dsp_frames = buffer_->GetCurrentItemNum();
-  return 0;
-}
-
-ssize_t GceAudioOutputStream::Write(const void* buffer, size_t length) {
-  // We're always the blocking case for now.
-  static const bool blocking = true;
-  message_header_.frame_size = frame_size_;
-  frame_count_ += message_header_.num_frames_presented = length / frame_size_;
-  message_header_.message_type = gce_audio_message::DATA_SAMPLES;
-  // First do a nonblocking add
-  int64_t frames_accepted_without_blocking = buffer_->AddToOutputBuffer(
-      message_header_.num_frames_presented, false);
-  // This seems backward, but adding the items to the buffer first
-  // allows us to calculate the right frame number in the case of underflow.
-  message_header_.frame_num =
-      buffer_->GetNextOutputBufferItemNum() - frames_accepted_without_blocking;
-  message_header_.time_presented =
-      buffer_->GetLastUpdatedTime().SinceEpoch().GetTS();
-  // We want to send the message before blocking. If we're in blocking mode
-  // we will accept all of the frames.
-  if (blocking) {
-    message_header_.num_frames_accepted =
-        message_header_.num_frames_presented;
-  } else {
-    message_header_.num_frames_accepted = frames_accepted_without_blocking;
-  }
-  // Never exceed the maximum packet size, as defined by the interface.
-  // Clip off any frames that we can't transmit and increment the clipped
-  // count.
-  size_t transmitted_frame_size = length;
-  if (length > gce_audio_message::kMaxAudioFrameLen) {
-    transmitted_frame_size = gce_audio_message::kMaxAudioFrameLen;
-    message_header_.num_packets_shortened++;
-  }
-  message_header_.total_size =
-      sizeof(message_header_) + transmitted_frame_size;
-  // Now send the message. Do not block if the receiver isn't ready
-  // If this is a blocking write we will block after we have attempted to
-  // send the data to the receiver.
-  msghdr msg;
-  iovec msg_iov[2];
-  // We need a cast here because iov_base is defined non-const to support
-  // recvmsg et.al.
-  // There is no danger here:sendmsg does not write to the buffer.
-  msg_iov[0].iov_base = &message_header_;
-  msg_iov[0].iov_len = sizeof(message_header_);
-  msg_iov[1].iov_base = const_cast<void*>(buffer);
-  msg_iov[1].iov_len = transmitted_frame_size;
-  msg.msg_name = NULL;
-  msg.msg_namelen = 0;
-  msg.msg_iov = msg_iov;
-  msg.msg_iovlen = arraysize(msg_iov);
-  msg.msg_control = NULL;
-  msg.msg_controllen = 0;
-  msg.msg_flags = 0;
-  if (dev_->SendMsg(msg, MSG_DONTWAIT) < 0) {
-    message_header_.num_packets_dropped++;
-  }
-  if (!blocking) {
-    return frames_accepted_without_blocking * frame_size_;
-  }
-  if ((message_header_.num_frames_presented) >
-      static_cast<size_t>(frames_accepted_without_blocking)) {
-    buffer_->AddToOutputBuffer(
-        message_header_.num_frames_presented -
-        frames_accepted_without_blocking, true);
-  }
-  return message_header_.num_frames_presented * frame_size_;
-}
-
-int GceAudioOutputStream::Open(
-    GceAudio* dev, audio_io_handle_t /*handle*/,
-    audio_devices_t devices, audio_output_flags_t /*flags*/,
-    audio_config* config, uint32_t stream_number,
-    GceAudioOutputStream** stream_out) {
-  D("GceAudioOutputStream::%s", __FUNCTION__);
-  *stream_out = NULL;
-  // Deleted by Close(); UniquePtr holds until end of Open().
-  std::unique_ptr<GceAudioOutputStream> out(
-      new GceAudioOutputStream(dev));
-  out->message_header_.stream_number = stream_number;
-  out->message_header_.format = config->format;
-  out->message_header_.channel_mask = config->channel_mask;
-  out->message_header_.frame_rate = config->sample_rate;
-  out->frame_count_ = config->frame_count;
-  out->common.get_sample_rate =
-      cvd::thunk<audio_stream, &GceAudioOutputStream::GetSampleRate>;
-  out->common.set_sample_rate =
-      cvd::thunk<audio_stream, &GceAudioOutputStream::SetSampleRate>;
-  out->common.get_buffer_size =
-      cvd::thunk<audio_stream, &GceAudioOutputStream::GetBufferSize>;
-  out->common.get_channels =
-      cvd::thunk<audio_stream, &GceAudioOutputStream::GetChannels>;
-  out->common.get_format = cvd::thunk<audio_stream, &GceAudioOutputStream::GetFormat>;
-  out->common.set_format = cvd::thunk<audio_stream, &GceAudioOutputStream::SetFormat>;
-  out->common.standby = cvd::thunk<audio_stream, &GceAudioOutputStream::Standby>;
-  out->common.dump = cvd::thunk<audio_stream, &GceAudioOutputStream::Dump>;
-  out->common.get_device = cvd::thunk<audio_stream, &GceAudioOutputStream::GetDevice>;
-  out->common.set_device = cvd::thunk<audio_stream, &GceAudioOutputStream::SetDevice>;
-  out->common.set_parameters =
-      cvd::thunk<audio_stream, &GceAudioOutputStream::SetParameters>;
-  out->common.get_parameters =
-      cvd::thunk<audio_stream, &GceAudioOutputStream::GetParameters>;
-  out->common.add_audio_effect =
-      cvd::thunk<audio_stream, &GceAudioOutputStream::AddAudioEffect>;
-  out->common.remove_audio_effect =
-      cvd::thunk<audio_stream, &GceAudioOutputStream::RemoveAudioEffect>;
-
-  out->get_latency =
-      cvd::thunk<audio_stream_out, &GceAudioOutputStream::GetLatency>;
-  out->set_volume =
-      cvd::thunk<audio_stream_out, &GceAudioOutputStream::SetVolume>;
-  out->write =
-      cvd::thunk<audio_stream_out, &GceAudioOutputStream::Write>;
-  out->get_render_position =
-      cvd::thunk<audio_stream_out, &GceAudioOutputStream::GetRenderPosition>;
-  out->get_next_write_timestamp =
-      cvd::thunk<audio_stream_out, &GceAudioOutputStream::GetNextWriteTimestamp>;
-  out->device_ = devices;
-  out->frame_size_ = GceAudioFrameSize(out.get());
-
-  int64_t item_capacity =
-      out->frame_size_  == 0 ? 0 : out->GetBufferSize() / out->frame_size_;
-  if (item_capacity == 0) {
-    ALOGE("Attempt to create GceAudioOutputStream with frame_size_ of 0.");
-    return -EINVAL;
-  }
-  out->buffer_.reset(
-      new SimulatedOutputBuffer(
-          config->sample_rate, item_capacity));
-  *stream_out = out.release();
-  return 0;
-}
-
-}  // namespace cvd
diff --git a/guest/hals/audio/legacy/vsoc_audio_output_stream.h b/guest/hals/audio/legacy/vsoc_audio_output_stream.h
deleted file mode 100644
index 70ced6e..0000000
--- a/guest/hals/audio/legacy/vsoc_audio_output_stream.h
+++ /dev/null
@@ -1,313 +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.
- */
-#pragma once
-
-#include <memory>
-
-#include "common/libs/utils/simulated_buffer.h"
-#include "common/vsoc/lib/vsoc_audio_message.h"
-#include "guest/hals/audio/legacy/audio_hal.h"
-
-namespace cvd {
-
-// Defines static callback functions for the audio_stream and audio_stream_out
-// interfaces in  libhardware/include/hardware/audio.h
-//
-// Where the is a conflict the comments there apply.
-// By default these methods return 0 on success -<errno> for failure.
-class GceAudioOutputStream : public audio_stream_out {
- public:
-  // Factory method for a new output stream.
-  static int Open(GceAudio* dev, audio_io_handle_t handle,
-                  audio_devices_t devices, audio_output_flags_t flags,
-                  audio_config* config, uint32_t stream_number,
-                  GceAudioOutputStream** stream_out);
-
-  gce_audio_message GetStreamDescriptor(
-      gce_audio_message::message_t message_type) const {
-    gce_audio_message rval = message_header_;
-    rval.total_size = sizeof(rval);
-    rval.header_size = sizeof(rval);
-    rval.message_type = message_type;
-    rval.num_frames_presented = 0;
-    rval.num_frames_accepted = 0;
-    return rval;
-  }
-
-  // Method from audio_stream, listed in order of appearance.
-  // TODO(ghartman): Consider moving these if they could be shared with
-  // gce_audio_input_stream.
-
-
-  // Returns the sampling rate in Hz - eg. 44100.
-  uint32_t GetSampleRate() const {
-    return message_header_.frame_rate;
-  }
-
-  // Sets the sample rate
-  //   AUDIO_PARAMETER_STREAM_SAMPLING_RATE
-  int SetSampleRate(uint32_t sample_rate) {
-    if (sample_rate != message_header_.frame_rate) {
-      message_header_.frame_rate = sample_rate;
-      // TODO(ghartman): The output buffer should be quantized at about 192
-      // bytes for better fidelity. Do this by passing
-      // frame_rate * frame_size / 192 and then rescaling the outputs.
-      // Or we could always create a quantized wrapper of the buffer...
-      buffer_.reset(
-          new SimulatedOutputBuffer(
-              sample_rate, GetBufferSize() / frame_size_));
-    }
-    return 0;
-  }
-
-  // Returns the size of input/output buffer in bytes for this stream.
-  // eg. 4800.
-  // It should be a multiple of the frame size.  See also GetInputBufferSize.
-  size_t GetBufferSize() const {
-    return kOutBufferSize;
-  }
-
-  // Returns the channel mask -
-  //  e.g. AUDIO_CHANNEL_OUT_STEREO or AUDIO_CHANNEL_IN_STEREO
-  audio_channel_mask_t GetChannels() const {
-    return message_header_.channel_mask;
-  }
-
-  // Returns the audio format - e.g. AUDIO_FORMAT_PCM_16_BIT
-  audio_format_t GetFormat() const {
-    return message_header_.format;
-  }
-
-  // Sets the audio format.
-  // Unused as of JB - use set_parameters with key
-  //   AUDIO_PARAMETER_STREAM_FORMAT
-  int SetFormat(audio_format_t format) {
-    message_header_.format = format;
-    return 0;
-  }
-
-  // Puts 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.
-  // TODO(ghartman): This should reset some of the frame counts.
-  int Standby() {
-    return 0;
-  }
-
-  // dumps the state of the audio hardware to the given fd.
-  // This information can be retrieved using the dumpsys utility.
-  int Dump(int fd) const;
-
-  // Returns the set of device(s) which this stream is connected to.
-  // TODO(ghartman): Implement this.
-  audio_devices_t GetDevice() const { return device_; }
-
-  // Not directly called from JB forward.
-  // Called indirectly from SetParameters with the key
-  //   AUDIO_PARAMETER_STREAM_ROUTING
-  int SetDevice(audio_devices_t device) { device_ = device; return 0; }
-
-  // Sets 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 SetParameters(const char* kv_pairs);
-
-  // Gets audio stream parameters. The function accepts a list of
-  // keys in the form: key1=value1;key2=value2;...
-  //
-  // Returns a pointer to a heap allocated string. The caller is responsible
-  // for freeing the memory for it using free().
-  // TODO(ghartman): Implement this.
-  char* GetParameters(const char* keys) const;
-
-  // TODO(ghartman): Implement this.
-  int AddAudioEffect(effect_handle_t /*effect*/) const {
-    static unsigned int printed = 0;  // printed every 2^32-th call.
-    ALOGE_IF(!printed++, "%s: not implemented", __FUNCTION__);
-    return 0;
-  }
-
-  // TODO(ghartman): Implement this.
-  int RemoveAudioEffect(effect_handle_t /*effect*/) const {
-    static unsigned int printed = 0;  // printed every 2^32-th call.
-    ALOGE_IF(!printed++, "%s: not implemented", __FUNCTION__);
-    return 0;
-  }
-
-  // Methods defined in audio_stream_out
-
-  // Returns the audio hardware driver estimated latency in milliseconds.
-  // TODO(ghartman): Calculate this based on the format and the quantum.
-  uint32_t GetLatency() const {
-    return kOutLatency;
-  }
-
-  // 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.
-  //
-  // Note that GCE simulates hardware mixing.
-  int SetVolume(float left_volume, float right_volume) {
-    left_volume_ = left_volume;
-    right_volume_ = right_volume;
-    return 0;
-  }
-
-  // Write audio buffer to driver. Returns number of bytes written, or a
-  // negative android::status_t. If at least one frame was written successfully prior
-  // to the error the driver will return that successful (short) byte count
-  // and then return an error in the subsequent call.
-  //
-  // If SetCallback() 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(const void* buffer, size_t bytes);
-
-  // Returns the number of audio frames written by the audio dsp to DAC since
-  // the output has exited standby
-  // TODO(ghartman): Implement zeroing this in Standby().
-  int GetRenderPosition(uint32_t* dsp_frames) const;
-
-  // Gets 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.
-  //
-  // The GCE implementation uses CLOCK_MONOTONIC, which also happens to line
-  // up with LocalTime.
-  int GetNextWriteTimestamp(int64_t*) const;
-
-  // Turns on non-blocking mode and sets 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.
-  //
-  // TODO(ghartman): Implement this URGENTLY.
-  //
-  // int SetCallback(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.
-  //
-  // TODO(ghartman): Implement this URGENTLY. There is already support in
-  // SimulatedBuffer.
-  // int Pause();
-
-  // 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.
-  //
-  // TODO(ghartman): Implement this URGENTLY.
-  //
-  // int Resume();
-
-  // 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.
-  //
-  // TODO(ghartman): Implement this URGENTLY.
-  //
-  // int Drain(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.
-  //
-  // TODO(ghartman): Implement this URGENTLY.
-  //
-  // int Flush();
-
-  // Returns 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.
-  //
-  // TODO(ghartman): Implement this URGENTLY.
-  //
-  // int GetPresentationPosition(uint64_t *frames, struct timespec *timestamp);
-
- private:
-  // If key is present in query, add key=value; to reply.
-  // query should be pointer to const, but the str_parms functions aren't
-  // const-correct, so neither is this.
-  static void AddIntIfKeyPresent(
-      /*const*/ str_parms* query, str_parms* reply, const char* key, int value);
-
-
-  explicit GceAudioOutputStream(cvd::GceAudio*);
-
-  static const size_t kOutBufferSize = 3840;
-  static const size_t kOutLatency = 2;
-
-  gce_audio_message message_header_;
-  std::unique_ptr<SimulatedOutputBuffer> buffer_;
-  cvd::GceAudio *dev_;
-  audio_devices_t device_;
-  size_t frame_size_;
-  size_t frame_count_;
-  float left_volume_;
-  float right_volume_;
-};
-
-}