Merge "Revert "Switch to f2fs userdata by default""
diff --git a/Android.bp b/Android.bp
index a9ee724..9fed081 100644
--- a/Android.bp
+++ b/Android.bp
@@ -110,132 +110,3 @@
     host_supported: true,
     defaults: ["cuttlefish_base"],
 }
-
-cc_library_shared {
-    name: "vsoc_lib",
-    srcs: [
-        "common/vsoc/lib/compat.cpp",
-        "common/vsoc/lib/audio_data_layout.cpp",
-        "common/vsoc/lib/e2e_test_region_layout.cpp",
-        "common/vsoc/lib/gralloc_layout.cpp",
-        "common/vsoc/lib/input_events_layout.cpp",
-        "common/vsoc/lib/input_events_region_view.cpp",
-        "common/vsoc/lib/lock_common.cpp",
-        "common/vsoc/lib/managed_e2e_test_region_layout.cpp",
-        "common/vsoc/lib/region_view.cpp",
-        "common/vsoc/lib/screen_layout.cpp",
-        "common/vsoc/lib/screen_region_view.cpp",
-        "common/vsoc/lib/socket_forward_layout.cpp",
-        "common/vsoc/lib/socket_forward_region_view.cpp",
-        "common/vsoc/lib/vsoc_memory.cpp",
-    ],
-    header_libs: ["cuttlefish_glog"],
-    shared_libs: [
-        "libcuttlefish_fs",
-        "cuttlefish_auto_resources",
-        "libbase",
-        "liblog",
-    ],
-    target: {
-        host: {
-            srcs: [
-                "host/vsoc/lib/gralloc_buffer_region_view.cpp",
-                "host/vsoc/lib/host_lock.cpp",
-                "host/vsoc/lib/region_control.cpp",
-                "host/vsoc/lib/region_view.cpp",
-            ],
-        },
-        android: {
-            srcs: [
-                "guest/vsoc/lib/gralloc_region_view.cpp",
-                "guest/vsoc/lib/guest_lock.cpp",
-                "guest/vsoc/lib/region_control.cpp",
-                "guest/vsoc/lib/region_view.cpp",
-            ],
-        },
-    },
-    defaults: ["cuttlefish_host_and_guest"],
-}
-
-cc_test_host {
-    name: "circqueue_test",
-    srcs: [
-        "common/vsoc/lib/circqueue_test.cpp",
-    ],
-    shared_libs: [
-        "vsoc_lib",
-        "libbase",
-    ],
-    defaults: ["cuttlefish_host_only"],
-    test_suites: ["general-tests"],
-}
-
-cc_binary_host {
-    name: "vsoc_screen_region_view_test",
-    srcs: [
-        "common/vsoc/lib/screen_region_view_test.cpp",
-    ],
-    static_libs: [
-        "libcuttlefish_host_config",
-        "libjsoncpp",
-        "libgflags",
-    ],
-    shared_libs: [
-        "vsoc_lib",
-        "libbase",
-        "libcuttlefish_utils",
-    ],
-    defaults: ["cuttlefish_host_only"],
-}
-
-cc_test_host {
-    name: "lock_test",
-    srcs: [
-        "common/vsoc/lib/lock_test.cpp",
-    ],
-    shared_libs: [
-        "vsoc_lib",
-        "libcuttlefish_fs",
-        "cuttlefish_auto_resources",
-        "libbase",
-    ],
-    static_libs: [
-        "libgtest_host",
-    ],
-    defaults: ["cuttlefish_host_only"],
-    test_suites: ["general-tests"],
-}
-
-cc_test_host {
-    name: "vsoc_graphics_test",
-    srcs: [
-        "common/vsoc/lib/graphics_test.cpp",
-    ],
-    shared_libs: [
-        "vsoc_lib",
-        "libbase",
-    ],
-    defaults: ["cuttlefish_host_only"],
-    test_suites: ["general-tests"],
-}
-
-cc_binary_host {
-    name: "host_region_e2e_test",
-    srcs: [
-        "host/vsoc/lib/host_region_e2e_test.cpp",
-    ],
-    shared_libs: [
-        "vsoc_lib",
-        "libcuttlefish_fs",
-        "libcuttlefish_utils",
-        "cuttlefish_auto_resources",
-        "libbase",
-    ],
-    static_libs: [
-        "libcuttlefish_host_config",
-        "libjsoncpp",
-        "libgtest_host",
-        "libgflags",
-    ],
-    defaults: ["cuttlefish_host_only"],
-}
diff --git a/Android.mk b/Android.mk
index 0b78c87..8e69e18 100644
--- a/Android.mk
+++ b/Android.mk
@@ -11,7 +11,7 @@
 # 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.
-ifneq ($(filter vsoc_arm vsoc_arm64 vsoc_x86 vsoc_x86_64 vsoc_x86_noapex, $(TARGET_DEVICE)),)
+ifneq ($(filter vsoc_arm64 vsoc_x86 vsoc_x86_64, $(TARGET_BOARD_PLATFORM)),)
 LOCAL_PATH:= $(call my-dir)
 include $(call first-makefiles-under,$(LOCAL_PATH))
 endif
diff --git a/OWNERS b/OWNERS
index ce92c4f..9594320 100644
--- a/OWNERS
+++ b/OWNERS
@@ -2,6 +2,7 @@
 ghartman@google.com
 jemoreira@google.com
 malchev@google.com
-schuffelen@google.com
 muntsinger@google.com
+natsu@google.com
 rammuthiah@google.com
+schuffelen@google.com
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 91d513e..ef710ca 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -6,22 +6,13 @@
   ],
   "presubmit": [
     {
-      "name": "circqueue_test",
-      "host": true
-    },
-    {
-      "name": "lock_test",
-      "host": true
-    },
-    {
-      "name": "vsoc_graphics_test",
-      "host": true
-    },
-    {
       "name": "vts_treble_vintf_framework_test"
     },
     {
       "name": "vts_treble_vintf_vendor_test"
+    },
+    {
+      "name": "hidl_implementation_test"
     }
   ]
 }
diff --git a/common/frontend/Android.bp b/common/frontend/Android.bp
index a7a4de5..39a4dbb 100644
--- a/common/frontend/Android.bp
+++ b/common/frontend/Android.bp
@@ -14,6 +14,5 @@
 // limitations under the License.
 
 subdirs = [
-    "socket_forward_proxy",
     "socket_vsock_proxy",
 ]
diff --git a/common/frontend/socket_forward_proxy/Android.bp b/common/frontend/socket_forward_proxy/Android.bp
deleted file mode 100644
index 74ef53a..0000000
--- a/common/frontend/socket_forward_proxy/Android.bp
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// Copyright (C) 2018 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.
-
-cc_binary {
-    name: "socket_forward_proxy",
-    srcs: [
-        "main.cpp",
-    ],
-    shared_libs: [
-        "libbase",
-        "libcuttlefish_fs",
-        "libcuttlefish_utils",
-        "libcuttlefish_strings",
-        "cuttlefish_auto_resources",
-        "vsoc_lib",
-        "liblog",
-    ],
-    static_libs: [
-        "libgflags",
-    ],
-    header_libs: [
-        "cuttlefish_glog",
-    ],
-    target: {
-        host: {
-            static_libs: [
-                "libcuttlefish_host_config",
-                "libjsoncpp",
-            ],
-        },
-    },
-    defaults: ["cuttlefish_host_and_guest"]
-}
diff --git a/common/frontend/socket_forward_proxy/main.cpp b/common/frontend/socket_forward_proxy/main.cpp
deleted file mode 100644
index 4c21459..0000000
--- a/common/frontend/socket_forward_proxy/main.cpp
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * Copyright (C) 2018 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 <array>
-#include <cstdint>
-#include <cstdlib>
-#include <iostream>
-#include <limits>
-#include <memory>
-#include <mutex>
-#include <sstream>
-#include <string>
-#include <thread>
-#include <vector>
-#include <glog/logging.h>
-#include <gflags/gflags.h>
-
-#include <unistd.h>
-
-#include "common/libs/fs/shared_fd.h"
-#include "common/libs/strings/str_split.h"
-#include "common/vsoc/lib/socket_forward_region_view.h"
-
-#ifdef CUTTLEFISH_HOST
-#include "host/libs/config/cuttlefish_config.h"
-#endif
-
-using vsoc::socket_forward::Packet;
-using vsoc::socket_forward::SocketForwardRegionView;
-
-#ifdef CUTTLEFISH_HOST
-DEFINE_string(guest_ports, "",
-              "Comma-separated list of ports on which to forward TCP "
-              "connections to the guest.");
-DEFINE_string(host_ports, "",
-              "Comma-separated list of ports on which to run TCP servers on "
-              "the host.");
-#endif
-
-namespace {
-// Sends packets, Shutdown(SHUT_WR) on destruction
-class SocketSender {
- public:
-  explicit SocketSender(cvd::SharedFD socket) : socket_{std::move(socket)} {}
-
-  SocketSender(SocketSender&&) = default;
-  SocketSender& operator=(SocketSender&&) = default;
-
-  SocketSender(const SocketSender&&) = delete;
-  SocketSender& operator=(const SocketSender&) = delete;
-
-  ~SocketSender() {
-    if (socket_.operator->()) {  // check that socket_ was not moved-from
-      socket_->Shutdown(SHUT_WR);
-    }
-  }
-
-  ssize_t SendAll(const Packet& packet) {
-    ssize_t written{};
-    while (written < static_cast<ssize_t>(packet.payload_length())) {
-      if (!socket_->IsOpen()) {
-        return -1;
-      }
-      auto just_written =
-          socket_->Send(packet.payload() + written,
-                        packet.payload_length() - written, MSG_NOSIGNAL);
-      if (just_written <= 0) {
-        LOG(INFO) << "Couldn't write to client: "
-                  << strerror(socket_->GetErrno());
-        return just_written;
-      }
-      written += just_written;
-    }
-    return written;
-  }
-
- private:
-  cvd::SharedFD socket_;
-};
-
-class SocketReceiver {
- public:
-  explicit SocketReceiver(cvd::SharedFD socket) : socket_{std::move(socket)} {}
-
-  SocketReceiver(SocketReceiver&&) = default;
-  SocketReceiver& operator=(SocketReceiver&&) = default;
-
-  SocketReceiver(const SocketReceiver&&) = delete;
-  SocketReceiver& operator=(const SocketReceiver&) = delete;
-
-  // *packet will be empty if Read returns 0 or error
-  void Recv(Packet* packet) {
-    auto size = socket_->Read(packet->payload(), sizeof packet->payload());
-    if (size < 0) {
-      size = 0;
-    }
-    packet->set_payload_length(size);
-  }
-
- private:
-  cvd::SharedFD socket_;
-};
-
-void SocketToShm(SocketReceiver socket_receiver,
-                 SocketForwardRegionView::ShmSender shm_sender) {
-  while (true) {
-    auto packet = Packet::MakeData();
-    socket_receiver.Recv(&packet);
-    if (packet.empty() || !shm_sender.Send(packet)) {
-      break;
-    }
-  }
-  LOG(INFO) << "Socket to shm exiting";
-}
-
-void ShmToSocket(SocketSender socket_sender,
-                 SocketForwardRegionView::ShmReceiver shm_receiver) {
-  auto packet = Packet{};
-  while (true) {
-    shm_receiver.Recv(&packet);
-    CHECK(packet.IsData());
-    if (packet.empty()) {
-      break;
-    }
-    if (socket_sender.SendAll(packet) < 0) {
-      break;
-    }
-  }
-  LOG(INFO) << "Shm to socket exiting";
-}
-
-// One thread for reading from shm and writing into a socket.
-// One thread for reading from a socket and writing into shm.
-void HandleConnection(SocketForwardRegionView::ShmSenderReceiverPair shm_sender_and_receiver,
-                      cvd::SharedFD socket) {
-  auto socket_to_shm =
-      std::thread(SocketToShm, SocketReceiver{socket}, std::move(shm_sender_and_receiver.first));
-  ShmToSocket(SocketSender{socket}, std::move(shm_sender_and_receiver.second));
-  socket_to_shm.join();
-}
-
-#ifdef CUTTLEFISH_HOST
-struct PortPair {
-  int guest_port;
-  int host_port;
-};
-
-enum class QueueState {
-  kFree,
-  kUsed,
-};
-
-struct SocketConnectionInfo {
-  std::mutex lock{};
-  std::condition_variable cv{};
-  cvd::SharedFD socket{};
-  int guest_port{};
-  QueueState state = QueueState::kFree;
-};
-
-static constexpr auto kNumHostThreads =
-    vsoc::layout::socket_forward::kNumQueues;
-
-using SocketConnectionInfoCollection =
-    std::array<SocketConnectionInfo, kNumHostThreads>;
-
-void MarkAsFree(SocketConnectionInfo* conn) {
-  std::lock_guard<std::mutex> guard{conn->lock};
-  conn->socket = cvd::SharedFD{};
-  conn->guest_port = 0;
-  conn->state = QueueState::kFree;
-}
-
-std::pair<int, cvd::SharedFD> WaitForConnection(SocketConnectionInfo* conn) {
-  std::unique_lock<std::mutex> guard{conn->lock};
-  while (conn->state != QueueState::kUsed) {
-    conn->cv.wait(guard);
-  }
-  return {conn->guest_port, conn->socket};
-}
-
-[[noreturn]] void host_thread(SocketForwardRegionView::ShmConnectionView view,
-                              SocketConnectionInfo* conn) {
-  while (true) {
-    int guest_port{};
-    cvd::SharedFD socket{};
-    // TODO structured binding in C++17
-    std::tie(guest_port, socket) = WaitForConnection(conn);
-
-    LOG(INFO) << "Establishing connection to guest port " << guest_port
-              << " with connection_id: " << view.connection_id();
-    HandleConnection(view.EstablishConnection(guest_port), std::move(socket));
-    LOG(INFO) << "Connection to guest port " << guest_port
-              << " closed. Marking queue " << view.connection_id()
-              << " as free.";
-    MarkAsFree(conn);
-  }
-}
-
-bool TryAllocateConnection(SocketConnectionInfo* conn, int guest_port,
-                           cvd::SharedFD socket) {
-  bool success = false;
-  {
-    std::lock_guard<std::mutex> guard{conn->lock};
-    if (conn->state == QueueState::kFree) {
-      conn->socket = std::move(socket);
-      conn->guest_port = guest_port;
-      conn->state = QueueState::kUsed;
-      success = true;
-    }
-  }
-  if (success) {
-    conn->cv.notify_one();
-  }
-  return success;
-}
-
-void AllocateWorkers(cvd::SharedFD socket,
-                     SocketConnectionInfoCollection* socket_connection_info,
-                     int guest_port) {
-  while (true) {
-    for (auto& conn : *socket_connection_info) {
-      if (TryAllocateConnection(&conn, guest_port, socket)) {
-        return;
-      }
-    }
-    LOG(INFO) << "no queues available. sleeping and retrying";
-    sleep(5);
-  }
-}
-
-[[noreturn]] void host_impl(
-    SocketForwardRegionView* shm,
-    SocketConnectionInfoCollection* socket_connection_info,
-    std::vector<PortPair> ports, std::size_t index) {
-  // launch a worker for the following port before handling the current port.
-  // recursion (instead of a loop) removes the need fore any join() or having
-  // the main thread do no work.
-  if (index + 1 < ports.size()) {
-    std::thread(host_impl, shm, socket_connection_info, ports, index + 1)
-        .detach();
-  }
-  auto guest_port = ports[index].guest_port;
-  auto host_port = ports[index].host_port;
-  LOG(INFO) << "starting server on " << host_port << " for guest port "
-            << guest_port;
-  auto server = cvd::SharedFD::SocketLocalServer(host_port, SOCK_STREAM);
-  CHECK(server->IsOpen()) << "Could not start server on port " << host_port;
-  while (true) {
-    LOG(INFO) << "waiting for client connection";
-    auto client_socket = cvd::SharedFD::Accept(*server);
-    CHECK(client_socket->IsOpen()) << "error creating client socket";
-    LOG(INFO) << "client socket accepted";
-    AllocateWorkers(std::move(client_socket), socket_connection_info,
-                    guest_port);
-  }
-}
-
-[[noreturn]] void host(SocketForwardRegionView* shm,
-                       std::vector<PortPair> ports) {
-  CHECK(!ports.empty());
-
-  SocketConnectionInfoCollection socket_connection_info{};
-
-  auto conn_info_iter = std::begin(socket_connection_info);
-  for (auto& shm_connection_view : shm->AllConnections()) {
-    CHECK_NE(conn_info_iter, std::end(socket_connection_info));
-    std::thread(host_thread, std::move(shm_connection_view), &*conn_info_iter)
-        .detach();
-    ++conn_info_iter;
-  }
-  CHECK_EQ(conn_info_iter, std::end(socket_connection_info));
-  host_impl(shm, &socket_connection_info, ports, 0);
-}
-
-std::vector<PortPair> ParsePortsList(const std::string& guest_ports_str,
-                                     const std::string& host_ports_str) {
-  std::vector<PortPair> ports{};
-  auto guest_ports = cvd::StrSplit(guest_ports_str, ',');
-  auto host_ports = cvd::StrSplit(host_ports_str, ',');
-  CHECK(guest_ports.size() == host_ports.size());
-  for (std::size_t i = 0; i < guest_ports.size(); ++i) {
-    ports.push_back({std::stoi(guest_ports[i]), std::stoi(host_ports[i])});
-  }
-  return ports;
-}
-
-#else
-cvd::SharedFD OpenSocketConnection(int port) {
-  while (true) {
-    auto sock = cvd::SharedFD::SocketLocalClient(port, SOCK_STREAM);
-    if (sock->IsOpen()) {
-      return sock;
-    }
-    LOG(WARNING) << "could not connect on port " << port
-                 << ". sleeping for 1 second";
-    sleep(1);
-  }
-}
-
-[[noreturn]] void guest_thread(
-    SocketForwardRegionView::ShmConnectionView view) {
-  while (true) {
-    LOG(INFO) << "waiting for new connection";
-    auto shm_sender_and_receiver = view.WaitForNewConnection();
-    LOG(INFO) << "new connection for port " << view.port();
-    HandleConnection(std::move(shm_sender_and_receiver), OpenSocketConnection(view.port()));
-    LOG(INFO) << "connection closed on port " << view.port();
-  }
-}
-
-[[noreturn]] void guest(SocketForwardRegionView* shm) {
-  LOG(INFO) << "Starting guest mainloop";
-  auto connection_views = shm->AllConnections();
-  for (auto&& shm_connection_view : connection_views) {
-    std::thread(guest_thread, std::move(shm_connection_view)).detach();
-  }
-  while (true) {
-    sleep(std::numeric_limits<unsigned int>::max());
-  }
-}
-
-#endif
-
-SocketForwardRegionView* GetShm() {
-  auto shm = SocketForwardRegionView::GetInstance(
-#ifdef CUTTLEFISH_HOST
-      vsoc::GetDomain().c_str()
-#endif
-  );
-  if (!shm) {
-    LOG(FATAL) << "Could not open SHM. Aborting.";
-  }
-  shm->CleanUpPreviousConnections();
-  return shm;
-}
-
-// makes sure we're running as root on the guest, no-op on the host
-void assert_correct_user() {
-#ifndef CUTTLEFISH_HOST
-  CHECK_EQ(getuid(), 0u) << "must run as root!";
-#endif
-}
-
-}  // namespace
-
-int main(int argc, char* argv[]) {
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-  assert_correct_user();
-
-  auto shm = GetShm();
-  auto worker = shm->StartWorker();
-
-#ifdef CUTTLEFISH_HOST
-  CHECK(!FLAGS_guest_ports.empty()) << "Must specify --guest_ports flag";
-  CHECK(!FLAGS_host_ports.empty()) << "Must specify --host_ports flag";
-  host(shm, ParsePortsList(FLAGS_guest_ports, FLAGS_host_ports));
-#else
-  guest(shm);
-#endif
-}
diff --git a/common/frontend/socket_vsock_proxy/Android.bp b/common/frontend/socket_vsock_proxy/Android.bp
index 0a2f572..310244a 100644
--- a/common/frontend/socket_vsock_proxy/Android.bp
+++ b/common/frontend/socket_vsock_proxy/Android.bp
@@ -19,11 +19,9 @@
         "main.cpp",
     ],
     shared_libs: [
-        "cuttlefish_auto_resources",
         "libbase",
         "libcuttlefish_fs",
         "libcuttlefish_utils",
-        "libcuttlefish_strings",
         "liblog",
     ],
     static_libs: [
diff --git a/common/frontend/socket_vsock_proxy/main.cpp b/common/frontend/socket_vsock_proxy/main.cpp
index ac421a3..31cff0b 100644
--- a/common/frontend/socket_vsock_proxy/main.cpp
+++ b/common/frontend/socket_vsock_proxy/main.cpp
@@ -20,13 +20,103 @@
 #include <gflags/gflags.h>
 
 #include "common/libs/fs/shared_fd.h"
-#include "common/vsoc/lib/socket_forward_region_view.h"
 
 #ifdef CUTTLEFISH_HOST
 #include "host/libs/config/cuttlefish_config.h"
 #endif
 
-using vsoc::socket_forward::Packet;
+struct Header {
+  std::uint32_t payload_length;
+  enum MessageType : std::uint32_t {
+    DATA = 0,
+    BEGIN,
+    END,
+    RECV_CLOSED,  // indicate that this side's receive end is closed
+    RESTART,
+  };
+  MessageType message_type;
+};
+
+constexpr std::size_t kMaxPacketSize = 8192;
+constexpr std::size_t kMaxPayloadSize = kMaxPacketSize - sizeof(Header);
+
+struct Packet {
+ private:
+  Header header_;
+  using Payload = char[kMaxPayloadSize];
+  Payload payload_data_;
+
+  static constexpr Packet MakePacket(Header::MessageType type) {
+    Packet packet{};
+    packet.header_.message_type = type;
+    return packet;
+  }
+
+ public:
+  // port is only revelant on the host-side.
+  static Packet MakeBegin(std::uint16_t port);
+
+  static constexpr Packet MakeEnd() { return MakePacket(Header::END); }
+
+  static constexpr Packet MakeRecvClosed() {
+    return MakePacket(Header::RECV_CLOSED);
+  }
+
+  static constexpr Packet MakeRestart() { return MakePacket(Header::RESTART); }
+
+  // NOTE payload and payload_length must still be set.
+  static constexpr Packet MakeData() { return MakePacket(Header::DATA); }
+
+  bool empty() const { return IsData() && header_.payload_length == 0; }
+
+  void set_payload_length(std::uint32_t length) {
+    CHECK_LE(length, sizeof payload_data_);
+    header_.payload_length = length;
+  }
+
+  Payload& payload() { return payload_data_; }
+
+  const Payload& payload() const { return payload_data_; }
+
+  constexpr std::uint32_t payload_length() const {
+    return header_.payload_length;
+  }
+
+  constexpr bool IsBegin() const {
+    return header_.message_type == Header::BEGIN;
+  }
+
+  constexpr bool IsEnd() const { return header_.message_type == Header::END; }
+
+  constexpr bool IsData() const { return header_.message_type == Header::DATA; }
+
+  constexpr bool IsRecvClosed() const {
+    return header_.message_type == Header::RECV_CLOSED;
+  }
+
+  constexpr bool IsRestart() const {
+    return header_.message_type == Header::RESTART;
+  }
+
+  constexpr std::uint16_t port() const {
+    CHECK(IsBegin());
+    std::uint16_t port_number{};
+    CHECK_EQ(payload_length(), sizeof port_number);
+    std::memcpy(&port_number, payload(), sizeof port_number);
+    return port_number;
+  }
+
+  char* raw_data() { return reinterpret_cast<char*>(this); }
+
+  const char* raw_data() const { return reinterpret_cast<const char*>(this); }
+
+  constexpr size_t raw_data_length() const {
+    return payload_length() + sizeof header_;
+  }
+};
+
+static_assert(sizeof(Packet) == kMaxPacketSize, "");
+static_assert(std::is_pod<Packet>{}, "");
 
 DEFINE_uint32(tcp_port, 0, "TCP port (server on host, client on guest)");
 DEFINE_uint32(vsock_port, 0, "vsock port (client on host, server on guest");
diff --git a/common/libs/Android.bp b/common/libs/Android.bp
index e70e6ab..40b7f0c 100644
--- a/common/libs/Android.bp
+++ b/common/libs/Android.bp
@@ -14,7 +14,6 @@
 // limitations under the License.
 
 subdirs = [
-    "auto_resources",
     "device_config",
     "fs",
     "net",
diff --git a/common/libs/auto_resources/Android.bp b/common/libs/auto_resources/Android.bp
deleted file mode 100644
index f943211..0000000
--- a/common/libs/auto_resources/Android.bp
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// Copyright (C) 2017 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-cc_library {
-    name: "cuttlefish_auto_resources",
-    srcs: [
-        "auto_resources.cpp",
-    ],
-    defaults: ["cuttlefish_host_and_guest"],
-}
-
-cc_library_static {
-    name: "cuttlefish_auto_resources_product",
-    srcs: [
-        "auto_resources.cpp",
-    ],
-    defaults: ["cuttlefish_guest_product_only"],
-}
-
-cc_test_host {
-    name: "auto_free_buffer_test",
-    srcs: [
-        "auto_free_buffer_test.cpp",
-    ],
-    shared_libs: [
-        "cuttlefish_auto_resources",
-    ],
-    static_libs: [
-        "libgmock",
-    ],
-    defaults: ["cuttlefish_host_only"],
-    test_suites: ["general-tests"],
-}
diff --git a/common/libs/auto_resources/TEST_MAPPING b/common/libs/auto_resources/TEST_MAPPING
deleted file mode 100644
index 1e34e75..0000000
--- a/common/libs/auto_resources/TEST_MAPPING
+++ /dev/null
@@ -1,8 +0,0 @@
-{
-  "presubmit": [
-    {
-      "name": "auto_free_buffer_test",
-      "host": true
-    }
-  ]
-}
diff --git a/common/libs/auto_resources/auto_free_buffer_test.cpp b/common/libs/auto_resources/auto_free_buffer_test.cpp
deleted file mode 100644
index b1bbf34..0000000
--- a/common/libs/auto_resources/auto_free_buffer_test.cpp
+++ /dev/null
@@ -1,135 +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 "common/libs/auto_resources/auto_resources.h"
-
-#include <stdio.h>
-
-#include <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-using ::testing::StrEq;
-
-namespace test {
-static constexpr size_t kImmutableReserveSize =
-    AutoFreeBuffer::kAutoBufferShrinkReserveThreshold;
-
-class AutoFreeBufferTest : public ::testing::Test {
- public:
-  AutoFreeBufferTest() = default;
-  ~AutoFreeBufferTest() override = default;
-
-  void SetUp() override {}
-  void TearDown() override {}
-
- protected:
-  AutoFreeBuffer buffer_;
-};
-
-TEST_F(AutoFreeBufferTest, ShrinkingSmallReservationsDoesNotRealloc) {
-
-  buffer_.Reserve(kImmutableReserveSize);
-  const void* const data = buffer_.data();
-
-  EXPECT_EQ(0u, buffer_.size());
-  EXPECT_EQ(kImmutableReserveSize, buffer_.reserve_size());
-  EXPECT_NE(nullptr, data);
-
-  buffer_.Resize(kImmutableReserveSize);
-  EXPECT_EQ(kImmutableReserveSize, buffer_.size());
-  EXPECT_EQ(data, buffer_.data());
-
-  // Reduce size of buffer.
-  buffer_.Reserve(kImmutableReserveSize / 2);
-  EXPECT_EQ(kImmutableReserveSize, buffer_.reserve_size());
-  EXPECT_EQ(kImmutableReserveSize / 2, buffer_.size());
-  EXPECT_EQ(data, buffer_.data());
-
-  buffer_.Clear();
-
-  EXPECT_EQ(0u, buffer_.size());
-  EXPECT_EQ(kImmutableReserveSize, buffer_.reserve_size());
-  EXPECT_EQ(data, buffer_.data());
-}
-
-TEST_F(AutoFreeBufferTest, ShrinkingLargeReservationDoesRealloc) {
-  buffer_.Reserve(kImmutableReserveSize + 1);
-
-  EXPECT_EQ(0u, buffer_.size());
-  EXPECT_EQ(kImmutableReserveSize + 1, buffer_.reserve_size());
-
-  buffer_.Reserve(kImmutableReserveSize);
-
-  EXPECT_EQ(0u, buffer_.size());
-  EXPECT_EQ(kImmutableReserveSize, buffer_.reserve_size());
-  // Note: realloc may re-use current memory pointer, so testing data pointer
-  // makes no sense.
-}
-
-TEST_F(AutoFreeBufferTest, ResizeClearsMemory) {
-  constexpr char kTruncWords[] = "This string";
-  constexpr char kLastWords[] = "will be truncated to first two words.";
-  constexpr char kFullText[] =
-      "This string will be truncated to first two words.";
-  // Ignore padding \0.
-  constexpr size_t kTruncLength = sizeof(kTruncWords) - 1;
-
-  buffer_.SetToString(kFullText);
-
-  // Note: this call treats buffer as raw data, so no padding happens yet.
-  buffer_.Resize(kTruncLength);
-  EXPECT_THAT(buffer_.data(), StrEq(kFullText));
-
-  buffer_.Resize(kTruncLength + 1);
-  EXPECT_THAT(buffer_.data(), StrEq(kTruncWords));
-
-  // Note: we're accessing buffer out of size() bounds, but still within
-  // reserve_size() bounds.
-  // This confirms that only 1 byte of data has been appended.
-  EXPECT_THAT(&buffer_.data()[sizeof(kTruncWords)], StrEq(kLastWords));
-}
-
-TEST_F(AutoFreeBufferTest, PrintFTest) {
-  constexpr char kFormatString[] = "Printf %s %d %03d %02x Test.";
-  constexpr char kParam1[] = "string";
-  constexpr int kParam2 = 1234;
-  constexpr int kParam3 = 7;
-  constexpr int kParam4 = 0x42;
-
-  char temp_buffer[1024];
-  size_t vsize = snprintf(&temp_buffer[0], sizeof(temp_buffer),
-                          kFormatString, kParam1, kParam2, kParam3, kParam4);
-
-  // Test 1: no reservation => allocate buffer.
-  EXPECT_EQ(vsize,
-            buffer_.PrintF(kFormatString, kParam1, kParam2, kParam3, kParam4));
-  // Check for size + null termination.
-  EXPECT_EQ(vsize + 1, buffer_.size());
-  EXPECT_THAT(buffer_.data(), StrEq(temp_buffer));
-
-  size_t reservation = buffer_.reserve_size();
-
-  buffer_.Clear();
-
-  // Test 2: buffer reserved: just print and return.
-  EXPECT_EQ(vsize,
-            buffer_.PrintF(kFormatString, kParam1, kParam2, kParam3, kParam4));
-  // Check for size + null termination.
-  EXPECT_EQ(vsize + 1, buffer_.size());
-  EXPECT_THAT(buffer_.data(), StrEq(temp_buffer));
-  EXPECT_EQ(reservation, buffer_.reserve_size());
-}
-
-}  // namespace test
diff --git a/common/libs/auto_resources/auto_resources.cpp b/common/libs/auto_resources/auto_resources.cpp
deleted file mode 100644
index 3357b7e..0000000
--- a/common/libs/auto_resources/auto_resources.cpp
+++ /dev/null
@@ -1,121 +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 "common/libs/auto_resources/auto_resources.h"
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-bool AutoCloseFILE::CopyFrom(const AutoCloseFILE& in) {
-  char buffer[8192];
-  while (!in.IsEOF()) {
-    size_t num_read = fread(buffer, 1, sizeof(buffer), in);
-    if (!num_read) {
-      if (in.IsEOF()) {
-        return true;
-      }
-      printf("%s: unable to fread %s:%d (%s)\n",
-             __FUNCTION__, __FILE__, __LINE__, strerror(errno));
-      return false;
-    }
-    size_t num_written = fwrite(buffer, 1, num_read, *this);
-    if (num_written != num_read) {
-      printf("%s: unable to fwrite, %zu != %zu %s:%d (%s)\n",
-             __FUNCTION__, num_read, num_written, __FILE__, __LINE__,
-             strerror(errno));
-      return false;
-    }
-  }
-  return true;
-}
-
-AutoFreeBuffer::~AutoFreeBuffer() {
-  if (data_) free(data_);
-}
-
-void AutoFreeBuffer::Clear() {
-  size_ = 0;
-}
-
-bool AutoFreeBuffer::Reserve(size_t newsize) {
-  if (newsize > reserve_size_ ||
-      reserve_size_ > kAutoBufferShrinkReserveThreshold) {
-    char* newdata = static_cast<char*>(realloc(data_, newsize));
-    // If realloc fails, everything remains unchanged.
-    if (!newdata && newsize) return false;
-
-    reserve_size_ = newsize;
-    data_ = newdata;
-  }
-  if (size_ > newsize) size_ = newsize;
-  return true;
-}
-
-bool AutoFreeBuffer::Resize(size_t newsize) {
-  // If reservation is small, and we get a shrink request, simply reduce size_.
-  if (reserve_size_ < kAutoBufferShrinkReserveThreshold && newsize < size_) {
-    size_ = newsize;
-    return true;
-  }
-
-  if (!Reserve(newsize)) return false;
-
-  // Should we keep this? Sounds like it should be called Grow().
-  if (newsize > size_) memset(&data_[size_], 0, newsize - size_);
-  size_ = newsize;
-  return true;
-}
-
-bool AutoFreeBuffer::SetToString(const char* in) {
-  size_t newsz = strlen(in) + 1;
-  if (!Resize(newsz)) return false;
-  memcpy(data_, in, newsz);
-  return true;
-}
-
-bool AutoFreeBuffer::Append(const void* new_data, size_t new_data_size) {
-  size_t offset = size_;
-  if (!Resize(offset + new_data_size)) return false;
-  memcpy(&data_[offset], new_data, new_data_size);
-  return true;
-}
-
-size_t AutoFreeBuffer::PrintF(const char* format, ... ) {
-  va_list args;
-
-  // Optimize: Use whatever reservation left we have for initial printf.
-  // If reservation is not long enough, resize and try again.
-
-  va_start(args, format);
-  size_t printf_size = vsnprintf(data_, reserve_size_, format, args);
-  va_end(args);
-
-  // vsnprintf write no more than |reserve_size_| bytes including trailing \0.
-  // Result value equal or greater than |reserve_size_| signals truncated
-  // output.
-  if (printf_size < reserve_size_) {
-    size_ = printf_size + 1;
-    return printf_size;
-  }
-
-  // Grow buffer and re-try printf.
-  if (!Resize(printf_size + 1)) return 0;
-  va_start(args, format);
-  vsprintf(data_, format, args);
-  va_end(args);
-  return printf_size;
-}
-
diff --git a/common/libs/auto_resources/auto_resources.h b/common/libs/auto_resources/auto_resources.h
deleted file mode 100644
index 43cb6dc..0000000
--- a/common/libs/auto_resources/auto_resources.h
+++ /dev/null
@@ -1,223 +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 CUTTLEFISH_COMMON_COMMON_LIBS_AUTO_RESOURCES_AUTO_RESOURCES_H_
-#define CUTTLEFISH_COMMON_COMMON_LIBS_AUTO_RESOURCES_AUTO_RESOURCES_H_
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <pthread.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-template <typename T, size_t N>
-char (&ArraySizeHelper(T (&array)[N]))[N];
-
-template <typename T, size_t N>
-char (&ArraySizeHelper(const T (&array)[N]))[N];
-
-#define arraysize(array) (sizeof(ArraySizeHelper(array)))
-
-// Automatically close a file descriptor
-class AutoCloseFILE {
- public:
-  explicit AutoCloseFILE(FILE *f) : f_(f) { }
-  virtual ~AutoCloseFILE() {
-    if (f_) {
-      (void)::fclose(f_);
-      f_ = NULL;
-    }
-  }
-
-  operator FILE*() const {
-    return f_;
-  }
-
-  bool CopyFrom(const AutoCloseFILE& in);
-
-  bool IsError() const {
-    return f_ == NULL;
-  }
-
-  bool IsEOF() const {
-    return IsError() || feof(f_);
-  }
-
-  bool IsOpen() const {
-    return f_ != NULL;
-  }
-
-  // Close the underlying file descriptor, returning a status to give the caller
-  // the chance to act on failure to close.
-  // Returns true on success.
-  bool close() {
-    bool rval = true;
-    if (f_) {
-      rval = !::fclose(f_);
-      f_ = NULL;
-    }
-    return rval;
-  }
-
- private:
-  AutoCloseFILE& operator=(const AutoCloseFILE & o);
-  explicit AutoCloseFILE(const AutoCloseFILE &);
-
-  FILE* f_;
-};
-
-// Automatically close a file descriptor
-class AutoCloseFileDescriptor {
- public:
-  explicit AutoCloseFileDescriptor(int fd) : fd_(fd) { }
-  virtual ~AutoCloseFileDescriptor() {
-    if (fd_ != -1) {
-      (void)::close(fd_);
-      fd_ = -1;
-    }
-  }
-
-  operator int() const {
-    return fd_;
-  }
-
-  bool IsError() const {
-    return fd_ == -1;
-  }
-
-  // Close the underlying file descriptor, returning a status to give the caller
-  // the chance to act on failure to close.
-  // Returns true on success.
-  bool close() {
-    bool rval = true;
-    if (fd_ != -1) {
-      rval = !::close(fd_);
-      fd_ = -1;
-    }
-    return rval;
-  }
-
- private:
-  AutoCloseFileDescriptor& operator=(const AutoCloseFileDescriptor & o);
-  explicit AutoCloseFileDescriptor(const AutoCloseFileDescriptor &);
-
-  int fd_;
-};
-
-// In C++11 this is just std::vector<char>, but Android isn't
-// there yet.
-class AutoFreeBuffer {
- public:
-  enum {
-    // Minimum reserve size of AutoFreeBuffer to consider shrinking reservation.
-    // Any buffer shorter than this will not be shrunk.
-    kAutoBufferShrinkReserveThreshold = 8192
-  };
-
-  AutoFreeBuffer()
-      : data_(NULL), size_(0), reserve_size_(0) {}
-
-  AutoFreeBuffer(size_t reserve_size)
-      : data_(NULL), size_(0), reserve_size_(0) {
-    Reserve(reserve_size);
-  }
-
-  ~AutoFreeBuffer();
-  void Clear();
-  bool Resize(size_t newsize);
-  bool Reserve(size_t newsize);
-  bool SetToString(const char* in);
-  bool Append(const void* new_data, size_t new_data_size);
-  size_t PrintF(const char* format, ... );
-
-  char* data() {
-    return data_;
-  }
-
-  const char* data() const {
-    return data_;
-  }
-
-  char* begin() {
-    return data_;
-  }
-
-  const char* begin() const {
-    return data_;
-  }
-
-  char* end() {
-    return data_ + size_;
-  }
-
-  const char* end() const {
-    return data_ + size_;
-  }
-
-  size_t size() const {
-    return size_;
-  }
-
-  size_t reserve_size() const {
-    return reserve_size_;
-  }
-
-  void Swap(AutoFreeBuffer& other) {
-    char* temp_ptr = data_;
-    data_ = other.data_;
-    other.data_ = temp_ptr;
-
-    size_t temp_size = size_;
-    size_ = other.size_;
-    other.size_ = temp_size;
-
-    temp_size = reserve_size_;
-    reserve_size_ = other.reserve_size_;
-    other.reserve_size_ = temp_size;
-  }
-
-  bool operator==(const AutoFreeBuffer& other) const {
-    return (size_ == other.size_) && !memcmp(data_, other.data_, size_);
-  }
-
-  bool operator!=(const AutoFreeBuffer& other) const {
-    return !(*this == other);
-  }
-
- protected:
-  char *data_;
-  size_t size_;
-  size_t reserve_size_;
-
- private:
-  AutoFreeBuffer& operator=(const AutoFreeBuffer&);
-  explicit AutoFreeBuffer(const AutoFreeBuffer&);
-};
-
-class AutoUMask {
- public:
-  explicit AutoUMask(mode_t mask) {
-      prev_umask = umask(mask);
-  }
-
-  ~AutoUMask() {
-    umask(prev_umask);
-  }
- private:
-  mode_t prev_umask;
-};
-#endif  // CUTTLEFISH_COMMON_COMMON_LIBS_AUTO_RESOURCES_AUTO_RESOURCES_H_
diff --git a/common/libs/device_config/Android.bp b/common/libs/device_config/Android.bp
index 36c8ddb..4900d35 100644
--- a/common/libs/device_config/Android.bp
+++ b/common/libs/device_config/Android.bp
@@ -25,7 +25,6 @@
         "libbase",
         "liblog",
         "libcuttlefish_fs",
-        "cuttlefish_auto_resources",
         "libcuttlefish_utils",
     ],
     target: {
diff --git a/common/libs/device_config/device_config.cpp b/common/libs/device_config/device_config.cpp
index faed36e..69c489f 100644
--- a/common/libs/device_config/device_config.cpp
+++ b/common/libs/device_config/device_config.cpp
@@ -16,8 +16,6 @@
 
 #include "device_config.h"
 
-#include <stdio.h>
-
 #include <sstream>
 #include <type_traits>
 
diff --git a/common/libs/device_config/guest_device_config.cpp b/common/libs/device_config/guest_device_config.cpp
index 90d2528..d5558b9 100644
--- a/common/libs/device_config/guest_device_config.cpp
+++ b/common/libs/device_config/guest_device_config.cpp
@@ -14,16 +14,21 @@
  * limitations under the License.
  */
 
+#include "device_config.h"
+
+#include <chrono>
+#include <thread>
+
 #include <cutils/properties.h>
 #include <glog/logging.h>
 
-#include "device_config.h"
-
 namespace cvd {
 
 namespace {
 
 static constexpr auto kDataSize = sizeof(DeviceConfig::RawData);
+static constexpr int kRetries = 5;
+static constexpr int kRetryDelaySeconds = 5;
 
 bool GetRawFromServer(DeviceConfig::RawData* data) {
   auto port_property = "ro.boot.cuttlefish_config_server_port";
@@ -63,9 +68,18 @@
 
 std::unique_ptr<DeviceConfig> DeviceConfig::Get() {
   DeviceConfig::RawData data;
-  if (!GetRawFromServer(&data)) return nullptr;
 
-  return std::unique_ptr<DeviceConfig>(new DeviceConfig(data));
+  int attempts_remaining = 1 + kRetries;
+  while (attempts_remaining > 0) {
+    if (GetRawFromServer(&data)) {
+      return std::unique_ptr<DeviceConfig>(new DeviceConfig(data));
+    }
+
+    std::this_thread::sleep_for(std::chrono::seconds(kRetryDelaySeconds));
+
+    --attempts_remaining;
+  }
+  return nullptr;
 }
 
 DeviceConfig::DeviceConfig(const DeviceConfig::RawData& data) : data_(data) {
diff --git a/common/libs/fs/Android.bp b/common/libs/fs/Android.bp
index 1824caf..9f5d55e 100644
--- a/common/libs/fs/Android.bp
+++ b/common/libs/fs/Android.bp
@@ -21,14 +21,12 @@
     ],
     shared: {
         shared_libs: [
-            "cuttlefish_auto_resources",
             "libbase",
             "liblog",
         ],
     },
     static: {
         static_libs: [
-            "cuttlefish_auto_resources",
             "libbase",
             "liblog",
         ],
@@ -45,9 +43,6 @@
 
 cc_library_static {
     name: "libcuttlefish_fs_product",
-    static_libs: [
-        "cuttlefish_auto_resources_product",
-    ],
     srcs: [
         "shared_buf.cc",
         "shared_fd.cpp",
@@ -67,7 +62,6 @@
     ],
     header_libs: ["cuttlefish_glog"],
     shared_libs: [
-        "cuttlefish_auto_resources",
         "libcuttlefish_fs",
         "libbase",
     ],
diff --git a/common/libs/fs/shared_fd.cpp b/common/libs/fs/shared_fd.cpp
index dde0604..2f6d100 100644
--- a/common/libs/fs/shared_fd.cpp
+++ b/common/libs/fs/shared_fd.cpp
@@ -23,8 +23,8 @@
 #include <netinet/in.h>
 #include <unistd.h>
 #include <algorithm>
+#include <vector>
 
-#include "common/libs/auto_resources/auto_resources.h"
 #include "common/libs/glog/logging.h"
 #include "common/libs/fs/shared_select.h"
 
@@ -57,8 +57,7 @@
 namespace cvd {
 
 bool FileInstance::CopyFrom(FileInstance& in) {
-  AutoFreeBuffer buffer;
-  buffer.Resize(8192);
+  std::vector<char> buffer(8192);
   while (true) {
     ssize_t num_read = in.Read(buffer.data(), buffer.size());
     if (!num_read) {
@@ -78,8 +77,7 @@
 }
 
 bool FileInstance::CopyFrom(FileInstance& in, size_t length) {
-  AutoFreeBuffer buffer;
-  buffer.Resize(8192);
+  std::vector<char> buffer(8192);
   while (length > 0) {
     ssize_t num_read = in.Read(buffer.data(), std::min(buffer.size(), length));
     length -= num_read;
@@ -95,30 +93,34 @@
 }
 
 void FileInstance::Close() {
-  AutoFreeBuffer message;
+  std::stringstream message;
   if (fd_ == -1) {
     errno_ = EBADF;
   } else if (close(fd_) == -1) {
     errno_ = errno;
     if (identity_.size()) {
-      message.PrintF("%s: %s failed (%s)", __FUNCTION__, identity_.data(),
-                     StrError());
-      Log(message.data());
+      message << __FUNCTION__ << ": " << identity_ << " failed (" << StrError() << ")";
+      std::string message_str = message.str();
+      Log(message_str.c_str());
     }
   } else {
     if (identity_.size()) {
-      message.PrintF("%s: %s succeeded", __FUNCTION__, identity_.data());
-      Log(message.data());
+      message << __FUNCTION__ << ": " << identity_ << "succeeded";
+      std::string message_str = message.str();
+      Log(message_str.c_str());
     }
   }
   fd_ = -1;
 }
 
 void FileInstance::Identify(const char* identity) {
-  identity_.PrintF("fd=%d @%p is %s", fd_, this, identity);
-  AutoFreeBuffer message;
-  message.PrintF("%s: %s", __FUNCTION__, identity_.data());
-  Log(message.data());
+  std::stringstream identity_stream;
+  identity_stream << "fd=" << fd_ << " @" << this << " is " << identity;
+  identity_ = identity_stream.str();
+  std::stringstream message;
+  message << __FUNCTION__ << ": " << identity_;
+  std::string message_str = message.str();
+  Log(message_str.c_str());
 }
 
 bool FileInstance::IsSet(fd_set* in) const {
@@ -228,8 +230,9 @@
 }
 
 SharedFD SharedFD::Dup(int unmanaged_fd) {
-  int fd = dup(unmanaged_fd);
-  return SharedFD(std::shared_ptr<FileInstance>(new FileInstance(fd, errno)));
+  int fd = fcntl(unmanaged_fd, F_DUPFD_CLOEXEC, 3);
+  int error_num = errno;
+  return SharedFD(std::shared_ptr<FileInstance>(new FileInstance(fd, error_num)));
 }
 
 bool SharedFD::Pipe(SharedFD* fd0, SharedFD* fd1) {
@@ -418,6 +421,10 @@
   return vsock;
 }
 
+SharedFD SharedFD::VsockServer(int type) {
+  return VsockServer(VMADDR_PORT_ANY, type);
+}
+
 SharedFD SharedFD::VsockClient(unsigned int cid, unsigned int port, int type) {
   auto vsock = cvd::SharedFD::Socket(AF_VSOCK, type, 0);
   if (!vsock->IsOpen()) {
diff --git a/common/libs/fs/shared_fd.h b/common/libs/fs/shared_fd.h
index b811f4a..eec17b1 100644
--- a/common/libs/fs/shared_fd.h
+++ b/common/libs/fs/shared_fd.h
@@ -33,13 +33,13 @@
 #include <sys/un.h>
 
 #include <memory>
+#include <sstream>
 
 #include <errno.h>
 #include <fcntl.h>
 #include <string.h>
 #include <unistd.h>
 
-#include "common/libs/auto_resources/auto_resources.h"
 #include "vm_sockets.h"
 
 /**
@@ -157,6 +157,7 @@
   static SharedFD SocketSeqPacketServer(const char* name, mode_t mode);
   static SharedFD SocketSeqPacketClient(const char* name);
   static SharedFD VsockServer(unsigned int port, int type);
+  static SharedFD VsockServer(int type);
   static SharedFD VsockClient(unsigned int cid, unsigned int port, int type);
   static SharedFD TimerFD(int clock, int flags);
 
@@ -292,6 +293,22 @@
     return rval;
   }
 
+  int GetSockName(struct sockaddr* addr, socklen_t* addrlen) {
+    errno = 0;
+    int rval = TEMP_FAILURE_RETRY(getsockname(fd_, addr, addrlen));
+    if (rval == -1) {
+      errno_ = errno;
+    }
+    return rval;
+  }
+
+  unsigned int VsockServerPort() {
+    struct sockaddr_vm vm_socket;
+    socklen_t length = sizeof(vm_socket);
+    GetSockName(reinterpret_cast<struct sockaddr*>(&vm_socket), &length);
+    return vm_socket.svm_port;
+  }
+
   void Identify(const char* identity);
 
   int Ioctl(int request, void* val = nullptr) {
@@ -515,7 +532,9 @@
     // Ensure every file descriptor managed by a FileInstance has the CLOEXEC
     // flag
     TEMP_FAILURE_RETRY(fcntl(fd, F_SETFD, FD_CLOEXEC));
-    identity_.PrintF("fd=%d @%p", fd, this);
+    std::stringstream identity;
+    identity << "fd=" << fd << " @" << this;
+    identity_ = identity.str();
   }
 
   FileInstance* Accept(struct sockaddr* addr, socklen_t* addrlen) const {
@@ -529,7 +548,7 @@
 
   int fd_;
   int errno_;
-  AutoFreeBuffer identity_;
+  std::string identity_;
   char strerror_buf_[160];
 };
 
diff --git a/common/libs/net/Android.bp b/common/libs/net/Android.bp
index ea53f71..ba7bbd3 100644
--- a/common/libs/net/Android.bp
+++ b/common/libs/net/Android.bp
@@ -21,7 +21,6 @@
     ],
     shared_libs: [
         "libcuttlefish_fs",
-        "cuttlefish_auto_resources",
         "libbase",
     ],
     defaults: ["cuttlefish_host_and_guest"],
@@ -36,7 +35,6 @@
     shared_libs: [
         "libcuttlefish_fs",
         "cuttlefish_net",
-        "cuttlefish_auto_resources",
         "libbase",
     ],
     static_libs: [
diff --git a/common/libs/net/netlink_request.cpp b/common/libs/net/netlink_request.cpp
index 28690a4..501b2c3 100644
--- a/common/libs/net/netlink_request.cpp
+++ b/common/libs/net/netlink_request.cpp
@@ -20,6 +20,7 @@
 #include <net/if.h>
 #include <string.h>
 
+#include <algorithm>
 #include <string>
 #include <vector>
 
@@ -35,21 +36,16 @@
 }
 
 void* NetlinkRequest::AppendRaw(const void* data, size_t length) {
-  void* out = request_.end();
-
-  request_.Append(data, length);
-  int pad = RTA_ALIGN(length) - length;
-  if (pad > 0) {
-    request_.Resize(request_.size() + pad);
-  }
-
-  return out;
+  auto* output = static_cast<char*>(ReserveRaw(length));
+  const auto* input = static_cast<const char*>(data);
+  std::copy(input, input + length, output);
+  return output;
 }
 
 void* NetlinkRequest::ReserveRaw(size_t length) {
-  void* out = request_.end();
-  request_.Resize(request_.size() + RTA_ALIGN(length));
-  return out;
+  size_t original_size = request_.size();
+  request_.resize(original_size + RTA_ALIGN(length), '\0');
+  return reinterpret_cast<void*>(request_.data() + original_size);
 }
 
 nlattr* NetlinkRequest::AppendTag(
@@ -61,9 +57,9 @@
   return attr;
 }
 
-NetlinkRequest::NetlinkRequest(int32_t command, int32_t flags)
-    : request_(512),
-      header_(Reserve<nlmsghdr>()) {
+NetlinkRequest::NetlinkRequest(int32_t command, int32_t flags) {
+  request_.reserve(512);
+  header_ = Reserve<nlmsghdr>();
   flags |= NLM_F_ACK | NLM_F_REQUEST;
   header_->nlmsg_flags = flags;
   header_->nlmsg_type = command;
@@ -75,7 +71,7 @@
   using std::swap;
   swap(lists_, other.lists_);
   swap(header_, other.header_);
-  request_.Swap(other.request_);
+  swap(request_, other.request_);
 }
 
 void NetlinkRequest::AddString(uint16_t type, const std::string& value) {
diff --git a/common/libs/net/netlink_request.h b/common/libs/net/netlink_request.h
index e0f8753..5e5b355 100644
--- a/common/libs/net/netlink_request.h
+++ b/common/libs/net/netlink_request.h
@@ -23,8 +23,6 @@
 #include <string>
 #include <vector>
 
-#include "common/libs/auto_resources/auto_resources.h"
-
 namespace cvd {
 // Abstraction of Network link request.
 // Used to supply kernel with information about which interface needs to be
@@ -100,7 +98,7 @@
   nlattr* AppendTag(uint16_t type, const void* data, uint16_t length);
 
   std::vector<std::pair<nlattr*, int32_t>> lists_;
-  AutoFreeBuffer request_;
+  std::vector<char> request_;
   nlmsghdr* header_;
 
   NetlinkRequest(const NetlinkRequest&) = delete;
diff --git a/common/libs/strings/Android.bp b/common/libs/strings/Android.bp
deleted file mode 100644
index fcc6784..0000000
--- a/common/libs/strings/Android.bp
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// Copyright (C) 2018 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.
-
-cc_library {
-    name: "libcuttlefish_strings",
-    srcs: [
-        "str_split.cpp",
-    ],
-    shared: {
-        shared_libs: [
-            "libbase",
-        ],
-    },
-    static: {
-        static_libs: [
-            "libbase",
-        ],
-    },
-    defaults: ["cuttlefish_host_and_guest"],
-}
diff --git a/common/libs/strings/str_split.cpp b/common/libs/strings/str_split.cpp
deleted file mode 100644
index d76acad..0000000
--- a/common/libs/strings/str_split.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2018 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 "common/libs/strings/str_split.h"
-
-#include <vector>
-#include <string>
-#include <sstream>
-
-std::vector<std::string> cvd::StrSplit(const std::string& src, char delimiter) {
-  std::istringstream stream{src};
-  std::vector<std::string> result;
-  for (std::string s; std::getline(stream, s, delimiter); s.clear()) {
-    result.push_back(std::move(s));
-  }
-  return result;
-}
diff --git a/common/libs/strings/str_split.h b/common/libs/strings/str_split.h
deleted file mode 100644
index cd18d15..0000000
--- a/common/libs/strings/str_split.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2018 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 CUTTLEFISH_COMMON_COMMON_LIBS_STRINGS_STR_SPLIT_H_
-#define CUTTLEFISH_COMMON_COMMON_LIBS_STRINGS_STR_SPLIT_H_
-
-#include <vector>
-#include <string>
-
-namespace cvd {
-std::vector<std::string> StrSplit(const std::string& src, char delimiter);
-}  // namespace cvd
-
-#endif
diff --git a/common/libs/tcp_socket/Android.bp b/common/libs/tcp_socket/Android.bp
index d60ccb2..c5f9550 100644
--- a/common/libs/tcp_socket/Android.bp
+++ b/common/libs/tcp_socket/Android.bp
@@ -19,7 +19,6 @@
         "tcp_socket.cpp",
     ],
     shared_libs: [
-        "cuttlefish_auto_resources",
         "libbase",
         "libcuttlefish_fs",
         "liblog",
diff --git a/common/libs/utils/Android.bp b/common/libs/utils/Android.bp
index 1bd252d..7330315 100644
--- a/common/libs/utils/Android.bp
+++ b/common/libs/utils/Android.bp
@@ -31,16 +31,12 @@
         shared_libs: [
             "libbase",
             "libcuttlefish_fs",
-            "libcuttlefish_strings",
-            "cuttlefish_auto_resources",
         ],
     },
     static: {
         static_libs: [
             "libbase",
             "libcuttlefish_fs",
-            "libcuttlefish_strings",
-            "cuttlefish_auto_resources",
         ],
     },
     defaults: ["cuttlefish_host_and_guest"],
diff --git a/common/libs/utils/archive.cpp b/common/libs/utils/archive.cpp
index a22db4f..c1c496d 100644
--- a/common/libs/utils/archive.cpp
+++ b/common/libs/utils/archive.cpp
@@ -19,9 +19,9 @@
 #include <string>
 #include <vector>
 
+#include <android-base/strings.h>
 #include <glog/logging.h>
 
-#include "common/libs/strings/str_split.h"
 #include "common/libs/utils/subprocess.h"
 
 namespace cvd {
@@ -43,7 +43,7 @@
     LOG(ERROR) << "`bsdtar -tf \"" << file << "\"` returned " << bsdtar_ret;
   }
   return bsdtar_ret == 0
-      ? cvd::StrSplit(bsdtar_output, '\n')
+      ? android::base::Split(bsdtar_output, "\n")
       : std::vector<std::string>();
 }
 
diff --git a/common/libs/utils/subprocess.cpp b/common/libs/utils/subprocess.cpp
index d3ebf1d..e83b487 100644
--- a/common/libs/utils/subprocess.cpp
+++ b/common/libs/utils/subprocess.cpp
@@ -99,6 +99,12 @@
         LOG(ERROR) << "setpgid failed (" << strerror(error) << ")";
       }
     }
+    for (const auto& entry : inherited_fds) {
+      if (fcntl(entry.second, F_SETFD, 0)) {
+        int error_num = errno;
+        LOG(ERROR) << "fcntl failed: " << strerror(error_num);
+      }
+    }
     int rval;
     // If envp is NULL, the current process's environment is used as the
     // environment of the child process. To force an empty emvironment for
@@ -248,8 +254,9 @@
   if (inherited_fds_.count(shared_fd)) {
     fd = inherited_fds_[shared_fd];
   } else {
-    fd = shared_fd->UNMANAGED_Dup();
+    fd = shared_fd->Fcntl(F_DUPFD_CLOEXEC, 3);
     if (fd < 0) {
+      LOG(ERROR) << "Could not acquire a new file descriptor: " << shared_fd->StrError();
       return false;
     }
     inherited_fds_[shared_fd] = fd;
@@ -268,8 +275,9 @@
                << static_cast<int>(channel);
     return false;
   }
-  auto dup_fd = shared_fd->UNMANAGED_Dup();
+  auto dup_fd = shared_fd->Fcntl(F_DUPFD_CLOEXEC, 3);
   if (dup_fd < 0) {
+    LOG(ERROR) << "Could not acquire a new file descriptor: " << shared_fd->StrError();
     return false;
   }
   redirects_[channel] = dup_fd;
diff --git a/common/vsoc/lib/audio_data_layout.cpp b/common/vsoc/lib/audio_data_layout.cpp
deleted file mode 100644
index 4b5172c..0000000
--- a/common/vsoc/lib/audio_data_layout.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Define some of the string constants associated with the region layout.
-#include "common/vsoc/shm/audio_data_layout.h"
-
-namespace vsoc {
-namespace layout {
-namespace audio_data {
-
-// static
-const char *const AudioDataLayout::region_name = "audio_data";
-
-}  // namespace audio_data
-}  // namespace layout
-}  // namespace vsoc
-
diff --git a/common/vsoc/lib/audio_data_region_view.h b/common/vsoc/lib/audio_data_region_view.h
deleted file mode 100644
index 42d05df..0000000
--- a/common/vsoc/lib/audio_data_region_view.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2018 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 <memory>
-
-#include <android-base/macros.h>
-
-#include "common/vsoc/lib/typed_region_view.h"
-#include "common/vsoc/shm/audio_data_layout.h"
-
-namespace vsoc {
-namespace audio_data {
-
-class AudioDataRegionView
-    : public vsoc::TypedRegionView<
-        AudioDataRegionView,
-        vsoc::layout::audio_data::AudioDataLayout> {
-public:
-    AudioDataRegionView() = default;
-    AudioDataRegionView(const AudioDataRegionView &) = delete;
-    AudioDataRegionView &operator=(const AudioDataRegionView &) = delete;
-};
-
-}  // namespace audio_data
-}  // namespace vsoc
diff --git a/common/vsoc/lib/circqueue_impl.h b/common/vsoc/lib/circqueue_impl.h
deleted file mode 100644
index 8b0fa90..0000000
--- a/common/vsoc/lib/circqueue_impl.h
+++ /dev/null
@@ -1,234 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <cerrno>
-#include <cstring>
-
-#include <sys/uio.h>
-
-#include "common/vsoc/lib/region_signaling_interface.h"
-#include "common/vsoc/shm/circqueue.h"
-
-// Increases the given index until it is naturally aligned for T.
-template <typename T>
-uintptr_t align(uintptr_t index) {
-  return (index + sizeof(T) - 1) & ~(sizeof(T) - 1);
-}
-
-namespace vsoc {
-class RegionSignalingInterface;
-namespace layout {
-
-template <uint32_t SizeLog2>
-void CircularQueueBase<SizeLog2>::CopyInRange(const char* buffer_in,
-                                              const Range& t) {
-  size_t bytes = t.end_idx - t.start_idx;
-  uint32_t index = t.start_idx & (BufferSize - 1);
-  if (index + bytes <= BufferSize) {
-    std::memcpy(buffer_ + index, buffer_in, bytes);
-  } else {
-    size_t part1_size = BufferSize - index;
-    size_t part2_size = bytes - part1_size;
-    std::memcpy(buffer_ + index, buffer_in, part1_size);
-    std::memcpy(buffer_, buffer_in + part1_size, part2_size);
-  }
-}
-
-template <uint32_t SizeLog2>
-void CircularQueueBase<SizeLog2>::CopyOutRange(const Range& t,
-                                               char* buffer_out) {
-  uint32_t index = t.start_idx & (BufferSize - 1);
-  size_t total_size = t.end_idx - t.start_idx;
-  if (index + total_size <= BufferSize) {
-    std::memcpy(buffer_out, buffer_ + index, total_size);
-  } else {
-    uint32_t part1_size = BufferSize - index;
-    uint32_t part2_size = total_size - part1_size;
-    std::memcpy(buffer_out, buffer_ + index, part1_size);
-    std::memcpy(buffer_out + part1_size, buffer_, part2_size);
-  }
-}
-
-template <uint32_t SizeLog2>
-void CircularQueueBase<SizeLog2>::WaitForDataLocked(
-    RegionSignalingInterface* r) {
-  while (1) {
-    uint32_t o_w_pub = w_pub_;
-    // We don't have data. Wait until some appears and try again
-    if (r_released_ != o_w_pub) {
-      return;
-    }
-    lock_.Unlock();
-    r->WaitForSignal(&w_pub_, o_w_pub);
-    lock_.Lock();
-  }
-}
-
-template <uint32_t SizeLog2>
-intptr_t CircularQueueBase<SizeLog2>::WriteReserveLocked(
-    RegionSignalingInterface* r, size_t bytes, Range* t, bool non_blocking) {
-  // Can't write more than the buffer will hold
-  if (bytes > BufferSize) {
-    return -ENOSPC;
-  }
-  while (true) {
-    uint32_t o_w_pub = w_pub_;
-    uint32_t o_r_release = r_released_;
-    uint32_t bytes_in_use = o_w_pub - o_r_release;
-    size_t available = BufferSize - bytes_in_use;
-    if (available >= bytes) {
-      t->start_idx = o_w_pub;
-      t->end_idx = o_w_pub + bytes;
-      break;
-    }
-    if (non_blocking) {
-      return -EWOULDBLOCK;
-    }
-    // If we can't write at the moment wait for a reader to release
-    // some bytes.
-    lock_.Unlock();
-    r->WaitForSignal(&r_released_, o_r_release);
-    lock_.Lock();
-  }
-  return t->end_idx - t->start_idx;
-}
-
-template <uint32_t SizeLog2>
-intptr_t CircularByteQueue<SizeLog2>::Read(RegionSignalingInterface* r,
-                                           char* buffer_out, size_t max_size) {
-  this->lock_.Lock();
-  this->WaitForDataLocked(r);
-  Range t;
-  t.start_idx = this->r_released_;
-  t.end_idx = this->w_pub_;
-  // The lock is still held here...
-  // Trim the range if we got more than the reader wanted
-  if ((t.end_idx - t.start_idx) > max_size) {
-    t.end_idx = t.start_idx + max_size;
-  }
-  this->CopyOutRange(t, buffer_out);
-  this->r_released_ = t.end_idx;
-  this->lock_.Unlock();
-  r->SendSignal(layout::Sides::Both, &this->r_released_);
-  return t.end_idx - t.start_idx;
-}
-
-template <uint32_t SizeLog2>
-intptr_t CircularByteQueue<SizeLog2>::Write(RegionSignalingInterface* r,
-                                            const char* buffer_in, size_t bytes,
-                                            bool non_blocking) {
-  Range range;
-  this->lock_.Lock();
-  intptr_t rval = this->WriteReserveLocked(r, bytes, &range, non_blocking);
-  if (rval < 0) {
-    this->lock_.Unlock();
-    return rval;
-  }
-  this->CopyInRange(buffer_in, range);
-  // We can't publish until all of the previous write allocations where
-  // published.
-  this->w_pub_ = range.end_idx;
-  this->lock_.Unlock();
-  r->SendSignal(layout::Sides::Both, &this->w_pub_);
-  return bytes;
-}
-
-template <uint32_t SizeLog2, uint32_t MaxPacketSize>
-intptr_t CircularPacketQueue<SizeLog2, MaxPacketSize>::CalculateBufferedSize(
-    size_t payload) {
-  return align<uint32_t>(sizeof(uint32_t) + payload);
-}
-
-template <uint32_t SizeLog2, uint32_t MaxPacketSize>
-intptr_t CircularPacketQueue<SizeLog2, MaxPacketSize>::Read(
-    RegionSignalingInterface* r, char* buffer_out, size_t max_size) {
-  this->lock_.Lock();
-  this->WaitForDataLocked(r);
-  uint32_t packet_size = *reinterpret_cast<uint32_t*>(
-      this->buffer_ + (this->r_released_ & (this->BufferSize - 1)));
-  if (packet_size > max_size) {
-    this->lock_.Unlock();
-    return -ENOSPC;
-  }
-  Range t;
-  t.start_idx = this->r_released_ + sizeof(uint32_t);
-  t.end_idx = t.start_idx + packet_size;
-  this->CopyOutRange(t, buffer_out);
-  this->r_released_ += this->CalculateBufferedSize(packet_size);
-  this->lock_.Unlock();
-  r->SendSignal(layout::Sides::Both, &this->r_released_);
-  return packet_size;
-}
-
-template <uint32_t SizeLog2, uint32_t MaxPacketSize>
-intptr_t CircularPacketQueue<SizeLog2, MaxPacketSize>::Write(
-    RegionSignalingInterface* r, const char* buffer_in, uint32_t bytes,
-    bool non_blocking) {
-  iovec iov;
-  iov.iov_base = const_cast<char *>(buffer_in);
-  iov.iov_len = bytes;
-  return Writev(r, &iov, 1 /* iov_count */, non_blocking);
-}
-
-template <uint32_t SizeLog2, uint32_t MaxPacketSize>
-intptr_t CircularPacketQueue<SizeLog2, MaxPacketSize>::Writev(
-      RegionSignalingInterface *r,
-      const iovec *iov,
-      size_t iov_count,
-      bool non_blocking) {
-  size_t bytes = 0;
-  for (size_t i = 0; i < iov_count; ++i) {
-    bytes += iov[i].iov_len;
-  }
-
-  if (bytes > MaxPacketSize) {
-    return -ENOSPC;
-  }
-
-  Range range;
-  size_t buffered_size = this->CalculateBufferedSize(bytes);
-  this->lock_.Lock();
-  intptr_t rval =
-      this->WriteReserveLocked(r, buffered_size, &range, non_blocking);
-  if (rval < 0) {
-    this->lock_.Unlock();
-    return rval;
-  }
-  Range header = range;
-  header.end_idx = header.start_idx + sizeof(uint32_t);
-  Range payload{
-      static_cast<uint32_t>(range.start_idx + sizeof(uint32_t)),
-      static_cast<uint32_t>(range.start_idx + sizeof(uint32_t) + bytes)};
-  this->CopyInRange(reinterpret_cast<const char*>(&bytes), header);
-
-  Range subRange = payload;
-  for (size_t i = 0; i < iov_count; ++i) {
-    subRange.end_idx = subRange.start_idx + iov[i].iov_len;
-    this->CopyInRange(static_cast<const char *>(iov[i].iov_base), subRange);
-
-    subRange.start_idx = subRange.end_idx;
-  }
-
-  this->w_pub_ = range.end_idx;
-  this->lock_.Unlock();
-  r->SendSignal(layout::Sides::Both, &this->w_pub_);
-  return bytes;
-}
-
-}  // namespace layout
-}  // namespace vsoc
diff --git a/common/vsoc/lib/circqueue_test.cpp b/common/vsoc/lib/circqueue_test.cpp
deleted file mode 100644
index 34aca33..0000000
--- a/common/vsoc/lib/circqueue_test.cpp
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <thread>
-#include <unistd.h>
-
-#include <gtest/gtest.h>
-
-#include "common/vsoc/lib/circqueue_impl.h"
-#include "common/vsoc/lib/mock_region_view.h"
-
-#define EXPECT_BLOCK(region, tid) \
-    EXPECT_TRUE(region.IsBlocking(tid))
-
-namespace {
-
-constexpr int kQueueSizeLog2 = 16;
-constexpr int kQueueCapacity = 1 << kQueueSizeLog2;
-constexpr int kMaxPacketSize = 1024;
-
-constexpr int kNumReadingThread = 5;
-constexpr int kNumWritingThread = 5;
-
-struct CircQueueTestRegionLayout : public vsoc::layout::RegionLayout {
-  vsoc::layout::CircularByteQueue<kQueueSizeLog2> byte_queue;
-  vsoc::layout::CircularPacketQueue<kQueueSizeLog2, kMaxPacketSize> packet_queue;
-};
-
-typedef vsoc::test::MockRegionView<CircQueueTestRegionLayout> CircQueueRegionView;
-
-class CircQueueTest : public ::testing::Test {
- protected:
-  virtual void SetUp() {
-    region_.Open();
-  }
-
-  CircQueueRegionView region_;
-};
-
-intptr_t ReadBytes(CircQueueRegionView* region, int bytes) {
-  char buffer_out[bytes];
-  CircQueueTestRegionLayout* layout = region->data();
-  return layout->byte_queue.Read(region, buffer_out, bytes);
-}
-
-intptr_t WriteBytes(CircQueueRegionView* region, int bytes) {
-  char buffer_in[bytes];
-  CircQueueTestRegionLayout* layout = region->data();
-  return layout->byte_queue.Write(region, buffer_in, bytes);
-}
-
-intptr_t ReadPacket(CircQueueRegionView* region, int max_size) {
-  char buffer_out[max_size];
-  CircQueueTestRegionLayout* layout = region->data();
-  return layout->packet_queue.Read(region, buffer_out, max_size);
-}
-
-intptr_t WritePacket(CircQueueRegionView* region, int packet_size) {
-  char buffer_in[packet_size];
-  CircQueueTestRegionLayout* layout = region->data();
-  return layout->packet_queue.Write(region, buffer_in, packet_size);
-}
-
-void ReadBytesInChunk(CircQueueRegionView* region, int total_size, int chuck_size) {
-  char buffer_out[chuck_size];
-  CircQueueTestRegionLayout* layout = region->data();
-  int total_read = 0;
-  int remaining = total_size;
-  while (remaining >= chuck_size) {
-    int ret = layout->byte_queue.Read(region, buffer_out, chuck_size);
-    total_read += ret;
-    remaining -= ret;
-  }
-  if (remaining > 0) {
-    total_read += layout->byte_queue.Write(region, buffer_out, remaining);
-  }
-  EXPECT_EQ(total_read, total_size);
-}
-
-void WriteBytesInChunk(CircQueueRegionView* region, int total_size, int chuck_size) {
-  char buffer_in[chuck_size];
-  CircQueueTestRegionLayout* layout = region->data();
-  int total_write = 0;
-  int remaining = total_size;
-  while (remaining >= chuck_size) {
-    int ret = layout->byte_queue.Write(region, buffer_in, chuck_size);
-    total_write += ret;
-    remaining -= ret;
-  }
-  if (remaining > 0) {
-    total_write += layout->byte_queue.Write(region, buffer_in, remaining);
-  }
-  EXPECT_EQ(total_write, total_size);
-}
-
-void ReadManyPackets(CircQueueRegionView* region, int num_packets, int packet_size) {
-  char buffer_out[packet_size];
-  CircQueueTestRegionLayout* layout = region->data();
-  int total_read = 0;
-  int remaining = num_packets;
-  while (remaining > 0) {
-    int ret = layout->packet_queue.Read(region, buffer_out, packet_size);
-    total_read += ret;
-    remaining--;
-  }
-  EXPECT_EQ(total_read, num_packets * packet_size);
-}
-
-void WriteManyPackets(CircQueueRegionView* region, int num_packets, int packet_size) {
-  char buffer_in[packet_size];
-  CircQueueTestRegionLayout* layout = region->data();
-  int total_write = 0;
-  int remaining = num_packets;
-  while (remaining > 0) {
-    int ret = layout->packet_queue.Write(region, buffer_in, packet_size);
-    total_write += ret;
-    remaining--;
-  }
-  EXPECT_EQ(total_write, num_packets * packet_size);
-}
-
-// ByteQueue Tests
-
-// Test writing bytes
-TEST_F(CircQueueTest, ByteQueueSimpleWrite) {
-  const int num_bytes = 8;
-  EXPECT_EQ(num_bytes, WriteBytes(&this->region_, num_bytes));
-}
-
-// Test reading bytes
-TEST_F(CircQueueTest, ByteQueueSimpleRead) {
-  const int num_bytes = 8;
-  EXPECT_EQ(num_bytes, WriteBytes(&this->region_, num_bytes));
-  EXPECT_EQ(num_bytes, ReadBytes(&this->region_, num_bytes));
-}
-
-// Test reading on an empty queue. Expect blocking.
-TEST_F(CircQueueTest, ByteQueueReadOnEmpty) {
-  const int num_bytes = 8;
-
-  // Spawn a thread to read from queue. Expect it to block.
-  std::thread reading_thread(ReadBytes, &this->region_, num_bytes);
-  EXPECT_BLOCK(region_, reading_thread.get_id());
-
-  // Write expected bytes in so that we can clean up properly.
-  std::thread writing_thread(WriteBytes, &this->region_, num_bytes);
-  writing_thread.join();
-
-  reading_thread.join();
-}
-
-// Test writing on a full queue. Expect blocking.
-TEST_F(CircQueueTest, ByteQueueWriteOnFull) {
-  // Fill the queue.
-  const int capacity_bytes = kQueueCapacity;
-  EXPECT_EQ(capacity_bytes, WriteBytes(&this->region_, capacity_bytes));
-
-  // Now the queue is full, any further write would block.
-  const int num_bytes = 8;
-  std::thread writing_thread(WriteBytes, &this->region_, num_bytes);
-  EXPECT_BLOCK(region_, writing_thread.get_id());
-
-  // Read the extra bytes out so that we can clean up properly.
-  std::thread reading_thread(ReadBytes, &this->region_, num_bytes);
-  reading_thread.join();
-
-  writing_thread.join();
-}
-
-// Test if bytes being read out are the same as ones being written in.
-TEST_F(CircQueueTest, ByteQueueContentIntegrity) {
-  const int num_bytes = 8;
-  CircQueueTestRegionLayout* layout = this->region_.data();
-
-  char buffer_in[num_bytes] = {'a'};
-  layout->byte_queue.Write(&this->region_, buffer_in, num_bytes);
-
-  char buffer_out[num_bytes] = {'b'};
-  layout->byte_queue.Read(&this->region_, buffer_out, num_bytes);
-
-  for (int i=0; i<num_bytes; i++) {
-    EXPECT_EQ(buffer_in[i], buffer_out[i]);
-  }
-}
-
-// Test writing more bytes than capacity
-TEST_F(CircQueueTest, ByteQueueWriteTooManyBytes) {
-  const int extra_bytes = 8;
-  const int num_bytes = kQueueCapacity + extra_bytes;
-  EXPECT_EQ(-ENOSPC, WriteBytes(&this->region_, num_bytes));
-}
-
-// Test multiple bytes read/write
-TEST_F(CircQueueTest, ByteQueueMultipleReadWrite) {
-  const int chunk_size = 7;
-  const int total_size = 3.3 * kQueueCapacity;
-  std::vector<std::thread> reading_threads;
-  std::vector<std::thread> writing_threads;
-  for (int i=0; i<kNumReadingThread; i++) {
-    reading_threads.emplace_back(
-        std::thread(ReadBytesInChunk, &this->region_, total_size, chunk_size));
-  }
-  for (int i=0; i<kNumWritingThread; i++) {
-    writing_threads.emplace_back(
-        std::thread(WriteBytesInChunk, &this->region_, total_size, chunk_size));
-  }
-  std::for_each(reading_threads.begin(), reading_threads.end(), [](std::thread& t) { t.join(); });
-  std::for_each(writing_threads.begin(), writing_threads.end(), [](std::thread& t) { t.join(); });
-}
-
-// PacketQueue Tests
-
-// Test writing packet
-TEST_F(CircQueueTest, PacketQueueSimpleWrite) {
-  const int packet_size = 8;
-  EXPECT_EQ(packet_size, WritePacket(&this->region_, packet_size));
-}
-
-// Test reading packet
-TEST_F(CircQueueTest, PacketQueueSimpleRead) {
-  const int packet_size = 8;
-  EXPECT_EQ(packet_size, WritePacket(&this->region_, packet_size));
-  EXPECT_EQ(packet_size, ReadPacket(&this->region_, packet_size));
-}
-
-// Test reading on an empty queue. Expect blocking.
-TEST_F(CircQueueTest, PacketQueueReadOnEmpty) {
-  const int packet_size = 8;
-
-  // Spawn a thread to read from queue. Expect it to block.
-  std::thread reading_thread(ReadPacket, &this->region_, packet_size);
-  EXPECT_BLOCK(region_, reading_thread.get_id());
-
-  // Write expected bytes in so that we can clean up properly.
-  std::thread writing_thread(WritePacket, &this->region_, packet_size);
-  writing_thread.join();
-
-  reading_thread.join();
-}
-
-// Test writing on a full queue. Expect blocking.
-TEST_F(CircQueueTest, PacketQueueWriteOnFull) {
-  // Fill the queue.
-  const int packet_size = kMaxPacketSize;
-  int capacity_bytes = kQueueCapacity;
-  while (capacity_bytes >= packet_size) {
-    EXPECT_EQ(packet_size, WritePacket(&this->region_, packet_size));
-    capacity_bytes -= (packet_size + sizeof(uint32_t));
-  }
-
-  // Now the queue is full, any further write would block.
-  std::thread writing_thread(WritePacket, &this->region_, packet_size);
-  EXPECT_BLOCK(region_, writing_thread.get_id());
-
-  // Read the extra bytes out so that we can clean up properly.
-  std::thread reading_thread(ReadPacket, &this->region_, packet_size);
-  reading_thread.join();
-
-  writing_thread.join();
-}
-
-// Test if packet being read out are the same as one being written in.
-TEST_F(CircQueueTest, PacketQueueContentIntegrity) {
-  const int packet_size = 8;
-  CircQueueTestRegionLayout* layout = this->region_.data();
-
-  char buffer_in[packet_size] = {'a'};
-  layout->packet_queue.Write(&this->region_, buffer_in, packet_size);
-
-  char buffer_out[packet_size] = {'b'};
-  layout->packet_queue.Read(&this->region_, buffer_out, packet_size);
-
-  for (int i=0; i<packet_size; i++) {
-    EXPECT_EQ(buffer_in[i], buffer_out[i]);
-  }
-}
-
-// Test writing packet larger than capacity
-TEST_F(CircQueueTest, PacketQueueWriteTooLargePacket) {
-  const int extra_bytes = 8;
-  const int packet_size = kQueueCapacity + extra_bytes;
-  EXPECT_EQ(-ENOSPC, WritePacket(&this->region_, packet_size));
-}
-
-// Test reading packet larger than can handle
-TEST_F(CircQueueTest, PacketQueueReadTooLargePacket) {
-  const int extra_bytes = 8;
-  const int small_packet = 8;
-  const int large_packet = small_packet + extra_bytes;
-
-  WritePacket(&this->region_, large_packet);
-  char buffer_out[small_packet];
-  CircQueueTestRegionLayout* layout = this->region_.data();
-  EXPECT_EQ(-ENOSPC, layout->packet_queue.Read(&this->region_, buffer_out, small_packet));
-}
-
-// Test multiple packets read/write
-TEST_F(CircQueueTest, PacketQueueMultipleReadWrite) {
-  const int packet_size = kMaxPacketSize;
-  const int num_packets = 1.5 * (kQueueCapacity / packet_size);
-  std::vector<std::thread> reading_threads;
-  std::vector<std::thread> writing_threads;
-  for (int i=0; i<kNumReadingThread; i++) {
-    reading_threads.emplace_back(
-        std::thread(ReadManyPackets, &this->region_, num_packets, packet_size));
-  }
-  for (int i=0; i<kNumWritingThread; i++) {
-    writing_threads.emplace_back(
-        std::thread(WriteManyPackets, &this->region_, num_packets, packet_size));
-  }
-  std::for_each(reading_threads.begin(), reading_threads.end(), [](std::thread& t) { t.join(); });
-  std::for_each(writing_threads.begin(), writing_threads.end(), [](std::thread& t) { t.join(); });
-}
-
-}  // namespace
diff --git a/common/vsoc/lib/compat.cpp b/common/vsoc/lib/compat.cpp
deleted file mode 100644
index 3b8deb2..0000000
--- a/common/vsoc/lib/compat.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "common/vsoc/lib/compat.h"
-
-#include <sys/syscall.h>
-#include <unistd.h>
-
-namespace vsoc {
-
-#ifdef CUTTLEFISH_HOST
-uint32_t gettid() {
-  thread_local uint32_t tid = syscall(SYS_gettid);
-  return tid;
-}
-#endif
-}
diff --git a/common/vsoc/lib/compat.h b/common/vsoc/lib/compat.h
deleted file mode 100644
index 8f3355c..0000000
--- a/common/vsoc/lib/compat.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Utilities to make the host and the guest a bit more compatible
-
-#include <stdint.h>
-
-namespace vsoc {
-#ifdef CUTTLEFISH_HOST
-// Things that are missing on the host
-uint32_t gettid();
-#endif
-}
diff --git a/common/vsoc/lib/e2e_test_region_layout.cpp b/common/vsoc/lib/e2e_test_region_layout.cpp
deleted file mode 100644
index 9a787bd..0000000
--- a/common/vsoc/lib/e2e_test_region_layout.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Define some of the string constants associated with the region layout.
-#include "common/vsoc/shm/e2e_test_region_layout.h"
-
-namespace vsoc {
-namespace layout {
-namespace e2e_test {
-
-const char* E2EPrimaryTestRegionLayout::region_name = "e2e_primary";
-const char
-    E2EPrimaryTestRegionLayout::guest_pattern[E2EMemoryFill::kOwnedFieldSize] =
-        "primary guest e2e string";
-const char
-    E2EPrimaryTestRegionLayout::host_pattern[E2EMemoryFill::kOwnedFieldSize] =
-        "primary host e2e string";
-
-const char* E2ESecondaryTestRegionLayout::region_name = "e2e_secondary";
-const char E2ESecondaryTestRegionLayout::guest_pattern
-    [E2EMemoryFill::kOwnedFieldSize] = "secondary guest e2e string";
-const char
-    E2ESecondaryTestRegionLayout::host_pattern[E2EMemoryFill::kOwnedFieldSize] =
-        "secondary host e2e string";
-
-const char* E2EUnfindableRegionLayout::region_name = "e2e_must_not_exist";
-
-}  // namespace e2e_test
-}  // namespace layout
-}  // namespace vsoc
diff --git a/common/vsoc/lib/e2e_test_region_view.h b/common/vsoc/lib/e2e_test_region_view.h
deleted file mode 100644
index 70a3db6..0000000
--- a/common/vsoc/lib/e2e_test_region_view.h
+++ /dev/null
@@ -1,104 +0,0 @@
-#pragma once
-/*
- * 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 <memory>
-#include <functional>
-
-#include "common/vsoc/lib/typed_region_view.h"
-#include "common/vsoc/shm/e2e_test_region_layout.h"
-
-namespace vsoc {
-template <typename Layout>
-class E2ERegionView : public vsoc::TypedRegionView<
-                      E2ERegionView<Layout>,
-                      Layout> {
- public:
-
-  uint32_t read_guest_self_register() const {
-    return this->data().guest_self_register;
-  }
-
-  void write_guest_self_register(uint32_t val) {
-    this->data()->guest_self_register = val;
-  }
-
-  void signal_guest_self_register() {
-    this->SendSignal(layout::Sides::OurSide,
-                     &this->data()->guest_self_register);
-  }
-
-  int wait_guest_self_register(uint32_t expected_value) {
-    return this->WaitForSignal(
-        &this->data()->guest_self_register, expected_value);
-  }
-
-  void signal_guest_to_host_register() {
-    this->SendSignal(layout::Sides::OurSide,
-                     &this->data()->guest_to_host_signal);
-  }
-
-  uint32_t guest_to_host_signal_offset() const {
-    return this->pointer_to_region_offset(&this->data().guest_to_host_signal);
-  }
-
-  uint32_t host_to_guest_signal_offset() const {
-    return this->pointer_to_region_offset(&this->data().host_to_guest_signal);
-  }
-
-  const char* guest_string(size_t index) const {
-    return const_cast<const char*>(this->data().data[index].guest_writable);
-  }
-
-  const char* host_string(size_t index) const {
-    return const_cast<const char*>(this->data().data[index].host_writable);
-  }
-
-  bool set_guest_string(size_t index, const char* value) {
-    strcpy(const_cast<char*>(this->data()->data[index].guest_writable),
-           value);
-    return true;
-  }
-
-  bool set_host_string(size_t index, const char* value) {
-    strcpy(const_cast<char*>(this->data()->data[index].host_writable),
-           value);
-    return true;
-  }
-
-  size_t string_size() const {
-    return Layout::NumFillRecords(this->control_->region_data_size());
-  }
-
-  void guest_status(vsoc::layout::e2e_test::E2ETestStage stage) {
-    this->data()->guest_status.set_value(stage);
-  }
-
-  void host_status(vsoc::layout::e2e_test::E2ETestStage stage) {
-    this->data()->host_status.set_value(stage);
-  }
-};
-
-using E2EPrimaryRegionView =
-  vsoc::E2ERegionView<layout::e2e_test::E2EPrimaryTestRegionLayout>;
-
-using E2ESecondaryRegionView =
-  vsoc::E2ERegionView<layout::e2e_test::E2ESecondaryTestRegionLayout>;
-
-using E2EUnfindableRegionView =
-  vsoc::E2ERegionView<layout::e2e_test::E2EUnfindableRegionLayout>;
-
-}  // namespace vsoc
diff --git a/common/vsoc/lib/gralloc_layout.cpp b/common/vsoc/lib/gralloc_layout.cpp
deleted file mode 100644
index 9be790a..0000000
--- a/common/vsoc/lib/gralloc_layout.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Define some of the string constants associated with the region layout.
-#include "common/vsoc/shm/gralloc_layout.h"
-
-namespace vsoc {
-namespace layout {
-
-namespace gralloc {
-
-const char* GrallocManagerLayout::region_name = "gralloc_manager";
-const char* GrallocBufferLayout::region_name = "gralloc_memory";
-
-}  // gralloc
-}  // layout
-}  // vsoc
diff --git a/common/vsoc/lib/graphics_common.h b/common/vsoc/lib/graphics_common.h
deleted file mode 100644
index d2db6c4..0000000
--- a/common/vsoc/lib/graphics_common.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "common/vsoc/shm/graphics.h"
-
-namespace vsoc {
-
-// Returns BytesPerPixel given a PixelFormat. Code should rely on this rather
-// than accessing the mask directly.
-static inline std::size_t BytesPerPixel(PixelFormat in) {
-    return 1 + (in >> PixelFormatBase::SubformatSize) &
-        (PixelFormatBase::MaxBytesPerPixel - 1);
-}
-}  // vsoc
diff --git a/common/vsoc/lib/graphics_test.cpp b/common/vsoc/lib/graphics_test.cpp
deleted file mode 100644
index b43e56e..0000000
--- a/common/vsoc/lib/graphics_test.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "common/vsoc/shm/graphics.h"
-
-#include <gtest/gtest.h>
-
-TEST(GraphicsTest, Basic) {
-  // This is a shared memory layout and is mostly tested via static asserts.
-  // If this can compile then the test has passed.
-}
diff --git a/common/vsoc/lib/input_events_layout.cpp b/common/vsoc/lib/input_events_layout.cpp
deleted file mode 100644
index 3f1da61..0000000
--- a/common/vsoc/lib/input_events_layout.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Define some of the string constants associated with the region layout.
-#include "common/vsoc/shm/input_events_layout.h"
-
-namespace vsoc {
-namespace layout {
-
-namespace input_events {
-
-const char* InputEventsLayout::region_name = "input_events";
-
-}  // namespace input_events
-}  // namespace layout
-}  // namespace vsoc
diff --git a/common/vsoc/lib/input_events_region_view.cpp b/common/vsoc/lib/input_events_region_view.cpp
deleted file mode 100644
index 66bc697..0000000
--- a/common/vsoc/lib/input_events_region_view.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "common/vsoc/lib/input_events_region_view.h"
-
-#include <linux/input.h>
-#include <linux/uinput.h>
-
-#include "common/vsoc/lib/circqueue_impl.h"
-
-using vsoc::layout::input_events::InputEventsLayout;
-
-namespace vsoc {
-namespace input_events {
-
-namespace {
-void InitInputEvent(InputEvent* evt, uint16_t type, uint16_t code, uint32_t value) {
-  evt->type = type;
-  evt->code = code;
-  evt->value = value;
-}
-}  // namespace
-
-const int InputEventsRegionView::kMaxEventsPerPacket = 4;
-
-bool InputEventsRegionView::HandleSingleTouchEvent(bool down, int x, int y) {
-  // TODO(jemoreira): Use multitouch when available
-  InputEvent events[4];
-  // Make sure to modify kMaxEventPerPacket if more events are sent.
-  InitInputEvent(&events[0], EV_ABS, ABS_X, x);
-  InitInputEvent(&events[1], EV_ABS, ABS_Y, y);
-  InitInputEvent(&events[2], EV_KEY, BTN_TOUCH, down);
-  InitInputEvent(&events[3], EV_SYN, 0, 0);
-  return 0 <
-         data()->touch_screen_queue.Write(
-             this, reinterpret_cast<char*>(&events[0]), sizeof(events), true);
-}
-
-bool InputEventsRegionView::HandlePowerButtonEvent(bool down) {
-  InputEvent events[2];
-  InitInputEvent(&events[0], EV_KEY, KEY_POWER, down);
-  InitInputEvent(&events[1], EV_SYN, 0, 0);
-  return 0 < data()->power_button_queue.Write(
-                 this, reinterpret_cast<char*>(&events[0]),
-                 sizeof(events), true);
-}
-
-bool InputEventsRegionView::HandleKeyboardEvent(bool down, uint16_t key_code) {
-  InputEvent events[2];
-  InitInputEvent(&events[0], EV_KEY, key_code, down);
-  InitInputEvent(&events[1], EV_SYN, 0, 0);
-  return 0 <
-         data()->keyboard_queue.Write(this, reinterpret_cast<char*>(&events[0]),
-                                      sizeof(events), true);
-}
-
-intptr_t InputEventsRegionView::GetScreenEventsOrWait(InputEvent* evt,
-                                                      int max_event_count) {
-  intptr_t ret = this->data()->touch_screen_queue.Read(
-      this, reinterpret_cast<char*>(evt), sizeof(InputEvent) * max_event_count);
-  if (ret < 0) {
-    return ret;
-  }
-  return ret / sizeof(InputEvent);
-}
-
-intptr_t InputEventsRegionView::GetKeyboardEventsOrWait(InputEvent* evt,
-                                                        int max_event_count) {
-  intptr_t ret = this->data()->keyboard_queue.Read(
-      this, reinterpret_cast<char*>(evt), sizeof(InputEvent) * max_event_count);
-  if (ret < 0) {
-    return ret;
-  }
-  return ret / sizeof(InputEvent);
-}
-
-intptr_t InputEventsRegionView::GetPowerButtonEventsOrWait(
-    InputEvent* evt, int max_event_count) {
-  intptr_t ret = this->data()->power_button_queue.Read(
-      this, reinterpret_cast<char*>(evt), sizeof(InputEvent) * max_event_count);
-  if (ret < 0) {
-    return ret;
-  }
-  return ret / sizeof(InputEvent);
-}
-
-}  // namespace input_events
-}  // namespace vsoc
diff --git a/common/vsoc/lib/input_events_region_view.h b/common/vsoc/lib/input_events_region_view.h
deleted file mode 100644
index 3355631..0000000
--- a/common/vsoc/lib/input_events_region_view.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <memory>
-
-#include "common/vsoc/lib/typed_region_view.h"
-#include "common/vsoc/shm/input_events_layout.h"
-#include "uapi/vsoc_shm.h"
-
-namespace vsoc {
-namespace input_events {
-
-struct InputEvent {
-  uint16_t type;
-  uint16_t code;
-  uint32_t value;
-};
-
-class InputEventsRegionView
-    : public vsoc::TypedRegionView<
-          InputEventsRegionView,
-          vsoc::layout::input_events::InputEventsLayout> {
- public:
-  static const int kMaxEventsPerPacket;
-  // Generates a touch event, may returns true if successful, false if there was
-  // an error, most likely that the queue is full.
-  bool HandleSingleTouchEvent(bool down, int x, int y);
-  bool HandlePowerButtonEvent(bool down);
-  bool HandleKeyboardEvent(bool down, uint16_t key_code);
-
-  // TODO(jemoreira): HandleMultiTouchEvent()...
-
-  // Read input events from the queue, waits if there are none available.
-  // Returns the number of events read or a negative value in case of an error
-  // (most likely the next packet in the queue is larger than the buffer
-  // provided).
-  intptr_t GetScreenEventsOrWait(InputEvent* buffer, int max_event_count);
-  intptr_t GetKeyboardEventsOrWait(InputEvent* buffer, int max_event_count);
-  intptr_t GetPowerButtonEventsOrWait(InputEvent* buffer, int max_event_count);
-
-};
-}  // namespace input_events
-}  // namespace vsoc
diff --git a/common/vsoc/lib/lock_common.cpp b/common/vsoc/lib/lock_common.cpp
deleted file mode 100644
index c100574..0000000
--- a/common/vsoc/lib/lock_common.cpp
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "common/vsoc/shm/lock.h"
-
-#include "common/libs/glog/logging.h"
-#include "common/vsoc/lib/compat.h"
-#include "common/vsoc/lib/region_view.h"
-
-#include <stdlib.h>
-
-using vsoc::layout::Sides;
-
-namespace {
-
-const uint32_t LockFree = 0U;
-const uint32_t GuestWaitingFlag = (Sides::Guest << 30);
-const uint32_t HostWaitingFlag = (Sides::Host << 30);
-const uint32_t OurWaitingFlag = (Sides::OurSide << 30);
-static_assert(GuestWaitingFlag, "GuestWaitingFlag is 0");
-static_assert(HostWaitingFlag, "HostWaitingFlag is 0");
-static_assert((GuestWaitingFlag & HostWaitingFlag) == 0,
-              "Waiting flags should not share bits");
-
-// Set if the current owner is the host
-const uint32_t HostIsOwner = 0x20000000U;
-
-// PID_MAX_LIMIT appears to be 0x00400000U, so we're probably ok here
-const uint32_t OwnerMask = 0x3FFFFFFFU;
-
-uint32_t MakeOwnerTid(uint32_t raw_tid) {
-  if (Sides::OurSide == Sides::Host) {
-    return (raw_tid | HostIsOwner) & OwnerMask;
-  } else {
-    return raw_tid & (OwnerMask & ~HostIsOwner);
-  }
-}
-
-};  // namespace
-
-namespace vsoc {
-/**
- * This is a generic synchronization primitive that provides space for the
- * owner of the lock to write platform-specific information.
- */
-bool vsoc::layout::WaitingLockBase::TryLock(uint32_t tid,
-                                            uint32_t* expected_out) {
-  uint32_t masked_tid = MakeOwnerTid(tid);
-  uint32_t expected = LockFree;
-  while (1) {
-    // First try to lock assuming that the mutex is free
-    if (lock_uint32_.compare_exchange_strong(expected, masked_tid)) {
-      // We got the lock.
-      return true;
-    }
-    // We didn't get the lock and our wait flag is already set. It's safe to
-    // try to sleep
-    if (expected & OurWaitingFlag) {
-      *expected_out = expected;
-      return false;
-    }
-    // Attempt to set the wait flag. This will fail if the lock owner changes.
-    while (1) {
-      uint32_t add_wait_flag = expected | OurWaitingFlag;
-      if (lock_uint32_.compare_exchange_strong(expected, add_wait_flag)) {
-        // We set the waiting flag. Try to sleep.
-        *expected_out = expected;
-        return false;
-      }
-      // The owner changed, but we at least we got the wait flag.
-      // Try sleeping
-      if (expected & OurWaitingFlag) {
-        *expected_out = expected;
-        return false;
-      }
-      // Special case: the lock was just freed. Stop trying to set the
-      // waiting flag and try to grab the lock.
-      if (expected == LockFree) {
-        break;
-      }
-      // The owner changed and we have no wait flag
-      // Try to set the wait flag again
-    }
-    // This only happens if the lock was freed while we attempt the set the
-    // wait flag. Try to grab the lock again
-  }
-  // Never reached.
-}
-
-layout::Sides vsoc::layout::WaitingLockBase::UnlockCommon(uint32_t tid) {
-  uint32_t expected_state = lock_uint32_;
-
-  // We didn't hold the lock. This process is insane and must die before it
-  // does damage.
-  uint32_t marked_tid = MakeOwnerTid(tid);
-  if ((marked_tid ^ expected_state) & OwnerMask) {
-    LOG(FATAL) << tid << " unlocking " << this << " owned by "
-               << expected_state;
-  }
-  // If contention is just starting this may fail twice (once for each bit)
-  // expected_state updates on each failure. When this finishes we have
-  // one bit for each waiter
-  while (1) {
-    if (lock_uint32_.compare_exchange_strong(expected_state, LockFree)) {
-      break;
-    }
-  }
-  if ((expected_state ^ marked_tid) & OwnerMask) {
-    LOG(FATAL) << "Lock owner of " << this << " changed from " << tid << " to "
-               << expected_state << " during unlock";
-  }
-  switch (expected_state & (GuestWaitingFlag | HostWaitingFlag)) {
-    case 0:
-      return Sides::NoSides;
-    case GuestWaitingFlag:
-      return Sides::Guest;
-    case HostWaitingFlag:
-      return Sides::Host;
-    default:
-      return Sides::Both;
-  }
-}
-
-bool vsoc::layout::WaitingLockBase::RecoverSingleSided() {
-  // No need to signal because the caller ensured that there were no other
-  // threads...
-  return lock_uint32_.exchange(LockFree) != LockFree;
-}
-
-void layout::GuestAndHostLock::Lock(RegionView* region) {
-  uint32_t expected;
-  uint32_t tid = gettid();
-  while (1) {
-    if (TryLock(tid, &expected)) {
-      return;
-    }
-    region->WaitForSignal(&lock_uint32_, expected);
-  }
-}
-
-void layout::GuestAndHostLock::Unlock(RegionView* region) {
-  region->SendSignal(UnlockCommon(gettid()), &lock_uint32_);
-}
-
-bool layout::GuestAndHostLock::Recover(RegionView* region) {
-  uint32_t expected_state = lock_uint32_;
-  uint32_t expected_owner_bit = (Sides::OurSide == Sides::Host) ? HostIsOwner : 0;
-  // This avoids check then act by reading exactly once and then
-  // eliminating the states where Recover should be a noop.
-  if (expected_state == LockFree) {
-    return false;
-  }
-  // Owned by the other side, do nothing.
-  if ((expected_state & HostIsOwner) != expected_owner_bit) {
-    return false;
-  }
-  // At this point we know two things:
-  //   * The lock was held by our side
-  //   * There are no other threads running on our side (precondition
-  //     for calling Recover())
-  // Therefore, we know that the current expected value should still
-  // be in the lock structure. Use the normal unlock logic, providing
-  // the tid that we observed in the lock.
-  region->SendSignal(UnlockCommon(expected_state), &lock_uint32_);
-  return true;
-}
-
-}  // namespace vsoc
diff --git a/common/vsoc/lib/lock_guard.h b/common/vsoc/lib/lock_guard.h
deleted file mode 100644
index 8fbcc7d..0000000
--- a/common/vsoc/lib/lock_guard.h
+++ /dev/null
@@ -1,84 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "common/vsoc/shm/lock.h"
-
-namespace vsoc {
-
-class RegionView;
-
-/*
- * Implements std::lock_guard like functionality for the vsoc locks.
- */
-
-template <typename Lock>
-class LockGuard {
- public:
-  explicit LockGuard(Lock* lock) : lock_(lock) {
-    lock_->Lock();
-  }
-
-  LockGuard(LockGuard&& o) noexcept {
-    lock_ = o.lock_;
-    o.lock_ = nullptr;
-  }
-
-  LockGuard(const LockGuard&) = delete;
-  LockGuard& operator=(const LockGuard&) = delete;
-
-  ~LockGuard() {
-    if (lock_) {
-      lock_->Unlock();
-    }
-  }
-
- private:
-  Lock* lock_;
-};
-
-template <>
-class LockGuard<::vsoc::layout::GuestAndHostLock> {
-  using Lock = ::vsoc::layout::GuestAndHostLock;
-
- public:
-  LockGuard(Lock* lock, RegionView* region) : lock_(lock), region_(region) {
-    lock_->Lock(region_);
-  }
-
-  LockGuard(LockGuard&& o) noexcept {
-    lock_ = o.lock_;
-    o.lock_ = nullptr;
-    region_ = o.region_;
-    o.region_ = nullptr;
-  }
-
-  LockGuard(const LockGuard&) = delete;
-  LockGuard& operator=(const LockGuard&) = delete;
-
-  ~LockGuard() {
-    if (lock_) {
-      lock_->Unlock(region_);
-    }
-  }
-
- private:
-  Lock* lock_;
-  RegionView* region_;
-};
-
-}  // namespace vsoc
diff --git a/common/vsoc/lib/lock_test.cpp b/common/vsoc/lib/lock_test.cpp
deleted file mode 100644
index d09b5a4..0000000
--- a/common/vsoc/lib/lock_test.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "common/vsoc/shm/lock.h"
-
-#include <thread>
-#include <vector>
-
-#include <gtest/gtest.h>
-
-#include "common/vsoc/lib/region_view.h"
-
-#ifdef CUTTLEFISH_HOST
-using MyLock = vsoc::layout::HostLock;
-#else
-using MyLock = vsoc::layout::GuestLock;
-#endif
-
-class SimpleLocker {
- public:
-  enum State {
-    BEFORE_EXECUTION,
-    BEFORE_LOCK,
-    IN_CRITICAL_SECTION,
-    DONE,
-    JOINED
-  };
-
-  explicit SimpleLocker(MyLock* lock)
-      : lock_(lock), thread_(&SimpleLocker::Work, this) {}
-
-  void Work() {
-    state_ = BEFORE_LOCK;
-    lock_->Lock();
-    state_ = IN_CRITICAL_SECTION;
-    InCriticalSection();
-    lock_->Unlock();
-    state_ = DONE;
-  }
-
-  void InCriticalSection() {}
-
-  void Join() {
-    thread_.join();
-    state_ = JOINED;
-  }
-
- protected:
-  MyLock* lock_;
-  volatile State state_{BEFORE_EXECUTION};
-  std::thread thread_;
-};
-
-TEST(LockTest, Basic) {
-  // In production regions are always 0 filled on allocation. That's not
-  // true on the stack, so initialize the lock when we declare it.
-  MyLock lock{};
-  SimpleLocker a(&lock);
-  SimpleLocker b(&lock);
-  a.Join();
-  b.Join();
-}
diff --git a/common/vsoc/lib/managed_e2e_test_region_layout.cpp b/common/vsoc/lib/managed_e2e_test_region_layout.cpp
deleted file mode 100644
index 1cc794b..0000000
--- a/common/vsoc/lib/managed_e2e_test_region_layout.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "common/vsoc/shm/managed_e2e_test_region_layout.h"
-
-namespace vsoc {
-namespace layout {
-namespace e2e_test {
-
-const char* E2EManagedTestRegionLayout::region_name = "e2e_managed";
-
-const char* E2EManagerTestRegionLayout::region_name = "e2e_manager";
-
-}  // namespace e2e_test
-}  // namespace layout
-}  // namespace vsoc
diff --git a/common/vsoc/lib/mock_region_view.h b/common/vsoc/lib/mock_region_view.h
deleted file mode 100644
index f9c3006..0000000
--- a/common/vsoc/lib/mock_region_view.h
+++ /dev/null
@@ -1,119 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <linux/futex.h>
-#include <sys/syscall.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <chrono>
-#include <condition_variable>
-#include <mutex>
-#include <thread>
-#include <unordered_map>
-
-#include "common/vsoc/lib/region_signaling_interface.h"
-
-namespace vsoc {
-namespace test {
-
-/**
- * MockRegionView mocks a region in the shared memory window by calloc and
- * futex. It supports only one-sided signal as in it doesn't do anything on
- * sending or waiting interrupt. This is to test if a particular layout
- * behaves correctly when there are multiple threads accessing it.
- */
-template <typename Layout>
-class MockRegionView : public vsoc::RegionSignalingInterface {
- public:
-  explicit MockRegionView(){};
-  virtual ~MockRegionView() {
-    if (region_base_) {
-      free(region_base_);
-      region_base_ = nullptr;
-    }
-  };
-
-  bool Open() {
-    region_base_ = calloc(sizeof(Layout), 1);
-    return !region_base_;
-  };
-
-  virtual void SendSignal(vsoc::layout::Sides /* sides_to_signal */,
-                          std::atomic<uint32_t>* uaddr) {
-    syscall(SYS_futex, reinterpret_cast<int32_t*>(uaddr), FUTEX_WAKE, -1,
-            nullptr, nullptr, 0);
-  }
-
-  virtual int WaitForSignal(std::atomic<uint32_t>* uaddr,
-                             uint32_t expected_value) {
-    {
-      std::lock_guard<std::mutex> guard(mutex_);
-      if (tid_to_addr_.find(std::this_thread::get_id()) != tid_to_addr_.end()) {
-        // Same thread tries to wait
-        return 0;
-      }
-      tid_to_addr_.emplace(std::this_thread::get_id(), uaddr);
-      map_changed_.notify_one();
-    }
-
-    syscall(SYS_futex, uaddr, FUTEX_WAIT, expected_value, nullptr, nullptr, 0);
-
-    {
-      std::lock_guard<std::mutex> guard(mutex_);
-      tid_to_addr_.erase(std::this_thread::get_id());
-    }
-    return 0;
-  }
-
-  // Mock methods from TypedRegionView
-  Layout* data() { return reinterpret_cast<Layout*>(region_base_); };
-
-  // Check wait status on a specificy thread
-  bool IsBlocking(std::thread::id tid) {
-    while (1) {
-      std::unique_lock<std::mutex> lock(mutex_);
-      if (tid_to_addr_.find(tid) != tid_to_addr_.end()) {
-        return true;
-      }
-      // Allow some time as tid map might not be updated yet
-      while (tid_to_addr_.find(tid) == tid_to_addr_.end()) {
-        if (map_changed_.wait_for(lock,
-                                  std::chrono::seconds(kWaitTimeoutInSec)) ==
-            std::cv_status::timeout) {
-          return false;
-        }
-      }
-      return true;
-    }
-  }
-
- private:
-  // Timeout to avoid a race on checking if a thread is blocked
-  static constexpr int kWaitTimeoutInSec = 5;
-
-  void* region_base_{};
-  std::mutex mutex_;
-  std::condition_variable map_changed_;
-  std::unordered_map<std::thread::id, std::atomic<uint32_t>*> tid_to_addr_;
-};
-
-template <typename Layout>
-constexpr int MockRegionView<Layout>::kWaitTimeoutInSec;
-
-}  // namespace test
-}  // namespace vsoc
diff --git a/common/vsoc/lib/region_control.h b/common/vsoc/lib/region_control.h
deleted file mode 100644
index 7762603..0000000
--- a/common/vsoc/lib/region_control.h
+++ /dev/null
@@ -1,111 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <sys/mman.h>
-#include <stdint.h>
-#include <memory>
-#include "uapi/vsoc_shm.h"
-
-namespace vsoc {
-
-/**
- * Base class for side-specific utility functions that work on regions.
- * The methods in this class do not assume that the region is mapped in memory.
- * This makes is appropriate for ManagedRegions and certain low-level tests
- * of VSoC shared memory. Most other users will want to use TypedRegions with
- * a defined RegionLayout.
- *
- * This class is not directly instantiable because it must be specialized with
- * additional fields for the host and guest.
- */
-class RegionControl {
- public:
-  virtual ~RegionControl() {
-    if (region_base_) {
-      munmap(region_base_, region_size());
-    }
-    region_base_ = nullptr;
-  }
-
-#if defined(CUTTLEFISH_HOST)
-  static std::shared_ptr<RegionControl> Open(const char* region_name,
-                                             const char* domain);
-#else
-  static std::shared_ptr<RegionControl> Open(const char* region_name);
-#endif
-
-  const vsoc_device_region& region_desc() const { return region_desc_; }
-
-  // Returns the size of the entire region, including the signal tables.
-  uint32_t region_size() const {
-    return region_desc_.region_end_offset - region_desc_.region_begin_offset;
-  }
-
-  // Returns the size of the region that is usable for region-specific data.
-  uint32_t region_data_size() const {
-    return region_size() - region_desc_.offset_of_region_data;
-  }
-
-  // Creates a FdScopedPermission. Returns the file descriptor or -1 on
-  // failure. FdScopedPermission is not supported on the host, so -1 is
-  // always returned there.
-  virtual int CreateFdScopedPermission(const char* managed_region_name,
-                                       uint32_t owner_offset,
-                                       uint32_t owned_value,
-                                       uint32_t begin_offset,
-                                       uint32_t end_offset) = 0;
-
-  // Interrupt our peer, causing it to scan the outgoing_signal_table
-  virtual bool InterruptPeer() = 0;
-
-  // Wake the local signal table scanner. Primarily used during shutdown
-  virtual void InterruptSelf() = 0;
-
-  // Maps the entire region at an address, returning a pointer to the mapping
-  virtual void* Map() = 0;
-
-  // Wait for an interrupt from our peer
-  virtual void WaitForInterrupt() = 0;
-
-  // Signals local waiters at the given region offset.
-  // Defined only on the guest.
-  // Return value is negative on error.
-  virtual int SignalSelf(uint32_t offset) = 0;
-
-  // Waits for a signal at the given region offset.
-  // Defined only on the guest.
-  // Return value is negative on error. The number of false wakes is returned
-  // on success.
-  virtual int WaitForSignal(uint32_t offset, uint32_t expected_value) = 0;
-
-  template <typename T>
-  T* region_offset_to_pointer(uint32_t offset) {
-    if (offset > region_size()) {
-      LOG(FATAL) << __FUNCTION__ << ": " << offset << " not in region @"
-                 << region_base_;
-    }
-    return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(region_base_) +
-                                offset);
-  }
-
- protected:
-  RegionControl() {}
-  void* region_base_{};
-  vsoc_device_region region_desc_{};
-};
-}  // namespace vsoc
diff --git a/common/vsoc/lib/region_signaling_interface.h b/common/vsoc/lib/region_signaling_interface.h
deleted file mode 100644
index c1399e1..0000000
--- a/common/vsoc/lib/region_signaling_interface.h
+++ /dev/null
@@ -1,64 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdlib.h>
-#include <atomic>
-
-#include "common/vsoc/shm/base.h"
-
-namespace vsoc {
-
-/**
- * Interface that defines signaling and waiting for signal.
- */
-class RegionSignalingInterface {
- public:
-  virtual ~RegionSignalingInterface(){};
-
-  // Post a signal to the guest, the host, or both.
-  // See futex(2) FUTEX_WAKE for details.
-  //
-  //   sides_to_signal: controls where the signal is sent
-  //
-  //   signal_addr: the memory location to signal. Must be within the region.
-  virtual void SendSignal(layout::Sides sides_to_signal,
-                          std::atomic<uint32_t>* signal_addr) = 0;
-
-  // This implements the following:
-  // if (*signal_addr == last_observed_value)
-  //   wait_for_signal_at(signal_addr);
-  //
-  // Note: the caller still needs to check the value at signal_addr because
-  // this function may return early for reasons that are implementation-defined.
-  // See futex(2) FUTEX_WAIT for details.
-  //
-  //   signal_addr: the memory that will be signaled. Must be within the region.
-  //
-  //   last_observed_value: the value that motivated the calling code to wait.
-  //
-  // The return values are:
-  //   -1 on failure
-  //    0 indicates success with no tuning information
-  //    >0 indicates success. The number indicates how many times the thread
-  //       woke before it could return.
-  //       Large values indicate that the regions should be tuned.
-  virtual int WaitForSignal(std::atomic<uint32_t>* signal_addr,
-                             uint32_t last_observed_value) = 0;
-};
-
-}  // namespace vsoc
diff --git a/common/vsoc/lib/region_view.cpp b/common/vsoc/lib/region_view.cpp
deleted file mode 100644
index dc1088c..0000000
--- a/common/vsoc/lib/region_view.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-#include "common/vsoc/lib/region_view.h"
-
-#include <sys/mman.h>
-
-#include "common/libs/glog/logging.h"
-
-namespace {
-const uint32_t UADDR_OFFSET_MASK = 0xFFFFFFFC;
-const uint32_t UADDR_OFFSET_ROUND_TRIP_FLAG = 1;
-}  // namespace
-
-using vsoc::layout::Sides;
-
-vsoc::RegionWorker::RegionWorker(RegionView* region,
-                                 std::shared_ptr<RegionControl> control)
-    : control_(control),
-      region_(region),
-      stopping_(false) {}
-
-void vsoc::RegionWorker::start() {
-  CHECK(!thread_.joinable());
-  thread_ = std::thread(&vsoc::RegionWorker::Work, this);
-}
-
-void vsoc::RegionWorker::Work() {
-  while (!stopping_) {
-    region_->WaitForInterrupt();
-    if (stopping_) {
-      return;
-    }
-    region_->ProcessSignalsFromPeer([this](uint32_t offset) {
-        control_->SignalSelf(offset);
-    });
-  }
-}
-
-vsoc::RegionWorker::~RegionWorker() {
-  stopping_ = true;
-
-  if (thread_.joinable()) {
-    region_->InterruptSelf();
-    thread_.join();
-  }
-}
-
-vsoc::RegionView::~RegionView() {
-  // region_base_ is borrowed here. It's owned by control_, which is
-  // responsible for unmapping the memory
-  region_base_ = nullptr;
-}
-
-#if defined(CUTTLEFISH_HOST)
-bool vsoc::RegionView::Open(const char* name, const char* domain) {
-  control_ = vsoc::RegionControl::Open(name, domain);
-  if (!control_) {
-    return false;
-  }
-  region_base_ = control_->Map();
-  return region_base_ != nullptr;
-}
-#else
-bool vsoc::RegionView::Open(const char* name) {
-  control_ = vsoc::RegionControl::Open(name);
-  if (!control_) {
-    return false;
-  }
-  region_base_ = control_->Map();
-  return region_base_ != nullptr;
-}
-#endif
-
-// Interrupt our peer, causing it to scan the outgoing_signal_table
-bool vsoc::RegionView::MaybeInterruptPeer() {
-  if (region_offset_to_pointer<std::atomic<uint32_t>>(
-          outgoing_signal_table().interrupt_signalled_offset)
-          ->exchange(1)) {
-    return false;
-  }
-  return control_->InterruptPeer();
-}
-
-// Wait for an interrupt from our peer
-void vsoc::RegionView::WaitForInterrupt() {
-  while (1) {
-    if (region_offset_to_pointer<std::atomic<uint32_t>>(
-            incoming_signal_table().interrupt_signalled_offset)
-            ->exchange(0)) {
-      return;
-    }
-    control_->WaitForInterrupt();
-  }
-}
-
-void vsoc::RegionView::ProcessSignalsFromPeer(
-    std::function<void(uint32_t)> signal_handler) {
-  const vsoc_signal_table_layout& table = incoming_signal_table();
-  const size_t num_offsets = (1 << table.num_nodes_lg2);
-  std::atomic<uint32_t>* offsets =
-      region_offset_to_pointer<std::atomic<uint32_t>>(
-          table.futex_uaddr_table_offset);
-  for (size_t i = 0; i < num_offsets; ++i) {
-    uint32_t raw_offset = offsets[i].exchange(0);
-    if (raw_offset) {
-      bool round_trip = raw_offset & UADDR_OFFSET_ROUND_TRIP_FLAG;
-      uint32_t offset = raw_offset & UADDR_OFFSET_MASK;
-      signal_handler(offset);
-      if (round_trip) {
-        SendSignalToPeer(
-            region_offset_to_pointer<std::atomic<uint32_t>>(offset), false);
-      }
-    }
-  }
-}
-
-void vsoc::RegionView::SendSignal(Sides sides_to_signal,
-                                  std::atomic<uint32_t>* uaddr) {
-  if (sides_to_signal & Sides::Peer) {
-    // If we should also be signalling our side set the round trip flag on
-    // the futex signal.
-    bool round_trip = sides_to_signal & Sides::OurSide;
-    SendSignalToPeer(uaddr, round_trip);
-    // Return without signaling our waiters to give the other side a chance
-    // to run.
-    return;
-  }
-  if (sides_to_signal & Sides::OurSide) {
-    control_->SignalSelf(pointer_to_region_offset(uaddr));
-  }
-}
-
-void vsoc::RegionView::SendSignalToPeer(std::atomic<uint32_t>* uaddr,
-                                        bool round_trip) {
-  const vsoc_signal_table_layout& table = outgoing_signal_table();
-  std::atomic<uint32_t>* offsets =
-      region_offset_to_pointer<std::atomic<uint32_t>>(
-          table.futex_uaddr_table_offset);
-  // maximum index in the node that can hold an offset;
-  const size_t max_index = (1 << table.num_nodes_lg2) - 1;
-  uint32_t offset = pointer_to_region_offset(uaddr);
-  if (offset & ~UADDR_OFFSET_MASK) {
-    LOG(FATAL) << "uaddr offset is not naturally aligned " << uaddr;
-  }
-  // Guess at where this offset should go in the table.
-  // Do this before we set the round-trip flag.
-  size_t hash = (offset >> 2) & max_index;
-  if (round_trip) {
-    offset |= UADDR_OFFSET_ROUND_TRIP_FLAG;
-  }
-  while (1) {
-    uint32_t expected = 0;
-    if (offsets[hash].compare_exchange_strong(expected, offset)) {
-      // We stored the offset. Send the interrupt.
-      this->MaybeInterruptPeer();
-      break;
-    }
-    // We didn't store, but the value was already in the table with our flag.
-    // Return without interrupting.
-    if (expected == offset) {
-      return;
-    }
-    // Hash collision. Try again in a different node
-    if ((expected & UADDR_OFFSET_MASK) != (offset & UADDR_OFFSET_MASK)) {
-      hash = (hash + 1) & max_index;
-      continue;
-    }
-    // Our offset was in the bucket, but the flags didn't match.
-    // We're done if the value in the node had the round trip flag set.
-    if (expected & UADDR_OFFSET_ROUND_TRIP_FLAG) {
-      return;
-    }
-    // We wanted the round trip flag, but the value in the bucket didn't set it.
-    // Do a second swap to try to set it.
-    if (offsets[hash].compare_exchange_strong(expected, offset)) {
-      // It worked. We're done.
-      return;
-    }
-    if (expected == offset) {
-      // expected was the offset without the flag. After the swap it has the
-      // the flag. This means that some other thread set the flag, so
-      // we're done.
-      return;
-    }
-    // Something about the offset changed. We need to go around again, because:
-    //   our peer processed the old entry
-    //   another thread may have stolen the node while we were distracted
-  }
-}
-
-std::unique_ptr<vsoc::RegionWorker> vsoc::RegionView::StartWorker() {
-    std::unique_ptr<vsoc::RegionWorker> worker(
-            new vsoc::RegionWorker(this /* region */, control_));
-
-    worker->start();
-    return worker;
-}
-
-int vsoc::RegionView::WaitForSignal(std::atomic<uint32_t>* uaddr,
-                                     uint32_t expected_value) {
-  return control_->WaitForSignal(pointer_to_region_offset(uaddr),
-                                 expected_value);
-}
diff --git a/common/vsoc/lib/region_view.h b/common/vsoc/lib/region_view.h
deleted file mode 100644
index 055f721..0000000
--- a/common/vsoc/lib/region_view.h
+++ /dev/null
@@ -1,214 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Object that represents a region on the Host
-
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <atomic>
-#include <cstdint>
-
-#include <functional>
-#include <map>
-#include <thread>
-
-#include "common/libs/fs/shared_fd.h"
-#include "common/libs/glog/logging.h"
-#include "common/vsoc/lib/lock_guard.h"
-#include "common/vsoc/lib/region_control.h"
-#include "common/vsoc/lib/region_signaling_interface.h"
-#include "common/vsoc/shm/base.h"
-#include "uapi/vsoc_shm.h"
-
-namespace vsoc {
-
-class RegionControl;
-class RegionView;
-
-/**
- * Represents a task that is tied to a RegionView.
- *
- * This is currently used for the task that forwards futexes across the
- * shared memory window.
- */
-class RegionWorker {
- public:
-  RegionWorker(RegionView* region, std::shared_ptr<RegionControl> control);
-  ~RegionWorker();
-
-  void start();
-
-  void Work();
-
- protected:
-  std::shared_ptr<RegionControl> control_;
-  RegionView* region_;
-  std::thread thread_;
-  volatile bool stopping_;
-};
-
-/**
- * Base class to access a mapped region in VSoC shared memory.
- * This class holds the methods that depends on the region's memory having an
- * address. The RegionControl class holds the methods that can be invoked
- * without mapping the region.
- */
-class RegionView : public RegionSignalingInterface {
- public:
-  virtual ~RegionView();
-
-#if defined(CUTTLEFISH_HOST)
-  bool Open(const char* region_name, const char* domain);
-#else
-  bool Open(const char* region_name);
-#endif
-
-  // Returns a pointer to the table that will be scanned for signals
-  const vsoc_signal_table_layout& incoming_signal_table();
-
-  // Returns a pointer to the table that will be used to post signals
-  const vsoc_signal_table_layout& outgoing_signal_table();
-
-  // Returns true iff an interrupt is queued in the signal table
-  bool HasIncomingInterrupt() {
-    return *region_offset_to_pointer<std::atomic<uint32_t>>(
-        incoming_signal_table().interrupt_signalled_offset);
-  }
-
-  // Wake any threads waiting for an interrupt. This is generally used during
-  // shutdown.
-  void InterruptSelf() { control_->InterruptSelf(); }
-
-  // Interrupt our peer if an interrupt is not already on the way.
-  // Returns true if the interrupt was sent, false if an interrupt was already
-  // pending.
-  bool MaybeInterruptPeer();
-
-  // Scan in the incoming signal table, issuing futex calls for any posted
-  // signals and then reposting them to the peer if they were round-trip
-  // signals.
-  //
-  //   signal_handler: An action to perform on every offset signalled by our
-  //   peer, usually a FUTEX_WAKE call, but can be customized for other
-  //   purposes.
-  void ProcessSignalsFromPeer(
-      std::function<void(uint32_t)> signal_handler);
-
-  // Post a signal to the guest, the host, or both.
-  // See futex(2) FUTEX_WAKE for details.
-  //
-  //   sides_to_signal: controls where the signal is sent
-  //
-  //   signal_addr: the memory location to signal. Must be within the region.
-  void SendSignal(layout::Sides sides_to_signal,
-                  std::atomic<uint32_t>* signal_addr);
-
-  // Post a signal to our peer for a specific memeory location.
-  // See futex(2) FUTEX_WAKE for details.
-  //
-  //   signal_addr: the memory location to signal. Must be within the region.
-  //
-  //   round_trip: true if there may be waiters on both sides of the shared
-  //               memory.
-  void SendSignalToPeer(std::atomic<uint32_t>* signal_addr, bool round_trip);
-
-  // Waits until an interrupt appears on this region, then clears the
-  // interrupted flag and returns.
-  void WaitForInterrupt();
-
-  // This implements the following:
-  // if (*signal_addr == last_observed_value)
-  //   wait_for_signal_at(signal_addr);
-  //
-  // Note: the caller still needs to check the value at signal_addr because
-  // this function may return early for reasons that are implementation-defined.
-  // See futex(2) FUTEX_WAIT for details.
-  //
-  //   signal_addr: the memory that will be signaled. Must be within the region.
-  //
-  //   last_observed_value: the value that motivated the calling code to wait.
-  //
-  // The return value is -1 on error. On the guest positive values give the
-  // number of false wakes.
-  int WaitForSignal(std::atomic<uint32_t>* signal_addr,
-                     uint32_t last_observed_value) override;
-
-  // Starts the signal table scanner. This must be invoked by subclasses, which
-  // MUST store the returned unique_ptr as a class member.
-  __attribute__((warn_unused_result))
-  std::unique_ptr<RegionWorker> StartWorker();
-
-  // Returns a pointer to the start of region data that is cast to the given
-  // type.  Initializers that run in the launcher use this to get a typed view
-  // of the region. Most other cases should be handled via TypedRegionView.
-  template <typename LayoutType>
-  LayoutType* GetLayoutPointer() {
-    return this->region_offset_to_pointer<LayoutType>(
-        control_->region_desc().offset_of_region_data);
-  }
-
-  // Helper functions for lock guards. This approach has two advantages:
-  //
-  //   o Callers don't have to be refactored when lock types change
-  //   o The region pointer can be provided automatically
-  template <typename T>
-  LockGuard<T> make_lock_guard(T* lock) {
-    return LockGuard<T>(lock);
-  }
-
-  LockGuard<::vsoc::layout::GuestAndHostLock> make_lock_guard(
-      ::vsoc::layout::GuestAndHostLock* l) {
-    return LockGuard<::vsoc::layout::GuestAndHostLock>(l, this);
-  }
-
- protected:
-  template <typename T>
-  T* region_offset_to_pointer(uint32_t offset) {
-    return control_->region_offset_to_pointer<T>(offset);
-  }
-
-  template <typename T>
-  const T& region_offset_to_reference(uint32_t offset) const {
-    if (offset > control_->region_size()) {
-      LOG(FATAL) << __FUNCTION__ << ": " << offset << " not in region @"
-                 << region_base_;
-    }
-    return *reinterpret_cast<const T*>(
-        reinterpret_cast<uintptr_t>(region_base_) + offset);
-  }
-
-  // Calculates an offset based on a pointer in the region. Crashes if the
-  // pointer isn't in the region.
-  // This is mostly for the RegionView's internal plumbing. Use TypedRegionView
-  // and RegionLayout to avoid this in most cases.
-  template <typename T>
-  uint32_t pointer_to_region_offset(T* ptr) const {
-    uint32_t rval = reinterpret_cast<uintptr_t>(ptr) -
-                          reinterpret_cast<uintptr_t>(region_base_);
-    if (rval > control_->region_size()) {
-      LOG(FATAL) << __FUNCTION__ << ": " << ptr << " not in region @"
-                 << region_base_;
-    }
-    return rval;
-  }
-
-  std::shared_ptr<RegionControl> control_;
-  void* region_base_{};
-};
-
-}  // namespace vsoc
diff --git a/common/vsoc/lib/screen_layout.cpp b/common/vsoc/lib/screen_layout.cpp
deleted file mode 100644
index d302030..0000000
--- a/common/vsoc/lib/screen_layout.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "common/vsoc/shm/screen_layout.h"
-
-namespace vsoc {
-namespace layout {
-
-namespace screen {
-
-const char* ScreenLayout::region_name = "screen";
-
-}  // namespace screen
-}  // namespace layout
-}  // namespace vsoc
diff --git a/common/vsoc/lib/screen_region_view.cpp b/common/vsoc/lib/screen_region_view.cpp
deleted file mode 100644
index 2a22335..0000000
--- a/common/vsoc/lib/screen_region_view.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "common/vsoc/lib/screen_region_view.h"
-
-#include <memory>
-
-#include "common/libs/glog/logging.h"
-#include "common/vsoc/lib/lock_guard.h"
-
-using vsoc::layout::screen::CompositionStats;
-using vsoc::screen::ScreenRegionView;
-
-const uint8_t* ScreenRegionView::first_buffer() const {
-  // TODO(jemoreira): Add alignments?
-  return &(this->data().buffer[0]);
-}
-
-int ScreenRegionView::number_of_buffers() const {
-  auto offset_of_first_buffer =
-      const_cast<ScreenRegionView*>(this)->pointer_to_region_offset(
-          this->first_buffer());
-  size_t total_buffer_size = control_->region_size() - offset_of_first_buffer;
-  return total_buffer_size / buffer_size();
-}
-
-void* ScreenRegionView::GetBuffer(int buffer_idx) {
-  uint8_t* buffer = const_cast<uint8_t*>(this->first_buffer());
-  return buffer + buffer_idx * this->buffer_size();
-}
-
-// We can use a locking protocol because we decided that the streamer should
-// have more priority than the hwcomposer, so it's OK to block the hwcomposer
-// waiting for the streamer to complete, while the streamer will only block on
-// the hwcomposer when it has ran out of work to do and needs to get more from
-// the hwcomposer.
-void ScreenRegionView::BroadcastNewFrame(int buffer_idx,
-                                         const CompositionStats* stats) {
-  {
-    if (buffer_idx < 0 || buffer_idx >= number_of_buffers()) {
-      LOG(ERROR) << "Attempting to broadcast an invalid buffer index: "
-                 << buffer_idx;
-      return;
-    }
-    auto lock_guard(make_lock_guard(&data()->bcast_lock));
-    data()->seq_num++;
-    data()->buffer_index = static_cast<int32_t>(buffer_idx);
-    if (stats) {
-      data()->stats = *stats;
-    }
-  }
-  // Signaling after releasing the lock may cause spurious wake ups.
-  // Signaling while holding the lock may cause the just-awaken listener to
-  // block immediately trying to acquire the lock.
-  // The former is less costly and slightly less likely to happen.
-  SendSignal(layout::Sides::Both, &data()->seq_num);
-}
-
-int ScreenRegionView::WaitForNewFrameSince(uint32_t* last_seq_num,
-                                           CompositionStats* stats) {
-  static std::unique_ptr<RegionWorker> worker = StartWorker();
-  // It's ok to read seq_num here without holding the lock because the lock will
-  // be acquired immediately after so we'll block if necessary to wait for the
-  // critical section in BroadcastNewFrame to complete.
-  // Also, the call to WaitForSignal receives a pointer to seq_num (so the
-  // compiler should not optimize it out) and includes a memory barrier
-  // (FUTEX_WAIT).
-  while (data()->seq_num == *last_seq_num) {
-    // Don't hold the lock when waiting for a signal, will deadlock.
-    WaitForSignal(&data()->seq_num, *last_seq_num);
-  }
-
-  {
-    auto lock_guard(make_lock_guard(&data()->bcast_lock));
-    *last_seq_num = data()->seq_num;
-    if (stats) {
-      *stats = data()->stats;
-    }
-    return static_cast<int>(data()->buffer_index);
-  }
-}
diff --git a/common/vsoc/lib/screen_region_view.h b/common/vsoc/lib/screen_region_view.h
deleted file mode 100644
index aef4359..0000000
--- a/common/vsoc/lib/screen_region_view.h
+++ /dev/null
@@ -1,104 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <memory>
-
-#include "common/vsoc/lib/typed_region_view.h"
-#include "common/vsoc/shm/graphics.h"
-#include "common/vsoc/shm/screen_layout.h"
-#include "uapi/vsoc_shm.h"
-
-namespace vsoc {
-namespace screen {
-
-// Provides information related to the device's screen. Allows to query screen
-// properties such as resolution and dpi, as well as subscribe/notify to/of
-// changes on the screen contents. It also holds the contents of the display.
-class ScreenRegionView
-    : public vsoc::TypedRegionView<ScreenRegionView,
-                                   vsoc::layout::screen::ScreenLayout> {
- public:
-  static int align(int input) {
-    auto constexpr alignment = 16;
-    return (input + alignment - 1) & -alignment;
-  }
-
-  // Screen width in pixels
-  int x_res() const { return data().x_res; }
-
-  // Screen height in pixels
-  int y_res() const { return data().y_res; }
-
-  // Dots per inch
-  int dpi() const { return data().dpi; }
-
-  // Refresh rate in Hertz
-  int refresh_rate_hz() const { return data().refresh_rate_hz; }
-
-  uint32_t pixel_format() const { return kFbPixelFormat; }
-
-  uint32_t bytes_per_pixel() const {
-    return vsoc::PixelFormatProperties<kFbPixelFormat>::bytes_per_pixel;
-  }
-
-  int line_length() const { return align(x_res() * bytes_per_pixel()); }
-
-  size_t buffer_size() const {
-    return (align(x_res() * bytes_per_pixel()) * y_res()) + kSwiftShaderPadding;
-  }
-
-  int number_of_buffers() const;
-
-  // Gets a pointer to the beginning of a buffer. Does not perform any bound
-  // checks on the index.
-  void* GetBuffer(int buffer_idx);
-
-  // Broadcasts a new frame.
-  // buffer_idx is the index of the buffer containing the composed screen, it's
-  // a number in the range [0, number_of_buffers() - 1].
-  // Stats holds performance information of the last composition, can be null.
-  void BroadcastNewFrame(
-      int buffer_idx,
-      const vsoc::layout::screen::CompositionStats* stats = nullptr);
-
-  // Waits for a new frame (one with a different seq_num than last one we saw).
-  // Returns the index of the buffer containing the new frame or a negative
-  // number if there was an error, stores the new sequential number in
-  // *last_seq_num. The frame sequential numbers will be provided by the
-  // hwcomposer and expected to increase monotonically over time (though it's
-  // not a hard requirement), this numbers are guaranteed to be non-zero when a
-  // valid frame is available. Performance statistics are returned through the
-  // stats parameter when it's not null.
-  int WaitForNewFrameSince(
-      uint32_t* last_seq_num,
-      vsoc::layout::screen::CompositionStats* stats = nullptr);
-
-  using Pixel = uint32_t;
-  static constexpr int kSwiftShaderPadding = 4;
-  static constexpr int kRedShift = 0;
-  static constexpr int kGreenShift = 8;
-  static constexpr int kBlueShift = 16;
-  static constexpr int kRedBits = 8;
-  static constexpr int kGreenBits = 8;
-  static constexpr int kBlueBits = 8;
-  static constexpr uint32_t kFbPixelFormat = vsoc::VSOC_PIXEL_FORMAT_RGBA_8888;
-
- protected:
-  const uint8_t* first_buffer() const;
-};
-}  // namespace screen
-}  // namespace vsoc
diff --git a/common/vsoc/lib/screen_region_view_test.cpp b/common/vsoc/lib/screen_region_view_test.cpp
deleted file mode 100644
index cc02baa..0000000
--- a/common/vsoc/lib/screen_region_view_test.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "screen_region_view.h"
-#include "host/libs/config/cuttlefish_config.h"
-#include <stdio.h>
-
-using vsoc::screen::ScreenRegionView;
-
-int main() {
-  uint32_t frame_num = 0;
-  int buffer_id = 0;
-
-#if defined(CUTTLEFISH_HOST)
-  auto region = ScreenRegionView::GetInstance(vsoc::GetDomain().c_str());
-#else
-  auto region = ScreenRegionView::GetInstance();
-#endif
-  if (!region) {
-    fprintf(stderr, "Error opening region\n");
-    return 1;
-  }
-
-  while (1) {
-    buffer_id = region->WaitForNewFrameSince(&frame_num);
-    printf("Signaled frame_num = %d, buffer_id = %d\n", frame_num, buffer_id);
-  }
-
-  return 0;
-}
diff --git a/common/vsoc/lib/single_sided_signal.h b/common/vsoc/lib/single_sided_signal.h
deleted file mode 100644
index a40c792..0000000
--- a/common/vsoc/lib/single_sided_signal.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <unistd.h>
-#include <linux/futex.h>
-#include <sys/syscall.h>
-
-
-// Signaling mechanism that allows threads to signal changes to shared
-// memory and to wait for signals.
-
-namespace vsoc {
-/**
- * Defines the strategy for signaling among threads on a single kernel.
- */
-namespace SingleSidedSignal {
-/**
- * Waits for a signal, assuming the the word at addr matches expected_state.
- * Will return immediately if the value does not match.
- * Callers must be equipped to cope with spurious returns.
- */
-static void AwaitSignal(uint32_t expected_state, uint32_t* uaddr) {
-  syscall(SYS_futex, uaddr, FUTEX_WAIT, expected_state, nullptr, nullptr, 0);
-}
-
-/**
- * Sends a signal to every thread in AwaitSignal() using the address in
- * uaddr.
- */
-static void Signal(std::atomic<uint32_t>* uaddr) {
-  syscall(SYS_futex, reinterpret_cast<int32_t*>(uaddr), FUTEX_WAKE, -1, nullptr,
-          nullptr, 0);
-}
-}  // namespace SingleSidedSignal
-}  // namespace vsoc
diff --git a/common/vsoc/lib/socket_forward_layout.cpp b/common/vsoc/lib/socket_forward_layout.cpp
deleted file mode 100644
index 299ef70..0000000
--- a/common/vsoc/lib/socket_forward_layout.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2018 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 "common/vsoc/shm/socket_forward_layout.h"
-
-const char* vsoc::layout::socket_forward::SocketForwardLayout::region_name =
-  "socket_forward";
diff --git a/common/vsoc/lib/socket_forward_region_view.cpp b/common/vsoc/lib/socket_forward_region_view.cpp
deleted file mode 100644
index 2dbd2e8..0000000
--- a/common/vsoc/lib/socket_forward_region_view.cpp
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Copyright (C) 2018 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 <cassert>
-
-#include "common/vsoc/lib/circqueue_impl.h"
-#include "common/vsoc/lib/lock_guard.h"
-#include "common/vsoc/lib/socket_forward_region_view.h"
-#include "common/vsoc/shm/lock.h"
-#include "common/vsoc/shm/socket_forward_layout.h"
-
-using vsoc::layout::socket_forward::Queue;
-using vsoc::layout::socket_forward::QueuePair;
-// store the read and write direction as variables to keep the ifdefs and macros
-// in later code to a minimum
-constexpr auto ReadDirection = &QueuePair::
-#ifdef CUTTLEFISH_HOST
-                                   guest_to_host;
-#else
-                                   host_to_guest;
-#endif
-
-constexpr auto WriteDirection = &QueuePair::
-#ifdef CUTTLEFISH_HOST
-                                    host_to_guest;
-#else
-                                    guest_to_host;
-#endif
-
-using vsoc::socket_forward::SocketForwardRegionView;
-
-vsoc::socket_forward::Packet vsoc::socket_forward::Packet::MakeBegin(
-    std::uint16_t port) {
-  auto packet = MakePacket(Header::BEGIN);
-  std::memcpy(packet.payload(), &port, sizeof port);
-  packet.set_payload_length(sizeof port);
-  return packet;
-}
-
-void SocketForwardRegionView::Recv(int connection_id, Packet* packet) {
-  CHECK(packet != nullptr);
-  do {
-    (data()->queues_[connection_id].*ReadDirection)
-        .queue.Read(this, reinterpret_cast<char*>(packet), sizeof *packet);
-  } while (packet->IsBegin());
-  CHECK(!packet->empty()) << "zero-size data message received";
-  CHECK_LE(packet->payload_length(), kMaxPayloadSize) << "invalid size";
-}
-
-bool SocketForwardRegionView::Send(int connection_id, const Packet& packet) {
-  CHECK(!packet.empty());
-  CHECK_LE(packet.payload_length(), kMaxPayloadSize);
-
-  (data()->queues_[connection_id].*WriteDirection)
-      .queue.Write(this, packet.raw_data(), packet.raw_data_length());
-  return true;
-}
-
-int SocketForwardRegionView::IgnoreUntilBegin(int connection_id) {
-  Packet packet{};
-  do {
-    (data()->queues_[connection_id].*ReadDirection)
-        .queue.Read(this, reinterpret_cast<char*>(&packet), sizeof packet);
-  } while (!packet.IsBegin());
-  return packet.port();
-}
-
-constexpr int kNumQueues =
-    static_cast<int>(vsoc::layout::socket_forward::kNumQueues);
-
-void SocketForwardRegionView::CleanUpPreviousConnections() {
-  data()->Recover();
-
-  static constexpr auto kRestartPacket = Packet::MakeRestart();
-  for (int connection_id = 0; connection_id < kNumQueues; ++connection_id) {
-    Send(connection_id, kRestartPacket);
-  }
-}
-
-SocketForwardRegionView::ConnectionViewCollection
-SocketForwardRegionView::AllConnections() {
-  SocketForwardRegionView::ConnectionViewCollection all_queues;
-  for (int connection_id = 0; connection_id < kNumQueues; ++connection_id) {
-    all_queues.emplace_back(this, connection_id);
-  }
-  return all_queues;
-}
-
-// --- Connection ---- //
-
-void SocketForwardRegionView::ShmConnectionView::Receiver::Recv(Packet* packet) {
-  std::unique_lock<std::mutex> guard(receive_thread_data_lock_);
-  while (received_packet_free_) {
-    receive_thread_data_cv_.wait(guard);
-  }
-  CHECK(received_packet_.IsData());
-  *packet = received_packet_;
-  received_packet_free_ = true;
-  receive_thread_data_cv_.notify_one();
-}
-
-bool SocketForwardRegionView::ShmConnectionView::Receiver::GotRecvClosed() const {
-      return received_packet_.IsRecvClosed() || (received_packet_.IsRestart()
-#ifdef CUTTLEFISH_HOST
-                                              && saw_data_
-#endif
-                                              );
-}
-
-bool SocketForwardRegionView::ShmConnectionView::Receiver::ShouldReceiveAnotherPacket() const {
-        return (received_packet_.IsRecvClosed() && !saw_end_) ||
-             (saw_end_ && received_packet_.IsEnd())
-#ifdef CUTTLEFISH_HOST
-             || (received_packet_.IsRestart() && !saw_data_) ||
-             (received_packet_.IsBegin())
-#endif
-             ;
-}
-
-void SocketForwardRegionView::ShmConnectionView::Receiver::ReceivePacket() {
-  view_->region_view()->Recv(view_->connection_id(), &received_packet_);
-}
-
-void SocketForwardRegionView::ShmConnectionView::Receiver::CheckPacketForRecvClosed() {
-      if (GotRecvClosed()) {
-        saw_recv_closed_ = true;
-        view_->MarkOtherSideRecvClosed();
-      }
-#ifdef CUTTLEFISH_HOST
-      if (received_packet_.IsData()) {
-        saw_data_ = true;
-      }
-#endif
-}
-
-void SocketForwardRegionView::ShmConnectionView::Receiver::CheckPacketForEnd() {
-  if (received_packet_.IsEnd() || received_packet_.IsRestart()) {
-    CHECK(!saw_end_ || received_packet_.IsRestart());
-    saw_end_ = true;
-  }
-}
-
-
-bool SocketForwardRegionView::ShmConnectionView::Receiver::ExpectMorePackets() const {
-  return !saw_recv_closed_ || !saw_end_;
-}
-
-void SocketForwardRegionView::ShmConnectionView::Receiver::UpdatePacketAndSignalAvailable() {
-  if (!received_packet_.IsData()) {
-    static constexpr auto kEmptyPacket = Packet::MakeData();
-    received_packet_ = kEmptyPacket;
-  }
-  received_packet_free_ = false;
-  receive_thread_data_cv_.notify_one();
-}
-
-void SocketForwardRegionView::ShmConnectionView::Receiver::Start() {
-  while (ExpectMorePackets()) {
-    std::unique_lock<std::mutex> guard(receive_thread_data_lock_);
-    while (!received_packet_free_) {
-      receive_thread_data_cv_.wait(guard);
-    }
-
-    do {
-      ReceivePacket();
-      CheckPacketForRecvClosed();
-    } while (ShouldReceiveAnotherPacket());
-
-    if (received_packet_.empty()) {
-      LOG(ERROR) << "Received empty packet.";
-    }
-
-    CheckPacketForEnd();
-
-    UpdatePacketAndSignalAvailable();
-  }
-}
-
-auto SocketForwardRegionView::ShmConnectionView::ResetAndConnect()
-    -> ShmSenderReceiverPair {
-  if (receiver_) {
-    receiver_->Join();
-  }
-
-  {
-    std::lock_guard<std::mutex> guard(*other_side_receive_closed_lock_);
-    other_side_receive_closed_ = false;
-  }
-
-#ifdef CUTTLEFISH_HOST
-  region_view()->IgnoreUntilBegin(connection_id());
-  region_view()->Send(connection_id(), Packet::MakeBegin(port_));
-#else
-  region_view()->Send(connection_id(), Packet::MakeBegin(port_));
-  port_ =
-      region_view()->IgnoreUntilBegin(connection_id());
-#endif
-
-  receiver_.reset(new Receiver{this});
-  return {ShmSender{this}, ShmReceiver{this}};
-}
-
-#ifdef CUTTLEFISH_HOST
-auto SocketForwardRegionView::ShmConnectionView::EstablishConnection(int port)
-    -> ShmSenderReceiverPair {
-  port_ = port;
-  return ResetAndConnect();
-}
-#else
-auto SocketForwardRegionView::ShmConnectionView::WaitForNewConnection()
-    -> ShmSenderReceiverPair {
-  port_ = 0;
-  return ResetAndConnect();
-}
-#endif
-
-bool SocketForwardRegionView::ShmConnectionView::Send(const Packet& packet) {
-  if (packet.empty()) {
-    LOG(ERROR) << "Sending empty packet";
-  }
-  if (packet.IsData() && IsOtherSideRecvClosed()) {
-    return false;
-  }
-  return region_view()->Send(connection_id(), packet);
-}
-
-void SocketForwardRegionView::ShmConnectionView::Recv(Packet* packet) {
-  receiver_->Recv(packet);
-}
-
-void SocketForwardRegionView::ShmReceiver::Recv(Packet* packet) {
-  view_->Recv(packet);
-}
-
-bool SocketForwardRegionView::ShmSender::Send(const Packet& packet) {
-  return view_->Send(packet);
-}
diff --git a/common/vsoc/lib/socket_forward_region_view.h b/common/vsoc/lib/socket_forward_region_view.h
deleted file mode 100644
index c41517b..0000000
--- a/common/vsoc/lib/socket_forward_region_view.h
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * Copyright (C) 2018 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 <cstdlib>
-#include <utility>
-#include <vector>
-#include <memory>
-
-#include "common/vsoc/lib/typed_region_view.h"
-#include "common/vsoc/shm/socket_forward_layout.h"
-
-namespace vsoc {
-namespace socket_forward {
-
-struct Header {
-  std::uint32_t payload_length;
-  enum MessageType : std::uint32_t {
-    DATA = 0,
-    BEGIN,
-    END,
-    RECV_CLOSED,  // indicate that this side's receive end is closed
-    RESTART,
-  };
-  MessageType message_type;
-};
-
-constexpr std::size_t kMaxPayloadSize =
-    layout::socket_forward::kMaxPacketSize - sizeof(Header);
-
-struct Packet {
- private:
-  Header header_;
-  using Payload = char[kMaxPayloadSize];
-  Payload payload_data_;
-
-  static constexpr Packet MakePacket(Header::MessageType type) {
-    Packet packet{};
-    packet.header_.message_type = type;
-    return packet;
-  }
-
- public:
-  // port is only revelant on the host-side.
-  static Packet MakeBegin(std::uint16_t port);
-
-  static constexpr Packet MakeEnd() { return MakePacket(Header::END); }
-
-  static constexpr Packet MakeRecvClosed() {
-    return MakePacket(Header::RECV_CLOSED);
-  }
-
-  static constexpr Packet MakeRestart() { return MakePacket(Header::RESTART); }
-
-  // NOTE payload and payload_length must still be set.
-  static constexpr Packet MakeData() { return MakePacket(Header::DATA); }
-
-  bool empty() const { return IsData() && header_.payload_length == 0; }
-
-  void set_payload_length(std::uint32_t length) {
-    CHECK_LE(length, sizeof payload_data_);
-    header_.payload_length = length;
-  }
-
-  Payload& payload() { return payload_data_; }
-
-  const Payload& payload() const { return payload_data_; }
-
-  constexpr std::uint32_t payload_length() const {
-    return header_.payload_length;
-  }
-
-  constexpr bool IsBegin() const {
-    return header_.message_type == Header::BEGIN;
-  }
-
-  constexpr bool IsEnd() const { return header_.message_type == Header::END; }
-
-  constexpr bool IsData() const { return header_.message_type == Header::DATA; }
-
-  constexpr bool IsRecvClosed() const {
-    return header_.message_type == Header::RECV_CLOSED;
-  }
-
-  constexpr bool IsRestart() const {
-    return header_.message_type == Header::RESTART;
-  }
-
-  constexpr std::uint16_t port() const {
-    CHECK(IsBegin());
-    std::uint16_t port_number{};
-    CHECK_EQ(payload_length(), sizeof port_number);
-    std::memcpy(&port_number, payload(), sizeof port_number);
-    return port_number;
-  }
-
-  char* raw_data() { return reinterpret_cast<char*>(this); }
-
-  const char* raw_data() const { return reinterpret_cast<const char*>(this); }
-
-  constexpr size_t raw_data_length() const {
-    return payload_length() + sizeof header_;
-  }
-};
-
-static_assert(sizeof(Packet) == layout::socket_forward::kMaxPacketSize, "");
-static_assert(std::is_pod<Packet>{}, "");
-
-// Data sent will start with a uint32_t indicating the number of bytes being
-// sent, followed be the data itself
-class SocketForwardRegionView
-    : public TypedRegionView<SocketForwardRegionView,
-                             layout::socket_forward::SocketForwardLayout> {
- private:
-  // Returns an empty data packet if the other side is closed.
-  void Recv(int connection_id, Packet* packet);
-  // Returns true on success
-  bool Send(int connection_id, const Packet& packet);
-
-  // skip everything in the connection queue until seeing a BEGIN packet.
-  // returns port from begin packet.
-  int IgnoreUntilBegin(int connection_id);
-
- public:
-  class ShmSender;
-  class ShmReceiver;
-
-  using ShmSenderReceiverPair = std::pair<ShmSender, ShmReceiver>;
-
-  class ShmConnectionView {
-   public:
-    ShmConnectionView(SocketForwardRegionView* region_view, int connection_id)
-        : region_view_{region_view}, connection_id_{connection_id} {}
-
-#ifdef CUTTLEFISH_HOST
-    ShmSenderReceiverPair EstablishConnection(int port);
-#else
-    // Should not be called while there is an active ShmSender or ShmReceiver
-    // for this connection.
-    ShmSenderReceiverPair WaitForNewConnection();
-#endif
-
-    int port() const { return port_; }
-
-    bool Send(const Packet& packet);
-    void Recv(Packet* packet);
-
-    ShmConnectionView(const ShmConnectionView&) = delete;
-    ShmConnectionView& operator=(const ShmConnectionView&) = delete;
-
-    // Moving invalidates all existing ShmSenders and ShmReceiver
-    ShmConnectionView(ShmConnectionView&&) = default;
-    ShmConnectionView& operator=(ShmConnectionView&&) = default;
-    ~ShmConnectionView() = default;
-
-    // NOTE should only be used for debugging/logging purposes.
-    // connection_ids are an implementation detail that are currently useful for
-    // debugging, but may go away in the future.
-    int connection_id() const { return connection_id_; }
-
-   private:
-    SocketForwardRegionView* region_view() const { return region_view_; }
-
-    bool IsOtherSideRecvClosed() {
-      std::lock_guard<std::mutex> guard(*other_side_receive_closed_lock_);
-      return other_side_receive_closed_;
-    }
-
-    void MarkOtherSideRecvClosed() {
-      std::lock_guard<std::mutex> guard(*other_side_receive_closed_lock_);
-      other_side_receive_closed_ = true;
-    }
-
-    void ReceiverThread();
-    ShmSenderReceiverPair ResetAndConnect();
-
-    class Receiver {
-     public:
-      Receiver(ShmConnectionView* view)
-          : view_{view}
-      {
-        receiver_thread_ = std::thread([this] { Start(); });
-      }
-
-      void Recv(Packet* packet);
-
-      void Join() { receiver_thread_.join(); }
-
-      Receiver(const Receiver&) = delete;
-      Receiver& operator=(const Receiver&) = delete;
-
-      ~Receiver() = default;
-     private:
-      void Start();
-      bool GotRecvClosed() const;
-      void ReceivePacket();
-      void CheckPacketForRecvClosed();
-      void CheckPacketForEnd();
-      void UpdatePacketAndSignalAvailable();
-      bool ShouldReceiveAnotherPacket() const;
-      bool ExpectMorePackets() const;
-
-      std::mutex receive_thread_data_lock_;
-      std::condition_variable receive_thread_data_cv_;
-      bool received_packet_free_ = true;
-      Packet received_packet_{};
-
-      ShmConnectionView* view_{};
-      bool saw_recv_closed_ = false;
-      bool saw_end_ = false;
-#ifdef CUTTLEFISH_HOST
-      bool saw_data_ = false;
-#endif
-
-      std::thread receiver_thread_;
-    };
-
-    SocketForwardRegionView* region_view_{};
-    int connection_id_ = -1;
-    int port_ = -1;
-
-    std::unique_ptr<std::mutex> other_side_receive_closed_lock_ =
-        std::unique_ptr<std::mutex>{new std::mutex{}};
-    bool other_side_receive_closed_ = false;
-
-    std::unique_ptr<Receiver> receiver_;
-  };
-
-  class ShmSender {
-   public:
-    explicit ShmSender(ShmConnectionView* view) : view_{view} {}
-
-    ShmSender(const ShmSender&) = delete;
-    ShmSender& operator=(const ShmSender&) = delete;
-
-    ShmSender(ShmSender&&) = default;
-    ShmSender& operator=(ShmSender&&) = default;
-    ~ShmSender() = default;
-
-    // Returns true on success
-    bool Send(const Packet& packet);
-
-   private:
-    struct EndSender {
-      void operator()(ShmConnectionView* view) const {
-        if (view) {
-          view->Send(Packet::MakeEnd());
-        }
-      }
-    };
-
-    // Doesn't actually own the View, responsible for sending the End
-    // indicator and marking the sending side as disconnected.
-    std::unique_ptr<ShmConnectionView, EndSender> view_;
-  };
-
-  class ShmReceiver {
-   public:
-    explicit ShmReceiver(ShmConnectionView* view) : view_{view} {}
-    ShmReceiver(const ShmReceiver&) = delete;
-    ShmReceiver& operator=(const ShmReceiver&) = delete;
-
-    ShmReceiver(ShmReceiver&&) = default;
-    ShmReceiver& operator=(ShmReceiver&&) = default;
-    ~ShmReceiver() = default;
-
-    void Recv(Packet* packet);
-
-   private:
-    struct RecvClosedSender {
-      void operator()(ShmConnectionView* view) const {
-        if (view) {
-          view->Send(Packet::MakeRecvClosed());
-        }
-      }
-    };
-
-    // Doesn't actually own the view, responsible for sending the RecvClosed
-    // indicator
-    std::unique_ptr<ShmConnectionView, RecvClosedSender> view_{};
-  };
-
-  friend ShmConnectionView;
-
-  SocketForwardRegionView() = default;
-  ~SocketForwardRegionView() = default;
-  SocketForwardRegionView(const SocketForwardRegionView&) = delete;
-  SocketForwardRegionView& operator=(const SocketForwardRegionView&) = delete;
-
-  using ConnectionViewCollection = std::vector<ShmConnectionView>;
-  ConnectionViewCollection AllConnections();
-
-  int port(int connection_id);
-  void CleanUpPreviousConnections();
-
- private:
-#ifndef CUTTLEFISH_HOST
-  std::uint32_t last_seq_number_{};
-#endif
-};
-
-}  // namespace socket_forward
-}  // namespace vsoc
diff --git a/common/vsoc/lib/typed_region_view.h b/common/vsoc/lib/typed_region_view.h
deleted file mode 100644
index ead7412..0000000
--- a/common/vsoc/lib/typed_region_view.h
+++ /dev/null
@@ -1,104 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Object that represents a region on the Host
-
-#include "common/vsoc/lib/region_view.h"
-
-#include <map>
-#include <mutex>
-#include <string>
-
-namespace vsoc {
-
-/**
- * This class adds methods that depend on the Region's type.
- * This may be directly constructed. However, it may be more effective to
- * subclass it, adding region-specific methods.
- *
- * Layout should be VSoC shared memory compatible, defined in common/vsoc/shm,
- * and should have a constant string region name.
- */
-template <typename ViewType, typename LayoutType>
-class TypedRegionView : public RegionView {
- public:
-  using Layout = LayoutType;
-
-  /* Returns a pointer to the region with a type that matches the layout */
-  LayoutType* data() {
-    return this->GetLayoutPointer<LayoutType>();
-  }
-
-  const LayoutType& data() const {
-    return this->region_offset_to_reference<LayoutType>(
-        control_->region_desc().offset_of_region_data);
-  }
-
- protected:
-#if defined(CUTTLEFISH_HOST)
-  bool Open(const char* domain) {
-    return RegionView::Open(LayoutType::region_name, domain);
-  }
-#else
-  bool Open() {
-    return RegionView::Open(LayoutType::region_name);
-  }
-#endif
-
- public:
-  // Implementation of the region singletons.
-#if defined(CUTTLEFISH_HOST)
-  static ViewType* GetInstance(const char* domain) {
-    static std::mutex mtx;
-    static std::map<std::string, std::unique_ptr<ViewType>> instances;
-    if (!domain) {
-      return nullptr;
-    }
-    std::lock_guard<std::mutex> lock(mtx);
-    // Get a reference to the actual unique_ptr that's stored in the map, if
-    // there wasn't one it will be default constructed pointing to nullptr.
-    auto& instance = instances[domain];
-    if (!instance) {
-      // Update the referenced pointer with the address of the newly created
-      // region view.
-      instance.reset(new ViewType{});
-      if (!instance->Open(domain)) {
-        instance.reset();
-      }
-    }
-    return instance.get();
-  }
-#else
-  static ViewType* GetInstance() {
-    static std::mutex mtx;
-    static std::unique_ptr<ViewType> instance;
-    std::lock_guard<std::mutex> lock(mtx);
-    if (!instance) {
-      instance.reset(new ViewType{});
-      if (!instance->Open()) {
-        instance.reset();
-      }
-    }
-    return instance.get();
-  }
-#endif
-
-
-};
-
-}  // namespace vsoc
diff --git a/common/vsoc/lib/vsoc_audio_message.h b/common/vsoc/lib/vsoc_audio_message.h
deleted file mode 100644
index 230c4de..0000000
--- a/common/vsoc/lib/vsoc_audio_message.h
+++ /dev/null
@@ -1,99 +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 <stdlib.h>
-#include <stdint.h>
-#include <time.h>
-
-#include <system/audio.h>
-
-typedef uint32_t size32_t;
-
-struct timespec32 {
-  uint32_t tv_sec;
-  uint32_t tv_nsec;
-
-  timespec32() = default;
-
-  timespec32(const timespec &from)
-      : tv_sec(from.tv_sec),
-        tv_nsec(from.tv_nsec) {
-  }
-};
-
-struct gce_audio_message {
-  static const size32_t kMaxAudioFrameLen = 65536;
-  enum message_t {
-    UNKNOWN = 0,
-    DATA_SAMPLES = 1,
-    OPEN_INPUT_STREAM = 2,
-    OPEN_OUTPUT_STREAM = 3,
-    CLOSE_INPUT_STREAM = 4,
-    CLOSE_OUTPUT_STREAM = 5,
-    CONTROL_PAUSE = 100
-  };
-  // Size of the header + data. Used to frame when we're on TCP.
-  size32_t total_size;
-  // Size of the audio header
-  size32_t header_size;
-  message_t message_type;
-  // Identifier for the stream.
-  uint32_t stream_number;
-  // HAL assigned frame number, starts from 0.
-  int64_t frame_num;
-  // MONOTONIC_TIME when these frames were presented to the HAL.
-  timespec32 time_presented;
-  // Sample rate from the audio configuration.
-  uint32_t frame_rate;
-  // Channel mask from the audio configuration.
-  audio_channel_mask_t channel_mask;
-  // Format from the audio configuration.
-  audio_format_t format;
-  // Size of each frame in bytes.
-  size32_t frame_size;
-  // Number of frames that were presented to the HAL.
-  size32_t num_frames_presented;
-  // Number of frames that the HAL accepted.
-  //   For blocking audio this will be the same as num_frames.
-  //   For non-blocking audio this may be less.
-  size32_t num_frames_accepted;
-  // Count of the number of packets that were dropped because they would
-  // have blocked the HAL or exceeded the maximum message size.
-  size32_t num_packets_dropped;
-  // Count of the number of packets that were shortened to fit within
-  // kMaxAudioFrameLen.
-  size32_t num_packets_shortened;
-  // num_frames_presented (not num_frames_accepted) will follow here.
-
-  gce_audio_message() :
-      total_size(sizeof(gce_audio_message)),
-      header_size(sizeof(gce_audio_message)),
-      message_type(UNKNOWN),
-      stream_number(0),
-      frame_num(0),
-      frame_rate(0),
-      channel_mask(0),
-      format(AUDIO_FORMAT_DEFAULT),
-      frame_size(0),
-      num_frames_presented(0),
-      num_frames_accepted(0),
-      num_packets_dropped(0),
-      num_packets_shortened(0) {
-    time_presented.tv_sec = 0;
-    time_presented.tv_nsec = 0;
-  }
-};
diff --git a/common/vsoc/lib/vsoc_memory.cpp b/common/vsoc/lib/vsoc_memory.cpp
deleted file mode 100644
index 017ab13..0000000
--- a/common/vsoc/lib/vsoc_memory.cpp
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright (C) 2018 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 "common/vsoc/lib/vsoc_memory.h"
-
-#include <string.h>
-#include <unistd.h>
-
-#include <map>
-#include <string>
-#include <type_traits>
-
-#include "common/libs/glog/logging.h"
-#include "common/vsoc/shm/audio_data_layout.h"
-#include "common/vsoc/shm/base.h"
-#include "common/vsoc/shm/e2e_test_region_layout.h"
-#include "common/vsoc/shm/gralloc_layout.h"
-#include "common/vsoc/shm/input_events_layout.h"
-#include "common/vsoc/shm/managed_e2e_test_region_layout.h"
-#include "common/vsoc/shm/screen_layout.h"
-#include "common/vsoc/shm/socket_forward_layout.h"
-
-#include "uapi/vsoc_shm.h"
-
-namespace {
-
-// Takes a vector of objects and returns a vector of pointers to those objects.
-template <typename T, typename R>
-std::vector<R*> GetConstPointers(const std::vector<T>& v) {
-  std::vector<R*> result;
-  result.reserve(v.size());
-  for (auto& element : v) {
-    result.push_back(&element);
-  }
-  return result;
-}
-}  // namespace
-
-namespace vsoc {
-
-namespace {
-
-class VSoCRegionLayoutImpl : public VSoCRegionLayout {
- public:
-  VSoCRegionLayoutImpl(const char* region_name, size_t layout_size,
-                       int guest_to_host_signal_table_log_size,
-                       int host_to_guest_signal_table_log_size,
-                       const char* managed_by)
-      : region_name_(region_name),
-        layout_size_(layout_size),
-        guest_to_host_signal_table_log_size_(
-            guest_to_host_signal_table_log_size),
-        host_to_guest_signal_table_log_size_(
-            host_to_guest_signal_table_log_size),
-        managed_by_(managed_by) {
-  }
-  VSoCRegionLayoutImpl(const VSoCRegionLayoutImpl&) = default;
-
-  const char* region_name() const override { return region_name_; }
-  const char* managed_by() const override { return managed_by_; }
-
-  size_t layout_size() const override { return layout_size_; }
-  int guest_to_host_signal_table_log_size() const override {
-    return guest_to_host_signal_table_log_size_;
-  }
-  int host_to_guest_signal_table_log_size() const override {
-    return host_to_guest_signal_table_log_size_;
-  }
-
- private:
-  const char* region_name_{};
-  const size_t layout_size_{};
-  const int guest_to_host_signal_table_log_size_{};
-  const int host_to_guest_signal_table_log_size_{};
-  const char* managed_by_{};
-};
-
-class VSoCMemoryLayoutImpl : public VSoCMemoryLayout {
- public:
-  explicit VSoCMemoryLayoutImpl(std::vector<VSoCRegionLayoutImpl>&& regions)
-      : regions_(regions), region_idx_by_name_(GetNameToIndexMap(regions)) {
-    for (size_t i = 0; i < regions_.size(); ++i) {
-      // This link could be resolved later, but doing it here disables
-      // managed_by cycles among the regions.
-      if (regions[i].managed_by() &&
-          !region_idx_by_name_.count(regions[i].managed_by())) {
-        LOG(FATAL) << regions[i].region_name()
-                   << " managed by unknown region: " << regions[i].managed_by()
-                   << ". Manager Regions must be declared before the regions "
-                      "they manage";
-      }
-    }
-  }
-
-  ~VSoCMemoryLayoutImpl() = default;
-
-  std::vector<const VSoCRegionLayout*> GetRegions() const {
-    static std::vector<const VSoCRegionLayout*> ret =
-        GetConstPointers<VSoCRegionLayoutImpl, const VSoCRegionLayout>(
-            regions_);
-    return ret;
-  }
-
-  const VSoCRegionLayout* GetRegionByName(
-      const char* region_name) const override {
-    if (!region_idx_by_name_.count(region_name)) {
-      return nullptr;
-    }
-    return &regions_[region_idx_by_name_.at(region_name)];
-  }
-
- protected:
-  VSoCMemoryLayoutImpl() = delete;
-  VSoCMemoryLayoutImpl(const VSoCMemoryLayoutImpl&) = delete;
-
-  // Helper function to allow the creation of the name to index map in the
-  // constructor and allow the field to be const
-  static std::map<const char*, size_t> GetNameToIndexMap(
-      const std::vector<VSoCRegionLayoutImpl>& regions) {
-    std::map<const char*, size_t> result;
-    for (size_t index = 0; index < regions.size(); ++index) {
-      auto region_name = regions[index].region_name();
-      if (result.count(region_name)) {
-        LOG(FATAL) << region_name << " used for more than one region";
-      }
-      result[region_name] = index;
-    }
-    return result;
-  }
-
-  std::vector<VSoCRegionLayoutImpl> regions_;
-  const std::map<const char*, size_t> region_idx_by_name_;
-};
-
-template <class R>
-VSoCRegionLayoutImpl ValidateAndBuildLayout(int g_to_h_signal_table_log_size,
-                                            int h_to_g_signal_table_log_size,
-                                            const char* managed_by = nullptr) {
-  // Double check that the Layout is a valid shm type.
-  ASSERT_SHM_COMPATIBLE(R);
-  return VSoCRegionLayoutImpl(R::region_name, sizeof(R),
-                              g_to_h_signal_table_log_size,
-                              h_to_g_signal_table_log_size, managed_by);
-}
-
-}  // namespace
-
-VSoCMemoryLayout* VSoCMemoryLayout::Get() {
-  /*******************************************************************
-   * Make sure the first region is not the manager of other regions. *
-   *       This error will only be caught on runtime!!!!!            *
-   *******************************************************************/
-  static VSoCMemoryLayoutImpl layout(
-      {ValidateAndBuildLayout<layout::input_events::InputEventsLayout>(2, 2),
-       ValidateAndBuildLayout<layout::screen::ScreenLayout>(2, 2),
-       ValidateAndBuildLayout<layout::gralloc::GrallocManagerLayout>(2, 2),
-       ValidateAndBuildLayout<layout::gralloc::GrallocBufferLayout>(
-           0, 0,
-           /* managed_by */ layout::gralloc::GrallocManagerLayout::region_name),
-       ValidateAndBuildLayout<layout::socket_forward::SocketForwardLayout>(7,
-                                                                           7),
-       ValidateAndBuildLayout<layout::e2e_test::E2EPrimaryTestRegionLayout>(1,
-                                                                            1),
-       ValidateAndBuildLayout<layout::e2e_test::E2ESecondaryTestRegionLayout>(
-           1, 1),
-       ValidateAndBuildLayout<layout::e2e_test::E2EManagerTestRegionLayout>(1,
-                                                                            1),
-       ValidateAndBuildLayout<layout::e2e_test::E2EManagedTestRegionLayout>(1,
-                                                                            1),
-       ValidateAndBuildLayout<layout::audio_data::AudioDataLayout>(2, 2)});
-
-  // We need this code to compile on both sides to enforce the static checks,
-  // but should only be used host side.
-#if !defined(CUTTLEFISH_HOST)
-  LOG(FATAL) << "Memory layout should not be used guest side, use region "
-                "classes or the vsoc driver directly instead.";
-#endif
-  return &layout;
-}
-
-}  // namespace vsoc
diff --git a/common/vsoc/lib/vsoc_memory.h b/common/vsoc/lib/vsoc_memory.h
deleted file mode 100644
index 49853f9..0000000
--- a/common/vsoc/lib/vsoc_memory.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2018 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 <stdint.h>
-
-#include <vector>
-
-namespace vsoc {
-
-class VSoCRegionLayout {
- public:
-  virtual const char* region_name() const = 0;
-  virtual const char* managed_by() const = 0;
-
-  virtual size_t layout_size() const = 0;
-  virtual int guest_to_host_signal_table_log_size() const = 0;
-  virtual int host_to_guest_signal_table_log_size() const = 0;
- protected:
-  VSoCRegionLayout() = default;
-  virtual ~VSoCRegionLayout() = default;
-};
-
-class VSoCMemoryLayout {
- public:
-  // Returns a pointer to the memory layout singleton.
-  static VSoCMemoryLayout* Get();
-
-  VSoCMemoryLayout(const VSoCMemoryLayout&) = delete;
-  VSoCMemoryLayout(VSoCMemoryLayout&&) = delete;
-
-  virtual std::vector<const VSoCRegionLayout *> GetRegions() const = 0;
-  virtual const VSoCRegionLayout* GetRegionByName(
-      const char* region_name) const = 0;
- protected:
-  VSoCMemoryLayout() = default;
-  virtual ~VSoCMemoryLayout() = default;
-};
-
-}  // namespace vsoc
diff --git a/common/vsoc/shm/audio_data_layout.h b/common/vsoc/shm/audio_data_layout.h
deleted file mode 100644
index 3991ea0..0000000
--- a/common/vsoc/shm/audio_data_layout.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2018 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 "common/vsoc/shm/base.h"
-#include "common/vsoc/shm/circqueue.h"
-
-// Memory layout for region carrying audio data from audio HAL to client.
-
-namespace vsoc {
-namespace layout {
-namespace audio_data {
-
-struct AudioDataLayout : public RegionLayout {
-    static const char *const region_name;
-    static constexpr size_t layout_size = 16396;
-
-    // size = 2^14 = 16384, packets are up to 4KB bytes each.
-    CircularPacketQueue<14, 4096> audio_queue;
-};
-ASSERT_SHM_COMPATIBLE(AudioDataLayout);
-
-}  // namespace audio_data
-}  // namespace layout
-}  // namespace vsoc
diff --git a/common/vsoc/shm/base.h b/common/vsoc/shm/base.h
deleted file mode 100644
index f5abec8..0000000
--- a/common/vsoc/shm/base.h
+++ /dev/null
@@ -1,82 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdint.h>
-#include <type_traits>
-
-// Base macros for all layout structures.
-// ShmTypeValidator provides meaningful information about the type size
-// mismatch in compilation error messages, eg.
-//
-// error:
-//    static_assert failed "Class size changed, update the layout_size field"
-//    static_assert(Current == Expected,
-// note: in instantiation of template class
-//    'ShmTypeValidator<vsoc::layout::myclass::ClassName>'
-//    requested here ASSERT_SHM_COMPATIBLE(ClassName);
-//
-template <typename Type, size_t expected_size = Type::layout_size>
-struct ShmTypeValidator {
-  static_assert(sizeof(Type) == expected_size,
-                "Class size changed, update the layout_size field");
-  static_assert(std::is_trivial<Type>(), "Class uses features that are unsafe");
-  static constexpr bool valid =
-      sizeof(Type) == expected_size && std::is_trivial<Type>();
-};
-
-#define ASSERT_SHM_COMPATIBLE(T)            \
-  static_assert(ShmTypeValidator<T>::valid, \
-                "Compilation error. Please fix above errors and retry.")
-
-namespace vsoc {
-namespace layout {
-
-/**
- * Memory is shared between Guest and Host kernels. In some cases we need
- * flag to indicate which side we're on. In those cases we'll use this
- * simple structure.
- *
- * These are carefully formatted to make Guest and Host a bitfield.
- */
-enum Sides : uint32_t {
-  NoSides = 0,
-  Guest = 1,
-  Host = 2,
-  Both = 3,
-#ifdef CUTTLEFISH_HOST
-  OurSide = Host,
-  Peer = Guest
-#else
-  OurSide = Guest,
-  Peer = Host
-#endif
-};
-// Enums can't have static members, so can't use the macro here.
-  static_assert(ShmTypeValidator<Sides, 4>::valid,
-              "Compilation error. Please fix above errors and retry.");
-
-/**
- * Base class for all region layout structures.
- */
-class RegionLayout {
-public:
-  static constexpr size_t layout_size = 1;
-};
-ASSERT_SHM_COMPATIBLE(RegionLayout);
-
-}  // namespace layout
-}  // namespace vsoc
diff --git a/common/vsoc/shm/circqueue.h b/common/vsoc/shm/circqueue.h
deleted file mode 100644
index 05893bf..0000000
--- a/common/vsoc/shm/circqueue.h
+++ /dev/null
@@ -1,203 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Memory layout for byte-oriented circular queues
-
-#include <atomic>
-#include <cstdint>
-#include "common/vsoc/shm/base.h"
-#include "common/vsoc/shm/lock.h"
-
-struct iovec;
-
-namespace vsoc {
-class RegionSignalingInterface;
-namespace layout {
-
-/**
- * Base classes for all spinlock protected circular queues.
- * This class should be embedded in the per-region data structure that is used
- * as the parameter to TypedRegion.
- */
-template <uint32_t SizeLog2>
-class CircularQueueBase {
- public:
-  static constexpr size_t layout_size = (1 << SizeLog2) + 12;
-
- private:
-  CircularQueueBase() = delete;
-  CircularQueueBase(const CircularQueueBase&) = delete;
-  CircularQueueBase& operator=(const CircularQueueBase&) = delete;
-
- protected:
-  /**
-   * Specifies a part of the queue. Note, the given indexes must be masked
-   * before they can be used against buffer_
-   */
-  struct Range {
-    // Points to the first bytes that is part of the range
-    uint32_t start_idx;
-    // Points to the first byte that is not in the range. This is similar to
-    // the STL end iterator.
-    uint32_t end_idx;
-  };
-  static const uintptr_t BufferSize = (1 << SizeLog2);
-
-  /**
-   * Copy bytes from buffer_in into the part of the queue specified by Range.
-   */
-  void CopyInRange(const char* buffer_in, const Range& t);
-
-  /**
-   * Copy the bytes specified by range to the given buffer. They caller must
-   * ensure that the buffer is large enough to hold the content of the range.
-   */
-  void CopyOutRange(const Range& t, char* buffer_out);
-
-  /**
-   * Wait until data becomes available in the queue. The caller must have
-   * called Lock() before invoking this. The caller must call Unlock()
-   * after this returns.
-   */
-  void WaitForDataLocked(RegionSignalingInterface* r);
-
-  /**
-   * Reserve space in the queue for writing. The caller must have called Lock()
-   * before invoking this. The caller must call Unlock() after this returns.
-   * Indexes pointing to the reserved space will be placed in range.
-   * On success this returns bytes.
-   * On failure a negative errno indicates the problem. -ENOSPC indicates that
-   * bytes > the queue size, -EWOULDBLOCK indicates that the call would block
-   * waiting for space but was requested non bloking.
-   */
-  intptr_t WriteReserveLocked(RegionSignalingInterface* r, size_t bytes,
-                              Range* t, bool non_blocking);
-
-  bool RecoverBase() {
-    return lock_.Recover();
-  }
-
-  // Note: Both of these fields may hold values larger than the buffer size,
-  // they should be interpreted modulo the buffer size. This fact along with the
-  // buffer size being a power of two greatly simplyfies the index calculations.
-  // Advances when a reader has finished with buffer space
-  std::atomic<uint32_t> r_released_;
-  // Advances when buffer space is filled and ready for a reader
-  std::atomic<uint32_t> w_pub_;
-  // Spinlock that protects the region. 0 means unlocked
-  SpinLock lock_;
-  // The actual memory in the buffer
-  char buffer_[BufferSize];
-};
-using CircularQueueBase64k = CircularQueueBase<16>;
-ASSERT_SHM_COMPATIBLE(CircularQueueBase64k);
-
-/**
- * Byte oriented circular queue. Reads will always return some data, but
- * may return less data than requested. Writes will always write all of the
- * data or return an error.
- */
-template <uint32_t SizeLog2>
-class CircularByteQueue : public CircularQueueBase<SizeLog2> {
- public:
-  static constexpr size_t layout_size =
-      CircularQueueBase<SizeLog2>::layout_size;
-  /**
-   * Read at most max_size bytes from the qeueue, placing them in buffer_out
-   */
-  intptr_t Read(RegionSignalingInterface* r, char* buffer_out,
-                std::size_t max_size);
-  /**
-   * Write all of the given bytes into the queue. If non_blocking isn't set the
-   * call may block until there is enough available space in the queue. On
-   * success the return value will match bytes. On failure a negative errno is
-   * returned. -ENOSPC: If the queue size is smaller than the number of bytes to
-   * write. -EWOULDBLOCK: If non_blocking is true and there is not enough free
-   * space.
-   */
-  intptr_t Write(RegionSignalingInterface* r, const char* buffer_in,
-                 std::size_t bytes, bool non_blocking = false);
-
-  bool Recover() {
-    return this->RecoverBase();
-  }
-
- protected:
-  using Range = typename CircularQueueBase<SizeLog2>::Range;
-};
-using CircularByteQueue64k = CircularByteQueue<16>;
-ASSERT_SHM_COMPATIBLE(CircularByteQueue64k);
-
-/**
- * Packet oriented circular queue. Reads will either return data or an error.
- * Each return from read corresponds to a call to write and returns all of the
- * data from that corresponding Write().
- */
-template <uint32_t SizeLog2, uint32_t MaxPacketSize>
-class CircularPacketQueue : public CircularQueueBase<SizeLog2> {
- public:
-  static constexpr size_t layout_size =
-      CircularQueueBase<SizeLog2>::layout_size;
-
-  /**
-   * Read a single packet from the queue, placing its data into buffer_out.
-   * If max_size indicates that buffer_out cannot hold the entire packet
-   * this function will return -ENOSPC.
-   */
-  intptr_t Read(RegionSignalingInterface* r, char* buffer_out,
-                std::size_t max_size);
-
-  /**
-   * Writes [buffer_in, buffer_in + bytes) to the queue.
-   * If the number of bytes to be written exceeds the size of the queue
-   * -ENOSPC will be returned.
-   * If non_blocking is true and there is not enough free space on the queue to
-   * write all the data -EWOULDBLOCK will be returned.
-   */
-  intptr_t Write(RegionSignalingInterface* r, const char* buffer_in,
-                 uint32_t bytes, bool non_blocking = false);
-
-  /**
-   * Writes the data referenced by the given iov scatter/gather array to the
-   * queue.
-   * If the number of bytes to be written exceeds the size of the queue
-   * -ENOSPC will be returned.
-   * If non_blocking is true and there is not enough free space on the queue to
-   * write all the data -EWOULDBLOCK will be returned.
-   */
-  intptr_t Writev(
-          RegionSignalingInterface *r,
-          const iovec *iov,
-          size_t iov_count,
-          bool non_blocking = false);
-
-  bool Recover() {
-    return this->RecoverBase();
-  }
-
- protected:
-  static_assert(CircularQueueBase<SizeLog2>::BufferSize >= MaxPacketSize,
-                "Buffer is too small to hold the maximum sized packet");
-  using Range = typename CircularQueueBase<SizeLog2>::Range;
-  intptr_t CalculateBufferedSize(size_t payload);
-};
-using CircularPacketQueue64k = CircularPacketQueue<16, 1024>;
-ASSERT_SHM_COMPATIBLE(CircularPacketQueue64k);
-
-}  // namespace layout
-}  // namespace vsoc
diff --git a/common/vsoc/shm/e2e_test_region_layout.h b/common/vsoc/shm/e2e_test_region_layout.h
deleted file mode 100644
index f3ae615..0000000
--- a/common/vsoc/shm/e2e_test_region_layout.h
+++ /dev/null
@@ -1,168 +0,0 @@
-#pragma once
-/*
- * 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 <atomic>
-#include <cstdint>
-#include "common/vsoc/shm/base.h"
-
-// Memory layout for a region that supports end-to-end (E2E) testing of
-// shared memory regions. This verifies that all sorts of things work along the
-// the path:
-//
-//   host libraries <-> ivshmem server <-> kernel <-> guest libraries
-//
-// This is intentionally not a unit test. The primary source of errors along
-// this path is a misunderstanding and/or inconsistency in one of the
-// interfaces. Introducing mocks would allow these errors to go undetected.
-// Another way of looking at it is that the mocks would end up being a
-// a copy-and-paste job, making a series of change-detector tests.
-//
-// These tests are actually run on every device boot to verify that things are
-// ok.
-
-namespace vsoc {
-namespace layout {
-
-namespace e2e_test {
-
-/**
- * Flags that are used to indicate test status. Some of the latter testing
- * stages rely on initializion that must be done on the peer.
- */
-enum E2ETestStage : uint32_t {
-  // No tests have passed
-  E2E_STAGE_NONE = 0,
-  // This side has finished writing its pattern to the region
-  E2E_MEMORY_FILLED = 1,
-  // This side has confirmed that it can see its peer's writes to the region
-  E2E_PEER_MEMORY_READ = 2,
-};
-static_assert(ShmTypeValidator<E2ETestStage, 4>::valid,
-              "Compilation error. Please fix above errors and retry.");
-
-/**
- * Structure that grants permission to write in the region to either the guest
- * or the host. This size of these fields is arbitrary.
- */
-struct E2EMemoryFill {
-  static constexpr size_t layout_size = 64;
-
-  static const std::size_t kOwnedFieldSize = 32;
-
-  // The compiler must not attempt to optimize away reads and writes to the
-  // shared memory window. This is pretty typical when dealing with devices
-  // doing memory mapped I/O.
-  char host_writable[kOwnedFieldSize];
-  char guest_writable[kOwnedFieldSize];
-};
-ASSERT_SHM_COMPATIBLE(E2EMemoryFill);
-
-/**
- * Structure that grants permission to write in the region to either the guest
- * or the host. This size of these fields is arbitrary.
- */
-class E2ETestStageRegister {
- public:
-  static constexpr size_t layout_size = 4;
-
-  E2ETestStage value() const {
-    return value_;
-  }
-
-  void set_value(E2ETestStage new_value) { value_ = new_value; }
-
- protected:
-  // The compiler must not attempt to optimize away reads and writes to the
-  // shared memory window. This is pretty typical when dealing with devices
-  // doing memory mapped I/O.
-  E2ETestStage value_;
-};
-ASSERT_SHM_COMPATIBLE(E2ETestStageRegister);
-
-/**
- * Describes the layout of the regions used for the end-to-end test. There
- * are multiple regions: primary and secondary, so some details like the region
- * name must wait until later.
- */
-class E2ETestRegionLayout : public ::vsoc::layout::RegionLayout {
- public:
-  static constexpr size_t layout_size = 2 * E2ETestStageRegister::layout_size +
-                                        3 * 4 + E2EMemoryFill::layout_size;
-
-  /**
-   * Computes how many E2EMemoryFill records we need to cover the region.
-   * Covering the entire region during the test ensures that everything is
-   * mapped and coherent between guest and host.
-   */
-  static std::size_t NumFillRecords(std::size_t region_size) {
-    if (region_size < sizeof(E2ETestRegionLayout)) {
-      return 0;
-    }
-    // 1 + ... An array of size 1 is allocated in the E2ETestRegion.
-    // TODO(ghartman): AddressSanitizer may find this sort of thing to be
-    // alarming.
-    return 1 +
-           (region_size - sizeof(E2ETestRegionLayout)) / sizeof(E2EMemoryFill);
-  }
-  // The number of test stages that have completed on the guest
-  // Later host tests will wait on this
-  E2ETestStageRegister guest_status;
-  // The number of test stages that have completed on the host
-  // Later guest tests will wait on this
-  E2ETestStageRegister host_status;
-  // These fields are used to test the signaling mechanism.
-  std::atomic<uint32_t> host_to_guest_signal;
-  std::atomic<uint32_t> guest_to_host_signal;
-  std::atomic<uint32_t> guest_self_register;
-  // There rest of the region will be filled by guest_host_strings.
-  // We actually use more than one of these, but we can't know how many
-  // until we examine the region.
-  E2EMemoryFill data[1];
-};
-ASSERT_SHM_COMPATIBLE(E2ETestRegionLayout);
-
-struct E2EPrimaryTestRegionLayout : public E2ETestRegionLayout {
-  static constexpr size_t layout_size = E2ETestRegionLayout::layout_size;
-
-  static const char* region_name;
-  static const char guest_pattern[E2EMemoryFill::kOwnedFieldSize];
-  static const char host_pattern[E2EMemoryFill::kOwnedFieldSize];
-};
-ASSERT_SHM_COMPATIBLE(E2EPrimaryTestRegionLayout);
-
-struct E2ESecondaryTestRegionLayout : public E2ETestRegionLayout {
-  static constexpr size_t layout_size = E2ETestRegionLayout::layout_size;
-
-  static const char* region_name;
-  static const char guest_pattern[E2EMemoryFill::kOwnedFieldSize];
-  static const char host_pattern[E2EMemoryFill::kOwnedFieldSize];
-};
-ASSERT_SHM_COMPATIBLE(E2ESecondaryTestRegionLayout);
-
-/**
- * Defines an end-to-end region with a name that should never be configured.
- */
-struct E2EUnfindableRegionLayout : public E2ETestRegionLayout {
-  static constexpr size_t layout_size = E2ETestRegionLayout::layout_size;
-
-  static const char* region_name;
-};
-ASSERT_SHM_COMPATIBLE(E2EUnfindableRegionLayout);
-
-}  // namespace e2e_test
-}  // namespace layout
-}  // namespace vsoc
diff --git a/common/vsoc/shm/gralloc_layout.h b/common/vsoc/shm/gralloc_layout.h
deleted file mode 100644
index 4da740f..0000000
--- a/common/vsoc/shm/gralloc_layout.h
+++ /dev/null
@@ -1,75 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "common/vsoc/shm/base.h"
-#include "common/vsoc/shm/graphics.h"
-#include "common/vsoc/shm/lock.h"
-
-// Memory layout for the gralloc manager region.
-
-namespace vsoc {
-namespace layout {
-
-namespace gralloc {
-
-struct BufferEntry {
-  static constexpr size_t layout_size =
-      7 * 4 + PixelFormatRegister::layout_size;
-
-  uint32_t owned_by;
-  uint32_t buffer_begin;
-  uint32_t buffer_end;
-
-  PixelFormatRegister pixel_format;
-  uint32_t stride;
-  uint32_t width;
-  uint32_t height;
-
-  // A size of 28 is causing different layouts when GrallocManagerLayout is
-  // compiled in host and guest sides
-  uint32_t padding;
-
-  uint32_t buffer_size() {
-    return buffer_end - buffer_begin;
-  }
-};
-ASSERT_SHM_COMPATIBLE(BufferEntry);
-
-struct GrallocBufferLayout : public RegionLayout {
-  static constexpr size_t layout_size = 1;
-  static const char* region_name;
-};
-ASSERT_SHM_COMPATIBLE(GrallocBufferLayout);
-
-struct GrallocManagerLayout : public RegionLayout {
-  static constexpr size_t layout_size =
-      8 + GuestLock::layout_size + BufferEntry::layout_size;
-  static const char* region_name;
-  typedef GrallocBufferLayout ManagedRegion;
-
-  uint32_t allocated_buffer_memory;
-  uint32_t buffer_count;
-  // Make sure this isn't the first field
-  GuestLock new_buffer_lock;
-  // Needs to be last field
-  BufferEntry buffers_table[1];
-};
-ASSERT_SHM_COMPATIBLE(GrallocManagerLayout);
-
-} // namespace gralloc
-} // namespace layout
-} // namespace vsoc
diff --git a/common/vsoc/shm/graphics.h b/common/vsoc/shm/graphics.h
deleted file mode 100644
index 0aa7875..0000000
--- a/common/vsoc/shm/graphics.h
+++ /dev/null
@@ -1,169 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Memory layout for primitive graphics types.
-
-// The vsoc::layout namespace indicates that these are shared memory structure
-// definitions. The #include's given above are strictly limited, as are the
-// types that can be referenced below.
-
-#include <cstdint>
-
-#include "common/vsoc/shm/base.h"
-
-namespace vsoc {
-
-// The enumerations for VSoC pixel formats are laid out so that hardware to
-// parse bytes per pixel without relying an a exhaustive list of pixel formats.
-// These constants define the fields involved.
-namespace PixelFormatConst {
-  static const uint32_t BytesPerPixelSize = 3;
-  static const uint32_t SubformatSize = 3;
-  static const uint32_t MaxBytesPerPixel = (1 << BytesPerPixelSize);
-  static const uint32_t MaxSubformat = (1 << SubformatSize) - 1;
-};
-
-
-// Builds (statically) a new pixel format enumeration value given constant
-// bytes per pixel.
-template <uint32_t BYTES, uint32_t SUB_FORMAT>
-struct PixelFormatBuilder {
-  static_assert(BYTES > 0, "Too few bytes");
-  static_assert(BYTES <= PixelFormatConst::MaxBytesPerPixel, "Too many bytes");
-  static_assert(SUB_FORMAT <= PixelFormatConst::MaxSubformat,
-                "Too many subformats");
-  static const uint32_t value = ((BYTES - 1) << PixelFormatConst::SubformatSize) | SUB_FORMAT;
-};
-
-template <uint32_t FORMAT>
-struct PixelFormatProperties {
-  // No static asserts since all int32_t values are (technically) valid pixel formats?
-  static const uint32_t bytes_per_pixel = (FORMAT >> PixelFormatConst::SubformatSize) + 1;
-};
-
-// Contains all of the pixel formats currently supported by this VSoC. The
-// enumeration serves multiple purposes:
-//
-//   * The compile will warn (or error) if we switch on PixelFormat and don't
-//     handly all of the cases.
-//
-//   * Code can use PixelFormat to describe paramaters, making APIs a bit more
-//     self-documenting.
-//
-//   * Observant reviewers can verify that the same pixel value is not assigned
-//     to multiple formats. Keep the enums in numerical order below to
-//     make this easier.
-enum PixelFormat : uint32_t {
-  VSOC_PIXEL_FORMAT_UNINITIALIZED = PixelFormatBuilder<1,0>::value,
-  VSOC_PIXEL_FORMAT_BLOB =          PixelFormatBuilder<1,1>::value,
-
-  VSOC_PIXEL_FORMAT_RGB_565 =       PixelFormatBuilder<2,0>::value,
-  VSOC_PIXEL_FORMAT_YV12 =          PixelFormatBuilder<2,1>::value,
-  VSOC_PIXEL_FORMAT_YCbCr_420_888 = PixelFormatBuilder<2,2>::value,
-
-  VSOC_PIXEL_FORMAT_RGB_888 =       PixelFormatBuilder<3,0>::value,
-
-  VSOC_PIXEL_FORMAT_RGBA_8888 =     PixelFormatBuilder<4,0>::value,
-  VSOC_PIXEL_FORMAT_RGBX_8888 =     PixelFormatBuilder<4,1>::value,
-  VSOC_PIXEL_FORMAT_BGRA_8888 =     PixelFormatBuilder<4,2>::value,
-
-  VSOC_PIXEL_FORMAT_RGBA_FP16 =     PixelFormatBuilder<8,0>::value,
-
-  // VSOC_PIXEL_FORMAT_IMPLEMENTATION_DEFINED intentionally left out. The HALs
-  // should choose one of the defined contrete types.
-  //
-  // The following formats are defined in various platform versions, but don't
-  // seem to be used. If we encounter them it's ok to add them to the table.
-  // This does not necessitate a version change.
-  //
-  // The following have been in the framework for a long time:
-  //
-  //   VSOC_PIXEL_FORMAT_YCrCb_420_SP
-  //   VSOC_PIXEL_FORMAT_YCbCr_422_SP
-  //
-  // The following were added in JB_MR2:
-  //
-  //   VSOC_PIXEL_FORMAT_YCbCr_420_888
-  //   VSOC_PIXEL_FORMAT_Y8
-  //   VSOC_PIXEL_FORMAT_Y16
-  //
-  // The following were added in L:
-  //
-  //    VSOC_PIXEL_FORMAT_RAW_OPAQUE
-  //    VSOC_PIXEL_FORMAT_RAW16 (also known as RAW_SENSOR. Define only RAW16)
-  //    VSOC_PIXEL_FORMAT_RAW10
-  //
-  // The following were added in L MR1:
-  //
-  //   VSOC_PIXEL_FORMAT_YCbCr_444_888
-  //   VSOC_PIXEL_FORMAT_YCbCr_422_888
-  //   VSOC_PIXEL_FORMAT_RAW12
-  //   VSOC_PIXEL_FORMAT_FLEX_RGBA_8888
-  //   VSOC_PIXEL_FORMAT_FLEX_RGB_888
-  //
-  // These pixel formats were removed in later framework versions. Implement
-  // only if absolutely necessary.
-  //
-  // Support was dropped in K for:
-  //
-  //   VSOC_PIXEL_FORMAT_RGBA_5551
-  //   VSOC_PIXEL_FORMAT_RGBA_4444
-  //
-  // Supported only in K, L, and LMR1:
-  //
-  //   VSOC_PIXEL_FORMAT_sRGB_X_8888
-  //   VSOC_PIXEL_FORMAT_sRGB_A_8888
-};
-// Enums can't have static members, so can't use the macro here.
-static_assert(ShmTypeValidator<PixelFormat, 4>::valid,
-              "Compilation error. Please fix above errors and retry.");
-
-namespace layout {
-
-// VSoC memory layout for a register that accepts a single pixel format.
-// The value is volatile to ensure that the compiler does not eliminate stores.
-struct PixelFormatRegister {
-  static constexpr size_t layout_size = 4;
-
-  volatile PixelFormat value_;
-};
-ASSERT_SHM_COMPATIBLE(PixelFormatRegister);
-
-// Register layout for a mask giving different PixelFormats. Reserve enough
-// space to allow for future expansion. For example, we may well end with
-// a 12 bit per channel format in the future.
-struct PixelFormatMaskRegister {
-  static constexpr size_t layout_size = 8;
-
-  volatile uint64_t value_;
-
-  bool HasValue(PixelFormat in) {
-    return !!(value_ & (uint64_t(1) << in));
-  }
-};
-ASSERT_SHM_COMPATIBLE(PixelFormatMaskRegister);
-
-// Ensure that the mask is large enough to hold the highest encodable
-// pixel format.
-static_assert(PixelFormatBuilder<
-              PixelFormatConst::MaxBytesPerPixel,
-              PixelFormatConst::MaxSubformat>::value <
-              8 * sizeof(PixelFormatMaskRegister),
-              "Largest pixel format does not fit in mask");
-}  // layout
-}  // vsoc
diff --git a/common/vsoc/shm/input_events_layout.h b/common/vsoc/shm/input_events_layout.h
deleted file mode 100644
index 737c903..0000000
--- a/common/vsoc/shm/input_events_layout.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "common/vsoc/shm/base.h"
-#include "common/vsoc/shm/circqueue.h"
-
-// Memory layout for region carrying input events from host to guest
-
-namespace vsoc {
-namespace layout {
-
-namespace input_events {
-
-struct InputEventsLayout : public RegionLayout {
-  static constexpr size_t layout_size =
-      CircularPacketQueue<10, 256>::layout_size +
-      2 * CircularPacketQueue<10, 16>::layout_size;
-
-  static const char* region_name;
-  // Event queues for the different input devices supported. Both the power
-  // button and the keyboard need only generate 2 input events for every
-  // 'hardware' event, so 16 bytes are enough, however when the touchscreen has
-  // multitouch enabled the number of generated events is significantly higher.
-  CircularPacketQueue<10, 256> touch_screen_queue;
-  CircularPacketQueue<10, 16> keyboard_queue;
-  CircularPacketQueue<10, 16> power_button_queue;
-};
-ASSERT_SHM_COMPATIBLE(InputEventsLayout);
-
-}  // namespace input_events
-}  // namespace layout
-}  // namespace vsoc
diff --git a/common/vsoc/shm/lock.h b/common/vsoc/shm/lock.h
deleted file mode 100644
index 2049ba8..0000000
--- a/common/vsoc/shm/lock.h
+++ /dev/null
@@ -1,252 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Memory layout for locks of all types.
-
-// The vsoc::layout namespace indicates that these are shared memory structure
-// definitions. The #include's given above are strictly limited, as are the
-// types that can be referenced below.
-
-// For _mm_pause()
-#if defined(__SSE2__)
-#include <x86intrin.h>
-#define _pause() _mm_pause()
-#elif defined(__arm__) || defined(__aarch64__)
-#include <arm_acle.h>
-#define _pause() __yield()
-#endif
-
-#include <atomic>
-#include <cstdint>
-
-#include "common/vsoc/shm/base.h"
-
-// Host userspace, guest userspace, and the guest kernel must all agree on
-// the relationship between std::atomic and atomic_t. That's hard to do without
-// examining assembly, and we can't really examing atomic_t outside of the
-// kernel tree, but we can at least assert that the host and the guest
-// agree on a size.
-static_assert(sizeof(std::atomic<uint32_t>) == 4, "std::atomic size mismatch");
-
-namespace vsoc {
-
-class RegionView;
-
-namespace layout {
-
-/**
- * Lock that causes threads to busy loop rather than sleeping.
- * This lock should never be used when the amount of work in the critical
- * section cannot be bounded.
- */
-class SpinLock {
- public:
-  static constexpr size_t layout_size = 4;
-
-  /**
-   * Acquire the spinlock on the queue. This will effectively block all
-   * readers and writers.
-   */
-  void Lock() {
-    while (1) {
-      uint32_t expected = 0;
-      if (lock_.compare_exchange_strong(expected, Sides::OurSide)) {
-        return;
-      }
-      _pause();
-    }
-  }
-
-  /**
-   * Drop the lock iff it is currently held by this side. Used by
-   * recovery code that cleans up regions in the event of a reboot
-   * (guest side) or a service restart (host side).
-   *
-   * The caller must ensure that there are no other threads on its
-   * side (e.g. guest/host) are using the window.
-   */
-  bool Recover() {
-    uint32_t expected = Sides::OurSide;
-    return lock_.compare_exchange_strong(expected, 0);
-  }
-
-  /**
-   * Release the spinlock.
-   */
-  void Unlock() {
-    lock_ = 0;
-  }
-
- protected:
-  std::atomic<uint32_t> lock_;
-};
-ASSERT_SHM_COMPATIBLE(SpinLock);
-
-/**
- * This is a generic synchronization primitive that provides space for the
- * owner of the lock to write platform-specific information.
- */
-class WaitingLockBase {
- public:
-  static constexpr size_t layout_size = 40;
-
- protected:
-  // Common code to handle locking
-  // Must be called with the kernel's thread id
-  // Returns true if the lock was acquired. In this case the value in
-  // expected_vlaue is undefined.
-  // Returns false if locking failed. The value discovered in the lock word
-  // is returned in expected_value, and should probably be used in a conditional
-  // sleep.
-  bool TryLock(uint32_t tid, uint32_t* expected_value);
-
-  // Common code to handle unlocking.
-  // Must be called with the kernel's thread id
-  // Returns sides that should be signalled or 0
-  Sides UnlockCommon(uint32_t tid);
-
-  // Common code to recover single-sided locks.
-  bool RecoverSingleSided();
-
-  // Non-zero values in this word indicate that the lock is in use.
-  // This is 32 bits for compatibility with futex()
-  std::atomic<uint32_t> lock_uint32_;
-
-  // Pad so we line up with glib's pthread_mutex_t and can share the same queue.
-  // These fields may be redefined at any point in the future. They should not
-  // be used.
- private:
-// These fields are known to be unused and are provided for compatibility
-// with glibc's locks.
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wunused-private-field"
-  uint32_t reserved_1_;
-  char reserved_2_[16];
-  // Provide scratch space for the owner of the lock. The content of this space
-  // is undefined when the lock is acquired. The owner may write to and read
-  // from it while it holds the lock, but must relinquish control before
-  // releasing the lock.
-  //
-  // This is intended to support Linux robust futexes. See the documentation
-  // in the kernel tree:
-  //   Documentation/robust-futex-ABI.txt
- public:
-  int64_t owner_scratch_[2];
-#pragma clang diagnostic pop
-};
-ASSERT_SHM_COMPATIBLE(WaitingLockBase);
-
-/**
- * GuestLocks can be acquired and released only on the guest. They reside
- * in the shared memory window because mutiple guest processes may need
- * to coordinate activities in certain shared memory regions.
- *
- * Representing this as a concrete type allows for some optimizations when
- * signalling on the lock.
- */
-class GuestLock : public WaitingLockBase {
- public:
-  static constexpr size_t layout_size = WaitingLockBase::layout_size;
-
-#ifndef CUTTLEFISH_HOST
-  void Lock();
-  void Unlock();
-  /**
-   * Drop the lock iff it is currently held. Used by
-   * recovery code that cleans up regions in the event of a reboot.
-   *
-   * The caller must ensure that there are no other threads on its
-   * side (e.g. guest/host) are using the window.
-   */
-  bool Recover();
-#endif
-};
-ASSERT_SHM_COMPATIBLE(GuestLock);
-
-/**
- * HostLocks can be acquired and released only on the host. They reside
- * in the shared memory window because mutiple host processes may need
- * to coordinate activities in certain shared memory regions.
- *
- * Representing this as a concrete type allows for some optimizations when
- * signalling on the lock.
- */
-class HostLock : public WaitingLockBase {
- public:
-  static constexpr size_t layout_size = WaitingLockBase::layout_size;
-
-#ifdef CUTTLEFISH_HOST
-  void Lock();
-  void Unlock();
-  /**
-   * Drop the lock iff it is currently held. Used by
-   * recovery code that cleans up regions in the event of a daemon
-   * restart.
-   *
-   * The caller must ensure that there are no other threads on its
-   * side (e.g. guest/host) are using the window.
-   */
-  bool Recover();
-#endif
-};
-ASSERT_SHM_COMPATIBLE(HostLock);
-
-/**
- * GuestAndHostLocks can be acquired and released on either side of the
- * shared memory window. The locks attempt to enforce fairness by using
- * a round-trip signal:
- *
- *   When a guest releases a lock this code sends a signal to wake the host,
- *   but not other guest waiters.
- *
- *   The wake handler on the host wakes up and local waiters and then reposts
- *   the signal to the guest.
- *
- *   When the guest receives the signal from the host it then wakes ups
- *   any waiters.
- *
- * A similar scenario applies when the host releases a lock with guest waiters.
- *
- * Signalling across the shared memory window twice has non-trivial cost.
- * There are some optimizations in the code to prevent the full round-trip
- * if the process releasing the lock can confirm that there are no waiters on
- * the other side.
- *
- * Representing this as a concrete type allows for some optimizations when
- * signalling on the lock.
- */
-class GuestAndHostLock : public WaitingLockBase {
- public:
-  static constexpr size_t layout_size = WaitingLockBase::layout_size;
-
-  void Lock(RegionView*);
-  void Unlock(RegionView*);
-  /**
-   * Drop the lock iff it is currently held by this side. Used by
-   * recovery code that cleans up regions in the event of a reboot
-   * (guest side) or a service restart (host side).
-   *
-   * The caller must ensure that there are no other threads on its
-   * side (e.g. guest/host) are using the window.
-   */
-  bool Recover(RegionView*);
-};
-ASSERT_SHM_COMPATIBLE(GuestAndHostLock);
-
-}  // namespace layout
-}  // namespace vsoc
diff --git a/common/vsoc/shm/managed_e2e_test_region_layout.h b/common/vsoc/shm/managed_e2e_test_region_layout.h
deleted file mode 100644
index dc23f66..0000000
--- a/common/vsoc/shm/managed_e2e_test_region_layout.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#pragma once
-/*
- * 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 <cstdint>
-
-#include "common/vsoc/shm/base.h"
-
-namespace vsoc {
-namespace layout {
-
-namespace e2e_test {
-
-struct E2EManagedTestRegionLayout : public RegionLayout {
-  static constexpr size_t layout_size = 4;
-
-  static const char* region_name;
-  uint32_t val;  // Not needed, here only to avoid an empty struct.
-};
-ASSERT_SHM_COMPATIBLE(E2EManagedTestRegionLayout);
-
-struct E2EManagerTestRegionLayout : public RegionLayout {
-  static constexpr size_t layout_size = 4 * 4;
-
-  static const char* region_name;
-  typedef E2EManagedTestRegionLayout ManagedRegion;
-  uint32_t data[4];  // We don't need more than 4 for the tests
-};
-ASSERT_SHM_COMPATIBLE(E2EManagerTestRegionLayout);
-
-}  // namespace e2e_test
-}  // namespace layout
-}  // namespace vsoc
diff --git a/common/vsoc/shm/screen_layout.h b/common/vsoc/shm/screen_layout.h
deleted file mode 100644
index 7ad0ca3..0000000
--- a/common/vsoc/shm/screen_layout.h
+++ /dev/null
@@ -1,76 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "common/vsoc/shm/base.h"
-#include "common/vsoc/shm/lock.h"
-
-// Memory layout for screen region
-
-namespace vsoc {
-namespace layout {
-
-namespace screen {
-struct TimeSpec {
-  static constexpr size_t layout_size = 16;
-
-  int64_t ts_sec;
-  uint32_t ts_nsec;
-  // Host and guest compilers are giving the structure different sizes without
-  // this field.
-  uint32_t reserved;
-};
-ASSERT_SHM_COMPATIBLE(TimeSpec);
-
-struct CompositionStats {
-  static constexpr size_t layout_size = 4 + 2 * 2 + 5 * TimeSpec::layout_size;
-
-  uint32_t num_prepare_calls;
-  uint16_t num_layers;
-  uint16_t num_hwcomposited_layers;
-  TimeSpec last_vsync;
-  TimeSpec prepare_start;
-  TimeSpec prepare_end;
-  TimeSpec set_start;
-  TimeSpec set_end;
-};
-ASSERT_SHM_COMPATIBLE(CompositionStats);
-
-struct ScreenLayout : public RegionLayout {
-  static constexpr size_t layout_size = 24 + CompositionStats::layout_size;
-  static const char* region_name;
-  // Display properties
-  uint32_t x_res;
-  uint32_t y_res;
-  uint16_t dpi;
-  uint16_t refresh_rate_hz;
-
-  // Protects access to the frame offset, sequential number and stats.
-  // See the region implementation for more details.
-  SpinLock bcast_lock;
-  // The frame sequential number
-  std::atomic<uint32_t> seq_num;
-  // The index of the buffer containing the current frame.
-  int32_t buffer_index;
-  CompositionStats stats;
-  uint8_t buffer[0];
-};
-ASSERT_SHM_COMPATIBLE(ScreenLayout);
-
-}  // namespace screen
-
-}  // namespace layout
-}  // namespace vsoc
diff --git a/common/vsoc/shm/socket_forward_layout.h b/common/vsoc/shm/socket_forward_layout.h
deleted file mode 100644
index 4a9beda..0000000
--- a/common/vsoc/shm/socket_forward_layout.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2018 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 "common/vsoc/shm/base.h"
-#include "common/vsoc/shm/circqueue.h"
-#include "common/vsoc/shm/lock.h"
-
-// Memory layout for wifi packet exchange region.
-namespace vsoc {
-namespace layout {
-namespace socket_forward {
-
-constexpr std::size_t kMaxPacketSize = 8192;
-constexpr std::size_t kNumQueues = 16;
-
-struct Queue {
-  static constexpr size_t layout_size =
-      CircularPacketQueue<16, kMaxPacketSize>::layout_size;
-
-  CircularPacketQueue<16, kMaxPacketSize> queue;
-
-  bool Recover() { return queue.Recover(); }
-};
-ASSERT_SHM_COMPATIBLE(Queue);
-
-struct QueuePair {
-  static constexpr size_t layout_size = 2 * Queue::layout_size;
-
-  // Traffic originating from host that proceeds towards guest.
-  Queue host_to_guest;
-  // Traffic originating from guest that proceeds towards host.
-  Queue guest_to_host;
-
-  bool Recover() {
-    bool recovered = false;
-    recovered = recovered || host_to_guest.Recover();
-    recovered = recovered || guest_to_host.Recover();
-    return recovered;
-  }
-};
-ASSERT_SHM_COMPATIBLE(QueuePair);
-
-struct SocketForwardLayout : public RegionLayout {
-  static constexpr size_t layout_size = QueuePair::layout_size * kNumQueues;
-
-  bool Recover() {
-    bool recovered = false;
-    for (auto& i : queues_) {
-      bool rval = i.Recover();
-      recovered = recovered || rval;
-    }
-    return recovered;
-  }
-
-  QueuePair queues_[kNumQueues];
-  static const char* region_name;
-};
-
-ASSERT_SHM_COMPATIBLE(SocketForwardLayout);
-
-}  // namespace socket_forward
-}  // namespace layout
-}  // namespace vsoc
diff --git a/guest/commands/ip_link_add/Android.bp b/guest/commands/ip_link_add/Android.bp
index d84a5d1..6c155f0 100644
--- a/guest/commands/ip_link_add/Android.bp
+++ b/guest/commands/ip_link_add/Android.bp
@@ -21,7 +21,6 @@
     ],
     shared_libs: [
         "cuttlefish_net",
-        "cuttlefish_auto_resources",
     ],
     defaults: ["cuttlefish_guest_only"]
 }
diff --git a/guest/commands/setup_wifi/Android.bp b/guest/commands/setup_wifi/Android.bp
index ec89852..182d885 100644
--- a/guest/commands/setup_wifi/Android.bp
+++ b/guest/commands/setup_wifi/Android.bp
@@ -21,7 +21,6 @@
     ],
     shared_libs: [
         "cuttlefish_net",
-        "cuttlefish_auto_resources",
         "libbase",
         "liblog",
     ],
diff --git a/guest/commands/usbforward/Android.bp b/guest/commands/usbforward/Android.bp
index a639567..fe390e6 100644
--- a/guest/commands/usbforward/Android.bp
+++ b/guest/commands/usbforward/Android.bp
@@ -22,7 +22,6 @@
         "transport_request.cpp",
     ],
     shared_libs: [
-        "cuttlefish_auto_resources",
         "libcuttlefish_fs",
         "libusb",
         "libbase",
diff --git a/guest/commands/vsoc_input_service/Android.bp b/guest/commands/vsoc_input_service/Android.bp
index 76aae19..6c99127 100644
--- a/guest/commands/vsoc_input_service/Android.bp
+++ b/guest/commands/vsoc_input_service/Android.bp
@@ -24,12 +24,17 @@
         "virtual_touchscreen.cpp",
         "vsoc_input_service.cpp",
     ],
+    static_libs: [
+        "libgflags",
+    ],
     shared_libs: [
-        "cuttlefish_auto_resources",
+        "libcuttlefish_device_config",
         "libcuttlefish_fs",
         "libbase",
         "liblog",
-        "vsoc_lib",
+    ],
+    header_libs: [
+        "cuttlefish_glog",
     ],
     defaults: ["cuttlefish_guest_only"]
 }
diff --git a/guest/commands/vsoc_input_service/main.cpp b/guest/commands/vsoc_input_service/main.cpp
index 47b02a5..c9e93ed 100644
--- a/guest/commands/vsoc_input_service/main.cpp
+++ b/guest/commands/vsoc_input_service/main.cpp
@@ -15,10 +15,12 @@
  */
 
 #include "log/log.h"
+#include <gflags/gflags.h>
 
 #include "vsoc_input_service.h"
 
-int main(int /* arg */, char* /* argv */[]) {
+int main(int argc, char* argv[]) {
+  gflags::ParseCommandLineFlags(&argc, &argv, true);
   vsoc_input_service::VSoCInputService service;
   if (!service.SetUpDevices()) {
     return -1;
diff --git a/guest/commands/vsoc_input_service/virtual_device_base.cpp b/guest/commands/vsoc_input_service/virtual_device_base.cpp
index d0c16bd..0abb0cd 100644
--- a/guest/commands/vsoc_input_service/virtual_device_base.cpp
+++ b/guest/commands/vsoc_input_service/virtual_device_base.cpp
@@ -16,6 +16,7 @@
 
 #include "virtual_device_base.h"
 
+#include <glog/logging.h>
 #include <errno.h>
 #include <inttypes.h>
 #include <string.h>
@@ -103,6 +104,8 @@
     return false;
   }
 
+  LOG(INFO) << "set up virtual device";
+
   return true;
 }
 
diff --git a/guest/commands/vsoc_input_service/vsoc_input_service.cpp b/guest/commands/vsoc_input_service/vsoc_input_service.cpp
index d100a52..8b75b45 100644
--- a/guest/commands/vsoc_input_service/vsoc_input_service.cpp
+++ b/guest/commands/vsoc_input_service/vsoc_input_service.cpp
@@ -18,37 +18,34 @@
 
 #include <linux/input.h>
 #include <linux/uinput.h>
+#include <linux/virtio_input.h>
 
 #include <thread>
 
+#include <gflags/gflags.h>
 #include "log/log.h"
+#include <glog/logging.h>
 
-#include "common/vsoc/lib/screen_region_view.h"
-#include "common/vsoc/lib/input_events_region_view.h"
+#include "common/libs/fs/shared_fd.h"
+#include "common/libs/device_config/device_config.h"
 
-using vsoc::screen::ScreenRegionView;
 using vsoc::input_events::InputEvent;
-using vsoc::input_events::InputEventsRegionView;
 using vsoc_input_service::VirtualDeviceBase;
 using vsoc_input_service::VirtualKeyboard;
 using vsoc_input_service::VirtualPowerButton;
 using vsoc_input_service::VirtualTouchScreen;
 using vsoc_input_service::VSoCInputService;
 
+DEFINE_uint32(keyboard_port, 0, "keyboard vsock port");
+DEFINE_uint32(touch_port, 0, "keyboard vsock port");
+
 namespace {
 
 void EventLoop(std::shared_ptr<VirtualDeviceBase> device,
-               std::function<int(InputEvent*, int)> next_events) {
+               std::function<InputEvent()> next_event) {
   while (1) {
-    InputEvent events[InputEventsRegionView::kMaxEventsPerPacket];
-    int count = next_events(events, InputEventsRegionView::kMaxEventsPerPacket);
-    if (count <= 0) {
-      SLOGE("Error getting events from the queue: Maybe check packet size");
-      continue;
-    }
-    for (int i = 0; i < count; ++i) {
-      device->EmitEvent(events[i].type, events[i].code, events[i].value);
-    }
+    InputEvent event = next_event();
+    device->EmitEvent(event.type, event.code, event.value);
   }
 }
 
@@ -64,14 +61,14 @@
     return false;
   }
 
-  auto screen_view = ScreenRegionView::GetInstance();
-  if (!screen_view) {
-    SLOGE("Failed to open framebuffer broadcast region");
+  auto config = cvd::DeviceConfig::Get();
+  if (!config) {
+    LOG(ERROR) << "Failed to open device config";
     return false;
   }
 
   virtual_touchscreen_.reset(
-      new VirtualTouchScreen(screen_view->x_res(), screen_view->y_res()));
+      new VirtualTouchScreen(config->screen_x_res(), config->screen_y_res()));
   if (!virtual_touchscreen_->SetUp()) {
     return false;
   }
@@ -80,35 +77,56 @@
 }
 
 bool VSoCInputService::ProcessEvents() {
-  auto input_events_rv = InputEventsRegionView::GetInstance();
-  // TODO(jemoreira): Post available devices to region
-  auto worker = input_events_rv->StartWorker();
+  cvd::SharedFD keyboard_fd;
+  cvd::SharedFD touch_fd;
+
+  LOG(INFO) << "Connecting to the keyboard at " << FLAGS_keyboard_port;
+  if (FLAGS_keyboard_port) {
+    keyboard_fd = cvd::SharedFD::VsockClient(2, FLAGS_keyboard_port, SOCK_STREAM);
+    if (!keyboard_fd->IsOpen()) {
+      LOG(ERROR) << "Could not connect to the keyboard at vsock:2:" << FLAGS_keyboard_port;
+    }
+    LOG(INFO) << "Connected to keyboard";
+  }
+  LOG(INFO) << "Connecting to the touchscreen at " << FLAGS_keyboard_port;
+  if (FLAGS_touch_port) {
+    touch_fd = cvd::SharedFD::VsockClient(2, FLAGS_touch_port, SOCK_STREAM);
+    if (!touch_fd->IsOpen()) {
+      LOG(ERROR) << "Could not connect to the touch at vsock:2:" << FLAGS_touch_port;
+    }
+    LOG(INFO) << "Connected to touch";
+  }
 
   // Start device threads
-  std::thread screen_thread([this]() {
-    EventLoop(
-        virtual_touchscreen_, [](InputEvent* event_buffer, int max_events) {
-          return InputEventsRegionView::GetInstance()->GetScreenEventsOrWait(
-              event_buffer, max_events);
-        });
-  });
-  std::thread keyboard_thread([this]() {
-    EventLoop(virtual_keyboard_, [](InputEvent* event_buffer, int max_events) {
-      return InputEventsRegionView::GetInstance()->GetKeyboardEventsOrWait(
-          event_buffer, max_events);
+  std::thread screen_thread([this, touch_fd]() {
+    EventLoop(virtual_touchscreen_, [touch_fd]() {
+      struct virtio_input_event event;
+      if (touch_fd->Read(&event, sizeof(event)) != sizeof(event)) {
+        LOG(FATAL) << "Could not read touch event: " << touch_fd->StrError();
+      }
+      return InputEvent {
+        .type = event.type,
+        .code = event.code,
+        .value = event.value,
+      };
     });
   });
-  std::thread button_thread([this]() {
-    EventLoop(virtual_power_button_,
-              [](InputEvent* event_buffer, int max_events) {
-                return InputEventsRegionView::GetInstance()
-                    ->GetPowerButtonEventsOrWait(event_buffer, max_events);
-              });
+  std::thread keyboard_thread([this, keyboard_fd]() {
+    EventLoop(virtual_keyboard_, [keyboard_fd]() {
+      struct virtio_input_event event;
+      if (keyboard_fd->Read(&event, sizeof(event)) != sizeof(event)) {
+        LOG(FATAL) << "Could not read keyboard event: " << keyboard_fd->StrError();
+      }
+      return InputEvent {
+        .type = event.type,
+        .code = event.code,
+        .value = event.value,
+      };
+    });
   });
 
   screen_thread.join();
   keyboard_thread.join();
-  button_thread.join();
 
   // Should never return
   return false;
diff --git a/guest/commands/vsoc_input_service/vsoc_input_service.h b/guest/commands/vsoc_input_service/vsoc_input_service.h
index 2282b40..edf196d 100644
--- a/guest/commands/vsoc_input_service/vsoc_input_service.h
+++ b/guest/commands/vsoc_input_service/vsoc_input_service.h
@@ -21,6 +21,18 @@
 #include "virtual_power_button.h"
 #include "virtual_touchscreen.h"
 
+namespace vsoc {
+namespace input_events {
+
+struct InputEvent {
+  uint16_t type;
+  uint16_t code;
+  uint32_t value;
+};
+
+} // namespace input_events
+} // namespace vsoc
+
 namespace vsoc_input_service {
 
 class VSoCInputService {
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_;
-};
-
-}
diff --git a/guest/hals/camera/EmulatedFakeCamera2.cpp b/guest/hals/camera/EmulatedFakeCamera2.cpp
index 63a5c1a..393adf1 100644
--- a/guest/hals/camera/EmulatedFakeCamera2.cpp
+++ b/guest/hals/camera/EmulatedFakeCamera2.cpp
@@ -32,12 +32,19 @@
 #include "EmulatedCameraFactory.h"
 #include "EmulatedFakeCamera2.h"
 #include "GrallocModule.h"
-#include "common/libs/auto_resources/auto_resources.h"
 
 #define ERROR_CAMERA_NOT_PRESENT -EPIPE
 
 #define CAMERA2_EXT_TRIGGER_TESTING_DISCONNECT 0xFFFFFFFF
 
+template <typename T, size_t N>
+char (&ArraySizeHelper(T (&array)[N]))[N];
+
+template <typename T, size_t N>
+char (&ArraySizeHelper(const T (&array)[N]))[N];
+
+#define arraysize(array) (sizeof(ArraySizeHelper(array)))
+
 namespace android {
 
 const int64_t USEC = 1000LL;
@@ -1441,12 +1448,12 @@
   // To simulate some kind of real detection going on, we jitter the rectangles
   // on each frame by a few pixels in each dimension.
   for (size_t i = 0; i < numFaces * 4; i++) {
-    rects[i] += (int32_t)(((float)rand() / RAND_MAX) * 6 - 3);
+    rects[i] += (int32_t)(((float)rand() / (float)RAND_MAX) * 6 - 3);
   }
   // The confidence scores (0-100) are similarly jittered.
   uint8_t scores[numFaces] = {85, 95};
   for (size_t i = 0; i < numFaces; i++) {
-    scores[i] += (int32_t)(((float)rand() / RAND_MAX) * 10 - 5);
+    scores[i] += (int32_t)(((float)rand() / (float)RAND_MAX) * 10 - 5);
   }
 
   res = add_camera_metadata_entry(frame, ANDROID_STATISTICS_FACE_RECTANGLES,
@@ -1485,7 +1492,7 @@
   };
   // Jitter these a bit less than the rects
   for (size_t i = 0; i < numFaces * 6; i++) {
-    features[i] += (int32_t)(((float)rand() / RAND_MAX) * 4 - 2);
+    features[i] += (int32_t)(((float)rand() / (float)RAND_MAX) * 4 - 2);
   }
   // These are unique IDs that are used to identify each face while it's
   // visible to the detector (if a face went away and came back, it'd get a
diff --git a/guest/hals/gralloc/Android.mk b/guest/hals/gralloc/Android.mk
deleted file mode 100644
index 68ffffa..0000000
--- a/guest/hals/gralloc/Android.mk
+++ /dev/null
@@ -1,63 +0,0 @@
-# Copyright (C) 2017 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := gralloc.cutf_ivsh-future
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := \
-    gralloc.cpp \
-    mapper.cpp
-
-LOCAL_C_INCLUDES += \
-    device/google/cuttlefish_common \
-    device/google/cuttlefish_kernel \
-    hardware/libhardware/include \
-    system/core/base/include
-
-LOCAL_CFLAGS := \
-    -DLOG_TAG=\"gralloc_vsoc\" \
-    -Wno-missing-field-initializers \
-    -Wall -Werror \
-    $(VSOC_VERSION_CFLAGS)
-
-LOCAL_SHARED_LIBRARIES := \
-    libbase \
-    libcutils \
-    cuttlefish_auto_resources \
-    libcuttlefish_fs \
-    liblog \
-    vsoc_lib
-
-LOCAL_HEADER_LIBRARIES := \
-    libhardware_headers
-
-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_VENDOR_MODULE := true
-
-# See b/67109557
-ifeq (true, $(TARGET_TRANSLATE_2ND_ARCH))
-LOCAL_MULTILIB := first
-endif
-include $(BUILD_SHARED_LIBRARY)
-
-include $(call first-makefiles-under,$(LOCAL_PATH))
diff --git a/guest/hals/gralloc/gralloc.cpp b/guest/hals/gralloc/gralloc.cpp
deleted file mode 100644
index bf672ee..0000000
--- a/guest/hals/gralloc/gralloc.cpp
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <hardware/gralloc.h>
-#include <hardware/hardware.h>
-#include <log/log.h>
-#include <stdlib.h>
-
-#include "guest/hals/gralloc/gralloc_vsoc_priv.h"
-#include "guest/vsoc/lib/gralloc_region_view.h"
-
-using vsoc::gralloc::GrallocRegionView;
-
-namespace {
-
-static const int kSwiftShaderPadding = 4;
-
-inline void formatToYcbcr(
-    int format, int width, int height, void* base_v, android_ycbcr* ycbcr) {
-  uintptr_t it = reinterpret_cast<uintptr_t>(base_v);
-  // Clear reserved fields;
-  memset(ycbcr, 0, sizeof(*ycbcr));
-  switch (format) {
-    case HAL_PIXEL_FORMAT_YV12:
-    case HAL_PIXEL_FORMAT_YCbCr_420_888:
-      ycbcr->ystride = align(width, 16);
-      ycbcr->cstride = align(ycbcr->ystride / 2, 16);
-      ycbcr->chroma_step = 1;
-      ycbcr->y = reinterpret_cast<void*>(it);
-      it += ycbcr->ystride * height;
-      ycbcr->cr = reinterpret_cast<void*>(it);
-      it += ycbcr->cstride * height / 2;
-      ycbcr->cb = reinterpret_cast<void*>(it);
-      break;
-    default:
-      ALOGE("%s: can't deal with format=0x%x", __FUNCTION__, format);
-  }
-}
-
-inline int formatToBytesPerPixel(int format) {
-  switch (format) {
-    case HAL_PIXEL_FORMAT_RGBA_FP16:
-      return 8;
-    case HAL_PIXEL_FORMAT_RGBA_8888:
-    case HAL_PIXEL_FORMAT_RGBX_8888:
-    case HAL_PIXEL_FORMAT_BGRA_8888:
-    // The camera 3.0 implementation assumes that IMPLEMENTATION_DEFINED
-    // means HAL_PIXEL_FORMAT_RGBA_8888
-    case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
-      return 4;
-    case HAL_PIXEL_FORMAT_RGB_888:
-      return 3;
-    case HAL_PIXEL_FORMAT_RGB_565:
-    case HAL_PIXEL_FORMAT_YV12:
-    case HAL_PIXEL_FORMAT_YCbCr_420_888:
-      return 2;
-    case HAL_PIXEL_FORMAT_BLOB:
-      return 1;
-    default:
-      ALOGE("%s: unknown format=%d", __FUNCTION__, format);
-      return 8;
-  }
-}
-
-inline int formatToBytesPerFrame(int format, int w, int h) {
-  int bytes_per_pixel = formatToBytesPerPixel(format);
-  int w16, h16;
-  int y_size, c_size;
-
-  switch (format) {
-    // BLOB is used to allocate buffers for JPEG formatted data. Bytes per pixel
-    // is 1, the desired buffer size is in w, and h should be 1. We refrain from
-    // adding additional padding, although the caller is likely to round
-    // up to a page size.
-    case HAL_PIXEL_FORMAT_BLOB:
-      return bytes_per_pixel * w * h;
-    case HAL_PIXEL_FORMAT_YV12:
-    case HAL_PIXEL_FORMAT_YCbCr_420_888:
-      android_ycbcr strides;
-      formatToYcbcr(format, w, h, NULL, &strides);
-      y_size = strides.ystride * h;
-      c_size = strides.cstride * h / 2;
-      return (y_size + 2 * c_size + kSwiftShaderPadding);
-    /*case HAL_PIXEL_FORMAT_RGBA_8888:
-    case HAL_PIXEL_FORMAT_RGBX_8888:
-    case HAL_PIXEL_FORMAT_BGRA_8888:
-    case HAL_PIXEL_FORMAT_RGB_888:
-    case HAL_PIXEL_FORMAT_RGB_565:*/
-    default:
-      w16 = align(w, 16);
-      h16 = align(h, 16);
-      return bytes_per_pixel * w16 * h16 + kSwiftShaderPadding;
-  }
-}
-
-}
-
-/******************************************************************************/
-
-void dump(struct alloc_device_t */*dev*/, char */*buff*/, int /*buff_len*/) {}
-
-/******************************************************************************/
-
-int lock(struct gralloc_module_t const* /*module*/,
-         buffer_handle_t handle,
-         int /*usage*/,
-         int /*l*/,
-         int /*t*/,
-         int /*w*/,
-         int /*h*/,
-         void** vaddr) {
-  if (!vaddr || vsoc_buffer_handle_t::validate(handle)) {
-    return -EINVAL;
-  }
-  // TODO(jemoreira): Check allocation usage flags against requested usage.
-  const vsoc_buffer_handle_t* hnd =
-      reinterpret_cast<const vsoc_buffer_handle_t*>(handle);
-  void* mapped = reference_buffer(hnd);
-  if (mapped == NULL) {
-    ALOGE("Unable to reference buffer, %s", __FUNCTION__);
-    return -1;
-  }
-  *vaddr = mapped;
-  return 0;
-}
-
-int unlock(struct gralloc_module_t const* /*module*/, buffer_handle_t handle) {
-  if (vsoc_buffer_handle_t::validate(handle)) {
-    return -EINVAL;
-  }
-  return unreference_buffer(
-      reinterpret_cast<const vsoc_buffer_handle_t*>(handle));
-}
-
-int lock_ycbcr(struct gralloc_module_t const* module,
-               buffer_handle_t handle,
-               int usage,
-               int l,
-               int t,
-               int w,
-               int h,
-               struct android_ycbcr* ycbcr) {
-  void* mapped;
-  int retval = lock(module, handle, usage, l, t, w, h, &mapped);
-  if (retval) {
-    return retval;
-  }
-  const vsoc_buffer_handle_t* hnd =
-      reinterpret_cast<const vsoc_buffer_handle_t*>(handle);
-  formatToYcbcr(hnd->format, w, h, mapped, ycbcr);
-  return 0;
-}
-
-/******************************************************************************/
-
-static int gralloc_alloc(alloc_device_t* /*dev*/,
-                         int w,
-                         int h,
-                         int format,
-                         int /*usage*/,
-                         buffer_handle_t* pHandle,
-                         int* pStrideInPixels) {
-  int fd = -1;
-
-  int bytes_per_pixel = formatToBytesPerPixel(format);
-  int bytes_per_line;
-  int stride_in_pixels;
-  int size = 0;
-  uint32_t offset = 0;
-  // SwiftShader can't handle RGB_888, so fail fast and hard if we try to create
-  // a gralloc buffer in this format.
-  ALOG_ASSERT(format != HAL_PIXEL_FORMAT_RGB_888);
-  if (format == HAL_PIXEL_FORMAT_YV12) {
-    bytes_per_line = align(bytes_per_pixel * w, 16);
-  } else {
-    bytes_per_line = align(bytes_per_pixel * w, 8);
-  }
-  size = align(size + formatToBytesPerFrame(format, w, h), PAGE_SIZE);
-  size += PAGE_SIZE;
-  fd = GrallocRegionView::GetInstance()->AllocateBuffer(size, &offset);
-  if (fd < 0) {
-    ALOGE("Unable to allocate buffer (%s)", strerror(-fd));
-    return fd;
-  }
-
-  stride_in_pixels = bytes_per_line / bytes_per_pixel;
-  vsoc_buffer_handle_t* hnd = new vsoc_buffer_handle_t(fd,
-                                                       offset,
-                                                       size,
-                                                       format,
-                                                       w, h,
-                                                       stride_in_pixels);
-  void* addr =
-      reference_buffer(reinterpret_cast<const vsoc_buffer_handle_t*>(hnd));
-  if (!addr) {
-    ALOGE("Unable to reference buffer, %s", __FUNCTION__);
-    return -EIO;
-  }
-
-  *pHandle = hnd;
-  *pStrideInPixels = stride_in_pixels;
-
-  return 0;
-}
-
-static int gralloc_free(alloc_device_t* /*dev*/, buffer_handle_t handle) {
-  // No need to do anything else, the buffer will be atomatically deallocated
-  // when the handle is closed.
-  return unreference_buffer(
-      reinterpret_cast<const vsoc_buffer_handle_t*>(handle));
-}
-
-static int register_buffer(struct gralloc_module_t const* /*module*/,
-                          buffer_handle_t handle) {
-  if (vsoc_buffer_handle_t::validate(handle)) {
-    return -EINVAL;
-  }
-  void* addr =
-      reference_buffer(reinterpret_cast<const vsoc_buffer_handle_t*>(handle));
-  if (!addr) {
-    ALOGE("Unable to reference buffer, %s", __FUNCTION__);
-    return -EIO;
-  }
-  return 0;
-}
-
-int unregister_buffer(struct gralloc_module_t const* /*module*/,
-                     buffer_handle_t handle) {
-  if (vsoc_buffer_handle_t::validate(handle)) {
-    return -EINVAL;
-  }
-  return unreference_buffer(
-      reinterpret_cast<const vsoc_buffer_handle_t*>(handle));
-}
-
-/******************************************************************************/
-
-static int gralloc_device_close(struct hw_device_t *dev) {
-  vsoc_alloc_device_t* pdev = reinterpret_cast<vsoc_alloc_device_t*>(dev);
-  if (pdev) {
-    free(pdev);
-  }
-  return 0;
-}
-
-static int gralloc_device_open(
-    const hw_module_t* module, const char* name, hw_device_t** device) {
-    int status = -EINVAL;
-  if (!strcmp(name, GRALLOC_HARDWARE_GPU0)) {
-    vsoc_alloc_device_t *dev;
-    dev = (vsoc_alloc_device_t*) malloc(sizeof(*dev));
-    LOG_FATAL_IF(!dev, "%s: malloc returned NULL.", __FUNCTION__);
-
-    /* initialize our state here */
-    memset(dev, 0, sizeof(*dev));
-
-    /* initialize the procs */
-    dev->device.common.tag = HARDWARE_DEVICE_TAG;
-    dev->device.common.version = 0; // TODO(jemoreira): Bump to 0_2 when stable
-    dev->device.common.module = const_cast<hw_module_t*>(module);
-    dev->device.common.close = gralloc_device_close;
-
-    dev->device.alloc   = gralloc_alloc;
-    dev->device.free    = gralloc_free;
-
-    if (!GrallocRegionView::GetInstance()) {
-      LOG_FATAL("Unable to instantiate the gralloc region");
-      free(dev);
-      return -EIO;
-    }
-
-    *device = &dev->device.common;
-    status = 0;
-  }
-  // TODO(jemoreira): Consider opening other type of devices (framebuffer)
-  return status;
-}
-
-/******************************************************************************/
-
-static struct hw_module_methods_t gralloc_module_methods = {
-  .open = gralloc_device_open
-};
-
-struct vsoc_gralloc_module_t HAL_MODULE_INFO_SYM = {
-  .base = {
-    .common = {
-      .tag = HARDWARE_MODULE_TAG,
-      .version_major = GRALLOC_MODULE_API_VERSION_0_2,
-      .version_minor = 0,
-      .id = GRALLOC_HARDWARE_MODULE_ID,
-      .name = "VSoC X86 Graphics Memory Allocator Module",
-      .author = "The Android Open Source Project",
-      .methods = &gralloc_module_methods,
-      .dso = NULL,
-      .reserved = {0},
-    },
-    .registerBuffer = register_buffer,
-    .unregisterBuffer = unregister_buffer,
-    .lock = lock,
-    .unlock = unlock,
-    .lock_ycbcr = lock_ycbcr,
-    .perform = NULL,
-    .validateBufferSize = NULL,
-    .getTransportSize = NULL,
-  },
-};
diff --git a/guest/hals/gralloc/gralloc_vsoc_priv.h b/guest/hals/gralloc/gralloc_vsoc_priv.h
deleted file mode 100644
index 1ec5659..0000000
--- a/guest/hals/gralloc/gralloc_vsoc_priv.h
+++ /dev/null
@@ -1,100 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <errno.h>
-#include <cutils/native_handle.h>
-#include <hardware/gralloc.h>
-#include <log/log.h>
-
-struct vsoc_alloc_device_t {
-  alloc_device_t device;
-};
-
-struct vsoc_gralloc_module_t {
-  gralloc_module_t base;
-};
-
-static_assert(sizeof(int) >= 4, "At least 4 bytes are needed for offsets");
-
-struct vsoc_buffer_handle_t : public native_handle {
-  // File descriptors
-  int fd;
-  // ints
-  int magic;
-  int format;
-  int x_res;
-  int y_res;
-  int stride_in_pixels;
-  int size;
-  // buffer offset in bytes divided by PAGE_SIZE
-  int offset;
-
-  static inline int sNumInts() {
-    return ((sizeof(vsoc_buffer_handle_t) - sizeof(native_handle_t)) /
-                sizeof(int) -
-            sNumFds);
-  }
-  static const int sNumFds = 1;
-  static const int sMagic = 0xc63752f4;
-
-  vsoc_buffer_handle_t(int fd,
-                       int offset,
-                       int size,
-                       int format,
-                       int x_res,
-                       int y_res,
-                       int stride_in_pixels)
-      : fd(fd),
-        magic(sMagic),
-        format(format),
-        x_res(x_res),
-        y_res(y_res),
-        stride_in_pixels(stride_in_pixels),
-        size(size),
-        offset(offset) {
-    version = sizeof(native_handle);
-    numInts = sNumInts();
-    numFds = sNumFds;
-  }
-
-  ~vsoc_buffer_handle_t() {
-    magic = 0;
-  }
-
-  static int validate(const native_handle* handle) {
-    const vsoc_buffer_handle_t* hnd =
-        reinterpret_cast<const vsoc_buffer_handle_t*>(handle);
-    if (!hnd || hnd->version != sizeof(native_handle) ||
-        hnd->numInts != sNumInts() || hnd->numFds != sNumFds ||
-        hnd->magic != sMagic) {
-      ALOGE("Invalid gralloc handle (at %p)", handle);
-      return -EINVAL;
-    }
-    return 0;
-  }
-};
-
-// These functions are to be used to map/unmap gralloc buffers. They are thread
-// safe and ensure that the same buffer never gets mapped twice.
-void* reference_buffer(const vsoc_buffer_handle_t* hnd);
-int unreference_buffer(const vsoc_buffer_handle_t* hnd);
-
-// TODO(jemoreira): Move this to a place where it can be used by the gralloc
-// region as well.
-inline int align(int input, int alignment) {
-  return (input + alignment - 1) & -alignment;
-}
diff --git a/guest/hals/gralloc/legacy/Android.mk b/guest/hals/gralloc/legacy/Android.mk
index 4bbc9c0..ac789fb 100644
--- a/guest/hals/gralloc/legacy/Android.mk
+++ b/guest/hals/gralloc/legacy/Android.mk
@@ -18,7 +18,6 @@
 
 VSOC_GRALLOC_COMMON_SRC_FILES := \
     gralloc.cpp \
-    framebuffer.cpp \
     mapper.cpp \
     region_registry.cpp
 
@@ -47,8 +46,7 @@
     libbase \
     liblog \
     libutils \
-    libcutils \
-    vsoc_lib
+    libcutils
 
 LOCAL_VENDOR_MODULE := true
 
diff --git a/guest/hals/gralloc/legacy/framebuffer.cpp b/guest/hals/gralloc/legacy/framebuffer.cpp
deleted file mode 100644
index 5a2b7f0..0000000
--- a/guest/hals/gralloc/legacy/framebuffer.cpp
+++ /dev/null
@@ -1,155 +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 <sys/mman.h>
-
-#include <dlfcn.h>
-
-#include <cutils/ashmem.h>
-#include <log/log.h>
-#include <cutils/properties.h>
-
-#include <sys/system_properties.h>
-
-#include <hardware/hardware.h>
-#include <hardware/gralloc.h>
-
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/ioctl.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <cutils/atomic.h>
-
-#if defined(__ANDROID__)
-#include <linux/fb.h>
-#endif
-
-#include "gralloc_vsoc_priv.h"
-#include "region_registry.h"
-
-#include "common/libs/auto_resources/auto_resources.h"
-#include "common/libs/threads/cuttlefish_thread.h"
-#include "common/vsoc/lib/screen_region_view.h"
-
-using vsoc::screen::ScreenRegionView;
-
-/*****************************************************************************/
-
-struct fb_context_t {
-  framebuffer_device_t  device;
-};
-
-/*****************************************************************************/
-
-static int fb_setSwapInterval(struct framebuffer_device_t* dev, int interval) {
-  if (interval < dev->minSwapInterval || interval > dev->maxSwapInterval) {
-    return -EINVAL;
-  }
-  // FIXME: implement fb_setSwapInterval
-  return 0;
-}
-
-/*
- * These functions (and probably the entire framebuffer device) are most likely
- * not used when the hardware composer device is present, however is hard to be
- * 100% sure.
- */
-static int fb_setUpdateRect(
-    struct framebuffer_device_t* dev __unused, int l, int t, int w, int h) {
-  if (((w|h) <= 0) || ((l|t)<0)) {
-    return -EINVAL;
-  }
-  // TODO(jemoreira): Find a way to broadcast this with the framebuffer control.
-  return 0;
-}
-
-static int fb_post(struct framebuffer_device_t* dev __unused,
-                   buffer_handle_t buffer_handle) {
-  static int frame_buffer_idx = 0;
-
-  auto screen_view = ScreenRegionView::GetInstance();
-
-  void* frame_buffer = screen_view->GetBuffer(frame_buffer_idx);
-  const private_handle_t* p_handle =
-      reinterpret_cast<const private_handle_t*>(buffer_handle);
-  void* buffer;
-  int retval =
-      reinterpret_cast<gralloc_module_t*>(dev->common.module)
-          ->lock(reinterpret_cast<const gralloc_module_t*>(dev->common.module),
-                 buffer_handle, GRALLOC_USAGE_SW_READ_OFTEN, 0, 0,
-                 p_handle->x_res, p_handle->y_res, &buffer);
-  if (retval != 0) {
-    ALOGE("Got error code %d from lock function", retval);
-    return -1;
-  }
-  memcpy(frame_buffer, buffer, screen_view->buffer_size());
-  screen_view->BroadcastNewFrame(frame_buffer_idx);
-
-  frame_buffer_idx = (frame_buffer_idx + 1) % screen_view->number_of_buffers();
-
-  return 0;
-}
-
-/*****************************************************************************/
-
-static int fb_close(struct hw_device_t *dev) {
-  fb_context_t* ctx = (fb_context_t*)dev;
-  if (ctx) {
-    free(ctx);
-  }
-  return 0;
-}
-
-int fb_device_open(
-    hw_module_t const* module, const char* name, hw_device_t** device) {
-  if (strcmp(name, GRALLOC_HARDWARE_FB0) != 0) {
-    return -EINVAL;
-  }
-  /* initialize our state here */
-  fb_context_t* dev = (fb_context_t*) malloc(sizeof(*dev));
-  LOG_FATAL_IF(!dev, "%s: malloc returned NULL.", __FUNCTION__);
-  memset(dev, 0, sizeof(*dev));
-
-  /* initialize the procs */
-  dev->device.common.tag = HARDWARE_DEVICE_TAG;
-  dev->device.common.version = 0;
-  dev->device.common.module = const_cast<hw_module_t*>(module);
-  dev->device.common.close = fb_close;
-  dev->device.setSwapInterval = fb_setSwapInterval;
-  dev->device.post            = fb_post;
-  dev->device.setUpdateRect   = fb_setUpdateRect;
-
-  auto screen_view = ScreenRegionView::GetInstance();
-
-  int stride =
-    screen_view->line_length() / screen_view->bytes_per_pixel();
-  int format = HAL_PIXEL_FORMAT_RGBX_8888;
-  const_cast<uint32_t&>(dev->device.flags) = 0;
-  const_cast<uint32_t&>(dev->device.width) = screen_view->x_res();
-  const_cast<uint32_t&>(dev->device.height) = screen_view->y_res();
-  const_cast<int&>(dev->device.stride) = stride;
-  const_cast<int&>(dev->device.format) = format;
-  const_cast<float&>(dev->device.xdpi) = screen_view->dpi();
-  const_cast<float&>(dev->device.ydpi) = screen_view->dpi();
-  const_cast<float&>(dev->device.fps) =
-    (screen_view->refresh_rate_hz() * 1000) / 1000.0f;
-  const_cast<int&>(dev->device.minSwapInterval) = 1;
-  const_cast<int&>(dev->device.maxSwapInterval) = 1;
-  *device = &dev->device.common;
-
-  return 0;
-}
diff --git a/guest/hals/gralloc/legacy/gralloc.cpp b/guest/hals/gralloc/legacy/gralloc.cpp
index a100a76..28e71eb 100644
--- a/guest/hals/gralloc/legacy/gralloc.cpp
+++ b/guest/hals/gralloc/legacy/gralloc.cpp
@@ -35,8 +35,6 @@
 #include <hardware/hardware.h>
 #include <hardware/gralloc.h>
 
-#include "common/libs/auto_resources/auto_resources.h"
-#include "common/vsoc/lib/screen_region_view.h"
 #include "gralloc_vsoc_priv.h"
 #include "region_registry.h"
 
@@ -162,7 +160,7 @@
     *device = &dev->device.common;
     status = 0;
   } else {
-    status = fb_device_open(module, name, device);
+    ALOGE("Need to create framebuffer, but it is unsupported");
   }
   return status;
 }
@@ -194,11 +192,11 @@
     .unregisterBuffer = gralloc_unregister_buffer,
     .lock = gralloc_lock,
     .unlock = gralloc_unlock,
-    .validateBufferSize = gralloc_validate_buffer_size,
-    .getTransportSize = gralloc_get_transport_size,
 #ifdef GRALLOC_MODULE_API_VERSION_0_2
     .perform = NULL,
     .lock_ycbcr = gralloc_lock_ycbcr,
 #endif
+    .getTransportSize = gralloc_get_transport_size,
+    .validateBufferSize = gralloc_validate_buffer_size,
   },
 };
diff --git a/guest/hals/gralloc/legacy/gralloc_vsoc_priv.h b/guest/hals/gralloc/legacy/gralloc_vsoc_priv.h
index 2544b5a..390c654 100644
--- a/guest/hals/gralloc/legacy/gralloc_vsoc_priv.h
+++ b/guest/hals/gralloc/legacy/gralloc_vsoc_priv.h
@@ -29,8 +29,6 @@
 
 #include <linux/fb.h>
 
-#include "common/vsoc/lib/screen_region_view.h"
-
 #ifndef GRALLOC_MODULE_API_VERSION_0_2
 // This structure will be defined in later releases of Android. Declare it
 // here to allow us to structure the code well.
@@ -45,6 +43,20 @@
 };
 #endif
 
+namespace vsoc {
+namespace screen {
+
+struct ScreenRegionView {
+  static int align(int input) {
+    auto constexpr alignment = 16;
+    return (input + alignment - 1) & -alignment;
+  }
+  static constexpr int kSwiftShaderPadding = 4;
+};
+
+}
+}
+
 /*****************************************************************************/
 
 struct private_handle_t;
@@ -297,9 +309,6 @@
   }
 }
 
-int fb_device_open(
-    const hw_module_t* module, const char* name, hw_device_t** device);
-
 int gralloc_lock(
     gralloc_module_t const* module,
     buffer_handle_t handle, int usage,
diff --git a/guest/hals/gralloc/mapper.cpp b/guest/hals/gralloc/mapper.cpp
deleted file mode 100644
index e9ba2eb..0000000
--- a/guest/hals/gralloc/mapper.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "gralloc_vsoc_priv.h"
-
-#include <unistd.h>
-#include <string.h>
-#include <sys/mman.h>
-
-#include <cutils/hashmap.h>
-#include <hardware/gralloc.h>
-#include <hardware/hardware.h>
-#include <log/log.h>
-
-namespace {
-
-const size_t g_page_size = sysconf(_SC_PAGESIZE);
-
-struct HmLockGuard {
-  HmLockGuard(Hashmap* map) : map_(map) {
-    hashmapLock(map_);
-  }
-  ~HmLockGuard() {
-    hashmapUnlock(map_);
-  }
- private:
-  Hashmap* map_;
-};
-
-int offset_hash(void* key) {
-  return *reinterpret_cast<int*>(key);
-}
-
-bool offset_equals(void* key1, void* key2) {
-  return *reinterpret_cast<int*>(key1) ==
-         *reinterpret_cast<int*>(key2);
-}
-
-// Keeps track of how many times a buffer is locked in the current process.
-struct GrallocBuffer {
-  void* vaddr;
-  int ref_count;
-  GrallocBuffer() : vaddr(NULL), ref_count(0) {}
-
-  static Hashmap* mapped_buffers() {
-    static Hashmap* mapped_buffers =
-        hashmapCreate(19, offset_hash, offset_equals);
-    return mapped_buffers;
-  }
-};
-
-}
-
-void* reference_buffer(const vsoc_buffer_handle_t* hnd) {
-  Hashmap* map = GrallocBuffer::mapped_buffers();
-  HmLockGuard lock_guard(map);
-  GrallocBuffer* buffer = reinterpret_cast<GrallocBuffer*>(
-      hashmapGet(map, const_cast<int*>(&hnd->offset)));
-  if (!buffer) {
-    buffer = new GrallocBuffer();
-    hashmapPut(map, const_cast<int*>(&hnd->offset), buffer);
-  }
-
-  if (!buffer->vaddr) {
-    void* mapped =
-      mmap(NULL, hnd->size, PROT_READ | PROT_WRITE, MAP_SHARED, hnd->fd, 0);
-    if (mapped == MAP_FAILED) {
-      ALOGE("Unable to map buffer (offset: %d, size: %d): %s",
-            hnd->offset,
-            hnd->size,
-            strerror(errno));
-      return NULL;
-    }
-    // Set up the guard pages. The last page is always a guard
-    uintptr_t base = uintptr_t(mapped);
-    uintptr_t addr = base + hnd->size - g_page_size;
-    if (mprotect((void*)addr, g_page_size, PROT_NONE) == -1) {
-      ALOGW("Unable to protect last page of buffer (offset: %d, size: %d): %s",
-            hnd->offset,
-            hnd->size,
-            strerror(errno));
-    }
-    buffer->vaddr = mapped;
-  }
-  buffer->ref_count++;
-  return buffer->vaddr;
-}
-
-int unreference_buffer(const vsoc_buffer_handle_t* hnd) {
-  int result = 0;
-  Hashmap* map = GrallocBuffer::mapped_buffers();
-  HmLockGuard lock_guard(map);
-  GrallocBuffer* buffer = reinterpret_cast<GrallocBuffer*>(
-      hashmapGet(map, const_cast<int*>(&hnd->offset)));
-  if (!buffer) {
-    ALOGE("Unreferencing an unknown buffer (offset: %d, size: %d)",
-          hnd->offset,
-          hnd->size);
-    return -EINVAL;
-  }
-  if (buffer->ref_count == 0) {
-    ALOGE("Unbalanced reference/unreference on buffer (offset: %d, size: %d)",
-          hnd->offset,
-          hnd->size);
-    return -EINVAL;
-  }
-  buffer->ref_count--;
-  if (buffer->ref_count == 0) {
-    result = munmap(buffer->vaddr, hnd->size);
-    if (result) {
-      ALOGE("Unable to unmap buffer (offset: %d, size: %d): %s",
-            hnd->offset,
-            hnd->size,
-            strerror(errno));
-    }
-    buffer->vaddr = NULL;
-  }
-  return result;
-}
diff --git a/guest/hals/health/Android.bp b/guest/hals/health/Android.bp
index ba7f614..3f21425 100644
--- a/guest/hals/health/Android.bp
+++ b/guest/hals/health/Android.bp
@@ -13,13 +13,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-cc_binary {
-    name: "android.hardware.health@2.0-service.cuttlefish",
-    init_rc: ["android.hardware.health@2.0-service.cuttlefish.rc"],
+cc_library_shared {
+    name: "android.hardware.health@2.1-impl-cuttlefish",
+    stem: "android.hardware.health@2.0-impl-2.1-cuttlefish",
     proprietary: true,
+    recovery_available: true,
+
     relative_install_path: "hw",
+
     srcs: [
-        "health_service.cpp",
+        "health.cpp",
     ],
 
     cflags: [
@@ -28,10 +31,10 @@
     ],
 
     static_libs: [
-        "android.hardware.health@2.0-impl",
         "android.hardware.health@1.0-convert",
-        "libhealthservice",
         "libbatterymonitor",
+        "libhealthloop",
+        "libhealth2impl",
     ],
 
     shared_libs: [
@@ -40,13 +43,8 @@
         "libhidlbase",
         "libutils",
         "android.hardware.health@2.0",
+        "android.hardware.health@2.1",
     ],
 
-    header_libs: ["libhealthd_headers"],
-
     defaults: ["enabled_on_p_and_later"],
-
-    overrides: [
-        "healthd",
-    ],
 }
diff --git a/guest/hals/health/android.hardware.health@2.0-service.cuttlefish.rc b/guest/hals/health/android.hardware.health@2.0-service.cuttlefish.rc
deleted file mode 100644
index c225ee8..0000000
--- a/guest/hals/health/android.hardware.health@2.0-service.cuttlefish.rc
+++ /dev/null
@@ -1,4 +0,0 @@
-service vendor.health-hal-2-0 /vendor/bin/hw/android.hardware.health@2.0-service.cuttlefish
-    class hal
-    user system
-    group system
diff --git a/guest/hals/health/health.cpp b/guest/hals/health/health.cpp
new file mode 100644
index 0000000..adec085
--- /dev/null
+++ b/guest/hals/health/health.cpp
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#define LOG_TAG "android.hardware.health@2.0-service.cuttlefish"
+
+#include <memory>
+#include <string_view>
+
+#include <android-base/logging.h>
+#include <health/utils.h>
+#include <health2impl/Health.h>
+
+using ::android::sp;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::health::InitHealthdConfig;
+using ::android::hardware::health::V2_1::IHealth;
+using namespace std::literals;
+
+namespace android {
+namespace hardware {
+namespace health {
+namespace V2_1 {
+namespace implementation {
+class HealthImpl : public Health {
+ public:
+  HealthImpl(std::unique_ptr<healthd_config>&& config)
+    : Health(std::move(config)) {}
+ protected:
+  void UpdateHealthInfo(HealthInfo* health_info) override;
+};
+
+void HealthImpl::UpdateHealthInfo(HealthInfo* health_info) {
+  auto* battery_props = &health_info->legacy.legacy;
+  battery_props->chargerAcOnline = true;
+  battery_props->chargerUsbOnline = true;
+  battery_props->chargerWirelessOnline = false;
+  battery_props->maxChargingCurrent = 500000;
+  battery_props->maxChargingVoltage = 5000000;
+  battery_props->batteryStatus = V1_0::BatteryStatus::CHARGING;
+  battery_props->batteryHealth = V1_0::BatteryHealth::GOOD;
+  battery_props->batteryPresent = true;
+  battery_props->batteryLevel = 85;
+  battery_props->batteryVoltage = 3600;
+  battery_props->batteryTemperature = 350;
+  battery_props->batteryCurrent = 400000;
+  battery_props->batteryCycleCount = 32;
+  battery_props->batteryFullCharge = 4000000;
+  battery_props->batteryChargeCounter = 1900000;
+  battery_props->batteryTechnology = "Li-ion";
+}
+
+}  // namespace implementation
+}  // namespace V2_1
+}  // namespace health
+}  // namespace hardware
+}  // namespace android
+
+
+extern "C" IHealth* HIDL_FETCH_IHealth(const char* instance) {
+  using ::android::hardware::health::V2_1::implementation::HealthImpl;
+  if (instance != "default"sv) {
+      return nullptr;
+  }
+  auto config = std::make_unique<healthd_config>();
+  InitHealthdConfig(config.get());
+
+  return new HealthImpl(std::move(config));
+}
diff --git a/guest/hals/health/health_service.cpp b/guest/hals/health/health_service.cpp
deleted file mode 100644
index 48c2571..0000000
--- a/guest/hals/health/health_service.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#define LOG_TAG "android.hardware.health@2.0-service.cuttlefish"
-
-#include <health2/Health.h>
-#include <health2/service.h>
-#include <healthd/healthd.h>
-
-#include <android-base/logging.h>
-
-using android::hardware::health::V2_0::DiskStats;
-using android::hardware::health::V2_0::StorageInfo;
-
-void healthd_board_init(struct healthd_config*) {}
-
-int healthd_board_battery_update(
-    struct android::BatteryProperties* battery_props) {
-  battery_props->chargerAcOnline = true;
-  battery_props->chargerUsbOnline = true;
-  battery_props->chargerWirelessOnline = false;
-  battery_props->maxChargingCurrent = 500000;
-  battery_props->maxChargingVoltage = 5000000;
-  battery_props->batteryStatus = android::BATTERY_STATUS_CHARGING;
-  battery_props->batteryHealth = android::BATTERY_HEALTH_GOOD;
-  battery_props->batteryPresent = true;
-  battery_props->batteryLevel = 85;
-  battery_props->batteryVoltage = 3600;
-  battery_props->batteryTemperature = 350;
-  battery_props->batteryCurrent = 400000;
-  battery_props->batteryCycleCount = 32;
-  battery_props->batteryFullCharge = 4000000;
-  battery_props->batteryChargeCounter = 1900000;
-  battery_props->batteryTechnology = "Li-ion";
-  return 0;
-}
-
-void get_storage_info(std::vector<struct StorageInfo>&) {}
-
-void get_disk_stats(std::vector<struct DiskStats>&) {}
-
-int main(void) { return health_service_main(); }
diff --git a/guest/hals/hwcomposer/common/Android.bp b/guest/hals/hwcomposer/common/Android.bp
index 1b5125a..25d02f8 100644
--- a/guest/hals/hwcomposer/common/Android.bp
+++ b/guest/hals/hwcomposer/common/Android.bp
@@ -29,7 +29,6 @@
         "libyuv_static",
     ],
     shared_libs: [
-        "cuttlefish_auto_resources",
         "liblog",
         "libhardware",
         "libbase",
diff --git a/guest/hals/hwcomposer/cutf_cvm/Android.bp b/guest/hals/hwcomposer/cutf_cvm/Android.bp
index 3835765..5041b70 100644
--- a/guest/hals/hwcomposer/cutf_cvm/Android.bp
+++ b/guest/hals/hwcomposer/cutf_cvm/Android.bp
@@ -31,7 +31,6 @@
         "hwcomposer_common"
     ],
     shared_libs: [
-        "cuttlefish_auto_resources",
         "liblog",
         "libhardware",
         "libbase",
diff --git a/guest/hals/hwcomposer/vsoc-future/Android.mk b/guest/hals/hwcomposer/vsoc-future/Android.mk
deleted file mode 100644
index bcc104e..0000000
--- a/guest/hals/hwcomposer/vsoc-future/Android.mk
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright (C) 2017 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := hwcomposer.cutf_ivsh-future
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := \
-    hwcomposer.cpp
-
-LOCAL_C_INCLUDES += \
-    device/google/cuttlefish_kernel \
-    device/google/cuttlefish_common \
-    device/google/cuttlefish_common/guest/hals/hwcomposer \
-    hardware/libhardware/include \
-    system/core/base/include
-
-LOCAL_CFLAGS := \
-    -DLOG_TAG=\"hwcomposer_vsoc\" \
-    -Wall -Werror
-
-LOCAL_SHARED_LIBRARIES := \
-    libbase \
-    liblog \
-    vsoc_lib
-
-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_VENDOR_MODULE := true
-# See b/67109557
-ifeq (true, $(TARGET_TRANSLATE_2ND_ARCH))
-LOCAL_MULTILIB := first
-endif
-
-LOCAL_HEADER_LIBRARIES := \
-    libhardware_headers
-
-include $(BUILD_SHARED_LIBRARY)
-
-include $(call first-makefiles-under,$(LOCAL_PATH))
diff --git a/guest/hals/hwcomposer/vsoc-future/hwcomposer.cpp b/guest/hals/hwcomposer/vsoc-future/hwcomposer.cpp
deleted file mode 100644
index f18712c..0000000
--- a/guest/hals/hwcomposer/vsoc-future/hwcomposer.cpp
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <pthread.h>
-#include <sys/resource.h>
-#include <sys/time.h>
-
-#include <hardware/hwcomposer.h>
-#include <hardware/hwcomposer_defs.h>
-#include <log/log.h>
-
-#include "common/vsoc/lib/screen_region_view.h"
-#include "guest/hals/gralloc/gralloc_vsoc_priv.h"
-
-// This file contains just a skeleton hwcomposer, the first step in the
-// multisided vsoc hwcomposer for cuttlefish.
-
-using vsoc::screen::ScreenRegionView;
-
-// TODO(jemoreira): ScreenRegionView may become the HWC region
-namespace {
-
-// Ensures that the layer does not include any inconsistencies
-int SanityCheckLayer(const hwc_layer_1& layer) {
-  // Check displayFrame
-  if (layer.displayFrame.left > layer.displayFrame.right ||
-      layer.displayFrame.top > layer.displayFrame.bottom) {
-    ALOGE(
-        "%s: Malformed rectangle (displayFrame): [left = %d, right = %d, top = "
-        "%d, bottom = %d]",
-        __FUNCTION__, layer.displayFrame.left, layer.displayFrame.right,
-        layer.displayFrame.top, layer.displayFrame.bottom);
-    return -EINVAL;
-  }
-  // Check sourceCrop
-  if (layer.sourceCrop.left > layer.sourceCrop.right ||
-      layer.sourceCrop.top > layer.sourceCrop.bottom) {
-    ALOGE(
-        "%s: Malformed rectangle (sourceCrop): [left = %d, right = %d, top = "
-        "%d, bottom = %d]",
-        __FUNCTION__, layer.sourceCrop.left, layer.sourceCrop.right,
-        layer.sourceCrop.top, layer.sourceCrop.bottom);
-    return -EINVAL;
-  }
-  const vsoc_buffer_handle_t* p_handle =
-      reinterpret_cast<const vsoc_buffer_handle_t*>(layer.handle);
-  if (!p_handle) {
-    ALOGE("Layer has a NULL buffer handle");
-    return -EINVAL;
-  }
-  if (layer.sourceCrop.left < 0 || layer.sourceCrop.top < 0 ||
-      layer.sourceCrop.right > p_handle->x_res ||
-      layer.sourceCrop.bottom > p_handle->y_res) {
-    ALOGE(
-        "%s: Invalid sourceCrop for buffer handle: sourceCrop = [left = %d, "
-        "right = %d, top = %d, bottom = %d], handle = [width = %d, height = "
-        "%d]",
-        __FUNCTION__, layer.sourceCrop.left, layer.sourceCrop.right,
-        layer.sourceCrop.top, layer.sourceCrop.bottom, p_handle->x_res,
-        p_handle->y_res);
-    return -EINVAL;
-  }
-  return 0;
-}
-
-struct vsoc_hwc_device {
-  hwc_composer_device_1_t base;
-  const hwc_procs_t* procs;
-  pthread_t vsync_thread;
-  int64_t vsync_base_timestamp;
-  int32_t vsync_period_ns;
-  uint32_t frame_num;
-};
-
-void* vsync_thread(void* arg) {
-  vsoc_hwc_device* pdev = reinterpret_cast<vsoc_hwc_device*>(arg);
-  setpriority(PRIO_PROCESS, 0, HAL_PRIORITY_URGENT_DISPLAY);
-
-  int64_t base_timestamp = pdev->vsync_base_timestamp;
-  int64_t last_logged = base_timestamp / 1e9;
-  int sent = 0;
-  int last_sent = 0;
-  static const int log_interval = 60;
-  void (*vsync_proc)(const struct hwc_procs*, int, int64_t) = nullptr;
-  bool log_no_procs = true, log_no_vsync = true;
-  while (true) {
-    struct timespec rt;
-    if (clock_gettime(CLOCK_MONOTONIC, &rt) == -1) {
-      ALOGE("%s:%d error in vsync thread clock_gettime: %s", __FILE__, __LINE__,
-            strerror(errno));
-    }
-    int64_t timestamp = int64_t(rt.tv_sec) * 1e9 + rt.tv_nsec;
-    // Given now's timestamp calculate the time of the next vsync.
-    timestamp += pdev->vsync_period_ns -
-                 (timestamp - base_timestamp) % pdev->vsync_period_ns;
-
-    rt.tv_sec = timestamp / 1e9;
-    rt.tv_nsec = timestamp % static_cast<int32_t>(1e9);
-    int err = clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &rt, NULL);
-    if (err == -1) {
-      ALOGE("error in vsync thread: %s", strerror(errno));
-      if (errno == EINTR) {
-        continue;
-      }
-    }
-
-    // The vsync thread is started on device open, it may run before the
-    // registerProcs callback has a chance to be called, so we need to make sure
-    // procs is not NULL before dereferencing it.
-    if (pdev && pdev->procs) {
-      vsync_proc = pdev->procs->vsync;
-    } else if (log_no_procs) {
-      log_no_procs = false;
-      ALOGI("procs is not set yet, unable to deliver vsync event");
-    }
-    if (vsync_proc) {
-      vsync_proc(const_cast<hwc_procs_t*>(pdev->procs), 0, timestamp);
-      ++sent;
-    } else if (log_no_vsync) {
-      log_no_vsync = false;
-      ALOGE("vsync callback is null (but procs was already set)");
-    }
-    if (rt.tv_sec - last_logged > log_interval) {
-      ALOGI("Sent %d syncs in %ds", sent - last_sent, log_interval);
-      last_logged = rt.tv_sec;
-      last_sent = sent;
-    }
-  }
-
-  return NULL;
-}
-
-int hwc_prepare(struct hwc_composer_device_1* /*dev*/, size_t numDisplays,
-                hwc_display_contents_1_t** displays) {
-  if (!numDisplays || !displays) return 0;
-  hwc_display_contents_1_t* list = displays[HWC_DISPLAY_PRIMARY];
-  if (!list) return 0;
-
-  for (size_t i = 0; i < list->numHwLayers; i++) {
-    if (list->hwLayers[i].compositionType == HWC_FRAMEBUFFER_TARGET) {
-      continue;
-    }
-    list->hwLayers[i].compositionType = HWC_FRAMEBUFFER;
-  }
-
-  return 0;
-}
-
-int hwc_set(struct hwc_composer_device_1* dev, size_t numDisplays,
-            hwc_display_contents_1_t** displays) {
-  if (!numDisplays || !displays) return 0;
-  hwc_display_contents_1_t* list = displays[HWC_DISPLAY_PRIMARY];
-  if (!list) return 0;
-  if (!dev) {
-    ALOGE("%s: dev is NULL", __FUNCTION__);
-    return -EINVAL;
-  }
-
-  for (size_t i = 0; i < list->numHwLayers; i++) {
-    if (vsoc_buffer_handle_t::validate(list->hwLayers[i].handle)) {
-      return -EINVAL;
-    }
-    if (list->hwLayers[i].compositionType == HWC_FRAMEBUFFER_TARGET) {
-      if (SanityCheckLayer(list->hwLayers[i])) {
-        ALOGW("Skipping layer %zu due to failed sanity check", i);
-        continue;
-      }
-      const vsoc_buffer_handle_t* fb_handle =
-          reinterpret_cast<const vsoc_buffer_handle_t*>(
-              list->hwLayers[i].handle);
-      ScreenRegionView::GetInstance()->BroadcastNewFrame(fb_handle->offset);
-      break;
-    }
-  }
-
-  return 0;
-}
-
-int hwc_eventControl(struct hwc_composer_device_1* /*dev*/, int disp, int event,
-                     int /*enabled*/) {
-  if (event == HWC_EVENT_VSYNC || disp != HWC_DISPLAY_PRIMARY) {
-    return 0;
-  }
-  return -EINVAL;
-}
-
-int hwc_blank(struct hwc_composer_device_1* /*dev*/, int disp, int /*blank*/) {
-  if (disp != HWC_DISPLAY_PRIMARY) {
-    return -EINVAL;
-  }
-  return 0;
-}
-
-int hwc_query(struct hwc_composer_device_1* dev, int what, int* value) {
-  vsoc_hwc_device* pdev = reinterpret_cast<vsoc_hwc_device*>(dev);
-  switch (what) {
-    case HWC_BACKGROUND_LAYER_SUPPORTED:
-      // we don't support the background layer
-      *value = 0;
-      break;
-    case HWC_VSYNC_PERIOD:
-      *value = pdev->vsync_period_ns;
-      break;
-    case HWC_DISPLAY_TYPES_SUPPORTED:
-      // We only support the primary display
-      *value = HWC_DISPLAY_PRIMARY_BIT;
-      break;
-    default:
-      // unsupported query
-      ALOGE("%s badness unsupported query what=%d", __FUNCTION__, what);
-      return -EINVAL;
-  }
-  return 0;
-}
-
-void hwc_registerProcs(struct hwc_composer_device_1* dev,
-                       hwc_procs_t const* procs) {
-  reinterpret_cast<vsoc_hwc_device*>(dev)->procs = procs;
-}
-
-void hwc_dump(struct hwc_composer_device_1* /*dev*/, char* /*buff*/,
-              int /*buff_len*/) {}
-
-int hwc_getDisplayConfigs(struct hwc_composer_device_1* /*dev*/, int disp,
-                          uint32_t* configs, size_t* numConfigs) {
-  if (*numConfigs == 0) return 0;
-
-  if (disp == HWC_DISPLAY_PRIMARY) {
-    configs[0] = 0;
-    *numConfigs = 1;
-    return 0;
-  }
-
-  return -EINVAL;
-}
-
-int32_t vsoc_hwc_attribute(uint32_t attribute) {
-  auto screen_view = ScreenRegionView::GetInstance();
-  switch (attribute) {
-    case HWC_DISPLAY_VSYNC_PERIOD:
-      return 1000000000 / screen_view->refresh_rate_hz();
-    case HWC_DISPLAY_WIDTH:
-      return screen_view->x_res();
-    case HWC_DISPLAY_HEIGHT:
-      return screen_view->y_res();
-    case HWC_DISPLAY_DPI_X:
-    case HWC_DISPLAY_DPI_Y:
-      // The number of pixels per thousand inches
-      return screen_view->dpi() * 1000;
-    case HWC_DISPLAY_COLOR_TRANSFORM:
-      // TODO(jemoreira): Add the other color transformations
-      return HAL_COLOR_TRANSFORM_IDENTITY;
-    default:
-      ALOGE("unknown display attribute %u", attribute);
-      return -EINVAL;
-  }
-}
-
-int hwc_getDisplayAttributes(struct hwc_composer_device_1* /*dev*/, int disp,
-                             uint32_t /*config*/, const uint32_t* attributes,
-                             int32_t* values) {
-  if (disp != HWC_DISPLAY_PRIMARY) {
-    ALOGE("Unknown display type %u", disp);
-    return -EINVAL;
-  }
-
-  for (int i = 0; attributes[i] != HWC_DISPLAY_NO_ATTRIBUTE; i++) {
-    values[i] = vsoc_hwc_attribute(attributes[i]);
-  }
-
-  return 0;
-}
-
-int hwc_close(hw_device_t* device) {
-  vsoc_hwc_device* dev = reinterpret_cast<vsoc_hwc_device*>(device);
-  pthread_kill(dev->vsync_thread, SIGTERM);
-  pthread_join(dev->vsync_thread, NULL);
-  delete dev;
-  return 0;
-}
-
-int hwc_open(const struct hw_module_t* module, const char* name,
-             struct hw_device_t** device) {
-  ALOGI("Opening vsoc hwcomposer device: %s", __FUNCTION__);
-  if (strcmp(name, HWC_HARDWARE_COMPOSER)) {
-    ALOGE("%s called with bad name %s", __FUNCTION__, name);
-    return -EINVAL;
-  }
-
-  vsoc_hwc_device* dev = new vsoc_hwc_device();
-  if (!dev) {
-    ALOGE("%s failed to allocate dev", __FUNCTION__);
-    return -ENOMEM;
-  }
-  memset(dev, 0, sizeof(*dev));
-
-  int refreshRate = 60;
-  dev->vsync_period_ns = 1000000000 / refreshRate;
-  struct timespec rt;
-  if (clock_gettime(CLOCK_MONOTONIC, &rt) == -1) {
-    ALOGE("%s:%d error in clock_gettime: %s", __FILE__, __LINE__,
-          strerror(errno));
-  }
-  dev->vsync_base_timestamp = int64_t(rt.tv_sec) * 1e9 + rt.tv_nsec;
-
-  dev->base.common.tag = HARDWARE_DEVICE_TAG;
-  dev->base.common.version = HWC_DEVICE_API_VERSION_1_1;
-  dev->base.common.module = const_cast<hw_module_t*>(module);
-  dev->base.common.close = hwc_close;
-
-  dev->base.prepare = hwc_prepare;
-  dev->base.set = hwc_set;
-  dev->base.query = hwc_query;
-  dev->base.registerProcs = hwc_registerProcs;
-  dev->base.dump = hwc_dump;
-  dev->base.blank = hwc_blank;
-  dev->base.eventControl = hwc_eventControl;
-  dev->base.getDisplayConfigs = hwc_getDisplayConfigs;
-  dev->base.getDisplayAttributes = hwc_getDisplayAttributes;
-
-  if (!ScreenRegionView::GetInstance()) {
-    ALOGE("Unable to open screen region (%s)", __FUNCTION__);
-    delete dev;
-    return -1;
-  }
-
-  int ret = pthread_create(&dev->vsync_thread, NULL, vsync_thread, dev);
-  if (ret) {
-    ALOGE("failed to start vsync thread: %s", strerror(ret));
-    delete dev;
-  } else {
-    *device = &dev->base.common;
-  }
-
-  return -ret;
-}
-
-struct hw_module_methods_t hwc_module_methods = {hwc_open};
-
-}  // namespace
-
-hwc_module_t HAL_MODULE_INFO_SYM = {{HARDWARE_MODULE_TAG,
-                                     HWC_MODULE_API_VERSION_0_1,
-                                     HARDWARE_HAL_API_VERSION,
-                                     HWC_HARDWARE_MODULE_ID,
-                                     "Cuttlefish hwcomposer module",
-                                     "Google",
-                                     &hwc_module_methods,
-                                     NULL,
-                                     {0}}};
diff --git a/guest/hals/hwcomposer/vsoc/Android.bp b/guest/hals/hwcomposer/vsoc/Android.bp
deleted file mode 100644
index 559a1c1..0000000
--- a/guest/hals/hwcomposer/vsoc/Android.bp
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (C) 2019 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.
-
-
-cc_library_shared {
-    name: "hwcomposer.cutf_ivsh_ashmem",
-    relative_install_path: "hw",
-    defaults: ["cuttlefish_guest_only"],
-    cflags: [
-        "-DGATHER_STATS",
-        // Uncomment the following line to revert to GL compositions
-        // "-DUSE_OLD_HWCOMPOSER",
-    ],
-    srcs: [
-        "vsoc_screen_view.cpp",
-        "hwcomposer.cpp",
-    ],
-    export_include_dirs: ["."],
-    static_libs: [
-        "libyuv_static", 
-        "hwcomposer_common"
-    ],
-    shared_libs: [
-        "cuttlefish_auto_resources",
-        "liblog",
-        "libhardware",
-        "libbase",
-        "libcutils",
-        "libutils",
-        "libsync",
-        "libjpeg",
-        "libcuttlefish_utils",
-        "libcuttlefish_fs",
-        "vsoc_lib",
-    ],
-}
diff --git a/guest/hals/hwcomposer/vsoc/hwcomposer.cpp b/guest/hals/hwcomposer/vsoc/hwcomposer.cpp
deleted file mode 100644
index 67713f2..0000000
--- a/guest/hals/hwcomposer/vsoc/hwcomposer.cpp
+++ /dev/null
@@ -1,52 +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.
- */
-
-#define LOG_TAG "hwc.cutf_cvm"
-
-#include <cutils/properties.h>
-#include <hardware/hardware.h>
-#include <hardware/hwcomposer.h>
-#include <hardware/hwcomposer_defs.h>
-#include <log/log.h>
-
-#include "guest/hals/hwcomposer/common/hwcomposer.h"
-
-#include "guest/hals/hwcomposer/vsoc/vsoc_screen_view.h"
-
-static int hwc_open(const struct hw_module_t* module, const char* name,
-                    struct hw_device_t** device) {
-  std::unique_ptr<cvd::ScreenView> screen_view(new cvd::VSoCScreenView());
-  if (!screen_view) {
-    ALOGE("Failed to instantiate screen view");
-    return -1;
-  }
-
-  return cvd::cvd_hwc_open(std::move(screen_view), module, name, device);
-}
-
-static struct hw_module_methods_t hwc_module_methods = {
-    hwc_open,
-};
-
-hwc_module_t HAL_MODULE_INFO_SYM = {{HARDWARE_MODULE_TAG,
-                                     HWC_MODULE_API_VERSION_0_1,
-                                     HARDWARE_HAL_API_VERSION,
-                                     HWC_HARDWARE_MODULE_ID,
-                                     "VSoC hwcomposer module",
-                                     "Google",
-                                     &hwc_module_methods,
-                                     NULL,
-                                     {0}}};
diff --git a/guest/hals/hwcomposer/vsoc/vsoc_screen_view.cpp b/guest/hals/hwcomposer/vsoc/vsoc_screen_view.cpp
deleted file mode 100644
index 6ca9ac2..0000000
--- a/guest/hals/hwcomposer/vsoc/vsoc_screen_view.cpp
+++ /dev/null
@@ -1,81 +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/hwcomposer/vsoc/vsoc_screen_view.h"
-
-#include <sys/time.h>
-
-#include "common/vsoc/lib/screen_region_view.h"
-
-using vsoc::layout::screen::TimeSpec;
-using vsoc::screen::ScreenRegionView;
-
-namespace cvd {
-namespace {
-
-TimeSpec TimeSpecFromSystemStruct(const timespec* spec) {
-  return {static_cast<uint32_t>(spec->tv_sec),
-          static_cast<uint32_t>(spec->tv_nsec), 0};
-}
-
-void VSoCStatsFromCvdStats(vsoc::layout::screen::CompositionStats* vsoc_stats,
-                           const cvd::CompositionStats* stats) {
-  vsoc_stats->num_prepare_calls = stats->num_prepare_calls;
-  vsoc_stats->num_layers = stats->num_layers;
-  vsoc_stats->num_hwcomposited_layers = stats->num_hwcomposited_layers;
-  vsoc_stats->last_vsync = TimeSpecFromSystemStruct(&stats->last_vsync);
-  vsoc_stats->prepare_start = TimeSpecFromSystemStruct(&stats->prepare_start);
-  vsoc_stats->prepare_end = TimeSpecFromSystemStruct(&stats->prepare_end);
-  vsoc_stats->set_start = TimeSpecFromSystemStruct(&stats->set_start);
-  vsoc_stats->set_end = TimeSpecFromSystemStruct(&stats->set_end);
-}
-
-}  // namespace
-
-VSoCScreenView::VSoCScreenView()
-    : region_view_(ScreenRegionView::GetInstance()) {}
-
-VSoCScreenView::~VSoCScreenView() {}
-
-void VSoCScreenView::Broadcast(int buffer_id,
-                               const cvd::CompositionStats* stats) {
-  if (stats) {
-    vsoc::layout::screen::CompositionStats vsoc_stats;
-    VSoCStatsFromCvdStats(&vsoc_stats, stats);
-    region_view_->BroadcastNewFrame(buffer_id, &vsoc_stats);
-  } else {
-    region_view_->BroadcastNewFrame(buffer_id);
-  }
-}
-
-void* VSoCScreenView::GetBuffer(int fb_index) {
-  return region_view_->GetBuffer(fb_index);
-}
-
-int32_t VSoCScreenView::x_res() const { return region_view_->x_res(); }
-
-int32_t VSoCScreenView::y_res() const { return region_view_->y_res(); }
-
-int32_t VSoCScreenView::dpi() const { return region_view_->dpi(); }
-
-int32_t VSoCScreenView::refresh_rate() const {
-  return region_view_->refresh_rate_hz();
-}
-
-int VSoCScreenView::num_buffers() const {
-  return region_view_->number_of_buffers();
-}
-}  // namespace cvd
diff --git a/guest/hals/hwcomposer/vsoc/vsoc_screen_view.h b/guest/hals/hwcomposer/vsoc/vsoc_screen_view.h
deleted file mode 100644
index 1ecace6..0000000
--- a/guest/hals/hwcomposer/vsoc/vsoc_screen_view.h
+++ /dev/null
@@ -1,50 +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 <condition_variable>
-#include <functional>
-#include <mutex>
-#include <thread>
-#include <vector>
-
-#include "common/libs/fs/shared_fd.h"
-#include "common/vsoc/lib/screen_region_view.h"
-#include "guest/hals/hwcomposer/common/screen_view.h"
-
-namespace cvd {
-
-class VSoCScreenView : public ScreenView {
- public:
-  VSoCScreenView();
-  virtual ~VSoCScreenView();
-
-  void Broadcast(int buffer_id,
-                 const CompositionStats* stats = nullptr) override;
-  void* GetBuffer(int fb_index) override;
-
-  int32_t x_res() const override;
-  int32_t y_res() const override;
-  int32_t dpi() const override;
-  int32_t refresh_rate() const override;
-
-  int num_buffers() const override;
-
- private:
-  vsoc::screen::ScreenRegionView* region_view_;
-};
-
-}  // namespace cvd
diff --git a/guest/hals/ril/Android.mk b/guest/hals/ril/Android.mk
index 77db038..b37e257 100644
--- a/guest/hals/ril/Android.mk
+++ b/guest/hals/ril/Android.mk
@@ -26,7 +26,6 @@
   ${CUTTLEFISH_LIBRIL_NAME} \
   libcuttlefish_fs \
   cuttlefish_net \
-  cuttlefish_auto_resources \
   libbase \
   libcuttlefish_device_config \
 
diff --git a/guest/hals/ril/cuttlefish_ril.cpp b/guest/hals/ril/cuttlefish_ril.cpp
index 2053429..cb7446f 100644
--- a/guest/hals/ril/cuttlefish_ril.cpp
+++ b/guest/hals/ril/cuttlefish_ril.cpp
@@ -102,6 +102,7 @@
 static int gSimPINAttempts = 0;
 static const int gSimPINAttemptsMax = 3;
 static SIM_Status gSimStatus = SIM_NOT_READY;
+static bool areUiccApplicationsEnabled = true;
 
 // SetUpNetworkInterface configures IP and Broadcast addresses on a RIL
 // controlled network interface.
@@ -1213,6 +1214,40 @@
                                  sizeof(gCdmaSubscriptionType));
 }
 
+static void request_enable_uicc_applications(int /*request*/, void* data,
+                                             size_t datalen,
+                                             RIL_Token t) {
+  ALOGV("Enable uicc applications.");
+
+  if (data == NULL || datalen != sizeof(int)) {
+    gce_ril_env->OnRequestComplete(t, RIL_E_INTERNAL_ERR, NULL, 0);
+    return;
+  }
+
+  bool enable = *(int *)(data) != 0;
+
+  ALOGV("areUiccApplicationsEnabled change from %d to %d", areUiccApplicationsEnabled, enable);
+
+  areUiccApplicationsEnabled = enable;
+
+  gce_ril_env->OnRequestComplete(t, RIL_E_SUCCESS, NULL, 0);
+}
+
+static void request_are_uicc_applications_enabled(int /*request*/, void* /*data*/,
+                                                  size_t /*datalen*/,
+                                                  RIL_Token t) {
+  ALOGV("Getting whether uicc applications are enabled.");
+
+  gce_ril_env->OnRequestComplete(t, RIL_E_SUCCESS, &areUiccApplicationsEnabled, sizeof(bool));
+}
+
+static void request_can_toggle_uicc_applications_enablement(int /*request*/, void* /*data*/,
+                                                             size_t /*datalen*/, RIL_Token t) {
+  ALOGV("Getting can toggle uicc applications enablement.");
+
+  gce_ril_env->OnRequestComplete(t, RIL_E_SUCCESS, NULL, 0);
+}
+
 static void request_cdma_set_subscription_source(int /*request*/, void* data,
                                                  size_t /*datalen*/,
                                                  RIL_Token t) {
@@ -2229,6 +2264,13 @@
   return;
 }
 
+static void request_set_signal_strength_reporting_criteria_1_5(int /*request*/, void* /*data*/,
+                                                               size_t /*datalen*/, RIL_Token t) {
+  ALOGV("request_set_signal_strength_reporting_criteria_1_5 - void");
+  gce_ril_env->OnRequestComplete(t, RIL_E_SUCCESS, NULL, 0);
+  return;
+}
+
 static void request_enable_modem(int /*request*/, RIL_Token t) {
   ALOGV("Enabling modem - void");
   gce_ril_env->OnRequestComplete(t, RIL_E_SUCCESS, NULL, 0);
@@ -2473,6 +2515,9 @@
     case RIL_REQUEST_START_NETWORK_SCAN4:
       request_start_network_scan4(t);
       break;
+    case RIL_REQUEST_SET_SIGNAL_STRENGTH_REPORTING_CRITERIA_1_5:
+      request_set_signal_strength_reporting_criteria_1_5(request, data, datalen, t);
+      break;
     case RIL_REQUEST_GET_MODEM_STACK_STATUS:
       request_get_modem_stack_status(request, t);
       break;
@@ -2524,6 +2569,15 @@
     case RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE:
       request_exit_emergency_mode(data, datalen, t);
       break;
+    case RIL_REQUEST_ENABLE_UICC_APPLICATIONS:
+      request_enable_uicc_applications(request, data, datalen, t);
+      break;
+    case RIL_REQUEST_ARE_UICC_APPLICATIONS_ENABLED:
+      request_are_uicc_applications_enabled(request, data, datalen, t);
+      break;
+    case RIL_REQUEST_CAN_TOGGLE_UICC_APPLICATIONS_ENABLEMENT:
+      request_can_toggle_uicc_applications_enablement(request, data, datalen, t);
+      break;
     default:
       ALOGE("Request %d not supported.", request);
       gce_ril_env->OnRequestComplete(t, RIL_E_REQUEST_NOT_SUPPORTED, NULL, 0);
diff --git a/guest/hals/ril/libril/Android.mk b/guest/hals/ril/libril/Android.mk
index 290c8e1..f0fe2c7 100644
--- a/guest/hals/ril/libril/Android.mk
+++ b/guest/hals/ril/libril/Android.mk
@@ -43,6 +43,7 @@
     android.hardware.radio@1.2 \
     android.hardware.radio@1.3 \
     android.hardware.radio@1.4 \
+    android.hardware.radio@1.5 \
 
 LOCAL_STATIC_LIBRARIES := \
     libprotobuf-c-nano-enable_malloc \
diff --git a/guest/hals/ril/libril/ril.cpp b/guest/hals/ril/libril/ril.cpp
index fc20976..ef77ed2 100644
--- a/guest/hals/ril/libril/ril.cpp
+++ b/guest/hals/ril/libril/ril.cpp
@@ -285,12 +285,12 @@
                            : RESPONSE_UNSOLICITED;
         // acquire read lock for the service before calling nitzTimeReceivedInd() since it reads
         // nitzTimeReceived in ril_service
-        pthread_rwlock_t *radioServiceRwlockPtr = radio_1_4::getRadioServiceRwlock(
+        pthread_rwlock_t *radioServiceRwlockPtr = radio_1_5::getRadioServiceRwlock(
                 (int) socket_id);
         int rwlockRet = pthread_rwlock_rdlock(radioServiceRwlockPtr);
         assert(rwlockRet == 0);
 
-        int ret = radio_1_4::nitzTimeReceivedInd(
+        int ret = radio_1_5::nitzTimeReceivedInd(
             (int)socket_id, responseType, 0,
             RIL_E_SUCCESS, s_lastNITZTimeData, s_lastNITZTimeDataSize);
         if (ret == 0) {
@@ -456,7 +456,7 @@
                 == s_unsolResponses[i].requestNumber);
     }
 
-    radio_1_4::registerService(&s_callbacks, s_commands);
+    radio_1_5::registerService(&s_callbacks, s_commands);
     RLOGI("RILHIDL called registerService");
 
 }
@@ -574,12 +574,12 @@
     appendPrintBuf("Ack [%04d]< %s", pRI->token, requestToString(pRI->pCI->requestNumber));
 
     if (pRI->cancelled == 0) {
-        pthread_rwlock_t *radioServiceRwlockPtr = radio_1_4::getRadioServiceRwlock(
+        pthread_rwlock_t *radioServiceRwlockPtr = radio_1_5::getRadioServiceRwlock(
                 (int) socket_id);
         int rwlockRet = pthread_rwlock_rdlock(radioServiceRwlockPtr);
         assert(rwlockRet == 0);
 
-        radio_1_4::acknowledgeRequest((int) socket_id, pRI->token);
+        radio_1_5::acknowledgeRequest((int) socket_id, pRI->token);
 
         rwlockRet = pthread_rwlock_unlock(radioServiceRwlockPtr);
         assert(rwlockRet == 0);
@@ -632,7 +632,7 @@
         RLOGE ("Calling responseFunction() for token %d", pRI->token);
 #endif
 
-        pthread_rwlock_t *radioServiceRwlockPtr = radio_1_4::getRadioServiceRwlock((int) socket_id);
+        pthread_rwlock_t *radioServiceRwlockPtr = radio_1_5::getRadioServiceRwlock((int) socket_id);
         int rwlockRet = pthread_rwlock_rdlock(radioServiceRwlockPtr);
         assert(rwlockRet == 0);
 
@@ -778,14 +778,14 @@
         responseType = RESPONSE_UNSOLICITED;
     }
 
-    pthread_rwlock_t *radioServiceRwlockPtr = radio_1_4::getRadioServiceRwlock((int) soc_id);
+    pthread_rwlock_t *radioServiceRwlockPtr = radio_1_5::getRadioServiceRwlock((int) soc_id);
     int rwlockRet;
 
     if (unsolResponse == RIL_UNSOL_NITZ_TIME_RECEIVED) {
         // get a write lock in caes of NITZ since setNitzTimeReceived() is called
         rwlockRet = pthread_rwlock_wrlock(radioServiceRwlockPtr);
         assert(rwlockRet == 0);
-        radio_1_4::setNitzTimeReceived((int) soc_id, android::elapsedRealtime());
+        radio_1_5::setNitzTimeReceived((int) soc_id, android::elapsedRealtime());
     } else {
         rwlockRet = pthread_rwlock_rdlock(radioServiceRwlockPtr);
         assert(rwlockRet == 0);
@@ -1169,6 +1169,7 @@
         case RIL_REQUEST_GET_CARRIER_RESTRICTIONS: return "GET_CARRIER_RESTRICTIONS";
         case RIL_REQUEST_GET_CARRIER_RESTRICTIONS_1_4: return "GET_CARRIER_RESTRICTIONS_1_4";
         case RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION: return "SET_CARRIER_INFO_IMSI_ENCRYPTION";
+        case RIL_REQUEST_SET_SIGNAL_STRENGTH_REPORTING_CRITERIA_1_5: return "SET_SIGNAL_STRENGTH_REPORTING_CRITERIA_1_5";
         case RIL_RESPONSE_ACKNOWLEDGEMENT: return "RESPONSE_ACKNOWLEDGEMENT";
         case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: return "UNSOL_RESPONSE_RADIO_STATE_CHANGED";
         case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED: return "UNSOL_RESPONSE_CALL_STATE_CHANGED";
diff --git a/guest/hals/ril/libril/ril.h b/guest/hals/ril/libril/ril.h
index 9b1b0ff..addf66b 100644
--- a/guest/hals/ril/libril/ril.h
+++ b/guest/hals/ril/libril/ril.h
@@ -94,6 +94,9 @@
  *                    RIL_REQUEST_ENABLE_MODEM
  *                    RIL_REQUEST_EMERGENCY_DIAL
  *                    RIL_REQUEST_SET_SYSTEM_SELECTION_CHANNELS
+ *                    RIL_REQUEST_ENABLE_UICC_APPLICATIONS
+ *                    RIL_REQUEST_ARE_UICC_APPLICATIONS_ENABLED
+ *                    RIL_REQUEST_CAN_TOGGLE_UICC_APPLICATIONS_ENABLEMENT
  */
 #define RIL_VERSION 12
 #define LAST_IMPRECISE_RIL_VERSION 12 // Better self-documented name
@@ -6561,6 +6564,85 @@
  */
 #define RIL_REQUEST_GET_CARRIER_RESTRICTIONS_1_4 154
 
+/**
+ * Sets the signal strength reporting criteria.
+ *
+ * The resulting reporting rules are the AND of all the supplied criteria. For each RAN
+ * The hysteresisDb apply to only the following measured quantities:
+ * -GERAN    - RSSI
+ * -CDMA2000 - RSSI
+ * -UTRAN    - RSCP
+ * -EUTRAN   - RSRP/RSRQ/RSSNR
+ *
+ * The thresholds apply to only the following measured quantities:
+ * -GERAN    - RSSI
+ * -CDMA2000 - RSSI
+ * -UTRAN    - RSCP
+ * -EUTRAN   - RSRP/RSRQ/RSSNR
+ * -NGRAN    - SSRSRP/SSRSRQ/SSSINR
+ *
+ * Note: Reporting criteria must be individually set for each RAN. For any unset reporting
+ * criteria, the value is implementation-defined.
+ *
+ * Note: @1.5::SignalThresholdInfo includes fields 'hysteresisDb', 'hysteresisMs',
+ * and 'thresholds'. As this mechanism generally only constrains reports based on one
+ * measured quantity per RAN, if multiple measured quantities must be used to trigger a report
+ * for a given RAN, the only valid field may be hysteresisMs: hysteresisDb and thresholds must
+ * be set to zero and length zero respectively. If either hysteresisDb or thresholds is set,
+ * then reports shall only be triggered by the respective measured quantity, subject to the
+ * applied constraints.
+ *
+ * Valid errors returned:
+ *   RadioError:NONE
+ *   RadioError:INVALID_ARGUMENTS
+ *   RadioError:RADIO_NOT_AVAILABLE
+ */
+#define RIL_REQUEST_SET_SIGNAL_STRENGTH_REPORTING_CRITERIA_1_5 155
+
+/**
+ * RIL_REQUEST_ENABLE_UICC_APPLICATIONS
+ *
+ * Enable or disable uicc applications.
+ *
+ * Valid errors:
+ *  SUCCESS
+ *  RADIO_NOT_AVAILABLE
+ *  SIM_ABSENT
+ *  INTERNAL_ERR
+ *  REQUEST_NOT_SUPPORTED
+ */
+#define RIL_REQUEST_ENABLE_UICC_APPLICATIONS 156
+
+/**
+ * RIL_REQUEST_ARE_UICC_APPLICATIONS_ENABLED
+ *
+ * Whether uicc applications are enabled.
+ *
+ * Response: a boolean of enable or not.
+ *
+ * Valid errors:
+ *  SUCCESS
+ *  RADIO_NOT_AVAILABLE
+ *  SIM_ABSENT
+ *  INTERNAL_ERR
+ *  REQUEST_NOT_SUPPORTED
+ */
+#define RIL_REQUEST_ARE_UICC_APPLICATIONS_ENABLED 157
+
+/**
+ * RIL_REQUEST_CAN_TOGGLE_UICC_APPLICATIONS_ENABLEMENT
+ *
+ * Whether disabling / enabling uicc applications is supported
+ *
+ * Response: a boolean of whether it's supported.
+ *
+ * Valid errors:
+ *  SUCCESS
+ *  RADIO_NOT_AVAILABLE
+ *  INTERNAL_ERR
+ */
+#define RIL_REQUEST_CAN_TOGGLE_UICC_APPLICATIONS_ENABLEMENT 158
+
 /***********************************************************************/
 
 /**
diff --git a/guest/hals/ril/libril/ril_commands.h b/guest/hals/ril/libril/ril_commands.h
index d9a0db7..97183fd 100644
--- a/guest/hals/ril/libril/ril_commands.h
+++ b/guest/hals/ril/libril/ril_commands.h
@@ -15,157 +15,161 @@
 ** limitations under the License.
 */
     {0, NULL},                   //none
-    {RIL_REQUEST_GET_SIM_STATUS, radio_1_4::getIccCardStatusResponse},
-    {RIL_REQUEST_ENTER_SIM_PIN, radio_1_4::supplyIccPinForAppResponse},
-    {RIL_REQUEST_ENTER_SIM_PUK, radio_1_4::supplyIccPukForAppResponse},
-    {RIL_REQUEST_ENTER_SIM_PIN2, radio_1_4::supplyIccPin2ForAppResponse},
-    {RIL_REQUEST_ENTER_SIM_PUK2, radio_1_4::supplyIccPuk2ForAppResponse},
-    {RIL_REQUEST_CHANGE_SIM_PIN, radio_1_4::changeIccPinForAppResponse},
-    {RIL_REQUEST_CHANGE_SIM_PIN2, radio_1_4::changeIccPin2ForAppResponse},
-    {RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION, radio_1_4::supplyNetworkDepersonalizationResponse},
-    {RIL_REQUEST_GET_CURRENT_CALLS, radio_1_4::getCurrentCallsResponse},
-    {RIL_REQUEST_DIAL, radio_1_4::dialResponse},
-    {RIL_REQUEST_GET_IMSI, radio_1_4::getIMSIForAppResponse},
-    {RIL_REQUEST_HANGUP, radio_1_4::hangupConnectionResponse},
-    {RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND, radio_1_4::hangupWaitingOrBackgroundResponse},
-    {RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND, radio_1_4::hangupForegroundResumeBackgroundResponse},
-    {RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE, radio_1_4::switchWaitingOrHoldingAndActiveResponse},
-    {RIL_REQUEST_CONFERENCE, radio_1_4::conferenceResponse},
-    {RIL_REQUEST_UDUB, radio_1_4::rejectCallResponse},
-    {RIL_REQUEST_LAST_CALL_FAIL_CAUSE, radio_1_4::getLastCallFailCauseResponse},
-    {RIL_REQUEST_SIGNAL_STRENGTH, radio_1_4::getSignalStrengthResponse},
-    {RIL_REQUEST_VOICE_REGISTRATION_STATE, radio_1_4::getVoiceRegistrationStateResponse},
-    {RIL_REQUEST_DATA_REGISTRATION_STATE, radio_1_4::getDataRegistrationStateResponse},
-    {RIL_REQUEST_OPERATOR, radio_1_4::getOperatorResponse},
-    {RIL_REQUEST_RADIO_POWER, radio_1_4::setRadioPowerResponse},
-    {RIL_REQUEST_DTMF, radio_1_4::sendDtmfResponse},
-    {RIL_REQUEST_SEND_SMS, radio_1_4::sendSmsResponse},
-    {RIL_REQUEST_SEND_SMS_EXPECT_MORE, radio_1_4::sendSMSExpectMoreResponse},
-    {RIL_REQUEST_SETUP_DATA_CALL, radio_1_4::setupDataCallResponse},
-    {RIL_REQUEST_SIM_IO, radio_1_4::iccIOForAppResponse},
-    {RIL_REQUEST_SEND_USSD, radio_1_4::sendUssdResponse},
-    {RIL_REQUEST_CANCEL_USSD, radio_1_4::cancelPendingUssdResponse},
-    {RIL_REQUEST_GET_CLIR, radio_1_4::getClirResponse},
-    {RIL_REQUEST_SET_CLIR, radio_1_4::setClirResponse},
-    {RIL_REQUEST_QUERY_CALL_FORWARD_STATUS, radio_1_4::getCallForwardStatusResponse},
-    {RIL_REQUEST_SET_CALL_FORWARD, radio_1_4::setCallForwardResponse},
-    {RIL_REQUEST_QUERY_CALL_WAITING, radio_1_4::getCallWaitingResponse},
-    {RIL_REQUEST_SET_CALL_WAITING, radio_1_4::setCallWaitingResponse},
-    {RIL_REQUEST_SMS_ACKNOWLEDGE, radio_1_4::acknowledgeLastIncomingGsmSmsResponse},
+    {RIL_REQUEST_GET_SIM_STATUS, radio_1_5::getIccCardStatusResponse},
+    {RIL_REQUEST_ENTER_SIM_PIN, radio_1_5::supplyIccPinForAppResponse},
+    {RIL_REQUEST_ENTER_SIM_PUK, radio_1_5::supplyIccPukForAppResponse},
+    {RIL_REQUEST_ENTER_SIM_PIN2, radio_1_5::supplyIccPin2ForAppResponse},
+    {RIL_REQUEST_ENTER_SIM_PUK2, radio_1_5::supplyIccPuk2ForAppResponse},
+    {RIL_REQUEST_CHANGE_SIM_PIN, radio_1_5::changeIccPinForAppResponse},
+    {RIL_REQUEST_CHANGE_SIM_PIN2, radio_1_5::changeIccPin2ForAppResponse},
+    {RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION, radio_1_5::supplyNetworkDepersonalizationResponse},
+    {RIL_REQUEST_GET_CURRENT_CALLS, radio_1_5::getCurrentCallsResponse},
+    {RIL_REQUEST_DIAL, radio_1_5::dialResponse},
+    {RIL_REQUEST_GET_IMSI, radio_1_5::getIMSIForAppResponse},
+    {RIL_REQUEST_HANGUP, radio_1_5::hangupConnectionResponse},
+    {RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND, radio_1_5::hangupWaitingOrBackgroundResponse},
+    {RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND, radio_1_5::hangupForegroundResumeBackgroundResponse},
+    {RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE, radio_1_5::switchWaitingOrHoldingAndActiveResponse},
+    {RIL_REQUEST_CONFERENCE, radio_1_5::conferenceResponse},
+    {RIL_REQUEST_UDUB, radio_1_5::rejectCallResponse},
+    {RIL_REQUEST_LAST_CALL_FAIL_CAUSE, radio_1_5::getLastCallFailCauseResponse},
+    {RIL_REQUEST_SIGNAL_STRENGTH, radio_1_5::getSignalStrengthResponse},
+    {RIL_REQUEST_VOICE_REGISTRATION_STATE, radio_1_5::getVoiceRegistrationStateResponse},
+    {RIL_REQUEST_DATA_REGISTRATION_STATE, radio_1_5::getDataRegistrationStateResponse},
+    {RIL_REQUEST_OPERATOR, radio_1_5::getOperatorResponse},
+    {RIL_REQUEST_RADIO_POWER, radio_1_5::setRadioPowerResponse},
+    {RIL_REQUEST_DTMF, radio_1_5::sendDtmfResponse},
+    {RIL_REQUEST_SEND_SMS, radio_1_5::sendSmsResponse},
+    {RIL_REQUEST_SEND_SMS_EXPECT_MORE, radio_1_5::sendSMSExpectMoreResponse},
+    {RIL_REQUEST_SETUP_DATA_CALL, radio_1_5::setupDataCallResponse},
+    {RIL_REQUEST_SIM_IO, radio_1_5::iccIOForAppResponse},
+    {RIL_REQUEST_SEND_USSD, radio_1_5::sendUssdResponse},
+    {RIL_REQUEST_CANCEL_USSD, radio_1_5::cancelPendingUssdResponse},
+    {RIL_REQUEST_GET_CLIR, radio_1_5::getClirResponse},
+    {RIL_REQUEST_SET_CLIR, radio_1_5::setClirResponse},
+    {RIL_REQUEST_QUERY_CALL_FORWARD_STATUS, radio_1_5::getCallForwardStatusResponse},
+    {RIL_REQUEST_SET_CALL_FORWARD, radio_1_5::setCallForwardResponse},
+    {RIL_REQUEST_QUERY_CALL_WAITING, radio_1_5::getCallWaitingResponse},
+    {RIL_REQUEST_SET_CALL_WAITING, radio_1_5::setCallWaitingResponse},
+    {RIL_REQUEST_SMS_ACKNOWLEDGE, radio_1_5::acknowledgeLastIncomingGsmSmsResponse},
     {RIL_REQUEST_GET_IMEI, NULL},
     {RIL_REQUEST_GET_IMEISV, NULL},
-    {RIL_REQUEST_ANSWER, radio_1_4::acceptCallResponse},
-    {RIL_REQUEST_DEACTIVATE_DATA_CALL, radio_1_4::deactivateDataCallResponse},
-    {RIL_REQUEST_QUERY_FACILITY_LOCK, radio_1_4::getFacilityLockForAppResponse},
-    {RIL_REQUEST_SET_FACILITY_LOCK, radio_1_4::setFacilityLockForAppResponse},
-    {RIL_REQUEST_CHANGE_BARRING_PASSWORD, radio_1_4::setBarringPasswordResponse},
-    {RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE, radio_1_4::getNetworkSelectionModeResponse},
-    {RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC, radio_1_4::setNetworkSelectionModeAutomaticResponse},
-    {RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, radio_1_4::setNetworkSelectionModeManualResponse},
-    {RIL_REQUEST_QUERY_AVAILABLE_NETWORKS , radio_1_4::getAvailableNetworksResponse},
-    {RIL_REQUEST_DTMF_START, radio_1_4::startDtmfResponse},
-    {RIL_REQUEST_DTMF_STOP, radio_1_4::stopDtmfResponse},
-    {RIL_REQUEST_BASEBAND_VERSION, radio_1_4::getBasebandVersionResponse},
-    {RIL_REQUEST_SEPARATE_CONNECTION, radio_1_4::separateConnectionResponse},
-    {RIL_REQUEST_SET_MUTE, radio_1_4::setMuteResponse},
-    {RIL_REQUEST_GET_MUTE, radio_1_4::getMuteResponse},
-    {RIL_REQUEST_QUERY_CLIP, radio_1_4::getClipResponse},
+    {RIL_REQUEST_ANSWER, radio_1_5::acceptCallResponse},
+    {RIL_REQUEST_DEACTIVATE_DATA_CALL, radio_1_5::deactivateDataCallResponse},
+    {RIL_REQUEST_QUERY_FACILITY_LOCK, radio_1_5::getFacilityLockForAppResponse},
+    {RIL_REQUEST_SET_FACILITY_LOCK, radio_1_5::setFacilityLockForAppResponse},
+    {RIL_REQUEST_CHANGE_BARRING_PASSWORD, radio_1_5::setBarringPasswordResponse},
+    {RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE, radio_1_5::getNetworkSelectionModeResponse},
+    {RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC, radio_1_5::setNetworkSelectionModeAutomaticResponse},
+    {RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, radio_1_5::setNetworkSelectionModeManualResponse},
+    {RIL_REQUEST_QUERY_AVAILABLE_NETWORKS , radio_1_5::getAvailableNetworksResponse},
+    {RIL_REQUEST_DTMF_START, radio_1_5::startDtmfResponse},
+    {RIL_REQUEST_DTMF_STOP, radio_1_5::stopDtmfResponse},
+    {RIL_REQUEST_BASEBAND_VERSION, radio_1_5::getBasebandVersionResponse},
+    {RIL_REQUEST_SEPARATE_CONNECTION, radio_1_5::separateConnectionResponse},
+    {RIL_REQUEST_SET_MUTE, radio_1_5::setMuteResponse},
+    {RIL_REQUEST_GET_MUTE, radio_1_5::getMuteResponse},
+    {RIL_REQUEST_QUERY_CLIP, radio_1_5::getClipResponse},
     {RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE, NULL},
-    {RIL_REQUEST_DATA_CALL_LIST, radio_1_4::getDataCallListResponse},
+    {RIL_REQUEST_DATA_CALL_LIST, radio_1_5::getDataCallListResponse},
     {RIL_REQUEST_RESET_RADIO, NULL},
-    {RIL_REQUEST_OEM_HOOK_RAW, radio_1_4::sendRequestRawResponse},
-    {RIL_REQUEST_OEM_HOOK_STRINGS, radio_1_4::sendRequestStringsResponse},
-    {RIL_REQUEST_SCREEN_STATE, radio_1_4::sendDeviceStateResponse},   // Note the response function is different.
-    {RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION, radio_1_4::setSuppServiceNotificationsResponse},
-    {RIL_REQUEST_WRITE_SMS_TO_SIM, radio_1_4::writeSmsToSimResponse},
-    {RIL_REQUEST_DELETE_SMS_ON_SIM, radio_1_4::deleteSmsOnSimResponse},
-    {RIL_REQUEST_SET_BAND_MODE, radio_1_4::setBandModeResponse},
-    {RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE, radio_1_4::getAvailableBandModesResponse},
+    {RIL_REQUEST_OEM_HOOK_RAW, radio_1_5::sendRequestRawResponse},
+    {RIL_REQUEST_OEM_HOOK_STRINGS, radio_1_5::sendRequestStringsResponse},
+    {RIL_REQUEST_SCREEN_STATE, radio_1_5::sendDeviceStateResponse},   // Note the response function is different.
+    {RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION, radio_1_5::setSuppServiceNotificationsResponse},
+    {RIL_REQUEST_WRITE_SMS_TO_SIM, radio_1_5::writeSmsToSimResponse},
+    {RIL_REQUEST_DELETE_SMS_ON_SIM, radio_1_5::deleteSmsOnSimResponse},
+    {RIL_REQUEST_SET_BAND_MODE, radio_1_5::setBandModeResponse},
+    {RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE, radio_1_5::getAvailableBandModesResponse},
     {RIL_REQUEST_STK_GET_PROFILE, NULL},
     {RIL_REQUEST_STK_SET_PROFILE, NULL},
-    {RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND, radio_1_4::sendEnvelopeResponse},
-    {RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE, radio_1_4::sendTerminalResponseToSimResponse},
-    {RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM, radio_1_4::handleStkCallSetupRequestFromSimResponse},
-    {RIL_REQUEST_EXPLICIT_CALL_TRANSFER, radio_1_4::explicitCallTransferResponse},
-    {RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, radio_1_4::setPreferredNetworkTypeResponse},
-    {RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE, radio_1_4::getPreferredNetworkTypeResponse},
-    {RIL_REQUEST_GET_NEIGHBORING_CELL_IDS, radio_1_4::getNeighboringCidsResponse},
-    {RIL_REQUEST_SET_LOCATION_UPDATES, radio_1_4::setLocationUpdatesResponse},
-    {RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE, radio_1_4::setCdmaSubscriptionSourceResponse},
-    {RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE, radio_1_4::setCdmaRoamingPreferenceResponse},
-    {RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE, radio_1_4::getCdmaRoamingPreferenceResponse},
-    {RIL_REQUEST_SET_TTY_MODE, radio_1_4::setTTYModeResponse},
-    {RIL_REQUEST_QUERY_TTY_MODE, radio_1_4::getTTYModeResponse},
-    {RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE, radio_1_4::setPreferredVoicePrivacyResponse},
-    {RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE, radio_1_4::getPreferredVoicePrivacyResponse},
-    {RIL_REQUEST_CDMA_FLASH, radio_1_4::sendCDMAFeatureCodeResponse},
-    {RIL_REQUEST_CDMA_BURST_DTMF, radio_1_4::sendBurstDtmfResponse},
+    {RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND, radio_1_5::sendEnvelopeResponse},
+    {RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE, radio_1_5::sendTerminalResponseToSimResponse},
+    {RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM, radio_1_5::handleStkCallSetupRequestFromSimResponse},
+    {RIL_REQUEST_EXPLICIT_CALL_TRANSFER, radio_1_5::explicitCallTransferResponse},
+    {RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, radio_1_5::setPreferredNetworkTypeResponse},
+    {RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE, radio_1_5::getPreferredNetworkTypeResponse},
+    {RIL_REQUEST_GET_NEIGHBORING_CELL_IDS, radio_1_5::getNeighboringCidsResponse},
+    {RIL_REQUEST_SET_LOCATION_UPDATES, radio_1_5::setLocationUpdatesResponse},
+    {RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE, radio_1_5::setCdmaSubscriptionSourceResponse},
+    {RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE, radio_1_5::setCdmaRoamingPreferenceResponse},
+    {RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE, radio_1_5::getCdmaRoamingPreferenceResponse},
+    {RIL_REQUEST_SET_TTY_MODE, radio_1_5::setTTYModeResponse},
+    {RIL_REQUEST_QUERY_TTY_MODE, radio_1_5::getTTYModeResponse},
+    {RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE, radio_1_5::setPreferredVoicePrivacyResponse},
+    {RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE, radio_1_5::getPreferredVoicePrivacyResponse},
+    {RIL_REQUEST_CDMA_FLASH, radio_1_5::sendCDMAFeatureCodeResponse},
+    {RIL_REQUEST_CDMA_BURST_DTMF, radio_1_5::sendBurstDtmfResponse},
     {RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY, NULL},
-    {RIL_REQUEST_CDMA_SEND_SMS, radio_1_4::sendCdmaSmsResponse},
-    {RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE, radio_1_4::acknowledgeLastIncomingCdmaSmsResponse},
-    {RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG, radio_1_4::getGsmBroadcastConfigResponse},
-    {RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG, radio_1_4::setGsmBroadcastConfigResponse},
-    {RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION, radio_1_4::setGsmBroadcastActivationResponse},
-    {RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG, radio_1_4::getCdmaBroadcastConfigResponse},
-    {RIL_REQUEST_CDMA_SET_BROADCAST_SMS_CONFIG, radio_1_4::setCdmaBroadcastConfigResponse},
-    {RIL_REQUEST_CDMA_SMS_BROADCAST_ACTIVATION, radio_1_4::setCdmaBroadcastActivationResponse},
-    {RIL_REQUEST_CDMA_SUBSCRIPTION, radio_1_4::getCDMASubscriptionResponse},
-    {RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM, radio_1_4::writeSmsToRuimResponse},
-    {RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM, radio_1_4::deleteSmsOnRuimResponse},
-    {RIL_REQUEST_DEVICE_IDENTITY, radio_1_4::getDeviceIdentityResponse},
-    {RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE, radio_1_4::exitEmergencyCallbackModeResponse},
-    {RIL_REQUEST_GET_SMSC_ADDRESS, radio_1_4::getSmscAddressResponse},
-    {RIL_REQUEST_SET_SMSC_ADDRESS, radio_1_4::setSmscAddressResponse},
-    {RIL_REQUEST_REPORT_SMS_MEMORY_STATUS, radio_1_4::reportSmsMemoryStatusResponse},
-    {RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING, radio_1_4::reportStkServiceIsRunningResponse},
-    {RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE, radio_1_4::getCdmaSubscriptionSourceResponse},
-    {RIL_REQUEST_ISIM_AUTHENTICATION, radio_1_4::requestIsimAuthenticationResponse},
-    {RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU, radio_1_4::acknowledgeIncomingGsmSmsWithPduResponse},
-    {RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS, radio_1_4::sendEnvelopeWithStatusResponse},
-    {RIL_REQUEST_VOICE_RADIO_TECH, radio_1_4::getVoiceRadioTechnologyResponse},
-    {RIL_REQUEST_GET_CELL_INFO_LIST, radio_1_4::getCellInfoListResponse},
-    {RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE, radio_1_4::setCellInfoListRateResponse},
-    {RIL_REQUEST_SET_INITIAL_ATTACH_APN, radio_1_4::setInitialAttachApnResponse},
-    {RIL_REQUEST_IMS_REGISTRATION_STATE, radio_1_4::getImsRegistrationStateResponse},
-    {RIL_REQUEST_IMS_SEND_SMS, radio_1_4::sendImsSmsResponse},
-    {RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC, radio_1_4::iccTransmitApduBasicChannelResponse},
-    {RIL_REQUEST_SIM_OPEN_CHANNEL, radio_1_4::iccOpenLogicalChannelResponse},
-    {RIL_REQUEST_SIM_CLOSE_CHANNEL, radio_1_4::iccCloseLogicalChannelResponse},
-    {RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL, radio_1_4::iccTransmitApduLogicalChannelResponse},
-    {RIL_REQUEST_NV_READ_ITEM, radio_1_4::nvReadItemResponse},
-    {RIL_REQUEST_NV_WRITE_ITEM, radio_1_4::nvWriteItemResponse},
-    {RIL_REQUEST_NV_WRITE_CDMA_PRL, radio_1_4::nvWriteCdmaPrlResponse},
-    {RIL_REQUEST_NV_RESET_CONFIG, radio_1_4::nvResetConfigResponse},
-    {RIL_REQUEST_SET_UICC_SUBSCRIPTION, radio_1_4::setUiccSubscriptionResponse},
-    {RIL_REQUEST_ALLOW_DATA, radio_1_4::setDataAllowedResponse},
-    {RIL_REQUEST_GET_HARDWARE_CONFIG, radio_1_4::getHardwareConfigResponse},
-    {RIL_REQUEST_SIM_AUTHENTICATION, radio_1_4::requestIccSimAuthenticationResponse},
+    {RIL_REQUEST_CDMA_SEND_SMS, radio_1_5::sendCdmaSmsResponse},
+    {RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE, radio_1_5::acknowledgeLastIncomingCdmaSmsResponse},
+    {RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG, radio_1_5::getGsmBroadcastConfigResponse},
+    {RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG, radio_1_5::setGsmBroadcastConfigResponse},
+    {RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION, radio_1_5::setGsmBroadcastActivationResponse},
+    {RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG, radio_1_5::getCdmaBroadcastConfigResponse},
+    {RIL_REQUEST_CDMA_SET_BROADCAST_SMS_CONFIG, radio_1_5::setCdmaBroadcastConfigResponse},
+    {RIL_REQUEST_CDMA_SMS_BROADCAST_ACTIVATION, radio_1_5::setCdmaBroadcastActivationResponse},
+    {RIL_REQUEST_CDMA_SUBSCRIPTION, radio_1_5::getCDMASubscriptionResponse},
+    {RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM, radio_1_5::writeSmsToRuimResponse},
+    {RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM, radio_1_5::deleteSmsOnRuimResponse},
+    {RIL_REQUEST_DEVICE_IDENTITY, radio_1_5::getDeviceIdentityResponse},
+    {RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE, radio_1_5::exitEmergencyCallbackModeResponse},
+    {RIL_REQUEST_GET_SMSC_ADDRESS, radio_1_5::getSmscAddressResponse},
+    {RIL_REQUEST_SET_SMSC_ADDRESS, radio_1_5::setSmscAddressResponse},
+    {RIL_REQUEST_REPORT_SMS_MEMORY_STATUS, radio_1_5::reportSmsMemoryStatusResponse},
+    {RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING, radio_1_5::reportStkServiceIsRunningResponse},
+    {RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE, radio_1_5::getCdmaSubscriptionSourceResponse},
+    {RIL_REQUEST_ISIM_AUTHENTICATION, radio_1_5::requestIsimAuthenticationResponse},
+    {RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU, radio_1_5::acknowledgeIncomingGsmSmsWithPduResponse},
+    {RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS, radio_1_5::sendEnvelopeWithStatusResponse},
+    {RIL_REQUEST_VOICE_RADIO_TECH, radio_1_5::getVoiceRadioTechnologyResponse},
+    {RIL_REQUEST_GET_CELL_INFO_LIST, radio_1_5::getCellInfoListResponse},
+    {RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE, radio_1_5::setCellInfoListRateResponse},
+    {RIL_REQUEST_SET_INITIAL_ATTACH_APN, radio_1_5::setInitialAttachApnResponse},
+    {RIL_REQUEST_IMS_REGISTRATION_STATE, radio_1_5::getImsRegistrationStateResponse},
+    {RIL_REQUEST_IMS_SEND_SMS, radio_1_5::sendImsSmsResponse},
+    {RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC, radio_1_5::iccTransmitApduBasicChannelResponse},
+    {RIL_REQUEST_SIM_OPEN_CHANNEL, radio_1_5::iccOpenLogicalChannelResponse},
+    {RIL_REQUEST_SIM_CLOSE_CHANNEL, radio_1_5::iccCloseLogicalChannelResponse},
+    {RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL, radio_1_5::iccTransmitApduLogicalChannelResponse},
+    {RIL_REQUEST_NV_READ_ITEM, radio_1_5::nvReadItemResponse},
+    {RIL_REQUEST_NV_WRITE_ITEM, radio_1_5::nvWriteItemResponse},
+    {RIL_REQUEST_NV_WRITE_CDMA_PRL, radio_1_5::nvWriteCdmaPrlResponse},
+    {RIL_REQUEST_NV_RESET_CONFIG, radio_1_5::nvResetConfigResponse},
+    {RIL_REQUEST_SET_UICC_SUBSCRIPTION, radio_1_5::setUiccSubscriptionResponse},
+    {RIL_REQUEST_ALLOW_DATA, radio_1_5::setDataAllowedResponse},
+    {RIL_REQUEST_GET_HARDWARE_CONFIG, radio_1_5::getHardwareConfigResponse},
+    {RIL_REQUEST_SIM_AUTHENTICATION, radio_1_5::requestIccSimAuthenticationResponse},
     {RIL_REQUEST_GET_DC_RT_INFO, NULL},
     {RIL_REQUEST_SET_DC_RT_INFO_RATE, NULL},
-    {RIL_REQUEST_SET_DATA_PROFILE, radio_1_4::setDataProfileResponse},
-    {RIL_REQUEST_SHUTDOWN, radio_1_4::requestShutdownResponse},
-    {RIL_REQUEST_GET_RADIO_CAPABILITY, radio_1_4::getRadioCapabilityResponse},
-    {RIL_REQUEST_SET_RADIO_CAPABILITY, radio_1_4::setRadioCapabilityResponse},
-    {RIL_REQUEST_START_LCE, radio_1_4::startLceServiceResponse},
-    {RIL_REQUEST_STOP_LCE, radio_1_4::stopLceServiceResponse},
-    {RIL_REQUEST_PULL_LCEDATA, radio_1_4::pullLceDataResponse},
-    {RIL_REQUEST_GET_ACTIVITY_INFO, radio_1_4::getModemActivityInfoResponse},
-    {RIL_REQUEST_SET_CARRIER_RESTRICTIONS, radio_1_4::setAllowedCarriersResponse},
-    {RIL_REQUEST_GET_CARRIER_RESTRICTIONS, radio_1_4::getAllowedCarriersResponse},
-    {RIL_REQUEST_SEND_DEVICE_STATE, radio_1_4::sendDeviceStateResponse},
-    {RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER, radio_1_4::setIndicationFilterResponse},
-    {RIL_REQUEST_SET_SIM_CARD_POWER, radio_1_4::setSimCardPowerResponse},
-    {RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION, radio_1_4::setCarrierInfoForImsiEncryptionResponse},
-    {RIL_REQUEST_START_NETWORK_SCAN, radio_1_4::startNetworkScanResponse},
-    {RIL_REQUEST_STOP_NETWORK_SCAN, radio_1_4::stopNetworkScanResponse},
-    {RIL_REQUEST_START_KEEPALIVE, radio_1_4::startKeepaliveResponse},
-    {RIL_REQUEST_STOP_KEEPALIVE, radio_1_4::stopKeepaliveResponse},
-    {RIL_REQUEST_START_NETWORK_SCAN4, radio_1_4::startNetworkScanResponse4},
-    {RIL_REQUEST_GET_MODEM_STACK_STATUS, radio_1_4::getModemStackStatusResponse},
-    {RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE_BITMAP, radio_1_4::getPreferredNetworkTypeBitmapResponse},
-    {RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE_BITMAP, radio_1_4::setPreferredNetworkTypeBitmapResponse},
-    {RIL_REQUEST_EMERGENCY_DIAL, radio_1_4::emergencyDialResponse},
-    {RIL_REQUEST_SET_SYSTEM_SELECTION_CHANNELS, radio_1_4::setSystemSelectionChannelsResponse},
-    {RIL_REQUEST_ENABLE_MODEM, radio_1_4::enableModemResponse},
-    {RIL_REQUEST_SET_CARRIER_RESTRICTIONS_1_4, radio_1_4::setAllowedCarriersResponse4},
-    {RIL_REQUEST_GET_CARRIER_RESTRICTIONS_1_4, radio_1_4::getAllowedCarriersResponse4},
+    {RIL_REQUEST_SET_DATA_PROFILE, radio_1_5::setDataProfileResponse},
+    {RIL_REQUEST_SHUTDOWN, radio_1_5::requestShutdownResponse},
+    {RIL_REQUEST_GET_RADIO_CAPABILITY, radio_1_5::getRadioCapabilityResponse},
+    {RIL_REQUEST_SET_RADIO_CAPABILITY, radio_1_5::setRadioCapabilityResponse},
+    {RIL_REQUEST_START_LCE, radio_1_5::startLceServiceResponse},
+    {RIL_REQUEST_STOP_LCE, radio_1_5::stopLceServiceResponse},
+    {RIL_REQUEST_PULL_LCEDATA, radio_1_5::pullLceDataResponse},
+    {RIL_REQUEST_GET_ACTIVITY_INFO, radio_1_5::getModemActivityInfoResponse},
+    {RIL_REQUEST_SET_CARRIER_RESTRICTIONS, radio_1_5::setAllowedCarriersResponse},
+    {RIL_REQUEST_GET_CARRIER_RESTRICTIONS, radio_1_5::getAllowedCarriersResponse},
+    {RIL_REQUEST_SEND_DEVICE_STATE, radio_1_5::sendDeviceStateResponse},
+    {RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER, radio_1_5::setIndicationFilterResponse},
+    {RIL_REQUEST_SET_SIM_CARD_POWER, radio_1_5::setSimCardPowerResponse},
+    {RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION, radio_1_5::setCarrierInfoForImsiEncryptionResponse},
+    {RIL_REQUEST_START_NETWORK_SCAN, radio_1_5::startNetworkScanResponse},
+    {RIL_REQUEST_STOP_NETWORK_SCAN, radio_1_5::stopNetworkScanResponse},
+    {RIL_REQUEST_START_KEEPALIVE, radio_1_5::startKeepaliveResponse},
+    {RIL_REQUEST_STOP_KEEPALIVE, radio_1_5::stopKeepaliveResponse},
+    {RIL_REQUEST_START_NETWORK_SCAN4, radio_1_5::startNetworkScanResponse4},
+    {RIL_REQUEST_GET_MODEM_STACK_STATUS, radio_1_5::getModemStackStatusResponse},
+    {RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE_BITMAP, radio_1_5::getPreferredNetworkTypeBitmapResponse},
+    {RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE_BITMAP, radio_1_5::setPreferredNetworkTypeBitmapResponse},
+    {RIL_REQUEST_EMERGENCY_DIAL, radio_1_5::emergencyDialResponse},
+    {RIL_REQUEST_SET_SYSTEM_SELECTION_CHANNELS, radio_1_5::setSystemSelectionChannelsResponse},
+    {RIL_REQUEST_ENABLE_MODEM, radio_1_5::enableModemResponse},
+    {RIL_REQUEST_SET_CARRIER_RESTRICTIONS_1_4, radio_1_5::setAllowedCarriersResponse4},
+    {RIL_REQUEST_GET_CARRIER_RESTRICTIONS_1_4, radio_1_5::getAllowedCarriersResponse4},
+    {RIL_REQUEST_SET_SIGNAL_STRENGTH_REPORTING_CRITERIA_1_5, radio_1_5::setSignalStrengthReportingCriteriaResponse_1_5},
+    {RIL_REQUEST_ENABLE_UICC_APPLICATIONS, radio_1_5::enableUiccApplicationsResponse},
+    {RIL_REQUEST_ARE_UICC_APPLICATIONS_ENABLED, radio_1_5::areUiccApplicationsEnabledResponse},
+    {RIL_REQUEST_CAN_TOGGLE_UICC_APPLICATIONS_ENABLEMENT, radio_1_5::canToggleUiccApplicationsEnablementResponse},
diff --git a/guest/hals/ril/libril/ril_service.cpp b/guest/hals/ril/libril/ril_service.cpp
index 23a61ee..f7bb895 100755
--- a/guest/hals/ril/libril/ril_service.cpp
+++ b/guest/hals/ril/libril/ril_service.cpp
@@ -16,10 +16,10 @@
 
 #define LOG_TAG "RILC"
 
-#include <android/hardware/radio/1.4/IRadio.h>
-#include <android/hardware/radio/1.4/IRadioResponse.h>
-#include <android/hardware/radio/1.4/IRadioIndication.h>
-#include <android/hardware/radio/1.4/types.h>
+#include <android/hardware/radio/1.5/IRadio.h>
+#include <android/hardware/radio/1.5/IRadioResponse.h>
+#include <android/hardware/radio/1.5/IRadioIndication.h>
+#include <android/hardware/radio/1.5/types.h>
 
 #include <android/hardware/radio/deprecated/1.0/IOemHook.h>
 
@@ -72,18 +72,18 @@
 RIL_RadioFunctions *s_vendorFunctions = NULL;
 static CommandInfo *s_commands;
 
-struct RadioImpl_1_4;
+struct RadioImpl_1_5;
 struct OemHookImpl;
 
 #if (SIM_COUNT >= 2)
-sp<RadioImpl_1_4> radioService[SIM_COUNT];
+sp<RadioImpl_1_5> radioService[SIM_COUNT];
 sp<OemHookImpl> oemHookService[SIM_COUNT];
 int64_t nitzTimeReceived[SIM_COUNT];
 // counter used for synchronization. It is incremented every time response callbacks are updated.
 volatile int32_t mCounterRadio[SIM_COUNT];
 volatile int32_t mCounterOemHook[SIM_COUNT];
 #else
-sp<RadioImpl_1_4> radioService[1];
+sp<RadioImpl_1_5> radioService[1];
 sp<OemHookImpl> oemHookService[1];
 int64_t nitzTimeReceived[1];
 // counter used for synchronization. It is incremented every time response callbacks are updated.
@@ -127,7 +127,7 @@
 void populateResponseInfo(RadioResponseInfo& responseInfo, int serial, int responseType,
                          RIL_Errno e);
 
-struct RadioImpl_1_4 : public V1_4::IRadio {
+struct RadioImpl_1_5 : public V1_5::IRadio {
     int32_t mSlotId;
     sp<IRadioResponse> mRadioResponse;
     sp<IRadioIndication> mRadioIndication;
@@ -137,6 +137,8 @@
     sp<V1_3::IRadioIndication> mRadioIndicationV1_3;
     sp<V1_4::IRadioResponse> mRadioResponseV1_4;
     sp<V1_4::IRadioIndication> mRadioIndicationV1_4;
+    sp<V1_5::IRadioResponse> mRadioResponseV1_5;
+    sp<V1_5::IRadioIndication> mRadioIndicationV1_5;
 
     Return<void> setResponseFunctions(
             const ::android::sp<IRadioResponse>& radioResponse,
@@ -529,6 +531,14 @@
             ::android::hardware::radio::V1_4::SimLockMultiSimPolicy multiSimPolicy);
     Return<void> getAllowedCarriers_1_4(int32_t serial);
     Return<void> getSignalStrength_1_4(int32_t serial);
+
+    // Methods from ::android::hardware::radio::V1_5::IRadio follow.
+    Return<void> setSignalStrengthReportingCriteria_1_5(int32_t serial,
+            const ::android::hardware::radio::V1_5::SignalThresholdInfo& signalThresholdInfo,
+            const ::android::hardware::radio::V1_5::AccessNetwork accessNetwork);
+    Return<void> enableUiccApplications(int32_t serial, bool detach);
+    Return<void> areUiccApplicationsEnabled(int32_t serial);
+    Return<void> canToggleUiccApplicationsEnablement(int32_t serial);
 };
 
 struct OemHookImpl : public IOemHook {
@@ -829,7 +839,7 @@
         // note the current counter to avoid overwriting updates made by another thread before
         // write lock is acquired.
         int counter = isRadioService ? mCounterRadio[slotId] : mCounterOemHook[slotId];
-        pthread_rwlock_t *radioServiceRwlockPtr = radio_1_4::getRadioServiceRwlock(slotId);
+        pthread_rwlock_t *radioServiceRwlockPtr = radio_1_5::getRadioServiceRwlock(slotId);
         int ret = pthread_rwlock_unlock(radioServiceRwlockPtr);
         assert(ret == 0);
 
@@ -848,6 +858,8 @@
                 radioService[slotId]->mRadioIndicationV1_3 = NULL;
                 radioService[slotId]->mRadioResponseV1_4 = NULL;
                 radioService[slotId]->mRadioIndicationV1_4 = NULL;
+                radioService[slotId]->mRadioResponseV1_5 = NULL;
+                radioService[slotId]->mRadioIndicationV1_5 = NULL;
             } else {
                 oemHookService[slotId]->mOemHookResponse = NULL;
                 oemHookService[slotId]->mOemHookIndication = NULL;
@@ -868,21 +880,29 @@
     }
 }
 
-void RadioImpl_1_4::checkReturnStatus(Return<void>& ret) {
+void RadioImpl_1_5::checkReturnStatus(Return<void>& ret) {
     ::checkReturnStatus(mSlotId, ret, true);
 }
 
-Return<void> RadioImpl_1_4::setResponseFunctions(
+Return<void> RadioImpl_1_5::setResponseFunctions(
         const ::android::sp<IRadioResponse>& radioResponseParam,
         const ::android::sp<IRadioIndication>& radioIndicationParam) {
     RLOGD("setResponseFunctions");
 
-    pthread_rwlock_t *radioServiceRwlockPtr = radio_1_4::getRadioServiceRwlock(mSlotId);
+    pthread_rwlock_t *radioServiceRwlockPtr = radio_1_5::getRadioServiceRwlock(mSlotId);
     int ret = pthread_rwlock_wrlock(radioServiceRwlockPtr);
     assert(ret == 0);
 
     mRadioResponse = radioResponseParam;
     mRadioIndication = radioIndicationParam;
+
+   mRadioResponseV1_5 = V1_5::IRadioResponse::castFrom(mRadioResponse).withDefault(nullptr);
+   mRadioIndicationV1_5 = V1_5::IRadioIndication::castFrom(mRadioIndication).withDefault(nullptr);
+   if (mRadioResponseV1_5 == nullptr || mRadioIndicationV1_5 == nullptr) {
+       mRadioResponseV1_5 = nullptr;
+       mRadioIndicationV1_5 = nullptr;
+   }
+
     mRadioResponseV1_4 = V1_4::IRadioResponse::castFrom(mRadioResponse).withDefault(nullptr);
     mRadioIndicationV1_4 = V1_4::IRadioIndication::castFrom(mRadioIndication).withDefault(nullptr);
     if (mRadioResponseV1_4 == nullptr || mRadioIndicationV1_4 == nullptr) {
@@ -915,7 +935,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getIccCardStatus(int32_t serial) {
+Return<void> RadioImpl_1_5::getIccCardStatus(int32_t serial) {
 #if VDBG
     RLOGD("getIccCardStatus: serial %d", serial);
 #endif
@@ -923,7 +943,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::supplyIccPinForApp(int32_t serial, const hidl_string& pin,
+Return<void> RadioImpl_1_5::supplyIccPinForApp(int32_t serial, const hidl_string& pin,
         const hidl_string& aid) {
 #if VDBG
     RLOGD("supplyIccPinForApp: serial %d", serial);
@@ -933,7 +953,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::supplyIccPukForApp(int32_t serial, const hidl_string& puk,
+Return<void> RadioImpl_1_5::supplyIccPukForApp(int32_t serial, const hidl_string& puk,
                                            const hidl_string& pin, const hidl_string& aid) {
 #if VDBG
     RLOGD("supplyIccPukForApp: serial %d", serial);
@@ -943,7 +963,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::supplyIccPin2ForApp(int32_t serial, const hidl_string& pin2,
+Return<void> RadioImpl_1_5::supplyIccPin2ForApp(int32_t serial, const hidl_string& pin2,
                                             const hidl_string& aid) {
 #if VDBG
     RLOGD("supplyIccPin2ForApp: serial %d", serial);
@@ -953,7 +973,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::supplyIccPuk2ForApp(int32_t serial, const hidl_string& puk2,
+Return<void> RadioImpl_1_5::supplyIccPuk2ForApp(int32_t serial, const hidl_string& puk2,
                                             const hidl_string& pin2, const hidl_string& aid) {
 #if VDBG
     RLOGD("supplyIccPuk2ForApp: serial %d", serial);
@@ -963,7 +983,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::changeIccPinForApp(int32_t serial, const hidl_string& oldPin,
+Return<void> RadioImpl_1_5::changeIccPinForApp(int32_t serial, const hidl_string& oldPin,
                                            const hidl_string& newPin, const hidl_string& aid) {
 #if VDBG
     RLOGD("changeIccPinForApp: serial %d", serial);
@@ -973,7 +993,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::changeIccPin2ForApp(int32_t serial, const hidl_string& oldPin2,
+Return<void> RadioImpl_1_5::changeIccPin2ForApp(int32_t serial, const hidl_string& oldPin2,
                                             const hidl_string& newPin2, const hidl_string& aid) {
 #if VDBG
     RLOGD("changeIccPin2ForApp: serial %d", serial);
@@ -983,7 +1003,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::supplyNetworkDepersonalization(int32_t serial,
+Return<void> RadioImpl_1_5::supplyNetworkDepersonalization(int32_t serial,
                                                        const hidl_string& netPin) {
 #if VDBG
     RLOGD("supplyNetworkDepersonalization: serial %d", serial);
@@ -993,7 +1013,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getCurrentCalls(int32_t serial) {
+Return<void> RadioImpl_1_5::getCurrentCalls(int32_t serial) {
 #if VDBG
     RLOGD("getCurrentCalls: serial %d", serial);
 #endif
@@ -1001,7 +1021,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::dial(int32_t serial, const Dial& dialInfo) {
+Return<void> RadioImpl_1_5::dial(int32_t serial, const Dial& dialInfo) {
 #if VDBG
     RLOGD("dial: serial %d", serial);
 #endif
@@ -1043,7 +1063,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getImsiForApp(int32_t serial, const hidl_string& aid) {
+Return<void> RadioImpl_1_5::getImsiForApp(int32_t serial, const hidl_string& aid) {
 #if VDBG
     RLOGD("getImsiForApp: serial %d", serial);
 #endif
@@ -1052,7 +1072,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::hangup(int32_t serial, int32_t gsmIndex) {
+Return<void> RadioImpl_1_5::hangup(int32_t serial, int32_t gsmIndex) {
 #if VDBG
     RLOGD("hangup: serial %d", serial);
 #endif
@@ -1060,7 +1080,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::hangupWaitingOrBackground(int32_t serial) {
+Return<void> RadioImpl_1_5::hangupWaitingOrBackground(int32_t serial) {
 #if VDBG
     RLOGD("hangupWaitingOrBackground: serial %d", serial);
 #endif
@@ -1068,7 +1088,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::hangupForegroundResumeBackground(int32_t serial) {
+Return<void> RadioImpl_1_5::hangupForegroundResumeBackground(int32_t serial) {
 #if VDBG
     RLOGD("hangupForegroundResumeBackground: serial %d", serial);
 #endif
@@ -1076,7 +1096,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::switchWaitingOrHoldingAndActive(int32_t serial) {
+Return<void> RadioImpl_1_5::switchWaitingOrHoldingAndActive(int32_t serial) {
 #if VDBG
     RLOGD("switchWaitingOrHoldingAndActive: serial %d", serial);
 #endif
@@ -1084,7 +1104,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::conference(int32_t serial) {
+Return<void> RadioImpl_1_5::conference(int32_t serial) {
 #if VDBG
     RLOGD("conference: serial %d", serial);
 #endif
@@ -1092,7 +1112,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::rejectCall(int32_t serial) {
+Return<void> RadioImpl_1_5::rejectCall(int32_t serial) {
 #if VDBG
     RLOGD("rejectCall: serial %d", serial);
 #endif
@@ -1100,7 +1120,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getLastCallFailCause(int32_t serial) {
+Return<void> RadioImpl_1_5::getLastCallFailCause(int32_t serial) {
 #if VDBG
     RLOGD("getLastCallFailCause: serial %d", serial);
 #endif
@@ -1108,7 +1128,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getSignalStrength(int32_t serial) {
+Return<void> RadioImpl_1_5::getSignalStrength(int32_t serial) {
 #if VDBG
     RLOGD("getSignalStrength: serial %d", serial);
 #endif
@@ -1116,7 +1136,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getVoiceRegistrationState(int32_t serial) {
+Return<void> RadioImpl_1_5::getVoiceRegistrationState(int32_t serial) {
 #if VDBG
     RLOGD("getVoiceRegistrationState: serial %d", serial);
 #endif
@@ -1124,7 +1144,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getDataRegistrationState(int32_t serial) {
+Return<void> RadioImpl_1_5::getDataRegistrationState(int32_t serial) {
 #if VDBG
     RLOGD("getDataRegistrationState: serial %d", serial);
 #endif
@@ -1132,7 +1152,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getOperator(int32_t serial) {
+Return<void> RadioImpl_1_5::getOperator(int32_t serial) {
 #if VDBG
     RLOGD("getOperator: serial %d", serial);
 #endif
@@ -1140,13 +1160,13 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setRadioPower(int32_t serial, bool on) {
+Return<void> RadioImpl_1_5::setRadioPower(int32_t serial, bool on) {
     RLOGD("setRadioPower: serial %d on %d", serial, on);
     dispatchInts(serial, mSlotId, RIL_REQUEST_RADIO_POWER, 1, BOOL_TO_INT(on));
     return Void();
 }
 
-Return<void> RadioImpl_1_4::sendDtmf(int32_t serial, const hidl_string& s) {
+Return<void> RadioImpl_1_5::sendDtmf(int32_t serial, const hidl_string& s) {
 #if VDBG
     RLOGD("sendDtmf: serial %d", serial);
 #endif
@@ -1154,7 +1174,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::sendSms(int32_t serial, const GsmSmsMessage& message) {
+Return<void> RadioImpl_1_5::sendSms(int32_t serial, const GsmSmsMessage& message) {
 #if VDBG
     RLOGD("sendSms: serial %d", serial);
 #endif
@@ -1163,7 +1183,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::sendSMSExpectMore(int32_t serial, const GsmSmsMessage& message) {
+Return<void> RadioImpl_1_5::sendSMSExpectMore(int32_t serial, const GsmSmsMessage& message) {
 #if VDBG
     RLOGD("sendSMSExpectMore: serial %d", serial);
 #endif
@@ -1190,7 +1210,7 @@
     return false;
 }
 
-Return<void> RadioImpl_1_4::setupDataCall(int32_t serial, RadioTechnology radioTechnology,
+Return<void> RadioImpl_1_5::setupDataCall(int32_t serial, RadioTechnology radioTechnology,
                                       const DataProfileInfo& dataProfileInfo, bool modemCognitive,
                                       bool roamingAllowed, bool isRoaming) {
 
@@ -1246,7 +1266,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::iccIOForApp(int32_t serial, const IccIo& iccIo) {
+Return<void> RadioImpl_1_5::iccIOForApp(int32_t serial, const IccIo& iccIo) {
 #if VDBG
     RLOGD("iccIOForApp: serial %d", serial);
 #endif
@@ -1288,7 +1308,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::sendUssd(int32_t serial, const hidl_string& ussd) {
+Return<void> RadioImpl_1_5::sendUssd(int32_t serial, const hidl_string& ussd) {
 #if VDBG
     RLOGD("sendUssd: serial %d", serial);
 #endif
@@ -1296,7 +1316,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::cancelPendingUssd(int32_t serial) {
+Return<void> RadioImpl_1_5::cancelPendingUssd(int32_t serial) {
 #if VDBG
     RLOGD("cancelPendingUssd: serial %d", serial);
 #endif
@@ -1304,7 +1324,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getClir(int32_t serial) {
+Return<void> RadioImpl_1_5::getClir(int32_t serial) {
 #if VDBG
     RLOGD("getClir: serial %d", serial);
 #endif
@@ -1312,7 +1332,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setClir(int32_t serial, int32_t status) {
+Return<void> RadioImpl_1_5::setClir(int32_t serial, int32_t status) {
 #if VDBG
     RLOGD("setClir: serial %d", serial);
 #endif
@@ -1320,7 +1340,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getCallForwardStatus(int32_t serial, const CallForwardInfo& callInfo) {
+Return<void> RadioImpl_1_5::getCallForwardStatus(int32_t serial, const CallForwardInfo& callInfo) {
 #if VDBG
     RLOGD("getCallForwardStatus: serial %d", serial);
 #endif
@@ -1329,7 +1349,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setCallForward(int32_t serial, const CallForwardInfo& callInfo) {
+Return<void> RadioImpl_1_5::setCallForward(int32_t serial, const CallForwardInfo& callInfo) {
 #if VDBG
     RLOGD("setCallForward: serial %d", serial);
 #endif
@@ -1338,7 +1358,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getCallWaiting(int32_t serial, int32_t serviceClass) {
+Return<void> RadioImpl_1_5::getCallWaiting(int32_t serial, int32_t serviceClass) {
 #if VDBG
     RLOGD("getCallWaiting: serial %d", serial);
 #endif
@@ -1346,7 +1366,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setCallWaiting(int32_t serial, bool enable, int32_t serviceClass) {
+Return<void> RadioImpl_1_5::setCallWaiting(int32_t serial, bool enable, int32_t serviceClass) {
 #if VDBG
     RLOGD("setCallWaiting: serial %d", serial);
 #endif
@@ -1355,7 +1375,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::acknowledgeLastIncomingGsmSms(int32_t serial,
+Return<void> RadioImpl_1_5::acknowledgeLastIncomingGsmSms(int32_t serial,
                                                       bool success, SmsAcknowledgeFailCause cause) {
 #if VDBG
     RLOGD("acknowledgeLastIncomingGsmSms: serial %d", serial);
@@ -1365,7 +1385,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::acceptCall(int32_t serial) {
+Return<void> RadioImpl_1_5::acceptCall(int32_t serial) {
 #if VDBG
     RLOGD("acceptCall: serial %d", serial);
 #endif
@@ -1373,7 +1393,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::deactivateDataCall(int32_t serial,
+Return<void> RadioImpl_1_5::deactivateDataCall(int32_t serial,
                                            int32_t cid, bool reasonRadioShutDown) {
 #if VDBG
     RLOGD("deactivateDataCall: serial %d", serial);
@@ -1383,7 +1403,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getFacilityLockForApp(int32_t serial, const hidl_string& facility,
+Return<void> RadioImpl_1_5::getFacilityLockForApp(int32_t serial, const hidl_string& facility,
                                               const hidl_string& password, int32_t serviceClass,
                                               const hidl_string& appId) {
 #if VDBG
@@ -1395,7 +1415,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setFacilityLockForApp(int32_t serial, const hidl_string& facility,
+Return<void> RadioImpl_1_5::setFacilityLockForApp(int32_t serial, const hidl_string& facility,
                                               bool lockState, const hidl_string& password,
                                               int32_t serviceClass, const hidl_string& appId) {
 #if VDBG
@@ -1407,7 +1427,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setBarringPassword(int32_t serial, const hidl_string& facility,
+Return<void> RadioImpl_1_5::setBarringPassword(int32_t serial, const hidl_string& facility,
                                            const hidl_string& oldPassword,
                                            const hidl_string& newPassword) {
 #if VDBG
@@ -1418,7 +1438,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getNetworkSelectionMode(int32_t serial) {
+Return<void> RadioImpl_1_5::getNetworkSelectionMode(int32_t serial) {
 #if VDBG
     RLOGD("getNetworkSelectionMode: serial %d", serial);
 #endif
@@ -1426,7 +1446,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setNetworkSelectionModeAutomatic(int32_t serial) {
+Return<void> RadioImpl_1_5::setNetworkSelectionModeAutomatic(int32_t serial) {
 #if VDBG
     RLOGD("setNetworkSelectionModeAutomatic: serial %d", serial);
 #endif
@@ -1434,7 +1454,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setNetworkSelectionModeManual(int32_t serial,
+Return<void> RadioImpl_1_5::setNetworkSelectionModeManual(int32_t serial,
                                                       const hidl_string& operatorNumeric) {
 #if VDBG
     RLOGD("setNetworkSelectionModeManual: serial %d", serial);
@@ -1444,7 +1464,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getAvailableNetworks(int32_t serial) {
+Return<void> RadioImpl_1_5::getAvailableNetworks(int32_t serial) {
 #if VDBG
     RLOGD("getAvailableNetworks: serial %d", serial);
 #endif
@@ -1452,7 +1472,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::startNetworkScan(int32_t serial, const V1_1::NetworkScanRequest& request) {
+Return<void> RadioImpl_1_5::startNetworkScan(int32_t serial, const V1_1::NetworkScanRequest& request) {
 #if VDBG
     RLOGD("startNetworkScan: serial %d", serial);
 #endif
@@ -1518,7 +1538,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::stopNetworkScan(int32_t serial) {
+Return<void> RadioImpl_1_5::stopNetworkScan(int32_t serial) {
 #if VDBG
     RLOGD("stopNetworkScan: serial %d", serial);
 #endif
@@ -1526,7 +1546,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::startDtmf(int32_t serial, const hidl_string& s) {
+Return<void> RadioImpl_1_5::startDtmf(int32_t serial, const hidl_string& s) {
 #if VDBG
     RLOGD("startDtmf: serial %d", serial);
 #endif
@@ -1535,7 +1555,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::stopDtmf(int32_t serial) {
+Return<void> RadioImpl_1_5::stopDtmf(int32_t serial) {
 #if VDBG
     RLOGD("stopDtmf: serial %d", serial);
 #endif
@@ -1543,7 +1563,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getBasebandVersion(int32_t serial) {
+Return<void> RadioImpl_1_5::getBasebandVersion(int32_t serial) {
 #if VDBG
     RLOGD("getBasebandVersion: serial %d", serial);
 #endif
@@ -1551,7 +1571,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::separateConnection(int32_t serial, int32_t gsmIndex) {
+Return<void> RadioImpl_1_5::separateConnection(int32_t serial, int32_t gsmIndex) {
 #if VDBG
     RLOGD("separateConnection: serial %d", serial);
 #endif
@@ -1559,7 +1579,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setMute(int32_t serial, bool enable) {
+Return<void> RadioImpl_1_5::setMute(int32_t serial, bool enable) {
 #if VDBG
     RLOGD("setMute: serial %d", serial);
 #endif
@@ -1567,7 +1587,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getMute(int32_t serial) {
+Return<void> RadioImpl_1_5::getMute(int32_t serial) {
 #if VDBG
     RLOGD("getMute: serial %d", serial);
 #endif
@@ -1575,7 +1595,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getClip(int32_t serial) {
+Return<void> RadioImpl_1_5::getClip(int32_t serial) {
 #if VDBG
     RLOGD("getClip: serial %d", serial);
 #endif
@@ -1583,7 +1603,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getDataCallList(int32_t serial) {
+Return<void> RadioImpl_1_5::getDataCallList(int32_t serial) {
 #if VDBG
     RLOGD("getDataCallList: serial %d", serial);
 #endif
@@ -1591,7 +1611,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setSuppServiceNotifications(int32_t serial, bool enable) {
+Return<void> RadioImpl_1_5::setSuppServiceNotifications(int32_t serial, bool enable) {
 #if VDBG
     RLOGD("setSuppServiceNotifications: serial %d", serial);
 #endif
@@ -1600,7 +1620,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::writeSmsToSim(int32_t serial, const SmsWriteArgs& smsWriteArgs) {
+Return<void> RadioImpl_1_5::writeSmsToSim(int32_t serial, const SmsWriteArgs& smsWriteArgs) {
 #if VDBG
     RLOGD("writeSmsToSim: serial %d", serial);
 #endif
@@ -1628,7 +1648,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::deleteSmsOnSim(int32_t serial, int32_t index) {
+Return<void> RadioImpl_1_5::deleteSmsOnSim(int32_t serial, int32_t index) {
 #if VDBG
     RLOGD("deleteSmsOnSim: serial %d", serial);
 #endif
@@ -1636,7 +1656,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setBandMode(int32_t serial, RadioBandMode mode) {
+Return<void> RadioImpl_1_5::setBandMode(int32_t serial, RadioBandMode mode) {
 #if VDBG
     RLOGD("setBandMode: serial %d", serial);
 #endif
@@ -1644,7 +1664,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getAvailableBandModes(int32_t serial) {
+Return<void> RadioImpl_1_5::getAvailableBandModes(int32_t serial) {
 #if VDBG
     RLOGD("getAvailableBandModes: serial %d", serial);
 #endif
@@ -1652,7 +1672,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::sendEnvelope(int32_t serial, const hidl_string& command) {
+Return<void> RadioImpl_1_5::sendEnvelope(int32_t serial, const hidl_string& command) {
 #if VDBG
     RLOGD("sendEnvelope: serial %d", serial);
 #endif
@@ -1661,7 +1681,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::sendTerminalResponseToSim(int32_t serial,
+Return<void> RadioImpl_1_5::sendTerminalResponseToSim(int32_t serial,
                                                   const hidl_string& commandResponse) {
 #if VDBG
     RLOGD("sendTerminalResponseToSim: serial %d", serial);
@@ -1671,7 +1691,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::handleStkCallSetupRequestFromSim(int32_t serial, bool accept) {
+Return<void> RadioImpl_1_5::handleStkCallSetupRequestFromSim(int32_t serial, bool accept) {
 #if VDBG
     RLOGD("handleStkCallSetupRequestFromSim: serial %d", serial);
 #endif
@@ -1680,7 +1700,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::explicitCallTransfer(int32_t serial) {
+Return<void> RadioImpl_1_5::explicitCallTransfer(int32_t serial) {
 #if VDBG
     RLOGD("explicitCallTransfer: serial %d", serial);
 #endif
@@ -1688,7 +1708,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setPreferredNetworkType(int32_t serial, PreferredNetworkType nwType) {
+Return<void> RadioImpl_1_5::setPreferredNetworkType(int32_t serial, PreferredNetworkType nwType) {
 #if VDBG
     RLOGD("setPreferredNetworkType: serial %d", serial);
 #endif
@@ -1696,7 +1716,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getPreferredNetworkType(int32_t serial) {
+Return<void> RadioImpl_1_5::getPreferredNetworkType(int32_t serial) {
 #if VDBG
     RLOGD("getPreferredNetworkType: serial %d", serial);
 #endif
@@ -1704,7 +1724,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getNeighboringCids(int32_t serial) {
+Return<void> RadioImpl_1_5::getNeighboringCids(int32_t serial) {
 #if VDBG
     RLOGD("getNeighboringCids: serial %d", serial);
 #endif
@@ -1712,7 +1732,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setLocationUpdates(int32_t serial, bool enable) {
+Return<void> RadioImpl_1_5::setLocationUpdates(int32_t serial, bool enable) {
 #if VDBG
     RLOGD("setLocationUpdates: serial %d", serial);
 #endif
@@ -1720,7 +1740,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setCdmaSubscriptionSource(int32_t serial, CdmaSubscriptionSource cdmaSub) {
+Return<void> RadioImpl_1_5::setCdmaSubscriptionSource(int32_t serial, CdmaSubscriptionSource cdmaSub) {
 #if VDBG
     RLOGD("setCdmaSubscriptionSource: serial %d", serial);
 #endif
@@ -1728,7 +1748,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setCdmaRoamingPreference(int32_t serial, CdmaRoamingType type) {
+Return<void> RadioImpl_1_5::setCdmaRoamingPreference(int32_t serial, CdmaRoamingType type) {
 #if VDBG
     RLOGD("setCdmaRoamingPreference: serial %d", serial);
 #endif
@@ -1736,7 +1756,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getCdmaRoamingPreference(int32_t serial) {
+Return<void> RadioImpl_1_5::getCdmaRoamingPreference(int32_t serial) {
 #if VDBG
     RLOGD("getCdmaRoamingPreference: serial %d", serial);
 #endif
@@ -1744,7 +1764,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setTTYMode(int32_t serial, TtyMode mode) {
+Return<void> RadioImpl_1_5::setTTYMode(int32_t serial, TtyMode mode) {
 #if VDBG
     RLOGD("setTTYMode: serial %d", serial);
 #endif
@@ -1752,7 +1772,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getTTYMode(int32_t serial) {
+Return<void> RadioImpl_1_5::getTTYMode(int32_t serial) {
 #if VDBG
     RLOGD("getTTYMode: serial %d", serial);
 #endif
@@ -1760,7 +1780,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setPreferredVoicePrivacy(int32_t serial, bool enable) {
+Return<void> RadioImpl_1_5::setPreferredVoicePrivacy(int32_t serial, bool enable) {
 #if VDBG
     RLOGD("setPreferredVoicePrivacy: serial %d", serial);
 #endif
@@ -1769,7 +1789,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getPreferredVoicePrivacy(int32_t serial) {
+Return<void> RadioImpl_1_5::getPreferredVoicePrivacy(int32_t serial) {
 #if VDBG
     RLOGD("getPreferredVoicePrivacy: serial %d", serial);
 #endif
@@ -1777,7 +1797,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::sendCDMAFeatureCode(int32_t serial, const hidl_string& featureCode) {
+Return<void> RadioImpl_1_5::sendCDMAFeatureCode(int32_t serial, const hidl_string& featureCode) {
 #if VDBG
     RLOGD("sendCDMAFeatureCode: serial %d", serial);
 #endif
@@ -1786,7 +1806,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::sendBurstDtmf(int32_t serial, const hidl_string& dtmf, int32_t on,
+Return<void> RadioImpl_1_5::sendBurstDtmf(int32_t serial, const hidl_string& dtmf, int32_t on,
                                       int32_t off) {
 #if VDBG
     RLOGD("sendBurstDtmf: serial %d", serial);
@@ -1828,7 +1848,7 @@
     }
 }
 
-Return<void> RadioImpl_1_4::sendCdmaSms(int32_t serial, const CdmaSmsMessage& sms) {
+Return<void> RadioImpl_1_5::sendCdmaSms(int32_t serial, const CdmaSmsMessage& sms) {
 #if VDBG
     RLOGD("sendCdmaSms: serial %d", serial);
 #endif
@@ -1844,7 +1864,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::acknowledgeLastIncomingCdmaSms(int32_t serial, const CdmaSmsAck& smsAck) {
+Return<void> RadioImpl_1_5::acknowledgeLastIncomingCdmaSms(int32_t serial, const CdmaSmsAck& smsAck) {
 #if VDBG
     RLOGD("acknowledgeLastIncomingCdmaSms: serial %d", serial);
 #endif
@@ -1862,7 +1882,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getGsmBroadcastConfig(int32_t serial) {
+Return<void> RadioImpl_1_5::getGsmBroadcastConfig(int32_t serial) {
 #if VDBG
     RLOGD("getGsmBroadcastConfig: serial %d", serial);
 #endif
@@ -1870,7 +1890,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setGsmBroadcastConfig(int32_t serial,
+Return<void> RadioImpl_1_5::setGsmBroadcastConfig(int32_t serial,
                                               const hidl_vec<GsmBroadcastSmsConfigInfo>&
                                               configInfo) {
 #if VDBG
@@ -1900,7 +1920,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setGsmBroadcastActivation(int32_t serial, bool activate) {
+Return<void> RadioImpl_1_5::setGsmBroadcastActivation(int32_t serial, bool activate) {
 #if VDBG
     RLOGD("setGsmBroadcastActivation: serial %d", serial);
 #endif
@@ -1909,7 +1929,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getCdmaBroadcastConfig(int32_t serial) {
+Return<void> RadioImpl_1_5::getCdmaBroadcastConfig(int32_t serial) {
 #if VDBG
     RLOGD("getCdmaBroadcastConfig: serial %d", serial);
 #endif
@@ -1917,7 +1937,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setCdmaBroadcastConfig(int32_t serial,
+Return<void> RadioImpl_1_5::setCdmaBroadcastConfig(int32_t serial,
                                                const hidl_vec<CdmaBroadcastSmsConfigInfo>&
                                                configInfo) {
 #if VDBG
@@ -1945,7 +1965,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setCdmaBroadcastActivation(int32_t serial, bool activate) {
+Return<void> RadioImpl_1_5::setCdmaBroadcastActivation(int32_t serial, bool activate) {
 #if VDBG
     RLOGD("setCdmaBroadcastActivation: serial %d", serial);
 #endif
@@ -1954,7 +1974,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getCDMASubscription(int32_t serial) {
+Return<void> RadioImpl_1_5::getCDMASubscription(int32_t serial) {
 #if VDBG
     RLOGD("getCDMASubscription: serial %d", serial);
 #endif
@@ -1962,7 +1982,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::writeSmsToRuim(int32_t serial, const CdmaSmsWriteArgs& cdmaSms) {
+Return<void> RadioImpl_1_5::writeSmsToRuim(int32_t serial, const CdmaSmsWriteArgs& cdmaSms) {
 #if VDBG
     RLOGD("writeSmsToRuim: serial %d", serial);
 #endif
@@ -1980,7 +2000,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::deleteSmsOnRuim(int32_t serial, int32_t index) {
+Return<void> RadioImpl_1_5::deleteSmsOnRuim(int32_t serial, int32_t index) {
 #if VDBG
     RLOGD("deleteSmsOnRuim: serial %d", serial);
 #endif
@@ -1988,7 +2008,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getDeviceIdentity(int32_t serial) {
+Return<void> RadioImpl_1_5::getDeviceIdentity(int32_t serial) {
 #if VDBG
     RLOGD("getDeviceIdentity: serial %d", serial);
 #endif
@@ -1996,7 +2016,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::exitEmergencyCallbackMode(int32_t serial) {
+Return<void> RadioImpl_1_5::exitEmergencyCallbackMode(int32_t serial) {
 #if VDBG
     RLOGD("exitEmergencyCallbackMode: serial %d", serial);
 #endif
@@ -2004,7 +2024,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getSmscAddress(int32_t serial) {
+Return<void> RadioImpl_1_5::getSmscAddress(int32_t serial) {
 #if VDBG
     RLOGD("getSmscAddress: serial %d", serial);
 #endif
@@ -2012,7 +2032,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setSmscAddress(int32_t serial, const hidl_string& smsc) {
+Return<void> RadioImpl_1_5::setSmscAddress(int32_t serial, const hidl_string& smsc) {
 #if VDBG
     RLOGD("setSmscAddress: serial %d", serial);
 #endif
@@ -2021,7 +2041,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::reportSmsMemoryStatus(int32_t serial, bool available) {
+Return<void> RadioImpl_1_5::reportSmsMemoryStatus(int32_t serial, bool available) {
 #if VDBG
     RLOGD("reportSmsMemoryStatus: serial %d", serial);
 #endif
@@ -2030,7 +2050,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::reportStkServiceIsRunning(int32_t serial) {
+Return<void> RadioImpl_1_5::reportStkServiceIsRunning(int32_t serial) {
 #if VDBG
     RLOGD("reportStkServiceIsRunning: serial %d", serial);
 #endif
@@ -2038,7 +2058,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getCdmaSubscriptionSource(int32_t serial) {
+Return<void> RadioImpl_1_5::getCdmaSubscriptionSource(int32_t serial) {
 #if VDBG
     RLOGD("getCdmaSubscriptionSource: serial %d", serial);
 #endif
@@ -2046,7 +2066,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::requestIsimAuthentication(int32_t serial, const hidl_string& challenge) {
+Return<void> RadioImpl_1_5::requestIsimAuthentication(int32_t serial, const hidl_string& challenge) {
 #if VDBG
     RLOGD("requestIsimAuthentication: serial %d", serial);
 #endif
@@ -2055,7 +2075,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::acknowledgeIncomingGsmSmsWithPdu(int32_t serial, bool success,
+Return<void> RadioImpl_1_5::acknowledgeIncomingGsmSmsWithPdu(int32_t serial, bool success,
                                                          const hidl_string& ackPdu) {
 #if VDBG
     RLOGD("acknowledgeIncomingGsmSmsWithPdu: serial %d", serial);
@@ -2065,7 +2085,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::sendEnvelopeWithStatus(int32_t serial, const hidl_string& contents) {
+Return<void> RadioImpl_1_5::sendEnvelopeWithStatus(int32_t serial, const hidl_string& contents) {
 #if VDBG
     RLOGD("sendEnvelopeWithStatus: serial %d", serial);
 #endif
@@ -2074,7 +2094,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getVoiceRadioTechnology(int32_t serial) {
+Return<void> RadioImpl_1_5::getVoiceRadioTechnology(int32_t serial) {
 #if VDBG
     RLOGD("getVoiceRadioTechnology: serial %d", serial);
 #endif
@@ -2082,7 +2102,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getCellInfoList(int32_t serial) {
+Return<void> RadioImpl_1_5::getCellInfoList(int32_t serial) {
 #if VDBG
     RLOGD("getCellInfoList: serial %d", serial);
 #endif
@@ -2090,7 +2110,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setCellInfoListRate(int32_t serial, int32_t rate) {
+Return<void> RadioImpl_1_5::setCellInfoListRate(int32_t serial, int32_t rate) {
 #if VDBG
     RLOGD("setCellInfoListRate: serial %d", serial);
 #endif
@@ -2098,7 +2118,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setInitialAttachApn(int32_t serial, const DataProfileInfo& dataProfileInfo,
+Return<void> RadioImpl_1_5::setInitialAttachApn(int32_t serial, const DataProfileInfo& dataProfileInfo,
                                             bool modemCognitive, bool isRoaming) {
 #if VDBG
     RLOGD("setInitialAttachApn: serial %d", serial);
@@ -2187,7 +2207,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getImsRegistrationState(int32_t serial) {
+Return<void> RadioImpl_1_5::getImsRegistrationState(int32_t serial) {
 #if VDBG
     RLOGD("getImsRegistrationState: serial %d", serial);
 #endif
@@ -2284,7 +2304,7 @@
     return true;
 }
 
-Return<void> RadioImpl_1_4::sendImsSms(int32_t serial, const ImsSmsMessage& message) {
+Return<void> RadioImpl_1_5::sendImsSms(int32_t serial, const ImsSmsMessage& message) {
 #if VDBG
     RLOGD("sendImsSms: serial %d", serial);
 #endif
@@ -2307,7 +2327,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::iccTransmitApduBasicChannel(int32_t serial, const SimApdu& message) {
+Return<void> RadioImpl_1_5::iccTransmitApduBasicChannel(int32_t serial, const SimApdu& message) {
 #if VDBG
     RLOGD("iccTransmitApduBasicChannel: serial %d", serial);
 #endif
@@ -2315,7 +2335,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::iccOpenLogicalChannel(int32_t serial, const hidl_string& aid, int32_t p2) {
+Return<void> RadioImpl_1_5::iccOpenLogicalChannel(int32_t serial, const hidl_string& aid, int32_t p2) {
 #if VDBG
     RLOGD("iccOpenLogicalChannel: serial %d", serial);
 #endif
@@ -2342,7 +2362,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::iccCloseLogicalChannel(int32_t serial, int32_t channelId) {
+Return<void> RadioImpl_1_5::iccCloseLogicalChannel(int32_t serial, int32_t channelId) {
 #if VDBG
     RLOGD("iccCloseLogicalChannel: serial %d", serial);
 #endif
@@ -2350,7 +2370,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::iccTransmitApduLogicalChannel(int32_t serial, const SimApdu& message) {
+Return<void> RadioImpl_1_5::iccTransmitApduLogicalChannel(int32_t serial, const SimApdu& message) {
 #if VDBG
     RLOGD("iccTransmitApduLogicalChannel: serial %d", serial);
 #endif
@@ -2358,7 +2378,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::nvReadItem(int32_t serial, NvItem itemId) {
+Return<void> RadioImpl_1_5::nvReadItem(int32_t serial, NvItem itemId) {
 #if VDBG
     RLOGD("nvReadItem: serial %d", serial);
 #endif
@@ -2374,7 +2394,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::nvWriteItem(int32_t serial, const NvWriteItem& item) {
+Return<void> RadioImpl_1_5::nvWriteItem(int32_t serial, const NvWriteItem& item) {
 #if VDBG
     RLOGD("nvWriteItem: serial %d", serial);
 #endif
@@ -2397,7 +2417,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::nvWriteCdmaPrl(int32_t serial, const hidl_vec<uint8_t>& prl) {
+Return<void> RadioImpl_1_5::nvWriteCdmaPrl(int32_t serial, const hidl_vec<uint8_t>& prl) {
 #if VDBG
     RLOGD("nvWriteCdmaPrl: serial %d", serial);
 #endif
@@ -2405,7 +2425,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::nvResetConfig(int32_t serial, ResetNvType resetType) {
+Return<void> RadioImpl_1_5::nvResetConfig(int32_t serial, ResetNvType resetType) {
     int rilResetType = -1;
 #if VDBG
     RLOGD("nvResetConfig: serial %d", serial);
@@ -2431,7 +2451,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setUiccSubscription(int32_t serial, const SelectUiccSub& uiccSub) {
+Return<void> RadioImpl_1_5::setUiccSubscription(int32_t serial, const SelectUiccSub& uiccSub) {
 #if VDBG
     RLOGD("setUiccSubscription: serial %d", serial);
 #endif
@@ -2452,7 +2472,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setDataAllowed(int32_t serial, bool allow) {
+Return<void> RadioImpl_1_5::setDataAllowed(int32_t serial, bool allow) {
 #if VDBG
     RLOGD("setDataAllowed: serial %d", serial);
 #endif
@@ -2460,7 +2480,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getHardwareConfig(int32_t serial) {
+Return<void> RadioImpl_1_5::getHardwareConfig(int32_t serial) {
 #if VDBG
     RLOGD("getHardwareConfig: serial %d", serial);
 #endif
@@ -2469,7 +2489,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::requestIccSimAuthentication(int32_t serial, int32_t authContext,
+Return<void> RadioImpl_1_5::requestIccSimAuthentication(int32_t serial, int32_t authContext,
         const hidl_string& authData, const hidl_string& aid) {
 #if VDBG
     RLOGD("requestIccSimAuthentication: serial %d", serial);
@@ -2532,7 +2552,7 @@
     free(dataProfilePtrs);
 }
 
-Return<void> RadioImpl_1_4::setDataProfile(int32_t serial, const hidl_vec<DataProfileInfo>& profiles,
+Return<void> RadioImpl_1_5::setDataProfile(int32_t serial, const hidl_vec<DataProfileInfo>& profiles,
                                        bool isRoaming) {
 #if VDBG
     RLOGD("setDataProfile: serial %d", serial);
@@ -2694,7 +2714,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::requestShutdown(int32_t serial) {
+Return<void> RadioImpl_1_5::requestShutdown(int32_t serial) {
 #if VDBG
     RLOGD("requestShutdown: serial %d", serial);
 #endif
@@ -2702,7 +2722,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getRadioCapability(int32_t serial) {
+Return<void> RadioImpl_1_5::getRadioCapability(int32_t serial) {
 #if VDBG
     RLOGD("getRadioCapability: serial %d", serial);
 #endif
@@ -2710,7 +2730,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setRadioCapability(int32_t serial, const RadioCapability& rc) {
+Return<void> RadioImpl_1_5::setRadioCapability(int32_t serial, const RadioCapability& rc) {
 #if VDBG
     RLOGD("setRadioCapability: serial %d", serial);
 #endif
@@ -2733,7 +2753,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::startLceService(int32_t serial, int32_t reportInterval, bool pullMode) {
+Return<void> RadioImpl_1_5::startLceService(int32_t serial, int32_t reportInterval, bool pullMode) {
 #if VDBG
     RLOGD("startLceService: serial %d", serial);
 #endif
@@ -2742,7 +2762,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::stopLceService(int32_t serial) {
+Return<void> RadioImpl_1_5::stopLceService(int32_t serial) {
 #if VDBG
     RLOGD("stopLceService: serial %d", serial);
 #endif
@@ -2750,7 +2770,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::pullLceData(int32_t serial) {
+Return<void> RadioImpl_1_5::pullLceData(int32_t serial) {
 #if VDBG
     RLOGD("pullLceData: serial %d", serial);
 #endif
@@ -2758,7 +2778,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getModemActivityInfo(int32_t serial) {
+Return<void> RadioImpl_1_5::getModemActivityInfo(int32_t serial) {
 #if VDBG
     RLOGD("getModemActivityInfo: serial %d", serial);
 #endif
@@ -2831,7 +2851,7 @@
 }
 
 
-Return<void> RadioImpl_1_4::setAllowedCarriers(int32_t serial, bool allAllowed,
+Return<void> RadioImpl_1_5::setAllowedCarriers(int32_t serial, bool allAllowed,
                                            const CarrierRestrictions& carriers) {
 #if VDBG
     RLOGD("setAllowedCarriers: serial %d", serial);
@@ -2855,7 +2875,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setAllowedCarriers_1_4(int32_t  serial,
+Return<void> RadioImpl_1_5::setAllowedCarriers_1_4(int32_t  serial,
         const ::android::hardware::radio::V1_4::CarrierRestrictionsWithPriority& carriers,
         ::android::hardware::radio::V1_4::SimLockMultiSimPolicy multiSimPolicy) {
 #if VDBG
@@ -2891,7 +2911,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getAllowedCarriers(int32_t serial) {
+Return<void> RadioImpl_1_5::getAllowedCarriers(int32_t serial) {
 #if VDBG
     RLOGD("getAllowedCarriers: serial %d", serial);
 #endif
@@ -2899,7 +2919,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getAllowedCarriers_1_4(int32_t serial) {
+Return<void> RadioImpl_1_5::getAllowedCarriers_1_4(int32_t serial) {
 #if VDBG
     RLOGD("getAllowedCarriers_1_4: serial %d", serial);
 #endif
@@ -2907,7 +2927,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::sendDeviceState(int32_t serial, DeviceStateType deviceStateType,
+Return<void> RadioImpl_1_5::sendDeviceState(int32_t serial, DeviceStateType deviceStateType,
                                         bool state) {
 #if VDBG
     RLOGD("sendDeviceState: serial %d", serial);
@@ -2928,7 +2948,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setIndicationFilter(int32_t serial, int32_t indicationFilter) {
+Return<void> RadioImpl_1_5::setIndicationFilter(int32_t serial, int32_t indicationFilter) {
 #if VDBG
     RLOGD("setIndicationFilter: serial %d", serial);
 #endif
@@ -2942,7 +2962,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setSimCardPower(int32_t serial, bool powerUp) {
+Return<void> RadioImpl_1_5::setSimCardPower(int32_t serial, bool powerUp) {
 #if VDBG
     RLOGD("setSimCardPower: serial %d", serial);
 #endif
@@ -2950,7 +2970,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setSimCardPower_1_1(int32_t serial, const V1_1::CardPowerState state) {
+Return<void> RadioImpl_1_5::setSimCardPower_1_1(int32_t serial, const V1_1::CardPowerState state) {
 #if VDBG
     RLOGD("setSimCardPower_1_1: serial %d state %d", serial, state);
 #endif
@@ -2958,7 +2978,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setCarrierInfoForImsiEncryption(int32_t serial,
+Return<void> RadioImpl_1_5::setCarrierInfoForImsiEncryption(int32_t serial,
         const V1_1::ImsiEncryptionInfo& data) {
 #if VDBG
     RLOGD("setCarrierInfoForImsiEncryption: serial %d", serial);
@@ -2992,7 +3012,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::startKeepalive(int32_t serial, const V1_1::KeepaliveRequest& keepalive) {
+Return<void> RadioImpl_1_5::startKeepalive(int32_t serial, const V1_1::KeepaliveRequest& keepalive) {
 #if VDBG
     RLOGD("%s(): %d", __FUNCTION__, serial);
 #endif
@@ -3041,7 +3061,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::stopKeepalive(int32_t serial, int32_t sessionHandle) {
+Return<void> RadioImpl_1_5::stopKeepalive(int32_t serial, int32_t sessionHandle) {
 #if VDBG
     RLOGD("%s(): %d", __FUNCTION__, serial);
 #endif
@@ -3054,7 +3074,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::responseAcknowledgement() {
+Return<void> RadioImpl_1_5::responseAcknowledgement() {
     android::releaseWakeLock();
     return Void();
 }
@@ -3148,7 +3168,7 @@
 }
 
 // Methods from ::android::hardware::radio::V1_2::IRadio follow.
-Return<void> RadioImpl_1_4::startNetworkScan_1_2(int32_t serial,
+Return<void> RadioImpl_1_5::startNetworkScan_1_2(int32_t serial,
         const ::android::hardware::radio::V1_2::NetworkScanRequest& request) {
 #if VDBG
     RLOGD("startNetworkScan_1_2: serial %d", serial);
@@ -3175,7 +3195,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setIndicationFilter_1_2(int32_t /* serial */,
+Return<void> RadioImpl_1_5::setIndicationFilter_1_2(int32_t /* serial */,
         hidl_bitfield<::android::hardware::radio::V1_2::IndicationFilter> /* indicationFilter */) {
     // TODO implement
 #if VDBG
@@ -3184,7 +3204,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setSignalStrengthReportingCriteria(int32_t /* serial */,
+Return<void> RadioImpl_1_5::setSignalStrengthReportingCriteria(int32_t /* serial */,
         int32_t /* hysteresisMs */, int32_t /* hysteresisDb */,
         const hidl_vec<int32_t>& /* thresholdsDbm */,
         ::android::hardware::radio::V1_2::AccessNetwork /* accessNetwork */) {
@@ -3195,7 +3215,17 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setLinkCapacityReportingCriteria(int32_t /* serial */,
+Return<void> RadioImpl_1_5::setSignalStrengthReportingCriteria_1_5(int32_t /* serial */,
+        const ::android::hardware::radio::V1_5::SignalThresholdInfo& /* signalThresholdInfo */,
+        const ::android::hardware::radio::V1_5::AccessNetwork /* accessNetwork */) {
+    // TODO implement
+#if VDBG
+    RLOGE("[%04d]< %s", serial, "Method is not implemented");
+#endif
+    return Void();
+}
+
+Return<void> RadioImpl_1_5::setLinkCapacityReportingCriteria(int32_t /* serial */,
         int32_t /* hysteresisMs */, int32_t /* hysteresisDlKbps */, int32_t /* hysteresisUlKbps */,
         const hidl_vec<int32_t>& /* thresholdsDownlinkKbps */,
         const hidl_vec<int32_t>& /* thresholdsUplinkKbps */,
@@ -3207,7 +3237,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setupDataCall_1_2(int32_t /* serial */,
+Return<void> RadioImpl_1_5::setupDataCall_1_2(int32_t /* serial */,
         ::android::hardware::radio::V1_2::AccessNetwork /* accessNetwork */,
         const ::android::hardware::radio::V1_0::DataProfileInfo& /* dataProfileInfo */,
         bool /* modemCognitive */, bool /* roamingAllowed */, bool /* isRoaming */,
@@ -3220,7 +3250,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::deactivateDataCall_1_2(int32_t /* serial */, int32_t /* cid */,
+Return<void> RadioImpl_1_5::deactivateDataCall_1_2(int32_t /* serial */, int32_t /* cid */,
         ::android::hardware::radio::V1_2::DataRequestReason /* reason */) {
     // TODO implement
 #if VDBG
@@ -3230,7 +3260,7 @@
 }
 
 // Methods from ::android::hardware::radio::V1_3::IRadio follow.
-Return<void> RadioImpl_1_4::setSystemSelectionChannels(int32_t serial, bool /* specifyChannels */,
+Return<void> RadioImpl_1_5::setSystemSelectionChannels(int32_t serial, bool /* specifyChannels */,
         const hidl_vec<::android::hardware::radio::V1_1::RadioAccessSpecifier>& /* specifiers */) {
 #if VDBG
     RLOGD("setSystemSelectionChannels: serial %d", serial);
@@ -3239,7 +3269,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::enableModem(int32_t serial, bool /* on */) {
+Return<void> RadioImpl_1_5::enableModem(int32_t serial, bool /* on */) {
 #if VDBG
     RLOGE("enableModem: serial = %d, enable = %s", serial, on);
 #endif
@@ -3247,7 +3277,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getModemStackStatus(int32_t serial) {
+Return<void> RadioImpl_1_5::getModemStackStatus(int32_t serial) {
 #if VDBG
     RLOGD("getModemStackStatus: serial %d", serial);
 #endif
@@ -3275,7 +3305,7 @@
 }
 
 // Methods from ::android::hardware::radio::V1_4::IRadio follow.
-Return<void> RadioImpl_1_4::setupDataCall_1_4(int32_t serial ,
+Return<void> RadioImpl_1_5::setupDataCall_1_4(int32_t serial ,
         ::android::hardware::radio::V1_4::AccessNetwork /* accessNetwork */,
         const ::android::hardware::radio::V1_4::DataProfileInfo& dataProfileInfo,
         bool roamingAllowed, ::android::hardware::radio::V1_2::DataRequestReason /* reason */,
@@ -3313,7 +3343,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setInitialAttachApn_1_4(int32_t  serial ,
+Return<void> RadioImpl_1_5::setInitialAttachApn_1_4(int32_t  serial ,
         const ::android::hardware::radio::V1_4::DataProfileInfo& dataProfileInfo) {
     RequestInfo *pRI = android::addRequestToList(serial, mSlotId,
             RIL_REQUEST_SET_INITIAL_ATTACH_APN);
@@ -3339,7 +3369,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setDataProfile_1_4(int32_t  serial ,
+Return<void> RadioImpl_1_5::setDataProfile_1_4(int32_t  serial ,
         const hidl_vec<::android::hardware::radio::V1_4::DataProfileInfo>& /* profiles */) {
     RequestInfo *pRI = android::addRequestToList(serial, mSlotId,
             RIL_REQUEST_SET_DATA_PROFILE);
@@ -3365,7 +3395,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::emergencyDial(int32_t serial,
+Return<void> RadioImpl_1_5::emergencyDial(int32_t serial,
         const ::android::hardware::radio::V1_0::Dial& dialInfo,
         hidl_bitfield<android::hardware::radio::V1_4::EmergencyServiceCategory> /* categories */,
         const hidl_vec<hidl_string>& /* urns */,
@@ -3413,7 +3443,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::startNetworkScan_1_4(int32_t serial,
+Return<void> RadioImpl_1_5::startNetworkScan_1_4(int32_t serial,
         const ::android::hardware::radio::V1_2::NetworkScanRequest& request) {
 #if VDBG
     RLOGD("startNetworkScan_1_4: serial %d", serial);
@@ -3440,7 +3470,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getPreferredNetworkTypeBitmap(int32_t serial ) {
+Return<void> RadioImpl_1_5::getPreferredNetworkTypeBitmap(int32_t serial ) {
 #if VDBG
     RLOGD("getPreferredNetworkTypeBitmap: serial %d", serial);
 #endif
@@ -3448,7 +3478,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::setPreferredNetworkTypeBitmap(
+Return<void> RadioImpl_1_5::setPreferredNetworkTypeBitmap(
         int32_t serial, hidl_bitfield<RadioAccessFamily> networkTypeBitmap) {
 #if VDBG
     RLOGD("setPreferredNetworkTypeBitmap: serial %d", serial);
@@ -3457,7 +3487,7 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getSignalStrength_1_4(int32_t serial) {
+Return<void> RadioImpl_1_5::getSignalStrength_1_4(int32_t serial) {
 #if VDBG
     RLOGD("getSignalStrength_1_4: serial %d", serial);
 #endif
@@ -3465,6 +3495,32 @@
     return Void();
 }
 
+// radio::V1_5::IRadio methods:
+Return<void> RadioImpl_1_5::enableUiccApplications(int32_t serial, bool enable) {
+#if VDBG
+    RLOGD("enableUiccApplications: serial %d enable %d", serial, enable);
+#endif
+    dispatchInts(serial, mSlotId, RIL_REQUEST_ENABLE_UICC_APPLICATIONS, 1, BOOL_TO_INT(enable));
+    return Void();
+}
+
+Return<void> RadioImpl_1_5::areUiccApplicationsEnabled(int32_t serial) {
+#if VDBG
+    RLOGD("areUiccApplicationsEnabled: serial %d", serial);
+#endif
+    dispatchVoid(serial, mSlotId, RIL_REQUEST_ARE_UICC_APPLICATIONS_ENABLED);
+    return Void();
+}
+
+Return<void> RadioImpl_1_5::canToggleUiccApplicationsEnablement(int32_t serial) {
+#if VDBG
+    RLOGD("canToggleUiccApplicationsEnablement: serial %d.", serial);
+#endif
+    dispatchVoid(serial, mSlotId, RIL_REQUEST_CAN_TOGGLE_UICC_APPLICATIONS_ENABLEMENT);
+    return Void();
+}
+
+// OEM hook methods:
 Return<void> OemHookImpl::setResponseFunctions(
         const ::android::sp<IOemHookResponse>& oemHookResponseParam,
         const ::android::sp<IOemHookIndication>& oemHookIndicationParam) {
@@ -3472,7 +3528,7 @@
     RLOGD("OemHookImpl::setResponseFunctions");
 #endif
 
-    pthread_rwlock_t *radioServiceRwlockPtr = radio_1_4::getRadioServiceRwlock(mSlotId);
+    pthread_rwlock_t *radioServiceRwlockPtr = radio_1_5::getRadioServiceRwlock(mSlotId);
     int ret = pthread_rwlock_wrlock(radioServiceRwlockPtr);
     assert(ret == 0);
 
@@ -3509,7 +3565,7 @@
  * responses for those requests coming back from the vendor code.
  **************************************************************************************************/
 
-void radio_1_4::acknowledgeRequest(int slotId, int serial) {
+void radio_1_5::acknowledgeRequest(int slotId, int serial) {
     if (radioService[slotId]->mRadioResponse != NULL) {
         Return<void> retStatus = radioService[slotId]->mRadioResponse->acknowledgeRequest(serial);
         radioService[slotId]->checkReturnStatus(retStatus);
@@ -3566,7 +3622,7 @@
     return ret;
 }
 
-int radio_1_4::getIccCardStatusResponse(int slotId,
+int radio_1_5::getIccCardStatusResponse(int slotId,
                                    int responseType, int serial, RIL_Errno e,
                                    void *response, size_t responseLen) {
     if (radioService[slotId]->mRadioResponseV1_4 != NULL
@@ -3644,7 +3700,7 @@
     return 0;
 }
 
-int radio_1_4::supplyIccPinForAppResponse(int slotId,
+int radio_1_5::supplyIccPinForAppResponse(int slotId,
                                      int responseType, int serial, RIL_Errno e,
                                      void *response, size_t responseLen) {
 #if VDBG
@@ -3666,7 +3722,7 @@
     return 0;
 }
 
-int radio_1_4::supplyIccPukForAppResponse(int slotId,
+int radio_1_5::supplyIccPukForAppResponse(int slotId,
                                      int responseType, int serial, RIL_Errno e,
                                      void *response, size_t responseLen) {
 #if VDBG
@@ -3687,7 +3743,7 @@
     return 0;
 }
 
-int radio_1_4::supplyIccPin2ForAppResponse(int slotId,
+int radio_1_5::supplyIccPin2ForAppResponse(int slotId,
                                       int responseType, int serial, RIL_Errno e,
                                       void *response, size_t responseLen) {
 #if VDBG
@@ -3708,7 +3764,7 @@
     return 0;
 }
 
-int radio_1_4::supplyIccPuk2ForAppResponse(int slotId,
+int radio_1_5::supplyIccPuk2ForAppResponse(int slotId,
                                       int responseType, int serial, RIL_Errno e,
                                       void *response, size_t responseLen) {
 #if VDBG
@@ -3729,7 +3785,7 @@
     return 0;
 }
 
-int radio_1_4::changeIccPinForAppResponse(int slotId,
+int radio_1_5::changeIccPinForAppResponse(int slotId,
                                      int responseType, int serial, RIL_Errno e,
                                      void *response, size_t responseLen) {
 #if VDBG
@@ -3750,7 +3806,7 @@
     return 0;
 }
 
-int radio_1_4::changeIccPin2ForAppResponse(int slotId,
+int radio_1_5::changeIccPin2ForAppResponse(int slotId,
                                       int responseType, int serial, RIL_Errno e,
                                       void *response, size_t responseLen) {
 #if VDBG
@@ -3771,7 +3827,7 @@
     return 0;
 }
 
-int radio_1_4::supplyNetworkDepersonalizationResponse(int slotId,
+int radio_1_5::supplyNetworkDepersonalizationResponse(int slotId,
                                                  int responseType, int serial, RIL_Errno e,
                                                  void *response, size_t responseLen) {
 #if VDBG
@@ -3792,7 +3848,7 @@
     return 0;
 }
 
-int radio_1_4::getCurrentCallsResponse(int slotId,
+int radio_1_5::getCurrentCallsResponse(int slotId,
                                   int responseType, int serial, RIL_Errno e,
                                   void *response, size_t responseLen) {
 #if VDBG
@@ -3850,7 +3906,7 @@
     return 0;
 }
 
-int radio_1_4::dialResponse(int slotId,
+int radio_1_5::dialResponse(int slotId,
                        int responseType, int serial, RIL_Errno e, void *response,
                        size_t responseLen) {
 #if VDBG
@@ -3869,7 +3925,7 @@
     return 0;
 }
 
-int radio_1_4::getIMSIForAppResponse(int slotId,
+int radio_1_5::getIMSIForAppResponse(int slotId,
                                 int responseType, int serial, RIL_Errno e, void *response,
                                 size_t responseLen) {
 #if VDBG
@@ -3890,7 +3946,7 @@
     return 0;
 }
 
-int radio_1_4::hangupConnectionResponse(int slotId,
+int radio_1_5::hangupConnectionResponse(int slotId,
                                    int responseType, int serial, RIL_Errno e,
                                    void *response, size_t responseLen) {
 #if VDBG
@@ -3911,7 +3967,7 @@
     return 0;
 }
 
-int radio_1_4::hangupWaitingOrBackgroundResponse(int slotId,
+int radio_1_5::hangupWaitingOrBackgroundResponse(int slotId,
                                             int responseType, int serial, RIL_Errno e,
                                             void *response, size_t responseLen) {
 #if VDBG
@@ -3933,7 +3989,7 @@
     return 0;
 }
 
-int radio_1_4::hangupForegroundResumeBackgroundResponse(int slotId, int responseType, int serial,
+int radio_1_5::hangupForegroundResumeBackgroundResponse(int slotId, int responseType, int serial,
                                                     RIL_Errno e, void *response,
                                                     size_t responseLen) {
 #if VDBG
@@ -3955,7 +4011,7 @@
     return 0;
 }
 
-int radio_1_4::switchWaitingOrHoldingAndActiveResponse(int slotId, int responseType, int serial,
+int radio_1_5::switchWaitingOrHoldingAndActiveResponse(int slotId, int responseType, int serial,
                                                    RIL_Errno e, void *response,
                                                    size_t responseLen) {
 #if VDBG
@@ -3977,7 +4033,7 @@
     return 0;
 }
 
-int radio_1_4::conferenceResponse(int slotId, int responseType,
+int radio_1_5::conferenceResponse(int slotId, int responseType,
                              int serial, RIL_Errno e, void *response, size_t responseLen) {
 #if VDBG
     RLOGD("conferenceResponse: serial %d", serial);
@@ -3997,7 +4053,7 @@
     return 0;
 }
 
-int radio_1_4::rejectCallResponse(int slotId, int responseType,
+int radio_1_5::rejectCallResponse(int slotId, int responseType,
                              int serial, RIL_Errno e, void *response, size_t responseLen) {
 #if VDBG
     RLOGD("rejectCallResponse: serial %d", serial);
@@ -4017,7 +4073,7 @@
     return 0;
 }
 
-int radio_1_4::getLastCallFailCauseResponse(int slotId,
+int radio_1_5::getLastCallFailCauseResponse(int slotId,
                                        int responseType, int serial, RIL_Errno e, void *response,
                                        size_t responseLen) {
 #if VDBG
@@ -4056,7 +4112,7 @@
     return 0;
 }
 
-int radio_1_4::getSignalStrengthResponse(int slotId,
+int radio_1_5::getSignalStrengthResponse(int slotId,
                                      int responseType, int serial, RIL_Errno e,
                                      void *response, size_t responseLen) {
 #if VDBG
@@ -4395,7 +4451,7 @@
     fillCellIdentityResponse(cellIdentity, rilCellIdentity);
 }
 
-int radio_1_4::getVoiceRegistrationStateResponse(int slotId,
+int radio_1_5::getVoiceRegistrationStateResponse(int slotId,
                                             int responseType, int serial, RIL_Errno e,
                                             void *response, size_t responseLen) {
 #if VDBG
@@ -4459,7 +4515,7 @@
     return 0;
 }
 
-int radio_1_4::getDataRegistrationStateResponse(int slotId,
+int radio_1_5::getDataRegistrationStateResponse(int slotId,
                                            int responseType, int serial, RIL_Errno e,
                                            void *response, size_t responseLen) {
 #if VDBG
@@ -4515,7 +4571,7 @@
     return 0;
 }
 
-int radio_1_4::getOperatorResponse(int slotId,
+int radio_1_5::getOperatorResponse(int slotId,
                               int responseType, int serial, RIL_Errno e, void *response,
                               size_t responseLen) {
 #if VDBG
@@ -4550,7 +4606,7 @@
     return 0;
 }
 
-int radio_1_4::setRadioPowerResponse(int slotId,
+int radio_1_5::setRadioPowerResponse(int slotId,
                                 int responseType, int serial, RIL_Errno e, void *response,
                                 size_t responseLen) {
     RLOGD("setRadioPowerResponse: serial %d", serial);
@@ -4569,7 +4625,7 @@
     return 0;
 }
 
-int radio_1_4::sendDtmfResponse(int slotId,
+int radio_1_5::sendDtmfResponse(int slotId,
                            int responseType, int serial, RIL_Errno e, void *response,
                            size_t responseLen) {
 #if VDBG
@@ -4608,7 +4664,7 @@
     return result;
 }
 
-int radio_1_4::sendSmsResponse(int slotId,
+int radio_1_5::sendSmsResponse(int slotId,
                           int responseType, int serial, RIL_Errno e, void *response,
                           size_t responseLen) {
 #if VDBG
@@ -4630,7 +4686,7 @@
     return 0;
 }
 
-int radio_1_4::sendSMSExpectMoreResponse(int slotId,
+int radio_1_5::sendSMSExpectMoreResponse(int slotId,
                                     int responseType, int serial, RIL_Errno e, void *response,
                                     size_t responseLen) {
 #if VDBG
@@ -4652,7 +4708,7 @@
     return 0;
 }
 
-int radio_1_4::setupDataCallResponse(int slotId,
+int radio_1_5::setupDataCallResponse(int slotId,
                                  int responseType, int serial, RIL_Errno e, void *response,
                                  size_t responseLen) {
 #if VDBG
@@ -4731,7 +4787,7 @@
     return result;
 }
 
-int radio_1_4::iccIOForAppResponse(int slotId,
+int radio_1_5::iccIOForAppResponse(int slotId,
                       int responseType, int serial, RIL_Errno e, void *response,
                       size_t responseLen) {
 #if VDBG
@@ -4753,7 +4809,7 @@
     return 0;
 }
 
-int radio_1_4::sendUssdResponse(int slotId,
+int radio_1_5::sendUssdResponse(int slotId,
                            int responseType, int serial, RIL_Errno e, void *response,
                            size_t responseLen) {
 #if VDBG
@@ -4774,7 +4830,7 @@
     return 0;
 }
 
-int radio_1_4::cancelPendingUssdResponse(int slotId,
+int radio_1_5::cancelPendingUssdResponse(int slotId,
                                     int responseType, int serial, RIL_Errno e, void *response,
                                     size_t responseLen) {
 #if VDBG
@@ -4795,7 +4851,7 @@
     return 0;
 }
 
-int radio_1_4::getClirResponse(int slotId,
+int radio_1_5::getClirResponse(int slotId,
                               int responseType, int serial, RIL_Errno e, void *response,
                               size_t responseLen) {
 #if VDBG
@@ -4825,7 +4881,7 @@
     return 0;
 }
 
-int radio_1_4::setClirResponse(int slotId,
+int radio_1_5::setClirResponse(int slotId,
                           int responseType, int serial, RIL_Errno e, void *response,
                           size_t responseLen) {
 #if VDBG
@@ -4845,7 +4901,7 @@
     return 0;
 }
 
-int radio_1_4::getCallForwardStatusResponse(int slotId,
+int radio_1_5::getCallForwardStatusResponse(int slotId,
                                        int responseType, int serial, RIL_Errno e,
                                        void *response, size_t responseLen) {
 #if VDBG
@@ -4886,7 +4942,7 @@
     return 0;
 }
 
-int radio_1_4::setCallForwardResponse(int slotId,
+int radio_1_5::setCallForwardResponse(int slotId,
                                  int responseType, int serial, RIL_Errno e, void *response,
                                  size_t responseLen) {
 #if VDBG
@@ -4906,7 +4962,7 @@
     return 0;
 }
 
-int radio_1_4::getCallWaitingResponse(int slotId,
+int radio_1_5::getCallWaitingResponse(int slotId,
                                  int responseType, int serial, RIL_Errno e, void *response,
                                  size_t responseLen) {
 #if VDBG
@@ -4937,7 +4993,7 @@
     return 0;
 }
 
-int radio_1_4::setCallWaitingResponse(int slotId,
+int radio_1_5::setCallWaitingResponse(int slotId,
                                  int responseType, int serial, RIL_Errno e, void *response,
                                  size_t responseLen) {
 #if VDBG
@@ -4957,7 +5013,7 @@
     return 0;
 }
 
-int radio_1_4::acknowledgeLastIncomingGsmSmsResponse(int slotId,
+int radio_1_5::acknowledgeLastIncomingGsmSmsResponse(int slotId,
                                                 int responseType, int serial, RIL_Errno e,
                                                 void *response, size_t responseLen) {
 #if VDBG
@@ -4979,7 +5035,7 @@
     return 0;
 }
 
-int radio_1_4::acceptCallResponse(int slotId,
+int radio_1_5::acceptCallResponse(int slotId,
                              int responseType, int serial, RIL_Errno e,
                              void *response, size_t responseLen) {
 #if VDBG
@@ -5000,7 +5056,7 @@
     return 0;
 }
 
-int radio_1_4::deactivateDataCallResponse(int slotId,
+int radio_1_5::deactivateDataCallResponse(int slotId,
                                                 int responseType, int serial, RIL_Errno e,
                                                 void *response, size_t responseLen) {
 #if VDBG
@@ -5021,7 +5077,7 @@
     return 0;
 }
 
-int radio_1_4::getFacilityLockForAppResponse(int slotId,
+int radio_1_5::getFacilityLockForAppResponse(int slotId,
                                         int responseType, int serial, RIL_Errno e,
                                         void *response, size_t responseLen) {
 #if VDBG
@@ -5042,7 +5098,7 @@
     return 0;
 }
 
-int radio_1_4::setFacilityLockForAppResponse(int slotId,
+int radio_1_5::setFacilityLockForAppResponse(int slotId,
                                       int responseType, int serial, RIL_Errno e,
                                       void *response, size_t responseLen) {
 #if VDBG
@@ -5064,7 +5120,7 @@
     return 0;
 }
 
-int radio_1_4::setBarringPasswordResponse(int slotId,
+int radio_1_5::setBarringPasswordResponse(int slotId,
                              int responseType, int serial, RIL_Errno e,
                              void *response, size_t responseLen) {
 #if VDBG
@@ -5085,7 +5141,7 @@
     return 0;
 }
 
-int radio_1_4::getNetworkSelectionModeResponse(int slotId,
+int radio_1_5::getNetworkSelectionModeResponse(int slotId,
                                           int responseType, int serial, RIL_Errno e, void *response,
                                           size_t responseLen) {
 #if VDBG
@@ -5116,7 +5172,7 @@
     return 0;
 }
 
-int radio_1_4::setNetworkSelectionModeAutomaticResponse(int slotId, int responseType, int serial,
+int radio_1_5::setNetworkSelectionModeAutomaticResponse(int slotId, int responseType, int serial,
                                                     RIL_Errno e, void *response,
                                                     size_t responseLen) {
 #if VDBG
@@ -5138,7 +5194,7 @@
     return 0;
 }
 
-int radio_1_4::setNetworkSelectionModeManualResponse(int slotId,
+int radio_1_5::setNetworkSelectionModeManualResponse(int slotId,
                              int responseType, int serial, RIL_Errno e,
                              void *response, size_t responseLen) {
 #if VDBG
@@ -5174,7 +5230,7 @@
     }
 }
 
-int radio_1_4::getAvailableNetworksResponse(int slotId,
+int radio_1_5::getAvailableNetworksResponse(int slotId,
                               int responseType, int serial, RIL_Errno e, void *response,
                               size_t responseLen) {
 #if VDBG
@@ -5217,7 +5273,7 @@
     return 0;
 }
 
-int radio_1_4::startDtmfResponse(int slotId,
+int radio_1_5::startDtmfResponse(int slotId,
                             int responseType, int serial, RIL_Errno e,
                             void *response, size_t responseLen) {
 #if VDBG
@@ -5237,7 +5293,7 @@
     return 0;
 }
 
-int radio_1_4::stopDtmfResponse(int slotId,
+int radio_1_5::stopDtmfResponse(int slotId,
                            int responseType, int serial, RIL_Errno e,
                            void *response, size_t responseLen) {
 #if VDBG
@@ -5257,7 +5313,7 @@
     return 0;
 }
 
-int radio_1_4::getBasebandVersionResponse(int slotId,
+int radio_1_5::getBasebandVersionResponse(int slotId,
                                      int responseType, int serial, RIL_Errno e,
                                      void *response, size_t responseLen) {
 #if VDBG
@@ -5278,7 +5334,7 @@
     return 0;
 }
 
-int radio_1_4::separateConnectionResponse(int slotId,
+int radio_1_5::separateConnectionResponse(int slotId,
                                      int responseType, int serial, RIL_Errno e,
                                      void *response, size_t responseLen) {
 #if VDBG
@@ -5299,7 +5355,7 @@
     return 0;
 }
 
-int radio_1_4::setMuteResponse(int slotId,
+int radio_1_5::setMuteResponse(int slotId,
                           int responseType, int serial, RIL_Errno e,
                           void *response, size_t responseLen) {
 #if VDBG
@@ -5319,7 +5375,7 @@
     return 0;
 }
 
-int radio_1_4::getMuteResponse(int slotId,
+int radio_1_5::getMuteResponse(int slotId,
                           int responseType, int serial, RIL_Errno e, void *response,
                           size_t responseLen) {
 #if VDBG
@@ -5347,7 +5403,7 @@
     return 0;
 }
 
-int radio_1_4::getClipResponse(int slotId,
+int radio_1_5::getClipResponse(int slotId,
                           int responseType, int serial, RIL_Errno e,
                           void *response, size_t responseLen) {
 #if VDBG
@@ -5367,7 +5423,7 @@
     return 0;
 }
 
-int radio_1_4::getDataCallListResponse(int slotId,
+int radio_1_5::getDataCallListResponse(int slotId,
                                    int responseType, int serial, RIL_Errno e,
                                    void *response, size_t responseLen) {
 #if VDBG
@@ -5397,7 +5453,7 @@
     return 0;
 }
 
-int radio_1_4::setSuppServiceNotificationsResponse(int slotId,
+int radio_1_5::setSuppServiceNotificationsResponse(int slotId,
                                               int responseType, int serial, RIL_Errno e,
                                               void *response, size_t responseLen) {
 #if VDBG
@@ -5419,7 +5475,7 @@
     return 0;
 }
 
-int radio_1_4::deleteSmsOnSimResponse(int slotId,
+int radio_1_5::deleteSmsOnSimResponse(int slotId,
                                  int responseType, int serial, RIL_Errno e,
                                  void *response, size_t responseLen) {
 #if VDBG
@@ -5439,7 +5495,7 @@
     return 0;
 }
 
-int radio_1_4::setBandModeResponse(int slotId,
+int radio_1_5::setBandModeResponse(int slotId,
                               int responseType, int serial, RIL_Errno e,
                               void *response, size_t responseLen) {
 #if VDBG
@@ -5459,7 +5515,7 @@
     return 0;
 }
 
-int radio_1_4::writeSmsToSimResponse(int slotId,
+int radio_1_5::writeSmsToSimResponse(int slotId,
                                 int responseType, int serial, RIL_Errno e,
                                 void *response, size_t responseLen) {
 #if VDBG
@@ -5479,7 +5535,7 @@
     return 0;
 }
 
-int radio_1_4::getAvailableBandModesResponse(int slotId,
+int radio_1_5::getAvailableBandModesResponse(int slotId,
                                         int responseType, int serial, RIL_Errno e, void *response,
                                         size_t responseLen) {
 #if VDBG
@@ -5513,7 +5569,7 @@
     return 0;
 }
 
-int radio_1_4::sendEnvelopeResponse(int slotId,
+int radio_1_5::sendEnvelopeResponse(int slotId,
                                int responseType, int serial, RIL_Errno e,
                                void *response, size_t responseLen) {
 #if VDBG
@@ -5534,7 +5590,7 @@
     return 0;
 }
 
-int radio_1_4::sendTerminalResponseToSimResponse(int slotId,
+int radio_1_5::sendTerminalResponseToSimResponse(int slotId,
                                             int responseType, int serial, RIL_Errno e,
                                             void *response, size_t responseLen) {
 #if VDBG
@@ -5556,7 +5612,7 @@
     return 0;
 }
 
-int radio_1_4::handleStkCallSetupRequestFromSimResponse(int slotId,
+int radio_1_5::handleStkCallSetupRequestFromSimResponse(int slotId,
                                                    int responseType, int serial,
                                                    RIL_Errno e, void *response,
                                                    size_t responseLen) {
@@ -5579,7 +5635,7 @@
     return 0;
 }
 
-int radio_1_4::explicitCallTransferResponse(int slotId,
+int radio_1_5::explicitCallTransferResponse(int slotId,
                                        int responseType, int serial, RIL_Errno e,
                                        void *response, size_t responseLen) {
 #if VDBG
@@ -5600,7 +5656,7 @@
     return 0;
 }
 
-int radio_1_4::setPreferredNetworkTypeResponse(int slotId,
+int radio_1_5::setPreferredNetworkTypeResponse(int slotId,
                                  int responseType, int serial, RIL_Errno e,
                                  void *response, size_t responseLen) {
 #if VDBG
@@ -5623,7 +5679,7 @@
 }
 
 
-int radio_1_4::getPreferredNetworkTypeResponse(int slotId,
+int radio_1_5::getPreferredNetworkTypeResponse(int slotId,
                                           int responseType, int serial, RIL_Errno e,
                                           void *response, size_t responseLen) {
 #if VDBG
@@ -5645,7 +5701,7 @@
     return 0;
 }
 
-int radio_1_4::setPreferredNetworkTypeBitmapResponse(int slotId,
+int radio_1_5::setPreferredNetworkTypeBitmapResponse(int slotId,
                                  int responseType, int serial, RIL_Errno e,
                                  void *response, size_t responseLen) {
 #if VDBG
@@ -5668,7 +5724,7 @@
 }
 
 
-int radio_1_4::getPreferredNetworkTypeBitmapResponse(int slotId,
+int radio_1_5::getPreferredNetworkTypeBitmapResponse(int slotId,
                                           int responseType, int serial, RIL_Errno e,
                                           void *response, size_t responseLen) {
 #if VDBG
@@ -5692,7 +5748,7 @@
     return 0;
 }
 
-int radio_1_4::getNeighboringCidsResponse(int slotId,
+int radio_1_5::getNeighboringCidsResponse(int slotId,
                                      int responseType, int serial, RIL_Errno e,
                                      void *response, size_t responseLen) {
 #if VDBG
@@ -5730,7 +5786,7 @@
     return 0;
 }
 
-int radio_1_4::setLocationUpdatesResponse(int slotId,
+int radio_1_5::setLocationUpdatesResponse(int slotId,
                                      int responseType, int serial, RIL_Errno e,
                                      void *response, size_t responseLen) {
 #if VDBG
@@ -5751,7 +5807,7 @@
     return 0;
 }
 
-int radio_1_4::setCdmaSubscriptionSourceResponse(int slotId,
+int radio_1_5::setCdmaSubscriptionSourceResponse(int slotId,
                                  int responseType, int serial, RIL_Errno e,
                                  void *response, size_t responseLen) {
 #if VDBG
@@ -5773,7 +5829,7 @@
     return 0;
 }
 
-int radio_1_4::setCdmaRoamingPreferenceResponse(int slotId,
+int radio_1_5::setCdmaRoamingPreferenceResponse(int slotId,
                                  int responseType, int serial, RIL_Errno e,
                                  void *response, size_t responseLen) {
 #if VDBG
@@ -5795,7 +5851,7 @@
     return 0;
 }
 
-int radio_1_4::getCdmaRoamingPreferenceResponse(int slotId,
+int radio_1_5::getCdmaRoamingPreferenceResponse(int slotId,
                                            int responseType, int serial, RIL_Errno e,
                                            void *response, size_t responseLen) {
 #if VDBG
@@ -5817,7 +5873,7 @@
     return 0;
 }
 
-int radio_1_4::setTTYModeResponse(int slotId,
+int radio_1_5::setTTYModeResponse(int slotId,
                              int responseType, int serial, RIL_Errno e,
                              void *response, size_t responseLen) {
 #if VDBG
@@ -5837,7 +5893,7 @@
     return 0;
 }
 
-int radio_1_4::getTTYModeResponse(int slotId,
+int radio_1_5::getTTYModeResponse(int slotId,
                              int responseType, int serial, RIL_Errno e,
                              void *response, size_t responseLen) {
 #if VDBG
@@ -5858,7 +5914,7 @@
     return 0;
 }
 
-int radio_1_4::setPreferredVoicePrivacyResponse(int slotId,
+int radio_1_5::setPreferredVoicePrivacyResponse(int slotId,
                                  int responseType, int serial, RIL_Errno e,
                                  void *response, size_t responseLen) {
 #if VDBG
@@ -5880,7 +5936,7 @@
     return 0;
 }
 
-int radio_1_4::getPreferredVoicePrivacyResponse(int slotId,
+int radio_1_5::getPreferredVoicePrivacyResponse(int slotId,
                                            int responseType, int serial, RIL_Errno e,
                                            void *response, size_t responseLen) {
 #if VDBG
@@ -5911,7 +5967,7 @@
     return 0;
 }
 
-int radio_1_4::sendCDMAFeatureCodeResponse(int slotId,
+int radio_1_5::sendCDMAFeatureCodeResponse(int slotId,
                                  int responseType, int serial, RIL_Errno e,
                                  void *response, size_t responseLen) {
 #if VDBG
@@ -5932,7 +5988,7 @@
     return 0;
 }
 
-int radio_1_4::sendBurstDtmfResponse(int slotId,
+int radio_1_5::sendBurstDtmfResponse(int slotId,
                                  int responseType, int serial, RIL_Errno e,
                                  void *response, size_t responseLen) {
 #if VDBG
@@ -5952,7 +6008,7 @@
     return 0;
 }
 
-int radio_1_4::sendCdmaSmsResponse(int slotId,
+int radio_1_5::sendCdmaSmsResponse(int slotId,
                               int responseType, int serial, RIL_Errno e, void *response,
                               size_t responseLen) {
 #if VDBG
@@ -5974,7 +6030,7 @@
     return 0;
 }
 
-int radio_1_4::acknowledgeLastIncomingCdmaSmsResponse(int slotId,
+int radio_1_5::acknowledgeLastIncomingCdmaSmsResponse(int slotId,
                                                  int responseType, int serial, RIL_Errno e,
                                                  void *response, size_t responseLen) {
 #if VDBG
@@ -5996,7 +6052,7 @@
     return 0;
 }
 
-int radio_1_4::getGsmBroadcastConfigResponse(int slotId,
+int radio_1_5::getGsmBroadcastConfigResponse(int slotId,
                                         int responseType, int serial, RIL_Errno e,
                                         void *response, size_t responseLen) {
 #if VDBG
@@ -6038,7 +6094,7 @@
     return 0;
 }
 
-int radio_1_4::setGsmBroadcastConfigResponse(int slotId,
+int radio_1_5::setGsmBroadcastConfigResponse(int slotId,
                                         int responseType, int serial, RIL_Errno e,
                                         void *response, size_t responseLen) {
 #if VDBG
@@ -6059,7 +6115,7 @@
     return 0;
 }
 
-int radio_1_4::setGsmBroadcastActivationResponse(int slotId,
+int radio_1_5::setGsmBroadcastActivationResponse(int slotId,
                                             int responseType, int serial, RIL_Errno e,
                                             void *response, size_t responseLen) {
 #if VDBG
@@ -6081,7 +6137,7 @@
     return 0;
 }
 
-int radio_1_4::getCdmaBroadcastConfigResponse(int slotId,
+int radio_1_5::getCdmaBroadcastConfigResponse(int slotId,
                                          int responseType, int serial, RIL_Errno e,
                                          void *response, size_t responseLen) {
 #if VDBG
@@ -6121,7 +6177,7 @@
     return 0;
 }
 
-int radio_1_4::setCdmaBroadcastConfigResponse(int slotId,
+int radio_1_5::setCdmaBroadcastConfigResponse(int slotId,
                                          int responseType, int serial, RIL_Errno e,
                                          void *response, size_t responseLen) {
 #if VDBG
@@ -6143,7 +6199,7 @@
     return 0;
 }
 
-int radio_1_4::setCdmaBroadcastActivationResponse(int slotId,
+int radio_1_5::setCdmaBroadcastActivationResponse(int slotId,
                                              int responseType, int serial, RIL_Errno e,
                                              void *response, size_t responseLen) {
 #if VDBG
@@ -6165,7 +6221,7 @@
     return 0;
 }
 
-int radio_1_4::getCDMASubscriptionResponse(int slotId,
+int radio_1_5::getCDMASubscriptionResponse(int slotId,
                                       int responseType, int serial, RIL_Errno e, void *response,
                                       size_t responseLen) {
 #if VDBG
@@ -6205,7 +6261,7 @@
     return 0;
 }
 
-int radio_1_4::writeSmsToRuimResponse(int slotId,
+int radio_1_5::writeSmsToRuimResponse(int slotId,
                                  int responseType, int serial, RIL_Errno e,
                                  void *response, size_t responseLen) {
 #if VDBG
@@ -6225,7 +6281,7 @@
     return 0;
 }
 
-int radio_1_4::deleteSmsOnRuimResponse(int slotId,
+int radio_1_5::deleteSmsOnRuimResponse(int slotId,
                                   int responseType, int serial, RIL_Errno e,
                                   void *response, size_t responseLen) {
 #if VDBG
@@ -6245,7 +6301,7 @@
     return 0;
 }
 
-int radio_1_4::getDeviceIdentityResponse(int slotId,
+int radio_1_5::getDeviceIdentityResponse(int slotId,
                                     int responseType, int serial, RIL_Errno e, void *response,
                                     size_t responseLen) {
 #if VDBG
@@ -6283,7 +6339,7 @@
     return 0;
 }
 
-int radio_1_4::exitEmergencyCallbackModeResponse(int slotId,
+int radio_1_5::exitEmergencyCallbackModeResponse(int slotId,
                                             int responseType, int serial, RIL_Errno e,
                                             void *response, size_t responseLen) {
 #if VDBG
@@ -6305,7 +6361,7 @@
     return 0;
 }
 
-int radio_1_4::getSmscAddressResponse(int slotId,
+int radio_1_5::getSmscAddressResponse(int slotId,
                                   int responseType, int serial, RIL_Errno e,
                                   void *response, size_t responseLen) {
 #if VDBG
@@ -6326,7 +6382,7 @@
     return 0;
 }
 
-int radio_1_4::setSmscAddressResponse(int slotId,
+int radio_1_5::setSmscAddressResponse(int slotId,
                                              int responseType, int serial, RIL_Errno e,
                                              void *response, size_t responseLen) {
 #if VDBG
@@ -6346,7 +6402,7 @@
     return 0;
 }
 
-int radio_1_4::reportSmsMemoryStatusResponse(int slotId,
+int radio_1_5::reportSmsMemoryStatusResponse(int slotId,
                                         int responseType, int serial, RIL_Errno e,
                                         void *response, size_t responseLen) {
 #if VDBG
@@ -6367,7 +6423,7 @@
     return 0;
 }
 
-int radio_1_4::reportStkServiceIsRunningResponse(int slotId,
+int radio_1_5::reportStkServiceIsRunningResponse(int slotId,
                                              int responseType, int serial, RIL_Errno e,
                                              void *response, size_t responseLen) {
 #if VDBG
@@ -6388,7 +6444,7 @@
     return 0;
 }
 
-int radio_1_4::getCdmaSubscriptionSourceResponse(int slotId,
+int radio_1_5::getCdmaSubscriptionSourceResponse(int slotId,
                                             int responseType, int serial, RIL_Errno e,
                                             void *response, size_t responseLen) {
 #if VDBG
@@ -6410,7 +6466,7 @@
     return 0;
 }
 
-int radio_1_4::requestIsimAuthenticationResponse(int slotId,
+int radio_1_5::requestIsimAuthenticationResponse(int slotId,
                                             int responseType, int serial, RIL_Errno e,
                                             void *response, size_t responseLen) {
 #if VDBG
@@ -6433,7 +6489,7 @@
     return 0;
 }
 
-int radio_1_4::acknowledgeIncomingGsmSmsWithPduResponse(int slotId,
+int radio_1_5::acknowledgeIncomingGsmSmsWithPduResponse(int slotId,
                                                    int responseType,
                                                    int serial, RIL_Errno e, void *response,
                                                    size_t responseLen) {
@@ -6456,7 +6512,7 @@
     return 0;
 }
 
-int radio_1_4::sendEnvelopeWithStatusResponse(int slotId,
+int radio_1_5::sendEnvelopeWithStatusResponse(int slotId,
                                          int responseType, int serial, RIL_Errno e, void *response,
                                          size_t responseLen) {
 #if VDBG
@@ -6480,7 +6536,7 @@
     return 0;
 }
 
-int radio_1_4::getVoiceRadioTechnologyResponse(int slotId,
+int radio_1_5::getVoiceRadioTechnologyResponse(int slotId,
                                           int responseType, int serial, RIL_Errno e,
                                           void *response, size_t responseLen) {
 #if VDBG
@@ -6502,7 +6558,7 @@
     return 0;
 }
 
-int radio_1_4::getCellInfoListResponse(int slotId,
+int radio_1_5::getCellInfoListResponse(int slotId,
                                    int responseType,
                                    int serial, RIL_Errno e, void *response,
                                    size_t responseLen) {
@@ -6533,7 +6589,7 @@
     return 0;
 }
 
-int radio_1_4::setCellInfoListRateResponse(int slotId,
+int radio_1_5::setCellInfoListRateResponse(int slotId,
                                        int responseType,
                                        int serial, RIL_Errno e, void *response,
                                        size_t responseLen) {
@@ -6555,7 +6611,7 @@
     return 0;
 }
 
-int radio_1_4::setInitialAttachApnResponse(int slotId,
+int radio_1_5::setInitialAttachApnResponse(int slotId,
                                        int responseType, int serial, RIL_Errno e,
                                        void *response, size_t responseLen) {
 #if VDBG
@@ -6576,7 +6632,7 @@
     return 0;
 }
 
-int radio_1_4::getImsRegistrationStateResponse(int slotId,
+int radio_1_5::getImsRegistrationStateResponse(int slotId,
                                            int responseType, int serial, RIL_Errno e,
                                            void *response, size_t responseLen) {
 #if VDBG
@@ -6609,7 +6665,7 @@
     return 0;
 }
 
-int radio_1_4::sendImsSmsResponse(int slotId,
+int radio_1_5::sendImsSmsResponse(int slotId,
                               int responseType, int serial, RIL_Errno e, void *response,
                               size_t responseLen) {
 #if VDBG
@@ -6631,7 +6687,7 @@
     return 0;
 }
 
-int radio_1_4::iccTransmitApduBasicChannelResponse(int slotId,
+int radio_1_5::iccTransmitApduBasicChannelResponse(int slotId,
                                                int responseType, int serial, RIL_Errno e,
                                                void *response, size_t responseLen) {
 #if VDBG
@@ -6655,7 +6711,7 @@
     return 0;
 }
 
-int radio_1_4::iccOpenLogicalChannelResponse(int slotId,
+int radio_1_5::iccOpenLogicalChannelResponse(int slotId,
                                          int responseType, int serial, RIL_Errno e, void *response,
                                          size_t responseLen) {
 #if VDBG
@@ -6693,7 +6749,7 @@
     return 0;
 }
 
-int radio_1_4::iccCloseLogicalChannelResponse(int slotId,
+int radio_1_5::iccCloseLogicalChannelResponse(int slotId,
                                           int responseType, int serial, RIL_Errno e,
                                           void *response, size_t responseLen) {
 #if VDBG
@@ -6715,7 +6771,7 @@
     return 0;
 }
 
-int radio_1_4::iccTransmitApduLogicalChannelResponse(int slotId,
+int radio_1_5::iccTransmitApduLogicalChannelResponse(int slotId,
                                                  int responseType, int serial, RIL_Errno e,
                                                  void *response, size_t responseLen) {
 #if VDBG
@@ -6739,7 +6795,7 @@
     return 0;
 }
 
-int radio_1_4::nvReadItemResponse(int slotId,
+int radio_1_5::nvReadItemResponse(int slotId,
                               int responseType, int serial, RIL_Errno e,
                               void *response, size_t responseLen) {
 #if VDBG
@@ -6760,7 +6816,7 @@
     return 0;
 }
 
-int radio_1_4::nvWriteItemResponse(int slotId,
+int radio_1_5::nvWriteItemResponse(int slotId,
                                int responseType, int serial, RIL_Errno e,
                                void *response, size_t responseLen) {
 #if VDBG
@@ -6780,7 +6836,7 @@
     return 0;
 }
 
-int radio_1_4::nvWriteCdmaPrlResponse(int slotId,
+int radio_1_5::nvWriteCdmaPrlResponse(int slotId,
                                   int responseType, int serial, RIL_Errno e,
                                   void *response, size_t responseLen) {
 #if VDBG
@@ -6800,7 +6856,7 @@
     return 0;
 }
 
-int radio_1_4::nvResetConfigResponse(int slotId,
+int radio_1_5::nvResetConfigResponse(int slotId,
                                  int responseType, int serial, RIL_Errno e,
                                  void *response, size_t responseLen) {
 #if VDBG
@@ -6820,7 +6876,7 @@
     return 0;
 }
 
-int radio_1_4::setUiccSubscriptionResponse(int slotId,
+int radio_1_5::setUiccSubscriptionResponse(int slotId,
                                        int responseType, int serial, RIL_Errno e,
                                        void *response, size_t responseLen) {
 #if VDBG
@@ -6841,7 +6897,7 @@
     return 0;
 }
 
-int radio_1_4::setDataAllowedResponse(int slotId,
+int radio_1_5::setDataAllowedResponse(int slotId,
                                   int responseType, int serial, RIL_Errno e,
                                   void *response, size_t responseLen) {
 #if VDBG
@@ -6861,7 +6917,7 @@
     return 0;
 }
 
-int radio_1_4::getHardwareConfigResponse(int slotId,
+int radio_1_5::getHardwareConfigResponse(int slotId,
                                      int responseType, int serial, RIL_Errno e,
                                      void *response, size_t responseLen) {
 #if VDBG
@@ -6891,7 +6947,7 @@
     return 0;
 }
 
-int radio_1_4::requestIccSimAuthenticationResponse(int slotId,
+int radio_1_5::requestIccSimAuthenticationResponse(int slotId,
                                                int responseType, int serial, RIL_Errno e,
                                                void *response, size_t responseLen) {
 #if VDBG
@@ -6915,7 +6971,7 @@
     return 0;
 }
 
-int radio_1_4::setDataProfileResponse(int slotId,
+int radio_1_5::setDataProfileResponse(int slotId,
                                   int responseType, int serial, RIL_Errno e,
                                   void *response, size_t responseLen) {
 #if VDBG
@@ -6935,7 +6991,7 @@
     return 0;
 }
 
-int radio_1_4::requestShutdownResponse(int slotId,
+int radio_1_5::requestShutdownResponse(int slotId,
                                   int responseType, int serial, RIL_Errno e,
                                   void *response, size_t responseLen) {
 #if VDBG
@@ -6968,7 +7024,7 @@
     }
 }
 
-int radio_1_4::getRadioCapabilityResponse(int slotId,
+int radio_1_5::getRadioCapabilityResponse(int slotId,
                                      int responseType, int serial, RIL_Errno e,
                                      void *response, size_t responseLen) {
 #if VDBG
@@ -6990,7 +7046,7 @@
     return 0;
 }
 
-int radio_1_4::setRadioCapabilityResponse(int slotId,
+int radio_1_5::setRadioCapabilityResponse(int slotId,
                                      int responseType, int serial, RIL_Errno e,
                                      void *response, size_t responseLen) {
 #if VDBG
@@ -7028,7 +7084,7 @@
     return result;
 }
 
-int radio_1_4::startLceServiceResponse(int slotId,
+int radio_1_5::startLceServiceResponse(int slotId,
                                    int responseType, int serial, RIL_Errno e,
                                    void *response, size_t responseLen) {
 #if VDBG
@@ -7051,7 +7107,7 @@
     return 0;
 }
 
-int radio_1_4::stopLceServiceResponse(int slotId,
+int radio_1_5::stopLceServiceResponse(int slotId,
                                   int responseType, int serial, RIL_Errno e,
                                   void *response, size_t responseLen) {
 #if VDBG
@@ -7074,7 +7130,7 @@
     return 0;
 }
 
-int radio_1_4::pullLceDataResponse(int slotId,
+int radio_1_5::pullLceDataResponse(int slotId,
                                int responseType, int serial, RIL_Errno e,
                                void *response, size_t responseLen) {
 #if VDBG
@@ -7103,7 +7159,7 @@
     return 0;
 }
 
-int radio_1_4::getModemActivityInfoResponse(int slotId,
+int radio_1_5::getModemActivityInfoResponse(int slotId,
                                         int responseType, int serial, RIL_Errno e,
                                         void *response, size_t responseLen) {
 #if VDBG
@@ -7139,7 +7195,7 @@
     return 0;
 }
 
-int radio_1_4::setAllowedCarriersResponse(int slotId,
+int radio_1_5::setAllowedCarriersResponse(int slotId,
                                       int responseType, int serial, RIL_Errno e,
                                       void *response, size_t responseLen) {
 #if VDBG
@@ -7161,7 +7217,7 @@
     return 0;
 }
 
-int radio_1_4::setAllowedCarriersResponse4(int slotId, int responseType, int serial, RIL_Errno e,
+int radio_1_5::setAllowedCarriersResponse4(int slotId, int responseType, int serial, RIL_Errno e,
                                     void *response, size_t responseLen) {
 #if VDBG
     RLOGD("setAllowedCarriersResponse4: serial %d", serial);
@@ -7208,7 +7264,7 @@
     }
 }
 
-int radio_1_4::getAllowedCarriersResponse(int slotId,
+int radio_1_5::getAllowedCarriersResponse(int slotId,
                                       int responseType, int serial, RIL_Errno e,
                                       void *response, size_t responseLen) {
 #if VDBG
@@ -7248,7 +7304,7 @@
     return 0;
 }
 
-int radio_1_4::getAllowedCarriersResponse4(int slotId,
+int radio_1_5::getAllowedCarriersResponse4(int slotId,
                                       int responseType, int serial, RIL_Errno e,
                                       void *response, size_t responseLen) {
 #if VDBG
@@ -7302,7 +7358,7 @@
     return 0;
 }
 
-int radio_1_4::sendDeviceStateResponse(int slotId,
+int radio_1_5::sendDeviceStateResponse(int slotId,
                               int responseType, int serial, RIL_Errno e,
                               void *response, size_t responselen) {
 #if VDBG
@@ -7322,7 +7378,7 @@
     return 0;
 }
 
-int radio_1_4::setCarrierInfoForImsiEncryptionResponse(int slotId,
+int radio_1_5::setCarrierInfoForImsiEncryptionResponse(int slotId,
                                int responseType, int serial, RIL_Errno e,
                                void *response, size_t responseLen) {
     RLOGD("setCarrierInfoForImsiEncryptionResponse: serial %d", serial);
@@ -7339,7 +7395,7 @@
     return 0;
 }
 
-int radio_1_4::setIndicationFilterResponse(int slotId,
+int radio_1_5::setIndicationFilterResponse(int slotId,
                               int responseType, int serial, RIL_Errno e,
                               void *response, size_t responselen) {
 #if VDBG
@@ -7360,7 +7416,7 @@
     return 0;
 }
 
-int radio_1_4::setSimCardPowerResponse(int slotId,
+int radio_1_5::setSimCardPowerResponse(int slotId,
                                    int responseType, int serial, RIL_Errno e,
                                    void *response, size_t responseLen) {
 #if VDBG
@@ -7389,7 +7445,7 @@
     return 0;
 }
 
-int radio_1_4::startNetworkScanResponse(int slotId, int responseType, int serial, RIL_Errno e,
+int radio_1_5::startNetworkScanResponse(int slotId, int responseType, int serial, RIL_Errno e,
                                     void *response, size_t responseLen) {
 #if VDBG
     RLOGD("startNetworkScanResponse: serial %d", serial);
@@ -7408,7 +7464,7 @@
     return 0;
 }
 
-int radio_1_4::startNetworkScanResponse4(int slotId, int responseType, int serial, RIL_Errno e,
+int radio_1_5::startNetworkScanResponse4(int slotId, int responseType, int serial, RIL_Errno e,
                                     void *response, size_t responseLen) {
 #if VDBG
     RLOGD("startNetworkScanResponse4: serial %d", serial);
@@ -7426,7 +7482,7 @@
     return 0;
 }
 
-int radio_1_4::stopNetworkScanResponse(int slotId, int responseType, int serial, RIL_Errno e,
+int radio_1_5::stopNetworkScanResponse(int slotId, int responseType, int serial, RIL_Errno e,
                                    void *response, size_t responseLen) {
 #if VDBG
     RLOGD("stopNetworkScanResponse: serial %d", serial);
@@ -7445,7 +7501,7 @@
     return 0;
 }
 
-int radio_1_4::emergencyDialResponse(int slotId, int responseType, int serial, RIL_Errno e,
+int radio_1_5::emergencyDialResponse(int slotId, int responseType, int serial, RIL_Errno e,
                                     void *response, size_t responseLen) {
 #if VDBG
     RLOGD("emergencyDialResponse: serial %d", serial);
@@ -7469,7 +7525,7 @@
     halStatus.code = static_cast<V1_1::KeepaliveStatusCode>(rilStatus->code);
 }
 
-int radio_1_4::startKeepaliveResponse(int slotId, int responseType, int serial, RIL_Errno e,
+int radio_1_5::startKeepaliveResponse(int slotId, int responseType, int serial, RIL_Errno e,
                                     void *response, size_t responseLen) {
 #if VDBG
     RLOGD("%s(): %d", __FUNCTION__, serial);
@@ -7497,7 +7553,7 @@
     return 0;
 }
 
-int radio_1_4::stopKeepaliveResponse(int slotId, int responseType, int serial, RIL_Errno e,
+int radio_1_5::stopKeepaliveResponse(int slotId, int responseType, int serial, RIL_Errno e,
                                     void *response, size_t responseLen) {
 #if VDBG
     RLOGD("%s(): %d", __FUNCTION__, serial);
@@ -7517,7 +7573,7 @@
     return 0;
 }
 
-int radio_1_4::getModemStackStatusResponse(int slotId, int responseType, int serial, RIL_Errno e,
+int radio_1_5::getModemStackStatusResponse(int slotId, int responseType, int serial, RIL_Errno e,
                                     void *response, size_t responseLen) {
 #if VDBG
     RLOGD("%s(): %d", __FUNCTION__, serial);
@@ -7538,7 +7594,7 @@
     return 0;
 }
 
-int radio_1_4::enableModemResponse(int slotId, int responseType, int serial, RIL_Errno e,
+int radio_1_5::enableModemResponse(int slotId, int responseType, int serial, RIL_Errno e,
                                     void *response, size_t responseLen) {
 #if VDBG
     RLOGD("%s(): %d", __FUNCTION__, serial);
@@ -7558,7 +7614,7 @@
     return 0;
 }
 
-int radio_1_4::sendRequestRawResponse(int slotId,
+int radio_1_5::sendRequestRawResponse(int slotId,
                                   int responseType, int serial, RIL_Errno e,
                                   void *response, size_t responseLen) {
 #if VDBG
@@ -7589,7 +7645,7 @@
     return 0;
 }
 
-int radio_1_4::sendRequestStringsResponse(int slotId,
+int radio_1_5::sendRequestStringsResponse(int slotId,
                                       int responseType, int serial, RIL_Errno e,
                                       void *response, size_t responseLen) {
 #if VDBG
@@ -7626,7 +7682,7 @@
     return 0;
 }
 
-int radio_1_4::setSystemSelectionChannelsResponse(int slotId, int responseType, int serial,
+int radio_1_5::setSystemSelectionChannelsResponse(int slotId, int responseType, int serial,
                                         RIL_Errno e, void* /* response */, size_t responseLen) {
 #if VDBG
     RLOGD("%s(): %d", __FUNCTION__, serial);
@@ -7647,6 +7703,96 @@
     return 0;
 }
 
+int radio_1_5::setSignalStrengthReportingCriteriaResponse_1_5(int slotId, int responseType,
+                                        int serial, RIL_Errno e, void* /* response */,
+                                        size_t responseLen) {
+#if VDBG
+    RLOGD("%s(): %d", __FUNCTION__, serial);
+#endif
+    RadioResponseInfo responseInfo = {};
+    populateResponseInfo(responseInfo, serial, responseType, e);
+
+    if (radioService[slotId]->mRadioResponseV1_5 == NULL) {
+        RLOGE("%s: radioService[%d]->mRadioResponseV1_5 == NULL", __FUNCTION__, slotId);
+        Return<void> retStatus =
+                radioService[slotId]->mRadioResponseV1_5->setSignalStrengthReportingCriteriaResponse_1_5(
+                responseInfo);
+        radioService[slotId]->checkReturnStatus(retStatus);
+    }
+    return 0;
+}
+
+int radio_1_5::enableUiccApplicationsResponse(int slotId, int responseType, int serial,
+                                    RIL_Errno e, void* /* response */, size_t responseLen) {
+#if VDBG
+    RLOGD("%s(): %d", __FUNCTION__, serial);
+#endif
+    RadioResponseInfo responseInfo = {};
+    populateResponseInfo(responseInfo, serial, responseType, e);
+
+    // If we don't have a radio service, there's nothing we can do
+    if (radioService[slotId]->mRadioResponseV1_5 == NULL) {
+        RLOGE("%s: radioService[%d]->mRadioResponseV1_5 == NULL", __FUNCTION__, slotId);
+        return 0;
+    }
+
+    Return<void> retStatus =
+            radioService[slotId]->mRadioResponseV1_5->enableUiccApplicationsResponse(
+            responseInfo);
+    radioService[slotId]->checkReturnStatus(retStatus);
+    return 0;
+}
+
+int radio_1_5::areUiccApplicationsEnabledResponse(int slotId, int responseType, int serial,
+                                        RIL_Errno e, void* response, size_t responseLen) {
+#if VDBG
+    RLOGD("%s(): %d", __FUNCTION__, serial);
+#endif
+    RadioResponseInfo responseInfo = {};
+    populateResponseInfo(responseInfo, serial, responseType, e);
+
+    // If we don't have a radio service, there's nothing we can do
+    if (radioService[slotId]->mRadioResponseV1_5 == NULL) {
+        RLOGE("%s: radioService[%d]->mRadioResponseV1_5 == NULL", __FUNCTION__, slotId);
+        return 0;
+    }
+
+    bool enable = false;
+    if (response == NULL || responseLen != sizeof(bool)) {
+        RLOGE("isSimDetachedFromNetwork Invalid response.");
+    } else {
+        enable = (*((bool *) response));
+    }
+
+    Return<void> retStatus =
+            radioService[slotId]->mRadioResponseV1_5->areUiccApplicationsEnabledResponse(
+            responseInfo, enable);
+    radioService[slotId]->checkReturnStatus(retStatus);
+    return 0;
+}
+
+int radio_1_5::canToggleUiccApplicationsEnablementResponse(int slotId, int responseType,
+                                                       int serial, RIL_Errno e,
+                                                       void *response, size_t responseLen) {
+#if VDBG
+    RLOGD("%s(): %d", __FUNCTION__, serial);
+#endif
+    RadioResponseInfo responseInfo = {};
+    populateResponseInfo(responseInfo, serial, responseType, e);
+
+    // If we don't have a radio service, there's nothing we can do
+    if (radioService[slotId]->mRadioResponseV1_5 == NULL) {
+        RLOGE("%s: radioService[%d]->mRadioResponseV1_5 == NULL", __FUNCTION__, slotId);
+        return 0;
+    }
+
+    Return<void> retStatus =
+            radioService[slotId]->mRadioResponseV1_5->canToggleUiccApplicationsEnablementResponse(
+            responseInfo, true);
+    radioService[slotId]->checkReturnStatus(retStatus);
+    return 0;
+}
+
 /***************************************************************************************************
  * INDICATION FUNCTIONS
  * The below function handle unsolicited messages coming from the Radio
@@ -7658,7 +7804,7 @@
             (RadioIndicationType::UNSOLICITED_ACK_EXP);
 }
 
-int radio_1_4::radioStateChangedInd(int slotId,
+int radio_1_5::radioStateChangedInd(int slotId,
                                  int indicationType, int token, RIL_Errno e, void *response,
                                  size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -7675,7 +7821,7 @@
     return 0;
 }
 
-int radio_1_4::callStateChangedInd(int slotId,
+int radio_1_5::callStateChangedInd(int slotId,
                                int indicationType, int token, RIL_Errno e, void *response,
                                size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -7692,7 +7838,7 @@
     return 0;
 }
 
-int radio_1_4::networkStateChangedInd(int slotId,
+int radio_1_5::networkStateChangedInd(int slotId,
                                   int indicationType, int token, RIL_Errno e, void *response,
                                   size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -7746,7 +7892,7 @@
     return bytes;
 }
 
-int radio_1_4::newSmsInd(int slotId, int indicationType,
+int radio_1_5::newSmsInd(int slotId, int indicationType,
                      int token, RIL_Errno e, void *response, size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
         if (response == NULL || responseLen == 0) {
@@ -7776,7 +7922,7 @@
     return 0;
 }
 
-int radio_1_4::newSmsStatusReportInd(int slotId,
+int radio_1_5::newSmsStatusReportInd(int slotId,
                                  int indicationType, int token, RIL_Errno e, void *response,
                                  size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -7807,7 +7953,7 @@
     return 0;
 }
 
-int radio_1_4::newSmsOnSimInd(int slotId, int indicationType,
+int radio_1_5::newSmsOnSimInd(int slotId, int indicationType,
                           int token, RIL_Errno e, void *response, size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
         if (response == NULL || responseLen != sizeof(int)) {
@@ -7828,7 +7974,7 @@
     return 0;
 }
 
-int radio_1_4::onUssdInd(int slotId, int indicationType,
+int radio_1_5::onUssdInd(int slotId, int indicationType,
                      int token, RIL_Errno e, void *response, size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
         if (response == NULL || responseLen != 2 * sizeof(char *)) {
@@ -7852,7 +7998,7 @@
     return 0;
 }
 
-int radio_1_4::nitzTimeReceivedInd(int slotId,
+int radio_1_5::nitzTimeReceivedInd(int slotId,
                                int indicationType, int token, RIL_Errno e, void *response,
                                size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -7924,7 +8070,7 @@
     signalStrength.tdScdma.rscp = rilSignalStrength->TD_SCDMA_SignalStrength.rscp;
 }
 
-int radio_1_4::currentSignalStrengthInd(int slotId,
+int radio_1_5::currentSignalStrengthInd(int slotId,
                                     int indicationType, int token, RIL_Errno e,
                                     void *response, size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -8023,7 +8169,7 @@
     }
 }
 
-int radio_1_4::dataCallListChangedInd(int slotId,
+int radio_1_5::dataCallListChangedInd(int slotId,
                                   int indicationType, int token, RIL_Errno e, void *response,
                                   size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -8047,7 +8193,7 @@
     return 0;
 }
 
-int radio_1_4::suppSvcNotifyInd(int slotId, int indicationType,
+int radio_1_5::suppSvcNotifyInd(int slotId, int indicationType,
                             int token, RIL_Errno e, void *response, size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
         if (response == NULL || responseLen != sizeof(RIL_SuppSvcNotification)) {
@@ -8077,7 +8223,7 @@
     return 0;
 }
 
-int radio_1_4::stkSessionEndInd(int slotId, int indicationType,
+int radio_1_5::stkSessionEndInd(int slotId, int indicationType,
                             int token, RIL_Errno e, void *response, size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
 #if VDBG
@@ -8093,7 +8239,7 @@
     return 0;
 }
 
-int radio_1_4::stkProactiveCommandInd(int slotId,
+int radio_1_5::stkProactiveCommandInd(int slotId,
                                   int indicationType, int token, RIL_Errno e, void *response,
                                   size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -8115,7 +8261,7 @@
     return 0;
 }
 
-int radio_1_4::stkEventNotifyInd(int slotId, int indicationType,
+int radio_1_5::stkEventNotifyInd(int slotId, int indicationType,
                              int token, RIL_Errno e, void *response, size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
         if (response == NULL || responseLen == 0) {
@@ -8136,7 +8282,7 @@
     return 0;
 }
 
-int radio_1_4::stkCallSetupInd(int slotId, int indicationType,
+int radio_1_5::stkCallSetupInd(int slotId, int indicationType,
                            int token, RIL_Errno e, void *response, size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
         if (response == NULL || responseLen != sizeof(int)) {
@@ -8157,7 +8303,7 @@
     return 0;
 }
 
-int radio_1_4::simSmsStorageFullInd(int slotId,
+int radio_1_5::simSmsStorageFullInd(int slotId,
                                 int indicationType, int token, RIL_Errno e, void *response,
                                 size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -8174,7 +8320,7 @@
     return 0;
 }
 
-int radio_1_4::simRefreshInd(int slotId, int indicationType,
+int radio_1_5::simRefreshInd(int slotId, int indicationType,
                          int token, RIL_Errno e, void *response, size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
         if (response == NULL || responseLen != sizeof(RIL_SimRefreshResponse_v7)) {
@@ -8210,7 +8356,7 @@
     record.signal = signalInfoRecord->signal;
 }
 
-int radio_1_4::callRingInd(int slotId, int indicationType,
+int radio_1_5::callRingInd(int slotId, int indicationType,
                        int token, RIL_Errno e, void *response, size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
         bool isGsm;
@@ -8239,7 +8385,7 @@
     return 0;
 }
 
-int radio_1_4::simStatusChangedInd(int slotId,
+int radio_1_5::simStatusChangedInd(int slotId,
                                int indicationType, int token, RIL_Errno e, void *response,
                                size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -8256,7 +8402,7 @@
     return 0;
 }
 
-int radio_1_4::cdmaNewSmsInd(int slotId, int indicationType,
+int radio_1_5::cdmaNewSmsInd(int slotId, int indicationType,
                          int token, RIL_Errno e, void *response, size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
         if (response == NULL || responseLen != sizeof(RIL_CDMA_SMS_Message)) {
@@ -8304,7 +8450,7 @@
     return 0;
 }
 
-int radio_1_4::newBroadcastSmsInd(int slotId,
+int radio_1_5::newBroadcastSmsInd(int slotId,
                               int indicationType, int token, RIL_Errno e, void *response,
                               size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -8328,7 +8474,7 @@
     return 0;
 }
 
-int radio_1_4::cdmaRuimSmsStorageFullInd(int slotId,
+int radio_1_5::cdmaRuimSmsStorageFullInd(int slotId,
                                      int indicationType, int token, RIL_Errno e, void *response,
                                      size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -8346,7 +8492,7 @@
     return 0;
 }
 
-int radio_1_4::restrictedStateChangedInd(int slotId,
+int radio_1_5::restrictedStateChangedInd(int slotId,
                                      int indicationType, int token, RIL_Errno e, void *response,
                                      size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -8369,7 +8515,7 @@
     return 0;
 }
 
-int radio_1_4::enterEmergencyCallbackModeInd(int slotId,
+int radio_1_5::enterEmergencyCallbackModeInd(int slotId,
                                          int indicationType, int token, RIL_Errno e, void *response,
                                          size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -8387,7 +8533,7 @@
     return 0;
 }
 
-int radio_1_4::cdmaCallWaitingInd(int slotId,
+int radio_1_5::cdmaCallWaitingInd(int slotId,
                               int indicationType, int token, RIL_Errno e, void *response,
                               size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -8420,7 +8566,7 @@
     return 0;
 }
 
-int radio_1_4::cdmaOtaProvisionStatusInd(int slotId,
+int radio_1_5::cdmaOtaProvisionStatusInd(int slotId,
                                      int indicationType, int token, RIL_Errno e, void *response,
                                      size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -8443,7 +8589,7 @@
     return 0;
 }
 
-int radio_1_4::cdmaInfoRecInd(int slotId,
+int radio_1_5::cdmaInfoRecInd(int slotId,
                           int indicationType, int token, RIL_Errno e, void *response,
                           size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -8621,7 +8767,7 @@
     return 0;
 }
 
-int radio_1_4::indicateRingbackToneInd(int slotId,
+int radio_1_5::indicateRingbackToneInd(int slotId,
                                    int indicationType, int token, RIL_Errno e, void *response,
                                    size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -8643,7 +8789,7 @@
     return 0;
 }
 
-int radio_1_4::resendIncallMuteInd(int slotId,
+int radio_1_5::resendIncallMuteInd(int slotId,
                                int indicationType, int token, RIL_Errno e, void *response,
                                size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -8660,7 +8806,7 @@
     return 0;
 }
 
-int radio_1_4::cdmaSubscriptionSourceChangedInd(int slotId,
+int radio_1_5::cdmaSubscriptionSourceChangedInd(int slotId,
                                             int indicationType, int token, RIL_Errno e,
                                             void *response, size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -8684,7 +8830,7 @@
     return 0;
 }
 
-int radio_1_4::cdmaPrlChangedInd(int slotId,
+int radio_1_5::cdmaPrlChangedInd(int slotId,
                              int indicationType, int token, RIL_Errno e, void *response,
                              size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -8706,7 +8852,7 @@
     return 0;
 }
 
-int radio_1_4::exitEmergencyCallbackModeInd(int slotId,
+int radio_1_5::exitEmergencyCallbackModeInd(int slotId,
                                         int indicationType, int token, RIL_Errno e, void *response,
                                         size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -8724,7 +8870,7 @@
     return 0;
 }
 
-int radio_1_4::rilConnectedInd(int slotId,
+int radio_1_5::rilConnectedInd(int slotId,
                            int indicationType, int token, RIL_Errno e, void *response,
                            size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -8739,7 +8885,7 @@
     return 0;
 }
 
-int radio_1_4::voiceRadioTechChangedInd(int slotId,
+int radio_1_5::voiceRadioTechChangedInd(int slotId,
                                     int indicationType, int token, RIL_Errno e, void *response,
                                     size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -8908,7 +9054,7 @@
     }
 }
 
-int radio_1_4::cellInfoListInd(int slotId,
+int radio_1_5::cellInfoListInd(int slotId,
                            int indicationType, int token, RIL_Errno e, void *response,
                            size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -8933,7 +9079,7 @@
     return 0;
 }
 
-int radio_1_4::imsNetworkStateChangedInd(int slotId,
+int radio_1_5::imsNetworkStateChangedInd(int slotId,
                                      int indicationType, int token, RIL_Errno e, void *response,
                                      size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -8951,7 +9097,7 @@
     return 0;
 }
 
-int radio_1_4::subscriptionStatusChangedInd(int slotId,
+int radio_1_5::subscriptionStatusChangedInd(int slotId,
                                         int indicationType, int token, RIL_Errno e, void *response,
                                         size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -8974,7 +9120,7 @@
     return 0;
 }
 
-int radio_1_4::srvccStateNotifyInd(int slotId,
+int radio_1_5::srvccStateNotifyInd(int slotId,
                                int indicationType, int token, RIL_Errno e, void *response,
                                size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -9029,7 +9175,7 @@
     }
 }
 
-int radio_1_4::hardwareConfigChangedInd(int slotId,
+int radio_1_5::hardwareConfigChangedInd(int slotId,
                                     int indicationType, int token, RIL_Errno e, void *response,
                                     size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -9065,7 +9211,7 @@
     rc.status = (V1_0::RadioCapabilityStatus) rilRadioCapability->status;
 }
 
-int radio_1_4::radioCapabilityIndicationInd(int slotId,
+int radio_1_5::radioCapabilityIndicationInd(int slotId,
                                         int indicationType, int token, RIL_Errno e, void *response,
                                         size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -9104,7 +9250,7 @@
     return false;
 }
 
-int radio_1_4::onSupplementaryServiceIndicationInd(int slotId,
+int radio_1_5::onSupplementaryServiceIndicationInd(int slotId,
                                                int indicationType, int token, RIL_Errno e,
                                                void *response, size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -9184,7 +9330,7 @@
     return 0;
 }
 
-int radio_1_4::stkCallControlAlphaNotifyInd(int slotId,
+int radio_1_5::stkCallControlAlphaNotifyInd(int slotId,
                                         int indicationType, int token, RIL_Errno e, void *response,
                                         size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -9214,7 +9360,7 @@
     lce.lceSuspended = rilLceDataInfo->lce_suspended;
 }
 
-int radio_1_4::lceDataInd(int slotId,
+int radio_1_5::lceDataInd(int slotId,
                       int indicationType, int token, RIL_Errno e, void *response,
                       size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -9238,7 +9384,7 @@
     return 0;
 }
 
-int radio_1_4::pcoDataInd(int slotId,
+int radio_1_5::pcoDataInd(int slotId,
                       int indicationType, int token, RIL_Errno e, void *response,
                       size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -9267,7 +9413,7 @@
     return 0;
 }
 
-int radio_1_4::modemResetInd(int slotId,
+int radio_1_5::modemResetInd(int slotId,
                          int indicationType, int token, RIL_Errno e, void *response,
                          size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
@@ -9289,7 +9435,7 @@
     return 0;
 }
 
-int radio_1_4::networkScanResultInd(int slotId,
+int radio_1_5::networkScanResultInd(int slotId,
                                 int indicationType, int token, RIL_Errno e, void *response,
                                 size_t responseLen) {
 #if VDBG
@@ -9325,7 +9471,7 @@
     return 0;
 }
 
-int radio_1_4::carrierInfoForImsiEncryption(int slotId,
+int radio_1_5::carrierInfoForImsiEncryption(int slotId,
                                   int indicationType, int token, RIL_Errno e, void *response,
                                   size_t responseLen) {
     if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndicationV1_4 != NULL) {
@@ -9345,7 +9491,7 @@
     return 0;
 }
 
-int radio_1_4::keepaliveStatusInd(int slotId,
+int radio_1_5::keepaliveStatusInd(int slotId,
                          int indicationType, int token, RIL_Errno e, void *response,
                          size_t responseLen) {
 #if VDBG
@@ -9378,7 +9524,7 @@
     return 0;
 }
 
-int radio_1_4::oemHookRawInd(int slotId,
+int radio_1_5::oemHookRawInd(int slotId,
                          int indicationType, int token, RIL_Errno e, void *response,
                          size_t responseLen) {
     if (!kOemHookEnabled) return 0;
@@ -9404,7 +9550,7 @@
     return 0;
 }
 
-void radio_1_4::registerService(RIL_RadioFunctions *callbacks, CommandInfo *commands) {
+void radio_1_5::registerService(RIL_RadioFunctions *callbacks, CommandInfo *commands) {
     using namespace android::hardware;
     int simCount = 1;
     const char *serviceNames[] = {
@@ -9435,11 +9581,12 @@
 
         RLOGD("sim i = %d registering ...", i);
 
-        radioService[i] = new RadioImpl_1_4;
+        radioService[i] = new RadioImpl_1_5;
         radioService[i]->mSlotId = i;
         RLOGD("registerService: starting android::hardware::radio::V1_4::IRadio %s for slot %d",
                 serviceNames[i], i);
         android::status_t status = radioService[i]->registerAsService(serviceNames[i]);
+        assert(status == android::OK);
 
         RLOGD("registerService: OemHook is enabled = %s", kOemHookEnabled ? "true" : "false");
         if (kOemHookEnabled) {
@@ -9457,7 +9604,7 @@
     joinRpcThreadpool();
 }
 
-pthread_rwlock_t * radio_1_4::getRadioServiceRwlock(int slotId) {
+pthread_rwlock_t * radio_1_5::getRadioServiceRwlock(int slotId) {
     pthread_rwlock_t *radioServiceRwlockPtr = &radioServiceRwlock;
 
     #if (SIM_COUNT >= 2)
@@ -9474,6 +9621,6 @@
 }
 
 // should acquire write lock for the corresponding service before calling this
-void radio_1_4::setNitzTimeReceived(int slotId, long timeReceived) {
+void radio_1_5::setNitzTimeReceived(int slotId, long timeReceived) {
     nitzTimeReceived[slotId] = timeReceived;
 }
diff --git a/guest/hals/ril/libril/ril_service.h b/guest/hals/ril/libril/ril_service.h
index fc19bcd..8caaaee 100644
--- a/guest/hals/ril/libril/ril_service.h
+++ b/guest/hals/ril/libril/ril_service.h
@@ -20,7 +20,7 @@
 #include <guest/hals/ril/libril/ril.h>
 #include <ril_internal.h>
 
-namespace radio_1_4 {
+namespace radio_1_5 {
 void registerService(RIL_RadioFunctions *callbacks, android::CommandInfo *commands);
 
 int getIccCardStatusResponse(int slotId, int responseType,
@@ -778,6 +778,22 @@
                                 void *response,
                                 size_t responselen);
 
+int setSignalStrengthReportingCriteriaResponse_1_5(int slotId,
+                          int responseType, int serial, RIL_Errno e,
+                          void *response, size_t responselen);
+
+int enableUiccApplicationsResponse(int slotId,
+                                 int responseType, int serial, RIL_Errno e,
+                                 void *response, size_t responselen);
+
+int areUiccApplicationsEnabledResponse(int slotId,
+                                     int responseType, int serial, RIL_Errno e,
+                                     void *response, size_t responselen);
+
+int canToggleUiccApplicationsEnablementResponse(int slotId,
+                                            int responseType, int serial, RIL_Errno e,
+                                            void *response, size_t responselen);
+
 pthread_rwlock_t * getRadioServiceRwlock(int slotId);
 
 void setNitzTimeReceived(int slotId, long timeReceived);
diff --git a/guest/hals/ril/libril/ril_unsol_commands.h b/guest/hals/ril/libril/ril_unsol_commands.h
index 072a0fa..89c1f55 100644
--- a/guest/hals/ril/libril/ril_unsol_commands.h
+++ b/guest/hals/ril/libril/ril_unsol_commands.h
@@ -14,53 +14,53 @@
 ** See the License for the specific language governing permissions and
 ** limitations under the License.
 */
-    {RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED, radio_1_4::radioStateChangedInd, WAKE_PARTIAL},
-    {RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED, radio_1_4::callStateChangedInd, WAKE_PARTIAL},
-    {RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED, radio_1_4::networkStateChangedInd, WAKE_PARTIAL},
-    {RIL_UNSOL_RESPONSE_NEW_SMS, radio_1_4::newSmsInd, WAKE_PARTIAL},
-    {RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT, radio_1_4::newSmsStatusReportInd, WAKE_PARTIAL},
-    {RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM, radio_1_4::newSmsOnSimInd, WAKE_PARTIAL},
-    {RIL_UNSOL_ON_USSD, radio_1_4::onUssdInd, WAKE_PARTIAL},
-    {RIL_UNSOL_ON_USSD_REQUEST, radio_1_4::onUssdInd, DONT_WAKE},
-    {RIL_UNSOL_NITZ_TIME_RECEIVED, radio_1_4::nitzTimeReceivedInd, WAKE_PARTIAL},
-    {RIL_UNSOL_SIGNAL_STRENGTH, radio_1_4::currentSignalStrengthInd, DONT_WAKE},
-    {RIL_UNSOL_DATA_CALL_LIST_CHANGED, radio_1_4::dataCallListChangedInd, WAKE_PARTIAL},
-    {RIL_UNSOL_SUPP_SVC_NOTIFICATION, radio_1_4::suppSvcNotifyInd, WAKE_PARTIAL},
-    {RIL_UNSOL_STK_SESSION_END, radio_1_4::stkSessionEndInd, WAKE_PARTIAL},
-    {RIL_UNSOL_STK_PROACTIVE_COMMAND, radio_1_4::stkProactiveCommandInd, WAKE_PARTIAL},
-    {RIL_UNSOL_STK_EVENT_NOTIFY, radio_1_4::stkEventNotifyInd, WAKE_PARTIAL},
-    {RIL_UNSOL_STK_CALL_SETUP, radio_1_4::stkCallSetupInd, WAKE_PARTIAL},
-    {RIL_UNSOL_SIM_SMS_STORAGE_FULL, radio_1_4::simSmsStorageFullInd, WAKE_PARTIAL},
-    {RIL_UNSOL_SIM_REFRESH, radio_1_4::simRefreshInd, WAKE_PARTIAL},
-    {RIL_UNSOL_CALL_RING, radio_1_4::callRingInd, WAKE_PARTIAL},
-    {RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED, radio_1_4::simStatusChangedInd, WAKE_PARTIAL},
-    {RIL_UNSOL_RESPONSE_CDMA_NEW_SMS, radio_1_4::cdmaNewSmsInd, WAKE_PARTIAL},
-    {RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS, radio_1_4::newBroadcastSmsInd, WAKE_PARTIAL},
-    {RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL, radio_1_4::cdmaRuimSmsStorageFullInd, WAKE_PARTIAL},
-    {RIL_UNSOL_RESTRICTED_STATE_CHANGED, radio_1_4::restrictedStateChangedInd, WAKE_PARTIAL},
-    {RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE, radio_1_4::enterEmergencyCallbackModeInd, WAKE_PARTIAL},
-    {RIL_UNSOL_CDMA_CALL_WAITING, radio_1_4::cdmaCallWaitingInd, WAKE_PARTIAL},
-    {RIL_UNSOL_CDMA_OTA_PROVISION_STATUS, radio_1_4::cdmaOtaProvisionStatusInd, WAKE_PARTIAL},
-    {RIL_UNSOL_CDMA_INFO_REC, radio_1_4::cdmaInfoRecInd, WAKE_PARTIAL},
-    {RIL_UNSOL_OEM_HOOK_RAW, radio_1_4::oemHookRawInd, WAKE_PARTIAL},
-    {RIL_UNSOL_RINGBACK_TONE, radio_1_4::indicateRingbackToneInd, WAKE_PARTIAL},
-    {RIL_UNSOL_RESEND_INCALL_MUTE, radio_1_4::resendIncallMuteInd, WAKE_PARTIAL},
-    {RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED, radio_1_4::cdmaSubscriptionSourceChangedInd, WAKE_PARTIAL},
-    {RIL_UNSOL_CDMA_PRL_CHANGED, radio_1_4::cdmaPrlChangedInd, WAKE_PARTIAL},
-    {RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE, radio_1_4::exitEmergencyCallbackModeInd, WAKE_PARTIAL},
-    {RIL_UNSOL_RIL_CONNECTED, radio_1_4::rilConnectedInd, WAKE_PARTIAL},
-    {RIL_UNSOL_VOICE_RADIO_TECH_CHANGED, radio_1_4::voiceRadioTechChangedInd, WAKE_PARTIAL},
-    {RIL_UNSOL_CELL_INFO_LIST, radio_1_4::cellInfoListInd, WAKE_PARTIAL},
-    {RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED, radio_1_4::imsNetworkStateChangedInd, WAKE_PARTIAL},
-    {RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED, radio_1_4::subscriptionStatusChangedInd, WAKE_PARTIAL},
-    {RIL_UNSOL_SRVCC_STATE_NOTIFY, radio_1_4::srvccStateNotifyInd, WAKE_PARTIAL},
-    {RIL_UNSOL_HARDWARE_CONFIG_CHANGED, radio_1_4::hardwareConfigChangedInd, WAKE_PARTIAL},
+    {RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED, radio_1_5::radioStateChangedInd, WAKE_PARTIAL},
+    {RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED, radio_1_5::callStateChangedInd, WAKE_PARTIAL},
+    {RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED, radio_1_5::networkStateChangedInd, WAKE_PARTIAL},
+    {RIL_UNSOL_RESPONSE_NEW_SMS, radio_1_5::newSmsInd, WAKE_PARTIAL},
+    {RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT, radio_1_5::newSmsStatusReportInd, WAKE_PARTIAL},
+    {RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM, radio_1_5::newSmsOnSimInd, WAKE_PARTIAL},
+    {RIL_UNSOL_ON_USSD, radio_1_5::onUssdInd, WAKE_PARTIAL},
+    {RIL_UNSOL_ON_USSD_REQUEST, radio_1_5::onUssdInd, DONT_WAKE},
+    {RIL_UNSOL_NITZ_TIME_RECEIVED, radio_1_5::nitzTimeReceivedInd, WAKE_PARTIAL},
+    {RIL_UNSOL_SIGNAL_STRENGTH, radio_1_5::currentSignalStrengthInd, DONT_WAKE},
+    {RIL_UNSOL_DATA_CALL_LIST_CHANGED, radio_1_5::dataCallListChangedInd, WAKE_PARTIAL},
+    {RIL_UNSOL_SUPP_SVC_NOTIFICATION, radio_1_5::suppSvcNotifyInd, WAKE_PARTIAL},
+    {RIL_UNSOL_STK_SESSION_END, radio_1_5::stkSessionEndInd, WAKE_PARTIAL},
+    {RIL_UNSOL_STK_PROACTIVE_COMMAND, radio_1_5::stkProactiveCommandInd, WAKE_PARTIAL},
+    {RIL_UNSOL_STK_EVENT_NOTIFY, radio_1_5::stkEventNotifyInd, WAKE_PARTIAL},
+    {RIL_UNSOL_STK_CALL_SETUP, radio_1_5::stkCallSetupInd, WAKE_PARTIAL},
+    {RIL_UNSOL_SIM_SMS_STORAGE_FULL, radio_1_5::simSmsStorageFullInd, WAKE_PARTIAL},
+    {RIL_UNSOL_SIM_REFRESH, radio_1_5::simRefreshInd, WAKE_PARTIAL},
+    {RIL_UNSOL_CALL_RING, radio_1_5::callRingInd, WAKE_PARTIAL},
+    {RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED, radio_1_5::simStatusChangedInd, WAKE_PARTIAL},
+    {RIL_UNSOL_RESPONSE_CDMA_NEW_SMS, radio_1_5::cdmaNewSmsInd, WAKE_PARTIAL},
+    {RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS, radio_1_5::newBroadcastSmsInd, WAKE_PARTIAL},
+    {RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL, radio_1_5::cdmaRuimSmsStorageFullInd, WAKE_PARTIAL},
+    {RIL_UNSOL_RESTRICTED_STATE_CHANGED, radio_1_5::restrictedStateChangedInd, WAKE_PARTIAL},
+    {RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE, radio_1_5::enterEmergencyCallbackModeInd, WAKE_PARTIAL},
+    {RIL_UNSOL_CDMA_CALL_WAITING, radio_1_5::cdmaCallWaitingInd, WAKE_PARTIAL},
+    {RIL_UNSOL_CDMA_OTA_PROVISION_STATUS, radio_1_5::cdmaOtaProvisionStatusInd, WAKE_PARTIAL},
+    {RIL_UNSOL_CDMA_INFO_REC, radio_1_5::cdmaInfoRecInd, WAKE_PARTIAL},
+    {RIL_UNSOL_OEM_HOOK_RAW, radio_1_5::oemHookRawInd, WAKE_PARTIAL},
+    {RIL_UNSOL_RINGBACK_TONE, radio_1_5::indicateRingbackToneInd, WAKE_PARTIAL},
+    {RIL_UNSOL_RESEND_INCALL_MUTE, radio_1_5::resendIncallMuteInd, WAKE_PARTIAL},
+    {RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED, radio_1_5::cdmaSubscriptionSourceChangedInd, WAKE_PARTIAL},
+    {RIL_UNSOL_CDMA_PRL_CHANGED, radio_1_5::cdmaPrlChangedInd, WAKE_PARTIAL},
+    {RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE, radio_1_5::exitEmergencyCallbackModeInd, WAKE_PARTIAL},
+    {RIL_UNSOL_RIL_CONNECTED, radio_1_5::rilConnectedInd, WAKE_PARTIAL},
+    {RIL_UNSOL_VOICE_RADIO_TECH_CHANGED, radio_1_5::voiceRadioTechChangedInd, WAKE_PARTIAL},
+    {RIL_UNSOL_CELL_INFO_LIST, radio_1_5::cellInfoListInd, WAKE_PARTIAL},
+    {RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED, radio_1_5::imsNetworkStateChangedInd, WAKE_PARTIAL},
+    {RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED, radio_1_5::subscriptionStatusChangedInd, WAKE_PARTIAL},
+    {RIL_UNSOL_SRVCC_STATE_NOTIFY, radio_1_5::srvccStateNotifyInd, WAKE_PARTIAL},
+    {RIL_UNSOL_HARDWARE_CONFIG_CHANGED, radio_1_5::hardwareConfigChangedInd, WAKE_PARTIAL},
     {RIL_UNSOL_DC_RT_INFO_CHANGED, NULL, WAKE_PARTIAL},
-    {RIL_UNSOL_RADIO_CAPABILITY, radio_1_4::radioCapabilityIndicationInd, WAKE_PARTIAL},
-    {RIL_UNSOL_ON_SS, radio_1_4::onSupplementaryServiceIndicationInd, WAKE_PARTIAL},
-    {RIL_UNSOL_STK_CC_ALPHA_NOTIFY, radio_1_4::stkCallControlAlphaNotifyInd, WAKE_PARTIAL},
-    {RIL_UNSOL_LCEDATA_RECV, radio_1_4::lceDataInd, WAKE_PARTIAL},
-    {RIL_UNSOL_PCO_DATA, radio_1_4::pcoDataInd, WAKE_PARTIAL},
-    {RIL_UNSOL_MODEM_RESTART, radio_1_4::modemResetInd, WAKE_PARTIAL},
-    {RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION, radio_1_4::carrierInfoForImsiEncryption, WAKE_PARTIAL},
-    {RIL_UNSOL_NETWORK_SCAN_RESULT, radio_1_4::networkScanResultInd, WAKE_PARTIAL},
+    {RIL_UNSOL_RADIO_CAPABILITY, radio_1_5::radioCapabilityIndicationInd, WAKE_PARTIAL},
+    {RIL_UNSOL_ON_SS, radio_1_5::onSupplementaryServiceIndicationInd, WAKE_PARTIAL},
+    {RIL_UNSOL_STK_CC_ALPHA_NOTIFY, radio_1_5::stkCallControlAlphaNotifyInd, WAKE_PARTIAL},
+    {RIL_UNSOL_LCEDATA_RECV, radio_1_5::lceDataInd, WAKE_PARTIAL},
+    {RIL_UNSOL_PCO_DATA, radio_1_5::pcoDataInd, WAKE_PARTIAL},
+    {RIL_UNSOL_MODEM_RESTART, radio_1_5::modemResetInd, WAKE_PARTIAL},
+    {RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION, radio_1_5::carrierInfoForImsiEncryption, WAKE_PARTIAL},
+    {RIL_UNSOL_NETWORK_SCAN_RESULT, radio_1_5::networkScanResultInd, WAKE_PARTIAL},
diff --git a/guest/hals/rild/rild_cuttlefish.c b/guest/hals/rild/rild_cuttlefish.c
index c2efe44..cfd74fa 100644
--- a/guest/hals/rild/rild_cuttlefish.c
+++ b/guest/hals/rild/rild_cuttlefish.c
@@ -207,6 +207,11 @@
     rilArgv[0] = argv[0];
 
     funcs = rilInit(&s_rilEnv, argc, rilArgv);
+    if (funcs == NULL) {
+        RLOGE("RIL_Init rilInit failed.\n");
+        exit(EXIT_FAILURE);
+    }
+
     RLOGD("RIL_Init rilInit completed");
 
     RLOGD("RIL_Init callback versions = %d", funcs->version);
diff --git a/guest/hals/sensors/Android.mk b/guest/hals/sensors/Android.mk
deleted file mode 100644
index e9a1a1a..0000000
--- a/guest/hals/sensors/Android.mk
+++ /dev/null
@@ -1,63 +0,0 @@
-# Copyright (C) 2017 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH := $(call my-dir)
-
-# HAL module implemenation stored in
-# hw/<SENSORS_HARDWARE_MODULE_ID>.<ro.hardware>.so
-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_MULTILIB := first
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SHARED_LIBRARIES := \
-    $(VSOC_STLPORT_LIBS) \
-    libcuttlefish_fs \
-    cuttlefish_auto_resources \
-    liblog \
-    libcutils
-
-LOCAL_HEADER_LIBRARIES := \
-    libhardware_headers
-
-LOCAL_SRC_FILES := \
-    sensors.cpp \
-    sensors_hal.cpp \
-    vsoc_sensors.cpp \
-    vsoc_sensors_message.cpp
-
-LOCAL_CFLAGS := -DLOG_TAG=\"VSoC-Sensors\" \
-    $(VSOC_VERSION_CFLAGS) \
-    -std=c++17 \
-    -Werror -Wall -Wno-missing-field-initializers -Wno-unused-parameter
-
-LOCAL_C_INCLUDES := \
-    $(VSOC_STLPORT_INCLUDES) \
-    device/google/cuttlefish_common \
-    system/extras
-
-LOCAL_STATIC_LIBRARIES := \
-    libcutils \
-    libcuttlefish_remoter_framework \
-    $(VSOC_STLPORT_STATIC_LIBS)
-
-LOCAL_MODULE := sensors.cutf
-LOCAL_VENDOR_MODULE := true
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/guest/hals/sensors/sensors.cpp b/guest/hals/sensors/sensors.cpp
deleted file mode 100644
index 951461d..0000000
--- a/guest/hals/sensors/sensors.cpp
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "guest/hals/sensors/vsoc_sensors.h"
-
-#include <limits>
-
-#include "guest/hals/sensors/sensors.h"
-
-namespace cvd {
-namespace {
-const cvd::time::Milliseconds kDefaultSamplingRate(200);
-
-timespec infinity() {
-  timespec ts;
-  ts.tv_sec = std::numeric_limits<time_t>::max();
-  ts.tv_nsec = 0;
-  return ts;
-}
-}  // namespace
-
-const cvd::time::MonotonicTimePoint SensorState::kInfinity =
-    cvd::time::MonotonicTimePoint(infinity());
-
-SensorState::SensorState(SensorInfo info)
-    : enabled_(false),
-      event_(),
-      deadline_(kInfinity),
-      sampling_period_(kDefaultSamplingRate) {
-  event_.sensor = info.handle;
-  event_.type = info.type;
-}
-
-SensorInfo::SensorInfo(const char* name, const char* vendor, int version,
-                       int handle, int type, float max_range, float resolution,
-                       float power, int32_t min_delay,
-                       uint32_t fifo_reserved_event_count,
-                       uint32_t fifo_max_event_count, const char* string_type,
-                       const char* required_permission, int32_t max_delay,
-                       uint32_t reporting_mode) {
-  this->name = name;
-  this->vendor = vendor;
-  this->version = version;
-  this->handle = handle;
-  this->type = type;
-  this->maxRange = max_range;
-  this->resolution = resolution;
-  this->power = power;
-  this->minDelay = min_delay;
-  this->fifoReservedEventCount = fifo_reserved_event_count;
-  this->fifoMaxEventCount = fifo_max_event_count;
-  this->stringType = string_type;
-  this->requiredPermission = required_permission;
-  this->maxDelay = max_delay;
-  this->flags = reporting_mode;
-}
-
-namespace sc = sensors_constants;
-
-SensorInfo AccelerometerSensor() {
-  uint32_t flags = sc::kAccelerometerReportingMode |
-      (sc::kAccelerometerIsWakeup ? SENSOR_FLAG_WAKE_UP : 0);
-
-  return SensorInfo(sc::kAccelerometerName, sc::kVendor, sc::kVersion,
-                    sc::kAccelerometerHandle, SENSOR_TYPE_ACCELEROMETER,
-                    sc::kAccelerometerMaxRange, sc::kAccelerometerResolution,
-                    sc::kAccelerometerPower, sc::kAccelerometerMinDelay,
-                    sc::kFifoReservedEventCount, sc::kFifoMaxEventCount,
-                    sc::kAccelerometerStringType, sc::kRequiredPermission,
-                    sc::kMaxDelay, flags);
-}
-
-SensorInfo GyroscopeSensor() {
-  uint32_t flags = sc::kGyroscopeReportingMode |
-      (sc::kGyroscopeIsWakeup ? SENSOR_FLAG_WAKE_UP : 0);
-
-  return SensorInfo(
-      sc::kGyroscopeName, sc::kVendor, sc::kVersion, sc::kGyroscopeHandle,
-      SENSOR_TYPE_GYROSCOPE, sc::kGyroscopeMaxRange, sc::kGyroscopeResolution,
-      sc::kGyroscopePower, sc::kGyroscopeMinDelay, sc::kFifoReservedEventCount,
-      sc::kFifoMaxEventCount, sc::kGyroscopeStringType, sc::kRequiredPermission,
-      sc::kMaxDelay, flags);
-}
-
-SensorInfo LightSensor() {
-  uint32_t flags = sc::kLightReportingMode |
-      (sc::kLightIsWakeup ? SENSOR_FLAG_WAKE_UP : 0);
-
-  return SensorInfo(sc::kLightName, sc::kVendor, sc::kVersion, sc::kLightHandle,
-                    SENSOR_TYPE_LIGHT, sc::kLightMaxRange, sc::kLightResolution,
-                    sc::kLightPower, sc::kLightMinDelay,
-                    sc::kFifoReservedEventCount, sc::kFifoMaxEventCount,
-                    sc::kLightStringType, sc::kRequiredPermission,
-                    sc::kMaxDelay, flags);
-}
-
-SensorInfo MagneticFieldSensor() {
-  uint32_t flags = sc::kMagneticFieldReportingMode |
-      (sc::kMagneticFieldIsWakeup ? SENSOR_FLAG_WAKE_UP : 0);
-
-  return SensorInfo(sc::kMagneticFieldName, sc::kVendor, sc::kVersion,
-                    sc::kMagneticFieldHandle, SENSOR_TYPE_MAGNETIC_FIELD,
-                    sc::kMagneticFieldMaxRange, sc::kMagneticFieldResolution,
-                    sc::kMagneticFieldPower, sc::kMagneticFieldMinDelay,
-                    sc::kFifoReservedEventCount, sc::kFifoMaxEventCount,
-                    sc::kMagneticFieldStringType, sc::kRequiredPermission,
-                    sc::kMaxDelay, flags);
-}
-
-SensorInfo PressureSensor() {
-  uint32_t flags = sc::kPressureReportingMode |
-      (sc::kPressureIsWakeup ? SENSOR_FLAG_WAKE_UP : 0);
-
-  return SensorInfo(
-      sc::kPressureName, sc::kVendor, sc::kVersion, sc::kPressureHandle,
-      SENSOR_TYPE_PRESSURE, sc::kPressureMaxRange, sc::kPressureResolution,
-      sc::kPressurePower, sc::kPressureMinDelay, sc::kFifoReservedEventCount,
-      sc::kFifoMaxEventCount, sc::kPressureStringType, sc::kRequiredPermission,
-      sc::kMaxDelay, flags);
-}
-
-SensorInfo ProximitySensor() {
-  uint32_t flags = sc::kProximityReportingMode |
-      (sc::kProximityIsWakeup ? SENSOR_FLAG_WAKE_UP : 0);
-
-  return SensorInfo(
-      sc::kProximityName, sc::kVendor, sc::kVersion, sc::kProximityHandle,
-      SENSOR_TYPE_PROXIMITY, sc::kProximityMaxRange, sc::kProximityResolution,
-      sc::kProximityPower, sc::kProximityMinDelay, sc::kFifoReservedEventCount,
-      sc::kFifoMaxEventCount, sc::kProximityStringType, sc::kRequiredPermission,
-      sc::kMaxDelay, flags);
-}
-
-SensorInfo AmbientTempSensor() {
-  uint32_t flags = sc::kAmbientTempReportingMode |
-      (sc::kAmbientTempIsWakeup ? SENSOR_FLAG_WAKE_UP : 0);
-
-  return SensorInfo(sc::kAmbientTempName, sc::kVendor, sc::kVersion,
-                    sc::kAmbientTempHandle, SENSOR_TYPE_AMBIENT_TEMPERATURE,
-                    sc::kAmbientTempMaxRange, sc::kAmbientTempResolution,
-                    sc::kAmbientTempPower, sc::kAmbientTempMinDelay,
-                    sc::kFifoReservedEventCount, sc::kFifoMaxEventCount,
-                    sc::kAmbientTempStringType, sc::kRequiredPermission,
-                    sc::kMaxDelay, flags);
-}
-
-SensorInfo DeviceTempSensor() {
-  uint32_t flags = sc::kDeviceTempReportingMode |
-      (sc::kDeviceTempIsWakeup ? SENSOR_FLAG_WAKE_UP : 0);
-
-  return SensorInfo(sc::kDeviceTempName, sc::kVendor, sc::kVersion,
-                    sc::kDeviceTempHandle, SENSOR_TYPE_TEMPERATURE,
-                    sc::kDeviceTempMaxRange, sc::kDeviceTempResolution,
-                    sc::kDeviceTempPower, sc::kDeviceTempMinDelay,
-                    sc::kFifoReservedEventCount, sc::kFifoMaxEventCount,
-                    sc::kDeviceTempStringType, sc::kRequiredPermission,
-                    sc::kMaxDelay, flags);
-}
-
-SensorInfo RelativeHumiditySensor() {
-  uint32_t flags = sc::kRelativeHumidityReportingMode |
-      (sc::kRelativeHumidityIsWakeup ? SENSOR_FLAG_WAKE_UP : 0);
-
-  return SensorInfo(sc::kRelativeHumidityName, sc::kVendor, sc::kVersion,
-                    sc::kRelativeHumidityHandle, SENSOR_TYPE_RELATIVE_HUMIDITY,
-                    sc::kRelativeHumidityMaxRange,
-                    sc::kRelativeHumidityResolution, sc::kRelativeHumidityPower,
-                    sc::kRelativeHumidityMinDelay, sc::kFifoReservedEventCount,
-                    sc::kFifoMaxEventCount, sc::kRelativeHumidityStringType,
-                    sc::kRequiredPermission, sc::kMaxDelay,
-                    flags);
-}
-
-}  // namespace cvd
diff --git a/guest/hals/sensors/sensors.h b/guest/hals/sensors/sensors.h
deleted file mode 100644
index 9543e4e..0000000
--- a/guest/hals/sensors/sensors.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#pragma once
-
-#include "common/libs/time/monotonic_time.h"
-#include "guest/hals/sensors/sensors_hal.h"
-
-namespace cvd {
-
-// Stores static information about a sensor.
-// Must be completely compatible with sensor_t (i.e. no additional
-// information or virtual functions)
-// so we can cast a list of SensorInfo to a list of sensor_t.
-class SensorInfo : public sensor_t {
- public:
-  // Dummy, empty set of sensor information (value-initialized).
-  SensorInfo() : sensor_t() {}
-
- private:
-  SensorInfo(const char* name, const char* vendor, int version, int handle,
-             int type, float max_range, float resolution, float power,
-             int32_t min_delay, uint32_t fifo_reserved_event_count,
-             uint32_t fifo_max_event_count, const char* string_type,
-             const char* required_permission, int32_t max_delay,
-             uint32_t reporting_mode);
-
-  friend SensorInfo AccelerometerSensor();
-  friend SensorInfo GyroscopeSensor();
-  friend SensorInfo LightSensor();
-  friend SensorInfo MagneticFieldSensor();
-  friend SensorInfo PressureSensor();
-  friend SensorInfo ProximitySensor();
-  friend SensorInfo AmbientTempSensor();
-  friend SensorInfo DeviceTempSensor();
-  friend SensorInfo RelativeHumiditySensor();
-};
-
-SensorInfo AccelerometerSensor();
-SensorInfo GyroscopeSensor();
-SensorInfo LightSensor();
-SensorInfo MagneticFieldSensor();
-SensorInfo PressureSensor();
-SensorInfo ProximitySensor();
-SensorInfo AmbientTempSensor();
-SensorInfo DeviceTempSensor();
-SensorInfo RelativeHumiditySensor();
-
-// Stores the current state of a sensor.
-class SensorState {
- public:
-  SensorState(SensorInfo info);
-  virtual ~SensorState() {}
-
-  // What this sensor is activated or not.
-  bool enabled_;
-  // Buffer of incoming events.
-  sensors_event_t event_;
-  // The deadline at which we should report the next sensor event
-  // to the framework in order to meet our frequency constraints.
-  // For disabled sensors, should be 'infinity'.
-  cvd::time::MonotonicTimePoint deadline_;
-  // Delay time between consecutive sensor samples, in ns.
-  cvd::time::Nanoseconds sampling_period_;
-
-  // Time 'infinity'.
-  static const cvd::time::MonotonicTimePoint kInfinity;
-};
-
-namespace sensors_constants {
-// TODO: Verify these numbers.
-// Vendor of the hardware part.
-const char kVendor[] = "Google";
-// Version of the hardware part + driver. The value of this field
-// must increase when the driver is updated in a way that
-// changes the output of the sensor.
-const int kVersion = VSOC_SENSOR_DEVICE_VERSION;
-// Number of events reserved for this sensor in batch mode FIFO.
-// If it has its own FIFO, the size of that FIFO.
-const uint32_t kFifoReservedEventCount = 15;
-// Maximum events that can be batched. In a shared FIFO,
-// the size of that FIFO.
-const uint32_t kFifoMaxEventCount = 15;
-// Permission required to use this sensor, or empty string
-// if none required.
-const char kRequiredPermission[] = "";
-// Defined only for continuous mode and on-change sensors.
-// Delay corresponding with lowest frequency supported.
-const int32_t kMaxDelay = 5000000;
-
-// Name of this sensor. Must be unique.
-const char kAccelerometerName[] = "acceleration";
-const char kGyroscopeName[] = "gyroscope";
-const char kLightName[] = "light";
-const char kMagneticFieldName[] = "magnetic_field";
-const char kPressureName[] = "pressure";
-const char kProximityName[] = "proximity";
-const char kAmbientTempName[] = "ambient_temp";
-const char kDeviceTempName[] = "device_temp";
-const char kRelativeHumidityName[] = "relative_humidity";
-
-// Handle that identifies the sensor. This is used as an array index,
-// so must be unique in the range [0, # sensors)
-
-const int kAccelerometerHandle = 0;
-const int kGyroscopeHandle = 1;
-const int kLightHandle = 2;
-const int kMagneticFieldHandle = 3;
-const int kPressureHandle = 4;
-const int kProximityHandle = 5;
-const int kAmbientTempHandle = 6;
-const int kDeviceTempHandle = 7;
-const int kRelativeHumidityHandle = 8;
-
-// For continuous sensors, minimum sample period (in microseconds).
-// On-Change (0), One-shot (-1), and special (0).
-const int32_t kAccelerometerMinDelay = 4444;
-const int32_t kGyroscopeMinDelay = 4444;
-const int32_t kLightMinDelay = 0;
-const int32_t kMagneticFieldMinDelay = 14285;
-const int32_t kPressureMinDelay = 28571;
-const int32_t kProximityMinDelay = 0;
-const int32_t kAmbientTempMinDelay = 4444;
-const int32_t kDeviceTempMinDelay = 4444;
-const int32_t kRelativeHumidityMinDelay = 4444;
-
-// Maximum range of this sensor's value in SI units.
-const float kAccelerometerMaxRange = 39.226593f;
-const float kGyroscopeMaxRange = 8.726639f;
-const float kLightMaxRange = 10000.0f;
-const float kMagneticFieldMaxRange = 4911.9995f;
-const float kPressureMaxRange = 1100.0f;
-const float kProximityMaxRange = 5.0f;
-const float kAmbientTempMaxRange = 80.0f;
-const float kDeviceTempMaxRange = 80.0f;
-const float kRelativeHumidityMaxRange = 100;
-
-// Smallest difference between two values reported by this sensor.
-const float kAccelerometerResolution = 0.45f;
-const float kGyroscopeResolution = 10.0f;
-const float kLightResolution = 10.0f;
-const float kMagneticFieldResolution = 1.0f;
-const float kPressureResolution = 1.0f;
-const float kProximityResolution = 1.0f;
-const float kAmbientTempResolution = 1.0f;
-const float kDeviceTempResolution = 1.0f;
-const float kRelativeHumidityResolution = 1.0f;
-
-// Rough estimate of this sensor's power consumption in mA.
-const float kAccelerometerPower = 0.45f;
-const float kGyroscopePower = 3.6f;
-const float kLightPower = 0.175f;
-const float kMagneticFieldPower = 5.0f;
-const float kPressurePower = 0.004f;
-const float kProximityPower = 12.675f;
-const float kAmbientTempPower = 1.0f;
-const float kDeviceTempPower = 1.0f;
-const float kRelativeHumidityPower = 1.0f;
-
-// Type of this sensor, represented as a string.
-
-const char kAccelerometerStringType[] = SENSOR_STRING_TYPE_ACCELEROMETER;
-const char kGyroscopeStringType[] = SENSOR_STRING_TYPE_GYROSCOPE;
-const char kLightStringType[] = SENSOR_STRING_TYPE_LIGHT;
-const char kMagneticFieldStringType[] = SENSOR_STRING_TYPE_MAGNETIC_FIELD;
-const char kPressureStringType[] = SENSOR_STRING_TYPE_PRESSURE;
-const char kProximityStringType[] = SENSOR_STRING_TYPE_PROXIMITY;
-const char kAmbientTempStringType[] = SENSOR_STRING_TYPE_AMBIENT_TEMPERATURE;
-const char kDeviceTempStringType[] = SENSOR_STRING_TYPE_TEMPERATURE;
-const char kRelativeHumidityStringType[] = SENSOR_STRING_TYPE_RELATIVE_HUMIDITY;
-
-const uint32_t kAccelerometerReportingMode = SENSOR_FLAG_CONTINUOUS_MODE;
-const uint32_t kGyroscopeReportingMode = SENSOR_FLAG_CONTINUOUS_MODE;
-const uint32_t kLightReportingMode = SENSOR_FLAG_ON_CHANGE_MODE;
-const uint32_t kMagneticFieldReportingMode = SENSOR_FLAG_CONTINUOUS_MODE;
-const uint32_t kPressureReportingMode = SENSOR_FLAG_CONTINUOUS_MODE;
-const uint32_t kProximityReportingMode = SENSOR_FLAG_ON_CHANGE_MODE;
-const uint32_t kAmbientTempReportingMode = SENSOR_FLAG_ON_CHANGE_MODE;
-const uint32_t kDeviceTempReportingMode = SENSOR_FLAG_ON_CHANGE_MODE;
-const uint32_t kRelativeHumidityReportingMode = SENSOR_FLAG_ON_CHANGE_MODE;
-
-const bool kAccelerometerIsWakeup = false;
-const bool kGyroscopeIsWakeup = false;
-const bool kLightIsWakeup = false;
-const bool kMagneticFieldIsWakeup = false;
-const bool kPressureIsWakeup = false;
-const bool kProximityIsWakeup = true;
-const bool kAmbientTempIsWakeup = false;
-const bool kDeviceTempIsWakeup = false;
-const bool kRelativeHumidityIsWakeup = false;
-
-}  // namespace sensors_constants
-}  // namespace cvd
-
diff --git a/guest/hals/sensors/sensors_hal.cpp b/guest/hals/sensors/sensors_hal.cpp
deleted file mode 100644
index c1e2284..0000000
--- a/guest/hals/sensors/sensors_hal.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "guest/hals/sensors/sensors_hal.h"
-
-#include "guest/hals/sensors/vsoc_sensors.h"
-
-static hw_module_methods_t hal_module_methods = {
-  .open = cvd::GceSensors::Open,
-};
-
-sensors_module_t HAL_MODULE_INFO_SYM = {
-  .common = {
-    .tag = HARDWARE_MODULE_TAG,
-    .module_api_version = 1,
-    .hal_api_version = 0,
-    .id = SENSORS_HARDWARE_MODULE_ID,
-    .name = "Android-GCE SENSORS Module",
-    .author = "Google",
-    .methods = & hal_module_methods,
-  },
-  .get_sensors_list = cvd::GceSensors::GetSensorsList,
-  .set_operation_mode = cvd::GceSensors::SetOperationMode,
-};
diff --git a/guest/hals/sensors/sensors_hal.h b/guest/hals/sensors/sensors_hal.h
deleted file mode 100644
index 263bf09..0000000
--- a/guest/hals/sensors/sensors_hal.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#pragma once
-
-#include <log/log.h>
-#include <hardware/hardware.h>
-#include <hardware/sensors.h>
-
-#define VSOC_SENSOR_DEVICE_VERSION SENSORS_DEVICE_API_VERSION_1_4
-
-#define SENSORS_DEBUG 0
-
-#if SENSORS_DEBUG
-#  define D(...) ALOGD(__VA_ARGS__)
-#else
-#  define D(...) ((void)0)
-#endif
-
diff --git a/guest/hals/sensors/vsoc_sensors.cpp b/guest/hals/sensors/vsoc_sensors.cpp
deleted file mode 100644
index c9388b0..0000000
--- a/guest/hals/sensors/vsoc_sensors.cpp
+++ /dev/null
@@ -1,509 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <cstdint>
-
-#include <cutils/properties.h>
-#include <cutils/sockets.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/system_properties.h>
-#include <unistd.h>
-
-#include <algorithm>
-
-#include "common/libs/fs/shared_select.h"
-#include "common/libs/threads/thunkers.h"
-#include "guest/hals/sensors/sensors_hal.h"
-#include "guest/hals/sensors/vsoc_sensors.h"
-#include "guest/hals/sensors/vsoc_sensors_message.h"
-#include "guest/libs/remoter/remoter_framework_pkt.h"
-
-using cvd::LockGuard;
-using cvd::Mutex;
-using cvd::time::Milliseconds;
-using cvd::time::MonotonicTimePoint;
-using cvd::time::Nanoseconds;
-
-namespace cvd {
-
-int GceSensors::total_sensor_count_ = -1;
-SensorInfo* GceSensors::sensor_infos_ = NULL;
-const int GceSensors::kInjectedEventWaitPeriods = 3;
-const Nanoseconds GceSensors::kInjectedEventWaitTime =
-    Nanoseconds(Milliseconds(20));
-
-GceSensors::GceSensors()
-  : sensors_poll_device_1(), deadline_change_(&sensor_state_lock_) {
-  if (total_sensor_count_ == -1) {
-    RegisterSensors();
-  }
-
-  // Create a pair of FDs that would be used to control the
-  // receiver thread.
-  if (control_sender_socket_->IsOpen() || control_receiver_socket_->IsOpen()) {
-    ALOGE("%s: Receiver control FDs are opened", __FUNCTION__);
-  }
-  if (!cvd::SharedFD::Pipe(&control_receiver_socket_,
-                           &control_sender_socket_)) {
-    ALOGE("%s: Unable to create thread control FDs: %d -> %s", __FUNCTION__,
-          errno, strerror(errno));
-  }
-
-  // Create the correct number of holding buffers for this client.
-  sensor_states_.resize(total_sensor_count_);
-  int i;
-  for (i = 0; i < total_sensor_count_; i++) {
-    sensor_states_[i] = new SensorState(sensor_infos_[i]);
-  }
-}
-
-GceSensors::~GceSensors() {
-  int i;
-  for (i = 0; i < total_sensor_count_; i++) {
-    delete sensor_states_[i];
-  }
-}
-
-int GceSensors::GetSensorsList(struct sensors_module_t* /*module*/,
-                               struct sensor_t const** list) {
-  *list = sensor_infos_;
-  return total_sensor_count_;
-}
-
-int GceSensors::SetOperationMode(unsigned int /* is_loopback_mode */) {
-  return -EINVAL;
-}
-
-int GceSensors::Open(const struct hw_module_t* module, const char* name,
-                     struct hw_device_t** device) {
-  int status = -EINVAL;
-
-  if (!strcmp(name, SENSORS_HARDWARE_POLL)) {
-    // Create a new GceSensors object and set all the fields/functions
-    // to their default values.
-    GceSensors* rval = new GceSensors;
-
-    rval->common.tag = HARDWARE_DEVICE_TAG;
-    rval->common.version = VSOC_SENSOR_DEVICE_VERSION;
-    rval->common.module = (struct hw_module_t*)module;
-    rval->common.close = cvd::thunk<hw_device_t, &GceSensors::Close>;
-
-    rval->poll = cvd::thunk<sensors_poll_device_t, &GceSensors::Poll>;
-    rval->activate = cvd::thunk<sensors_poll_device_t, &GceSensors::Activate>;
-    rval->setDelay = cvd::thunk<sensors_poll_device_t, &GceSensors::SetDelay>;
-
-    rval->batch = cvd::thunk<sensors_poll_device_1, &GceSensors::Batch>;
-    rval->flush = cvd::thunk<sensors_poll_device_1, &GceSensors::Flush>;
-    rval->inject_sensor_data =
-        cvd::thunk<sensors_poll_device_1, &GceSensors::InjectSensorData>;
-
-    // Spawn a thread to listen for incoming data from the remoter.
-    int err = pthread_create(
-        &rval->receiver_thread_, NULL,
-        cvd::thunk<void, &GceSensors::Receiver>,
-        rval);
-    if (err) {
-      ALOGE("GceSensors::%s: Unable to start receiver thread (%s)",
-            __FUNCTION__, strerror(err));
-    }
-
-    *device = &rval->common;
-    status = 0;
-  }
-  return status;
-}
-
-int GceSensors::Close() {
-  // Make certain the receiver thread wakes up.
-  SensorControlMessage msg;
-  msg.message_type = THREAD_STOP;
-  SendControlMessage(msg);
-  pthread_join(receiver_thread_, NULL);
-  delete this;
-  return 0;
-}
-
-int GceSensors::Activate(int handle, int enabled) {
-  if (handle < 0 || handle >= total_sensor_count_) {
-    ALOGE("GceSensors::%s: Bad handle %d", __FUNCTION__, handle);
-    return -1;
-  }
-
-  {
-    LockGuard<Mutex> guard(sensor_state_lock_);
-    // Update the report deadline, if changed.
-    if (enabled && !sensor_states_[handle]->enabled_) {
-      sensor_states_[handle]->deadline_ =
-          MonotonicTimePoint::Now() + sensor_states_[handle]->sampling_period_;
-    } else if (!enabled && sensor_states_[handle]->enabled_) {
-      sensor_states_[handle]->deadline_ = SensorState::kInfinity;
-    }
-    sensor_states_[handle]->enabled_ = enabled;
-    UpdateDeadline();
-  }
-
-  D("sensor_activate(): handle %d, enabled %d", handle, enabled);
-  if (!UpdateRemoterState(handle)) {
-    ALOGE("Failed to notify remoter about new sensor enable/disable.");
-  }
-  return 0;
-}
-
-int GceSensors::SetDelay(int handle, int64_t sampling_period_ns) {
-  if (handle < 0 || handle >= total_sensor_count_) {
-    ALOGE("GceSensors::%s: Bad handle %d", __FUNCTION__, handle);
-    return -1;
-  }
-  int64_t min_delay_ns = sensor_infos_[handle].minDelay * 1000;
-  if (sampling_period_ns < min_delay_ns) {
-    sampling_period_ns = min_delay_ns;
-  }
-
-  {
-    LockGuard<Mutex> guard(sensor_state_lock_);
-    sensor_states_[handle]->deadline_ -=
-        sensor_states_[handle]->sampling_period_;
-    sensor_states_[handle]->sampling_period_ = Nanoseconds(sampling_period_ns);
-    sensor_states_[handle]->deadline_ +=
-        sensor_states_[handle]->sampling_period_;
-    // If our sampling period has decreased, our deadline
-    // could have already passed. If so, report immediately, but not in the
-    // past.
-    MonotonicTimePoint now = MonotonicTimePoint::Now();
-    if (sensor_states_[handle]->deadline_ < now) {
-      sensor_states_[handle]->deadline_ = now;
-    }
-    UpdateDeadline();
-  }
-
-  D("sensor_set_delay(): handle %d, delay (ms) %" PRId64, handle,
-    Milliseconds(Nanoseconds(sampling_period_ns)).count());
-  if (!UpdateRemoterState(handle)) {
-    ALOGE("Failed to notify remoter about new sensor delay.");
-  }
-  return 0;
-}
-
-int GceSensors::Poll(sensors_event_t* data, int count_unsafe) {
-  if (count_unsafe <= 0) {
-    ALOGE("Framework polled with bad count (%d)", count_unsafe);
-    return -1;
-  }
-  size_t count = size_t(count_unsafe);
-
-  // Poll will block until 1 of 2 things happens:
-  //    1. The next deadline for some active sensor
-  //        occurs.
-  //    2. The next deadline changes (either because
-  //        a sensor was activated/deactivated or its
-  //        delay changed).
-  // In both cases, any sensors whose report deadlines
-  // have passed will report their data (or mock data),
-  // and poll will either return (if at least one deadline
-  // has passed), or repeat by blocking until the next deadline.
-  LockGuard<Mutex> guard(sensor_state_lock_);
-  current_deadline_ = UpdateDeadline();
-  // Sleep until we have something to report
-  while (!fifo_.size()) {
-    deadline_change_.WaitUntil(current_deadline_);
-    current_deadline_ = UpdateDeadline();
-  }
-  // Copy the events from the buffer
-  int num_copied = std::min(fifo_.size(), count);
-  FifoType::iterator first_uncopied = fifo_.begin() + num_copied;
-  std::copy(fifo_.begin(), first_uncopied, data);
-  fifo_.erase(fifo_.begin(), first_uncopied);
-  D("Reported %d sensor events. First: %d %f %f %f", num_copied, data->sensor,
-    data->data[0], data->data[1], data->data[2]);
-  return num_copied;
-}
-
-
-void *GceSensors::Receiver() {
-  // Initialize the server.
-  sensor_listener_socket_ = cvd::SharedFD::SocketSeqPacketServer(
-      gce_sensors_message::kSensorsHALSocketName, 0777);
-  if (!sensor_listener_socket_->IsOpen()) {
-    ALOGE("GceSensors::%s: Could not listen for sensor connections. (%s).",
-          __FUNCTION__, sensor_listener_socket_->StrError());
-    return NULL;
-  }
-  D("GceSensors::%s: Listening for sensor connections at %s", __FUNCTION__,
-    gce_sensors_message::kSensorsHALSocketName);
-  // Announce that we are ready for the remoter to connect.
-  if (!NotifyRemoter()) {
-    ALOGI("Failed to notify remoter that HAL is ready.");
-  } else {
-    ALOGI("Notified remoter that HAL is ready.");
-  }
-
-  typedef std::vector<cvd::SharedFD> FDVec;
-  FDVec connected;
-  // Listen for incoming sensor data and control messages
-  // from the HAL.
-  while (true) {
-    cvd::SharedFDSet fds;
-    for (FDVec::iterator it = connected.begin(); it != connected.end(); ++it) {
-      fds.Set(*it);
-    }
-    fds.Set(control_receiver_socket_);
-    // fds.Set(sensor_listener_socket_);
-    int res = cvd::Select(&fds, NULL, NULL, NULL);
-    if (res == -1) {
-      ALOGE("%s: select returned %d and failed %d -> %s", __FUNCTION__, res,
-            errno, strerror(errno));
-      break;
-    } else if (res == 0) {
-      ALOGE("%s: select timed out", __FUNCTION__);
-      break;
-    } else if (fds.IsSet(sensor_listener_socket_)) {
-      connected.push_back(cvd::SharedFD::Accept(*sensor_listener_socket_));
-      ALOGI("GceSensors::%s: new client connected", __FUNCTION__);
-    } else if (fds.IsSet(control_receiver_socket_)) {
-      // We received a control message.
-      SensorControlMessage msg;
-      int res =
-          control_receiver_socket_->Read(&msg, sizeof(SensorControlMessage));
-      if (res == -1) {
-        ALOGE("GceSensors::%s: Failed to receive control message.",
-              __FUNCTION__);
-      } else if (res == 0) {
-        ALOGE("GceSensors::%s: Control connection closed.", __FUNCTION__);
-      }
-      if (msg.message_type == SENSOR_STATE_UPDATE) {
-        // Forward the update to the remoter.
-        remoter_request_packet packet;
-        remoter_request_packet_init(&packet, kRemoterSensorState, 0);
-        {
-          LockGuard<Mutex> guard(sensor_state_lock_);
-          packet.params.sensor_state_params.type =
-              sensor_infos_[msg.sensor_handle].type;
-          packet.params.sensor_state_params.enabled =
-              sensor_states_[msg.sensor_handle]->enabled_;
-          packet.params.sensor_state_params.delay_ns =
-              sensor_states_[msg.sensor_handle]->sampling_period_.count();
-          packet.params.sensor_state_params.handle = msg.sensor_handle;
-        }
-        struct msghdr msg;
-        iovec msg_iov[1];
-        msg_iov[0].iov_base = &packet;
-        msg_iov[0].iov_len = sizeof(remoter_request_packet);
-        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;
-
-        for (FDVec::iterator it = connected.begin(); it != connected.end();
-             ++it) {
-          cvd::SharedFD &fd = *it;
-          if (fd->SendMsg(&msg, 0) == -1) {
-            ALOGE("GceSensors::%s. Could not send sensor state (%s).",
-                  __FUNCTION__, fd->StrError());
-          }
-        }
-      }
-      if (msg.message_type == THREAD_STOP) {
-        D("Received terminate control message.");
-        return NULL;
-      }
-    } else {
-      for (FDVec::iterator it = connected.begin(); it != connected.end();
-           ++it) {
-        cvd::SharedFD &fd = *it;
-        if (fds.IsSet(fd)) {
-          // We received a sensor update from remoter.
-          sensors_event_t event;
-          struct msghdr msg;
-          iovec msg_iov[1];
-          msg_iov[0].iov_base = &event;
-          msg_iov[0].iov_len = sizeof(event);
-          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;
-          int res = fd->RecvMsg(&msg, 0);
-          if (res <= 0) {
-            if (res == 0) {
-              ALOGE("GceSensors::%s: Sensors HAL connection closed.",
-                    __FUNCTION__);
-            } else {
-              ALOGE("GceSensors::%s: Failed to receive sensor message",
-                    __FUNCTION__);
-            }
-            connected.erase(std::find(connected.begin(), connected.end(), fd));
-            break;
-          }
-
-          // We received an event from the remoter.
-          if (event.sensor < 0 || event.sensor >= total_sensor_count_) {
-            ALOGE("Remoter sent us an invalid sensor event! (handle %d)",
-                  event.sensor);
-            connected.erase(std::find(connected.begin(), connected.end(), fd));
-            break;
-          }
-
-          D("Received sensor event: %d %f %f %f", event.sensor, event.data[0],
-            event.data[1], event.data[2]);
-
-          {
-            LockGuard<Mutex> guard(sensor_state_lock_);
-            // Increase the delay so that the HAL knows
-            // it shouldn't report on its own for a while.
-            SensorState *holding_buffer = sensor_states_[event.sensor];
-            int wait_periods =
-                std::max(kInjectedEventWaitPeriods,
-                         (int)(kInjectedEventWaitTime.count() /
-                               holding_buffer->sampling_period_.count()));
-            holding_buffer->deadline_ =
-                MonotonicTimePoint::Now() +
-                holding_buffer->sampling_period_ * wait_periods;
-            holding_buffer->event_.data[0] = event.data[0];
-            holding_buffer->event_.data[1] = event.data[1];
-            holding_buffer->event_.data[2] = event.data[2];
-            // Signal the HAL to report the newly arrived event.
-            fifo_.push_back(event);
-            deadline_change_.NotifyOne();
-          }
-        }
-      }
-    }
-  }
-  return NULL;
-}
-
-bool GceSensors::NotifyRemoter() {
-  remoter_request_packet packet;
-  remoter_request_packet_init(&packet, kRemoterHALReady, 0);
-  packet.send_response = 0;
-  strncpy(packet.params.hal_ready_params.unix_socket,
-          gce_sensors_message::kSensorsHALSocketName,
-          sizeof(packet.params.hal_ready_params.unix_socket));
-  AutoCloseFileDescriptor remoter_socket(remoter_connect());
-  if (remoter_socket.IsError()) {
-    D("GceSensors::%s: Could not connect to remoter to notify ready (%s).",
-      __FUNCTION__, strerror(errno));
-    return false;
-  }
-  int err =
-      remoter_do_single_request_with_socket(remoter_socket, &packet, NULL);
-  if (err == -1) {
-    D("GceSensors::%s: Notify remoter ready: Failed after connect (%s).",
-      __FUNCTION__, strerror(errno));
-    return false;
-  }
-  D("GceSensors::%s: Notify remoter ready Succeeded.", __FUNCTION__);
-  return true;
-}
-
-static bool CompareTimestamps(const sensors_event_t& a,
-                              const sensors_event_t& b) {
-  return a.timestamp < b.timestamp;
-}
-
-MonotonicTimePoint GceSensors::UpdateDeadline() {
-  // Get the minimum of all the current deadlines.
-  MonotonicTimePoint now = MonotonicTimePoint::Now();
-  MonotonicTimePoint min = SensorState::kInfinity;
-  int i = 0;
-  bool sort_fifo = false;
-
-  for (i = 0; i < total_sensor_count_; i++) {
-    SensorState* holding_buffer = sensor_states_[i];
-    // Ignore disabled sensors.
-    if (!holding_buffer->enabled_) {
-      continue;
-    }
-    while (holding_buffer->deadline_ < now) {
-      sensors_event_t data = holding_buffer->event_;
-      data.timestamp = holding_buffer->deadline_.SinceEpoch().count();
-      fifo_.push_back(data);
-      holding_buffer->deadline_ += holding_buffer->sampling_period_;
-      sort_fifo = true;
-    }
-    // Now check if we should update the wake time based on the next event
-    // from this sensor.
-    if (sensor_states_[i]->deadline_ < min) {
-      min = sensor_states_[i]->deadline_;
-    }
-  }
-  // We added one or more sensor readings, so do a sort.
-  // This is likely to be cheaper than a traditional priority queue because
-  // a priority queue would try to keep its state correct for each addition.
-  if (sort_fifo) {
-    std::sort(fifo_.begin(), fifo_.end(), CompareTimestamps);
-  }
-  // If we added events or the deadline is lower notify the thread in Poll().
-  // If the deadline went up, don't do anything.
-  if (fifo_.size() || (min < current_deadline_)) {
-    deadline_change_.NotifyOne();
-  }
-  return min;
-}
-
-bool GceSensors::UpdateRemoterState(int handle) {
-  SensorControlMessage msg;
-  msg.message_type = SENSOR_STATE_UPDATE;
-  msg.sensor_handle = handle;
-  return SendControlMessage(msg);
-}
-
-bool GceSensors::SendControlMessage(SensorControlMessage msg) {
-  if (!control_sender_socket_->IsOpen()) {
-    ALOGE("%s: Can't send control message %d, control socket not open.",
-          __FUNCTION__, msg.message_type);
-    return false;
-  }
-  if (control_sender_socket_->Write(&msg, sizeof(SensorControlMessage)) == -1) {
-    ALOGE("GceSensors::%s. Could not send control message %d (%s).",
-          __FUNCTION__, msg.message_type, control_sender_socket_->StrError());
-    return false;
-  }
-  return true;
-}
-
-int GceSensors::RegisterSensors() {
-  if (total_sensor_count_ != -1) {
-    return -1;
-  }
-  total_sensor_count_ = 9;
-  sensor_infos_ = new SensorInfo[total_sensor_count_];
-  sensor_infos_[sensors_constants::kAccelerometerHandle] =
-      AccelerometerSensor();
-  sensor_infos_[sensors_constants::kGyroscopeHandle] = GyroscopeSensor();
-  sensor_infos_[sensors_constants::kLightHandle] = LightSensor();
-  sensor_infos_[sensors_constants::kMagneticFieldHandle] =
-      MagneticFieldSensor();
-  sensor_infos_[sensors_constants::kPressureHandle] = PressureSensor();
-  sensor_infos_[sensors_constants::kProximityHandle] = ProximitySensor();
-  sensor_infos_[sensors_constants::kAmbientTempHandle] = AmbientTempSensor();
-  sensor_infos_[sensors_constants::kDeviceTempHandle] = DeviceTempSensor();
-  sensor_infos_[sensors_constants::kRelativeHumidityHandle] =
-      RelativeHumiditySensor();
-  int i;
-  for (i = 0; i < total_sensor_count_; i++) {
-    D("Found sensor %s with handle %d", sensor_infos_[i].name,
-      sensor_infos_[i].handle);
-  }
-  return total_sensor_count_;
-}
-
-}  // namespace cvd
diff --git a/guest/hals/sensors/vsoc_sensors.h b/guest/hals/sensors/vsoc_sensors.h
deleted file mode 100644
index c4e9718..0000000
--- a/guest/hals/sensors/vsoc_sensors.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#pragma once
-
-#include <vector>
-
-#include "common/libs/threads/cuttlefish_thread.h"
-#include "common/libs/fs/shared_fd.h"
-#include "guest/hals/sensors/sensors.h"
-#include "guest/hals/sensors/sensors_hal.h"
-
-namespace cvd {
-
-// Used for sending control messages to the receiver thread.
-// The sensor_handle field may be left unused if it is not needed.
-enum ControlMessageType {
-  THREAD_STOP,
-  SENSOR_STATE_UPDATE
-};
-typedef struct {
-  ControlMessageType message_type;
-  uint8_t sensor_handle;
-} SensorControlMessage;
-
-// Last updated to HAL 1.4
-// Version history:
-//   Before jb, jb-mr1 SENSORS_DEVICE_API_VERSION_0_1 (no version in sensors.h)
-//   jb-mr2: SENSORS_DEVICE_API_VERSION_1_0
-//   k: SENSORS_DEVICE_API_VERSION_1_1
-//   l, l-mr1: SENSORS_DEVICE_API_VERSION_1_3
-//   m, n, n-mr1: SENSORS_DEVICE_API_VERSION_1_4
-
-class GceSensors : public sensors_poll_device_1 {
- public:
-  GceSensors();
-  ~GceSensors();
-
-  /**
-   ** SENSOR HAL API FUNCTIONS FOR MODULE
-   **/
-
-  // Gets a list of all supported sensors and stores in list.
-  // Returns the number of supported sensors.
-  static int GetSensorsList(struct sensors_module_t* module,
-    struct sensor_t const** list);
-
-  // Place the module in a specific mode. The following modes are defined
-  //
-  //  0 - Normal operation. Default state of the module.
-  //  1 - Loopback mode. Data is injected for the supported
-  //      sensors by the sensor service in this mode.
-  // @return 0 on success
-  //         -EINVAL if requested mode is not supported
-  //         -EPERM if operation is not allowed
-  static int SetOperationMode(unsigned int mode);
-
-
-  /**
-   ** SENSOR HAL API FUNCTIONS FOR DEVICE
-   **/
-  // Opens the device.
-  static int Open(const struct hw_module_t* module, const char* name,
-    struct hw_device_t** device);
-
-  // Closes the device, closing all sensors.
-  int Close();
-
-  // Activate (or deactivate) the sensor with the given handle.
-  //
-  // One-shot sensors deactivate themselves automatically upon receiving an
-  // event, and they must still accept to be deactivated through a call to
-  // activate(..., enabled=0).
-  // Non-wake-up sensors never prevent the SoC from going into suspend mode;
-  // that is, the HAL shall not hold a partial wake-lock on behalf of
-  // applications.
-  //
-  // If enabled is 1 and the sensor is already activated, this function is a
-  // no-op and succeeds.
-  //
-  // If enabled is 0 and the sensor is already deactivated, this function is a
-  // no-op and succeeds.
-  //
-  // This function returns 0 on success and a negative error number otherwise.
-  int Activate(int handle, int enabled);
-
-  // Sets the delay (in ns) for the sensor with the given handle.
-  // Deprecated as of HAL 1.1
-  // Called after activate()
-  int SetDelay(int handle, int64_t sampling_period_ns);
-
-  // Returns an array of sensor data by filling the data argument.
-  // This function must block until events are available. It will return
-  // the number of events read on success, or a negative number in case of
-  // an error.
-  int Poll(sensors_event_t* data, int count);
-
-  // Sets a sensor’s parameters, including sampling frequency and maximum
-  // report latency. This function can be called while the sensor is
-  // activated, in which case it must not cause any sensor measurements to
-  // be lost: transitioning from one sampling rate to the other cannot cause
-  // lost events, nor can transitioning from a high maximum report latency to
-  // a low maximum report latency.
-  //
-  // Before SENSORS_DEVICE_API_VERSION_1_3, flags included:
-  //   SENSORS_BATCH_DRY_RUN
-  //   SENSORS_BATCH_WAKE_UPON_FIFO_FULL
-  //
-  // After SENSORS_DEVICE_API_VERSION_1_3 see WAKE_UPON_FIFO_FULL
-  // in sensor_t.flags
-  int Batch(int sensor_handle, int flags, int64_t sampling_period_ns,
-            int64_t max_report_latency_ns) {
-    // TODO: Add support for maximum report latency with max_report_latency_ns.
-    return SetDelay(sensor_handle, sampling_period_ns);
-  }
-
-  // Adds a META_DATA_FLUSH_COMPLETE event (sensors_event_meta_data_t)
-  // to the end of the "batch mode" FIFO for the specified sensor and flushes
-  // the FIFO.
-  //
-  // If the FIFO is empty or if the sensor doesn't support batching (FIFO
-  // size zero), it should return SUCCESS along with a trivial
-  // META_DATA_FLUSH_COMPLETE event added to the event stream. This applies to
-  // all sensors other than one-shot sensors.
-  //
-  // If the sensor is a one-shot sensor, flush must return -EINVAL and not
-  // generate any flush complete metadata.
-  //
-  // If the sensor is not active at the time flush() is called, flush() should
-  // return -EINVAL.
-  int Flush(int sensor_handle) {
-    return -EINVAL;
-  }
-
-  // Inject a single sensor sample to be to this device.
-  // data points to the sensor event to be injected
-  // @return 0 on success
-  //  -EPERM if operation is not allowed
-  //  -EINVAL if sensor event cannot be injected
-  int InjectSensorData(const sensors_event_t *data) {
-    return -EINVAL;
-  }
-
- private:
-  typedef std::vector<SensorState*> SensorStateVector;
-  typedef std::vector<sensors_event_t> FifoType;
-  // Total number of sensors supported by this HAL.
-  static int total_sensor_count_;
-  // Vector of static sensor information for sensors supported by this HAL.
-  // Indexed by the handle. Length must always be equal to total_sensor_count_.
-  static SensorInfo* sensor_infos_;
-  // Vector of sensor state information, indexed by the handle.
-  // Assumption here is that the sensor handles will start at 0 and be
-  // contiguous up to the number of supported sensors.
-  SensorStateVector sensor_states_;
-  // Keep track of the time when the thread in Poll() is scheduled to wake.
-  cvd::time::MonotonicTimePoint current_deadline_;
-
-  // Ordered set of sensor values.
-  // TODO(ghartman): Simulate FIFO overflow.
-  FifoType fifo_;
-  // Thread to handle new connections.
-  pthread_t receiver_thread_;
-  // Socket to receive sensor events on.
-  cvd::SharedFD sensor_listener_socket_;
-  // Socket for listener thread to receive control messages.
-  cvd::SharedFD control_receiver_socket_;
-  // Socket to send control messages to listener thread.
-  cvd::SharedFD control_sender_socket_;
-
-  // Lock to protect shared state, including
-  // sensor_states_ and next_deadline_.
-  // Associated with deadline_change_ condition variable.
-  cvd::Mutex sensor_state_lock_;
-  // Condition variable to signal changes in the deadline.
-  cvd::ConditionVariable deadline_change_;
-
-  // When events are arriving from a client, we report only
-  // when they arrive, rather than at a fixed cycle. After not
-  // receiving a real event for both a given number of periods
-  // and a given time period, we will give up and resume
-  // sending mock events.
-  const static int kInjectedEventWaitPeriods;
-  const static cvd::time::Nanoseconds kInjectedEventWaitTime;
-
-  /**
-   ** UTILITY FUNCTIONS
-   **/
-
-  // Receive data from remoter.
-  void* Receiver();
-
-  // Notifies the remoter that the HAL is awake and ready.
-  inline bool NotifyRemoter();
-
-  // Looks through all active sensor deadlines, and finds the one that
-  // is coming up next. If this is not next_deadline_, then the deadline
-  // has changed. Update it and signal the Poll thread.
-  // This should be called anytime the next deadline may have changed.
-  // Can only be called while holding sensor_state_lock_.
-  // Returns true if the deadline has changed.
-  cvd::time::MonotonicTimePoint UpdateDeadline();
-
-  // Sends an update for the sensor with the given handle to the remoter.
-  // Update will be enqueued for receiver, not send immediately.
-  inline bool UpdateRemoterState(int handle);
-
-  // Sends a control event to the listener.
-  inline bool SendControlMessage(SensorControlMessage msg);
-
-  // Populates the list of static sensor info. Returns the number
-  // of sensors supported. Should only be called once.
-  static inline int RegisterSensors();
-
-};
-
-} //namespace cvd
-
diff --git a/guest/hals/sensors/vsoc_sensors_message.cpp b/guest/hals/sensors/vsoc_sensors_message.cpp
deleted file mode 100644
index 1998762..0000000
--- a/guest/hals/sensors/vsoc_sensors_message.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stdlib.h>
-#include "guest/hals/sensors/vsoc_sensors_message.h"
-
-const char* gce_sensors_message::kSensorsHALSocketName =
-    "/var/run/system/sensors_hal_socket";
diff --git a/guest/hals/sensors/vsoc_sensors_message.h b/guest/hals/sensors/vsoc_sensors_message.h
deleted file mode 100644
index 3a57700..0000000
--- a/guest/hals/sensors/vsoc_sensors_message.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#pragma once
-
-#include <hardware/hardware.h>
-#include <hardware/sensors.h>
-
-struct gce_sensors_message : sensors_event_t {
-  static const char* kSensorsHALSocketName;
-};
-
diff --git a/guest/monitoring/cuttlefish_service/Android.mk b/guest/monitoring/cuttlefish_service/Android.mk
index d1baf7d..2540ef5 100644
--- a/guest/monitoring/cuttlefish_service/Android.mk
+++ b/guest/monitoring/cuttlefish_service/Android.mk
@@ -23,6 +23,7 @@
 LOCAL_SDK_VERSION := 28
 LOCAL_PROGUARD_FLAGS := -include build/core/proguard.flags
 LOCAL_PROGUARD_FLAG_FILES := proguard.flags
+LOCAL_PROGUARD_ENABLED := obfuscation
 LOCAL_VENDOR_MODULE := true
 
 include $(BUILD_PACKAGE)
diff --git a/guest/monitoring/cuttlefish_service/proguard.flags b/guest/monitoring/cuttlefish_service/proguard.flags
index c09a728..4578c0d 100644
--- a/guest/monitoring/cuttlefish_service/proguard.flags
+++ b/guest/monitoring/cuttlefish_service/proguard.flags
@@ -14,7 +14,7 @@
 
 # Keep enough data for stack traces
 -renamesourcefileattribute SourceFile
--keepattributes SourceFile,LineNumberTable,*Annotation*
+-keepattributes SourceFile,LineNumberTable,RuntimeVisible*Annotations,AnnotationDefault
 
 # Keep classes and methods that have the guava @VisibleForTesting annotation
 -keep @com.google.common.annotations.VisibleForTesting class *
@@ -24,3 +24,6 @@
 
 -keep public class * extends android.app.Service
 -keep public class * extends android.content.BroadcastReceiver
+
+# -dontobfuscate
+-keep,allowshrinking class * { *; }
diff --git a/guest/monitoring/tombstone_transmit/Android.bp b/guest/monitoring/tombstone_transmit/Android.bp
index 1e89183..2e0af82 100644
--- a/guest/monitoring/tombstone_transmit/Android.bp
+++ b/guest/monitoring/tombstone_transmit/Android.bp
@@ -21,11 +21,12 @@
     static_libs: [
         "libcuttlefish_fs_product",
         "libgflags",
-        "cuttlefish_auto_resources_product",
-        "liblog",
         "libbase",
         "libcutils",
     ],
+    shared_libs: [
+        "liblog",
+    ],
     stl: "libc++_static",
     header_libs: [
         "cuttlefish_glog_product",
diff --git a/guest/monitoring/tombstone_transmit/tombstone_transmit.cpp b/guest/monitoring/tombstone_transmit/tombstone_transmit.cpp
index 3633612..8fc3586 100644
--- a/guest/monitoring/tombstone_transmit/tombstone_transmit.cpp
+++ b/guest/monitoring/tombstone_transmit/tombstone_transmit.cpp
@@ -86,7 +86,6 @@
               "VSOCK port to send tombstones to");
 DEFINE_uint32(cid, 2, "VSOCK CID to send logcat output to");
 #define TOMBSTONE_BUFFER_SIZE (1024)
-#define MAX_TOMBSTONE_SIZE (50 * TOMBSTONE_BUFFER_SIZE)
 
 int main(int argc, char** argv) {
   gflags::ParseCommandLineFlags(&argc, &argv, true);
@@ -114,8 +113,7 @@
     char buffer[TOMBSTONE_BUFFER_SIZE];
     uint num_transfers = 0;
     int num_bytes_read = 0;
-    while (log_fd->IsOpen() && ifs.is_open() && !ifs.eof() &&
-           num_bytes_read < MAX_TOMBSTONE_SIZE) {
+    while (log_fd->IsOpen() && ifs.is_open() && !ifs.eof()) {
       ifs.read(buffer, sizeof(buffer));
       num_bytes_read += ifs.gcount();
       log_fd->Write(buffer, ifs.gcount());
diff --git a/guest/vsoc/lib/Android.bp b/guest/vsoc/lib/Android.bp
deleted file mode 100644
index d534a5d..0000000
--- a/guest/vsoc/lib/Android.bp
+++ /dev/null
@@ -1,77 +0,0 @@
-//
-// Copyright (C) 2019 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.
-
-cc_binary {
-    name: "vsoc_driver_test",
-    srcs: [
-        "vsoc_driver_test.cpp",
-    ],
-    shared_libs: [
-        "vsoc_lib",
-        "cuttlefish_auto_resources",
-        "libcuttlefish_fs",
-        "libbase",
-    ],
-    static_libs: [
-        "libgtest",
-    ],
-    cflags: [
-        "-DGTEST_OS_LINUX_ANDROID",
-        "-DGTEST_HAS_STD_STRING",
-    ],
-    defaults: ["cuttlefish_guest_only"]
-}
-
-cc_binary {
-    name: "vsoc_guest_region_e2e_test",
-    srcs: [
-        "guest_region_e2e_test.cpp",
-    ],
-    shared_libs: [
-        "vsoc_lib",
-        "cuttlefish_auto_resources",
-        "libcuttlefish_fs",
-        "libbase",
-    ],
-    static_libs: [
-        "libgtest",
-    ],
-    cflags: [
-        "-DGTEST_OS_LINUX_ANDROID",
-        "-DGTEST_HAS_STD_STRING",
-    ],
-    defaults: ["cuttlefish_guest_only"]
-}
-
-cc_binary {
-    name: "vsoc_managed_region_e2e_test",
-    srcs: [
-        "managed_region_e2e_test.cpp",
-    ],
-    shared_libs: [
-        "vsoc_lib",
-        "cuttlefish_auto_resources",
-        "libcuttlefish_fs",
-        "libbase",
-    ],
-    static_libs: [
-        "libgtest",
-    ],
-    cflags: [
-        "-DGTEST_OS_LINUX_ANDROID",
-        "-DGTEST_HAS_STD_STRING",
-    ],
-    defaults: ["cuttlefish_guest_only"]
-}
diff --git a/guest/vsoc/lib/e2e_test_common.h b/guest/vsoc/lib/e2e_test_common.h
deleted file mode 100644
index 521f4c6..0000000
--- a/guest/vsoc/lib/e2e_test_common.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <android-base/logging.h>
-
-#define DEATH_TEST_MESSAGE "abort converted to exit of 2 during death test"
-
-static inline void disable_tombstones() {
-  // We don't want a tombstone, and we're already in the child, so we modify the
-  // behavior of LOG(ABORT) to print the well known message and do an
-  // error-based exit.
-  android::base::SetAborter([](const char*) {
-    fputs(DEATH_TEST_MESSAGE, stderr);
-    fflush(stderr);
-    exit(2);
-  });
-}
diff --git a/guest/vsoc/lib/gralloc_region_view.cpp b/guest/vsoc/lib/gralloc_region_view.cpp
deleted file mode 100644
index 2c42f57..0000000
--- a/guest/vsoc/lib/gralloc_region_view.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "guest/vsoc/lib/gralloc_region_view.h"
-
-#include <common/vsoc/lib/lock_guard.h>
-#include <log/log.h>
-#include <sys/types.h>
-#include <uapi/vsoc_shm.h>
-#include <atomic>
-
-using vsoc::gralloc::GrallocRegionView;
-using vsoc::layout::gralloc::BufferEntry;
-using vsoc::layout::gralloc::GrallocBufferLayout;
-using vsoc::layout::gralloc::GrallocManagerLayout;
-
-namespace {
-template <typename T>
-inline T gralloc_align(T val) {
-  return (val + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1);
-}
-
-// Use the thread id to identify the original creator of a buffer.
-inline uint32_t gralloc_owned_value() {
-  return gettid();
-}
-
-}  // namespace
-
-bool GrallocRegionView::Open() {
-  if (!vsoc::ManagerRegionView<GrallocRegionView, GrallocManagerLayout>::Open()) {
-    return false;
-  }
-  std::shared_ptr<vsoc::RegionControl> managed_region =
-      vsoc::RegionControl::Open(
-          GrallocManagerLayout::ManagedRegion::region_name);
-  if (!managed_region) {
-    LOG_FATAL("Unable to open managed region");
-    return false;
-  }
-  offset_of_buffer_memory_ = gralloc_align<uint32_t>(
-      managed_region->region_desc().offset_of_region_data);
-  total_buffer_memory_ =
-      managed_region->region_size() - offset_of_buffer_memory_;
-
-  // TODO(jemoreira): Handle the case of unexpected values in the region.
-  return true;
-}
-
-int GrallocRegionView::AllocateBuffer(size_t size, uint32_t* begin_offset) {
-  size = gralloc_align<size_t>(size);
-  // Cache the value of buffer_count in shared memory.
-  uint32_t buffer_count_local = 0;
-  {
-    vsoc::LockGuard<vsoc::layout::GuestLock>(&data()->new_buffer_lock);
-    buffer_count_local = data()->buffer_count;
-  }
-  // Find a free buffer entry of the appropriate size.
-  for (uint32_t idx = 0; idx < buffer_count_local; ++idx) {
-    BufferEntry& entry = data()->buffers_table[idx];
-    if (entry.owned_by == VSOC_REGION_FREE && entry.buffer_size() == size) {
-      int fd = control_->CreateFdScopedPermission(
-          GrallocManagerLayout::ManagedRegion::region_name,
-          pointer_to_region_offset(&entry.owned_by),
-          gralloc_owned_value(),
-          entry.buffer_begin,
-          entry.buffer_end);
-      if (fd >= 0) {
-        if (begin_offset) {
-          *begin_offset = entry.buffer_begin;
-        }
-        return fd;
-      }
-    }
-  }
-
-  // We couldn't find any suitable buffer, create one
-  {
-    vsoc::LockGuard<vsoc::layout::GuestLock>(&data()->new_buffer_lock);
-    // don't use the cached value here!!!
-    uint32_t idx = data()->buffer_count;
-    if (pointer_to_region_offset(&data()->buffers_table[idx + 1]) >
-        control_->region_size()) {
-      ALOGE(
-          "Out of memory in gralloc_manager (total: %d, used: %d, "
-          "requested: %d)",
-          static_cast<int>(control_->region_size()),
-          static_cast<int>(
-              pointer_to_region_offset(&data()->buffers_table[idx])),
-          static_cast<int>(sizeof(data()->buffers_table[idx])));
-      return -ENOMEM;
-    }
-    if (total_buffer_memory_ - data()->allocated_buffer_memory < size) {
-      ALOGE(
-          "Out of memory in gralloc_memory (total: %d, used: %d, requested: %d)",
-          static_cast<int>(total_buffer_memory_),
-          static_cast<int>(data()->allocated_buffer_memory),
-          static_cast<int>(size));
-      return -ENOMEM;
-    }
-    // Initialize the buffer entry and acquire ownership
-    // Do it before increasing buffer_count so that another thread looking for
-    // free entries doesn't find this one
-    BufferEntry& new_entry = data()->buffers_table[idx];
-    new_entry.buffer_begin =
-        offset_of_buffer_memory_ + data()->allocated_buffer_memory;
-    data()->allocated_buffer_memory += size;
-    new_entry.buffer_end = new_entry.buffer_begin + size;
-    int fd = control_->CreateFdScopedPermission(
-        GrallocManagerLayout::ManagedRegion::region_name,
-        pointer_to_region_offset(&new_entry.owned_by),
-        gralloc_owned_value(),
-        new_entry.buffer_begin,
-        new_entry.buffer_end);
-    if (fd < 0) {
-      LOG_FATAL(
-          "Unexpected error while creating fd scoped permission over "
-          "uncontested memory: %s",
-          strerror(-fd));
-      return fd;
-    }
-    // Increment buffer_count now that the entry can't be taken from us
-    data()->buffer_count++;
-    if (begin_offset) {
-      *begin_offset = new_entry.buffer_begin;
-    }
-    return fd;
-  }
-}
diff --git a/guest/vsoc/lib/gralloc_region_view.h b/guest/vsoc/lib/gralloc_region_view.h
deleted file mode 100644
index ef5553f..0000000
--- a/guest/vsoc/lib/gralloc_region_view.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <common/vsoc/shm/gralloc_layout.h>
-#include <guest/vsoc/lib/manager_region_view.h>
-#include <memory>
-#include <stdlib.h>
-
-namespace vsoc {
-namespace gralloc {
-
-class GrallocRegionView : public vsoc::ManagerRegionView<
-                          GrallocRegionView,
-                          vsoc::layout::gralloc::GrallocManagerLayout> {
- public:
-  friend TypedRegionView<
-      GrallocRegionView, vsoc::layout::gralloc::GrallocManagerLayout>;
-  GrallocRegionView() = default;
-  // Allocates a gralloc buffer of (at least) the specified size. Returns a file
-  // descriptor that exposes the buffer when mmapped from 0 to (the page
-  // aligned) size (and fails to mmap anything outside of that range) or a
-  // negative number in case of error (e.g not enough free memory left).
-  // TODO(jemoreira): Include debug info like stride, width, height, etc
-  int AllocateBuffer(size_t size, uint32_t* begin_offset = nullptr);
-
- protected:
-  GrallocRegionView(const GrallocRegionView&) = delete;
-  GrallocRegionView & operator=(const GrallocRegionView&) = delete;
-
-  bool Open();
-
-  uint32_t offset_of_buffer_memory_{};
-  uint32_t total_buffer_memory_{};
-};
-
-} // namespace gralloc
-} // namespace vsoc
diff --git a/guest/vsoc/lib/guest_lock.cpp b/guest/vsoc/lib/guest_lock.cpp
deleted file mode 100644
index 247b48b..0000000
--- a/guest/vsoc/lib/guest_lock.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "common/vsoc/shm/lock.h"
-
-#include "common/vsoc/lib/compat.h"
-#include "common/vsoc/lib/single_sided_signal.h"
-
-namespace vsoc {
-namespace layout {
-
-void GuestLock::Lock() {
-  uint32_t tid = gettid();
-  uint32_t expected_value;
-  uint32_t* uaddr = reinterpret_cast<uint32_t*>(&lock_uint32_);
-
-  while (1) {
-    if (TryLock(tid, &expected_value)) {
-      return;
-    }
-    SingleSidedSignal::AwaitSignal(expected_value, uaddr);
-  }
-}
-
-void GuestLock::Unlock() {
-  Sides sides_to_signal = UnlockCommon(gettid());
-  if (sides_to_signal != Sides::NoSides) {
-    SingleSidedSignal::Signal(&lock_uint32_);
-  }
-}
-
-bool GuestLock::Recover() {
-  return RecoverSingleSided();
-}
-
-}  // namespace layout
-}  // namespace vsoc
diff --git a/guest/vsoc/lib/guest_region_e2e_test.cpp b/guest/vsoc/lib/guest_region_e2e_test.cpp
deleted file mode 100644
index 5fd644a..0000000
--- a/guest/vsoc/lib/guest_region_e2e_test.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * End-to-end test to ensure that mapping of vsoc regions works on the guest.
- */
-
-#include "guest/vsoc/lib/e2e_test_common.h"
-#include "common/vsoc/lib/e2e_test_region_view.h"
-
-#include <android-base/logging.h>
-#include <gtest/gtest.h>
-
-template <typename View>
-void DeathTestView() {
-  disable_tombstones();
-  // View::GetInstance should never return.
-  EXPECT_FALSE(!!View::GetInstance());
-}
-
-// Here is a summary of the two regions interrupt and write test:
-// 1. Write our strings to the first region
-// 2. Ensure that our peer hasn't signalled the second region. That would
-//    indicate that it didn't wait for our interrupt.
-// 3. Send the interrupt on the first region
-// 4. Wait for our peer's interrupt on the first region
-// 5. Confirm that we can see our peer's writes in the first region
-// 6. Initialize our strings in the second region
-// 7. Send an interrupt on the second region to our peer
-// 8. Wait for our peer's interrupt on the second region
-// 9. Confirm that we can see our peer's writes in the second region
-// 10. Repeat the process for signaling.
-// 11. Confirm that no interrupt is pending in the first region
-// 12. Confirm that no interrupt is pending in the second region
-
-template <typename View>
-void SetGuestStrings(View* in) {
-  size_t num_data = in->string_size();
-  EXPECT_LE(2U, num_data);
-  for (size_t i = 0; i < num_data; ++i) {
-    EXPECT_TRUE(!in->guest_string(i)[0] ||
-                !strcmp(in->guest_string(i), View::Layout::guest_pattern));
-    in->set_guest_string(i, View::Layout::guest_pattern);
-    EXPECT_STREQ(in->guest_string(i), View::Layout::guest_pattern);
-  }
-}
-
-template <typename View>
-void CheckPeerStrings(View* in) {
-  size_t num_data = in->string_size();
-  EXPECT_LE(2U, num_data);
-  for (size_t i = 0; i < num_data; ++i) {
-    EXPECT_STREQ(View::Layout::host_pattern, in->host_string(i));
-  }
-}
-
-TEST(RegionTest, BasicPeerTests) {
-  auto primary = vsoc::E2EPrimaryRegionView::GetInstance();
-  auto secondary = vsoc::E2ESecondaryRegionView::GetInstance();
-  ASSERT_TRUE(!!primary);
-  ASSERT_TRUE(!!secondary);
-  LOG(INFO) << "Regions are open";
-  SetGuestStrings(primary);
-  LOG(INFO) << "Primary guest strings are set";
-  EXPECT_FALSE(secondary->HasIncomingInterrupt());
-  LOG(INFO) << "Verified no early second interrupt";
-  EXPECT_TRUE(primary->MaybeInterruptPeer());
-  LOG(INFO) << "Interrupt sent. Waiting for first interrupt from peer";
-  primary->WaitForInterrupt();
-  LOG(INFO) << "First interrupt received";
-  CheckPeerStrings(primary);
-  LOG(INFO) << "Verified peer's primary strings";
-  SetGuestStrings(secondary);
-  LOG(INFO) << "Secondary guest strings are set";
-  EXPECT_TRUE(secondary->MaybeInterruptPeer());
-  LOG(INFO) << "Second interrupt sent";
-  secondary->WaitForInterrupt();
-  LOG(INFO) << "Second interrupt received";
-  CheckPeerStrings(secondary);
-  LOG(INFO) << "Verified peer's secondary strings";
-
-  // Test signals
-  EXPECT_FALSE(secondary->HasIncomingInterrupt());
-  LOG(INFO) << "Verified no early second signal";
-  primary->SendSignal(vsoc::layout::Sides::Peer,
-                      &primary->data()->guest_to_host_signal);
-  LOG(INFO) << "Signal sent. Waiting for first signal from peer";
-  primary->WaitForInterrupt();
-  int count = 0;  // counts the number of signals received.
-  primary->ProcessSignalsFromPeer(
-      [&primary, &count](uint32_t offset) {
-        ++count;
-        EXPECT_TRUE(offset == primary->host_to_guest_signal_offset());
-      });
-  EXPECT_TRUE(count == 1);
-  LOG(INFO) << "Signal received on primary region";
-  secondary->SendSignal(vsoc::layout::Sides::Peer,
-                        &secondary->data()->guest_to_host_signal);
-  LOG(INFO) << "Signal sent. Waiting for second signal from peer";
-  secondary->WaitForInterrupt();
-  count = 0;
-  secondary->ProcessSignalsFromPeer(
-      [&secondary, &count](uint32_t offset) {
-        ++count;
-        EXPECT_TRUE(offset == secondary->host_to_guest_signal_offset());
-      });
-  EXPECT_TRUE(count == 1);
-  LOG(INFO) << "Signal received on secondary region";
-
-  EXPECT_FALSE(primary->HasIncomingInterrupt());
-  EXPECT_FALSE(secondary->HasIncomingInterrupt());
-  LOG(INFO) << "PASS: BasicPeerTests";
-}
-
-TEST(RegionTest, MissingRegionDeathTest) {
-  // EXPECT_DEATH creates a child for the test, so we do it out here.
-  // DeathTestGuestRegion will actually do the deadly call after ensuring
-  // that we don't create an unwanted tombstone.
-  EXPECT_EXIT(DeathTestView<vsoc::E2EUnfindableRegionView>(),
-              testing::ExitedWithCode(2),
-              ".*" DEATH_TEST_MESSAGE ".*");
-}
-
-int main(int argc, char** argv) {
-  if (argc == 2) {
-    // gtest tries to leave temporary files in the current directory, so make the
-    // current directory something that we control.
-    if (chdir(argv[1]) != 0) {
-      abort();
-    }
-  }
-  android::base::InitLogging(argv);
-  testing::InitGoogleTest(&argc, argv);
-  int rval = RUN_ALL_TESTS();
-  if (!rval) {
-    auto region = vsoc::E2EPrimaryRegionView::GetInstance();
-    region->guest_status(vsoc::layout::e2e_test::E2E_MEMORY_FILLED);
-    LOG(INFO) << "stage_1_guest_region_e2e_tests PASSED";
-  } else {
-    LOG(ERROR) << "stage_1_guest_region_e2e_tests FAILED";
-  }
-  return rval;
-}
diff --git a/guest/vsoc/lib/managed_region_e2e_test.cpp b/guest/vsoc/lib/managed_region_e2e_test.cpp
deleted file mode 100644
index 390a6b7..0000000
--- a/guest/vsoc/lib/managed_region_e2e_test.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "common/vsoc/shm/managed_e2e_test_region_layout.h"
-#include "guest/vsoc/lib/e2e_test_common.h"
-#include "guest/vsoc/lib/manager_region_view.h"
-
-#include <android-base/logging.h>
-#include <gtest/gtest.h>
-
-using vsoc::layout::e2e_test::E2EManagedTestRegionLayout;
-using vsoc::layout::e2e_test::E2EManagerTestRegionLayout;
-
-// Region view classes to allow calling the Open() function from the test.
-class E2EManagedTestRegionView
-    : public vsoc::TypedRegionView<
-        E2EManagedTestRegionView,
-        E2EManagedTestRegionLayout> {
- public:
-  using vsoc::TypedRegionView<
-      E2EManagedTestRegionView, E2EManagedTestRegionLayout>::Open;
-};
-class E2EManagerTestRegionView
-    : public vsoc::ManagerRegionView<
-        E2EManagerTestRegionView,
-        E2EManagerTestRegionLayout> {
- public:
-  using vsoc::ManagerRegionView<
-      E2EManagerTestRegionView, E2EManagerTestRegionLayout>::Open;
-};
-
-class ManagedRegionTest {
- public:
-  void testManagedRegionFailMap() {
-    E2EManagedTestRegionView managed_region;
-    disable_tombstones();
-    // managed_region.Open should never return.
-    EXPECT_FALSE(managed_region.Open());
-  }
-
-  void testManagedRegionMap() {
-    EXPECT_TRUE(manager_region_.Open());
-
-    // Maps correctly with permission
-    const uint32_t owned_value = 65, begin_offset = 4096, end_offset = 8192;
-    int perm_fd = manager_region_.CreateFdScopedPermission(
-        &manager_region_.data()->data[0], owned_value, begin_offset,
-        end_offset);
-    EXPECT_TRUE(perm_fd >= 0);
-    fd_scoped_permission perm;
-    ASSERT_TRUE(ioctl(perm_fd, VSOC_GET_FD_SCOPED_PERMISSION, &perm) == 0);
-    void* mapped_ptr = mmap(NULL, perm.end_offset - perm.begin_offset,
-                            PROT_WRITE | PROT_READ, MAP_SHARED, perm_fd, 0);
-    EXPECT_FALSE(mapped_ptr == MAP_FAILED);
-
-    // Owned value gets written
-    EXPECT_TRUE(manager_region_.data()->data[0] == owned_value);
-
-    // Data written to the mapped memory stays there after unmap
-    std::string str = "managed by e2e_manager";
-    strcpy(reinterpret_cast<char*>(mapped_ptr), str.c_str());
-    EXPECT_TRUE(munmap(mapped_ptr, end_offset - begin_offset) == 0);
-    mapped_ptr = mmap(NULL, end_offset - begin_offset, PROT_WRITE | PROT_READ,
-                      MAP_SHARED, perm_fd, 0);
-    EXPECT_FALSE(mapped_ptr == MAP_FAILED);
-    EXPECT_TRUE(strcmp(reinterpret_cast<char*>(mapped_ptr), str.c_str()) == 0);
-
-    // Create permission elsewhere in the region, map same offset and length,
-    // ensure data isn't there
-    EXPECT_TRUE(munmap(mapped_ptr, end_offset - begin_offset) == 0);
-    close(perm_fd);
-    EXPECT_TRUE(manager_region_.data()->data[0] == 0);
-    perm_fd = manager_region_.CreateFdScopedPermission(
-        &manager_region_.data()->data[1], owned_value, begin_offset + 4096,
-        end_offset + 4096);
-    EXPECT_TRUE(perm_fd >= 0);
-    mapped_ptr = mmap(NULL, end_offset - begin_offset, PROT_WRITE | PROT_READ,
-                      MAP_SHARED, perm_fd, 0);
-    EXPECT_FALSE(mapped_ptr == MAP_FAILED);
-    EXPECT_FALSE(strcmp(reinterpret_cast<char*>(mapped_ptr), str.c_str()) == 0);
-  }
-  ManagedRegionTest() {}
-
- private:
-  E2EManagerTestRegionView manager_region_;
-};
-
-TEST(ManagedRegionTest, ManagedRegionFailMap) {
-  ManagedRegionTest test;
-  EXPECT_EXIT(test.testManagedRegionFailMap(), testing::ExitedWithCode(2),
-              ".*" DEATH_TEST_MESSAGE ".*");
-}
-
-TEST(ManagedRegionTest, ManagedRegionMap) {
-  ManagedRegionTest test;
-  test.testManagedRegionMap();
-}
-
-int main(int argc, char** argv) {
-  if (argc == 2) {
-    // gtest tries to leave temporary files in the current directory, so make the
-    // current directory something that we control.
-    if (chdir(argv[1]) != 0) {
-      abort();
-    }
-  }
-  android::base::InitLogging(argv);
-  testing::InitGoogleTest(&argc, argv);
-  return RUN_ALL_TESTS();
-}
diff --git a/guest/vsoc/lib/manager_region_view.h b/guest/vsoc/lib/manager_region_view.h
deleted file mode 100644
index c2a873d..0000000
--- a/guest/vsoc/lib/manager_region_view.h
+++ /dev/null
@@ -1,58 +0,0 @@
-#pragma once
-
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "common/vsoc/lib/typed_region_view.h"
-
-namespace vsoc {
-
-/**
- * Adds methods to create file descriptor scoped permissions. Just like
- * TypedRegionView it can be directly constructed or subclassed.
- *
- * The Layout type must (in addition to requirements for TypedRegionView) also
- * provide a nested type for the layout of the managed region.
- */
-template <typename View, typename Layout>
-class ManagerRegionView : public TypedRegionView<View, Layout> {
- public:
-  ManagerRegionView() = default;
-  /**
-   * Creates a fd scoped permission on the managed region.
-   *
-   * The managed_region_fd is in/out parameter that can be a not yet open file
-   * descriptor. If the fd is not open yet it will open the managed region
-   * device and then create the permission. If the function returns EBUSY
-   * (meaning that we lost the race to acquire the memory) the same fd can (and
-   * is expected to) be used in a subsequent call to create a permission on
-   * another memory location.
-   *
-   * On success returns an open fd with the requested permission asociated to
-   * it. If another thread/process acquired ownership of *owner_ptr before this
-   * one returns -EBUSY, returns a different negative number otherwise.
-   */
-  int CreateFdScopedPermission(uint32_t* owner_ptr, uint32_t owned_val,
-                               uint32_t begin_offset,
-                               uint32_t end_offset) {
-    return this->control_->CreateFdScopedPermission(
-        Layout::ManagedRegion::region_name,
-        this->pointer_to_region_offset(owner_ptr), owned_val, begin_offset,
-        end_offset);
-  }
-};
-
-}  // namespace vsoc
diff --git a/guest/vsoc/lib/region_control.cpp b/guest/vsoc/lib/region_control.cpp
deleted file mode 100644
index 1fcbd13..0000000
--- a/guest/vsoc/lib/region_control.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "common/vsoc/lib/region_view.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <string>
-#include <thread>
-
-#include <android-base/logging.h>
-#include <uapi/vsoc_shm.h>
-
-using cvd::SharedFD;
-
-namespace {
-class GuestRegionControl : public vsoc::RegionControl {
- public:
-  explicit GuestRegionControl(const SharedFD& region_fd,
-                              const vsoc_device_region& desc)
-      : region_fd_{region_fd} {
-    region_desc_ = desc;
-  }
-  virtual bool InterruptPeer() override;
-  virtual void InterruptSelf() override;
-  virtual void WaitForInterrupt() override;
-  virtual void* Map() override;
-  virtual int SignalSelf(uint32_t offset) override;
-  virtual int WaitForSignal(uint32_t offset, uint32_t expected_value) override;
-
- protected:
-  int CreateFdScopedPermission(const char* managed_region_name,
-                               uint32_t owner_offset, uint32_t owned_val,
-                               uint32_t begin_offset,
-                               uint32_t end_offset) override;
-  cvd::SharedFD region_fd_;
-};
-
-std::string device_path_from_name(const char* region_name) {
-  return std::string("/dev/") + region_name;
-}
-
-bool GuestRegionControl::InterruptPeer() {
-  int rval = region_fd_->Ioctl(VSOC_SEND_INTERRUPT_TO_HOST, 0);
-  if ((rval == -1) && (errno != EBUSY)) {
-    LOG(INFO) << __FUNCTION__ << ": ioctl failed (" << strerror(errno) << ")";
-  }
-  return !rval;
-}
-
-void GuestRegionControl::InterruptSelf() {
-  region_fd_->Ioctl(VSOC_SELF_INTERRUPT, 0);
-}
-
-void GuestRegionControl::WaitForInterrupt() {
-  region_fd_->Ioctl(VSOC_WAIT_FOR_INCOMING_INTERRUPT, 0);
-}
-
-int GuestRegionControl::SignalSelf(uint32_t offset) {
-  return region_fd_->Ioctl(VSOC_COND_WAKE, reinterpret_cast<void*>(offset));
-}
-
-int GuestRegionControl::WaitForSignal(uint32_t offset,
-                                      uint32_t expected_value) {
-  struct vsoc_cond_wait wait;
-  wait.offset = offset;
-  wait.value = expected_value;
-  wait.wake_time_sec = 0;
-  wait.wake_time_nsec = 0;
-  wait.wait_type = VSOC_WAIT_IF_EQUAL;
-  wait.wakes = 1000;
-  wait.reserved_1 = 0;
-  int rval = region_fd_->Ioctl(VSOC_COND_WAIT, &wait);
-  if (rval == -1) {
-    return rval;
-  }
-  // Clamp the number of wakes if it overflows an integer.
-  rval = wait.wakes;
-  if (rval >= 0) {
-    return rval;
-  }
-  return INT_MAX;
-}
-
-int GuestRegionControl::CreateFdScopedPermission(
-    const char* managed_region_name, uint32_t owner_offset,
-    uint32_t owned_value, uint32_t begin_offset,
-    uint32_t end_offset) {
-  if (!region_fd_->IsOpen()) {
-    LOG(FATAL) << "Can't create permission before opening controller region";
-    return -EINVAL;
-  }
-  int managed_region_fd =
-      open(device_path_from_name(managed_region_name).c_str(), O_RDWR);
-  if (managed_region_fd < 0) {
-    int errno_ = errno;
-    LOG(FATAL) << "Can't open managed region: " << managed_region_name;
-    return -errno_;
-  }
-
-  fd_scoped_permission_arg perm;
-  perm.perm.begin_offset = begin_offset;
-  perm.perm.end_offset = end_offset;
-  perm.perm.owned_value = owned_value;
-  perm.perm.owner_offset = owner_offset;
-  perm.managed_region_fd = managed_region_fd;
-  LOG(INFO) << "owner offset: " << perm.perm.owner_offset;
-  int retval = region_fd_->Ioctl(VSOC_CREATE_FD_SCOPED_PERMISSION, &perm);
-  if (retval) {
-    int errno_ = errno;
-    close(managed_region_fd);
-    if (errno_ != EBUSY) {
-      LOG(FATAL) << "Unable to create fd scoped permission ("
-                 << strerror(errno_) << ")";
-    }
-    return -errno_;
-  }
-  return managed_region_fd;
-}
-
-void* GuestRegionControl::Map() {
-  region_base_ =
-      region_fd_->Mmap(0, region_size(), PROT_READ | PROT_WRITE, MAP_SHARED, 0);
-  if (region_base_ == MAP_FAILED) {
-    LOG(FATAL) << "mmap failed (" << region_fd_->StrError() << ")";
-    region_base_ = nullptr;
-  }
-  return region_base_;
-}
-}  // namespace
-
-// domain is here to ensure that this method has the same signature as the
-// method on host regions.
-std::shared_ptr<vsoc::RegionControl> vsoc::RegionControl::Open(
-    const char* region_name) {
-  std::string path = device_path_from_name(region_name);
-  SharedFD fd = SharedFD::Open(path.c_str(), O_RDWR);
-  if (!fd->IsOpen()) {
-    LOG(FATAL) << "Unable to open region " << region_name << " ("
-               << fd->StrError() << ")";
-    return nullptr;
-  }
-  vsoc_device_region desc;
-  if (fd->Ioctl(VSOC_DESCRIBE_REGION, &desc)) {
-    LOG(FATAL) << "Unable to obtain region descriptor (" << fd->StrError()
-               << ")";
-    return nullptr;
-  }
-  return std::shared_ptr<vsoc::RegionControl>(new GuestRegionControl(fd, desc));
-}
diff --git a/guest/vsoc/lib/region_view.cpp b/guest/vsoc/lib/region_view.cpp
deleted file mode 100644
index db1bec0..0000000
--- a/guest/vsoc/lib/region_view.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "common/vsoc/lib/region_view.h"
-#include "common/vsoc/lib/region_control.h"
-
-const vsoc_signal_table_layout& vsoc::RegionView::incoming_signal_table() {
-  return control_->region_desc().host_to_guest_signal_table;
-}
-
-// Returns a pointer to the table that will be used to post signals
-const vsoc_signal_table_layout& vsoc::RegionView::outgoing_signal_table() {
-  return control_->region_desc().guest_to_host_signal_table;
-}
diff --git a/guest/vsoc/lib/vsoc_driver_test.cpp b/guest/vsoc/lib/vsoc_driver_test.cpp
deleted file mode 100644
index ff20ecb..0000000
--- a/guest/vsoc/lib/vsoc_driver_test.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-/*
- * Stand-alone tests for the ioctls in the vsoc driver.
- */
-
-#include "uapi/vsoc_shm.h"
-#include <atomic>
-#include <stdint.h>
-#include "common/vsoc/lib/e2e_test_region_view.h"
-#include "guest/vsoc/lib/manager_region_view.h"
-
-#include <android-base/logging.h>
-#include <gtest/gtest.h>
-
-void BasicWaitForSignal(vsoc::E2EPrimaryRegionView* region,
-                        uint32_t expected_start,
-                        uint32_t expected_finish) {
-  ASSERT_EQ(expected_start, region->read_guest_self_register());
-  int rval = region->wait_guest_self_register(expected_start);
-  EXPECT_LE(0, rval);
-  EXPECT_GT(5, rval);
-  EXPECT_EQ(expected_finish, region->read_guest_self_register());
-}
-
-TEST(FutexTest, BasicFutexTests) {
-  constexpr uint32_t INITIAL_SIGNAL = 0;
-  constexpr uint32_t SILENT_UPDATE_SIGNAL = 1;
-  constexpr uint32_t WAKE_SIGNAL = 2;
-  auto region = vsoc::E2EPrimaryRegionView::GetInstance();
-  ASSERT_TRUE(region != NULL);
-  LOG(INFO) << "Regions are open";
-  region->write_guest_self_register(INITIAL_SIGNAL);
-  std::thread waiter(BasicWaitForSignal, region, INITIAL_SIGNAL, WAKE_SIGNAL);
-  sleep(1);
-  LOG(INFO) << "Still waiting. Trying to wake wrong address";
-  region->signal_guest_to_host_register();
-  sleep(1);
-  LOG(INFO) << "Still waiting. Trying to wake without update";
-  region->signal_guest_self_register();
-  sleep(1);
-  LOG(INFO) << "Still waiting. Trying to wake without signal";
-  region->write_guest_self_register(SILENT_UPDATE_SIGNAL);
-  sleep(1);
-  LOG(INFO) << "Still waiting. Trying to wake with signal";
-  region->write_guest_self_register(WAKE_SIGNAL);
-  region->signal_guest_self_register();
-  waiter.join();
-  LOG(INFO) << "Wake worked";
-  LOG(INFO) << "PASS: BasicPeerTests";
-}
-
-int main(int argc, char* argv[]) {
-  android::base::InitLogging(argv);
-  testing::InitGoogleTest(&argc, argv);
-  return RUN_ALL_TESTS();
-}
diff --git a/host/commands/Android.bp b/host/commands/Android.bp
index a6f059d..c200611 100644
--- a/host/commands/Android.bp
+++ b/host/commands/Android.bp
@@ -19,7 +19,6 @@
     "launch",
     "stop_cvd",
     "ivserver",
-    "record_audio",
     "virtual_usb_manager",
     "kernel_log_monitor",
     "config_server",
diff --git a/host/commands/assemble_cvd/Android.bp b/host/commands/assemble_cvd/Android.bp
index e296526..18b846f 100644
--- a/host/commands/assemble_cvd/Android.bp
+++ b/host/commands/assemble_cvd/Android.bp
@@ -39,15 +39,13 @@
         "super_image_mixer.cc",
     ],
     header_libs: [
+        "bootimg_headers",
         "cuttlefish_glog",
     ],
     shared_libs: [
         "cdisk_spec",
-        "vsoc_lib",
         "libcuttlefish_fs",
-        "libcuttlefish_strings",
         "libcuttlefish_utils",
-        "cuttlefish_auto_resources",
         "libbase",
         "libnl",
         "libprotobuf-cpp-full",
@@ -57,7 +55,6 @@
     static_libs: [
         "libcuttlefish_host_config",
         "libcuttlefish_vm_manager",
-        "libivserver",
         "libgflags",
         "libxml2",
         "libjsoncpp",
@@ -65,8 +62,7 @@
     defaults: ["cuttlefish_host_only", "cuttlefish_libicuuc"],
 }
 
-cc_prebuilt_binary {
+sh_binary_host {
     name: "cf_bpttool",
-    srcs: ["cf_bpttool"],
-    defaults: ["cuttlefish_host_only"],
+    src: "cf_bpttool",
 }
diff --git a/host/commands/assemble_cvd/assemble_cvd.cc b/host/commands/assemble_cvd/assemble_cvd.cc
index 6eab814..c829395 100644
--- a/host/commands/assemble_cvd/assemble_cvd.cc
+++ b/host/commands/assemble_cvd/assemble_cvd.cc
@@ -15,11 +15,11 @@
 
 #include <iostream>
 
+#include <android-base/strings.h>
 #include <glog/logging.h>
 
 #include "common/libs/fs/shared_buf.h"
 #include "common/libs/fs/shared_fd.h"
-#include "common/libs/strings/str_split.h"
 #include "host/commands/assemble_cvd/assembler_defs.h"
 #include "host/commands/assemble_cvd/flags.h"
 #include "host/libs/config/fetcher_config.h"
@@ -68,7 +68,7 @@
       LOG(FATAL) << "Failed to read input files. Error was \"" << input_fd->StrError() << "\"";
     }
   }
-  std::vector<std::string> input_files = cvd::StrSplit(input_files_str, '\n');
+  std::vector<std::string> input_files = android::base::Split(input_files_str, "\n");
 
   auto config = InitFilesystemAndCreateConfig(&argc, &argv, FindFetcherConfig(input_files));
 
diff --git a/host/commands/assemble_cvd/boot_image_unpacker.cc b/host/commands/assemble_cvd/boot_image_unpacker.cc
index 460cc1e..f1ead30 100644
--- a/host/commands/assemble_cvd/boot_image_unpacker.cc
+++ b/host/commands/assemble_cvd/boot_image_unpacker.cc
@@ -21,10 +21,10 @@
 
 #include <sstream>
 
+#include <bootimg.h>
 #include <glog/logging.h>
 
 #include "common/libs/utils/subprocess.h"
-#include "host/commands/assemble_cvd/bootimg.h"
 
 namespace cvd {
 
@@ -48,39 +48,58 @@
 }
 }  // namespace
 
-std::unique_ptr<BootImageUnpacker> BootImageUnpacker::FromImage(
-    const std::string& path) {
-  auto boot_img = SharedFD::Open(path.c_str(), O_RDONLY);
+std::unique_ptr<BootImageUnpacker> BootImageUnpacker::FromImages(
+    const std::string& boot_image_path,
+    const std::string& vendor_boot_image_path) {
+  auto boot_img = SharedFD::Open(boot_image_path.c_str(), O_RDONLY);
   if (!boot_img->IsOpen()) {
-    LOG(ERROR) << "Unable to open boot image (" << path
+    LOG(ERROR) << "Unable to open boot image (" << boot_image_path
                << "): " << boot_img->StrError();
     return nullptr;
   }
-  boot_img_hdr header;
+  boot_img_hdr_v3 header;
   auto bytes_read = boot_img->Read(&header, sizeof(header));
   if (bytes_read != sizeof(header)) {
     LOG(ERROR) << "Error reading boot image header";
     return nullptr;
   }
 
-  std::ostringstream cmdline;
-  cmdline << reinterpret_cast<char*>(&header.cmdline[0]);
-  if (header.extra_cmdline[0] != '\0') {
-    cmdline << " ";
-    cmdline << reinterpret_cast<char*>(&header.extra_cmdline[0]);
+  auto vendor_boot_img = SharedFD::Open(vendor_boot_image_path.c_str(),
+                                        O_RDONLY);
+  if (!vendor_boot_img->IsOpen()) {
+    LOG(ERROR) << "Unable to open vendor boot image (" << vendor_boot_image_path
+               << "): " << vendor_boot_img->StrError();
+    return nullptr;
+  }
+  vendor_boot_img_hdr_v3 vboot_header;
+  bytes_read = vendor_boot_img->Read(&vboot_header, sizeof(vboot_header));
+  if (bytes_read != sizeof(vboot_header)) {
+    LOG(ERROR) << "Error reading vendor boot image header";
+    return nullptr;
   }
 
-  uint32_t page_size = header.page_size;
-  // See system/core/mkbootimg/include/mkbootimg/bootimg.h for the origin of
+  std::ostringstream cmdline;
+  cmdline << reinterpret_cast<char*>(&header.cmdline[0]);
+  if (vboot_header.cmdline[0] != '\0') {
+    cmdline << " ";
+    cmdline << reinterpret_cast<char*>(&vboot_header.cmdline[0]);
+  }
+
+  uint32_t page_size = 4096;
+  // See system/tools/mkbootimg/include/bootimg/bootimg.h for the origin of
   // these offset calculations
   uint32_t kernel_offset = page_size;
   uint32_t ramdisk_offset =
       kernel_offset +
       ((header.kernel_size + page_size - 1) / page_size) * page_size;
+  uint32_t vendor_ramdisk_offset =
+      ((vboot_header.header_size + vboot_header.page_size - 1) / vboot_header.page_size) *
+      vboot_header.page_size;
 
   std::unique_ptr<BootImageUnpacker> ret(new BootImageUnpacker(
       boot_img, cmdline.str(), header.kernel_size, kernel_offset,
-      header.ramdisk_size, ramdisk_offset));
+      header.ramdisk_size, ramdisk_offset, vendor_boot_img,
+      vboot_header.vendor_ramdisk_size, vendor_ramdisk_offset));
 
   return ret;
 }
@@ -99,8 +118,14 @@
   return ExtractFile(boot_image_, ramdisk_image_offset_, ramdisk_image_size_,
                      path);
 }
+bool BootImageUnpacker::ExtractVendorRamdiskImage(const std::string& path) const {
+  if (vendor_ramdisk_image_size_ == 0) return false;
+  return ExtractFile(vendor_boot_image_, vendor_ramdisk_image_offset_,
+                     vendor_ramdisk_image_size_, path);
+}
 
 bool BootImageUnpacker::Unpack(const std::string& ramdisk_image_path,
+                               const std::string& vendor_ramdisk_image_path,
                                const std::string& kernel_image_path) {
   if (HasRamdiskImage()) {
     if (!ExtractRamdiskImage(ramdisk_image_path)) {
@@ -108,6 +133,12 @@
       return false;
     }
   }
+  if (HasVendorRamdiskImage()) {
+    if (!ExtractVendorRamdiskImage(vendor_ramdisk_image_path)) {
+      LOG(ERROR) << "Error extracting vendor ramdisk from venodr boot image";
+      return false;
+    }
+  }
   if (!kernel_image_path.empty()) {
     if (HasKernelImage()) {
       if (!ExtractKernelImage(kernel_image_path)) {
diff --git a/host/commands/assemble_cvd/boot_image_unpacker.h b/host/commands/assemble_cvd/boot_image_unpacker.h
index 05fe671..a331f0c 100644
--- a/host/commands/assemble_cvd/boot_image_unpacker.h
+++ b/host/commands/assemble_cvd/boot_image_unpacker.h
@@ -29,7 +29,9 @@
  public:
   // Reads header section of boot image at path and returns a BootImageUnpacker
   // preloaded with all the metadata.
-  static std::unique_ptr<BootImageUnpacker> FromImage(const std::string& path);
+  static std::unique_ptr<BootImageUnpacker> FromImages(
+    const std::string& boot_image_path,
+    const std::string& vendor_boot_image_path);
 
   ~BootImageUnpacker() = default;
 
@@ -37,30 +39,32 @@
 
   bool HasKernelImage() const { return kernel_image_size_ > 0; }
   bool HasRamdiskImage() const { return ramdisk_image_size_ > 0; }
-
-  // Extracts the kernel image to the given path
-  bool ExtractKernelImage(const std::string& path) const;
-  // Extracts the ramdisk image to the given path. It may return false if the
-  // boot image does not contain a ramdisk, which is the case when having system
-  // as root.
-  bool ExtractRamdiskImage(const std::string& path) const;
+  bool HasVendorRamdiskImage() const { return vendor_ramdisk_image_size_ > 0; }
 
   bool Unpack(const std::string& ramdisk_image_path,
+              const std::string& vendor_ramdisk_image_path,
               const std::string& kernel_image_path);
 
  private:
   BootImageUnpacker(SharedFD boot_image, const std::string& cmdline,
                     uint32_t kernel_image_size, uint32_t kernel_image_offset,
-                    uint32_t ramdisk_image_size, uint32_t ramdisk_image_offset)
+                    uint32_t ramdisk_image_size, uint32_t ramdisk_image_offset,
+                    SharedFD vendor_boot_image,
+                    uint32_t vendor_ramdisk_image_size,
+                    uint32_t vendor_ramdisk_image_offset)
       : boot_image_(boot_image),
+        vendor_boot_image_(vendor_boot_image),
         kernel_cmdline_(cmdline),
         kernel_image_size_(kernel_image_size),
         kernel_image_offset_(kernel_image_offset),
         ramdisk_image_size_(ramdisk_image_size),
-        ramdisk_image_offset_(ramdisk_image_offset) {}
+        ramdisk_image_offset_(ramdisk_image_offset),
+        vendor_ramdisk_image_size_(vendor_ramdisk_image_size),
+        vendor_ramdisk_image_offset_(vendor_ramdisk_image_offset) {}
 
   // Mutable because we only read from the fd, but do not modify its contents
   mutable SharedFD boot_image_;
+  mutable SharedFD vendor_boot_image_;
   std::string kernel_cmdline_;
   // When buidling the boot image a particular page size is assumed, which may
   // not match the actual page size of the system.
@@ -68,6 +72,17 @@
   uint32_t kernel_image_offset_;
   uint32_t ramdisk_image_size_;
   uint32_t ramdisk_image_offset_;
+  uint32_t vendor_ramdisk_image_size_;
+  uint32_t vendor_ramdisk_image_offset_;
+
+  // Extracts the kernel image to the given path
+  bool ExtractKernelImage(const std::string& path) const;
+  // Extracts the ramdisk image to the given path. It may return false if the
+  // boot image does not contain a ramdisk, which is the case when having system
+  // as root.
+  bool ExtractRamdiskImage(const std::string& path) const;
+  // Extracts the vendor ramdisk image to the given path
+  bool ExtractVendorRamdiskImage(const std::string& path) const;
 };
 
 }  // namespace cvd
diff --git a/host/commands/assemble_cvd/bootimg.h b/host/commands/assemble_cvd/bootimg.h
deleted file mode 100644
index 7b8fb28..0000000
--- a/host/commands/assemble_cvd/bootimg.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/* tools/mkbootimg/bootimg.h
-**
-** Copyright 2007, 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.
-*/
-
-// This file is a clone of the one found on system/core/mkbootimg. We've made a
-// clone because the location of the original header has changed over time.
-
-#include <stdint.h>
-
-#ifndef CUTTLEFISH_LAUNCH_BOOT_IMAGE_H_
-#define CUTTLEFISH_LAUNCH_BOOT_IMAGE_H_
-
-#define BOOT_MAGIC "ANDROID!"
-#define BOOT_MAGIC_SIZE 8
-#define BOOT_NAME_SIZE 16
-#define BOOT_ARGS_SIZE 512
-#define BOOT_EXTRA_ARGS_SIZE 1024
-
-#define BOOT_HEADER_VERSION_ZERO 0
-/*
- *  Bootloader expects the structure of boot_img_hdr with header version
- *  BOOT_HEADER_VERSION_ZERO to be as follows:
- */
-struct boot_img_hdr_v0 {
-    uint8_t magic[BOOT_MAGIC_SIZE];
-
-    uint32_t kernel_size; /* size in bytes */
-    uint32_t kernel_addr; /* physical load addr */
-
-    uint32_t ramdisk_size; /* size in bytes */
-    uint32_t ramdisk_addr; /* physical load addr */
-
-    uint32_t second_size; /* size in bytes */
-    uint32_t second_addr; /* physical load addr */
-
-    uint32_t tags_addr; /* physical addr for kernel tags */
-    uint32_t page_size; /* flash page size we assume */
-    /*
-     * version for the boot image header.
-     */
-    uint32_t header_version;
-
-    /* operating system version and security patch level; for
-     * version "A.B.C" and patch level "Y-M-D":
-     * ver = A << 14 | B << 7 | C         (7 bits for each of A, B, C)
-     * lvl = ((Y - 2000) & 127) << 4 | M  (7 bits for Y, 4 bits for M)
-     * os_version = ver << 11 | lvl */
-    uint32_t os_version;
-
-    uint8_t name[BOOT_NAME_SIZE]; /* asciiz product name */
-
-    uint8_t cmdline[BOOT_ARGS_SIZE];
-
-    uint32_t id[8]; /* timestamp / checksum / sha1 / etc */
-
-    /* Supplemental command line data; kept here to maintain
-     * binary compatibility with older versions of mkbootimg */
-    uint8_t extra_cmdline[BOOT_EXTRA_ARGS_SIZE];
-} __attribute__((packed));
-
-/*
- * It is expected that callers would explicitly specify which version of the
- * boot image header they need to use.
- */
-typedef struct boot_img_hdr_v0 boot_img_hdr;
-
-/* When a boot header is of version BOOT_HEADER_VERSION_ZERO, the structure of boot image is as
- * follows:
- *
- * +-----------------+
- * | boot header     | 1 page
- * +-----------------+
- * | kernel          | n pages
- * +-----------------+
- * | ramdisk         | m pages
- * +-----------------+
- * | second stage    | o pages
- * +-----------------+
- *
- * n = (kernel_size + page_size - 1) / page_size
- * m = (ramdisk_size + page_size - 1) / page_size
- * o = (second_size + page_size - 1) / page_size
- *
- * 0. all entities are page_size aligned in flash
- * 1. kernel and ramdisk are required (size != 0)
- * 2. second is optional (second_size == 0 -> no second)
- * 3. load each element (kernel, ramdisk, second) at
- *    the specified physical address (kernel_addr, etc)
- * 4. prepare tags at tag_addr.  kernel_args[] is
- *    appended to the kernel commandline in the tags.
- * 5. r0 = 0, r1 = MACHINE_TYPE, r2 = tags_addr
- * 6. if second_size != 0: jump to second_addr
- *    else: jump to kernel_addr
- */
-
-#define BOOT_HEADER_VERSION_ONE 1
-
-struct boot_img_hdr_v1 : public boot_img_hdr_v0 {
-    uint32_t recovery_dtbo_size;   /* size in bytes for recovery DTBO image */
-    uint64_t recovery_dtbo_offset; /* physical load addr */
-    uint32_t header_size;
-} __attribute__((packed));
-
-/* When the boot image header has a version of BOOT_HEADER_VERSION_ONE, the structure of the boot
- * image is as follows:
- *
- * +-----------------+
- * | boot header     | 1 page
- * +-----------------+
- * | kernel          | n pages
- * +-----------------+
- * | ramdisk         | m pages
- * +-----------------+
- * | second stage    | o pages
- * +-----------------+
- * | recovery dtbo   | p pages
- * +-----------------+
- * n = (kernel_size + page_size - 1) / page_size
- * m = (ramdisk_size + page_size - 1) / page_size
- * o = (second_size + page_size - 1) / page_size
- * p = (recovery_dtbo_size + page_size - 1) / page_size
- *
- * 0. all entities are page_size aligned in flash
- * 1. kernel and ramdisk are required (size != 0)
- * 2. recovery_dtbo is required for recovery.img in non-A/B devices(recovery_dtbo_size != 0)
- * 3. second is optional (second_size == 0 -> no second)
- * 4. load each element (kernel, ramdisk, second, recovery_dtbo) at
- *    the specified physical address (kernel_addr, etc)
- * 5. prepare tags at tag_addr.  kernel_args[] is
- *    appended to the kernel commandline in the tags.
- * 6. r0 = 0, r1 = MACHINE_TYPE, r2 = tags_addr
- * 7. if second_size != 0: jump to second_addr
- *    else: jump to kernel_addr
- */
-
-#if 0
-typedef struct ptentry ptentry;
-
-struct ptentry {
-    char name[16];      /* asciiz partition name    */
-    unsigned start;     /* starting block number    */
-    unsigned length;    /* length in blocks         */
-    unsigned flags;     /* set to zero              */
-};
-
-/* MSM Partition Table ATAG
-**
-** length: 2 + 7 * n
-** atag:   0x4d534d70
-**         <ptentry> x n
-*/
-#endif
-
-#endif
diff --git a/host/commands/assemble_cvd/flags.cc b/host/commands/assemble_cvd/flags.cc
index c5a8c36..5c60674 100644
--- a/host/commands/assemble_cvd/flags.cc
+++ b/host/commands/assemble_cvd/flags.cc
@@ -3,13 +3,12 @@
 #include <iostream>
 #include <fstream>
 
+#include <android-base/strings.h>
 #include <gflags/gflags.h>
 #include <glog/logging.h>
 
-#include "common/libs/strings/str_split.h"
 #include "common/libs/utils/environment.h"
 #include "common/libs/utils/files.h"
-#include "common/vsoc/lib/vsoc_memory.h"
 #include "host/commands/assemble_cvd/boot_image_unpacker.h"
 #include "host/commands/assemble_cvd/data_image.h"
 #include "host/commands/assemble_cvd/image_aggregator.h"
@@ -71,17 +70,16 @@
 DEFINE_string(boot_image, "",
               "Location of cuttlefish boot image. If empty it is assumed to be "
               "boot.img in the directory specified by -system_image_dir.");
+DEFINE_string(vendor_boot_image, "",
+              "Location of cuttlefish vendor boot image. If empty it is assumed to "
+              "be vendor_boot.img in the directory specified by -system_image_dir.");
 DEFINE_int32(memory_mb, 2048,
              "Total amount of memory available for guest, MB.");
-std::string g_default_mempath{vsoc::GetDefaultMempath()};
-DEFINE_string(mempath, g_default_mempath.c_str(),
-              "Target location for the shmem file.");
-DEFINE_string(mobile_interface, "", // default handled on ParseCommandLine
+DEFINE_string(mobile_interface, GetPerInstanceDefault("cvd-mbr-"),
               "Network interface to use for mobile networking");
-DEFINE_string(mobile_tap_name, "", // default handled on ParseCommandLine
+DEFINE_string(mobile_tap_name, GetPerInstanceDefault("cvd-mtap-"),
               "The name of the tap interface to use for mobile");
-std::string g_default_serial_number{GetPerInstanceDefault("CUTTLEFISHCVD")};
-DEFINE_string(serial_number, g_default_serial_number.c_str(),
+DEFINE_string(serial_number, GetPerInstanceDefault("CUTTLEFISHCVD"),
               "Serial number to use for the device");
 DEFINE_string(instance_dir, "", // default handled on ParseCommandLine
               "A directory to put all instance specific files");
@@ -112,24 +110,14 @@
 DEFINE_string(vnc_server_binary,
               vsoc::DefaultHostArtifactsPath("bin/vnc_server"),
               "Location of the vnc server binary.");
-DEFINE_bool(start_stream_audio, false,
-            "Whether to start the stream audio process.");
-DEFINE_string(stream_audio_binary,
-              vsoc::DefaultHostArtifactsPath("bin/stream_audio"),
-              "Location of the stream_audio binary.");
 DEFINE_string(virtual_usb_manager_binary,
               vsoc::DefaultHostArtifactsPath("bin/virtual_usb_manager"),
               "Location of the virtual usb manager binary.");
 DEFINE_string(kernel_log_monitor_binary,
               vsoc::DefaultHostArtifactsPath("bin/kernel_log_monitor"),
               "Location of the log monitor binary.");
-DEFINE_string(ivserver_binary,
-              vsoc::DefaultHostArtifactsPath("bin/ivserver"),
-              "Location of the ivshmem server binary.");
 DEFINE_int32(vnc_server_port, GetPerInstanceDefault(6444),
              "The port on which the vnc server should listen");
-DEFINE_int32(stream_audio_port, GetPerInstanceDefault(7444),
-             "The port on which stream_audio should listen.");
 DEFINE_string(socket_forward_proxy_binary,
               vsoc::DefaultHostArtifactsPath("bin/socket_forward_proxy"),
               "Location of the socket_forward_proxy binary.");
@@ -152,7 +140,7 @@
               "Location of the adb_connector binary. Only relevant if "
               "-run_adb_connector is true");
 DEFINE_int32(vhci_port, GetPerInstanceDefault(0), "VHCI port to use for usb");
-DEFINE_string(wifi_tap_name, "", // default handled on ParseCommandLine
+DEFINE_string(wifi_tap_name, GetPerInstanceDefault("cvd-wtap-"),
               "The name of the tap interface to use for wifi");
 DEFINE_int32(vsock_guest_cid,
              vsoc::GetDefaultPerInstanceVsockCid(),
@@ -179,10 +167,6 @@
               vsoc::DefaultHostArtifactsPath("bin/console_forwarder"),
               "The Console Forwarder binary to use");
 DEFINE_bool(restart_subprocesses, true, "Restart any crashed host process");
-DEFINE_bool(run_e2e_test, true, "Run e2e test after device launches");
-DEFINE_string(e2e_test_binary,
-              vsoc::DefaultHostArtifactsPath("bin/host_region_e2e_test"),
-              "Location of the region end to end test binary");
 DEFINE_string(logcat_receiver_binary,
               vsoc::DefaultHostArtifactsPath("bin/logcat_receiver"),
               "Binary for the logcat server");
@@ -204,12 +188,22 @@
               "Binary for the tombstone server");
 DEFINE_int32(tombstone_receiver_port, vsoc::GetPerInstanceDefault(5630),
              "The vsock port for tombstones");
+DEFINE_int32(keyboard_server_port, GetPerInstanceDefault(5540),
+             "The port on which the vsock keyboard server should listen");
+DEFINE_int32(touch_server_port, GetPerInstanceDefault(5640),
+             "The port on which the vsock touch server should listen");
 DEFINE_bool(use_bootloader, false, "Boots the device using a bootloader");
 DEFINE_string(bootloader, "", "Bootloader binary path");
+DEFINE_string(boot_slot, "", "Force booting into the given slot. If empty, "
+             "the slot will be chosen based on the misc partition if using a "
+             "bootloader. It will default to 'a' if empty and not using a "
+             "bootloader.");
 
 namespace {
 
-std::string kRamdiskConcatExt = ".concat";
+const std::string kKernelDefaultPath = "kernel";
+const std::string kInitramfsImg = "initramfs.img";
+const std::string kRamdiskConcatExt = ".concat";
 
 template<typename S, typename T>
 static std::string concat(const S& s, const T& t) {
@@ -247,6 +241,11 @@
   std::string default_composite_disk = FLAGS_system_image_dir + "/composite.img";
   SetCommandLineOptionWithMode("composite_disk", default_composite_disk.c_str(),
                                google::FlagSettingMode::SET_FLAGS_DEFAULT);
+  std::string default_vendor_boot_image = FLAGS_system_image_dir
+                                        + "/vendor_boot.img";
+  SetCommandLineOptionWithMode("vendor_boot_image",
+                               default_vendor_boot_image.c_str(),
+                               google::FlagSettingMode::SET_FLAGS_DEFAULT);
 
   return true;
 }
@@ -263,9 +262,9 @@
 // Initializes the config object and saves it to file. It doesn't return it, all
 // further uses of the config should happen through the singleton
 bool InitializeCuttlefishConfiguration(
-    const cvd::BootImageUnpacker& boot_image_unpacker) {
+    const cvd::BootImageUnpacker& boot_image_unpacker,
+    const cvd::FetcherConfig& fetcher_config) {
   vsoc::CuttlefishConfig tmp_config_obj;
-  auto& memory_layout = *vsoc::VSoCMemoryLayout::Get();
   // Set this first so that calls to PerInstancePath below are correct
   tmp_config_obj.set_instance_dir(FLAGS_instance_dir);
   if (!vm_manager::VmManager::IsValidName(FLAGS_vm_manager)) {
@@ -300,18 +299,20 @@
   tmp_config_obj.set_num_screen_buffers(FLAGS_num_screen_buffers);
   tmp_config_obj.set_refresh_rate_hz(FLAGS_refresh_rate_hz);
   tmp_config_obj.set_gdb_flag(FLAGS_qemu_gdb);
-  std::vector<std::string> adb = cvd::StrSplit(FLAGS_adb_mode, ',');
+  std::vector<std::string> adb = android::base::Split(FLAGS_adb_mode, ",");
   tmp_config_obj.set_adb_mode(std::set<std::string>(adb.begin(), adb.end()));
   tmp_config_obj.set_host_port(GetHostPort());
   tmp_config_obj.set_adb_ip_and_port("127.0.0.1:" + std::to_string(GetHostPort()));
 
   tmp_config_obj.set_device_title(FLAGS_device_title);
-  if (FLAGS_kernel_path.size()) {
-    tmp_config_obj.set_kernel_image_path(FLAGS_kernel_path);
+  std::string discovered_kernel = fetcher_config.FindCvdFileWithSuffix(kKernelDefaultPath);
+  std::string foreign_kernel = FLAGS_kernel_path.size() ? FLAGS_kernel_path : discovered_kernel;
+  if (foreign_kernel.size()) {
+    tmp_config_obj.set_kernel_image_path(foreign_kernel);
     tmp_config_obj.set_use_unpacked_kernel(false);
   } else {
     tmp_config_obj.set_kernel_image_path(
-        tmp_config_obj.PerInstancePath("kernel"));
+        tmp_config_obj.PerInstancePath(kKernelDefaultPath.c_str()));
     tmp_config_obj.set_use_unpacked_kernel(true);
   }
   tmp_config_obj.set_decompress_kernel(FLAGS_decompress_kernel);
@@ -321,30 +322,13 @@
   }
 
   auto ramdisk_path = tmp_config_obj.PerInstancePath("ramdisk.img");
-  bool use_ramdisk = boot_image_unpacker.HasRamdiskImage();
-  if (!use_ramdisk) {
-    LOG(INFO) << "No ramdisk present; assuming system-as-root build";
-    ramdisk_path = "";
+  auto vendor_ramdisk_path = tmp_config_obj.PerInstancePath("vendor_ramdisk.img");
+  if (!boot_image_unpacker.HasRamdiskImage()) {
+    LOG(INFO) << "A ramdisk is required, but the boot image did not have one.";
+    return false;
   }
 
   tmp_config_obj.add_kernel_cmdline(boot_image_unpacker.kernel_cmdline());
-
-  if (use_ramdisk) {
-    if (FLAGS_composite_disk.empty()) {
-      tmp_config_obj.add_kernel_cmdline("androidboot.fstab_name=fstab");
-    } else {
-      tmp_config_obj.add_kernel_cmdline("androidboot.fstab_name=fstab.composite");
-    }
-  } else {
-    if (FLAGS_composite_disk.empty()) {
-      tmp_config_obj.add_kernel_cmdline("root=/dev/vda");
-      tmp_config_obj.add_kernel_cmdline("androidboot.fstab_name=fstab");
-    } else {
-      tmp_config_obj.add_kernel_cmdline("root=/dev/vda1");
-      tmp_config_obj.add_kernel_cmdline("androidboot.fstab_name=fstab.composite");
-    }
-  }
-
   tmp_config_obj.add_kernel_cmdline("init=/init");
   tmp_config_obj.add_kernel_cmdline(
       concat("androidboot.serialno=", FLAGS_serial_number));
@@ -382,38 +366,33 @@
       tmp_config_obj.add_kernel_cmdline("audit=0");
     }
   }
-  if (FLAGS_run_e2e_test) {
-    tmp_config_obj.add_kernel_cmdline("androidboot.vsoc_e2e_test=1");
-  }
   if (FLAGS_extra_kernel_cmdline.size()) {
     tmp_config_obj.add_kernel_cmdline(FLAGS_extra_kernel_cmdline);
   }
 
-  if (!FLAGS_composite_disk.empty()) {
-    tmp_config_obj.set_virtual_disk_paths({FLAGS_composite_disk});
-  } else {
-    tmp_config_obj.set_virtual_disk_paths({
-      FLAGS_super_image,
-      FLAGS_data_image,
-      FLAGS_cache_image,
-      FLAGS_metadata_image,
-    });
-  }
+  tmp_config_obj.set_virtual_disk_paths({FLAGS_composite_disk});
 
   tmp_config_obj.set_ramdisk_image_path(ramdisk_path);
-  if(FLAGS_initramfs_path.size() > 0) {
-    tmp_config_obj.set_initramfs_path(FLAGS_initramfs_path);
-    tmp_config_obj.set_final_ramdisk_path(ramdisk_path + kRamdiskConcatExt);
-  } else {
-    tmp_config_obj.set_final_ramdisk_path(ramdisk_path);
-  }
+  tmp_config_obj.set_vendor_ramdisk_image_path(vendor_ramdisk_path);
 
-  tmp_config_obj.set_mempath(FLAGS_mempath);
-  tmp_config_obj.set_ivshmem_qemu_socket_path(
-      tmp_config_obj.PerInstanceInternalPath("ivshmem_socket_qemu"));
-  tmp_config_obj.set_ivshmem_client_socket_path(
-      tmp_config_obj.PerInstanceInternalPath("ivshmem_socket_client"));
-  tmp_config_obj.set_ivshmem_vector_count(memory_layout.GetRegions().size());
+  // Boot as recovery is set so normal boot needs to be forced every boot
+  tmp_config_obj.add_kernel_cmdline("androidboot.force_normal_boot=1");
+
+  std::string discovered_ramdisk = fetcher_config.FindCvdFileWithSuffix(kInitramfsImg);
+  std::string foreign_ramdisk = FLAGS_initramfs_path.size () ? FLAGS_initramfs_path : discovered_ramdisk;
+  if (foreign_kernel.size() && !foreign_ramdisk.size()) {
+    // If there's a kernel that's passed in without an initramfs, that implies
+    // user error or a kernel built with no modules. In either case, let's
+    // choose to avoid loading the modules from the vendor ramdisk which are
+    // built for the default cf kernel. Once boot occurs, user error will
+    // become obvious.
+    tmp_config_obj.set_final_ramdisk_path(ramdisk_path);
+  } else {
+    tmp_config_obj.set_final_ramdisk_path(ramdisk_path + kRamdiskConcatExt);
+    if(foreign_ramdisk.size()) {
+      tmp_config_obj.set_initramfs_path(foreign_ramdisk);
+    }
+  }
 
   if (tmp_config_obj.adb_mode().count(vsoc::AdbMode::Usb) > 0) {
     tmp_config_obj.set_usb_v1_socket_name(
@@ -449,17 +428,12 @@
   tmp_config_obj.set_qemu_binary(FLAGS_qemu_binary);
   tmp_config_obj.set_crosvm_binary(FLAGS_crosvm_binary);
   tmp_config_obj.set_console_forwarder_binary(FLAGS_console_forwarder_binary);
-  tmp_config_obj.set_ivserver_binary(FLAGS_ivserver_binary);
   tmp_config_obj.set_kernel_log_monitor_binary(FLAGS_kernel_log_monitor_binary);
 
   tmp_config_obj.set_enable_vnc_server(FLAGS_start_vnc_server);
   tmp_config_obj.set_vnc_server_binary(FLAGS_vnc_server_binary);
   tmp_config_obj.set_vnc_server_port(FLAGS_vnc_server_port);
 
-  tmp_config_obj.set_enable_stream_audio(FLAGS_start_stream_audio);
-  tmp_config_obj.set_stream_audio_binary(FLAGS_stream_audio_binary);
-  tmp_config_obj.set_stream_audio_port(FLAGS_stream_audio_port);
-
   tmp_config_obj.set_restart_subprocesses(FLAGS_restart_subprocesses);
   tmp_config_obj.set_run_adb_connector(FLAGS_run_adb_connector);
   tmp_config_obj.set_adb_connector_binary(FLAGS_adb_connector_binary);
@@ -469,8 +443,6 @@
       FLAGS_socket_forward_proxy_binary);
   tmp_config_obj.set_socket_vsock_proxy_binary(FLAGS_socket_vsock_proxy_binary);
   tmp_config_obj.set_run_as_daemon(FLAGS_daemon);
-  tmp_config_obj.set_run_e2e_test(FLAGS_run_e2e_test);
-  tmp_config_obj.set_e2e_test_binary(FLAGS_e2e_test_binary);
 
   tmp_config_obj.set_data_policy(FLAGS_data_policy);
   tmp_config_obj.set_blank_data_image_mb(FLAGS_blank_data_image_mb);
@@ -484,7 +456,7 @@
   tmp_config_obj.set_logcat_vsock_port(FLAGS_logcat_vsock_port);
   tmp_config_obj.set_config_server_port(FLAGS_config_server_port);
   tmp_config_obj.set_frames_vsock_port(FLAGS_frames_vsock_port);
-  if (!tmp_config_obj.enable_ivserver() && tmp_config_obj.enable_vnc_server()) {
+  if (tmp_config_obj.enable_vnc_server()) {
     tmp_config_obj.add_kernel_cmdline(concat("androidboot.vsock_frames_port=",
                                              FLAGS_frames_vsock_port));
   }
@@ -502,9 +474,32 @@
     tmp_config_obj.add_kernel_cmdline("androidboot.tombstone_transmit=0");
   }
 
+  tmp_config_obj.set_touch_socket_port(FLAGS_touch_server_port);
+  tmp_config_obj.set_keyboard_socket_port(FLAGS_keyboard_server_port);
+  if (FLAGS_vm_manager == vm_manager::QemuManager::name()) {
+    tmp_config_obj.add_kernel_cmdline(concat("androidboot.vsock_touch_port=",
+                                             FLAGS_touch_server_port));
+    tmp_config_obj.add_kernel_cmdline(concat("androidboot.vsock_keyboard_port=",
+                                             FLAGS_keyboard_server_port));
+  }
+
   tmp_config_obj.set_use_bootloader(FLAGS_use_bootloader);
   tmp_config_obj.set_bootloader(FLAGS_bootloader);
 
+  if (!FLAGS_boot_slot.empty()) {
+      tmp_config_obj.set_boot_slot(FLAGS_boot_slot);
+  }
+
+  if (!FLAGS_use_bootloader) {
+    std::string slot_suffix;
+    if (FLAGS_boot_slot.empty()) {
+      slot_suffix = "_a";
+    } else {
+      slot_suffix = "_" + FLAGS_boot_slot;
+    }
+    tmp_config_obj.add_kernel_cmdline("androidboot.slot_suffix=" + slot_suffix);
+  }
+
   tmp_config_obj.set_cuttlefish_env_path(GetCuttlefishEnvPath());
 
   auto config_file = GetConfigFilePath(tmp_config_obj);
@@ -525,42 +520,20 @@
 }
 
 void SetDefaultFlagsForQemu() {
-  auto default_mobile_interface = GetPerInstanceDefault("cvd-mbr-");
-  SetCommandLineOptionWithMode("mobile_interface",
-                               default_mobile_interface.c_str(),
-                               google::FlagSettingMode::SET_FLAGS_DEFAULT);
-  auto default_mobile_tap_name = GetPerInstanceDefault("cvd-mtap-");
-  SetCommandLineOptionWithMode("mobile_tap_name",
-                               default_mobile_tap_name.c_str(),
-                               google::FlagSettingMode::SET_FLAGS_DEFAULT);
-  auto default_wifi_tap_name = GetPerInstanceDefault("cvd-wtap-");
-  SetCommandLineOptionWithMode("wifi_tap_name",
-                               default_wifi_tap_name.c_str(),
-                               google::FlagSettingMode::SET_FLAGS_DEFAULT);
   auto default_instance_dir =
       cvd::StringFromEnv("HOME", ".") + "/cuttlefish_runtime";
   SetCommandLineOptionWithMode("instance_dir",
                                default_instance_dir.c_str(),
                                google::FlagSettingMode::SET_FLAGS_DEFAULT);
-  SetCommandLineOptionWithMode("hardware_name", "cutf_ivsh",
+  // TODO(b/144111429): Consolidate to one hardware name
+  SetCommandLineOptionWithMode("hardware_name", "cutf_cvm",
                                google::FlagSettingMode::SET_FLAGS_DEFAULT);
-  SetCommandLineOptionWithMode("logcat_mode", cvd::kLogcatSerialMode,
+  // TODO(b/144119457) Use the serial port.
+  SetCommandLineOptionWithMode("logcat_mode", cvd::kLogcatVsockMode,
                                google::FlagSettingMode::SET_FLAGS_DEFAULT);
 }
 
 void SetDefaultFlagsForCrosvm() {
-  auto default_mobile_interface = GetPerInstanceDefault("cvd-mbr-");
-  SetCommandLineOptionWithMode("mobile_interface",
-                               default_mobile_interface.c_str(),
-                               google::FlagSettingMode::SET_FLAGS_DEFAULT);
-  auto default_mobile_tap_name = GetPerInstanceDefault("cvd-mtap-");
-  SetCommandLineOptionWithMode("mobile_tap_name",
-                               default_mobile_tap_name.c_str(),
-                               google::FlagSettingMode::SET_FLAGS_DEFAULT);
-  auto default_wifi_tap_name = GetPerInstanceDefault("cvd-wtap-");
-  SetCommandLineOptionWithMode("wifi_tap_name",
-                               default_wifi_tap_name.c_str(),
-                               google::FlagSettingMode::SET_FLAGS_DEFAULT);
   auto default_instance_dir =
       cvd::StringFromEnv("HOME", ".") + "/cuttlefish_runtime";
   SetCommandLineOptionWithMode("instance_dir",
@@ -572,10 +545,9 @@
   SetCommandLineOptionWithMode("x_display",
                                getenv("DISPLAY"),
                                google::FlagSettingMode::SET_FLAGS_DEFAULT);
+  // TODO(b/144111429): Consolidate to one hardware name
   SetCommandLineOptionWithMode("hardware_name", "cutf_cvm",
                                google::FlagSettingMode::SET_FLAGS_DEFAULT);
-  SetCommandLineOptionWithMode("run_e2e_test", "false",
-                               google::FlagSettingMode::SET_FLAGS_DEFAULT);
   SetCommandLineOptionWithMode("logcat_mode", cvd::kLogcatVsockMode,
                                google::FlagSettingMode::SET_FLAGS_DEFAULT);
 }
@@ -605,8 +577,6 @@
 bool CleanPriorFiles() {
   // Everything on the instance directory
   std::string prior_files = FLAGS_instance_dir + "/*";
-  // The shared memory file
-  prior_files += " " + FLAGS_mempath;
   // The environment file
   prior_files += " " + GetCuttlefishEnvPath();
   // The global link to the config file
@@ -684,9 +654,6 @@
 }
 
 bool ShouldCreateCompositeDisk() {
-  if (FLAGS_composite_disk.empty()) {
-    return false;
-  }
   if (FLAGS_vm_manager == vm_manager::CrosvmManager::name()) {
     // The crosvm implementation is very fast to rebuild but also more brittle due to being split
     // into multiple files. The QEMU implementation is slow to build, but completely self-contained
@@ -773,9 +740,16 @@
     exit(cvd::kCuttlefishConfigurationInitError);
   }
 
-  auto boot_img_unpacker = cvd::BootImageUnpacker::FromImage(FLAGS_boot_image);
+  if (!cvd::FileHasContent(FLAGS_vendor_boot_image)) {
+    LOG(ERROR) << "File not found: " << FLAGS_vendor_boot_image;
+    exit(cvd::kCuttlefishConfigurationInitError);
+  }
 
-  if (!InitializeCuttlefishConfiguration(*boot_img_unpacker)) {
+  auto boot_img_unpacker =
+    cvd::BootImageUnpacker::FromImages(FLAGS_boot_image,
+                                       FLAGS_vendor_boot_image);
+
+  if (!InitializeCuttlefishConfiguration(*boot_img_unpacker, fetcher_config)) {
     LOG(ERROR) << "Failed to initialize configuration";
     exit(AssemblerExitCodes::kCuttlefishConfigurationInitError);
   }
@@ -787,6 +761,7 @@
   }
 
   if (!boot_img_unpacker->Unpack(config->ramdisk_image_path(),
+                                 config->vendor_ramdisk_image_path(),
                                  config->use_unpacked_kernel()
                                      ? config->kernel_image_path()
                                      : "")) {
@@ -794,10 +769,30 @@
     exit(AssemblerExitCodes::kBootImageUnpackError);
   }
 
-  if(config->initramfs_path().size() != 0) {
-    if(!ConcatRamdisks(config->final_ramdisk_path(), config->ramdisk_image_path(),
-        config->initramfs_path())) {
-      LOG(ERROR) << "Failed to concatenate ramdisk and initramfs";
+  // TODO(134522463) as part of the bootloader refactor, repack the vendor boot
+  // image and use the bootloader to load both the boot and vendor ramdisk.
+  // Until then, this hack to get gki modules into cuttlefish will suffice.
+
+  // If a vendor ramdisk comes in via this mechanism, let it supercede the one
+  // in the vendor boot image. This flag is what kernel presubmit testing uses
+  // to pass in the kernel ramdisk.
+
+  // If no kernel is passed in or an initramfs is made available, the default
+  // vendor boot ramdisk or the initramfs provided should be appended to the
+  // boot ramdisk. If a kernel IS provided with no initramfs, it is safe to
+  // safe to assume that the kernel was built with no modules and expects no
+  // modules for cf to run properly.
+  std::string discovered_kernel = fetcher_config.FindCvdFileWithSuffix(kKernelDefaultPath);
+  std::string foreign_kernel = FLAGS_kernel_path.size() ? FLAGS_kernel_path : discovered_kernel;
+  std::string discovered_ramdisk = fetcher_config.FindCvdFileWithSuffix(kInitramfsImg);
+  std::string foreign_ramdisk = FLAGS_initramfs_path.size () ? FLAGS_initramfs_path : discovered_ramdisk;
+  if(!foreign_kernel.size() || foreign_ramdisk.size()) {
+    const std::string& vendor_ramdisk_path =
+      config->initramfs_path().size() ? config->initramfs_path()
+                                      : config->vendor_ramdisk_image_path();
+    if(!ConcatRamdisks(config->final_ramdisk_path(),
+                       config->ramdisk_image_path(), vendor_ramdisk_path)) {
+      LOG(ERROR) << "Failed to concatenate ramdisk and vendor ramdisk";
       exit(AssemblerExitCodes::kInitRamFsConcatError);
     }
   }
diff --git a/host/commands/assemble_cvd/super_image_mixer.cc b/host/commands/assemble_cvd/super_image_mixer.cc
index 061497f..1960d41 100644
--- a/host/commands/assemble_cvd/super_image_mixer.cc
+++ b/host/commands/assemble_cvd/super_image_mixer.cc
@@ -15,15 +15,17 @@
 
 #include "super_image_mixer.h"
 
+#include <sys/stat.h>
+
+#include <algorithm>
 #include <cstdio>
 #include <functional>
 #include <memory>
 
+#include <android-base/strings.h>
 #include <glog/logging.h>
 
-#include "ziparchive/zip_archive.h"
-#include "ziparchive/zip_writer.h"
-
+#include "common/libs/utils/archive.h"
 #include "common/libs/utils/files.h"
 #include "common/libs/utils/subprocess.h"
 #include "host/libs/config/cuttlefish_config.h"
@@ -37,152 +39,90 @@
 std::string TargetFilesZip(const cvd::FetcherConfig& fetcher_config,
                            cvd::FileSource source) {
   for (const auto& file_iter : fetcher_config.get_cvd_files()) {
-    if (file_iter.second.source != source) {
+    const auto& file_path = file_iter.first;
+    const auto& file_info = file_iter.second;
+    if (file_info.source != source) {
       continue;
     }
-    std::string expected_substr = "target_files-" + file_iter.second.build_id + ".zip";
-    auto expected_pos = file_iter.first.size() - expected_substr.size();
-    if (file_iter.first.rfind(expected_substr) == expected_pos) {
-      return file_iter.first;
+    std::string expected_filename = "target_files-" + file_iter.second.build_id + ".zip";
+    if (!android::base::EndsWith(file_path, expected_filename)) {
+      continue;
     }
+    return file_path;;
   }
   return "";
 }
 
-class ZipArchiveDeleter {
-public:
-  void operator()(ZipArchive* archive) {
-    CloseArchive(archive);
-  }
-};
-
-using ManagedZipArchive = std::unique_ptr<ZipArchive, ZipArchiveDeleter>;
-
-class CFileCloser {
-public:
-  void operator()(FILE* file) {
-    fclose(file);
-  }
-};
-
-using ManagedCFile = std::unique_ptr<FILE, CFileCloser>;
-
-ManagedZipArchive OpenZipArchive(const std::string& path) {
-  ZipArchive* ptr;
-  int status = OpenArchive(path.c_str(), &ptr);
-  if (status != 0) {
-    LOG(ERROR) << "Could not open archive \"" << path << "\": " << status;
-    return {};
-  }
-  return ManagedZipArchive(ptr);
-}
-
-ManagedCFile OpenFile(const std::string& path, const std::string& mode) {
-  FILE* ptr = fopen(path.c_str(), mode.c_str());
-  if (ptr == nullptr) {
-    int error_num = errno;
-    LOG(ERROR) << "Could not open \"" << path << "\". Error was "
-               << strerror(error_num);
-    return {};
-  }
-  return ManagedCFile(ptr);
-}
-
 const std::string kMiscInfoPath = "META/misc_info.txt";
-const std::string kSystemPath = "IMAGES/system.img";
-const std::string kSystemExtPath = "IMAGES/system_ext.img";
-
-bool CopyZipFileContents(const uint8_t* buf, size_t buf_size, void* cookie) {
-  ZipWriter* out_writer = (ZipWriter*) cookie;
-  int32_t status = out_writer->WriteBytes(buf, buf_size);
-  if (status != 0) {
-    LOG(ERROR) << "Could not write zip file contents, error code " << status;
-    return false;
-  }
-  return true;
-}
+const std::set<std::string> kDefaultTargetImages = {
+  "IMAGES/boot.img",
+  "IMAGES/cache.img",
+  "IMAGES/recovery.img",
+  "IMAGES/userdata.img",
+  "IMAGES/vendor.img",
+};
 
 bool CombineTargetZipFiles(const std::string& default_target_zip,
                            const std::string& system_target_zip,
                            const std::string& output_path) {
-  auto default_target = OpenZipArchive(default_target_zip);
-  if (!default_target) {
+  cvd::Archive default_target_archive(default_target_zip);
+  cvd::Archive system_target_archive(system_target_zip);
+
+  auto default_target_contents = default_target_archive.Contents();
+  if (default_target_contents.size() == 0) {
     LOG(ERROR) << "Could not open " << default_target_zip;
     return false;
   }
-  auto system_target = OpenZipArchive(system_target_zip);
-  if (!system_target) {
+  auto system_target_contents = system_target_archive.Contents();
+  if (system_target_contents.size() == 0) {
     LOG(ERROR) << "Could not open " << system_target_zip;
     return false;
   }
-  auto out_file = OpenFile(output_path, "wb");
-  if (!out_file) {
-    LOG(ERROR) << "Could not open " << output_path;
-    return false;
-  }
-  ZipWriter out_writer{out_file.get()};
-
-  ZipEntry entry;
-  if (FindEntry(system_target.get(), kSystemPath, &entry) != 0) {
-    LOG(ERROR) << "System target files zip does not have " << kSystemPath;
+  if (mkdir(output_path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) {
+    LOG(ERROR) << "Could not create directory " << output_path;
     return false;
   }
 
-  if (FindEntry(default_target.get(), kMiscInfoPath, &entry) != 0) {
+  if (std::find(default_target_contents.begin(), default_target_contents.end(), kMiscInfoPath)
+      == default_target_contents.end()) {
     LOG(ERROR) << "Default target files zip does not have " << kMiscInfoPath;
     return false;
   }
-  out_writer.StartEntry(kMiscInfoPath, 0);
-  ProcessZipEntryContents(
-      default_target.get(), &entry, CopyZipFileContents, (void*) &out_writer);
-  out_writer.FinishEntry();
-
-  bool system_target_has_ext =
-      FindEntry(system_target.get(), kSystemExtPath, &entry) == 0;
-
-  void* iteration_cookie;
-  std::string name;
-
-  StartIteration(default_target.get(), &iteration_cookie, "IMAGES/", ".img");
-  for (int status = 0; status != -1; status = Next(iteration_cookie, &entry, &name)) {
-    if (name == "") {
-      continue;
-    }
-    LOG(INFO) << "Name is \"" << name << "\"";
-    if (name == kSystemPath) {
-      continue;
-    } else if (system_target_has_ext && name == kSystemExtPath) {
-      continue;
-    }
-    LOG(INFO) << "Writing " << name;
-    out_writer.StartEntry(name, 0);
-    ProcessZipEntryContents(
-        default_target.get(), &entry, CopyZipFileContents, (void*) &out_writer);
-    out_writer.FinishEntry();
-  }
-  EndIteration(iteration_cookie);
-
-  StartIteration(system_target.get(), &iteration_cookie, "IMAGES/", ".img");
-  for (int status = 0; status != -1; status = Next(iteration_cookie, &entry, &name)) {
-    bool is_system_image = name == kSystemPath;
-    bool is_system_ext_image = name == kSystemExtPath;
-    if (!is_system_image && !is_system_ext_image) {
-      continue;
-    }
-    LOG(INFO) << "Writing " << name;
-    out_writer.StartEntry(name, 0);
-    ProcessZipEntryContents(
-        system_target.get(), &entry, CopyZipFileContents, (void*) &out_writer);
-    out_writer.FinishEntry();
-  }
-  EndIteration(iteration_cookie);
-
-  int success = out_writer.Finish();
-  if (success != 0) {
-    LOG(ERROR) << "Unable to write combined image zip archive: " << success;
+  if (!default_target_archive.ExtractFiles({kMiscInfoPath}, output_path)) {
+    LOG(ERROR) << "Failed to write misc info to output directory";
     return false;
   }
 
+  for (const auto& name : default_target_contents) {
+    if (!android::base::StartsWith(name, "IMAGES/")) {
+      continue;
+    } else if (!android::base::EndsWith(name, ".img")) {
+      continue;
+    } else if (kDefaultTargetImages.count(name) == 0) {
+      continue;
+    }
+    LOG(INFO) << "Writing " << name;
+    if (!default_target_archive.ExtractFiles({name}, output_path)) {
+      LOG(ERROR) << "Failed to extract " << name << " from the default target zip";
+      return false;
+    }
+  }
+
+  for (const auto& name : system_target_contents) {
+    if (!android::base::StartsWith(name, "IMAGES/")) {
+      continue;
+    } else if (!android::base::EndsWith(name, ".img")) {
+      continue;
+    } else if (kDefaultTargetImages.count(name) > 0) {
+      continue;
+    }
+    LOG(INFO) << "Writing " << name;
+    if (!system_target_archive.ExtractFiles({name}, output_path)) {
+      LOG(ERROR) << "Failed to extract " << name << " from the system target zip";
+      return false;
+    }
+  }
+
   return true;
 }
 
@@ -241,14 +181,14 @@
     LOG(ERROR) << "Unable to find system target zip file.";
     return false;
   }
-  std::string combined_target_zip = config.PerInstancePath("target_combined.zip");
+  std::string combined_target_path = config.PerInstanceInternalPath("target_combined");
   // TODO(schuffelen): Use otatools/bin/merge_target_files
   if (!CombineTargetZipFiles(default_target_zip, system_target_zip,
-                             combined_target_zip)) {
+                             combined_target_path)) {
     LOG(ERROR) << "Could not combine target zip files.";
     return false;
   }
-  bool success = BuildSuperImage(combined_target_zip, output_path);
+  bool success = BuildSuperImage(combined_target_path, output_path);
   if (!success) {
     LOG(ERROR) << "Could not write the final output super image.";
   }
diff --git a/host/commands/config_server/Android.bp b/host/commands/config_server/Android.bp
index 07d832a..fcf6d39 100644
--- a/host/commands/config_server/Android.bp
+++ b/host/commands/config_server/Android.bp
@@ -26,7 +26,6 @@
         "libcuttlefish_fs",
         "liblog",
         "libcuttlefish_utils",
-        "cuttlefish_auto_resources",
         "libcuttlefish_device_config",
     ],
     static_libs: [
diff --git a/host/commands/console_forwarder/Android.bp b/host/commands/console_forwarder/Android.bp
index 57dacfe..a090e98 100644
--- a/host/commands/console_forwarder/Android.bp
+++ b/host/commands/console_forwarder/Android.bp
@@ -25,7 +25,6 @@
         "libbase",
         "libcuttlefish_fs",
         "libcuttlefish_utils",
-        "cuttlefish_auto_resources",
     ],
     static_libs: [
         "libcuttlefish_host_config",
diff --git a/host/frontend/stream_audio/Android.bp b/host/commands/cvd_status/Android.bp
similarity index 79%
rename from host/frontend/stream_audio/Android.bp
rename to host/commands/cvd_status/Android.bp
index 8f07536..3b1cbbc 100644
--- a/host/frontend/stream_audio/Android.bp
+++ b/host/commands/cvd_status/Android.bp
@@ -14,25 +14,24 @@
 // limitations under the License.
 
 cc_binary_host {
-    name: "stream_audio",
+    name: "cvd_status",
     srcs: [
-        "main.cpp",
+        "cvd_status.cc",
+    ],
+    header_libs: [
+        "cuttlefish_glog",
     ],
     shared_libs: [
-        "cuttlefish_tcp_socket",
         "libbase",
-        "libcuttlefish_utils",
         "libcuttlefish_fs",
-        "libopus",
-        "vsoc_lib",
+        "libcuttlefish_utils",
     ],
     static_libs: [
         "libcuttlefish_host_config",
+        "libcuttlefish_vm_manager",
         "libjsoncpp",
         "libgflags",
-        "libopuscpp",
+        "libxml2",
     ],
-    cpp_std: "c++17",
-    enabled: false,
-    defaults: ["cuttlefish_host_only"],
+    defaults: ["cuttlefish_host_only", "cuttlefish_libicuuc"],
 }
diff --git a/host/commands/cvd_status/cvd_status.cc b/host/commands/cvd_status/cvd_status.cc
new file mode 100644
index 0000000..fb9911f
--- /dev/null
+++ b/host/commands/cvd_status/cvd_status.cc
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2018 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 <inttypes.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <signal.h>
+
+#include <algorithm>
+#include <cstdlib>
+#include <fstream>
+#include <iomanip>
+#include <memory>
+#include <sstream>
+#include <string>
+#include <vector>
+
+#include <gflags/gflags.h>
+#include <glog/logging.h>
+
+#include "common/libs/fs/shared_fd.h"
+#include "common/libs/fs/shared_select.h"
+#include "common/libs/utils/environment.h"
+#include "host/commands/run_cvd/runner_defs.h"
+#include "host/libs/config/cuttlefish_config.h"
+#include "host/libs/vm_manager/vm_manager.h"
+
+DEFINE_int32(wait_for_launcher, 5,
+             "How many seconds to wait for the launcher to respond to the status "
+             "command. A value of zero means wait indefinetly");
+
+int main(int argc, char** argv) {
+  ::android::base::InitLogging(argv, android::base::StderrLogger);
+  google::ParseCommandLineFlags(&argc, &argv, true);
+
+  auto config = vsoc::CuttlefishConfig::Get();
+  if (!config) {
+    LOG(ERROR) << "Failed to obtain config object";
+    return 1;
+  }
+
+  auto monitor_path = config->launcher_monitor_socket_path();
+  if (monitor_path.empty()) {
+    LOG(ERROR) << "No path to launcher monitor found";
+    return 2;
+  }
+  auto monitor_socket = cvd::SharedFD::SocketLocalClient(monitor_path.c_str(),
+                                                         false, SOCK_STREAM);
+  if (!monitor_socket->IsOpen()) {
+    LOG(ERROR) << "Unable to connect to launcher monitor at " << monitor_path
+               << ": " << monitor_socket->StrError();
+    return 3;
+  }
+  auto request = cvd::LauncherAction::kStatus;
+  auto bytes_sent = monitor_socket->Send(&request, sizeof(request), 0);
+  if (bytes_sent < 0) {
+    LOG(ERROR) << "Error sending launcher monitor the status command: "
+               << monitor_socket->StrError();
+    return 4;
+  }
+  // Perform a select with a timeout to guard against launcher hanging
+  cvd::SharedFDSet read_set;
+  read_set.Set(monitor_socket);
+  struct timeval timeout = {FLAGS_wait_for_launcher, 0};
+  int selected = cvd::Select(&read_set, nullptr, nullptr,
+                             FLAGS_wait_for_launcher <= 0 ? nullptr : &timeout);
+  if (selected < 0){
+    LOG(ERROR) << "Failed communication with the launcher monitor: "
+               << strerror(errno);
+    return 5;
+  }
+  if (selected == 0) {
+    LOG(ERROR) << "Timeout expired waiting for launcher monitor to respond";
+    return 6;
+  }
+  cvd::LauncherResponse response;
+  auto bytes_recv = monitor_socket->Recv(&response, sizeof(response), 0);
+  if (bytes_recv < 0) {
+    LOG(ERROR) << "Error receiving response from launcher monitor: "
+               << monitor_socket->StrError();
+    return 7;
+  }
+  if (response != cvd::LauncherResponse::kSuccess) {
+    LOG(ERROR) << "Received '" << static_cast<char>(response)
+               << "' response from launcher monitor";
+    return 8;
+  }
+  LOG(INFO) << "run_cvd is active.";
+  return 0;
+}
diff --git a/host/commands/fetcher/Android.bp b/host/commands/fetcher/Android.bp
index 786455f..0677d76 100644
--- a/host/commands/fetcher/Android.bp
+++ b/host/commands/fetcher/Android.bp
@@ -27,11 +27,9 @@
     ],
     stl: "libc++_static",
     static_libs: [
-        "cuttlefish_auto_resources",
         "libbase",
         "libcuttlefish_host_config",
         "libcuttlefish_fs",
-        "libcuttlefish_strings",
         "libcuttlefish_utils",
         "libcurl",
         "libcrypto",
diff --git a/host/commands/ivserver/Android.bp b/host/commands/ivserver/Android.bp
deleted file mode 100644
index 4fc47a9..0000000
--- a/host/commands/ivserver/Android.bp
+++ /dev/null
@@ -1,83 +0,0 @@
-//
-// Copyright (C) 2017 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-cc_library_host_static {
-    name: "libivserver",
-    srcs: [
-        "hald_client.cc",
-        "ivserver.cc",
-        "options.cc",
-        "qemu_client.cc",
-        "vsocsharedmem.cc",
-    ],
-    header_libs: [
-        "cuttlefish_glog",
-    ],
-    shared_libs: [
-        "libbase",
-        "vsoc_lib",
-    ],
-    static_libs: [
-        "libjsoncpp",
-    ],
-    defaults: ["cuttlefish_host_only"],
-}
-
-cc_test_host {
-    name: "hald_client_test",
-    srcs: [
-        "hald_client_test.cc",
-    ],
-    header_libs: [
-        "cuttlefish_glog",
-    ],
-    shared_libs: [
-        "libcuttlefish_fs",
-        "cuttlefish_auto_resources",
-        "libbase",
-        "vsoc_lib",
-    ],
-    static_libs: [
-        "libivserver",
-        "libjsoncpp",
-        "libgmock",
-    ],
-    defaults: ["cuttlefish_host_only"],
-}
-
-cc_binary_host {
-    name: "ivserver",
-    srcs: [
-        "main.cpp",
-    ],
-    header_libs: [
-        "cuttlefish_glog",
-    ],
-    shared_libs: [
-        "vsoc_lib",
-        "libbase",
-        "libcuttlefish_fs",
-        "libcuttlefish_utils",
-        "cuttlefish_auto_resources",
-        "liblog",
-    ],
-    static_libs: [
-        "libcuttlefish_host_config",
-        "libivserver",
-        "libgflags",
-        "libjsoncpp",
-    ],
-    defaults: ["cuttlefish_host_only"],
-}
diff --git a/host/commands/ivserver/hald_client.cc b/host/commands/ivserver/hald_client.cc
deleted file mode 100644
index 98a83f6..0000000
--- a/host/commands/ivserver/hald_client.cc
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "host/commands/ivserver/hald_client.h"
-
-#include <string>
-
-#include <glog/logging.h>
-
-namespace ivserver {
-namespace {
-// The protocol between host-clients and the ivserver could change.
-// Clients should verify what version they are talking to during the handshake.
-const uint32_t kHaldClientProtocolVersion = 0;
-}  // anonymous namespace
-
-std::unique_ptr<HaldClient> HaldClient::New(const VSoCSharedMemory& shmem,
-                                            const cvd::SharedFD& clientfd) {
-  std::unique_ptr<HaldClient> res;
-
-  if (!clientfd->IsOpen()) {
-    LOG(WARNING) << "Invalid socket passed to HaldClient: "
-                 << clientfd->StrError();
-    return res;
-  }
-
-  res.reset(new HaldClient(clientfd));
-  if (!res->PerformHandshake(shmem)) {
-    LOG(ERROR) << "HalD handshake failed. Dropping connection.";
-    res.reset();
-  }
-
-  return res;
-}
-
-HaldClient::HaldClient(const cvd::SharedFD& client_socket)
-    : client_socket_(client_socket) {}
-
-bool HaldClient::PerformHandshake(const VSoCSharedMemory& shared_mem) {
-  int rval =
-      client_socket_->Send(&kHaldClientProtocolVersion,
-                           sizeof(kHaldClientProtocolVersion), MSG_NOSIGNAL);
-  if (rval != sizeof(kHaldClientProtocolVersion)) {
-    LOG(ERROR) << "failed to send protocol version: "
-               << client_socket_->StrError();
-    return false;
-  }
-
-  int16_t region_name_len;
-  if (client_socket_->Recv(&region_name_len, sizeof(region_name_len),
-                           MSG_NOSIGNAL) != sizeof(region_name_len)) {
-    LOG(ERROR) << "Error receiving region name length: "
-               << client_socket_->StrError();
-    return false;
-  }
-
-  if (region_name_len <= 0 ||
-      region_name_len > VSOC_DEVICE_NAME_SZ) {
-    LOG(ERROR) << "Invalid region length received: " << region_name_len;
-    return false;
-  }
-
-  std::vector<char> region_name_data(region_name_len);
-  rval = client_socket_->Recv(region_name_data.data(), region_name_len,
-                              MSG_NOSIGNAL);
-  if (rval != region_name_len) {
-    LOG(ERROR) << "Incomplete region name length received. Want: "
-               << region_name_len << ", got: " << rval;
-    return false;
-  }
-
-  std::string region_name(region_name_data.begin(), region_name_data.end());
-  LOG(INFO) << "New HALD requesting region: " << region_name;
-
-  // Send Host, Guest and SharedMemory FDs associated with this region.
-  cvd::SharedFD guest_to_host_efd;
-  cvd::SharedFD host_to_guest_efd;
-
-  if (!shared_mem.GetEventFdPairForRegion(region_name, &guest_to_host_efd,
-                                          &host_to_guest_efd)) {
-    LOG(ERROR) << "Region " << region_name << " was not found.";
-    return false;
-  }
-
-  if (!guest_to_host_efd->IsOpen()) {
-    LOG(ERROR) << "Host channel is not open; last known error: "
-               << guest_to_host_efd->StrError();
-    return false;
-  }
-
-  if (!host_to_guest_efd->IsOpen()) {
-    LOG(ERROR) << "Guest channel is not open; last known error: "
-               << host_to_guest_efd->StrError();
-    return false;
-  }
-
-  // TODO(ender): delete this once no longer necessary. Currently, absence of
-  // payload makes RecvMsgAndFDs hang forever.
-  uint64_t control_data = 0;
-  struct iovec vec {
-    &control_data, sizeof(control_data)
-  };
-  cvd::InbandMessageHeader hdr{nullptr, 0, &vec, 1, 0};
-  cvd::SharedFD fds[3] = {guest_to_host_efd, host_to_guest_efd,
-                          shared_mem.SharedMemFD()};
-  rval = client_socket_->SendMsgAndFDs<3>(hdr, MSG_NOSIGNAL, fds);
-  if (rval == -1) {
-    LOG(ERROR) << "failed to send Host FD: " << client_socket_->StrError();
-    return false;
-  }
-
-  LOG(INFO) << "HALD managing region: " << region_name << " connected.";
-  return true;
-}
-
-}  // namespace ivserver
diff --git a/host/commands/ivserver/hald_client.h b/host/commands/ivserver/hald_client.h
deleted file mode 100644
index 3b0fe2b..0000000
--- a/host/commands/ivserver/hald_client.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <inttypes.h>
-#include <unistd.h>
-#include <memory>
-
-#include "common/libs/fs/shared_fd.h"
-#include "host/commands/ivserver/vsocsharedmem.h"
-
-namespace ivserver {
-
-// Handles a HAL deamon client connection & handshake.
-class HaldClient final {
- public:
-  static std::unique_ptr<HaldClient> New(const VSoCSharedMemory &shared_mem,
-                                         const cvd::SharedFD &client_fd);
-
- private:
-  cvd::SharedFD client_socket_;
-
-  // Initialize new instance of HAL Client.
-  HaldClient(const cvd::SharedFD &client_fd);
-
-  // Perform handshake with HAL Client.
-  // If the region is not found approprate status (-1) is sent.
-  // Note that for every new client connected a unique ClientConnection object
-  // will be created and after the handshake it will be destroyed.
-  bool PerformHandshake(const VSoCSharedMemory &shared_mem);
-
-  HaldClient(const HaldClient &) = delete;
-  HaldClient &operator=(const HaldClient &) = delete;
-};
-
-}  // namespace ivserver
diff --git a/host/commands/ivserver/hald_client_test.cc b/host/commands/ivserver/hald_client_test.cc
deleted file mode 100644
index ee65530..0000000
--- a/host/commands/ivserver/hald_client_test.cc
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <stdlib.h>
-#include <memory>
-#include <string>
-#include <thread>
-
-#include <glog/logging.h>
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
-#include "common/libs/fs/shared_fd.h"
-#include "host/commands/ivserver/hald_client.h"
-#include "host/commands/ivserver/vsocsharedmem_mock.h"
-
-using ::testing::_;
-using ::testing::DoAll;
-using ::testing::Return;
-using ::testing::ReturnRef;
-using ::testing::SetArgPointee;
-
-namespace ivserver {
-namespace test {
-
-class HaldClientTest : public ::testing::Test {
- public:
-  void SetUp() override {
-    std::string socket_location;
-    ASSERT_TRUE(GetTempLocation(&socket_location))
-        << "Could not create temp file";
-    LOG(INFO) << "Temp file location: " << socket_location;
-
-    hald_server_socket_ = cvd::SharedFD::SocketLocalServer(
-        socket_location.c_str(), false, SOCK_STREAM, 0666);
-    test_socket_ = cvd::SharedFD::SocketLocalClient(socket_location.c_str(),
-                                                    false, SOCK_STREAM);
-    hald_socket_ =
-        cvd::SharedFD::Accept(*hald_server_socket_, nullptr, nullptr);
-
-    EXPECT_TRUE(hald_server_socket_->IsOpen());
-    EXPECT_TRUE(test_socket_->IsOpen());
-    EXPECT_TRUE(hald_socket_->IsOpen());
-  }
-
-  bool GetTempLocation(std::string* target) {
-    char temp_location[] = "/tmp/hald-client-test-XXXXXX";
-    mktemp(temp_location);
-    *target = temp_location;
-    if (target->size()) {
-      cleanup_files_.emplace_back(*target);
-      return true;
-    }
-    return false;
-  }
-
-  void TearDown() override {
-    hald_socket_->Close();
-    test_socket_->Close();
-    hald_server_socket_->Close();
-
-    for (const std::string& file : cleanup_files_) {
-      unlink(file.c_str());
-    }
-  }
-
- protected:
-  ::testing::NiceMock<VSoCSharedMemoryMock> vsoc_;
-
-  cvd::SharedFD hald_server_socket_;
-  cvd::SharedFD hald_socket_;
-  cvd::SharedFD test_socket_;
-
- private:
-  std::vector<std::string> cleanup_files_;
-};
-
-TEST_F(HaldClientTest, HandshakeTerminatedByHald) {
-  std::thread thread(
-      [this]() {
-        auto client(HaldClient::New(vsoc_, hald_socket_));
-        EXPECT_FALSE(client)
-            << "Handshake should not complete when client terminates early.";
-      });
-
-  test_socket_->Close();
-  thread.join();
-}
-
-TEST_F(HaldClientTest, HandshakeTerminatedByInvalidRegionSize) {
-  uint16_t sizes[] = {0, VSOC_DEVICE_NAME_SZ + 1, 0xffff};
-
-  for (uint16_t size : sizes) {
-    std::thread thread([this, size]() {
-      auto client(HaldClient::New(vsoc_, hald_socket_));
-      EXPECT_FALSE(client) << "Handle should not be created when size is "
-                           << size;
-    });
-
-    int32_t proto_version;
-    EXPECT_EQ(sizeof(proto_version),
-              static_cast<size_t>(test_socket_->Recv(
-                  &proto_version, sizeof(proto_version), MSG_NOSIGNAL)));
-
-    test_socket_->Send(&size, sizeof(size), MSG_NOSIGNAL);
-    thread.join();
-  }
-}
-
-TEST_F(HaldClientTest, FullSaneHandshake) {
-  std::string temp;
-  ASSERT_TRUE(GetTempLocation(&temp));
-  cvd::SharedFD host_fd(
-      cvd::SharedFD::Open(temp.c_str(), O_CREAT | O_RDWR, 0666));
-  EXPECT_TRUE(host_fd->IsOpen());
-
-  ASSERT_TRUE(GetTempLocation(&temp));
-  cvd::SharedFD guest_fd(
-      cvd::SharedFD::Open(temp.c_str(), O_CREAT | O_RDWR, 0666));
-  EXPECT_TRUE(guest_fd->IsOpen());
-
-  ASSERT_TRUE(GetTempLocation(&temp));
-  cvd::SharedFD shmem_fd(
-      cvd::SharedFD::Open(temp.c_str(), O_CREAT | O_RDWR, 0666));
-  EXPECT_TRUE(shmem_fd->IsOpen());
-
-  const std::string test_location("testing");
-  EXPECT_CALL(vsoc_, GetEventFdPairForRegion(test_location, _, _))
-      .WillOnce(DoAll(SetArgPointee<1>(host_fd), SetArgPointee<2>(guest_fd),
-                      Return(true)));
-  EXPECT_CALL(vsoc_, SharedMemFD()).WillOnce(ReturnRef(shmem_fd));
-
-  std::thread thread([this]() {
-    auto client(HaldClient::New(vsoc_, hald_socket_));
-    EXPECT_TRUE(client);
-  });
-
-  int32_t proto_version;
-  EXPECT_EQ(sizeof(proto_version),
-            static_cast<size_t>(test_socket_->Recv(
-                &proto_version, sizeof(proto_version), MSG_NOSIGNAL)));
-
-  uint16_t size = test_location.size();
-  EXPECT_EQ(sizeof(size), static_cast<size_t>(test_socket_->Send(
-                              &size, sizeof(size), MSG_NOSIGNAL)));
-  EXPECT_EQ(size, static_cast<size_t>(test_socket_->Send(test_location.data(),
-                                                         size, MSG_NOSIGNAL)));
-
-  // TODO(ender): delete this once no longer necessary. Currently, absence of
-  // payload makes RecvMsgAndFDs hang forever.
-  uint64_t control_data;
-  struct iovec vec {
-    &control_data, sizeof(control_data)
-  };
-  cvd::InbandMessageHeader hdr{nullptr, 0, &vec, 1, 0};
-  cvd::SharedFD fds[3];
-
-  EXPECT_GT(test_socket_->RecvMsgAndFDs<3>(hdr, MSG_NOSIGNAL, &fds), 0);
-  EXPECT_TRUE(fds[0]->IsOpen());
-  EXPECT_TRUE(fds[1]->IsOpen());
-  EXPECT_TRUE(fds[2]->IsOpen());
-
-  thread.join();
-}
-
-}  // namespace test
-}  // namespace ivserver
diff --git a/host/commands/ivserver/ivserver.cc b/host/commands/ivserver/ivserver.cc
deleted file mode 100644
index ca274cc..0000000
--- a/host/commands/ivserver/ivserver.cc
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "host/commands/ivserver/ivserver.h"
-
-#include <sys/select.h>
-#include <algorithm>
-
-#include <glog/logging.h>
-
-#include "common/libs/fs/shared_select.h"
-#include "host/commands/ivserver/hald_client.h"
-#include "host/commands/ivserver/qemu_client.h"
-
-namespace ivserver {
-
-IVServer::IVServer(const IVServerOptions &options, int qemu_channel_fd,
-                   int client_channel_fd)
-    : vsoc_shmem_(VSoCSharedMemory::New(options.shm_file_path)) {
-  if (qemu_channel_fd > 0) {
-    qemu_channel_ = cvd::SharedFD::Dup(qemu_channel_fd);
-  } else {
-    LOG_IF(WARNING, unlink(options.qemu_socket_path.c_str()) == 0)
-        << "Removed existing unix socket: " << options.qemu_socket_path
-        << ". We can't confirm yet whether another instance is running.";
-    qemu_channel_ = cvd::SharedFD::SocketLocalServer(
-        options.qemu_socket_path.c_str(), false, SOCK_STREAM, 0666);
-  }
-  LOG_IF(FATAL, !qemu_channel_->IsOpen())
-      << "Could not create QEmu channel: " << qemu_channel_->StrError();
-
-  if (client_channel_fd > 0) {
-    client_channel_ = cvd::SharedFD::Dup(client_channel_fd);
-  } else {
-    LOG_IF(WARNING, unlink(options.client_socket_path.c_str()) == 0)
-        << "Removed existing unix socket: " << options.client_socket_path
-        << ". We can't confirm yet whether another instance is running.";
-    client_channel_ = cvd::SharedFD::SocketLocalServer(
-        options.client_socket_path.c_str(), false, SOCK_STREAM, 0666);
-  }
-  LOG_IF(FATAL, !client_channel_->IsOpen())
-      << "Could not create Client channel: " << client_channel_->StrError();
-}
-
-void IVServer::Serve() {
-  while (true) {
-    cvd::SharedFDSet rset;
-    rset.Set(qemu_channel_);
-    rset.Set(client_channel_);
-    cvd::Select(&rset, nullptr, nullptr, nullptr);
-
-    if (rset.IsSet(qemu_channel_)) {
-      HandleNewQemuConnection();
-    }
-
-    if (rset.IsSet(client_channel_)) {
-      HandleNewClientConnection();
-    }
-  }
-
-  LOG(FATAL) << "Control reached out of event loop";
-}
-
-void IVServer::HandleNewClientConnection() {
-  std::unique_ptr<HaldClient> res = HaldClient::New(
-      *vsoc_shmem_, cvd::SharedFD::Accept(*client_channel_, nullptr, nullptr));
-  if (!res) {
-    LOG(WARNING) << "Rejecting unsuccessful HALD connection.";
-  }
-}
-
-void IVServer::HandleNewQemuConnection() {
-  std::unique_ptr<QemuClient> res = QemuClient::New(
-      *vsoc_shmem_, cvd::SharedFD::Accept(*qemu_channel_, nullptr, nullptr));
-
-  if (!res) {
-    LOG(WARNING) << "Could not accept new QEmu client.";
-  }
-}
-
-}  // namespace ivserver
diff --git a/host/commands/ivserver/ivserver.h b/host/commands/ivserver/ivserver.h
deleted file mode 100644
index d28d14b..0000000
--- a/host/commands/ivserver/ivserver.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <memory>
-
-#include "common/libs/fs/shared_fd.h"
-#include "host/commands/ivserver/options.h"
-#include "host/commands/ivserver/vsocsharedmem.h"
-
-namespace ivserver {
-
-// This class is responsible for orchestrating the setup and then serving
-// new connections.
-class IVServer final {
- public:
-  // The qemu_channel_fd and client_channel_fd are the server sockets. If
-  // non-positive values are provided the server will create those sockets
-  // itself.
-  IVServer(const IVServerOptions &options, int qemu_channel_fd,
-           int client_channel_fd);
-  IVServer(const IVServer &) = delete;
-  IVServer& operator=(const IVServer&) = delete;
-
-  // Serves incoming client and qemu connection.
-  // This method should never return.
-  void Serve();
-
- private:
-  void HandleNewClientConnection();
-  void HandleNewQemuConnection();
-
-  std::unique_ptr<VSoCSharedMemory> vsoc_shmem_;
-  cvd::SharedFD qemu_channel_;
-  cvd::SharedFD client_channel_;
-};
-
-}  // namespace ivserver
diff --git a/host/commands/ivserver/main.cpp b/host/commands/ivserver/main.cpp
deleted file mode 100644
index 16aa747..0000000
--- a/host/commands/ivserver/main.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <unistd.h>
-
-#include <thread>
-
-#include <gflags/gflags.h>
-#include <glog/logging.h>
-
-#include "host/libs/config/cuttlefish_config.h"
-#include "host/commands/ivserver/ivserver.h"
-#include "host/commands/ivserver/options.h"
-
-DEFINE_int32(
-    qemu_socket_fd, -1,
-    "A file descriptor to use as the server Qemu connects to. If not specified "
-    "a unix socket will be created in the default location.");
-DEFINE_int32(
-    client_socket_fd, -1,
-    "A file descriptor to use as the server clients connects to. If not "
-    "specified a unix socket will be created in the default location.");
-
-int main(int argc, char* argv[]) {
-  ::android::base::InitLogging(argv, android::base::StderrLogger);
-  google::ParseCommandLineFlags(&argc, &argv, true);
-
-  auto config = vsoc::CuttlefishConfig::Get();
-  if (!config) {
-    LOG(ERROR) << "Unable to get cuttlefish config";
-    return 1;
-  }
-
-  ivserver::IVServer server(
-      ivserver::IVServerOptions(config->mempath(),
-                                config->ivshmem_qemu_socket_path(),
-                                vsoc::GetDomain()),
-      FLAGS_qemu_socket_fd, FLAGS_client_socket_fd);
-
-  // Close the file descriptors as they have been dupped by now.
-  if (FLAGS_qemu_socket_fd > 0) {
-    close(FLAGS_qemu_socket_fd);
-  }
-  if (FLAGS_client_socket_fd > 0) {
-    close(FLAGS_client_socket_fd);
-  }
-
-  server.Serve();
-
-  return 0;
-}
diff --git a/host/commands/ivserver/options.cc b/host/commands/ivserver/options.cc
deleted file mode 100644
index 0f19397..0000000
--- a/host/commands/ivserver/options.cc
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "host/commands/ivserver/options.h"
-
-namespace ivserver {
-
-IVServerOptions::IVServerOptions(const std::string &shm_file_path,
-                                 const std::string &qemu_socket_path,
-                                 const std::string &client_socket_path)
-    : shm_file_path(shm_file_path),
-      qemu_socket_path(qemu_socket_path),
-      client_socket_path(client_socket_path) {}
-
-std::ostream &operator<<(std::ostream &out, const IVServerOptions &options) {
-  out << "\nshm_file: " << options.shm_file_path
-      << "\nqemu_socket_path: " << options.qemu_socket_path
-      << "\nclient_socket_path: " << options.client_socket_path << std::endl;
-
-  return out;
-}
-
-}  // namespace ivserver
diff --git a/host/commands/ivserver/options.h b/host/commands/ivserver/options.h
deleted file mode 100644
index 40b3246..0000000
--- a/host/commands/ivserver/options.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <inttypes.h>
-#include <iostream>
-#include <string>
-
-namespace ivserver {
-
-const uint16_t kIVServerMajorVersion = 1;
-const uint16_t kIVServerMinorVersion = 0;
-const uint32_t kIVServerDefaultShmSizeInMiB = 4;
-
-//
-// structure that contains the various options to start the server.
-//
-struct IVServerOptions final {
-  IVServerOptions(const std::string &shm_file_path,
-                  const std::string &qemu_socket_path,
-                  const std::string &client_socket_path);
-
-  //
-  // We still need a friend here
-  //
-  friend std::ostream &operator<<(std::ostream &out,
-                                  const IVServerOptions &opts);
-
-  const std::string shm_file_path;
-  const std::string qemu_socket_path;
-  const std::string client_socket_path;
-};
-
-}  // namespace ivserver
diff --git a/host/commands/ivserver/qemu_client.cc b/host/commands/ivserver/qemu_client.cc
deleted file mode 100644
index 660c915..0000000
--- a/host/commands/ivserver/qemu_client.cc
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "host/commands/ivserver/qemu_client.h"
-
-#include <glog/logging.h>
-
-namespace ivserver {
-
-std::unique_ptr<QemuClient> QemuClient::New(const VSoCSharedMemory& shmem,
-                                            const cvd::SharedFD& socket) {
-  std::unique_ptr<QemuClient> res;
-  if (!socket->IsOpen()) {
-    LOG(WARNING) << "Invalid socket passed to QemuClient: "
-                 << socket->StrError();
-    return res;
-  }
-
-  res.reset(new QemuClient(std::move(socket)));
-  if (!res->PerformHandshake(shmem)) {
-    LOG(ERROR) << "Qemu handshake failed. Dropping connection.";
-    res.reset();
-  }
-
-  return res;
-}
-
-QemuClient::QemuClient(cvd::SharedFD socket) : client_socket_(socket) {}
-
-// Once the QemuClient object is constructed, invoking the following
-// method will perform the actual handshake with a QEMU instance.
-bool QemuClient::PerformHandshake(const VSoCSharedMemory& shmem) {
-  LOG(INFO) << "New QEmu client connected.";
-  // 1. The protocol version number, currently zero.  The client should
-  //    close the connection on receipt of versions it can't handle.
-  int64_t msg = QemuConstants::kIvshMemProtocolVersion;
-  int rval = client_socket_->Send(&msg, sizeof(msg), MSG_NOSIGNAL);
-  if (rval != sizeof(msg)) {
-    LOG(ERROR) << "Failed to send protocol version: "
-               << client_socket_->StrError();
-    return false;
-  }
-
-  // 2. The client's ID.  This is unique among all clients of this server.
-  //    IDs must be between 0 and 65535, because the Doorbell register
-  //    provides only 16 bits for them.
-  msg = QemuConstants::kGuestID;
-  rval = client_socket_->Send(&msg, sizeof(msg), MSG_NOSIGNAL);
-  if (rval != sizeof(msg)) {
-    LOG(ERROR) << "Failed to send VM Id: " << client_socket_->StrError();
-    return false;
-  }
-
-  // 3. Connect notifications for existing other clients, if any.  This is
-  //    a peer ID (number between 0 and 65535 other than the client's ID),
-  //    repeated N times.  Each repetition is accompanied by one file
-  //    descriptor.  These are for interrupting the peer with that ID using
-  //    vector 0,..,N-1, in order.  If the client is configured for fewer
-  //    vectors, it closes the extra file descriptors.  If it is configured
-  //    for more, the extra vectors remain unconnected.
-  for (const auto& region_data : shmem.Regions()) {
-    if (!SendSocketInfo(kHostID, region_data.host_fd)) {
-      LOG(ERROR) << "Failed to send Host Side FD for region "
-                 << region_data.device_name << ": " << client_socket_->StrError();
-      return false;
-    }
-  }
-
-  // 4. Interrupt setup.  This is the client's own ID, repeated N times.
-  //    Each repetition is accompanied by one file descriptor.  These are
-  //    for receiving interrupts from peers using vector 0,..,N-1, in
-  //    order.  If the client is configured for fewer vectors, it closes
-  //    the extra file descriptors.  If it is configured for more, the
-  //    extra vectors remain unconnected.
-  for (const auto& region_data : shmem.Regions()) {
-    if (!SendSocketInfo(kGuestID, region_data.guest_fd)) {
-      LOG(ERROR) << "Failed to send Guest Side FD for region "
-                 << region_data.device_name << ": " << client_socket_->StrError();
-      return false;
-    }
-  }
-
-  // 5. The number -1, accompanied by the file descriptor for the shared
-  //    memory.
-  if (!SendSocketInfo(kSharedMem, shmem.SharedMemFD())) {
-    LOG(ERROR) << "Failed to send Shared Memory socket: "
-               << client_socket_->StrError();
-    return false;
-  }
-
-
-  LOG(INFO) << "QEmu handshake completed.";
-  return true;
-}
-
-bool QemuClient::SendSocketInfo(QemuConstants message,
-                                const cvd::SharedFD& socket) {
-  struct iovec vec {
-    &message, sizeof(message)
-  };
-  cvd::InbandMessageHeader hdr{nullptr, 0, &vec, 1, 0};
-  cvd::SharedFD fds[] = {socket};
-  int rval = client_socket_->SendMsgAndFDs(hdr, 0, fds);
-  if (rval == -1) {
-    LOG(ERROR) << "failed to send shared_mem_fd: "
-               << client_socket_->StrError();
-    return false;
-  }
-  return true;
-}
-
-}  // namespace ivserver
diff --git a/host/commands/ivserver/qemu_client.h b/host/commands/ivserver/qemu_client.h
deleted file mode 100644
index 31cd211..0000000
--- a/host/commands/ivserver/qemu_client.h
+++ /dev/null
@@ -1,69 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <memory>
-
-#include "common/libs/fs/shared_fd.h"
-#include "host/commands/ivserver/vsocsharedmem.h"
-
-namespace ivserver {
-
-// QemuClient manages individual QEmu connections using protocol specified
-// in documentation file distributed as part of QEmu 2.8 package under:
-// docs/specs/ivshmem-spec.txt
-// Alternatively, please point your browser to the following URL:
-// https://github.com/qemu/qemu/blob/stable-2.8/docs/specs/ivshmem-spec.txt
-class QemuClient final {
- public:
-  static std::unique_ptr<QemuClient> New(const VSoCSharedMemory &shmem,
-                                         const cvd::SharedFD &connection);
-
-  cvd::SharedFD client_socket() const { return client_socket_; }
-
- private:
-  enum QemuConstants : int64_t {
-    kIvshMemProtocolVersion = 0,
-    // Marker for the shared memory file
-    kSharedMem = -1,
-    // HostID is in fact a Peer ID and can take multiple values, depending on
-    // how many subsystems we would like Guest to talk to.
-    kHostID = 0,
-    // GuestID is a unique form of Peer ID (see above), that identifies newly
-    // created quest in IvSharedMem world.
-    kGuestID = 1
-  };
-
-  static_assert(QemuConstants::kHostID != QemuConstants::kGuestID,
-                "Guest and host should have different IDs");
-
-  cvd::SharedFD client_socket_;
-
-  // Initialize new instance of QemuClient.
-  QemuClient(cvd::SharedFD qemu_listener_socket);
-
-  // Once the QemuClient object is constructed, invoking the following
-  // method will perform the actual handshake with a QEMU instance.
-  bool PerformHandshake(const VSoCSharedMemory &shmem_fd);
-
-  // Send socket data to Qemu.
-  bool SendSocketInfo(QemuConstants message, const cvd::SharedFD &socket);
-
-  QemuClient(const QemuClient &) = delete;
-  QemuClient &operator=(const QemuClient &) = delete;
-};
-
-}  // namespace ivserver
diff --git a/host/commands/ivserver/shm_layout.txt b/host/commands/ivserver/shm_layout.txt
deleted file mode 100644
index 39d66a7..0000000
--- a/host/commands/ivserver/shm_layout.txt
+++ /dev/null
@@ -1,88 +0,0 @@
-(Please      use      a      smaller        font        and/or       appropriate     terminal   width  to      see    this     line without wrapping)
-
-
-                                              REGION DESCRIPTORS
-                                              (starts at page 0)
-                                       +------------------------------+
-                                       |     major_version: u16       |
-                                       +------------------------------+
-                                       |     minor_version: u16       |
-                                       +------------------------------+
-        (size of shared memory)        |         size: u32            |
-                                       +------------------------------+
-          (number of regions)          |     region_count: u32        |
-                                       +------------------------------+
-  (offset of region descriptor data)   | vsoc_region_desc_offset: u32 |o-----+
-                                       +------------------------------+      |
-                                       |                              |      |
-                                       | ..          ..            .. |      |
-                                       |                              |      |
-      (region 0 descriptor start)      +------------------------------+ <----+
-                                       |    current_version: u16      |
-                                       +------------------------------+
-                                       |  min_compatible_version: u16 |
-                                       +------------------------------+
-       (start offset of region 0)      |  region_begin_offset: u32    |o--------------------+
-                                       +------------------------------+                     |
-       (end offset   of region 0)      |  region_end_offset: u32      |o----------------------------------------------------------------------+
-                                       +------------------------------+                     |                                                 |
-                                       |  offset_of_region_data: u32  |o-----+              |                                                 |
-                                       +------------------------------+      |              |                                                 |
-                                       | guest_to_host_signal_table   |      |              |                                                 |
-                                       |______________________________|      |              |                                                 |
-                                        +----------------------------+       |              |                                                 |
-                                        |    num_nodes_lg2: u32      |       |              |                                                 |
-                                        +----------------------------+       |              |                                                 |
-                                        |futex_uaddr_table_offset:u32|o------------------+  |                                                 |
-                                        +----------------------------+       |           |  |                                                 |
-                                        | intr_signaled_offset: u32  |o----------------+ |  |                                                 |
-                                        +----------------------------+       |         | |  |                                                 |
-                                       +------------------------------+      |         | |  |                                                 |
-                                       | host_to_guest_signal_table   |      |         | |  |                                                 |
-                                       |______________________________|      |         | |  |                                                 |
-                                        +----------------------------+       |         | |  |                                                 |
-                                        |    num_nodes_lg2: u32      |       |         | |  |                                                 |
-                                        +----------------------------+       |         | |  |                                                 |
-                                        |futex_uaddr_table_offset:u32|o--------------+ | |  |                                                 |
-                                        +----------------------------+       |       | | |  \/      REGION AREA (page aligned)                |
-                                        | intr_signaled_offset: u32  |o------|-----+ | | |  +---------------------------------------+         |
-                                        +----------------------------+       |     | | | |  |  region area before start of guest to |         |
-                                       +------------------------------+      |     | | | |  |  host signal table.                   |         |
-                                       |    device_name: char[16]     |      |     | | | |  |     (currently does not exist)        |         |
-         (region 0 descriptor end)     +------------------------------+      |     | | | +->+---------------------------------------+         |
-       (region 1 descriptor start)     |                              |      |     | | |    |        uaddr_offset_0 : u32           |         |
-                                       |  current_version: u16        |      |     | | |    +---------------------------------------+         |
-                                       +------------------------------+      |     | | |    |        uaddr_offset_1 : u32           |         |
-                                       |  min_compatible_version: u16 |      |     | | |    +---------------------------------------+         |
-                                       +------------------------------+      |     | | |    |     ...      ..       ...             |         |
-                                       |  region_begin_offset: u32    |      |     | | |    +---------------------------------------+         |
-                                       +------------------------------+      |     | | |    | uaddr_offset_(2^num_nodes_lg2 - 1):u32|         |
-                                       |  region_end_offset: u32      |      |     | | +--->+---------------------------------------+         |
-                                       +------------------------------+      |     | |      |     (interrupt_signaled_area) : u32   |         |
-                                       |  offset_of_region_data: u32  |      |     | +----->+---------------------------------------+         |
-                                       +------------------------------+      |     |        |        uaddr_offset_0 : u32           |         |
-                                       | guest_to_host_signal_table   |      |     |        +---------------------------------------+         |
-                                       +------------------------------+      |     |        |     ...      ..       ...             |         |
-                                       | host_to_guest_signal_table   |      |     |        +---------------------------------------+         |
-                                       +------------------------------+      |     |        | uaddr_offset_(2^num_nodes_lg2 - 1):u32|         |
-                                       |    device_name: char[16]     |      |     +------->+---------------------------------------+         |
-          (region 1 descriptor end)    +------------------------------+      |              |     (interrupt_signaled_area) : u32   |         |
-                                       ...           ...            ...      +------------->+---------------------------------------+         |
-                                       +------------------------------+                     |                                       |         |
-                                       |    current_version: u16      |                     |                                       |         |
-                                       +------------------------------+                     |                                       |         |
-                                       |  min_compatible_version: u16 |                     |         region specific data          |         |
-                                       +------------------------------+                     | (defined by region specific agreement |         |
-                                       |  region_begin_offset: u32    |                     |  between HAL and host-side process)   |         |
-                                       +------------------------------+                     |                                       |         |
-                                       |  region_end_offset: u32      |                     |                                       |         |
-                                       +------------------------------+                     |                                       |         |
-                                       |  offset_of_region_data: u32  |                     +---------------------------------------+ <-------+
-                                       +------------------------------+
-                                       | guest_to_host_signal_table   |
-                                       +------------------------------+
-                                       | host_to_guest_signal_table   |
-                                       +------------------------------+
-                                       |    device_name: char[16]     |
-                                       +------------------------------+
-                                          END OF REGION DESCRIPTORS
diff --git a/host/commands/ivserver/vsocsharedmem.cc b/host/commands/ivserver/vsocsharedmem.cc
deleted file mode 100644
index eb448d8..0000000
--- a/host/commands/ivserver/vsocsharedmem.cc
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "host/commands/ivserver/vsocsharedmem.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/eventfd.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <algorithm>
-#include <tuple>
-
-#include <glog/logging.h>
-
-#include "common/vsoc/lib/vsoc_memory.h"
-#include "uapi/vsoc_shm.h"
-
-namespace ivserver {
-namespace {
-
-class VSoCSharedMemoryImpl : public VSoCSharedMemory {
- public:
-  VSoCSharedMemoryImpl(const std::map<std::string, size_t> &name_to_region_idx,
-                       const std::vector<Region> &regions,
-                       const std::string &path);
-
-  bool GetEventFdPairForRegion(const std::string &region_name,
-                               cvd::SharedFD *guest_to_host,
-                               cvd::SharedFD *host_to_guest) const override;
-
-  const cvd::SharedFD &SharedMemFD() const override;
-
-  const std::vector<Region> &Regions() const override;
-
- private:
-  void CreateLayout();
-
-  cvd::SharedFD shared_mem_fd_;
-  const std::map<std::string, size_t> region_name_to_index_;
-  const std::vector<Region> region_data_;
-
-  VSoCSharedMemoryImpl(const VSoCSharedMemoryImpl &) = delete;
-  VSoCSharedMemoryImpl &operator=(const VSoCSharedMemoryImpl &other) = delete;
-};
-
-VSoCSharedMemoryImpl::VSoCSharedMemoryImpl(
-    const std::map<std::string, size_t> &name_to_region_idx,
-    const std::vector<Region> &regions, const std::string &path)
-    : shared_mem_fd_(cvd::SharedFD::Open(path.c_str(), O_RDWR)),
-      region_name_to_index_{name_to_region_idx},
-      region_data_{regions} {
-  LOG_IF(FATAL, !shared_mem_fd_->IsOpen())
-      << "Error in creating shared_memory file: " << shared_mem_fd_->StrError();
-}
-
-const cvd::SharedFD &VSoCSharedMemoryImpl::SharedMemFD() const {
-  return shared_mem_fd_;
-}
-
-const std::vector<VSoCSharedMemory::Region> &VSoCSharedMemoryImpl::Regions()
-    const {
-  return region_data_;
-}
-
-bool VSoCSharedMemoryImpl::GetEventFdPairForRegion(
-    const std::string &region_name, cvd::SharedFD *guest_to_host,
-    cvd::SharedFD *host_to_guest) const {
-  auto it = region_name_to_index_.find(region_name);
-  if (it == region_name_to_index_.end()) return false;
-
-  *guest_to_host = region_data_[it->second].host_fd;
-  *host_to_guest = region_data_[it->second].guest_fd;
-  return true;
-}
-
-}  // anonymous namespace
-
-std::unique_ptr<VSoCSharedMemory> VSoCSharedMemory::New(
-    const std::string &path) {
-  auto device_layout = vsoc::VSoCMemoryLayout::Get();
-
-  std::map<std::string, size_t> name_to_region_idx;
-  std::vector<Region> regions;
-  regions.reserve(device_layout->GetRegions().size());
-
-  for (auto region_spec : device_layout->GetRegions()) {
-    auto device_name = region_spec->region_name();
-
-    // Create one pair of eventfds for this region. Note that the guest to host
-    // eventfd is non-blocking, whereas the host to guest eventfd is blocking.
-    // This is in anticipation of blocking semantics for the host side locks.
-    auto host_fd = cvd::SharedFD::Event(0, EFD_NONBLOCK);
-    if (!host_fd->IsOpen()) {
-      LOG(ERROR) << "Failed to create host eventfd for " << device_name << ": "
-                 << host_fd->StrError();
-      return nullptr;
-    }
-    auto guest_fd = cvd::SharedFD::Event(0, EFD_NONBLOCK);
-    if (!guest_fd->IsOpen()) {
-      LOG(ERROR) << "Failed to create guest eventfd for " << device_name << ": "
-                 << guest_fd->StrError();
-      return nullptr;
-    }
-
-    auto region_idx = regions.size();
-    name_to_region_idx[device_name] = region_idx;
-    regions.emplace_back(device_name, host_fd, guest_fd);
-  }
-
-  return std::unique_ptr<VSoCSharedMemory>(
-      new VSoCSharedMemoryImpl(name_to_region_idx, regions, path));
-}
-
-}  // namespace ivserver
diff --git a/host/commands/ivserver/vsocsharedmem.h b/host/commands/ivserver/vsocsharedmem.h
deleted file mode 100644
index 613c6a0..0000000
--- a/host/commands/ivserver/vsocsharedmem.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <inttypes.h>
-#include <map>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "common/libs/fs/shared_fd.h"
-#include "uapi/vsoc_shm.h"
-
-namespace ivserver {
-
-class VSoCSharedMemory {
- public:
-  // Region describes a VSoCSharedMem region.
-  struct Region {
-    Region() = default;
-    explicit Region(const char *device_name, const cvd::SharedFD &host_fd,
-                    const cvd::SharedFD &guest_fd)
-        : device_name(device_name), host_fd(host_fd), guest_fd(guest_fd) {}
-    const char *device_name;
-    cvd::SharedFD host_fd;
-    cvd::SharedFD guest_fd;
-  };
-
-  VSoCSharedMemory() = default;
-  virtual ~VSoCSharedMemory() = default;
-
-  static std::unique_ptr<VSoCSharedMemory> New(const std::string &name);
-
-  virtual bool GetEventFdPairForRegion(const std::string &region_name,
-                                       cvd::SharedFD *guest_to_host,
-                                       cvd::SharedFD *host_to_guest) const = 0;
-
-  virtual const cvd::SharedFD &SharedMemFD() const = 0;
-  virtual const std::vector<Region> &Regions() const = 0;
-
- private:
-  VSoCSharedMemory(const VSoCSharedMemory &) = delete;
-  VSoCSharedMemory &operator=(const VSoCSharedMemory &other) = delete;
-};
-
-}  // namespace ivserver
diff --git a/host/commands/ivserver/vsocsharedmem_mock.h b/host/commands/ivserver/vsocsharedmem_mock.h
deleted file mode 100644
index 4ed1f16..0000000
--- a/host/commands/ivserver/vsocsharedmem_mock.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gmock/gmock.h>
-
-#include "host/commands/ivserver/vsocsharedmem.h"
-
-namespace ivserver {
-namespace test {
-class VSoCSharedMemoryMock : public VSoCSharedMemory {
- public:
-  MOCK_CONST_METHOD3(GetEventFdPairForRegion,
-                     bool(const std::string&, cvd::SharedFD*, cvd::SharedFD*));
-  MOCK_CONST_METHOD0(SharedMemFD, const cvd::SharedFD&());
-  MOCK_CONST_METHOD0(Regions,
-                     const std::vector<VSoCSharedMemory::Region>&());
-};
-}  // namespace test
-}  // namespace ivserver
diff --git a/host/commands/kernel_log_monitor/Android.bp b/host/commands/kernel_log_monitor/Android.bp
index 7bc29e0..54dda47 100644
--- a/host/commands/kernel_log_monitor/Android.bp
+++ b/host/commands/kernel_log_monitor/Android.bp
@@ -24,9 +24,7 @@
     ],
     shared_libs: [
         "libcuttlefish_fs",
-        "libcuttlefish_strings",
         "libcuttlefish_utils",
-        "cuttlefish_auto_resources",
         "libbase",
     ],
     static_libs: [
diff --git a/host/commands/kernel_log_monitor/main.cc b/host/commands/kernel_log_monitor/main.cc
index 1f0ead3..6956e68 100644
--- a/host/commands/kernel_log_monitor/main.cc
+++ b/host/commands/kernel_log_monitor/main.cc
@@ -20,12 +20,12 @@
 #include <string>
 #include <vector>
 
+#include <android-base/strings.h>
 #include <gflags/gflags.h>
 #include <glog/logging.h>
 
 #include <common/libs/fs/shared_fd.h>
 #include <common/libs/fs/shared_select.h>
-#include <common/libs/strings/str_split.h>
 #include <host/libs/config/cuttlefish_config.h>
 #include "host/commands/kernel_log_monitor/kernel_log_server.h"
 
@@ -47,7 +47,7 @@
     }
   }
 
-  auto fds = cvd::StrSplit(FLAGS_subscriber_fds, ',');
+  auto fds = android::base::Split(FLAGS_subscriber_fds, ",");
   std::vector<cvd::SharedFD> shared_fds;
   for (auto& fd_str: fds) {
     auto fd = std::stoi(fd_str);
diff --git a/host/commands/launch/Android.bp b/host/commands/launch/Android.bp
index a40a07d..dafe990 100644
--- a/host/commands/launch/Android.bp
+++ b/host/commands/launch/Android.bp
@@ -24,18 +24,14 @@
         "cuttlefish_glog",
     ],
     shared_libs: [
-        "vsoc_lib",
         "libcuttlefish_fs",
-        "libcuttlefish_strings",
         "libcuttlefish_utils",
-        "cuttlefish_auto_resources",
         "libbase",
         "libnl",
     ],
     static_libs: [
         "libcuttlefish_host_config",
         "libcuttlefish_vm_manager",
-        "libivserver",
         "libgflags",
         "libxml2",
         "libjsoncpp",
diff --git a/host/commands/launch/filesystem_explorer.cc b/host/commands/launch/filesystem_explorer.cc
index dd24324..4d43dcf 100644
--- a/host/commands/launch/filesystem_explorer.cc
+++ b/host/commands/launch/filesystem_explorer.cc
@@ -28,56 +28,6 @@
 #include "common/libs/utils/environment.h"
 #include "host/libs/config/fetcher_config.h"
 
-namespace {
-
-/*
- * Returns the paths of all files in `directory_path`.
- *
- * This is a shallow exploration that ignores directories, i.e. it only prints
- * any regular files.
- */
-std::set<std::string> ReportFiles(const std::string& directory_path) {
-  // TODO(schuffelen): Put this in a common library.
-  DIR* directory = opendir(directory_path.c_str());
-  if (!directory) {
-    int error_num = errno;
-    LOG(ERROR) << "ReportFiles could not open " << directory_path << " ("
-               << strerror(error_num) << ")";
-    return {};
-  }
-  struct dirent* entry;
-  std::set<std::string> found_files;
-  while ((entry = readdir(directory)) != NULL) {
-    if (entry->d_type == DT_DIR) {
-      continue;
-    }
-    found_files.insert(directory_path + "/" + std::string(entry->d_name));
-  }
-  closedir(directory);
-  return found_files;
-}
-
-/**
- * Report files that are present based on some heuristics for relevance.
- *
- * This is used in cases where it's not clear in advance whether there are
- * Cuttlefish files in the given directory.
- */
-std::set<std::string> HeuristicFileReport(const std::string& directory_path) {
-  std::set<std::string> files;
-  if (cvd::FileExists(directory_path + "/bin/launch_cvd")) {
-    files.merge(ReportFiles(directory_path + "/bin"));
-  }
-  bool has_super_img = cvd::FileExists(directory_path + "/super.img");
-  bool has_android_info = cvd::FileExists(directory_path + "/android-info.txt");
-  if (has_super_img || has_android_info) {
-    files.merge(ReportFiles(directory_path));
-  }
-  return files;
-}
-
-} // namespace
-
 cvd::FetcherConfig AvailableFilesReport() {
   std::string current_directory = cvd::AbsolutePath(cvd::CurrentDirectory());
   if (cvd::FileExists(current_directory + "/fetcher_config.json")) {
@@ -87,25 +37,12 @@
   }
 
   std::set<std::string> files;
-  std::string host_out = cvd::StringFromEnv("ANDROID_HOST_OUT", "");
-  if (host_out != "") {
-    files.merge(ReportFiles(cvd::AbsolutePath(host_out + "/bin")));
-  }
 
-  std::string product_out = cvd::StringFromEnv("ANDROID_PRODUCT_OUT", "");
-  if (product_out != "") {
-    files.merge(ReportFiles(cvd::AbsolutePath(product_out)));
-  }
-
-  files.merge(HeuristicFileReport(current_directory));
-
-  std::string home = cvd::StringFromEnv("HOME", "");
-  if (home != "" && cvd::AbsolutePath(home) != current_directory) {
-    files.merge(HeuristicFileReport(home));
-  }
-
+  std::string psuedo_fetcher_dir =
+      cvd::StringFromEnv("ANDROID_HOST_OUT",
+                         cvd::StringFromEnv("HOME", current_directory));
   std::string psuedo_fetcher_config =
-      current_directory + "/launcher_psuedo_fetcher_config.json";
+      psuedo_fetcher_dir + "/launcher_pseudo_fetcher_config.json";
   files.insert(psuedo_fetcher_config);
 
   cvd::FetcherConfig config;
diff --git a/host/commands/logcat_receiver/Android.bp b/host/commands/logcat_receiver/Android.bp
index 16f3bf9..72438c7 100644
--- a/host/commands/logcat_receiver/Android.bp
+++ b/host/commands/logcat_receiver/Android.bp
@@ -26,7 +26,6 @@
         "libcuttlefish_fs",
         "liblog",
         "libcuttlefish_utils",
-        "cuttlefish_auto_resources",
     ],
     static_libs: [
         "libcuttlefish_host_config",
diff --git a/host/commands/record_audio/Android.bp b/host/commands/record_audio/Android.bp
deleted file mode 100644
index 13f47ef..0000000
--- a/host/commands/record_audio/Android.bp
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// Copyright (C) 2018 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.
-
-cc_binary_host {
-    name: "record_audio",
-    srcs: [
-        "main.cc",
-    ],
-    include_dirs: [
-        "frameworks/av/cmds/stagefright",
-    ],
-    shared_libs: [
-        "libbase",
-        "libcuttlefish_utils",
-        "vsoc_lib",
-    ],
-    static_libs: [
-        "libcuttlefish_host_config",
-        "libjsoncpp",
-        "libgflags",
-    ],
-    defaults: ["cuttlefish_host_only"],
-}
diff --git a/host/commands/record_audio/main.cc b/host/commands/record_audio/main.cc
deleted file mode 100644
index 3c024b8..0000000
--- a/host/commands/record_audio/main.cc
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2018 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 "common/vsoc/lib/audio_data_region_view.h"
-#include "common/vsoc/lib/circqueue_impl.h"
-#include "common/vsoc/lib/vsoc_audio_message.h"
-#include "host/libs/config/cuttlefish_config.h"
-
-#include "WaveWriter.h"
-
-#include <android-base/logging.h>
-#include <gflags/gflags.h>
-#include <iostream>
-#include <signal.h>
-
-using AudioDataRegionView = vsoc::audio_data::AudioDataRegionView;
-using WaveWriter = android::WaveWriter;
-
-DEFINE_string(output_file, "", "Location of the output audio file.");
-DEFINE_bool(verbose, false, "Enable verbose logging.");
-
-volatile bool gDone = false;
-static void SigIntHandler(int /* sig */) {
-  gDone = true;
-}
-
-int main(int argc, char **argv) {
-  ::android::base::InitLogging(argv, android::base::StderrLogger);
-  google::ParseCommandLineFlags(&argc, &argv, true);
-
-  LOG_IF(FATAL, FLAGS_output_file.empty())
-      << "--output_file must be specified.";
-
-  AudioDataRegionView *audio_data_rv =
-      AudioDataRegionView::GetInstance(vsoc::GetDomain().c_str());
-
-  auto worker = audio_data_rv->StartWorker();
-
-  std::unique_ptr<WaveWriter> writer;
-  int64_t frameCount = 0LL;
-
-  // The configuration the writer is setup for.
-  gce_audio_message writer_hdr;
-
-  uint8_t buffer[4096];
-
-  gDone = false;
-
-  struct sigaction act;
-  sigemptyset(&act.sa_mask);
-  act.sa_flags = 0;
-  act.sa_handler = SigIntHandler;
-
-  struct sigaction oact;
-  sigaction(SIGINT, &act, &oact);
-
-  while (!gDone) {
-    intptr_t res = audio_data_rv->data()->audio_queue.Read(
-            audio_data_rv,
-            reinterpret_cast<char *>(buffer),
-            sizeof(buffer));
-
-    if (res < 0) {
-      std::cerr << "CircularPacketQueue::Read returned " << res << std::endl;
-        continue;
-    }
-
-    CHECK_GE(static_cast<size_t>(res), sizeof(gce_audio_message));
-
-    gce_audio_message hdr;
-    std::memcpy(&hdr, buffer, sizeof(gce_audio_message));
-
-    if (hdr.message_type != gce_audio_message::DATA_SAMPLES) {
-        continue;
-    }
-
-    const size_t payloadSize = res - sizeof(gce_audio_message);
-
-    if (FLAGS_verbose) {
-      std::cerr
-          << "stream "
-          << hdr.stream_number
-          << ", frame "
-          << hdr.frame_num
-          << ", rate "
-          << hdr.frame_rate
-          << ", channel_mask "
-          << hdr.channel_mask
-          << ", format "
-          << hdr.format
-          << ", payload_size "
-          << payloadSize
-          << std::endl;
-    }
-
-    if (!writer) {
-      const size_t numChannels = hdr.frame_size / sizeof(int16_t);
-
-      writer.reset(
-          new WaveWriter(FLAGS_output_file.c_str(), numChannels, hdr.frame_rate));
-
-      frameCount = hdr.frame_num;
-      writer_hdr = hdr;
-    } else if (writer_hdr.frame_size != hdr.frame_size
-        || writer_hdr.frame_rate != hdr.frame_rate
-        || writer_hdr.stream_number != hdr.stream_number) {
-      std::cerr << "Audio configuration changed. Aborting." << std::endl;
-      break;
-    }
-
-    int64_t framesMissing = hdr.frame_num - frameCount;
-    if (framesMissing > 0) {
-      // TODO(andih): Insert silence here, if necessary.
-    }
-
-    frameCount = hdr.frame_num;
-
-    writer->Append(&buffer[sizeof(gce_audio_message)], payloadSize);
-  }
-
-  std::cout << "DONE" << std::endl;
-
-  return 0;
-}
-
diff --git a/host/commands/run_cvd/Android.bp b/host/commands/run_cvd/Android.bp
index 5629d6a..a7893fe 100644
--- a/host/commands/run_cvd/Android.bp
+++ b/host/commands/run_cvd/Android.bp
@@ -19,25 +19,19 @@
         "launch.cc",
         "process_monitor.cc",
         "main.cc",
-        "screen_region_handler.cc",
-        "vsoc_shared_memory.cc",
     ],
     header_libs: [
         "cuttlefish_glog",
     ],
     shared_libs: [
-        "vsoc_lib",
         "libcuttlefish_fs",
-        "libcuttlefish_strings",
         "libcuttlefish_utils",
-        "cuttlefish_auto_resources",
         "libbase",
         "libnl"
     ],
     static_libs: [
         "libcuttlefish_host_config",
         "libcuttlefish_vm_manager",
-        "libivserver",
         "libgflags",
         "libxml2",
         "libjsoncpp",
diff --git a/host/commands/run_cvd/launch.cc b/host/commands/run_cvd/launch.cc
index 47cf2e2..e4eb858 100644
--- a/host/commands/run_cvd/launch.cc
+++ b/host/commands/run_cvd/launch.cc
@@ -8,30 +8,16 @@
 #include "common/libs/fs/shared_fd.h"
 #include "common/libs/utils/files.h"
 #include "common/libs/utils/size_utils.h"
-#include "common/vsoc/shm/screen_layout.h"
 #include "host/commands/run_cvd/runner_defs.h"
 #include "host/commands/run_cvd/pre_launch_initializers.h"
-#include "host/commands/run_cvd/vsoc_shared_memory.h"
+#include "host/libs/vm_manager/crosvm_manager.h"
+#include "host/libs/vm_manager/qemu_manager.h"
 
 using cvd::RunnerExitCodes;
 using cvd::MonitorEntry;
 
 namespace {
 
-cvd::SharedFD CreateIvServerUnixSocket(const std::string& path) {
-  return cvd::SharedFD::SocketLocalServer(path.c_str(), false, SOCK_STREAM,
-                                          0666);
-}
-
-std::string GetGuestPortArg() {
-  constexpr int kEmulatorPort = 5555;
-  return std::string{"--guest_ports="} + std::to_string(kEmulatorPort);
-}
-
-std::string GetHostPortArg(const vsoc::CuttlefishConfig& config) {
-  return std::string{"--host_ports="} + std::to_string(config.host_port());
-}
-
 std::string GetAdbConnectorTcpArg(const vsoc::CuttlefishConfig& config) {
   return std::string{"127.0.0.1:"} + std::to_string(config.host_port());
 }
@@ -46,10 +32,6 @@
   return config.adb_mode().count(mode) > 0;
 }
 
-bool AdbTunnelEnabled(const vsoc::CuttlefishConfig& config) {
-  return AdbModeEnabled(config, vsoc::AdbMode::Tunnel);
-}
-
 bool AdbVsockTunnelEnabled(const vsoc::CuttlefishConfig& config) {
   return config.vsock_guest_cid() > 2
       && AdbModeEnabled(config, vsoc::AdbMode::VsockTunnel);
@@ -61,11 +43,9 @@
 }
 
 bool AdbTcpConnectorEnabled(const vsoc::CuttlefishConfig& config) {
-  bool tunnel = AdbTunnelEnabled(config);
   bool vsock_tunnel = AdbVsockTunnelEnabled(config);
   bool vsock_half_tunnel = AdbVsockHalfTunnelEnabled(config);
-  return config.run_adb_connector()
-      && (tunnel || vsock_tunnel || vsock_half_tunnel);
+  return config.run_adb_connector() && (vsock_tunnel || vsock_half_tunnel);
 }
 
 bool AdbVsockConnectorEnabled(const vsoc::CuttlefishConfig& config) {
@@ -91,32 +71,6 @@
   return config.logcat_mode() == cvd::kLogcatVsockMode;
 }
 
-cvd::Command GetIvServerCommand(const vsoc::CuttlefishConfig& config) {
-  // Resize screen region
-  auto actual_width = cvd::AlignToPowerOf2(config.x_res() * 4, 4);// align to 16
-  uint32_t screen_buffers_size =
-      config.num_screen_buffers() *
-      cvd::AlignToPageSize(actual_width * config.y_res() + 16 /* padding */);
-  screen_buffers_size +=
-      (config.num_screen_buffers() - 1) * 4096; /* Guard pages */
-
-  // TODO(b/79170615) Resize gralloc region too.
-
-  vsoc::CreateSharedMemoryFile(
-      config.mempath(),
-      {{vsoc::layout::screen::ScreenLayout::region_name, screen_buffers_size}});
-
-
-  cvd::Command ivserver(config.ivserver_binary());
-  ivserver.AddParameter(
-      "-qemu_socket_fd=",
-      CreateIvServerUnixSocket(config.ivshmem_qemu_socket_path()));
-  ivserver.AddParameter(
-      "-client_socket_fd=",
-      CreateIvServerUnixSocket(config.ivshmem_client_socket_path()));
-  return ivserver;
-}
-
 std::vector<cvd::SharedFD> LaunchKernelLogMonitor(
     const vsoc::CuttlefishConfig& config,
     cvd::ProcessMonitor* process_monitor,
@@ -246,10 +200,20 @@
                                    GetOnSubprocessExitCallback(config));
 }
 
-cvd::SharedFD CreateVncInputServer(const std::string& path) {
+cvd::SharedFD CreateUnixVncInputServer(const std::string& path) {
   auto server = cvd::SharedFD::SocketLocalServer(path.c_str(), false, SOCK_STREAM, 0666);
   if (!server->IsOpen()) {
-    LOG(ERROR) << "Unable to create mouse server: "
+    LOG(ERROR) << "Unable to create unix input server: "
+               << server->StrError();
+    return cvd::SharedFD();
+  }
+  return server;
+}
+
+cvd::SharedFD CreateVsockVncInputServer(int port) {
+  auto server = cvd::SharedFD::VsockServer(port, SOCK_STREAM);
+  if (!server->IsOpen()) {
+    LOG(ERROR) << "Unable to create vsock input server: "
                << server->StrError();
     return cvd::SharedFD();
   }
@@ -264,50 +228,44 @@
     auto port_options = "-port=" + std::to_string(config.vnc_server_port());
     cvd::Command vnc_server(config.vnc_server_binary());
     vnc_server.AddParameter(port_options);
-    if (!config.enable_ivserver()) {
-      // When the ivserver is not enabled, the vnc touch_server needs to serve
-      // on unix sockets and send input events to whoever connects to it (namely
-      // crosvm)
-      auto touch_server = CreateVncInputServer(config.touch_socket_path());
-      if (!touch_server->IsOpen()) {
-        return false;
-      }
-      vnc_server.AddParameter("-touch_fd=", touch_server);
-
-      auto keyboard_server =
-          CreateVncInputServer(config.keyboard_socket_path());
-      if (!keyboard_server->IsOpen()) {
-        return false;
-      }
-      vnc_server.AddParameter("-keyboard_fd=", keyboard_server);
-      // TODO(b/128852363): This should be handled through the wayland mock
-      //  instead.
-      // Additionally it receives the frame updates from a virtual socket
-      // instead
-      auto frames_server =
-          cvd::SharedFD::VsockServer(config.frames_vsock_port(), SOCK_STREAM);
-      if (!frames_server->IsOpen()) {
-        return false;
-      }
-      vnc_server.AddParameter("-frame_server_fd=", frames_server);
+    if (config.vm_manager() == vm_manager::QemuManager::name()) {
+      vnc_server.AddParameter("-write_virtio_input");
     }
+    // When the ivserver is not enabled, the vnc touch_server needs to serve
+    // on sockets and send input events to whoever connects to it (the VMM).
+    auto touch_server =
+        config.vm_manager() == vm_manager::CrosvmManager::name()
+            ? CreateUnixVncInputServer(config.touch_socket_path())
+            : CreateVsockVncInputServer(config.touch_socket_port());
+    if (!touch_server->IsOpen()) {
+      return false;
+    }
+    vnc_server.AddParameter("-touch_fd=", touch_server);
+
+    auto keyboard_server =
+        config.vm_manager() == vm_manager::CrosvmManager::name()
+            ? CreateUnixVncInputServer(config.keyboard_socket_path())
+            : CreateVsockVncInputServer(config.keyboard_socket_port());
+    if (!keyboard_server->IsOpen()) {
+      return false;
+    }
+    vnc_server.AddParameter("-keyboard_fd=", keyboard_server);
+    // TODO(b/128852363): This should be handled through the wayland mock
+    //  instead.
+    // Additionally it receives the frame updates from a virtual socket
+    // instead
+    auto frames_server =
+        cvd::SharedFD::VsockServer(config.frames_vsock_port(), SOCK_STREAM);
+    if (!frames_server->IsOpen()) {
+      return false;
+    }
+    vnc_server.AddParameter("-frame_server_fd=", frames_server);
     process_monitor->StartSubprocess(std::move(vnc_server), callback);
     return true;
   }
   return false;
 }
 
-void LaunchStreamAudioIfEnabled(const vsoc::CuttlefishConfig& config,
-                                cvd::ProcessMonitor* process_monitor,
-                                std::function<bool(MonitorEntry*)> callback) {
-  if (config.enable_stream_audio()) {
-    auto port_options = "-port=" + std::to_string(config.stream_audio_port());
-    cvd::Command stream_audio(config.stream_audio_binary());
-    stream_audio.AddParameter(port_options);
-    process_monitor->StartSubprocess(std::move(stream_audio), callback);
-  }
-}
-
 void LaunchAdbConnectorIfEnabled(cvd::ProcessMonitor* process_monitor,
                                  const vsoc::CuttlefishConfig& config,
                                  cvd::SharedFD adbd_events_pipe) {
@@ -334,17 +292,6 @@
   }
 }
 
-void LaunchSocketForwardProxyIfEnabled(cvd::ProcessMonitor* process_monitor,
-                                 const vsoc::CuttlefishConfig& config) {
-  if (AdbTunnelEnabled(config)) {
-    cvd::Command adb_tunnel(config.socket_forward_proxy_binary());
-    adb_tunnel.AddParameter(GetGuestPortArg());
-    adb_tunnel.AddParameter(GetHostPortArg(config));
-    process_monitor->StartSubprocess(std::move(adb_tunnel),
-                                     GetOnSubprocessExitCallback(config));
-  }
-}
-
 void LaunchSocketVsockProxyIfEnabled(cvd::ProcessMonitor* process_monitor,
                                  const vsoc::CuttlefishConfig& config) {
   if (AdbVsockTunnelEnabled(config)) {
@@ -368,14 +315,3 @@
                                      GetOnSubprocessExitCallback(config));
   }
 }
-
-void LaunchIvServerIfEnabled(cvd::ProcessMonitor* process_monitor,
-                             const vsoc::CuttlefishConfig& config) {
-  if (config.enable_ivserver()) {
-    process_monitor->StartSubprocess(GetIvServerCommand(config),
-                                     GetOnSubprocessExitCallback(config));
-
-    // Initialize the regions that require so before the VM starts.
-    PreLaunchInitializers::Initialize(config);
-  }
-}
diff --git a/host/commands/run_cvd/launch.h b/host/commands/run_cvd/launch.h
index 714b5bd..4db6e12 100644
--- a/host/commands/run_cvd/launch.h
+++ b/host/commands/run_cvd/launch.h
@@ -6,7 +6,6 @@
 #include "host/commands/run_cvd/process_monitor.h"
 #include "host/libs/config/cuttlefish_config.h"
 
-cvd::Command GetIvServerCommand(const vsoc::CuttlefishConfig& config);
 std::vector <cvd::SharedFD> LaunchKernelLogMonitor(
     const vsoc::CuttlefishConfig& config,
     cvd::ProcessMonitor* process_monitor,
@@ -20,17 +19,10 @@
 bool LaunchVNCServerIfEnabled(const vsoc::CuttlefishConfig& config,
                               cvd::ProcessMonitor* process_monitor,
                               std::function<bool(cvd::MonitorEntry*)> callback);
-void LaunchStreamAudioIfEnabled(const vsoc::CuttlefishConfig& config,
-                                cvd::ProcessMonitor* process_monitor,
-                                std::function<bool(cvd::MonitorEntry*)> callback);
 void LaunchAdbConnectorIfEnabled(cvd::ProcessMonitor* process_monitor,
                                  const vsoc::CuttlefishConfig& config,
                                  cvd::SharedFD adbd_events_pipe);
-void LaunchSocketForwardProxyIfEnabled(cvd::ProcessMonitor* process_monitor,
-                                 const vsoc::CuttlefishConfig& config);
 void LaunchSocketVsockProxyIfEnabled(cvd::ProcessMonitor* process_monitor,
                                  const vsoc::CuttlefishConfig& config);
-void LaunchIvServerIfEnabled(cvd::ProcessMonitor* process_monitor,
-                             const vsoc::CuttlefishConfig& config);
 void LaunchTombstoneReceiverIfEnabled(const vsoc::CuttlefishConfig& config,
                                       cvd::ProcessMonitor* process_monitor);
diff --git a/host/commands/run_cvd/main.cc b/host/commands/run_cvd/main.cc
index 5ea68a3..fdd909d 100644
--- a/host/commands/run_cvd/main.cc
+++ b/host/commands/run_cvd/main.cc
@@ -35,23 +35,20 @@
 #include <thread>
 #include <vector>
 
+#include <android-base/strings.h>
 #include <gflags/gflags.h>
 #include <glog/logging.h>
 
 #include "common/libs/fs/shared_buf.h"
 #include "common/libs/fs/shared_fd.h"
 #include "common/libs/fs/shared_select.h"
-#include "common/libs/strings/str_split.h"
 #include "common/libs/utils/environment.h"
 #include "common/libs/utils/files.h"
 #include "common/libs/utils/subprocess.h"
 #include "common/libs/utils/size_utils.h"
-#include "common/vsoc/lib/vsoc_memory.h"
-#include "common/vsoc/shm/screen_layout.h"
 #include "host/commands/run_cvd/launch.h"
 #include "host/commands/run_cvd/runner_defs.h"
 #include "host/commands/run_cvd/process_monitor.h"
-#include "host/commands/run_cvd/vsoc_shared_memory.h"
 #include "host/libs/config/cuttlefish_config.h"
 #include "host/commands/kernel_log_monitor/kernel_log_server.h"
 #include <host/libs/vm_manager/crosvm_manager.h>
@@ -99,33 +96,12 @@
     return MaybeWriteToForegroundLauncher();
   }
 
-  bool  OnE2eTestCompleted(int exit_code) {
-    if (exit_code != 0) {
-      LOG(ERROR) << "VSoC e2e test failed";
-      state_ |= kE2eTestFailed;
-    } else {
-      LOG(INFO) << "VSoC e2e test passed";
-      state_ |= kE2eTestPassed;
-    }
-    return MaybeWriteToForegroundLauncher();
-  }
-
   bool BootCompleted() const {
-    bool boot_completed = state_ & kGuestBootCompleted;
-    bool test_passed_or_disabled =
-        (state_ & kE2eTestPassed) || (state_ & kE2eTestDisabled);
-    bool something_failed =
-        state_ & ~(kGuestBootCompleted | kE2eTestPassed | kE2eTestDisabled);
-    return boot_completed && test_passed_or_disabled && !something_failed;
-  }
-
-  bool DisableE2eTests() {
-    state_ |= kE2eTestDisabled;
-    return MaybeWriteToForegroundLauncher();
+    return state_ & kGuestBootCompleted;
   }
 
   bool BootFailed() const {
-    return state_ & (kGuestBootFailed | kE2eTestFailed);
+    return state_ & kGuestBootFailed;
   }
 
  private:
@@ -141,8 +117,6 @@
         SendExitCode(cvd::RunnerExitCodes::kSuccess);
       } else if (state_ & kGuestBootFailed) {
         SendExitCode(cvd::RunnerExitCodes::kVirtualDeviceBootFailed);
-      } else if (state_ & kE2eTestFailed) {
-        SendExitCode(cvd::RunnerExitCodes::kE2eTestFailed);
       } else {
         // No final state was reached
         return false;
@@ -158,9 +132,6 @@
   static const int kBootStarted = 0;
   static const int kGuestBootCompleted = 1 << 0;
   static const int kGuestBootFailed = 1 << 1;
-  static const int kE2eTestPassed = 1 << 2;
-  static const int kE2eTestFailed = 1 << 3;
-  static const int kE2eTestDisabled = 1 << 4;
 };
 
 // Abuse the process monitor to make it call us back when boot events are ready
@@ -178,22 +149,6 @@
       });
 }
 
-void LaunchE2eTestIfEnabled(cvd::ProcessMonitor* process_monitor,
-                            std::shared_ptr<CvdBootStateMachine> state_machine,
-                            const vsoc::CuttlefishConfig& config) {
-  if (config.run_e2e_test()) {
-    process_monitor->StartSubprocess(
-        cvd::Command(config.e2e_test_binary()),
-        [state_machine](cvd::MonitorEntry* entry) {
-          auto test_result = entry->proc->Wait();
-          state_machine->OnE2eTestCompleted(test_result);
-          return false;
-        });
-  } else {
-    state_machine->DisableE2eTests();
-  }
-}
-
 bool WriteCuttlefishEnvironment(const vsoc::CuttlefishConfig& config) {
   auto env = cvd::SharedFD::Open(config.cuttlefish_env_path().c_str(),
                                  O_CREAT | O_RDWR, 0755);
@@ -237,8 +192,6 @@
       LOG(INFO) << "Virtual device booted successfully";
     } else if (exit_code == RunnerExitCodes::kVirtualDeviceBootFailed) {
       LOG(ERROR) << "Virtual device failed to boot";
-    } else if (exit_code == RunnerExitCodes::kE2eTestFailed) {
-      LOG(ERROR) << "Host VSoC region end to end test failed";
     } else {
       LOG(ERROR) << "Unexpected exit code: " << exit_code;
     }
@@ -304,6 +257,12 @@
             client->Write(&response, sizeof(response));
           }
           break;
+        case cvd::LauncherAction::kStatus: {
+          // TODO(schuffelen): Return more information on a side channel
+          auto response = cvd::LauncherResponse::kSuccess;
+          client->Write(&response, sizeof(response));
+          break;
+        }
         default:
           LOG(ERROR) << "Unrecognized launcher action: "
                      << static_cast<char>(action);
@@ -345,7 +304,7 @@
       LOG(FATAL) << "Failed to read input files. Error was \"" << input_fd->StrError() << "\"";
     }
   }
-  std::vector<std::string> input_files = cvd::StrSplit(input_files_str, '\n');
+  std::vector<std::string> input_files = android::base::Split(input_files_str, "\n");
   bool found_config = false;
   for (const auto& file : input_files) {
     if (file.find("cuttlefish_config.json") != std::string::npos) {
@@ -450,10 +409,6 @@
 
   LaunchUsbServerIfEnabled(*config, &process_monitor);
 
-  LaunchIvServerIfEnabled(&process_monitor, *config);
-  // Launch the e2e tests after the ivserver is ready
-  LaunchE2eTestIfEnabled(&process_monitor, boot_state_machine, *config);
-
   // The vnc server needs to be launched after the ivserver because it connects
   // to it when using qemu. It needs to launch before the VMM because it serves
   // on several sockets (input devices, vsock frame server) when using crosvm.
@@ -468,10 +423,7 @@
   }
 
   // Start other host processes
-  LaunchSocketForwardProxyIfEnabled(&process_monitor, *config);
   LaunchSocketVsockProxyIfEnabled(&process_monitor, *config);
-  LaunchStreamAudioIfEnabled(*config, &process_monitor,
-                             GetOnSubprocessExitCallback(*config));
   LaunchAdbConnectorIfEnabled(&process_monitor, *config, adbd_events_pipe);
 
   ServerLoop(launcher_monitor_socket, &process_monitor); // Should not return
diff --git a/host/commands/run_cvd/runner_defs.h b/host/commands/run_cvd/runner_defs.h
index 255f5b0..1486b11 100644
--- a/host/commands/run_cvd/runner_defs.h
+++ b/host/commands/run_cvd/runner_defs.h
@@ -48,6 +48,7 @@
 
 // Actions supported by the launcher server
 enum class LauncherAction : char {
+  kStatus = 'I',
   kStop = 'X',
 };
 
diff --git a/host/commands/run_cvd/screen_region_handler.cc b/host/commands/run_cvd/screen_region_handler.cc
deleted file mode 100644
index 9be969e..0000000
--- a/host/commands/run_cvd/screen_region_handler.cc
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <glog/logging.h>
-
-#include "common/vsoc/lib/screen_region_view.h"
-#include "host/commands/run_cvd/pre_launch_initializers.h"
-#include "host/libs/config/cuttlefish_config.h"
-
-void InitializeScreenRegion(const vsoc::CuttlefishConfig& config) {
-  auto region =
-      vsoc::screen::ScreenRegionView::GetInstance(vsoc::GetDomain().c_str());
-  if (!region) {
-    LOG(FATAL) << "Screen region was not found";
-    return;
-  }
-  auto dest = region->data();
-  dest->x_res = config.x_res();
-  dest->y_res = config.y_res();
-  dest->dpi = config.dpi();
-  dest->refresh_rate_hz = config.refresh_rate_hz();
-}
diff --git a/host/commands/run_cvd/vsoc_shared_memory.cc b/host/commands/run_cvd/vsoc_shared_memory.cc
deleted file mode 100644
index 0278cad..0000000
--- a/host/commands/run_cvd/vsoc_shared_memory.cc
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (C) 2018 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 "host/commands/run_cvd/vsoc_shared_memory.h"
-
-#include <unistd.h>
-
-#include <map>
-#include <vector>
-
-#include "common/libs/fs/shared_fd.h"
-#include "common/libs/utils/size_utils.h"
-#include "common/vsoc/lib/vsoc_memory.h"
-#include "glog/logging.h"
-
-#include "uapi/vsoc_shm.h"
-
-namespace vsoc {
-
-namespace {
-
-uint32_t OffsetOfRegionData(const VSoCRegionLayout& layout) {
-  uint32_t offset = 0;
-  // Signal tables
-  offset +=
-      (1 << layout.guest_to_host_signal_table_log_size()) * sizeof(uint32_t);
-  offset +=
-      (1 << layout.host_to_guest_signal_table_log_size()) * sizeof(uint32_t);
-  // Interrup signals
-  offset += 2 * sizeof(uint32_t);
-  return offset;
-}
-
-struct VSoCRegionAllocator {
-  const VSoCRegionLayout* region_layout;
-  uint32_t begin_offset;
-  uint32_t region_size;
-
-  VSoCRegionAllocator(const VSoCRegionLayout& layout, uint32_t offset,
-                      uint32_t requested_layout_increase = 0)
-      : region_layout(&layout),
-        begin_offset(offset),
-        region_size(cvd::AlignToPageSize(OffsetOfRegionData(layout) +
-                                         layout.layout_size() +
-                                         requested_layout_increase)) {}
-};
-
-// Writes a region's signal table layout to shared memory. Returns the region
-// offset of free memory after the table and interrupt signaled word.
-uint32_t WriteSignalTableDescription(vsoc_signal_table_layout* layout,
-                                     uint32_t offset, int log_size) {
-  layout->num_nodes_lg2 = log_size;
-  // First the signal table
-  layout->futex_uaddr_table_offset = offset;
-  offset += (1 << log_size) * sizeof(uint32_t);
-  // Then the interrupt signaled word
-  layout->interrupt_signalled_offset = offset;
-  offset += sizeof(uint32_t);
-  return offset;
-}
-
-// Writes a region's layout description to shared memory
-void WriteRegionDescription(vsoc_device_region* shmem_region_desc,
-                            const VSoCRegionAllocator& allocator) {
-  // Region versions are deprecated, write some sensible value
-  shmem_region_desc->current_version = 0;
-  shmem_region_desc->min_compatible_version = 0;
-
-  shmem_region_desc->region_begin_offset = allocator.begin_offset;
-  shmem_region_desc->region_end_offset =
-      allocator.begin_offset + allocator.region_size;
-  shmem_region_desc->offset_of_region_data =
-      OffsetOfRegionData(*allocator.region_layout);
-  strncpy(shmem_region_desc->device_name,
-          allocator.region_layout->region_name(), VSOC_DEVICE_NAME_SZ - 1);
-  shmem_region_desc->device_name[VSOC_DEVICE_NAME_SZ - 1] = '\0';
-  // Guest to host signal table at the beginning of the region
-  uint32_t offset = 0;
-  offset = WriteSignalTableDescription(
-      &shmem_region_desc->guest_to_host_signal_table, offset,
-      allocator.region_layout->guest_to_host_signal_table_log_size());
-  // Host to guest signal table right after
-  offset = WriteSignalTableDescription(
-      &shmem_region_desc->host_to_guest_signal_table, offset,
-      allocator.region_layout->host_to_guest_signal_table_log_size());
-  // Double check that the region metadata does not collide with the data
-  if (offset > shmem_region_desc->offset_of_region_data) {
-    LOG(FATAL) << "Error: Offset of region data too small (is "
-               << shmem_region_desc->offset_of_region_data << " should be "
-               << offset << " ) for region "
-               << allocator.region_layout->region_name() << ". This is a bug";
-  }
-}
-
-void WriteLayout(void* shared_memory,
-                 const std::vector<VSoCRegionAllocator>& allocators,
-                 uint32_t file_size) {
-  // Device header
-  static_assert(CURRENT_VSOC_LAYOUT_MAJOR_VERSION == 2,
-                "Region layout code must be updated");
-  auto header = reinterpret_cast<vsoc_shm_layout_descriptor*>(shared_memory);
-  header->major_version = CURRENT_VSOC_LAYOUT_MAJOR_VERSION;
-  header->minor_version = CURRENT_VSOC_LAYOUT_MINOR_VERSION;
-  header->size = file_size;
-  header->region_count = allocators.size();
-
-  std::map<std::string, size_t> region_idx_by_name;
-  for (size_t idx = 0; idx < allocators.size(); ++idx) {
-    region_idx_by_name[allocators[idx].region_layout->region_name()] = idx;
-  }
-
-  // Region descriptions go right after the layout descriptor
-  header->vsoc_region_desc_offset = sizeof(vsoc_shm_layout_descriptor);
-  auto region_descriptions = reinterpret_cast<vsoc_device_region*>(header + 1);
-  for (size_t idx = 0; idx < allocators.size(); ++idx) {
-    auto shmem_region_desc = &region_descriptions[idx];
-    const auto& region = *allocators[idx].region_layout;
-    WriteRegionDescription(shmem_region_desc, allocators[idx]);
-    // Handle managed_by links
-    if (region.managed_by()) {
-      auto manager_idx = region_idx_by_name.at(region.managed_by());
-      if (manager_idx == VSOC_REGION_WHOLE) {
-        LOG(FATAL) << "Region '" << region.region_name() << "' has owner "
-                   << region.managed_by() << " with index " << manager_idx
-                   << " which is the default value for regions without an "
-                      "owner. Choose a different region to be at index "
-                   << manager_idx
-                   << ", make sure the chosen region is NOT the owner of any "
-                      "other region";
-      }
-      shmem_region_desc->managed_by = manager_idx;
-    } else {
-      shmem_region_desc->managed_by = VSOC_REGION_WHOLE;
-    }
-  }
-}
-}  // namespace
-
-void CreateSharedMemoryFile(
-    const std::string& path,
-    const std::map<std::string, uint32_t>& layout_increases) {
-  // TODO(ender): Lock the file after creation and check lock status upon second
-  // execution attempt instead of throwing an error.
-  LOG_IF(WARNING, unlink(path.c_str()) == 0)
-      << "Removed existing instance of " << path
-      << ". We currently don't know if another instance of daemon is running";
-  auto shared_mem_fd = cvd::SharedFD::Open(
-      path.c_str(), O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
-  LOG_IF(FATAL, !shared_mem_fd->IsOpen())
-      << "Error in creating shared_memory file: " << shared_mem_fd->StrError();
-
-  auto region_layouts = VSoCMemoryLayout::Get()->GetRegions();
-  std::vector<VSoCRegionAllocator> allocators;
-  uint32_t file_size =
-      cvd::AlignToPageSize(sizeof(vsoc_shm_layout_descriptor) +
-                           region_layouts.size() * sizeof(vsoc_device_region));
-  for (auto layout : region_layouts) {
-    allocators.emplace_back(*layout, file_size /* offset */,
-                            layout_increases.count(layout->region_name())
-                                ? layout_increases.at(layout->region_name())
-                                : 0);
-    file_size += allocators.back().region_size;
-  }
-  file_size = cvd::RoundUpToNextPowerOf2(file_size);
-
-  int truncate_res = shared_mem_fd->Truncate(file_size);
-  LOG_IF(FATAL, truncate_res == -1)
-      << "Error in sizing up the shared memory file: "
-      << shared_mem_fd->StrError();
-
-  void* mmap_addr =
-      shared_mem_fd->Mmap(0, file_size, PROT_READ | PROT_WRITE, MAP_SHARED, 0);
-  LOG_IF(FATAL, mmap_addr == MAP_FAILED)
-      << "Error mmaping file: " << strerror(errno);
-  WriteLayout(mmap_addr, allocators, file_size);
-  munmap(mmap_addr, file_size);
-}
-
-}  // namespace vsoc
diff --git a/host/commands/run_cvd/vsoc_shared_memory.h b/host/commands/run_cvd/vsoc_shared_memory.h
deleted file mode 100644
index 94c03a1..0000000
--- a/host/commands/run_cvd/vsoc_shared_memory.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2018 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 <map>
-#include <string>
-
-namespace vsoc {
-
-// Creates the shared memory file and initializes it with with the region
-// information. The size of each region is determined to be the smallest
-// multiple of page size that can accommodate the header and the layout. The
-// size of the layout can be increased by specifyng it on the
-// layout_increases_by_region_name parameter.
-void CreateSharedMemoryFile(
-    const std::string& path,
-    const std::map<std::string, uint32_t>& layout_increases_by_region_name = {});
-
-}  // namespace vsoc
diff --git a/host/commands/stop_cvd/Android.bp b/host/commands/stop_cvd/Android.bp
index b8322b5..ad279bb 100644
--- a/host/commands/stop_cvd/Android.bp
+++ b/host/commands/stop_cvd/Android.bp
@@ -25,7 +25,6 @@
         "libbase",
         "libcuttlefish_fs",
         "libcuttlefish_utils",
-        "cuttlefish_auto_resources",
     ],
     static_libs: [
         "libcuttlefish_host_config",
diff --git a/host/commands/tombstone_receiver/Android.bp b/host/commands/tombstone_receiver/Android.bp
index 5f5a5a5..bd32cae 100644
--- a/host/commands/tombstone_receiver/Android.bp
+++ b/host/commands/tombstone_receiver/Android.bp
@@ -26,7 +26,6 @@
         "libcuttlefish_fs",
         "liblog",
         "libcuttlefish_utils",
-        "cuttlefish_auto_resources",
     ],
     static_libs: [
         "libcuttlefish_host_config",
diff --git a/host/commands/virtual_usb_manager/Android.bp b/host/commands/virtual_usb_manager/Android.bp
index 9c86b70..6669b8c 100644
--- a/host/commands/virtual_usb_manager/Android.bp
+++ b/host/commands/virtual_usb_manager/Android.bp
@@ -34,10 +34,8 @@
         "cuttlefish_glog",
     ],
     shared_libs: [
-        "vsoc_lib",
         "libcuttlefish_fs",
         "libcuttlefish_utils",
-        "cuttlefish_auto_resources",
         "libbase",
     ],
     static_libs: [
diff --git a/host/commands/virtual_usb_manager/usbip/Android.bp b/host/commands/virtual_usb_manager/usbip/Android.bp
index b01acb1..8a52b90 100644
--- a/host/commands/virtual_usb_manager/usbip/Android.bp
+++ b/host/commands/virtual_usb_manager/usbip/Android.bp
@@ -27,7 +27,6 @@
     ],
     shared_libs: [
         "libcuttlefish_fs",
-        "cuttlefish_auto_resources",
         "libbase",
     ],
     static_libs: [
diff --git a/host/frontend/Android.bp b/host/frontend/Android.bp
index 5a053e7..8d78a9f 100644
--- a/host/frontend/Android.bp
+++ b/host/frontend/Android.bp
@@ -14,7 +14,6 @@
 // limitations under the License.
 
 subdirs = [
-    "stream_audio",
     "vnc_server",
     "adb_connector",
 ]
diff --git a/host/frontend/adb_connector/Android.bp b/host/frontend/adb_connector/Android.bp
index 3af5ef1..41fa1f6 100644
--- a/host/frontend/adb_connector/Android.bp
+++ b/host/frontend/adb_connector/Android.bp
@@ -28,7 +28,6 @@
     shared_libs: [
         "libbase",
         "libcuttlefish_fs",
-        "libcuttlefish_strings",
         "liblog",
     ],
     defaults: ["cuttlefish_host_only"],
diff --git a/host/frontend/adb_connector/main.cpp b/host/frontend/adb_connector/main.cpp
index 93a929d..3d3d824 100644
--- a/host/frontend/adb_connector/main.cpp
+++ b/host/frontend/adb_connector/main.cpp
@@ -28,7 +28,6 @@
 #include <host/commands/kernel_log_monitor/kernel_log_server.h>
 
 #include "common/libs/fs/shared_fd.h"
-#include "common/libs/strings/str_split.h"
 #include "host/libs/config/cuttlefish_config.h"
 #include "host/libs/adb_connection_maintainer/adb_connection_maintainer.h"
 
diff --git a/host/frontend/stream_audio/main.cpp b/host/frontend/stream_audio/main.cpp
deleted file mode 100644
index f63e315..0000000
--- a/host/frontend/stream_audio/main.cpp
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- *
- * Copyright (C) 2018 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.
- */
-
-// For each client that connects initially a header is sent with the following,
-// in this order, all as uint16_t in network-byte-order:
-//  number of channels, frame rate
-//
-// Following, audio packets are sent as a uint32_t length (network byte order)
-// indicating the number of bytes
-// followed by the (opus) frame_size as a uint32_t
-// followed by <length> bytes.
-
-#include "common/libs/tcp_socket/tcp_socket.h"
-#include "common/vsoc/lib/audio_data_region_view.h"
-#include "common/vsoc/lib/circqueue_impl.h"
-#include "common/vsoc/lib/vsoc_audio_message.h"
-#include "host/frontend/stream_audio/opuscpp/opus_wrapper.h"
-#include "host/libs/config/cuttlefish_config.h"
-
-#include <android-base/logging.h>
-#include <gflags/gflags.h>
-
-#include <arpa/inet.h>
-
-#include <cstdint>
-#include <cstring>
-#include <iostream>
-#include <memory>
-#include <mutex>
-#include <thread>
-#include <tuple>
-#include <vector>
-
-using vsoc::audio_data::AudioDataRegionView;
-
-DEFINE_int32(port, 0, "port on which to serve audio.");
-
-namespace {
-
-// Read audio frames from the AudioDataRegionView
-class AudioStreamer {
- public:
-  cvd::Message MakeAudioDescriptionHeader() const {
-    std::unique_lock guard(buffer_lock_);
-    while (!audio_buffer_) {
-      buffer_cv_.wait(guard);
-    }
-
-    const size_t num_channels = header_.frame_size / sizeof(opus_int16);
-    return cvd::CreateMessage(static_cast<std::uint16_t>(num_channels),
-                              static_cast<std::uint16_t>(header_.frame_rate));
-  }
-
-  std::uint32_t frame_rate() const {
-    std::unique_lock guard(buffer_lock_);
-    while (!audio_buffer_) {
-      buffer_cv_.wait(guard);
-    }
-    return header_.frame_rate;
-  }
-
-  std::uint32_t num_channels() const {
-    std::unique_lock guard(buffer_lock_);
-    while (!audio_buffer_) {
-      buffer_cv_.wait(guard);
-    }
-    return header_.frame_size / sizeof(opus_int16);
-  }
-
-  // Returns the frame id and audio frame
-  std::tuple<std::int64_t, std::shared_ptr<const cvd::Message>> audio_buffer(
-      std::int64_t previous_frame_num) const {
-    std::unique_lock guard(buffer_lock_);
-    while (header_.frame_num <= previous_frame_num) {
-      buffer_cv_.wait(guard);
-    }
-
-    return {header_.frame_num, audio_buffer_};
-  }
-
-  void Update() {
-    auto audio_data_rv =
-        AudioDataRegionView::GetInstance(vsoc::GetDomain().c_str());
-    auto worker = audio_data_rv->StartWorker();
-    std::vector<char> new_buffer;
-
-    while (true) {
-      new_buffer.resize(new_buffer.capacity());
-
-      auto [new_header, payload_size, audio_data] =
-          NextAudioMessage(audio_data_rv, &new_buffer);
-
-      LOG(DEBUG) << "stream " << new_header.stream_number << ", frame "
-                 << new_header.frame_num << ", rate " << new_header.frame_rate
-                 << ", channel_mask " << new_header.channel_mask << ", format "
-                 << new_header.format << ", payload_size " << payload_size
-                 << '\n';
-
-      {
-        std::lock_guard guard(buffer_lock_);
-        CheckAudioConfigurationIsSame(new_header);
-        header_ = new_header;
-        audio_buffer_ = std::make_shared<const cvd::Message>(
-            audio_data, audio_data + payload_size);
-      }
-      buffer_cv_.notify_all();
-    }
-  }
-
- private:
-  struct AudioMessage {
-    gce_audio_message header;
-    std::size_t payload_size;
-    const std::uint8_t* payload_data;
-  };
-
-  void ReadAudioMessage(AudioDataRegionView* audio_data_rv,
-                        std::vector<char>* buffer) const {
-    while (true) {
-      auto read_size = audio_data_rv->data()->audio_queue.Read(
-          audio_data_rv, buffer->data(), buffer->size());
-      if (read_size == -ENOSPC) {
-        DoubleSize(buffer);
-      } else if (read_size < 0) {
-        LOG(ERROR) << "CircularPacketQueue::Read returned " << read_size;
-      } else {
-        buffer->resize(read_size);
-        return;
-      }
-    }
-  }
-
-  void DoubleSize(std::vector<char>* buffer) const {
-    if (buffer->empty()) {
-      buffer->resize(1);
-    } else {
-      buffer->resize(buffer->size() * 2);
-    }
-  }
-
-  gce_audio_message GetHeaderFromBuffer(const std::vector<char>& buffer) const {
-    gce_audio_message new_header{};
-    CHECK_GE(buffer.size(), sizeof new_header);
-
-    std::memcpy(&new_header, buffer.data(), sizeof new_header);
-    CHECK_GT(new_header.stream_number, 0u);
-    return new_header;
-  }
-
-  std::tuple<std::size_t, const std::uint8_t*> GetPayloadFromBuffer(
-      const std::vector<char>& buffer) const {
-    const auto payload_size = buffer.size() - sizeof(gce_audio_message);
-    const auto* audio_data =
-        reinterpret_cast<const std::uint8_t*>(buffer.data()) +
-        sizeof(gce_audio_message);
-    return {payload_size, audio_data};
-  }
-
-  AudioMessage NextAudioMessage(AudioDataRegionView* audio_data_rv,
-                                std::vector<char>* buffer) const {
-    while (true) {
-      ReadAudioMessage(audio_data_rv, buffer);
-      auto header = GetHeaderFromBuffer(*buffer);
-      if (header.message_type == gce_audio_message::DATA_SAMPLES) {
-        auto [payload_size, payload_data] = GetPayloadFromBuffer(*buffer);
-        return {header, payload_size, payload_data};
-      }
-    }
-  }
-
-  void CheckAudioConfigurationIsSame(
-      const gce_audio_message& new_header) const {
-    if (audio_buffer_) {
-      CHECK_EQ(header_.frame_size, new_header.frame_size)
-          << "audio frame_size changed";
-      CHECK_EQ(header_.frame_rate, new_header.frame_rate)
-          << "audio frame_rate changed";
-      CHECK_EQ(header_.stream_number, new_header.stream_number)
-          << "audio stream_number changed";
-    }
-  }
-
-  std::shared_ptr<const cvd::Message> audio_buffer_{};
-  gce_audio_message header_{};
-  mutable std::mutex buffer_lock_;
-  mutable std::condition_variable buffer_cv_;
-};
-
-void HandleClient(AudioStreamer* audio_streamer,
-                  cvd::ClientSocket client_socket) {
-  auto num_channels = audio_streamer->num_channels();
-  opus::Encoder enc(audio_streamer->frame_rate(),
-                    audio_streamer->num_channels(), OPUS_APPLICATION_AUDIO);
-  CHECK(enc.valid()) << "Could not construct Encoder. Maybe bad frame_rate ("
-                     << audio_streamer->frame_rate() <<") or num_channels ("
-                     << audio_streamer->num_channels() << ")?";
-
-  auto header = audio_streamer->MakeAudioDescriptionHeader();
-  client_socket.SendNoSignal(header);
-  std::int64_t previous_frame_num = 0;
-
-  while (!client_socket.closed()) {
-    CHECK(enc.valid()) << "encoder in invalid state";
-    auto [frame_num, audio_data] =
-        audio_streamer->audio_buffer(previous_frame_num);
-    previous_frame_num = frame_num;
-
-    std::vector<opus_int16> pcm(audio_data->size() / sizeof(opus_int16));
-    std::memcpy(pcm.data(), audio_data->data(), audio_data->size());
-    // in opus terms "frame_size" is the number of unencoded samples per frame
-    const std::uint32_t frame_size = pcm.size() / num_channels;
-    auto encoded = enc.Encode(pcm, frame_size);
-    for (auto&& p : encoded) {
-      auto length_message =
-          cvd::CreateMessage(static_cast<std::uint32_t>(p.size()));
-      client_socket.SendNoSignal(length_message);
-      client_socket.SendNoSignal(cvd::CreateMessage(frame_size));
-      client_socket.SendNoSignal(p);
-    }
-  }
-}
-
-[[noreturn]] void AudioStreamerUpdateLoop(AudioStreamer* audio_streamer) {
-  while (true) {
-    audio_streamer->Update();
-  }
-}
-
-[[noreturn]] void MainLoop() {
-  AudioStreamer audio_streamer;
-  std::thread audio_streamer_update_thread;
-  auto server = cvd::ServerSocket(FLAGS_port);
-  while (true) {
-    LOG(INFO) << "waiting for client connection";
-    auto client = server.Accept();
-    LOG(INFO) << "client socket accepted";
-    if (!audio_streamer_update_thread.joinable()) {
-      audio_streamer_update_thread =
-          std::thread{AudioStreamerUpdateLoop, &audio_streamer};
-    }
-    std::thread(HandleClient, &audio_streamer, std::move(client)).detach();
-  }
-}
-
-}  // namespace
-
-int main(int argc, char* argv[]) {
-  ::android::base::InitLogging(argv, android::base::StderrLogger);
-  gflags::SetUsageMessage(" ");
-  google::ParseCommandLineFlags(&argc, &argv, true);
-  if (FLAGS_port <= 0) {
-    std::cerr << "--port must be specified.\n";
-    return 1;
-  }
-  MainLoop();
-}
diff --git a/host/frontend/stream_audio/opuscpp/Android.bp b/host/frontend/stream_audio/opuscpp/Android.bp
deleted file mode 100644
index 9ad7a52..0000000
--- a/host/frontend/stream_audio/opuscpp/Android.bp
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// Copyright (C) 2019 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.
-
-cc_library_host_static {
-    name: "libopuscpp",
-    srcs: [
-        "opus_wrapper.cc",
-    ],
-    shared_libs: [
-        "libbase",
-        "libopus",
-    ],
-    cpp_std: "c++17",
-    enabled: false,
-    defaults: ["cuttlefish_host_only"],
-}
diff --git a/host/frontend/stream_audio/opuscpp/opus_wrapper.cc b/host/frontend/stream_audio/opuscpp/opus_wrapper.cc
deleted file mode 100644
index 538bee8..0000000
--- a/host/frontend/stream_audio/opuscpp/opus_wrapper.cc
+++ /dev/null
@@ -1,177 +0,0 @@
-// Copyright 2018 Google LLC
-//
-// 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
-//
-//     https://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.
-
-// https://github.com/google/opuscpp
-
-#include <iterator>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <android-base/logging.h>
-#include "host/frontend/stream_audio/opuscpp/opus_wrapper.h"
-
-std::string opus::ErrorToString(int error) {
-  switch (error) {
-    case OPUS_OK:
-      return "OK";
-    case OPUS_BAD_ARG:
-      return "One or more invalid/out of range arguments.";
-    case OPUS_BUFFER_TOO_SMALL:
-      return "The mode struct passed is invalid.";
-    case OPUS_INTERNAL_ERROR:
-      return "An internal error was detected.";
-    case OPUS_INVALID_PACKET:
-      return "The compressed data passed is corrupted.";
-    case OPUS_UNIMPLEMENTED:
-      return "Invalid/unsupported request number.";
-    case OPUS_INVALID_STATE:
-      return "An encoder or decoder structure is invalid or already freed.";
-    default:
-      return "Unknown error code: " + std::to_string(error);
-  }
-}
-
-void opus::internal::OpusDestroyer::operator()(OpusEncoder* encoder) const
-    noexcept {
-  opus_encoder_destroy(encoder);
-}
-
-void opus::internal::OpusDestroyer::operator()(OpusDecoder* decoder) const
-    noexcept {
-  opus_decoder_destroy(decoder);
-}
-
-opus::Encoder::Encoder(opus_int32 sample_rate, int num_channels,
-                       int application, int expected_loss_percent)
-    : num_channels_{num_channels} {
-  int error{};
-  encoder_.reset(
-      opus_encoder_create(sample_rate, num_channels, application, &error));
-  valid_ = error == OPUS_OK;
-  if (!valid()) {
-    LOG(INFO) << "Could not construct encoder. Error: " << ErrorToString(error);
-    return;
-  }
-  if (expected_loss_percent > 0) {
-    LOG(INFO) << "Enabling FEC in the encoder.";
-    Ctl(OPUS_SET_INBAND_FEC(1));
-    Ctl(OPUS_SET_PACKET_LOSS_PERC(expected_loss_percent));
-  }
-}
-
-bool opus::Encoder::ResetState() {
-  valid_ = Ctl(OPUS_RESET_STATE) == OPUS_OK;
-  return valid_;
-}
-
-bool opus::Encoder::SetBitrate(int bitrate) {
-  valid_ = Ctl(OPUS_SET_BITRATE(bitrate)) == OPUS_OK;
-  return valid_;
-}
-
-bool opus::Encoder::SetVariableBitrate(int vbr) {
-  valid_ = Ctl(OPUS_SET_VBR(vbr)) == OPUS_OK;
-  return valid_;
-}
-
-bool opus::Encoder::SetComplexity(int complexity) {
-  valid_ = Ctl(OPUS_SET_COMPLEXITY(complexity)) == OPUS_OK;
-  return valid_;
-}
-
-int opus::Encoder::GetLookahead() {
-  opus_int32 skip{};
-  valid_ = Ctl(OPUS_GET_LOOKAHEAD(&skip)) == OPUS_OK;
-  return skip;
-}
-
-std::vector<std::vector<unsigned char>> opus::Encoder::Encode(
-    const std::vector<opus_int16>& pcm, int frame_size) {
-  constexpr auto sample_size = sizeof(pcm[0]);
-  const auto frame_length = frame_size * num_channels_ * sample_size;
-  auto data_length = pcm.size() * sample_size;
-  if (data_length % frame_length != 0u) {
-    LOG(WARNING) << "PCM samples contain an incomplete frame. Ignoring the "
-                    "incomplete frame.";
-    data_length -= (data_length % frame_length);
-  }
-
-  std::vector<std::vector<unsigned char>> encoded;
-  for (std::size_t i{}; i < data_length; i += frame_length) {
-    encoded.push_back(EncodeFrame(pcm.begin() + (i / sample_size), frame_size));
-  }
-  return encoded;
-}
-
-std::vector<unsigned char> opus::Encoder::EncodeFrame(
-    const std::vector<opus_int16>::const_iterator& frame_start,
-    int frame_size) {
-  const auto frame_length = (frame_size * num_channels_ * sizeof(*frame_start));
-  std::vector<unsigned char> encoded(frame_length);
-  auto num_bytes = opus_encode(encoder_.get(), &*frame_start, frame_size,
-                               encoded.data(), encoded.size());
-  if (num_bytes < 0) {
-    LOG(ERROR) << "Encode error: " << opus::ErrorToString(num_bytes);
-    return {};
-  }
-  encoded.resize(num_bytes);
-  return encoded;
-}
-
-opus::Decoder::Decoder(opus_uint32 sample_rate, int num_channels)
-    : num_channels_(num_channels) {
-  int error{};
-  decoder_.reset(opus_decoder_create(sample_rate, num_channels, &error));
-  valid_ = error == OPUS_OK;
-}
-
-std::vector<opus_int16> opus::Decoder::Decode(
-    const std::vector<std::vector<unsigned char>>& packets, int frame_size,
-    bool decode_fec) {
-  std::vector<opus_int16> decoded;
-  for (const auto& enc : packets) {
-    auto just_decoded = Decode(enc, frame_size, decode_fec);
-    decoded.insert(std::end(decoded), std::begin(just_decoded),
-                   std::end(just_decoded));
-  }
-  return decoded;
-}
-
-std::vector<opus_int16> opus::Decoder::Decode(
-    const std::vector<unsigned char>& packet, int frame_size, bool decode_fec) {
-  const auto frame_length = (frame_size * num_channels_ * sizeof(opus_int16));
-  std::vector<opus_int16> decoded(frame_length);
-  auto num_samples = opus_decode(decoder_.get(), packet.data(), packet.size(),
-                                 decoded.data(), frame_size, decode_fec);
-  if (num_samples < 0) {
-    LOG(ERROR) << "Decode error: " << opus::ErrorToString(num_samples);
-    return {};
-  }
-  decoded.resize(num_samples * num_channels_);
-  return decoded;
-}
-
-std::vector<opus_int16> opus::Decoder::DecodeDummy(int frame_size) {
-  const auto frame_length = (frame_size * num_channels_ * sizeof(opus_int16));
-  std::vector<opus_int16> decoded(frame_length);
-  auto num_samples =
-      opus_decode(decoder_.get(), nullptr, 0, decoded.data(), frame_size, true);
-  if (num_samples < 0) {
-    LOG(ERROR) << "Decode error: " << opus::ErrorToString(num_samples);
-    return {};
-  }
-  decoded.resize(num_samples * num_channels_);
-  return decoded;
-}
diff --git a/host/frontend/stream_audio/opuscpp/opus_wrapper.h b/host/frontend/stream_audio/opuscpp/opus_wrapper.h
deleted file mode 100644
index 07e932e..0000000
--- a/host/frontend/stream_audio/opuscpp/opus_wrapper.h
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright 2018 Google LLC
-//
-// 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
-//
-//     https://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.
-
-// https://github.com/google/opuscpp
-
-#ifndef OPUSCPP_OPUS_WRAPPER_H_
-#define OPUSCPP_OPUS_WRAPPER_H_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "opus.h"
-
-namespace opus {
-
-std::string ErrorToString(int error);
-
-namespace internal {
-// Deleter for OpusEncoders and OpusDecoders
-struct OpusDestroyer {
-  void operator()(OpusEncoder* encoder) const noexcept;
-  void operator()(OpusDecoder* decoder) const noexcept;
-};
-template <typename T>
-using opus_uptr = std::unique_ptr<T, OpusDestroyer>;
-}  // namespace internal
-
-class Encoder {
- public:
-  // see documentation at:
-  // https://mf4.xiph.org/jenkins/view/opus/job/opus/ws/doc/html/group__opus__encoder.html#gaa89264fd93c9da70362a0c9b96b9ca88
-  // Fs corresponds to sample_rate
-  //
-  // If expected_loss_percent is positive, FEC will be enabled
-  Encoder(opus_int32 sample_rate, int num_channels, int application,
-          int expected_loss_percent = 0);
-
-  // Resets internal state of encoder. This should be called between encoding
-  // different streams so that back-to-back decoding and one-at-a-time decoding
-  // give the same result. Returns true on success.
-  bool ResetState();
-
-  // Sets the desired bitrate. Rates from 500 to 512000 are meaningful as well
-  // as the special values OPUS_AUTO and OPUS_BITRATE_MAX. If this method
-  // is not called, the default value of OPUS_AUTO is used.
-  // Returns true on success.
-  bool SetBitrate(int bitrate);
-
-  // Enables or disables variable bitrate in the encoder. By default, variable
-  // bitrate is enabled. Returns true on success.
-  bool SetVariableBitrate(int vbr);
-
-  // Sets the computational complexity of the encoder, in the range of 0 to 10,
-  // inclusive, with 10 being the highest complexity. Returns true on success.
-  bool SetComplexity(int complexity);
-
-  // Gets the total samples of delay added by the entire codec. This value
-  // is the minimum amount of 'preskip' that has to be specified in an
-  // ogg-stream that encapsulates the encoded audio.
-  int GetLookahead();
-
-  // Takes audio data and encodes it. Returns a sequence of encoded packets.
-  // pcm.size() must be divisible by frame_size * (number of channels);
-  // pcm must not contain any incomplete packets.
-  // see documentation for pcm and frame_size at:
-  // https://mf4.xiph.org/jenkins/view/opus/job/opus/ws/doc/html/group__opus__encoder.html#gad2d6bf6a9ffb6674879d7605ed073e25
-  std::vector<std::vector<unsigned char>> Encode(
-      const std::vector<opus_int16>& pcm, int frame_size);
-
-  int valid() const { return valid_; }
-
- private:
-  std::vector<unsigned char> EncodeFrame(
-      const std::vector<opus_int16>::const_iterator& frame_start,
-      int frame_size);
-
-  template <typename... Ts>
-  int Ctl(int request, Ts... args) const {
-    return opus_encoder_ctl(encoder_.get(), request, args...);
-  }
-
-  int num_channels_{};
-  bool valid_{};
-  internal::opus_uptr<OpusEncoder> encoder_;
-};
-
-class Decoder {
- public:
-  // see documentation at:
-  // https://mf4.xiph.org/jenkins/view/opus/job/opus/ws/doc/html/group__opus__decoder.html#ga753f6fe0b699c81cfd47d70c8e15a0bd
-  // Fs corresponds to sample_rate
-  Decoder(opus_uint32 sample_rate, int num_channels);
-
-  // Takes a sequence of encoded packets and decodes them. Returns the decoded
-  // audio.
-  // see documentation at:
-  // https://mf4.xiph.org/jenkins/view/opus/job/opus/ws/doc/html/group__opus__decoder.html#ga7d1111f64c36027ddcb81799df9b3fc9
-  std::vector<opus_int16> Decode(
-      const std::vector<std::vector<unsigned char>>& packets, int frame_size,
-      bool decode_fec);
-
-  int valid() const { return valid_; }
-
-  // Takes an encoded packet and decodes it. Returns the decoded audio
-  // see documentation at:
-  // https://mf4.xiph.org/jenkins/view/opus/job/opus/ws/doc/html/group__opus__decoder.html#ga7d1111f64c36027ddcb81799df9b3fc9
-  std::vector<opus_int16> Decode(const std::vector<unsigned char>& packet,
-                                 int frame_size, bool decode_fec);
-
-  // Generates a dummy frame by passing nullptr to the underlying opus decode.
-  std::vector<opus_int16> DecodeDummy(int frame_size);
-
- private:
-  int num_channels_{};
-  bool valid_{};
-  internal::opus_uptr<OpusDecoder> decoder_;
-};
-
-}  // namespace opus
-
-#endif
diff --git a/host/frontend/vnc_server/Android.bp b/host/frontend/vnc_server/Android.bp
index fae5a17..0e82b2f 100644
--- a/host/frontend/vnc_server/Android.bp
+++ b/host/frontend/vnc_server/Android.bp
@@ -30,11 +30,9 @@
         "cuttlefish_glog",
     ],
     shared_libs: [
-        "vsoc_lib",
         "libcuttlefish_fs",
         "libcuttlefish_utils",
         "cuttlefish_tcp_socket",
-        "cuttlefish_auto_resources",
         "libbase",
     ],
     static_libs: [
diff --git a/host/frontend/vnc_server/screen_connector.cpp b/host/frontend/vnc_server/screen_connector.cpp
index 03e945a..35cf22f 100644
--- a/host/frontend/vnc_server/screen_connector.cpp
+++ b/host/frontend/vnc_server/screen_connector.cpp
@@ -18,11 +18,11 @@
 
 #include <atomic>
 #include <condition_variable>
+#include <thread>
 
+#include <glog/logging.h>
 #include <gflags/gflags.h>
 
-#include <common/vsoc/lib/screen_region_view.h>
-#include <host/libs/config/cuttlefish_config.h>
 #include "host/frontend/vnc_server/vnc_utils.h"
 
 DEFINE_int32(frame_server_fd, -1, "");
@@ -31,23 +31,6 @@
 namespace vnc {
 
 namespace {
-class VSoCScreenConnector : public ScreenConnector {
- public:
-  int WaitForNewFrameSince(std::uint32_t* seq_num) override {
-    if (!screen_view_) return -1;
-    return screen_view_->WaitForNewFrameSince(seq_num);
-  }
-
-  void* GetBuffer(int buffer_idx) override {
-    if (!screen_view_) return nullptr;
-    return screen_view_->GetBuffer(buffer_idx);
-  }
-
- private:
-  vsoc::screen::ScreenRegionView* screen_view_ =
-      vsoc::screen::ScreenRegionView::GetInstance(vsoc::GetDomain().c_str());
-};
-
 // TODO(b/128852363): Substitute with one based on memory shared with the
 //  wayland mock
 class SocketBasedScreenConnector : public ScreenConnector {
@@ -97,14 +80,19 @@
       }
       while (conn->IsOpen()) {
         int32_t size = 0;
-        conn->Read(&size, sizeof(size));
+        if (conn->Read(&size, sizeof(size)) < 0) {
+          LOG(ERROR) << "Failed to read from hwcomposer: "
+                      << conn->StrError();
+          break;
+        }
         auto buff = reinterpret_cast<uint8_t*>(GetBuffer(current_buffer));
         while (size > 0) {
           auto read = conn->Read(buff, size);
           if (read < 0) {
             LOG(ERROR) << "Failed to read from hwcomposer: "
                        << conn->StrError();
-            return;
+            conn->Close();
+            break;
           }
           size -= read;
           buff += read;
@@ -135,12 +123,7 @@
 }  // namespace
 
 ScreenConnector* ScreenConnector::Get() {
-  auto config = vsoc::CuttlefishConfig::Get();
-  if (config->enable_ivserver()) {
-    return new VSoCScreenConnector();
-  } else {
-    return new SocketBasedScreenConnector();
-  }
+  return new SocketBasedScreenConnector();
 }
 
 }  // namespace vnc
diff --git a/host/frontend/vnc_server/simulated_hw_composer.cpp b/host/frontend/vnc_server/simulated_hw_composer.cpp
index 7a94454..96702e8 100644
--- a/host/frontend/vnc_server/simulated_hw_composer.cpp
+++ b/host/frontend/vnc_server/simulated_hw_composer.cpp
@@ -20,7 +20,6 @@
 #include "host/libs/config/cuttlefish_config.h"
 
 using cvd::vnc::SimulatedHWComposer;
-using vsoc::screen::ScreenRegionView;
 
 SimulatedHWComposer::SimulatedHWComposer(BlackBoard* bb)
     :
diff --git a/host/frontend/vnc_server/virtual_inputs.cpp b/host/frontend/vnc_server/virtual_inputs.cpp
index e7e3757..fb91409 100644
--- a/host/frontend/vnc_server/virtual_inputs.cpp
+++ b/host/frontend/vnc_server/virtual_inputs.cpp
@@ -16,17 +16,19 @@
 
 #include "host/frontend/vnc_server/virtual_inputs.h"
 #include <gflags/gflags.h>
+#include <glog/logging.h>
 #include <linux/input.h>
 #include <linux/uinput.h>
 
+#include <cstdint>
 #include <mutex>
+#include <thread>
 #include "keysyms.h"
 
 #include <common/libs/fs/shared_select.h>
 #include <host/libs/config/cuttlefish_config.h>
 
 using cvd::vnc::VirtualInputs;
-using vsoc::input_events::InputEventsRegionView;
 
 DEFINE_int32(touch_fd, -1,
              "A fd for a socket where to accept touch connections");
@@ -34,7 +36,18 @@
 DEFINE_int32(keyboard_fd, -1,
              "A fd for a socket where to accept keyboard connections");
 
+DEFINE_bool(write_virtio_input, false,
+            "Whether to write the virtio_input struct over the socket");
+
 namespace {
+// Necessary to define here as the virtio_input.h header is not available
+// in the host glibc.
+struct virtio_input_event {
+  std::uint16_t type;
+  std::uint16_t code;
+  std::int32_t value;
+};
+
 void AddKeyMappings(std::map<uint32_t, uint16_t>* key_mapping) {
   (*key_mapping)[cvd::xk::AltLeft] = KEY_LEFTALT;
   (*key_mapping)[cvd::xk::ControlLeft] = KEY_LEFTCTRL;
@@ -233,37 +246,6 @@
 
 }  // namespace
 
-class VSoCVirtualInputs : public VirtualInputs {
- public:
-  VSoCVirtualInputs()
-      : input_events_region_view_{
-            vsoc::input_events::InputEventsRegionView::GetInstance(
-                vsoc::GetDomain().c_str())} {
-    if (!input_events_region_view_) {
-      LOG(FATAL) << "Failed to open Input events region view";
-    }
-  }
-
-  void GenerateKeyPressEvent(int code, bool down) override {
-    if (keymapping_.count(code)) {
-      input_events_region_view_->HandleKeyboardEvent(down, keymapping_[code]);
-    } else {
-      LOG(ERROR) << "Unknown keycode" << code;
-    }
-  }
-
-  void PressPowerButton(bool down) override {
-    input_events_region_view_->HandlePowerButtonEvent(down);
-  }
-
-  void HandlePointerEvent(bool touch_down, int x, int y) override {
-    input_events_region_view_->HandleSingleTouchEvent(touch_down, x, y);
-  }
-
- private:
-  vsoc::input_events::InputEventsRegionView* input_events_region_view_{};
-};
-
 class SocketVirtualInputs : public VirtualInputs {
  public:
   SocketVirtualInputs()
@@ -274,7 +256,7 @@
     InitInputEvent(&events[0], EV_KEY, keymapping_[key_code], down);
     InitInputEvent(&events[1], EV_SYN, 0, 0);
 
-    SendEvents(keyboard_socket_, events, sizeof(events));
+    SendEvents(keyboard_socket_, events);
   }
 
   void PressPowerButton(bool down) override {
@@ -282,7 +264,7 @@
     InitInputEvent(&events[0], EV_KEY, KEY_POWER, down);
     InitInputEvent(&events[1], EV_SYN, 0, 0);
 
-    SendEvents(keyboard_socket_, events, sizeof(events));
+    SendEvents(keyboard_socket_, events);
   }
 
   void HandlePointerEvent(bool touch_down, int x, int y) override {
@@ -293,11 +275,12 @@
     InitInputEvent(&events[2], EV_KEY, BTN_TOUCH, touch_down);
     InitInputEvent(&events[3], EV_SYN, 0, 0);
 
-    SendEvents(touch_socket_, events, sizeof(events));
+    SendEvents(touch_socket_, events);
   }
 
  private:
-  void SendEvents(cvd::SharedFD socket, void* event_buffer, int byte_count) {
+  template<size_t num_events>
+  void SendEvents(cvd::SharedFD socket, struct input_event (&event_buffer)[num_events]) {
     std::lock_guard<std::mutex> lock(socket_mutex_);
     if (!socket->IsOpen()) {
       // This is unlikely as it would only happen between the start of the vnc
@@ -306,9 +289,25 @@
       // handle it.
       return;
     }
-    auto ret = socket->Write(event_buffer, byte_count);
-    if (ret < 0) {
-      LOG(ERROR) << "Error sending input event: " << socket->StrError();
+
+    if (FLAGS_write_virtio_input) {
+      struct virtio_input_event virtio_events[num_events];
+      for (size_t i = 0; i < num_events; i++) {
+        virtio_events[i] = (struct virtio_input_event) {
+          .type = event_buffer[i].type,
+          .code = event_buffer[i].code,
+          .value = event_buffer[i].value,
+        };
+      }
+      auto ret = socket->Write(virtio_events, sizeof(virtio_events));
+      if (ret < 0) {
+        LOG(ERROR) << "Error sending input events: " << socket->StrError();
+      }
+    } else {
+      auto ret = socket->Write(event_buffer, sizeof(event_buffer));
+      if (ret < 0) {
+        LOG(ERROR) << "Error sending input events: " << socket->StrError();
+      }
     }
   }
 
@@ -320,6 +319,7 @@
     auto keyboard_server = cvd::SharedFD::Dup(FLAGS_keyboard_fd);
     close(FLAGS_keyboard_fd);
     FLAGS_keyboard_fd = -1;
+    LOG(INFO) << "Input socket host accepting connections...";
 
     while (1) {
       cvd::SharedFDSet read_set;
@@ -330,9 +330,11 @@
         std::lock_guard<std::mutex> lock(socket_mutex_);
         if (read_set.IsSet(touch_server)) {
           touch_socket_ = cvd::SharedFD::Accept(*touch_server);
+          LOG(INFO) << "connected to touch";
         }
         if (read_set.IsSet(keyboard_server)) {
           keyboard_socket_ = cvd::SharedFD::Accept(*keyboard_server);
+          LOG(INFO) << "connected to keyboard";
         }
       }
     }
@@ -346,9 +348,5 @@
 VirtualInputs::VirtualInputs() { AddKeyMappings(&keymapping_); }
 
 VirtualInputs* VirtualInputs::Get() {
-  if (vsoc::CuttlefishConfig::Get()->enable_ivserver()) {
-    return new VSoCVirtualInputs();
-  } else {
-    return new SocketVirtualInputs();
-  }
+  return new SocketVirtualInputs();
 }
diff --git a/host/frontend/vnc_server/virtual_inputs.h b/host/frontend/vnc_server/virtual_inputs.h
index f92693b..7aca3eb 100644
--- a/host/frontend/vnc_server/virtual_inputs.h
+++ b/host/frontend/vnc_server/virtual_inputs.h
@@ -21,8 +21,6 @@
 #include <map>
 #include <mutex>
 
-#include "common/vsoc/lib/input_events_region_view.h"
-
 namespace cvd {
 namespace vnc {
 
diff --git a/host/frontend/vnc_server/vnc_client_connection.cpp b/host/frontend/vnc_server/vnc_client_connection.cpp
index a8faf47..b81bb88 100644
--- a/host/frontend/vnc_server/vnc_client_connection.cpp
+++ b/host/frontend/vnc_server/vnc_client_connection.cpp
@@ -42,7 +42,17 @@
 using cvd::vnc::Stripe;
 using cvd::vnc::StripePtrVec;
 using cvd::vnc::VncClientConnection;
-using vsoc::screen::ScreenRegionView;
+
+struct ScreenRegionView {
+  using Pixel = uint32_t;
+  static constexpr int kSwiftShaderPadding = 4;
+  static constexpr int kRedShift = 0;
+  static constexpr int kGreenShift = 8;
+  static constexpr int kBlueShift = 16;
+  static constexpr int kRedBits = 8;
+  static constexpr int kGreenBits = 8;
+  static constexpr int kBlueBits = 8;
+};
 
 DEFINE_bool(debug_client, false, "Turn on detailed logging for the client");
 
diff --git a/host/frontend/vnc_server/vnc_utils.h b/host/frontend/vnc_server/vnc_utils.h
index 0953c4e..db88131 100644
--- a/host/frontend/vnc_server/vnc_utils.h
+++ b/host/frontend/vnc_server/vnc_utils.h
@@ -23,7 +23,6 @@
 
 #include "common/libs/utils/size_utils.h"
 #include "common/libs/tcp_socket/tcp_socket.h"
-#include "common/vsoc/lib/screen_region_view.h"
 #include "host/libs/config/cuttlefish_config.h"
 
 namespace cvd {
@@ -65,7 +64,7 @@
 };
 
 inline constexpr int BytesPerPixel() {
-  return sizeof(vsoc::screen::ScreenRegionView::Pixel);
+  return sizeof(uint32_t);
 }
 
 // The width of the screen regardless of orientation. Does not change.
diff --git a/host/libs/config/Android.bp b/host/libs/config/Android.bp
index 283053e..d88b206 100644
--- a/host/libs/config/Android.bp
+++ b/host/libs/config/Android.bp
@@ -25,7 +25,6 @@
     shared_libs: [
         "libcuttlefish_fs",
         "libcuttlefish_utils",
-        "cuttlefish_auto_resources",
         "libbase",
         "libgflags",
     ],
diff --git a/host/libs/config/cuttlefish_config.cpp b/host/libs/config/cuttlefish_config.cpp
index 650190f..7a65525 100644
--- a/host/libs/config/cuttlefish_config.cpp
+++ b/host/libs/config/cuttlefish_config.cpp
@@ -92,6 +92,7 @@
 const char* kRamdiskImagePath = "ramdisk_image_path";
 const char* kInitramfsPath = "initramfs_path";
 const char* kFinalRamdiskPath = "final_ramdisk_path";
+const char* kVendorRamdiskImagePath = "vendor_ramdisk_image_path";
 
 const char* kVirtualDiskPaths = "virtual_disk_paths";
 const char* kUsbV1SocketName = "usb_v1_socket_name";
@@ -105,11 +106,6 @@
 const char* kLauncherLogPath = "launcher_log_path";
 const char* kLauncherMonitorPath = "launcher_monitor_socket";
 
-const char* kMempath = "mempath";
-const char* kIvshmemQemuSocketPath = "ivshmem_qemu_socket_path";
-const char* kIvshmemClientSocketPath = "ivshmem_client_socket_path";
-const char* kIvshmemVectorCount = "ivshmem_vector_count";
-
 const char* kMobileBridgeName = "mobile_bridge_name";
 const char* kMobileTapName = "mobile_tap_name";
 const char* kWifiTapName = "wifi_tap_name";
@@ -126,17 +122,12 @@
 const char* kQemuBinary = "qemu_binary";
 const char* kCrosvmBinary = "crosvm_binary";
 const char* kConsoleForwarderBinary = "console_forwarder_binary";
-const char* kIvServerBinary = "ivserver_binary";
 const char* kKernelLogMonitorBinary = "kernel_log_monitor_binary";
 
 const char* kEnableVncServer = "enable_vnc_server";
 const char* kVncServerBinary = "vnc_server_binary";
 const char* kVncServerPort = "vnc_server_port";
 
-const char* kEnableStreamAudio = "enable_stream_audio";
-const char* kStreamAudioBinary = "stream_audio_binary";
-const char* kStreamAudioPort = "stream_audio_port";
-
 const char* kRestartSubprocesses = "restart_subprocesses";
 const char* kRunAdbConnector = "run_adb_connector";
 const char* kAdbConnectorBinary = "adb_connector_binary";
@@ -145,8 +136,6 @@
 const char* kSocketVsockProxyBinary = "socket_vsock_proxy_binary";
 
 const char* kRunAsDaemon = "run_as_daemon";
-const char* kRunE2eTest = "run_e2e_test";
-const char* kE2eTestBinary = "e2e_test_binary";
 
 const char* kDataPolicy = "data_policy";
 const char* kBlankDataImageMb = "blank_data_image_mb";
@@ -165,6 +154,12 @@
 
 const char* kBootloader = "bootloader";
 const char* kUseBootloader = "use_bootloader";
+
+const char* kBootSlot = "boot_slot";
+
+const char* kTouchSocketPort = "touch_socket_port";
+const char* kKeyboardSocketPort = "keyboard_socket_port";
+
 }  // namespace
 
 namespace vsoc {
@@ -378,6 +373,14 @@
   SetPath(kFinalRamdiskPath, final_ramdisk_path);
 }
 
+std::string CuttlefishConfig::vendor_ramdisk_image_path() const {
+  return (*dictionary_)[kVendorRamdiskImagePath].asString();
+}
+void CuttlefishConfig::set_vendor_ramdisk_image_path(
+    const std::string& vendor_ramdisk_image_path) {
+  SetPath(kVendorRamdiskImagePath, vendor_ramdisk_image_path);
+}
+
 std::vector<std::string> CuttlefishConfig::virtual_disk_paths() const {
   std::vector<std::string> virtual_disks;
   auto virtual_disks_json_obj = (*dictionary_)[kVirtualDiskPaths];
@@ -395,36 +398,6 @@
   (*dictionary_)[kVirtualDiskPaths] = virtual_disks_json_obj;
 }
 
-std::string CuttlefishConfig::mempath() const {
-  return (*dictionary_)[kMempath].asString();
-}
-void CuttlefishConfig::set_mempath(const std::string& mempath) {
-  SetPath(kMempath, mempath);
-}
-
-std::string CuttlefishConfig::ivshmem_qemu_socket_path() const {
-  return (*dictionary_)[kIvshmemQemuSocketPath].asString();
-}
-void CuttlefishConfig::set_ivshmem_qemu_socket_path(
-    const std::string& ivshmem_qemu_socket_path) {
-  SetPath(kIvshmemQemuSocketPath, ivshmem_qemu_socket_path);
-}
-
-std::string CuttlefishConfig::ivshmem_client_socket_path() const {
-  return (*dictionary_)[kIvshmemClientSocketPath].asString();
-}
-void CuttlefishConfig::set_ivshmem_client_socket_path(
-    const std::string& ivshmem_client_socket_path) {
-  SetPath(kIvshmemClientSocketPath, ivshmem_client_socket_path);
-}
-
-int CuttlefishConfig::ivshmem_vector_count() const {
-  return (*dictionary_)[kIvshmemVectorCount].asInt();
-}
-void CuttlefishConfig::set_ivshmem_vector_count(int ivshmem_vector_count) {
-  (*dictionary_)[kIvshmemVectorCount] = ivshmem_vector_count;
-}
-
 std::string CuttlefishConfig::usb_v1_socket_name() const {
   return (*dictionary_)[kUsbV1SocketName].asString();
 }
@@ -548,9 +521,7 @@
 
 static AdbMode stringToAdbMode(std::string mode) {
   std::transform(mode.begin(), mode.end(), mode.begin(), ::tolower);
-  if (mode == "tunnel") {
-    return AdbMode::Tunnel;
-  } else if (mode == "vsock_tunnel") {
+  if (mode == "vsock_tunnel") {
     return AdbMode::VsockTunnel;
   } else if (mode == "vsock_half_tunnel") {
     return AdbMode::VsockHalfTunnel;
@@ -597,11 +568,10 @@
 
 std::string CuttlefishConfig::adb_device_name() const {
   // TODO(schuffelen): Deal with duplication between here and launch.cc
-  bool tunnelMode = adb_mode().count(AdbMode::Tunnel) > 0;
   bool vsockTunnel = adb_mode().count(AdbMode::VsockTunnel) > 0;
   bool vsockHalfProxy = adb_mode().count(AdbMode::VsockHalfTunnel) > 0;
   bool nativeVsock = adb_mode().count(AdbMode::NativeVsock) > 0;
-  if (tunnelMode || vsockTunnel || vsockHalfProxy || nativeVsock) {
+  if (vsockTunnel || vsockHalfProxy || nativeVsock) {
     return adb_ip_and_port();
   } else if (adb_mode().count(AdbMode::Usb) > 0) {
     return serial_number();
@@ -651,14 +621,6 @@
   (*dictionary_)[kConsoleForwarderBinary] = binary;
 }
 
-std::string CuttlefishConfig::ivserver_binary() const {
-  return (*dictionary_)[kIvServerBinary].asString();
-}
-
-void CuttlefishConfig::set_ivserver_binary(const std::string& ivserver_binary) {
-  (*dictionary_)[kIvServerBinary] = ivserver_binary;
-}
-
 std::string CuttlefishConfig::kernel_log_monitor_binary() const {
   return (*dictionary_)[kKernelLogMonitorBinary].asString();
 }
@@ -693,31 +655,6 @@
   (*dictionary_)[kVncServerPort] = vnc_server_port;
 }
 
-bool CuttlefishConfig::enable_stream_audio() const {
-  return (*dictionary_)[kEnableStreamAudio].asBool();
-}
-
-void CuttlefishConfig::set_enable_stream_audio(bool enable_stream_audio) {
-  (*dictionary_)[kEnableStreamAudio] = enable_stream_audio;
-}
-
-std::string CuttlefishConfig::stream_audio_binary() const {
-  return (*dictionary_)[kStreamAudioBinary].asString();
-}
-
-void CuttlefishConfig::set_stream_audio_binary(
-    const std::string& stream_audio_binary) {
-  (*dictionary_)[kStreamAudioBinary] = stream_audio_binary;
-}
-
-int CuttlefishConfig::stream_audio_port() const {
-  return (*dictionary_)[kStreamAudioPort].asInt();
-}
-
-void CuttlefishConfig::set_stream_audio_port(int stream_audio_port) {
-  (*dictionary_)[kStreamAudioPort] = stream_audio_port;
-}
-
 bool CuttlefishConfig::restart_subprocesses() const {
   return (*dictionary_)[kRestartSubprocesses].asBool();
 }
@@ -777,23 +714,6 @@
 void CuttlefishConfig::set_run_as_daemon(bool run_as_daemon) {
   (*dictionary_)[kRunAsDaemon] = run_as_daemon;
 }
-
-bool CuttlefishConfig::run_e2e_test() const {
-  return (*dictionary_)[kRunE2eTest].asBool();
-}
-
-void CuttlefishConfig::set_run_e2e_test(bool run_e2e_test) {
-  (*dictionary_)[kRunE2eTest] = run_e2e_test;
-}
-
-std::string CuttlefishConfig::e2e_test_binary() const {
-  return (*dictionary_)[kE2eTestBinary].asString();
-}
-
-void CuttlefishConfig::set_e2e_test_binary(const std::string& e2e_test_binary) {
-  (*dictionary_)[kE2eTestBinary] = e2e_test_binary;
-}
-
 std::string CuttlefishConfig::data_policy() const {
   return (*dictionary_)[kDataPolicy].asString();
 }
@@ -903,12 +823,16 @@
   SetPath(kBootloader, bootloader);
 }
 
-int CuttlefishConfig::tombstone_receiver_port() const {
-  return (*dictionary_)[kTombstoneReceiverPort].asInt();
+void CuttlefishConfig::set_boot_slot(const std::string& boot_slot) {
+  (*dictionary_)[kBootSlot] = boot_slot;
 }
 
-bool CuttlefishConfig::enable_ivserver() const {
-  return hardware_name() == "cutf_ivsh";
+std::string CuttlefishConfig::boot_slot() const {
+  return (*dictionary_)[kBootSlot].asString();
+}
+
+int CuttlefishConfig::tombstone_receiver_port() const {
+  return (*dictionary_)[kTombstoneReceiverPort].asInt();
 }
 
 std::string CuttlefishConfig::touch_socket_path() const {
@@ -919,6 +843,22 @@
   return PerInstanceInternalPath("keyboard.sock");
 }
 
+void CuttlefishConfig::set_touch_socket_port(int port) {
+  (*dictionary_)[kTouchSocketPort] = port;
+}
+
+int CuttlefishConfig::touch_socket_port() const {
+  return (*dictionary_)[kTouchSocketPort].asInt();
+}
+
+void CuttlefishConfig::set_keyboard_socket_port(int port) {
+  (*dictionary_)[kKeyboardSocketPort] = port;
+}
+
+int CuttlefishConfig::keyboard_socket_port() const {
+  return (*dictionary_)[kKeyboardSocketPort].asInt();
+}
+
 // Creates the (initially empty) config object and populates it with values from
 // the config file if the CUTTLEFISH_CONFIG_FILE env variable is present.
 // Returns nullptr if there was an error loading from file
@@ -998,10 +938,6 @@
   return cvd::StringFromEnv("HOME", ".") + "/.cuttlefish_config.json";
 }
 
-std::string GetDomain() {
-  return CuttlefishConfig::Get()->ivshmem_client_socket_path();
-}
-
 std::string GetPerInstanceDefault(const char* prefix) {
   std::ostringstream stream;
   stream << prefix << std::setfill('0') << std::setw(2) << GetInstance();
@@ -1015,10 +951,6 @@
   return stream.str();
 }
 
-std::string GetDefaultMempath() {
-  return GetPerInstanceDefault("/var/run/shm/cvd-");
-}
-
 int GetDefaultPerInstanceVsockCid() {
   constexpr int kFirstGuestCid = 3;
   return vsoc::HostSupportsVsock() ? GetPerInstanceDefault(kFirstGuestCid) : 0;
diff --git a/host/libs/config/cuttlefish_config.h b/host/libs/config/cuttlefish_config.h
index 0dd9ce9..a920e76 100644
--- a/host/libs/config/cuttlefish_config.h
+++ b/host/libs/config/cuttlefish_config.h
@@ -39,7 +39,6 @@
 
 
 enum class AdbMode {
-  Tunnel,
   VsockTunnel,
   VsockHalfTunnel,
   NativeVsock,
@@ -156,23 +155,13 @@
   std::string final_ramdisk_path() const;
   void set_final_ramdisk_path(const std::string& final_ramdisk_path);
 
+  std::string vendor_ramdisk_image_path() const;
+  void set_vendor_ramdisk_image_path(const std::string&
+    vendor_ramdisk_image_path);
+
   std::vector<std::string> virtual_disk_paths() const;
   void set_virtual_disk_paths(const std::vector<std::string>& disk_paths);
 
-  std::string mempath() const;
-  void set_mempath(const std::string& mempath);
-
-  std::string ivshmem_qemu_socket_path() const;
-  void set_ivshmem_qemu_socket_path(
-      const std::string& ivshmem_qemu_socket_path);
-
-  std::string ivshmem_client_socket_path() const;
-  void set_ivshmem_client_socket_path(
-      const std::string& ivshmem_client_socket_path);
-
-  int ivshmem_vector_count() const;
-  void set_ivshmem_vector_count(int ivshmem_vector_count);
-
   // The name of the socket that will be used to forward access to USB gadget.
   // This is for V1 of the USB bus.
   std::string usb_v1_socket_name() const;
@@ -256,9 +245,6 @@
   void set_console_forwarder_binary(const std::string& crosvm_binary);
   std::string console_forwarder_binary() const;
 
-  void set_ivserver_binary(const std::string& ivserver_binary);
-  std::string ivserver_binary() const;
-
   void set_kernel_log_monitor_binary(
       const std::string& kernel_log_monitor_binary);
   std::string kernel_log_monitor_binary() const;
@@ -272,15 +258,6 @@
   void set_vnc_server_binary(const std::string& vnc_server_binary);
   std::string vnc_server_binary() const;
 
-  void set_enable_stream_audio(bool enable_stream_audio);
-  bool enable_stream_audio() const;
-
-  void set_stream_audio_port(int stream_audio_port);
-  int stream_audio_port() const;
-
-  void set_stream_audio_binary(const std::string& stream_audio_binary);
-  std::string stream_audio_binary() const;
-
   void set_restart_subprocesses(bool restart_subprocesses);
   bool restart_subprocesses() const;
 
@@ -302,12 +279,6 @@
   void set_run_as_daemon(bool run_as_daemon);
   bool run_as_daemon() const;
 
-  void set_run_e2e_test(bool run_e2e_test);
-  bool run_e2e_test() const;
-
-  void set_e2e_test_binary(const std::string& e2e_test_binary);
-  std::string e2e_test_binary() const;
-
   void set_data_policy(const std::string& data_policy);
   std::string data_policy() const;
 
@@ -344,11 +315,18 @@
   void set_bootloader(const std::string& bootloader_path);
   std::string bootloader() const;
 
-  bool enable_ivserver() const;
+  void set_boot_slot(const std::string& boot_slot);
+  std::string boot_slot() const;
 
   std::string touch_socket_path() const;
   std::string keyboard_socket_path() const;
 
+  void set_touch_socket_port(int touch_socket_port);
+  int touch_socket_port() const;
+
+  void set_keyboard_socket_port(int keyboard_socket_port);
+  int keyboard_socket_port() const;
+
  private:
   std::unique_ptr<Json::Value> dictionary_;
 
@@ -367,9 +345,6 @@
 // it easily discoverable regardless of what vm manager is in use
 std::string GetGlobalConfigFileLink();
 
-// Returns the path to the ivserver's client socket.
-std::string GetDomain();
-
 // These functions modify a given base value to make it different accross
 // different instances by appending the instance id in case of strings or adding
 // it in case of integers.
diff --git a/host/libs/config/fetcher_config.cpp b/host/libs/config/fetcher_config.cpp
index d218351..86e16dc 100644
--- a/host/libs/config/fetcher_config.cpp
+++ b/host/libs/config/fetcher_config.cpp
@@ -197,4 +197,20 @@
   return files;
 }
 
+std::string FetcherConfig::FindCvdFileWithSuffix(const std::string& suffix) const {
+  if (!dictionary_->isMember(kCvdFiles)) {
+    return {};
+  }
+  const auto& json_files = (*dictionary_)[kCvdFiles];
+  for (auto it = json_files.begin(); it != json_files.end(); it++) {
+    auto file = it.key().asString();
+    auto expected_pos = file.size() - suffix.size();
+    if (file.rfind(suffix) == expected_pos) {
+      return file;
+    }
+  }
+  LOG(ERROR) << "Could not find file ending in " << suffix;
+  return "";
+}
+
 } // namespace cvd
diff --git a/host/libs/config/fetcher_config.h b/host/libs/config/fetcher_config.h
index 41fd396..825fbc6 100644
--- a/host/libs/config/fetcher_config.h
+++ b/host/libs/config/fetcher_config.h
@@ -78,6 +78,8 @@
 
   bool add_cvd_file(const CvdFile& file, bool override_entry = false);
   std::map<std::string, CvdFile> get_cvd_files() const;
+
+  std::string FindCvdFileWithSuffix(const std::string& suffix) const;
 };
 
 } // namespace cvd
diff --git a/host/libs/vm_manager/Android.bp b/host/libs/vm_manager/Android.bp
index 6c638ea..61cda54 100644
--- a/host/libs/vm_manager/Android.bp
+++ b/host/libs/vm_manager/Android.bp
@@ -26,7 +26,6 @@
     shared_libs: [
         "libcuttlefish_fs",
         "libcuttlefish_utils",
-        "cuttlefish_auto_resources",
         "libbase",
         "libicuuc",
     ],
@@ -38,8 +37,7 @@
     defaults: ["cuttlefish_host_only"],
 }
 
-cc_prebuilt_binary {
+sh_binary_host {
     name: "cf_qemu.sh",
-    srcs: ["cf_qemu.sh"],
-    defaults: ["cuttlefish_host_only"],
+    src: "cf_qemu.sh",
 }
diff --git a/host/libs/vm_manager/cf_qemu.sh b/host/libs/vm_manager/cf_qemu.sh
index 75707ed..969332d 100755
--- a/host/libs/vm_manager/cf_qemu.sh
+++ b/host/libs/vm_manager/cf_qemu.sh
@@ -61,11 +61,6 @@
 qemu_binary=${qemu_binary=/usr/bin/qemu-system-x86_64}
 dtc_binary=${dtc_binary:-dtc}
 
-if [[ -z "${ivshmem_vector_count}" ]]; then
-    echo "The required ivshmem_vector_count environment variable is not set" >&2
-    exit 1
-fi
-
 if [[ "${qemu_binary##*/}" = "qemu-system-aarch64" ]]; then
   # On ARM, the early console can be PCI, and ISA is not supported
   kernel_console_serial="pci-serial"
@@ -147,8 +142,6 @@
     -device "${kernel_console_serial},chardev=charserial0,id=serial0"
     -chardev "socket,id=charserial1,path=${console_path:-${default_dir}/console},server,nowait"
     -device "${kernel_console_serial},chardev=charserial1,id=serial1"
-    -chardev "socket,path=${ivshmem_qemu_socket_path:-${default_internal_dir}/ivshmem_socket_qemu},id=ivsocket"
-    -device "ivshmem-doorbell,chardev=ivsocket,vectors=${ivshmem_vector_count}"
 )
 
 if [[ "${logcat_mode}" == "serial" ]]; then
diff --git a/host/libs/vm_manager/crosvm_manager.cpp b/host/libs/vm_manager/crosvm_manager.cpp
index 5a5fbf1..f132bac 100644
--- a/host/libs/vm_manager/crosvm_manager.cpp
+++ b/host/libs/vm_manager/crosvm_manager.cpp
@@ -78,6 +78,7 @@
     config->add_kernel_cmdline(
         "androidboot.hardware.hwcomposer=cutf_cvm_ashmem");
     config->add_kernel_cmdline("androidboot.hardware.egl=swiftshader");
+    config->add_kernel_cmdline("androidboot.hardware.vulkan=pastel");
     return true;
   }
   return false;
diff --git a/host/libs/vm_manager/qemu_manager.cpp b/host/libs/vm_manager/qemu_manager.cpp
index 5130afe..b40be87 100644
--- a/host/libs/vm_manager/qemu_manager.cpp
+++ b/host/libs/vm_manager/qemu_manager.cpp
@@ -110,9 +110,9 @@
   // HALs.
   config->add_kernel_cmdline("androidboot.hardware.gralloc=cutf_ashmem");
   config->add_kernel_cmdline(
-      "androidboot.hardware.hwcomposer=cutf_ivsh_ashmem");
-  config->add_kernel_cmdline(
-      "androidboot.hardware.egl=swiftshader");
+      "androidboot.hardware.hwcomposer=cutf_cvm_ashmem");
+  config->add_kernel_cmdline("androidboot.hardware.egl=swiftshader");
+  config->add_kernel_cmdline("androidboot.hardware.vulkan=pastel");
   return true;
 }
 
@@ -146,10 +146,6 @@
                config_->kernel_log_pipe_name());
   LogAndSetEnv("console_path", config_->console_path());
   LogAndSetEnv("logcat_path", config_->logcat_path());
-  LogAndSetEnv("ivshmem_qemu_socket_path",
-               config_->ivshmem_qemu_socket_path());
-  LogAndSetEnv("ivshmem_vector_count",
-               std::to_string(config_->ivshmem_vector_count()));
   LogAndSetEnv("usb_v1_socket_name", config_->usb_v1_socket_name());
   LogAndSetEnv("vsock_guest_cid", std::to_string(config_->vsock_guest_cid()));
   LogAndSetEnv("logcat_mode", config_->logcat_mode());
diff --git a/host/vsoc/lib/gralloc_buffer_region_view.cpp b/host/vsoc/lib/gralloc_buffer_region_view.cpp
deleted file mode 100644
index db302cb..0000000
--- a/host/vsoc/lib/gralloc_buffer_region_view.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "host/vsoc/lib/gralloc_buffer_region_view.h"
-
-#include <memory>
-#include <mutex>
-#include "glog/logging.h"
-
-using vsoc::gralloc::GrallocBufferRegionView;
-
-uint8_t* GrallocBufferRegionView::OffsetToBufferPtr(uint32_t offset) {
-  if (offset <= control_->region_desc().offset_of_region_data ||
-      offset >= control_->region_size()) {
-    LOG(FATAL)
-        << "Attempted to access a gralloc buffer outside region data, offset: "
-        << offset;
-    return nullptr;
-  }
-  return region_offset_to_pointer<uint8_t>(offset);
-}
diff --git a/host/vsoc/lib/gralloc_buffer_region_view.h b/host/vsoc/lib/gralloc_buffer_region_view.h
deleted file mode 100644
index b132a0e..0000000
--- a/host/vsoc/lib/gralloc_buffer_region_view.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "common/vsoc/lib/typed_region_view.h"
-#include "common/vsoc/shm/gralloc_layout.h"
-
-#include <string>
-
-namespace vsoc {
-namespace gralloc {
-
-// Allows access to the gralloc buffer region from host side. It needs to be a
-// different class than the one on guest side because of the required
-// interactions with the kernel on the guest.
-// Initially this class only returns a pointer to a buffer in memory given a
-// region offset, which is enough for now since it's only used by the hwcomposer
-// (which gets all other information from the guest side hwcomposer) and by the
-// VNC server (which uses only the frame buffer and gets the information it
-// needs from the framebuffer region).
-class GrallocBufferRegionView
-    : vsoc::TypedRegionView<
-        GrallocBufferRegionView,
-        vsoc::layout::gralloc::GrallocBufferLayout> {
-   public:
-  GrallocBufferRegionView() = default;
-  GrallocBufferRegionView(const GrallocBufferRegionView&) = delete;
-  GrallocBufferRegionView& operator=(const GrallocBufferRegionView&) = delete;
-
-  uint8_t* OffsetToBufferPtr(uint32_t offset);
-};
-
-}  // namespace gralloc
-}  // namespace vsoc
diff --git a/host/vsoc/lib/host_lock.cpp b/host/vsoc/lib/host_lock.cpp
deleted file mode 100644
index 895a429..0000000
--- a/host/vsoc/lib/host_lock.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "common/vsoc/shm/lock.h"
-
-#include "sys/types.h"
-
-#include "common/vsoc/lib/compat.h"
-#include "common/vsoc/lib/single_sided_signal.h"
-
-namespace vsoc {
-namespace layout {
-
-void HostLock::Lock() {
-  uint32_t tid = gettid();
-  uint32_t expected_value;
-  uint32_t* uaddr = reinterpret_cast<uint32_t*>(&lock_uint32_);
-
-  while (1) {
-    if (TryLock(tid, &expected_value)) {
-      return;
-    }
-    SingleSidedSignal::AwaitSignal(expected_value, uaddr);
-  }
-}
-
-void HostLock::Unlock() {
-  Sides sides_to_signal = UnlockCommon(gettid());
-  if (sides_to_signal != Sides::NoSides) {
-    SingleSidedSignal::Signal(&lock_uint32_);
-  }
-}
-
-bool HostLock::Recover() {
-  return RecoverSingleSided();
-}
-
-}  // namespace layout
-}  // namespace vsoc
diff --git a/host/vsoc/lib/host_region_e2e_test.cpp b/host/vsoc/lib/host_region_e2e_test.cpp
deleted file mode 100644
index 1366838..0000000
--- a/host/vsoc/lib/host_region_e2e_test.cpp
+++ /dev/null
@@ -1,130 +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.
- */
-
-/*
- * End-to-end test to ensure that mapping of vsoc regions works on the host.
- */
-
-#include <gtest/gtest.h>
-#include "common/vsoc/lib/e2e_test_region_view.h"
-#include "host/libs/config/cuttlefish_config.h"
-
-// Here is a summary of the two regions interrupt and write test:
-// 1. Write our strings to the first region
-// 2. Ensure that our peer hasn't signalled the second region. That would
-//    indicate that it didn't wait for our interrupt.
-// 3. Send the interrupt on the first region
-// 4. Wait for our peer's interrupt on the first region
-// 5. Confirm that we can see our peer's writes in the first region
-// 6. Initialize our strings in the second region
-// 7. Send an interrupt on the second region to our peer
-// 8. Wait for our peer's interrupt on the second region
-// 9. Confirm that we can see our peer's writes in the second region
-// 10. Repeat the process for signaling.
-// 11. Confirm that no interrupt is pending in the first region
-// 12. Confirm that no interrupt is pending in the second region
-
-template <typename View>
-void SetHostStrings(View* in) {
-  size_t num_data = in->string_size();
-  EXPECT_LE(static_cast<size_t>(2), num_data);
-  for (size_t i = 0; i < num_data; ++i) {
-    EXPECT_TRUE(!in->host_string(i)[0] ||
-                !strcmp(in->host_string(i), View::Layout::host_pattern));
-    in->set_host_string(i, View::Layout::host_pattern);
-    EXPECT_STREQ(in->host_string(i), View::Layout::host_pattern);
-  }
-}
-
-template <typename View>
-void CheckPeerStrings(View* in) {
-  size_t num_data = in->string_size();
-  EXPECT_LE(static_cast<size_t>(2), num_data);
-  for (size_t i = 0; i < num_data; ++i) {
-    EXPECT_STREQ(View::Layout::guest_pattern, in->guest_string(i));
-  }
-}
-
-TEST(RegionTest, PeerTests) {
-  auto primary =
-      vsoc::E2EPrimaryRegionView::GetInstance(vsoc::GetDomain().c_str());
-  ASSERT_TRUE(!!primary);
-  auto secondary =
-      vsoc::E2ESecondaryRegionView::GetInstance(vsoc::GetDomain().c_str());
-  ASSERT_TRUE(!!secondary);
-  LOG(INFO) << "Regions are open";
-  SetHostStrings(primary);
-  EXPECT_FALSE(secondary->HasIncomingInterrupt());
-  EXPECT_TRUE(primary->MaybeInterruptPeer());
-  LOG(INFO) << "Waiting for first interrupt from peer";
-  primary->WaitForInterrupt();
-  LOG(INFO) << "First interrupt received";
-  CheckPeerStrings(primary);
-  SetHostStrings(secondary);
-  EXPECT_TRUE(secondary->MaybeInterruptPeer());
-  LOG(INFO) << "Waiting for second interrupt from peer";
-  secondary->WaitForInterrupt();
-  LOG(INFO) << "Second interrupt received";
-  CheckPeerStrings(secondary);
-
-  // Test signals
-  EXPECT_FALSE(secondary->HasIncomingInterrupt());
-  LOG(INFO) << "Verified no early second signal";
-  primary->SendSignal(vsoc::layout::Sides::Peer,
-                      &primary->data()->host_to_guest_signal);
-  LOG(INFO) << "Signal sent. Waiting for first signal from peer";
-  primary->WaitForInterrupt();
-  int count = 0;  // counts the number of signals received.
-  primary->ProcessSignalsFromPeer(
-      [&primary, &count](uint32_t offset) {
-        ++count;
-        EXPECT_EQ(primary->guest_to_host_signal_offset(), offset);
-      });
-  EXPECT_EQ(1, count);
-  LOG(INFO) << "Signal received on primary region";
-  secondary->SendSignal(vsoc::layout::Sides::Peer,
-                        &secondary->data()->host_to_guest_signal);
-  LOG(INFO) << "Signal sent. Waiting for second signal from peer";
-  secondary->WaitForInterrupt();
-  count = 0;
-  secondary->ProcessSignalsFromPeer(
-      [secondary, &count](uint32_t offset) {
-        ++count;
-        EXPECT_EQ(secondary->guest_to_host_signal_offset(), offset);
-      });
-  EXPECT_EQ(1, count);
-  LOG(INFO) << "Signal received on secondary region";
-
-  EXPECT_FALSE(primary->HasIncomingInterrupt());
-  EXPECT_FALSE(secondary->HasIncomingInterrupt());
-}
-
-TEST(RegionTest, MissingRegionCausesDeath) {
-  EXPECT_DEATH(
-      vsoc::E2EUnfindableRegionView::GetInstance(vsoc::GetDomain().c_str()),
-      ".*");
-}
-
-int main(int argc, char** argv) {
-  testing::InitGoogleTest(&argc, argv);
-  int rval = RUN_ALL_TESTS();
-  if (!rval) {
-    auto region =
-        vsoc::E2EPrimaryRegionView::GetInstance(vsoc::GetDomain().c_str());
-    region->host_status(vsoc::layout::e2e_test::E2E_MEMORY_FILLED);
-  }
-  return rval;
-}
diff --git a/host/vsoc/lib/region_control.cpp b/host/vsoc/lib/region_control.cpp
deleted file mode 100644
index 491f600..0000000
--- a/host/vsoc/lib/region_control.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "common/vsoc/lib/region_view.h"
-
-#define LOG_TAG "vsoc: region_host"
-
-#include <stdio.h>
-#include <string.h>
-#include <linux/futex.h>
-#include <sys/mman.h>
-#include <sys/socket.h>
-#include <sys/syscall.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <iomanip>
-#include <sstream>
-#include <thread>
-#include <vector>
-
-#include <glog/logging.h>
-
-#include "common/libs/fs/shared_fd.h"
-#include "common/libs/fs/shared_select.h"
-
-using cvd::SharedFD;
-
-namespace {
-
-class HostRegionControl : public vsoc::RegionControl {
- public:
-  HostRegionControl(const char* region_name,
-                    const SharedFD& incoming_interrupt_fd,
-                    const SharedFD& outgoing_interrupt_fd,
-                    const SharedFD& shared_memory_fd)
-      : region_name_{region_name},
-        incoming_interrupt_fd_{incoming_interrupt_fd},
-        outgoing_interrupt_fd_{outgoing_interrupt_fd},
-        shared_memory_fd_{shared_memory_fd} {}
-
-  int CreateFdScopedPermission(const char* /*managed_region_name*/,
-                               uint32_t /*owner_offset*/,
-                               uint32_t /*owned_val*/,
-                               uint32_t /*begin_offset*/,
-                               uint32_t /*end_offset*/) override {
-    return -1;
-  }
-
-  bool InitializeRegion();
-
-  virtual bool InterruptPeer() override {
-    uint64_t one = 1;
-    ssize_t rval = outgoing_interrupt_fd_->Write(&one, sizeof(one));
-    if (rval != sizeof(one)) {
-      LOG(FATAL) << __FUNCTION__ << ": rval (" << rval << ") != sizeof(one))";
-      return false;
-    }
-    return true;
-  }
-
-  // Wake the local signal table scanner. Primarily used during shutdown
-  virtual void InterruptSelf() override {
-    uint64_t one = 1;
-    ssize_t rval = incoming_interrupt_fd_->Write(&one, sizeof(one));
-    if (rval != sizeof(one)) {
-      LOG(FATAL) << __FUNCTION__ << ": rval (" << rval << ") != sizeof(one))";
-    }
-  }
-
-  virtual void WaitForInterrupt() override {
-    // Check then act isn't a problem here: the other side does
-    // the following things in exactly this order:
-    //   1. exchanges 1 with interrupt_signalled
-    //   2. if interrupt_signalled was 0 it increments the eventfd
-    // eventfd increments are persistent, so if interrupt_signalled was set
-    // back to 1 while we are going to sleep the sleep will return
-    // immediately.
-    uint64_t missed{};
-    cvd::SharedFDSet readset;
-    readset.Set(incoming_interrupt_fd_);
-    cvd::Select(&readset, NULL, NULL, NULL);
-    ssize_t rval = incoming_interrupt_fd_->Read(&missed, sizeof(missed));
-    if (rval != sizeof(missed)) {
-      LOG(FATAL) << __FUNCTION__ << ": rval (" << rval
-                 << ") != sizeof(missed)), are there more than one threads "
-                    "waiting for interrupts?";
-    }
-    if (!missed) {
-      LOG(FATAL) << __FUNCTION__ << ": woke with 0 interrupts";
-    }
-  }
-
-  virtual void* Map() override {
-    if (region_base_) {
-      return region_base_;
-    }
-    // Now actually map the region
-    region_base_ =
-        shared_memory_fd_->Mmap(0, region_size(), PROT_READ | PROT_WRITE,
-                                MAP_SHARED, region_desc_.region_begin_offset);
-    if (region_base_ == MAP_FAILED) {
-      LOG(FATAL) << "mmap failed for offset "
-                 << region_desc_.region_begin_offset << " ("
-                 << shared_memory_fd_->StrError() << ")";
-      region_base_ = nullptr;
-    }
-    return region_base_;
-  }
-
-
-  virtual int SignalSelf(uint32_t offset) override {
-    return syscall(SYS_futex, region_offset_to_pointer<int32_t*>(offset),
-                   FUTEX_WAKE, -1, nullptr, nullptr, 0);
-  }
-
-  virtual int WaitForSignal(uint32_t offset, uint32_t expected_value) override {
-    return syscall(SYS_futex, region_offset_to_pointer<int32_t*>(offset),
-                   FUTEX_WAIT, expected_value, nullptr, nullptr, 0);
-  }
-
- protected:
-  const char* region_name_{};
-  cvd::SharedFD incoming_interrupt_fd_;
-  cvd::SharedFD outgoing_interrupt_fd_;
-  cvd::SharedFD shared_memory_fd_;
-};
-
-// Default path to the ivshmem_server socket. This can vary when we're
-// launching multiple CVDs.
-constexpr int kMaxSupportedProtocolVersion = 0;
-
-bool HostRegionControl::InitializeRegion() {
-  size_t region_name_len = strlen(region_name_);
-  if (region_name_len >= VSOC_DEVICE_NAME_SZ) {
-    LOG(FATAL) << "Region name length (" << region_name_len << ") not < "
-               << VSOC_DEVICE_NAME_SZ;
-    return false;
-  }
-  vsoc_shm_layout_descriptor layout;
-  ssize_t rval = shared_memory_fd_->Pread(&layout, sizeof(layout), 0);
-  if (rval != sizeof(layout)) {
-    LOG(FATAL) << "Unable to read layout, rval=" << rval << " ("
-               << shared_memory_fd_->StrError() << ")";
-    return false;
-  }
-  if (layout.major_version != CURRENT_VSOC_LAYOUT_MAJOR_VERSION) {
-    LOG(FATAL) << "Incompatible major version: saw " << layout.major_version
-               << " wanted " << CURRENT_VSOC_LAYOUT_MAJOR_VERSION;
-  }
-  std::vector<vsoc_device_region> descriptors;
-  descriptors.resize(layout.region_count);
-  ssize_t wanted = sizeof(vsoc_device_region) * layout.region_count;
-  rval = shared_memory_fd_->Pread(descriptors.data(), wanted,
-                                  layout.vsoc_region_desc_offset);
-  if (rval != wanted) {
-    LOG(FATAL) << "Unable to read region descriptors, rval=" << rval << " ("
-               << shared_memory_fd_->StrError() << ")";
-    return false;
-  }
-  for (const auto& desc : descriptors) {
-    if (!strcmp(region_name_, desc.device_name)) {
-      region_desc_ = desc;
-      return true;
-    }
-  }
-
-  std::ostringstream buf;
-  for (const auto& desc : descriptors) {
-    buf << " " << desc.device_name;
-  }
-  LOG(FATAL) << "Region name of " << region_name_
-             << " not found among:" << buf.str();
-  return false;
-}
-}  // namespace
-
-std::shared_ptr<vsoc::RegionControl> vsoc::RegionControl::Open(
-    const char* region_name, const char* domain) {
-  AutoFreeBuffer msg;
-
-  SharedFD region_server =
-      SharedFD::SocketLocalClient(domain, false, SOCK_STREAM);
-  if (!region_server->IsOpen()) {
-    LOG(FATAL) << "Could not contact ivshmem_server ("
-               << region_server->StrError() << ")";
-    return nullptr;
-  }
-
-  // Check server protocol version.
-  uint32_t protocol_version;
-  ssize_t bytes = region_server->Recv(&protocol_version,
-                                      sizeof(protocol_version), MSG_NOSIGNAL);
-  if (bytes != sizeof(protocol_version)) {
-    LOG(FATAL) << "Failed to recv protocol version; res=" << bytes << " ("
-               << region_server->StrError() << ")";
-    return nullptr;
-  }
-
-  if (protocol_version > kMaxSupportedProtocolVersion) {
-    LOG(FATAL) << "Unsupported protocol version " << protocol_version
-               << "; max supported version is " << kMaxSupportedProtocolVersion;
-    return nullptr;
-  }
-
-  // Send requested region.
-  int16_t size = strlen(region_name);
-  bytes = region_server->Send(&size, sizeof(size), MSG_NOSIGNAL);
-  if (bytes != sizeof(size)) {
-    LOG(FATAL) << "Failed to send region name length; res=" << bytes << " ("
-               << region_server->StrError() << ")";
-    return nullptr;
-  }
-
-  bytes = region_server->Send(region_name, size, MSG_NOSIGNAL);
-  if (bytes != size) {
-    LOG(FATAL) << "Failed to send region name; res=" << bytes << " ("
-               << region_server->StrError() << ")";
-    return nullptr;
-  }
-
-  // Receive control sockets.
-  uint64_t control_data;
-  struct iovec iov {
-    &control_data, sizeof(control_data)
-  };
-  cvd::InbandMessageHeader hdr{};
-  hdr.msg_iov = &iov;
-  hdr.msg_iovlen = 1;
-  SharedFD fds[3];
-  bytes = region_server->RecvMsgAndFDs(hdr, 0, &fds);
-  if (bytes != sizeof(control_data)) {
-    LOG(FATAL) << "Failed to complete handshake; res=" << bytes << " ("
-               << region_server->StrError() << ")";
-    return nullptr;
-  }
-  HostRegionControl* rval =
-      new HostRegionControl(region_name, fds[0], fds[1], fds[2]);
-  if (!rval) {
-    return nullptr;
-  }
-  // Search for the region header
-  if (!rval->InitializeRegion()) {
-    // We already logged, so we can just bail out.
-    return nullptr;
-  }
-  return std::shared_ptr<RegionControl>(rval);
-}
diff --git a/host/vsoc/lib/region_view.cpp b/host/vsoc/lib/region_view.cpp
deleted file mode 100644
index 975b7cd..0000000
--- a/host/vsoc/lib/region_view.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "common/vsoc/lib/region_view.h"
-#include "common/vsoc/lib/region_control.h"
-
-const vsoc_signal_table_layout& vsoc::RegionView::incoming_signal_table() {
-  return control_->region_desc().guest_to_host_signal_table;
-}
-
-// Returns a pointer to the table that will be used to post signals
-const vsoc_signal_table_layout& vsoc::RegionView::outgoing_signal_table() {
-  return control_->region_desc().host_to_guest_signal_table;
-}
diff --git a/tests/hidl/Android.bp b/tests/hidl/Android.bp
new file mode 100644
index 0000000..a1827e3
--- /dev/null
+++ b/tests/hidl/Android.bp
@@ -0,0 +1,13 @@
+cc_test {
+    name: "hidl_implementation_test",
+    srcs: ["hidl_implementation_test.cpp"],
+    static_libs: [
+        "libhidlmetadata",
+        "libhidl-gen-utils",
+    ],
+    shared_libs: [
+        "libbase",
+        "libvintf",
+    ],
+    test_suites: ["device-tests"],
+}
diff --git a/tests/hidl/OWNERS b/tests/hidl/OWNERS
new file mode 100644
index 0000000..40164aa
--- /dev/null
+++ b/tests/hidl/OWNERS
@@ -0,0 +1 @@
+smoreland@google.com
diff --git a/tests/hidl/hidl_implementation_test.cpp b/tests/hidl/hidl_implementation_test.cpp
new file mode 100644
index 0000000..3eedc96
--- /dev/null
+++ b/tests/hidl/hidl_implementation_test.cpp
@@ -0,0 +1,205 @@
+/*
+ * Copyright (C) 2019 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 <android-base/logging.h>
+#include <gtest/gtest.h>
+#include <hidl/metadata.h>
+#include <hidl-util/FQName.h>
+#include <vintf/VintfObject.h>
+
+using namespace android;
+
+static const std::set<std::string> kKnownMissing = {
+    "android.frameworks.bufferhub@1.0",
+    "android.frameworks.cameraservice.device@2.0",
+    "android.frameworks.vr.composer@1.0",
+    "android.frameworks.vr.composer@2.0",
+    "android.hardware.audio@2.0",
+    "android.hardware.audio@4.0",
+    "android.hardware.audio@6.0",
+    "android.hardware.audio.effect@2.0",
+    "android.hardware.audio.effect@4.0",
+    "android.hardware.audio.effect@6.0",
+    "android.hardware.automotive.audiocontrol@1.0",
+    "android.hardware.automotive.can@1.0",
+    "android.hardware.automotive.evs@1.0",
+    "android.hardware.automotive.evs@1.1",
+    "android.hardware.automotive.vehicle@2.0",
+    "android.hardware.biometrics.face@1.0",
+    "android.hardware.biometrics.fingerprint@2.1",
+    "android.hardware.bluetooth.a2dp@1.0",
+    "android.hardware.broadcastradio@1.1",
+    "android.hardware.broadcastradio@2.0",
+    "android.hardware.camera.provider@2.5",
+    "android.hardware.cas@1.2",
+    "android.hardware.cas.native@1.0",
+    "android.hardware.confirmationui@1.0",
+    "android.hardware.contexthub@1.0",
+    "android.hardware.fastboot@1.0",
+    "android.hardware.gnss.measurement_corrections@1.0",
+    "android.hardware.gnss.visibility_control@1.0",
+    "android.hardware.graphics.allocator@3.0",
+    "android.hardware.graphics.allocator@4.0",
+    "android.hardware.graphics.bufferqueue@1.0",
+    "android.hardware.graphics.bufferqueue@2.0",
+    "android.hardware.graphics.composer@2.3",
+    "android.hardware.graphics.composer@2.4",
+    "android.hardware.graphics.mapper@3.0",
+    "android.hardware.graphics.mapper@4.0",
+    "android.hardware.health@1.0",
+    "android.hardware.ir@1.0",
+    "android.hardware.keymaster@3.0",
+    "android.hardware.media.bufferpool@1.0",
+    "android.hardware.media.bufferpool@2.0",
+    "android.hardware.memtrack@1.0",
+    "android.hardware.nfc@1.2",
+    "android.hardware.oemlock@1.0",
+    "android.hardware.power@1.3",
+    "android.hardware.radio.deprecated@1.0",
+    "android.hardware.renderscript@1.0",
+    "android.hardware.secure_element@1.1",
+    "android.hardware.sensors@1.0",
+    "android.hardware.soundtrigger@2.2",
+    "android.hardware.tetheroffload.config@1.0",
+    "android.hardware.tetheroffload.control@1.0",
+    "android.hardware.thermal@1.1",
+    "android.hardware.tv.cec@1.0",
+    "android.hardware.tv.cec@2.0",
+    "android.hardware.tv.input@1.0",
+    "android.hardware.tv.tuner@1.0",
+    "android.hardware.usb@1.2",
+    "android.hardware.usb.gadget@1.0",
+    "android.hardware.vibrator@1.3",
+    "android.hardware.vr@1.0",
+    "android.hardware.weaver@1.0",
+    "android.hardware.wifi@1.3",
+    "android.hardware.wifi@1.4",
+    "android.hardware.wifi.hostapd@1.1",
+    "android.hardware.wifi.offload@1.0",
+    "android.hidl.base@1.0",
+    "android.hidl.memory.token@1.0",
+};
+
+// AOSP packages which are never considered
+static bool isPackageWhitelist(const FQName& name) {
+    static std::vector<std::string> gAospExclude = {
+        // packages not implemented now that we never expect to be implemented
+        "android.hardware.tests",
+        // packages not registered with hwservicemanager, usually sub-interfaces
+        "android.hardware.camera.device",
+    };
+    for (const std::string& package : gAospExclude) {
+        if (name.inPackage(package)) {
+            return true;
+        }
+    }
+    return false;
+}
+
+static bool isAospInterface(const FQName& name) {
+    static std::vector<std::string> gAospPackages = {
+        "android.hidl",
+        "android.hardware",
+        "android.frameworks",
+        "android.system",
+    };
+    for (const std::string& package : gAospPackages) {
+        if (name.inPackage(package) && !isPackageWhitelist(name)) {
+            return true;
+        }
+    }
+    return false;
+}
+
+static std::set<FQName> allTreeInterfaces() {
+    std::set<FQName> ret;
+    for (const auto& iface : HidlInterfaceMetadata::all()) {
+        FQName f;
+        CHECK(f.setTo(iface.name)) << iface.name;
+        ret.insert(f);
+    }
+    return ret;
+}
+
+static std::set<FQName> allManifestInstances() {
+    std::set<FQName> ret;
+    auto setInserter = [&] (const vintf::ManifestInstance& i) -> bool {
+        if (i.format() != vintf::HalFormat::HIDL) {
+            std::cout << "[ WARNING  ] Not checking non-HIDL instance: " << i.description() << std::endl;
+            return true;  // continue
+        }
+        ret.insert(i.getFqInstance().getFqName());
+        return true;  // continue
+    };
+    vintf::VintfObject::GetDeviceHalManifest()->forEachInstance(setInserter);
+    vintf::VintfObject::GetFrameworkHalManifest()->forEachInstance(setInserter);
+    return ret;
+}
+
+TEST(Hidl, IsAospDevice) {
+    for (const FQName& name : allManifestInstances()) {
+        EXPECT_TRUE(isAospInterface(name)) << name.string();
+    }
+}
+
+TEST(Hidl, InterfacesImplemented) {
+    // instances -> major version -> minor versions
+    std::map<std::string, std::map<size_t, std::set<size_t>>> unimplemented;
+
+    for (const FQName& f : allTreeInterfaces()) {
+        if (!isAospInterface(f)) continue;
+
+        unimplemented[f.package()][f.getPackageMajorVersion()].insert(f.getPackageMinorVersion());
+    }
+
+    // we'll be removing items from this which we know are missing
+    // in order to be left with those elements which we thought we
+    // knew were missing but are actually present
+    std::set<std::string> thoughtMissing = kKnownMissing;
+
+    for (const FQName& f : allManifestInstances()) {
+        if (thoughtMissing.erase(f.getPackageAndVersion().string()) > 0) {
+             std::cout << "[ WARNING  ] Instance in missing list, but available: " << f.string() << std::endl;
+        }
+
+        std::set<size_t>& minors = unimplemented[f.package()][f.getPackageMajorVersion()];
+        size_t minor = f.getPackageMinorVersion();
+
+        auto it = minors.find(minor);
+        if (it == minors.end()) continue;
+
+        // if 1.2 is implemented, also considere 1.0, 1.1 implemented
+        minors.erase(minors.begin(), std::next(it));
+    }
+
+    for (const auto& [package, minorsPerMajor] : unimplemented) {
+        for (const auto& [major, minors] : minorsPerMajor) {
+            if (minors.empty()) continue;
+
+            size_t maxMinor = *minors.rbegin();
+
+            FQName missing;
+            ASSERT_TRUE(missing.setTo(package, major, maxMinor));
+
+            if (thoughtMissing.erase(missing.string()) > 0) continue;
+
+            ADD_FAILURE() << "Missing implementation from " << missing.string();
+        }
+    }
+
+    for (const std::string& missing : thoughtMissing) {
+        std::cout << "[ WARNING  ] Instance in missing list, and cannot find it anywhere: " << missing << std::endl;
+    }
+}
diff --git a/tools/create_base_image_arm.sh b/tools/create_base_image_arm.sh
new file mode 100755
index 0000000..b65600c
--- /dev/null
+++ b/tools/create_base_image_arm.sh
@@ -0,0 +1,620 @@
+#!/bin/bash
+
+# Copyright 2019 Google Inc. All rights reserved.
+
+# 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.
+
+source "${ANDROID_BUILD_TOP}/external/shflags/src/shflags"
+
+DEFINE_boolean p1 \
+	false "Only generate/write the 1st partition (loader1)" "1"
+DEFINE_boolean p2 \
+	false "Only generate/write the 2nd partition (env)" "2"
+DEFINE_boolean p3 \
+	false "Only generate/write the 3rd partition (loader2)" "3"
+DEFINE_boolean p4 \
+	false "Only generate/write the 4th partition (trust)" "4"
+DEFINE_boolean p5 \
+	false "Only generate/write the 5th partition (rootfs)" "5"
+
+FLAGS_HELP="USAGE: $0 <KERNEL_DIR> [IMAGE] [flags]"
+
+FLAGS "$@" || exit $?
+eval set -- "${FLAGS_ARGV}"
+
+if [ ${FLAGS_p1} -eq ${FLAGS_FALSE} ] &&
+   [ ${FLAGS_p2} -eq ${FLAGS_FALSE} ] &&
+   [ ${FLAGS_p3} -eq ${FLAGS_FALSE} ] &&
+   [ ${FLAGS_p4} -eq ${FLAGS_FALSE} ] &&
+   [ ${FLAGS_p5} -eq ${FLAGS_FALSE} ]; then
+	FLAGS_p1=${FLAGS_TRUE}
+	FLAGS_p2=${FLAGS_TRUE}
+	FLAGS_p3=${FLAGS_TRUE}
+	FLAGS_p4=${FLAGS_TRUE}
+	FLAGS_p5=${FLAGS_TRUE}
+fi
+
+for arg in "$@" ; do
+	if [ -z $KERNEL_DIR ]; then
+		KERNEL_DIR=$arg
+	elif [ -z $IMAGE ]; then
+		IMAGE=$arg
+	else
+		flags_help
+		exit 1
+	fi
+done
+
+USE_IMAGE=`[ -z "${IMAGE}" ] && echo "0" || echo "1"`
+OVERWRITE=`[ -e "${IMAGE}" ] && echo "1" || echo "0"`
+if [ -z $KERNEL_DIR ]; then
+	flags_help
+	exit 1
+fi
+if [ ! -e "${KERNEL_DIR}" ]; then
+	echo "error: can't find '${KERNEL_DIR}'. aborting..."
+	exit 1
+fi
+
+# escalate to superuser
+if [ $UID -ne 0 ]; then
+	cd ${ANDROID_BUILD_TOP}
+	. ./build/envsetup.sh
+	lunch ${TARGET_PRODUCT}-${TARGET_BUILD_VARIANT}
+	mmma external/u-boot
+	cd -
+	exec sudo -E "${0}" ${@}
+fi
+
+if [ $OVERWRITE -eq 1 ]; then
+	OVERWRITE_IMAGE=${IMAGE}
+	IMAGE=`mktemp`
+fi
+
+if [ $USE_IMAGE -eq 0 ]; then
+	init_devs=`lsblk --nodeps -oNAME -n`
+	echo "Reinsert device (to write to) into PC"
+	while true; do
+		devs=`lsblk --nodeps -oNAME -n`
+		new_devs="$(echo -e "${init_devs}\n${devs}" | sort | uniq -u | awk 'NF')"
+		num_devs=`echo "${new_devs}" | wc -l`
+		if [[ "${new_devs}" == "" ]]; then
+			num_devs=0
+		fi
+		if [[ ${num_devs} -gt 1 ]]; then
+			echo "error: too many new devices detected! aborting..."
+			exit 1
+		fi
+		if [[ ${num_devs} -eq 1 ]]; then
+			if [[ "${new_devs}" != "${mmc_dev}" ]]; then
+				if [[ "${mmc_dev}" != "" ]]; then
+					echo "error: block device name mismatch ${new_devs} != ${mmc_dev}"
+					echo "Reinsert device (to write to) into PC"
+				fi
+				mmc_dev=${new_devs}
+				continue
+			fi
+			echo "${init_devs}" | grep "${mmc_dev}" >/dev/null
+			if [[ $? -eq 0 ]]; then
+				init_devs="${devs}"
+				continue
+			fi
+			break
+		fi
+	done
+	# now inform the user
+	echo "Detected device at /dev/${mmc_dev}"
+fi
+
+if [ ${FLAGS_p1} -eq ${FLAGS_TRUE} ]; then
+	cd ${ANDROID_BUILD_TOP}/external/arm-trusted-firmware
+	CROSS_COMPILE=aarch64-linux-gnu- make PLAT=rk3399 DEBUG=0 ERROR_DEPRECATED=1 bl31
+	export BL31="${ANDROID_BUILD_TOP}/external/arm-trusted-firmware/build/rk3399/release/bl31/bl31.elf"
+	cd -
+fi
+
+cd ${ANDROID_BUILD_TOP}/external/u-boot
+
+if [ ${FLAGS_p2} -eq ${FLAGS_TRUE} ]; then
+	tmpfile=`mktemp`
+	bootenv=`mktemp`
+	cat > ${tmpfile} << "EOF"
+bootdelay=2
+baudrate=1500000
+scriptaddr=0x00500000
+boot_targets=mmc1 mmc0
+bootcmd=run distro_bootcmd
+distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
+bootcmd_mmc0=devnum=0; run mmc_boot
+bootcmd_mmc1=devnum=1; run mmc_boot
+mmc_boot=if mmc dev ${devnum}; then ; run scan_for_boot_part; fi
+scan_for_boot_part=part list mmc ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype mmc ${devnum}:${distro_bootpart} bootfstype; then run find_script; fi; done; setenv devplist;
+find_script=if test -e mmc ${devnum}:${distro_bootpart} /boot/boot.scr; then echo Found U-Boot script /boot/boot.scr; run run_scr; fi
+run_scr=load mmc ${devnum}:${distro_bootpart} ${scriptaddr} /boot/boot.scr; source ${scriptaddr}
+EOF
+	script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+	echo "Sha=`${script_dir}/gen_sha.sh --kernel ${KERNEL_DIR}`" >> ${tmpfile}
+	${ANDROID_HOST_OUT}/bin/mkenvimage -s 32768 -o ${bootenv} - < ${tmpfile}
+fi
+
+if [ ${FLAGS_p1} -eq ${FLAGS_TRUE} ] || [ ${FLAGS_p3} -eq ${FLAGS_TRUE} ]; then
+	make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- rock-pi-4-rk3399_defconfig
+	if [ ${FLAGS_p1} -eq ${FLAGS_TRUE} ]; then
+		make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- -j`nproc`
+	fi
+	if [ ${FLAGS_p3} -eq ${FLAGS_TRUE} ]; then
+		make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- u-boot.itb
+	fi
+	if [ ${FLAGS_p1} -eq ${FLAGS_TRUE} ]; then
+		idbloader=`mktemp`
+		${ANDROID_HOST_OUT}/bin/mkimage -n rk3399 -T rksd -d tpl/u-boot-tpl.bin ${idbloader}
+		cat spl/u-boot-spl.bin >> ${idbloader}
+	fi
+fi
+cd -
+
+if [ ${FLAGS_p5} -eq ${FLAGS_TRUE} ]; then
+	${ANDROID_BUILD_TOP}/kernel/tests/net/test/build_rootfs.sh -a arm64 -s buster -n ${IMAGE}
+	if [ $? -ne 0 ]; then
+		echo "error: failed to build rootfs. exiting..."
+		exit 1
+	fi
+	truncate -s +3G ${IMAGE}
+	e2fsck -f ${IMAGE}
+	resize2fs ${IMAGE}
+
+	mntdir=`mktemp -d`
+	mount ${IMAGE} ${mntdir}
+	if [ $? != 0 ]; then
+		echo "error: unable to mount ${IMAGE} ${mntdir}"
+		exit 1
+	fi
+
+	cat > ${mntdir}/boot/boot.cmd << "EOF"
+setenv bootcmd_dhcp '
+mw.b ${scriptaddr} 0 0x8000
+mmc dev 0 0
+mmc read ${scriptaddr} 0x1fc0 0x40
+env import -b ${scriptaddr} 0x8000
+mw.b ${scriptaddr} 0 0x8000
+if dhcp ${scriptaddr} manifest.txt; then
+	setenv OldSha ${Sha}
+	setenv Sha
+	env import -t ${scriptaddr} 0x8000 ManifestVersion
+	echo "Manifest version $ManifestVersion";
+	if test "$ManifestVersion" = "1"; then
+		run manifest1
+	elif test "$ManifestVersion" = "2"; then
+		run manifest2
+	else
+		run manifestX
+	fi
+fi'
+setenv manifestX 'echo "***** ERROR: Unknown manifest version! *****";'
+setenv manifest1 '
+env import -t ${scriptaddr} 0x8000
+if test "$Sha" != "$OldSha"; then
+	setenv serverip ${TftpServer}
+	setenv loadaddr 0x00200000
+	mmc dev 0 0;
+	setenv file $TplSplImg; offset=0x40; size=0x1f80; run tftpget1; setenv TplSplImg
+	setenv file $UbootItb;  offset=0x4000; size=0x2000; run tftpget1; setenv UbootItb
+	setenv file $TrustImg; offset=0x6000; size=0x2000; run tftpget1; setenv TrustImg
+	setenv file $RootfsImg; offset=0x8000; size=0; run tftpget1; setenv RootfsImg
+	setenv file $UbootEnv; offset=0x1fc0; size=0x40; run tftpget1; setenv UbootEnv
+	mw.b ${scriptaddr} 0 0x8000
+	env export -b ${scriptaddr} 0x8000
+	mmc write ${scriptaddr} 0x1fc0 0x40
+else
+	echo "Already have ${Sha}. Booting..."
+fi'
+setenv manifest2 '
+env import -t ${scriptaddr} 0x8000
+if test "$DFUethaddr" = "$ethaddr" || test "$DFUethaddr" = ""; then
+	if test "$Sha" != "$OldSha"; then
+		setenv serverip ${TftpServer}
+		setenv loadaddr 0x00200000
+		mmc dev 0 0;
+		setenv file $TplSplImg; offset=0x40; size=0x1f80; run tftpget1; setenv TplSplImg
+		setenv file $UbootItb;  offset=0x4000; size=0x2000; run tftpget1; setenv UbootItb
+		setenv file $TrustImg; offset=0x6000; size=0x2000; run tftpget1; setenv TrustImg
+		setenv file $RootfsImg; offset=0x8000; size=0; run tftpget1; setenv RootfsImg
+		setenv file $UbootEnv; offset=0x1fc0; size=0x40; run tftpget1; setenv UbootEnv
+		mw.b ${scriptaddr} 0 0x8000
+		env export -b ${scriptaddr} 0x8000
+		mmc write ${scriptaddr} 0x1fc0 0x40
+	else
+		echo "Already have ${Sha}. Booting..."
+	fi
+else
+	echo "Update ${Sha} is not for me. Booting..."
+fi'
+setenv tftpget1 '
+if test "$file" != ""; then
+	mw.b ${loadaddr} 0 0x400000
+	tftp ${file}
+	if test $? = 0; then
+		setenv isGz 0 && setexpr isGz sub .*\\.gz\$ 1 ${file}
+		if test $isGz = 1; then
+			if test ${file} = ${UbootEnv}; then
+				echo "** gzipped env unsupported **"
+			else
+				setexpr boffset ${offset} * 0x200
+				gzwrite mmc 0 ${loadaddr} 0x${filesize} 100000 ${boffset} && echo Updated: ${file}
+			fi
+		elif test ${file} = ${UbootEnv}; then
+			env import -b ${loadaddr} && echo Updated: ${file}
+		else
+			if test $size = 0; then
+				setexpr x $filesize - 1
+				setexpr x $x / 0x1000
+				setexpr x $x + 1
+				setexpr x $x * 0x1000
+				setexpr x $x / 0x200
+				size=0x${x}
+			fi
+			mmc write ${loadaddr} ${offset} ${size} && echo Updated: ${file}
+		fi
+	fi
+	if test $? != 0; then
+		echo ** UPDATE FAILED: ${file} **
+	fi
+fi'
+if mmc dev 1 0; then; else
+	run bootcmd_dhcp;
+fi
+load mmc ${devnum}:${distro_bootpart} 0x02080000 /boot/Image
+load mmc ${devnum}:${distro_bootpart} 0x04000000 /boot/uInitrd
+load mmc ${devnum}:${distro_bootpart} 0x01f00000 /boot/dtb/rockchip/rk3399-rock-pi-4.dtb
+setenv finduuid "part uuid mmc ${devnum}:${distro_bootpart} uuid"
+run finduuid
+setenv bootargs "earlycon=uart8250,mmio32,0xff1a0000 console=ttyS2,1500000n8 loglevel=7 root=PARTUUID=${uuid} rootwait rootfstype=ext4 sdhci.debug_quirks=0x20000000"
+booti 0x02080000 0x04000000 0x01f00000
+EOF
+	${ANDROID_HOST_OUT}/bin/mkimage \
+		-C none -A arm -T script -d ${mntdir}/boot/boot.cmd ${mntdir}/boot/boot.scr
+
+	cd ${KERNEL_DIR}
+	export PATH=${ANDROID_BUILD_TOP}/prebuilts/clang/host/linux-x86/clang-r353983c/bin:$PATH
+	export PATH=${ANDROID_BUILD_TOP}/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin:$PATH
+	make ARCH=arm64 CC=clang CROSS_COMPILE=aarch64-linux-androidkernel- \
+	      CLANG_TRIPLE=aarch64-linux-gnu- rockpi4_defconfig
+	make ARCH=arm64 CC=clang CROSS_COMPILE=aarch64-linux-androidkernel- \
+	      CLANG_TRIPLE=aarch64-linux-gnu- -j`nproc`
+
+	cp ${KERNEL_DIR}/arch/arm64/boot/Image ${mntdir}/boot/
+	mkdir -p ${mntdir}/boot/dtb/rockchip/
+	cp ${KERNEL_DIR}/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtb ${mntdir}/boot/dtb/rockchip/
+	cd -
+
+	mount -o bind /proc ${mntdir}/proc
+	mount -o bind /sys ${mntdir}/sys
+	mount -o bind /dev ${mntdir}/dev
+
+	echo "Installing required packages..."
+	chroot ${mntdir} /bin/bash <<EOF
+apt-get update
+apt-get install -y -f initramfs-tools u-boot-tools network-manager openssh-server sudo man-db vim git dpkg-dev cdbs debhelper config-package-dev gdisk eject lzop binfmt-support ntpdate
+EOF
+
+	echo "Turning on DHCP client..."
+	cat >${mntdir}/etc/systemd/network/dhcp.network <<EOF
+[Match]
+Name=en*
+
+[Network]
+DHCP=yes
+EOF
+
+	chroot ${mntdir} /bin/bash << "EOT"
+echo "Adding user vsoc-01 and groups..."
+useradd -m -G kvm,sudo -d /home/vsoc-01 --shell /bin/bash vsoc-01
+echo -e "cuttlefish\ncuttlefish" | passwd
+echo -e "cuttlefish\ncuttlefish" | passwd vsoc-01
+EOT
+
+	echo "Cloning android-cuttlefish..."
+	cd ${mntdir}/home/vsoc-01
+	git clone https://github.com/google/android-cuttlefish.git
+	cd -
+
+	echo "Creating led script..."
+	cat > ${mntdir}/usr/local/bin/led << "EOF"
+#!/bin/bash
+
+if [ "$1" == "--start" ]; then
+	echo 125 > /sys/class/gpio/export
+	echo out > /sys/class/gpio/gpio125/direction
+	chmod 666 /sys/class/gpio/gpio125/value
+	echo 0 > /sys/class/gpio/gpio125/value
+	exit 0
+fi
+
+if [ "$1" == "--stop" ]; then
+	echo 0 > /sys/class/gpio/gpio125/value
+	echo 125 > /sys/class/gpio/unexport
+	exit 0
+fi
+
+if [ ! -e /sys/class/gpio/gpio125/value ]; then
+	echo "error: led service not initialized"
+	exit 1
+fi
+
+if [ "$1" == "0" ] || [ "$1" == "off" ] || [ "$1" == "OFF" ]; then
+	echo 0 > /sys/class/gpio/gpio125/value
+	exit 0
+fi
+
+if [ "$1" == "1" ] || [ "$1" == "on" ] || [ "$1" == "ON" ]; then
+	echo 1 > /sys/class/gpio/gpio125/value
+	exit 0
+fi
+
+echo "usage: led <0|1>"
+exit 1
+EOF
+	chown root:root ${mntdir}/usr/local/bin/led
+	chmod 755 ${mntdir}/usr/local/bin/led
+
+	echo "Creating led service..."
+	cat > ${mntdir}/etc/systemd/system/led.service << EOF
+[Unit]
+ Description=led service
+ ConditionPathExists=/usr/local/bin/led
+
+[Service]
+ Type=oneshot
+ ExecStart=/usr/local/bin/led --start
+ ExecStop=/usr/local/bin/led --stop
+ RemainAfterExit=true
+ StandardOutput=journal
+
+[Install]
+ WantedBy=multi-user.target
+EOF
+
+	echo "Creating SD duplicator script..."
+	cat > ${mntdir}/usr/local/bin/sd-dupe << "EOF"
+#!/bin/bash
+led 0
+
+src_dev=mmcblk0
+dest_dev=mmcblk1
+part_num=p5
+
+if [ -e /dev/mmcblk0p5 ]; then
+	led 1
+
+	sgdisk -Z -a1 /dev/${dest_dev}
+	sgdisk -a1 -n:1:64:8127 -t:1:8301 -c:1:loader1 /dev/${dest_dev}
+	sgdisk -a1 -n:2:8128:8191 -t:2:8301 -c:2:env /dev/${dest_dev}
+	sgdisk -a1 -n:3:16384:24575 -t:3:8301 -c:3:loader2 /dev/${dest_dev}
+	sgdisk -a1 -n:4:24576:32767 -t:4:8301 -c:4:trust /dev/${dest_dev}
+	sgdisk -a1 -n:5:32768:- -A:5:set:2 -t:5:8305 -c:5:rootfs /dev/${dest_dev}
+
+	src_block_count=`tune2fs -l /dev/${src_dev}${part_num} | grep "Block count:" | sed 's/.*: *//'`
+	src_block_size=`tune2fs -l /dev/${src_dev}${part_num} | grep "Block size:" | sed 's/.*: *//'`
+	src_fs_size=$(( src_block_count*src_block_size ))
+	src_fs_size_m=$(( src_fs_size / 1024 / 1024 + 1 ))
+
+	dd if=/dev/${src_dev}p1 of=/dev/${dest_dev}p1 conv=sync,noerror status=progress
+	dd if=/dev/${src_dev}p2 of=/dev/${dest_dev}p2 conv=sync,noerror status=progress
+	dd if=/dev/${src_dev}p3 of=/dev/${dest_dev}p3 conv=sync,noerror status=progress
+	dd if=/dev/${src_dev}p4 of=/dev/${dest_dev}p4 conv=sync,noerror status=progress
+
+	echo "Writing ${src_fs_size_m} MB: /dev/${src_dev} -> /dev/${dest_dev}..."
+	dd if=/dev/${src_dev}${part_num} of=/dev/${dest_dev}${part_num} bs=1M conv=sync,noerror status=progress
+
+	echo "Expanding /dev/${dest_dev}${part_num} filesystem..."
+	e2fsck -fy /dev/${dest_dev}${part_num}
+	resize2fs /dev/${dest_dev}${part_num}
+	tune2fs -O has_journal /dev/${dest_dev}${part_num}
+	e2fsck -fy /dev/${dest_dev}${part_num}
+	sync /dev/${dest_dev}
+
+	echo "Cleaning up..."
+	mount /dev/${dest_dev}${part_num} /media
+	chroot /media /usr/local/bin/install-cleanup
+
+	if [ $? == 0 ]; then
+		echo "Successfully copied Rock Pi image!"
+		while true; do
+			led 1; sleep 0.5
+			led 0; sleep 0.5
+		done
+	else
+		echo "Error while copying Rock Pi image"
+		while true; do
+			led 1; sleep 0.1
+			led 0; sleep 0.1
+		done
+	fi
+else
+	echo "Expanding /dev/${dest_dev}${part_num} filesystem..."
+	e2fsck -fy /dev/${dest_dev}${part_num}
+	resize2fs /dev/${dest_dev}${part_num}
+	tune2fs -O has_journal /dev/${dest_dev}${part_num}
+	e2fsck -fy /dev/${dest_dev}${part_num}
+	sync /dev/${dest_dev}
+
+	echo "Cleaning up..."
+	/usr/local/bin/install-cleanup
+fi
+EOF
+	chmod +x ${mntdir}/usr/local/bin/sd-dupe
+
+	echo "Creating SD duplicator service..."
+	cat > ${mntdir}/etc/systemd/system/sd-dupe.service << EOF
+[Unit]
+ Description=Duplicate SD card rootfs to eMMC on Rock Pi
+ ConditionPathExists=/usr/local/bin/sd-dupe
+ After=led.service
+
+[Service]
+ Type=simple
+ ExecStart=/usr/local/bin/sd-dupe
+ TimeoutSec=0
+ StandardOutput=tty
+
+[Install]
+ WantedBy=multi-user.target
+EOF
+
+	echo "Creating cleanup script..."
+	cat > ${mntdir}/usr/local/bin/install-cleanup << "EOF"
+#!/bin/bash
+echo "Installing cuttlefish-common package..."
+echo "nameserver 8.8.8.8" > /etc/resolv.conf
+MAC=`ip link | grep eth0 -A1 | grep ether | sed 's/.*\(..:..:..:..:..:..\) .*/\1/' | tr -d :`
+sed -i " 1 s/.*/& rockpi-${MAC}/" /etc/hosts
+sudo hostnamectl set-hostname "rockpi-${MAC}"
+
+dpkg --add-architecture amd64
+until ping -c1 ftp.debian.org; do sleep 1; done
+ntpdate time.google.com
+while true; do
+	apt-get -o Acquire::Check-Valid-Until=false update
+	if [ $? != 0 ]; then sleep 1; continue; fi
+	apt-get install -y -f libc6:amd64 qemu-user-static
+	if [ $? != 0 ]; then sleep 1; continue; fi
+	break
+done
+cd /home/vsoc-01/android-cuttlefish
+dpkg-buildpackage -d -uc -us
+apt-get install -y -f ../cuttlefish-common_*_arm64.deb
+apt-get clean
+usermod -aG cvdnetwork vsoc-01
+chmod 660 /dev/vhost-vsock
+chown root:cvdnetwork /dev/vhost-vsock
+
+rm /etc/machine-id
+rm /var/lib/dbus/machine-id
+dbus-uuidgen --ensure
+systemd-machine-id-setup
+
+systemctl disable sd-dupe
+rm /etc/systemd/system/sd-dupe.service
+rm /usr/local/bin/sd-dupe
+rm /usr/local/bin/install-cleanup
+EOF
+	chmod +x ${mntdir}/usr/local/bin/install-cleanup
+
+	chroot ${mntdir} /bin/bash << "EOT"
+echo "Enabling services..."
+systemctl enable led
+systemctl enable sd-dupe
+
+echo "Creating Initial Ramdisk..."
+update-initramfs -c -t -k "5.2.0"
+mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n uInitrd -d /boot/initrd.img-5.2.0 /boot/uInitrd-5.2.0
+ln -s /boot/uInitrd-5.2.0 /boot/uInitrd
+EOT
+
+	umount ${mntdir}/sys
+	umount ${mntdir}/dev
+	umount ${mntdir}/proc
+	umount ${mntdir}
+
+	# Turn on journaling
+	tune2fs -O ^has_journal ${IMAGE}
+	e2fsck -fy ${IMAGE} >/dev/null 2>&1
+fi
+
+if [ ${USE_IMAGE} -eq 0 ]; then
+	# 32GB eMMC size
+	end_sector=61071326
+	device=/dev/${mmc_dev}
+	devicep=${device}
+
+	sgdisk -Z -a1 ${device}
+	sgdisk -a1 -n:1:64:8127 -t:1:8301 -c:1:loader1 ${device}
+	sgdisk -a1 -n:2:8128:8191 -t:2:8301 -c:2:env ${device}
+	sgdisk -a1 -n:3:16384:24575 -t:3:8301 -c:3:loader2 ${device}
+	sgdisk -a1 -n:4:24576:32767 -t:4:8301 -c:4:trust ${device}
+	sgdisk -a1 -n:5:32768:${end_sector} -A:5:set:2 -t:5:8305 -c:5:rootfs ${device}
+	if [ ${FLAGS_p5} -eq ${FLAGS_TRUE} ]; then
+		dd if=${IMAGE} of=${devicep}5 bs=1M
+		resize2fs ${devicep}5 >/dev/null 2>&1
+	fi
+else
+	device=$(losetup -f)
+	devicep=${device}p
+	if [ ${FLAGS_p5} -eq ${FLAGS_FALSE} ]; then
+		fs_end=3G
+		end_sector=-
+	fi
+	if [ ${FLAGS_p5} -eq ${FLAGS_TRUE} ]; then
+		# Minimize rootfs filesystem
+		while true; do
+			out=`sudo resize2fs -M ${IMAGE} 2>&1`
+			if [[ $out =~ "Nothing to do" ]]; then
+				break
+			fi
+		done
+		# Minimize rootfs file size
+		block_count=`sudo tune2fs -l ${IMAGE} | grep "Block count:" | sed 's/.*: *//'`
+		block_size=`sudo tune2fs -l ${IMAGE} | grep "Block size:" | sed 's/.*: *//'`
+		sector_size=512
+		start_sector=32768
+		fs_size=$(( block_count*block_size ))
+		fs_sectors=$(( fs_size/sector_size ))
+		part_sectors=$(( ((fs_sectors-1)/2048+1)*2048 ))  # 1MB-aligned
+		end_sector=$(( start_sector+part_sectors-1 ))
+		secondary_gpt_sectors=33
+		fs_end=$(( (end_sector+secondary_gpt_sectors+1)*sector_size ))
+		image_size=$(( part_sectors*sector_size ))
+		truncate -s ${image_size} ${IMAGE}
+		e2fsck -fy ${IMAGE} >/dev/null 2>&1
+	fi
+
+	# Create final image
+	if [ $OVERWRITE -eq 1 ]; then
+		tmpimg=${OVERWRITE_IMAGE}
+	else
+		tmpimg=`mktemp`
+	fi
+	truncate -s ${fs_end} ${tmpimg}
+
+	# Create GPT
+	sgdisk -Z -a1 ${tmpimg}
+	sgdisk -a1 -n:1:64:8127 -t:1:8301 -c:1:loader1 ${tmpimg}
+	sgdisk -a1 -n:2:8128:8191 -t:2:8301 -c:2:env ${tmpimg}
+	sgdisk -a1 -n:3:16384:24575 -t:3:8301 -c:3:loader2 ${tmpimg}
+	sgdisk -a1 -n:4:24576:32767 -t:4:8301 -c:4:trust ${tmpimg}
+	sgdisk -a1 -n:5:32768:${end_sector} -A:5:set:2 -t:5:8305 -c:5:rootfs ${tmpimg}
+
+	losetup ${device} ${tmpimg}
+	partx -v --add ${device}
+
+	if [ ${FLAGS_p5} -eq ${FLAGS_TRUE} ]; then
+		dd if=${IMAGE} of=${devicep}5 bs=1M
+	fi
+fi
+if [ ${FLAGS_p1} -eq ${FLAGS_TRUE} ]; then
+	dd if=${idbloader} of=${devicep}1
+fi
+if [ ${FLAGS_p2} -eq ${FLAGS_TRUE} ]; then
+	dd if=${bootenv} of=${devicep}2
+fi
+if [ ${FLAGS_p3} -eq ${FLAGS_TRUE} ]; then
+	dd if=${ANDROID_BUILD_TOP}/external/u-boot/u-boot.itb of=${devicep}3
+fi
+if [ ${USE_IMAGE} -eq 1 ]; then
+	chown $SUDO_USER:`id -ng $SUDO_USER` ${tmpimg}
+	if [ $OVERWRITE -eq 0 ]; then
+		mv ${tmpimg} ${IMAGE}
+	fi
+	partx -v --delete ${device}
+	losetup -d ${device}
+fi
diff --git a/tools/gen_sha.sh b/tools/gen_sha.sh
new file mode 100755
index 0000000..dec71f7
--- /dev/null
+++ b/tools/gen_sha.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+# Copyright 2019 Google Inc. All rights reserved.
+
+# 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.
+
+source "${ANDROID_BUILD_TOP}/external/shflags/src/shflags"
+
+DEFINE_string kernel \
+  "" "Path to kernel build dir" "k"
+
+FLAGS_HELP="USAGE: $0 [flags]"
+
+FLAGS "$@" || exit $?
+eval set -- "${FLAGS_ARGV}"
+
+if [ -z ${FLAGS_kernel} ]; then
+	flags_help
+	exit 1
+fi
+
+cd "${ANDROID_BUILD_TOP}/device/google/cuttlefish_common"
+Sha=`git rev-parse HEAD`
+cd - >/dev/null
+cd "${ANDROID_BUILD_TOP}/external/u-boot"
+Sha="$Sha,`git rev-parse HEAD`"
+cd - >/dev/null
+cd "${ANDROID_BUILD_TOP}/external/arm-trusted-firmware"
+Sha="$Sha,`git rev-parse HEAD`"
+cd - >/dev/null
+cd "${FLAGS_kernel}"
+Sha="$Sha,`git rev-parse HEAD`"
+cd - >/dev/null
+echo $Sha
diff --git a/tools/make_manifest.sh b/tools/make_manifest.sh
new file mode 100755
index 0000000..c8b5296
--- /dev/null
+++ b/tools/make_manifest.sh
@@ -0,0 +1,116 @@
+#!/bin/bash
+
+# Copyright 2019 Google Inc. All rights reserved.
+
+# 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.
+
+source "${ANDROID_BUILD_TOP}/external/shflags/src/shflags"
+
+DEFINE_string loader1 \
+  "" "Path to loader1 image (partition 1)" "l"
+DEFINE_string env \
+  "" "Path to env image (partition 2)" "e"
+DEFINE_string loader2 \
+  "" "Path to loader2 image (partition 3)" "u"
+DEFINE_string trust \
+  "" "Path to trust image (partition 4)" "t"
+DEFINE_string rootfs \
+  "" "Path to rootfs image (partition 5)" "r"
+DEFINE_string tftp \
+  "192.168.0.1" "TFTP server address" "f"
+DEFINE_string tftpdir \
+  "/tftpboot" "TFTP server directory" "d"
+DEFINE_string version \
+  "2" "Specify which manifest version to use (default: latest)" "v"
+DEFINE_string ethaddr \
+  "" "MAC address of device to DFU (default: all)" "m"
+DEFINE_string kernel \
+  "" "Path to kernel build dir" "k"
+
+FLAGS_HELP="USAGE: $0 --kernel <dir> [flags]"
+
+FLAGS "$@" || exit $?
+eval set -- "${FLAGS_ARGV}"
+
+for arg in "$@" ; do
+	flags_help
+	exit 1
+done
+
+if [ -z ${FLAGS_kernel} ]; then
+	flags_help
+	exit 1
+fi
+
+confirm() {
+    read -r -p "${1:-Are you sure you want to continue? [y/N]} " response
+    case "$response" in
+        [yY][eE][sS]|[yY])
+            true
+            ;;
+        *)
+            false
+            ;;
+    esac
+}
+
+createManifest() {
+	>>manifest.txt
+}
+
+addKVToManifest() {
+	key=$1
+	value=$2
+	grep -q "^${key}=" manifest.txt && \
+		sed -i "s/^${key}=.*/${key}=${value}/" manifest.txt || \
+		echo "${key}=${value}" >> manifest.txt
+}
+
+addShaToManifest() {
+	DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+	addKVToManifest "Sha" `${DIR}/gen_sha.sh --kernel ${FLAGS_kernel}`
+}
+
+addPathToManifest() {
+	key=$1
+	path=$2
+
+	if [ "${path}" != "" ]; then
+		filename=$(basename $path)
+		filetype=`file -b --mime-type "${path}"`
+		if [ "$key" == "UbootEnv" ] && [ "${filetype}" == "application/gzip" ]; then
+			echo "error: gzip not supported for env images"
+		fi
+		if [ "$key" != "UbootEnv" ] && [ "${filetype}" != "application/gzip" ]; then
+			echo "warning: gzip recommended for all non-env images"
+			confirm || exit 1
+		fi
+		if [ ! "${path}" -ef "${FLAGS_tftpdir}/${filename}" ]; then
+			cp "${path}" "${FLAGS_tftpdir}/"
+		fi
+	else
+		unset filename
+	fi
+
+	addKVToManifest "${key}" "${filename}"
+}
+
+createManifest
+addKVToManifest ManifestVersion ${FLAGS_version}
+addKVToManifest TftpServer ${FLAGS_tftp}
+addKVToManifest DFUethaddr ${FLAGS_ethaddr}
+addPathToManifest RootfsImg ${FLAGS_rootfs}
+addPathToManifest UbootEnv ${FLAGS_env}
+addPathToManifest TplSplImg ${FLAGS_loader1}
+addPathToManifest UbootItb ${FLAGS_loader2}
+addShaToManifest
diff --git a/tools/network-setup.sh b/tools/network-setup.sh
index 2913c0d..019c193 100755
--- a/tools/network-setup.sh
+++ b/tools/network-setup.sh
@@ -19,104 +19,141 @@
 	exit 1
 fi
 
+# escalate to superuser
+if [ "$UID" -ne 0 ]; then
+	exec sudo bash "$0"
+fi
+
+cleanup() {
+	echo "Starting up network-manager..."
+	service network-manager start
+	if [ $? != 0 ]; then
+		echo "error: failed to start network-manager"
+		exit 1
+	fi
+
+	echo "Starting up networking..."
+	service networking start
+	if [ $? != 0 ]; then
+		echo "error: failed to start networking"
+		exit 1
+	fi
+	if [ ! -z "$1" ]; then
+		exit $1
+	fi
+}
+
 sleep_time=0.1
+max_attempts=100
 DEFAULTNET=$1
 if [ "$DEFAULTNET" == "" ]; then
 	warn_no_default_network=0
-	warn_multiple_networks=0
 	warn_disconnect_rockpi=0
+	attempts=0
 	while true; do
-		DEFAULTNET=`ip link | grep "state UP" | sed 's/[0-9]*: \([^:]*\):.*/\1/'`
-		if [[ "${DEFAULTNET}" == "" ]]; then
+		NETLIST=`ip link | grep "state UP" | sed 's/[0-9]*: \([^:]*\):.*/\1/'`
+		if [[ "${NETLIST}" == "" ]]; then
 			if [[ $warn_no_default_network -eq 0 ]]; then
 				echo "error: couldn't detect any connected default network"
 				warn_no_default_network=1
-				warn_multiple_networks=0
 			fi
 			continue
-		elif [ `echo "$DEFAULTNET" | wc -l` -eq 1 ]; then
+		elif [ `echo "${NETLIST}" | wc -l` -eq 1 ]; then
+			DEFAULTNET=${NETLIST}
 			break
-		elif [ `echo "$DEFAULTNET" | wc -l` -ne 1 ]; then
+		elif [ `echo "${NETLIST}" | wc -l` -ne 1 ]; then
 			if [[ $warn_disconnect_rockpi -eq 0 ]]; then
 				echo "Please disconnect the network cable from the Rock Pi"
 				warn_disconnect_rockpi=1
 			fi
-			if [[ $warn_multiple_networks -eq 0 ]]; then
-				echo "error: detected multiple connected networks, not sure which to use as default:"
-				for net in $DEFAULTNET; do echo "    $net"; done
+			if [[ ${attempts} -gt ${max_attempts} ]]; then
+				echo -e "\nerror: detected multiple connected networks, please tell me what to do:"
+				count=1
+				for net in ${NETLIST}; do
+					echo "${count}) $net"
+					let count+=1
+				done
+				read -p "Enter the number of your default network connection: " num_default
+				count=1
+				for net in ${NETLIST}; do
+					if [ ${count} -eq ${num_default} ]; then
+						echo "Setting default to: ${net}"
+						DEFAULTNET=${net}
+					fi
+					let count+=1
+				done
 				warn_no_default_network=0
-				warn_multiple_networks=1
+				break
 			fi
+			echo -ne "\r"
+			printf "Manual configuration in %.1f seconds..." "$(( max_attempts-attempts ))e-1"
 			sleep $sleep_time
 		fi
+		let attempts+=1
 	done
 fi
-
-# escalate to superuser
-if [ "$UID" -ne 0 ]; then
-	exec sudo bash "$0" "${DEFAULTNET}"
-fi
-
 echo "Found default network at ${DEFAULTNET}"
-echo "Please reconnect network cable from Rock Pi to PC's spare network port"
 
-ROCKNETinit=`ip link | grep "state UP" | grep -v $DEFAULTNET | sed 's/[0-9]*: \([^:]*\):.*/\1/' | awk 'NF'`
-while true; do
-	ROCKNET=`ip link | grep "state UP" | grep -v $DEFAULTNET | sed 's/[0-9]*: \([^:]*\):.*/\1/' | awk 'NF'`
-	networks=`echo "$ROCKNET" | wc -l`
-	if [[ "${ROCKNET}" == "" ]]; then
-		continue
-	elif [ $networks -eq 1 ]; then
-		break
-	elif [ $networks -gt 1 ]; then
-		ROCKNET=`comm -3 <(echo "$ROCKNETinit" | sort) <(echo "$ROCKNET" | sort) | awk '{$1=$1};1'`
-		if [ "${ROCKNET}" != "" ]; then
+if [ "${ROCKNET}" == "" ]; then
+	echo "Please reconnect network cable from Rock Pi to PC's spare network port"
+	attempts=0
+	while true; do
+		NETLIST=`ip link | grep "state UP" | grep -v $DEFAULTNET | sed 's/[0-9]*: \([^:]*\):.*/\1/' | awk 'NF'`
+		networks=`echo "$NETLIST" | wc -l`
+		if [[ "${NETLIST}" == "" ]]; then
+			networks=0
+		fi
+		if [ $networks -eq 1 ]; then
+			ROCKNET=${NETLIST}
 			break
+		elif [ $networks -gt 1 ]; then
+			if [[ ${attempts} -gt ${max_attempts} ]]; then
+				echo -e "\nerror: detected multiple connected networks, please tell me what to do:"
+				count=1
+				for net in ${NETLIST}; do
+					echo "${count}) $net"
+					let count+=1
+				done
+				read -p "Enter the number of your rock pi network connection: " num_rockpi
+				count=1
+				for net in ${NETLIST}; do
+					if [ ${count} -eq ${num_rockpi} ]; then
+						echo "Setting rock pi to: ${net}"
+						ROCKNET=${net}
+					fi
+					let count+=1
+				done
+				break
+			fi
+			echo -ne "\r"
+			printf "Manual configuration in %.1f seconds..." "$(( max_attempts-attempts ))e-1"
+			let attempts+=1
 		fi
 		sleep $sleep_time
-	fi
-done
+	done
+fi
 echo "Found Rock Pi network at ${ROCKNET}"
 sudo ifconfig ${ROCKNET} down
 
-echo "Configuring udev rules..."
-cat >/etc/udev/rules.d/82-${ROCKNET}.rules <<EOF
-ACTION=="add", SUBSYSTEM=="net", KERNEL=="${ROCKNET}", ENV{NM_UNMANAGED}="1"
-EOF
+echo "Downloading dnsmasq..."
+apt-get install -d -y dnsmasq >/dev/null
 
-echo "Configuring network interface..."
-cat >/etc/network/interfaces.d/${ROCKNET}.conf <<EOF
-auto ${ROCKNET}
-iface ${ROCKNET} inet static
-	address 192.168.0.1
-	netmask 255.255.255.0
-EOF
-
-echo "Restarting network interface..."
-service network-manager restart
+echo "Shutting down network-manager to prevent interference..."
+service network-manager stop
 if [ $? != 0 ]; then
-	echo "error: failed to restart network-manager"
-	exit 1
-fi
-service networking restart
-if [ $? != 0 ]; then
-	echo "error: failed to restart networking"
-	exit 1
+	echo "error: failed to stop network-manager"
+	cleanup 1
 fi
 
-# Verify the Rock Pi was configured correctly
-ip link show ${ROCKNET} >/dev/null
+echo "Shutting down networking to prevent interference..."
+service networking stop
 if [ $? != 0 ]; then
-	echo "error: wasn't able to successfully configure connection to Rock Pi"
-	exit 1
+	echo "error: failed to stop networking"
+	cleanup 1
 fi
 
-# Check if dnsmasq is already installed
-dpkg -l | grep " dnsmasq " >/dev/null
-if [ $? != 0 ]; then
-	echo "Installing dnsmasq..."
-	apt-get install dnsmasq >/dev/null
-fi
+echo "Installing dnsmasq..."
+apt-get install dnsmasq >/dev/null
 
 echo "Enabling dnsmasq daemon..."
 cat /etc/default/dnsmasq | grep "ENABLED" >/dev/null
@@ -137,12 +174,18 @@
 dhcp-range=192.168.0.100,192.168.0.199
 EOF
 
-echo "Restarting dnsmasq service..."
-service dnsmasq restart
-if [ $? != 0 ]; then
-	echo "error: failed to restart dnsmasq"
-	exit 1
-fi
+echo "Configuring udev rules..."
+cat >/etc/udev/rules.d/82-${ROCKNET}.rules <<EOF
+ACTION=="add", SUBSYSTEM=="net", KERNEL=="${ROCKNET}", ENV{NM_UNMANAGED}="1"
+EOF
+
+echo "Configuring network interface..."
+cat >/etc/network/interfaces.d/${ROCKNET}.conf <<EOF
+auto ${ROCKNET}
+iface ${ROCKNET} inet static
+	address 192.168.0.1
+	netmask 255.255.255.0
+EOF
 
 echo "Enabling IP forwarding..."
 echo 1 >/proc/sys/net/ipv4/ip_forward
@@ -180,6 +223,22 @@
 sudo systemctl enable iptables-rockpi
 sudo systemctl start iptables-rockpi
 
+cleanup
+
+echo "Restarting dnsmasq service..."
+service dnsmasq restart
+if [ $? != 0 ]; then
+	echo "error: failed to restart dnsmasq"
+	exit 1
+fi
+
+# Verify the Rock Pi was configured correctly
+ip link show ${ROCKNET} >/dev/null
+if [ $? != 0 ]; then
+	echo "error: wasn't able to successfully configure connection to Rock Pi"
+	exit 1
+fi
+
 echo "Searching for Rock Pi's IP address..."
 while true; do
 	rockip=`cat /proc/net/arp | grep ${ROCKNET} | grep -v 00:00:00:00:00:00 | cut -d" " -f1`