Merge "specify vehicle service name on vts test"
diff --git a/audio/2.0/default/service.cpp b/audio/2.0/default/service.cpp
index 28ef660..646d898 100644
--- a/audio/2.0/default/service.cpp
+++ b/audio/2.0/default/service.cpp
@@ -16,14 +16,17 @@
 
 #define LOG_TAG "audiohalservice"
 
+#include <hidl/HidlTransportSupport.h>
 #include <hidl/LegacySupport.h>
 #include <android/hardware/audio/2.0/IDevicesFactory.h>
 #include <android/hardware/audio/effect/2.0/IEffectsFactory.h>
 #include <android/hardware/soundtrigger/2.0/ISoundTriggerHw.h>
 #include <android/hardware/broadcastradio/1.0/IBroadcastRadioFactory.h>
 
-using android::hardware::IPCThreadState;
-using android::hardware::ProcessState;
+using android::hardware::configureRpcThreadpool;
+using android::hardware::joinRpcThreadpool;
+using android::hardware::registerPassthroughServiceImplementation;
+
 using android::hardware::audio::effect::V2_0::IEffectsFactory;
 using android::hardware::audio::V2_0::IDevicesFactory;
 using android::hardware::soundtrigger::V2_0::ISoundTriggerHw;
@@ -31,9 +34,10 @@
 using android::hardware::broadcastradio::V1_0::IBroadcastRadioFactory;
 
 int main(int /* argc */, char* /* argv */ []) {
+    configureRpcThreadpool(16, true /*callerWillJoin*/);
     registerPassthroughServiceImplementation<IDevicesFactory>("audio_devices_factory");
     registerPassthroughServiceImplementation<IEffectsFactory>("audio_effects_factory");
     registerPassthroughServiceImplementation<ISoundTriggerHw>("sound_trigger.primary");
     registerPassthroughServiceImplementation<IBroadcastRadioFactory>("broadcastradio");
-    return android::hardware::launchRpcServer(16);
+    joinRpcThreadpool();
 }
diff --git a/benchmarks/msgq/1.0/IBenchmarkMsgQ.hal b/benchmarks/msgq/1.0/IBenchmarkMsgQ.hal
index 3af0b71..c4b9d95 100644
--- a/benchmarks/msgq/1.0/IBenchmarkMsgQ.hal
+++ b/benchmarks/msgq/1.0/IBenchmarkMsgQ.hal
@@ -25,7 +25,7 @@
      * by the service. Client can use it to set up the FMQ at its end.
      */
     configureClientInboxSyncReadWrite()
-        generates(bool ret, MQDescriptorSync mqDescIn);
+        generates(bool ret, fmq_sync<uint8_t> mqDescIn);
 
     /*
      * This method requests the service to set up Synchronous read/write
@@ -35,7 +35,7 @@
      * by the service. Client can use it to set up the FMQ at its end.
      */
     configureClientOutboxSyncReadWrite()
-        generates(bool ret, MQDescriptorSync mqDescOut);
+        generates(bool ret, fmq_sync<uint8_t> mqDescOut);
 
     /*
      * This method request the service to write into the FMQ.
diff --git a/bluetooth/1.0/default/Android.bp b/bluetooth/1.0/default/Android.bp
index 4c7017c..32e5328 100644
--- a/bluetooth/1.0/default/Android.bp
+++ b/bluetooth/1.0/default/Android.bp
@@ -19,18 +19,34 @@
     srcs: [
         "async_fd_watcher.cc",
         "bluetooth_hci.cc",
+        "bluetooth_address.cc",
         "vendor_interface.cc",
     ],
     shared_libs: [
-        "liblog",
+        "android.hardware.bluetooth@1.0",
+        "libbase",
         "libcutils",
         "libhardware",
         "libhwbinder",
-        "libbase",
-        "libcutils",
-        "libutils",
         "libhidlbase",
         "libhidltransport",
-        "android.hardware.bluetooth@1.0",
+        "liblog",
+        "libutils",
+    ],
+}
+
+cc_test_host {
+    name: "bluetooth-vendor-interface-unit-tests",
+    srcs: [
+        "bluetooth_address.cc",
+        "test/bluetooth_address_test.cc",
+        "test/properties.cc",
+    ],
+    local_include_dirs: [
+        "test",
+    ],
+    shared_libs: [
+        "libbase",
+        "liblog",
     ],
 }
diff --git a/bluetooth/1.0/default/bluetooth_address.cc b/bluetooth/1.0/default/bluetooth_address.cc
new file mode 100644
index 0000000..b917de9
--- /dev/null
+++ b/bluetooth/1.0/default/bluetooth_address.cc
@@ -0,0 +1,93 @@
+//
+// Copyright 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 "bluetooth_address.h"
+
+#include <android-base/logging.h>
+#include <cutils/properties.h>
+#include <fcntl.h>
+#include <utils/Log.h>
+
+namespace android {
+namespace hardware {
+namespace bluetooth {
+namespace V1_0 {
+namespace implementation {
+
+void BluetoothAddress::bytes_to_string(const uint8_t* addr, char* addr_str) {
+  sprintf(addr_str, "%02x:%02x:%02x:%02x:%02x:%02x", addr[0], addr[1], addr[2],
+          addr[3], addr[4], addr[5]);
+}
+
+bool BluetoothAddress::string_to_bytes(const char* addr_str, uint8_t* addr) {
+  if (addr_str == NULL) return false;
+  if (strnlen(addr_str, kStringLength) != kStringLength) return false;
+  unsigned char trailing_char = '\0';
+
+  return (sscanf(addr_str, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx%1c",
+                 &addr[0], &addr[1], &addr[2], &addr[3], &addr[4], &addr[5],
+                 &trailing_char) == kBytes);
+}
+
+bool BluetoothAddress::get_local_address(uint8_t* local_addr) {
+  char property[PROPERTY_VALUE_MAX] = {0};
+  bool valid_bda = false;
+
+  // Get local bdaddr storage path from a system property.
+  if (property_get(PROPERTY_BT_BDADDR_PATH, property, NULL)) {
+    int addr_fd;
+
+    ALOGD("%s: Trying %s", __func__, property);
+
+    addr_fd = open(property, O_RDONLY);
+    if (addr_fd != -1) {
+      int bytes_read = read(addr_fd, property, kStringLength);
+      CHECK(bytes_read == kStringLength);
+      close(addr_fd);
+
+      // Null terminate the string.
+      property[kStringLength] = '\0';
+
+      // If the address is not all zeros, then use it.
+      const uint8_t zero_bdaddr[kBytes] = {0, 0, 0, 0, 0, 0};
+      if ((string_to_bytes(property, local_addr)) &&
+          (memcmp(local_addr, zero_bdaddr, kBytes) != 0)) {
+        valid_bda = true;
+        ALOGD("%s: Got Factory BDA %s", __func__, property);
+      }
+    }
+  }
+
+  // No BDADDR found in the file. Look for BDA in a factory property.
+  if (!valid_bda && property_get(FACTORY_BDADDR_PROPERTY, property, NULL) &&
+      string_to_bytes(property, local_addr)) {
+    valid_bda = true;
+  }
+
+  // No factory BDADDR found. Look for a previously stored BDA.
+  if (!valid_bda && property_get(PERSIST_BDADDR_PROPERTY, property, NULL) &&
+      string_to_bytes(property, local_addr)) {
+    valid_bda = true;
+  }
+
+  return valid_bda;
+}
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace bluetooth
+}  // namespace hardware
+}  // namespace android
diff --git a/bluetooth/1.0/default/bluetooth_address.h b/bluetooth/1.0/default/bluetooth_address.h
new file mode 100644
index 0000000..94bf616
--- /dev/null
+++ b/bluetooth/1.0/default/bluetooth_address.h
@@ -0,0 +1,61 @@
+//
+// Copyright 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 <fcntl.h>
+
+#include <cstdint>
+#include <string>
+#include <vector>
+
+namespace android {
+namespace hardware {
+namespace bluetooth {
+namespace V1_0 {
+namespace implementation {
+
+// The property key stores the storage location of Bluetooth Device Address
+static constexpr char PROPERTY_BT_BDADDR_PATH[] = "ro.bt.bdaddr_path";
+
+// Check for a legacy address stored as a property.
+static constexpr char PERSIST_BDADDR_PROPERTY[] =
+    "persist.service.bdroid.bdaddr";
+
+// If there is no valid bdaddr available from PROPERTY_BT_BDADDR_PATH and there
+// is no available persistent bdaddr available from PERSIST_BDADDR_PROPERTY,
+// use a factory set address.
+static constexpr char FACTORY_BDADDR_PROPERTY[] = "ro.boot.btmacaddr";
+
+// Encapsulate handling for Bluetooth Addresses:
+class BluetoothAddress {
+ public:
+  // Conversion constants
+  static constexpr size_t kStringLength = sizeof("XX:XX:XX:XX:XX:XX") - 1;
+  static constexpr size_t kBytes = (kStringLength + 1) / 3;
+
+  static void bytes_to_string(const uint8_t* addr, char* addr_str);
+
+  static bool string_to_bytes(const char* addr_str, uint8_t* addr);
+
+  static bool get_local_address(uint8_t* addr);
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace bluetooth
+} // namespace hardware
+} // namespace android
diff --git a/bluetooth/1.0/default/test/bluetooth_address_test.cc b/bluetooth/1.0/default/test/bluetooth_address_test.cc
new file mode 100644
index 0000000..9f80ec2
--- /dev/null
+++ b/bluetooth/1.0/default/test/bluetooth_address_test.cc
@@ -0,0 +1,246 @@
+//
+// Copyright 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 <cutils/properties.h>
+#include <fcntl.h>
+#include <gtest/gtest.h>
+
+#include <string>
+#include <vector>
+using std::vector;
+
+#include "bluetooth_address.h"
+
+namespace android {
+namespace hardware {
+namespace bluetooth {
+namespace V1_0 {
+namespace implementation {
+
+constexpr char kTestAddr1[BluetoothAddress::kStringLength + 1] =
+    "12:34:56:78:9a:bc";
+constexpr uint8_t kTestAddr1_bytes[BluetoothAddress::kBytes] = {
+    0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc};
+constexpr char kZeros[BluetoothAddress::kStringLength + 1] =
+    "00:00:00:00:00:00";
+constexpr uint8_t kZeros_bytes[BluetoothAddress::kBytes] = {0x00, 0x00, 0x00,
+                                                            0x00, 0x00, 0x00};
+constexpr char kTestAddrBad1[BluetoothAddress::kStringLength + 1] =
+    "bb:aa:dd:00:00:01";
+constexpr uint8_t kTestAddrBad1_bytes[BluetoothAddress::kBytes] = {
+    0xbb, 0xaa, 0xdd, 0x00, 0x00, 0x01};
+
+constexpr char kAddrPath[] = "/tmp/my_address_in_a_file.txt";
+
+class BluetoothAddressTest : public ::testing::Test {
+ public:
+  BluetoothAddressTest() {}
+  ~BluetoothAddressTest() {}
+
+  void FileWriteString(const char* path, const char* string);
+};
+
+void BluetoothAddressTest::FileWriteString(const char* path,
+                                           const char* string) {
+  int fd = open(path, O_CREAT | O_RDWR);
+  EXPECT_TRUE(fd > 0) << "err = " << strerror(errno);
+
+  size_t length = strlen(string);
+  size_t bytes_written = write(fd, string, length);
+
+  EXPECT_EQ(length, bytes_written) << strerror(errno);
+
+  close(fd);
+}
+
+TEST_F(BluetoothAddressTest, string_to_bytes) {
+  uint8_t addr[BluetoothAddress::kBytes];
+
+  // Malformed addresses
+  EXPECT_FALSE(BluetoothAddress::string_to_bytes("", addr));
+  EXPECT_FALSE(BluetoothAddress::string_to_bytes("000000000000", addr));
+  EXPECT_FALSE(BluetoothAddress::string_to_bytes("00:00:00:00:0000", addr));
+  EXPECT_FALSE(BluetoothAddress::string_to_bytes("00:00:00:00:00:0", addr));
+  EXPECT_FALSE(BluetoothAddress::string_to_bytes("00:00:00:00:00:0;", addr));
+  EXPECT_FALSE(BluetoothAddress::string_to_bytes("aB:cD:eF:Gh:iJ:Kl", addr));
+  EXPECT_FALSE(BluetoothAddress::string_to_bytes("00:00:000:00:00:0;", addr));
+  EXPECT_FALSE(BluetoothAddress::string_to_bytes("12:34:56:78:90:12;", addr));
+  EXPECT_FALSE(BluetoothAddress::string_to_bytes("12:34:56:78:90:123", addr));
+
+  // Reasonable addresses
+  EXPECT_TRUE(BluetoothAddress::string_to_bytes("00:00:00:00:00:00", addr));
+  EXPECT_TRUE(BluetoothAddress::string_to_bytes("a5:a5:a5:a5:a5:a5", addr));
+  EXPECT_TRUE(BluetoothAddress::string_to_bytes("5A:5A:5A:5A:5A:5A", addr));
+  EXPECT_TRUE(BluetoothAddress::string_to_bytes("AA:BB:CC:DD:EE:FF", addr));
+  EXPECT_TRUE(BluetoothAddress::string_to_bytes("aa:bb:cc:dd:ee:ff", addr));
+
+  // Compare the output to known bytes
+  uint8_t addrA[BluetoothAddress::kBytes];
+  uint8_t addrB[BluetoothAddress::kBytes];
+
+  // kTestAddr1
+  EXPECT_TRUE(BluetoothAddress::string_to_bytes(kTestAddr1, addrA));
+  EXPECT_TRUE(memcmp(addrA, kTestAddr1_bytes, BluetoothAddress::kBytes) == 0);
+
+  // kZeros
+  EXPECT_TRUE(BluetoothAddress::string_to_bytes(kZeros, addrB));
+  EXPECT_TRUE(memcmp(addrB, kZeros_bytes, BluetoothAddress::kBytes) == 0);
+
+  // kTestAddr1 != kZeros
+  EXPECT_FALSE(memcmp(addrA, addrB, BluetoothAddress::kBytes) == 0);
+}
+
+TEST_F(BluetoothAddressTest, bytes_to_string) {
+  char addrA[BluetoothAddress::kStringLength + 1] = "";
+  char addrB[BluetoothAddress::kStringLength + 1] = "";
+
+  // kTestAddr1
+  BluetoothAddress::bytes_to_string(kTestAddr1_bytes, addrA);
+  EXPECT_TRUE(memcmp(addrA, kTestAddr1, BluetoothAddress::kStringLength) == 0);
+
+  // kZeros
+  BluetoothAddress::bytes_to_string(kZeros_bytes, addrB);
+  EXPECT_TRUE(memcmp(addrB, kZeros, BluetoothAddress::kStringLength) == 0);
+
+  // kTestAddr1 != kZeros
+  EXPECT_FALSE(memcmp(addrA, addrB, BluetoothAddress::kStringLength) == 0);
+}
+
+TEST_F(BluetoothAddressTest, property_set) {
+  // Set the properties to empty strings.
+  property_set(PERSIST_BDADDR_PROPERTY, "");
+  property_set(PROPERTY_BT_BDADDR_PATH, "");
+  property_set(FACTORY_BDADDR_PROPERTY, "");
+
+  // Get returns 0.
+  char prop[PROP_VALUE_MAX] = "";
+  EXPECT_TRUE(property_get(PERSIST_BDADDR_PROPERTY, prop, NULL) == 0);
+  EXPECT_TRUE(property_get(PROPERTY_BT_BDADDR_PATH, prop, NULL) == 0);
+  EXPECT_TRUE(property_get(FACTORY_BDADDR_PROPERTY, prop, NULL) == 0);
+
+  // Set the properties to known strings.
+  property_set(PERSIST_BDADDR_PROPERTY, "1");
+  property_set(PROPERTY_BT_BDADDR_PATH, "22");
+  property_set(FACTORY_BDADDR_PROPERTY, "333");
+
+  // Get returns the correct length.
+  EXPECT_TRUE(property_get(PERSIST_BDADDR_PROPERTY, prop, NULL) == 1);
+  EXPECT_TRUE(property_get(PROPERTY_BT_BDADDR_PATH, prop, NULL) == 2);
+  EXPECT_TRUE(property_get(FACTORY_BDADDR_PROPERTY, prop, NULL) == 3);
+
+  // Set the properties to empty strings again.
+  property_set(PERSIST_BDADDR_PROPERTY, "");
+  property_set(PROPERTY_BT_BDADDR_PATH, "");
+  property_set(FACTORY_BDADDR_PROPERTY, "");
+
+  // Get returns 0.
+  EXPECT_TRUE(property_get(PERSIST_BDADDR_PROPERTY, prop, NULL) == 0);
+  EXPECT_TRUE(property_get(PROPERTY_BT_BDADDR_PATH, prop, NULL) == 0);
+  EXPECT_TRUE(property_get(FACTORY_BDADDR_PROPERTY, prop, NULL) == 0);
+}
+
+TEST_F(BluetoothAddressTest, property_get) {
+  // Set the properties to known strings.
+  property_set(PERSIST_BDADDR_PROPERTY, PERSIST_BDADDR_PROPERTY);
+  property_set(PROPERTY_BT_BDADDR_PATH, PROPERTY_BT_BDADDR_PATH);
+  property_set(FACTORY_BDADDR_PROPERTY, FACTORY_BDADDR_PROPERTY);
+
+  // Get returns the same strings.
+  char prop[PROP_VALUE_MAX] = "";
+  EXPECT_TRUE(property_get(PERSIST_BDADDR_PROPERTY, prop, NULL) > 0);
+  EXPECT_TRUE(strcmp(PERSIST_BDADDR_PROPERTY, prop) == 0);
+
+  EXPECT_TRUE(property_get(PROPERTY_BT_BDADDR_PATH, prop, NULL) > 0);
+  EXPECT_TRUE(strcmp(PROPERTY_BT_BDADDR_PATH, prop) == 0);
+
+  EXPECT_TRUE(property_get(FACTORY_BDADDR_PROPERTY, prop, NULL) > 0);
+  EXPECT_TRUE(strcmp(FACTORY_BDADDR_PROPERTY, prop) == 0);
+
+  // Set a property to a different known string.
+  char prop2[PROP_VALUE_MAX] = "Erased";
+  property_set(PERSIST_BDADDR_PROPERTY, prop2);
+
+  // Get returns the correct strings.
+  EXPECT_TRUE(property_get(PERSIST_BDADDR_PROPERTY, prop, NULL) > 0);
+  EXPECT_TRUE(strcmp(prop2, prop) == 0);
+
+  EXPECT_TRUE(property_get(PROPERTY_BT_BDADDR_PATH, prop, NULL) > 0);
+  EXPECT_TRUE(strcmp(PROPERTY_BT_BDADDR_PATH, prop) == 0);
+
+  EXPECT_TRUE(property_get(FACTORY_BDADDR_PROPERTY, prop, NULL) > 0);
+  EXPECT_TRUE(strcmp(FACTORY_BDADDR_PROPERTY, prop) == 0);
+
+  // Set another property to prop2.
+  property_set(PROPERTY_BT_BDADDR_PATH, prop2);
+
+  EXPECT_TRUE(property_get(PERSIST_BDADDR_PROPERTY, prop, NULL) > 0);
+  EXPECT_TRUE(strcmp(prop2, prop) == 0);
+
+  EXPECT_TRUE(property_get(PROPERTY_BT_BDADDR_PATH, prop, NULL) > 0);
+  EXPECT_TRUE(strcmp(prop2, prop) == 0);
+
+  EXPECT_TRUE(property_get(FACTORY_BDADDR_PROPERTY, prop, NULL) > 0);
+  EXPECT_TRUE(strcmp(FACTORY_BDADDR_PROPERTY, prop) == 0);
+
+  // Set the third property to prop2.
+  property_set(FACTORY_BDADDR_PROPERTY, prop2);
+
+  EXPECT_TRUE(property_get(PERSIST_BDADDR_PROPERTY, prop, NULL) > 0);
+  EXPECT_TRUE(strcmp(prop2, prop) == 0);
+
+  EXPECT_TRUE(property_get(PROPERTY_BT_BDADDR_PATH, prop, NULL) > 0);
+  EXPECT_TRUE(strcmp(prop2, prop) == 0);
+
+  EXPECT_TRUE(property_get(FACTORY_BDADDR_PROPERTY, prop, NULL) > 0);
+  EXPECT_TRUE(strcmp(prop2, prop) == 0);
+}
+
+TEST_F(BluetoothAddressTest, get_local_address) {
+  EXPECT_TRUE(property_set(PERSIST_BDADDR_PROPERTY, "") == 0);
+  EXPECT_TRUE(property_set(FACTORY_BDADDR_PROPERTY, "") == 0);
+  uint8_t address[BluetoothAddress::kBytes];
+
+  // File contains a non-zero Address.
+  FileWriteString(kAddrPath, kTestAddr1);
+  EXPECT_TRUE(property_set(PROPERTY_BT_BDADDR_PATH, kAddrPath) == 0);
+  EXPECT_TRUE(BluetoothAddress::get_local_address(address));
+  EXPECT_TRUE(memcmp(address, kTestAddr1_bytes, BluetoothAddress::kBytes) == 0);
+
+  // File contains a zero address.
+  FileWriteString(kAddrPath, kZeros);
+  EXPECT_TRUE(property_set(PROPERTY_BT_BDADDR_PATH, kAddrPath) == 0);
+  EXPECT_FALSE(BluetoothAddress::get_local_address(address));
+
+  // Factory property contains an address.
+  EXPECT_TRUE(property_set(PERSIST_BDADDR_PROPERTY, kTestAddrBad1) == 0);
+  EXPECT_TRUE(property_set(FACTORY_BDADDR_PROPERTY, kTestAddr1) == 0);
+  EXPECT_TRUE(BluetoothAddress::get_local_address(address));
+  EXPECT_TRUE(memcmp(address, kTestAddr1_bytes, BluetoothAddress::kBytes) == 0);
+
+  // Persistent property contains an address.
+  memcpy(address, kTestAddrBad1_bytes, BluetoothAddress::kBytes);
+  EXPECT_TRUE(property_set(PERSIST_BDADDR_PROPERTY, kTestAddr1) == 0);
+  EXPECT_TRUE(property_set(FACTORY_BDADDR_PROPERTY, "") == 0);
+  EXPECT_TRUE(property_set(PROPERTY_BT_BDADDR_PATH, "") == 0);
+  EXPECT_TRUE(BluetoothAddress::get_local_address(address));
+  EXPECT_TRUE(memcmp(address, kTestAddr1_bytes, BluetoothAddress::kBytes) == 0);
+}
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace bluetooth
+}  // namespace hardware
+}  // namespace android
diff --git a/bluetooth/1.0/default/test/properties.cc b/bluetooth/1.0/default/test/properties.cc
new file mode 100644
index 0000000..ad5c194
--- /dev/null
+++ b/bluetooth/1.0/default/test/properties.cc
@@ -0,0 +1,79 @@
+//
+// Copyright 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 "properties"
+
+#include <ctype.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <cutils/properties.h>
+#include <utils/Log.h>
+
+static const int MAX_PROPERTIES = 5;
+
+struct property {
+  char key[PROP_KEY_MAX + 2];
+  char value[PROP_VALUE_MAX + 2];
+};
+
+int num_properties = 0;
+struct property properties[MAX_PROPERTIES];
+
+// Find the correct entry.
+static int property_find(const char *key) {
+  for (int i = 0; i < num_properties; i++) {
+    if (strncmp(properties[i].key, key, PROP_KEY_MAX) == 0) {
+      return i;
+    }
+  }
+  return MAX_PROPERTIES;
+}
+
+int property_set(const char *key, const char *value) {
+  if (strnlen(value, PROP_VALUE_MAX) > PROP_VALUE_MAX) return -1;
+
+  // Check to see if the property exists.
+  int prop_index = property_find(key);
+
+  if (prop_index == MAX_PROPERTIES) {
+    if (num_properties >= MAX_PROPERTIES) return -1;
+    prop_index = num_properties;
+    num_properties += 1;
+  }
+
+  // This is test code.  Be nice and don't push the boundary cases!
+  strncpy(properties[prop_index].key, key, PROP_KEY_MAX + 1);
+  strncpy(properties[prop_index].value, value, PROP_VALUE_MAX + 1);
+  return 0;
+}
+
+int property_get(const char *key, char *value, const char *default_value) {
+  // This doesn't mock the behavior of default value
+  if (default_value != NULL) ALOGE("%s: default_value is ignored!", __func__);
+
+  // Check to see if the property exists.
+  int prop_index = property_find(key);
+
+  if (prop_index == MAX_PROPERTIES) return 0;
+
+  int len = strlen(properties[prop_index].value);
+  memcpy(value, properties[prop_index].value, len);
+  value[len] = '\0';
+  return len;
+}
diff --git a/bluetooth/1.0/default/test/sys/system_properties.h b/bluetooth/1.0/default/test/sys/system_properties.h
new file mode 100644
index 0000000..b477a6b
--- /dev/null
+++ b/bluetooth/1.0/default/test/sys/system_properties.h
@@ -0,0 +1,20 @@
+//
+// Copyright 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.
+//
+
+// Mock sys/system_properties.h for testing
+
+#define PROP_VALUE_MAX 50
+#define PROP_KEY_MAX 50
diff --git a/bluetooth/1.0/default/vendor_interface.cc b/bluetooth/1.0/default/vendor_interface.cc
index 7efd5bd..905e1a6 100644
--- a/bluetooth/1.0/default/vendor_interface.cc
+++ b/bluetooth/1.0/default/vendor_interface.cc
@@ -18,9 +18,13 @@
 
 #define LOG_TAG "android.hardware.bluetooth@1.0-impl"
 #include <android-base/logging.h>
+#include <cutils/properties.h>
 #include <utils/Log.h>
 
 #include <dlfcn.h>
+#include <fcntl.h>
+
+#include "bluetooth_address.h"
 
 static const char* VENDOR_LIBRARY_NAME = "libbt-vendor.so";
 static const char* VENDOR_LIBRARY_SYMBOL_NAME =
@@ -59,7 +63,7 @@
   packet->len = data.size();
   packet->layer_specific = 0;
   packet->event = event;
-  // TODO(eisenbach): Avoid copy here; if BT_HDR->data can be enusred to
+  // TODO(eisenbach): Avoid copy here; if BT_HDR->data can be ensured to
   // be the only way the data is accessed, a pointer could be passed here...
   memcpy(packet->data, data.data(), data.size());
   return packet;
@@ -143,9 +147,6 @@
 VendorInterface* VendorInterface::get() { return g_vendor_interface; }
 
 bool VendorInterface::Open(PacketReadCallback packet_read_cb) {
-  // TODO(eisenbach): P0 - get local BD address somehow
-  uint8_t local_bda[] = {0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
-
   firmware_configured_ = false;
   packet_read_cb_ = packet_read_cb;
 
@@ -166,6 +167,10 @@
     return false;
   }
 
+  // Get the local BD address
+
+  uint8_t local_bda[BluetoothAddress::kBytes];
+  CHECK(BluetoothAddress::get_local_address(local_bda));
   int status = lib_interface_->init(&lib_callbacks, (unsigned char*)local_bda);
   if (status) {
     ALOGE("%s unable to initialize vendor library: %d", __func__, status);
diff --git a/bluetooth/1.0/default/vendor_interface.h b/bluetooth/1.0/default/vendor_interface.h
index 133c51b..73ff2eb 100644
--- a/bluetooth/1.0/default/vendor_interface.h
+++ b/bluetooth/1.0/default/vendor_interface.h
@@ -29,7 +29,8 @@
 namespace implementation {
 
 using ::android::hardware::hidl_vec;
-using PacketReadCallback = std::function<void(HciPacketType, const hidl_vec<uint8_t>&)>;
+using PacketReadCallback =
+    std::function<void(HciPacketType, const hidl_vec<uint8_t> &)>;
 
 class VendorInterface {
  public:
diff --git a/bluetooth/1.0/vts/functional/bluetooth_hidl_hal_test.cpp b/bluetooth/1.0/vts/functional/bluetooth_hidl_hal_test.cpp
index b05e22b..2a4bbdd 100644
--- a/bluetooth/1.0/vts/functional/bluetooth_hidl_hal_test.cpp
+++ b/bluetooth/1.0/vts/functional/bluetooth_hidl_hal_test.cpp
@@ -21,7 +21,6 @@
 #include <android/hardware/bluetooth/1.0/IBluetoothHciCallbacks.h>
 #include <android/hardware/bluetooth/1.0/types.h>
 #include <hardware/bluetooth.h>
-#include <hwbinder/ProcessState.h>
 #include <utils/Log.h>
 
 #include <gtest/gtest.h>
@@ -128,14 +127,6 @@
           bluetooth->isRemote() ? "remote" : "local");
     ASSERT_NE(bluetooth, nullptr);
 
-    // TODO(b/31748996) A client must be completely unaware of the
-    // implementation details of its HAL: whether the HAL is passthrough, or
-    // whether it uses HWbinder or some other transport.
-    if (bluetooth->isRemote()) {
-      ::android::hardware::ProcessState::self()->setThreadPoolMaxThreadCount(1);
-      ::android::hardware::ProcessState::self()->startThreadPool();
-    }
-
     bluetooth_cb = new BluetoothHciCallbacks(*this);
     ASSERT_NE(bluetooth_cb, nullptr);
 
diff --git a/broadcastradio/1.0/vts/functional/broadcastradio_hidl_hal_test.cpp b/broadcastradio/1.0/vts/functional/broadcastradio_hidl_hal_test.cpp
index 26666d6..6802c3c 100644
--- a/broadcastradio/1.0/vts/functional/broadcastradio_hidl_hal_test.cpp
+++ b/broadcastradio/1.0/vts/functional/broadcastradio_hidl_hal_test.cpp
@@ -19,9 +19,8 @@
 #include <android-base/logging.h>
 #include <cutils/native_handle.h>
 #include <cutils/properties.h>
+#include <hidl/HidlTransportSupport.h>
 #include <utils/threads.h>
-#include <hwbinder/IPCThreadState.h>
-#include <hwbinder/ProcessState.h>
 
 #include <android/hardware/broadcastradio/1.0/IBroadcastRadioFactory.h>
 #include <android/hardware/broadcastradio/1.0/IBroadcastRadio.h>
@@ -33,7 +32,6 @@
 using ::android::sp;
 using ::android::Mutex;
 using ::android::Condition;
-using ::android::hardware::ProcessState;
 using ::android::hardware::Return;
 using ::android::hardware::Status;
 using ::android::hardware::Void;
@@ -461,8 +459,6 @@
 
 
 int main(int argc, char** argv) {
-  sp<ProcessState> proc(ProcessState::self());
-  ProcessState::self()->startThreadPool();
   ::testing::AddGlobalTestEnvironment(new BroadcastRadioHidlEnvironment);
   ::testing::InitGoogleTest(&argc, argv);
   int status = RUN_ALL_TESTS();
diff --git a/camera/device/3.2/types.hal b/camera/device/3.2/types.hal
index ed6ef7d..a7ab4ab 100644
--- a/camera/device/3.2/types.hal
+++ b/camera/device/3.2/types.hal
@@ -408,7 +408,16 @@
     int32_t streamId;
 
     /**
-     * The graphics buffer handle to the buffer
+     * The graphics buffer handle to the buffer.
+     *
+     * For StreamBuffers sent to the HAL in a CaptureRequest, this must be a
+     * valid handle to a graphics buffer, with dimensions and format matching
+     * that of the stream.
+     *
+     * For StreamBuffers returned in a CaptureResult, this must be null, since
+     * the handle to the buffer is already known to the client (since the client
+     * sent it in the matching CaptureRequest), and the handle can be identified
+     * by the combination of frame number and stream ID.
      */
     handle buffer;
 
@@ -424,44 +433,34 @@
      * The acquire sync fence for this buffer. The HAL must wait on this fence
      * fd before attempting to read from or write to this buffer.
      *
-     * The framework may be set to -1 to indicate that no waiting is necessary
-     * for this buffer.
+     * In a buffer included in a CaptureRequest, the client may set this to null
+     * to indicate that no waiting is necessary for this buffer.
      *
-     * When the HAL returns an output buffer to the framework with
-     * processCaptureResult(), the acquireFence must be set to -1. If the HAL
-     * never waits on the acquireFence due to an error in filling a buffer,
-     * when calling processCaptureResult() the HAL must set the releaseFence
-     * of the buffer to be the acquireFence passed to it by the framework. This
-     * allows the framework to wait on the fence before reusing the buffer.
-     *
-     * For input buffers, the HAL must not change the acquireFence field during
-     * the processCaptureRequest() call.
-     *
-     * When the HAL returns an input buffer to the framework with
-     * processCaptureResult(), the acquireFence must be set to -1. If the HAL
-     * never waits on input buffer acquire fence due to an error, the sync
-     * fences must be handled similarly to the way they are handled for output
-     * buffers.
+     * When the HAL returns an input or output buffer to the framework with
+     * processCaptureResult(), the acquireFence must be set to null. If the HAL
+     * never waits on the acquireFence due to an error in filling or reading a
+     * buffer, when calling processCaptureResult() the HAL must set the
+     * releaseFence of the buffer to be the acquireFence passed to it by the
+     * client. This allows the client to wait on the fence before reusing the
+     * buffer.
      */
     handle acquireFence;
 
     /**
-     * The release sync fence for this buffer. The HAL must set this fence when
-     * returning buffers to the framework, or write -1 to indicate that no
-     * waiting is required for this buffer.
+     * The release sync fence for this buffer. The HAL must set this to a valid
+     * fence fd when returning the input buffer or output buffers to the client
+     * in a CaptureResult, or set it to null to indicate that no waiting is
+     * required for this buffer.
      *
-     * For the output buffers, the fences must be set in the outputBuffers
-     * array passed to processCaptureResult().
-     *
-     * For the input buffer, the fences must be set in the inputBuffer
-     * passed to processCaptureResult().
+     * The client must set this to be null for all buffers included in a
+     * processCaptureRequest call.
      *
      * After signaling the releaseFence for this buffer, the HAL
      * must not make any further attempts to access this buffer as the
-     * ownership has been fully transferred back to the framework.
+     * ownership has been fully transferred back to the client.
      *
-     * If a fence of -1 was specified then the ownership of this buffer
-     * is transferred back immediately upon the call of processCaptureResult.
+     * If this is null, then the ownership of this buffer is transferred back
+     * immediately upon the call of processCaptureResult.
      */
     handle releaseFence;
 
@@ -722,13 +721,13 @@
     /**
      * The input stream buffer to use for this request, if any.
      *
+     * An invalid inputBuffer is signified by a null inputBuffer::buffer, in
+     * which case the value of all other members of inputBuffer must be ignored.
+     *
      * If inputBuffer is invalid, then the request is for a new capture from the
      * imager. If inputBuffer is valid, the request is for reprocessing the
-     * image contained in inputBuffer.
-     *
-     * In the latter case, the HAL must set the releaseFence of the
-     * inputBuffer to a valid sync fence, or to -1 if the HAL does not support
-     * sync, before processCaptureRequest() returns.
+     * image contained in inputBuffer, and the HAL must release the inputBuffer
+     * back to the client in a subsequent processCaptureResult call.
      *
      * The HAL is required to wait on the acquire sync fence of the input buffer
      * before accessing it.
@@ -741,9 +740,8 @@
      * data from this capture/reprocess. The HAL must wait on the acquire fences
      * of each stream buffer before writing to them.
      *
-     * The HAL takes ownership of the actual buffer_handle_t entries in
-     * outputBuffers; the framework must not access them until they are
-     * returned in a CaptureResult.
+     * The HAL takes ownership of the handles in outputBuffers; the client
+     * must not access them until they are returned in a CaptureResult.
      *
      * Any or all of the buffers included here may be brand new in this
      * request (having never before seen by the HAL).
@@ -823,10 +821,15 @@
     CameraMetadata result;
 
     /**
-     * The handles for the output stream buffers for this capture. They may not
-     * yet be filled at the time the HAL calls processCaptureResult(); the
-     * framework must wait on the release sync fences provided by the HAL before
-     * reading the buffers.
+     * The completed output stream buffers for this capture.
+     *
+     * They may not yet be filled at the time the HAL calls
+     * processCaptureResult(); the framework must wait on the release sync
+     * fences provided by the HAL before reading the buffers.
+     *
+     * The StreamBuffer::buffer handle must be null for all returned buffers;
+     * the client must cache the handle and look it up via the combination of
+     * frame number and stream ID.
      *
      * The number of output buffers returned must be less than or equal to the
      * matching capture request's count. If this is less than the buffer count
@@ -836,7 +839,7 @@
      * valid result metadata or an input buffer is returned in this result.
      *
      * The HAL must set the stream buffer's release sync fence to a valid sync
-     * fd, or to -1 if the buffer has already been filled.
+     * fd, or to null if the buffer has already been filled.
      *
      * If the HAL encounters an error while processing the buffer, and the
      * buffer is not filled, the buffer's status field must be set to ERROR. If
@@ -844,7 +847,7 @@
      * the acquire fence must be copied into the release fence, to allow the
      * framework to wait on the fence before reusing the buffer.
      *
-     * The acquire fence must be set to -1 for all output buffers.
+     * The acquire fence must be set to null for all output buffers.
      *
      * This vector may be empty; if so, at least one other processCaptureResult
      * call must be made (or have been made) by the HAL to provide the filled
@@ -854,8 +857,8 @@
      * all previous frames' buffers for that corresponding stream must have been
      * already delivered (the fences need not have yet been signaled).
      *
-     * Gralloc buffers for a frame may be sent to framework before the
-     * corresponding SHUTTER-notify.
+     * Buffers for a frame may be sent to framework before the corresponding
+     * SHUTTER-notify call is made by the HAL.
      *
      * Performance considerations:
      *
@@ -867,10 +870,11 @@
     vec<StreamBuffer> outputBuffers;
 
     /**
-     * The handle for the input stream buffer for this capture. It may not
-     * yet be consumed at the time the HAL calls processCaptureResult(); the
-     * framework must wait on the release sync fence provided by the HAL before
-     * reusing the buffer.
+     * The handle for the input stream buffer for this capture, if any.
+     *
+     * It may not yet be consumed at the time the HAL calls
+     * processCaptureResult(); the framework must wait on the release sync fence
+     * provided by the HAL before reusing the buffer.
      *
      * The HAL must handle the sync fences the same way they are done for
      * outputBuffers.
diff --git a/drm/crypto/1.0/ICryptoFactory.hal b/drm/crypto/1.0/ICryptoFactory.hal
index 0ac7828..4b60ccc 100644
--- a/drm/crypto/1.0/ICryptoFactory.hal
+++ b/drm/crypto/1.0/ICryptoFactory.hal
@@ -40,8 +40,9 @@
      * @param uuid uniquely identifies the drm scheme. See
      * http://dashif.org/identifiers/protection for uuid assignments
      * @param initData scheme-specific init data.
-     * @return status the status of the call. If the plugin can't
-     * be created, the HAL implementation must return ERROR_DRM_CANNOT_HANDLE.
+     * @return status the status of the call. The HAL implementation must return
+     * OK if the plugin is created and ERROR_DRM_CANNOT_HANDLE if the plugin
+     * cannot be created.
      * @return cryptoPlugin the created ICryptoPlugin
      */
     createPlugin(uint8_t[16] uuid, vec<uint8_t> initData)
diff --git a/drm/crypto/1.0/ICryptoPlugin.hal b/drm/crypto/1.0/ICryptoPlugin.hal
index e86c9f2..e892e3c 100644
--- a/drm/crypto/1.0/ICryptoPlugin.hal
+++ b/drm/crypto/1.0/ICryptoPlugin.hal
@@ -74,8 +74,8 @@
      * call to operate on a range of subsamples in a single call
      * @param source the input buffer for the decryption
      * @param destination the output buffer for the decryption
-     * @return status the status of the call. The status must be one of
-     * the following: ERROR_DRM_NO_LICENSE if no license keys have been
+     * @return status the status of the call. The status must be OK or one of
+     * the following errors: ERROR_DRM_NO_LICENSE if no license keys have been
      * loaded, ERROR_DRM_LICENSE_EXPIRED if the license keys have expired,
      * ERROR_DRM_RESOURCE_BUSY if the resources required to perform the
      * decryption are not available, ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION
@@ -83,12 +83,9 @@
      * ERROR_DRM_SESSION_NOT_OPENED if the decrypt session is not opened, or
      * ERROR_DRM_CANNOT_HANDLE in other failure cases.
      * @return bytesWritten the number of bytes output from the decryption
-     * @return detailedError if the error is a vendor-specific error, the
-     * vendor's crypto HAL may provide a detailed error string to help
-     * describe the error.
      */
     decrypt(bool secure, uint8_t[16] keyId, uint8_t[16] iv, Mode mode,
         Pattern pattern, vec<SubSample> subSamples,
             memory source, DestinationBuffer destination)
-        generates(Status status, uint32_t bytesWritten, string detailedError);
+        generates(Status status, uint32_t bytesWritten);
 };
diff --git a/drm/crypto/1.0/default/CryptoFactory.cpp b/drm/crypto/1.0/default/CryptoFactory.cpp
index e67a990..187d564 100644
--- a/drm/crypto/1.0/default/CryptoFactory.cpp
+++ b/drm/crypto/1.0/default/CryptoFactory.cpp
@@ -27,7 +27,7 @@
 namespace implementation {
 
     CryptoFactory::CryptoFactory() :
-        loader("/vendor/lib/mediadrm", "createCryptoFactory", "crypto") {}
+        loader("/vendor/lib/mediadrm", "createCryptoFactory") {}
 
     // Methods from ::android::hardware::drm::crypto::V1_0::ICryptoFactory follow.
     Return<bool> CryptoFactory::isCryptoSchemeSupported(
diff --git a/drm/crypto/1.0/default/CryptoPlugin.cpp b/drm/crypto/1.0/default/CryptoPlugin.cpp
index 9173d5b..7921852 100644
--- a/drm/crypto/1.0/default/CryptoPlugin.cpp
+++ b/drm/crypto/1.0/default/CryptoPlugin.cpp
@@ -119,7 +119,7 @@
             bytesWritten = 0;
         }
 
-        _hidl_cb(toStatus(status), bytesWritten, detailMessage.c_str());
+        _hidl_cb(toStatus(status), bytesWritten);
         return Void();
     }
 
diff --git a/drm/crypto/1.0/default/TypeConvert.cpp b/drm/crypto/1.0/default/TypeConvert.cpp
index d9cca6b..ed95d15 100644
--- a/drm/crypto/1.0/default/TypeConvert.cpp
+++ b/drm/crypto/1.0/default/TypeConvert.cpp
@@ -26,6 +26,9 @@
 Status toStatus(status_t legacyStatus) {
     Status status;
     switch(legacyStatus) {
+    case android::OK:
+        status = Status::OK;
+        break;
     case android::ERROR_DRM_NO_LICENSE:
         status = Status::ERROR_DRM_NO_LICENSE;
         break;
diff --git a/drm/crypto/1.0/types.hal b/drm/crypto/1.0/types.hal
index 7e853b8..e71d73a 100644
--- a/drm/crypto/1.0/types.hal
+++ b/drm/crypto/1.0/types.hal
@@ -18,6 +18,12 @@
 
 enum Status : uint32_t {
     /**
+     * The Crypto plugin must return OK when an operation completes without any
+     * errors.
+     */
+    OK,
+
+    /**
      * The Crypto Plugin must return ERROR_DRM_NO_LICENSE if decryption is
      * attempted when the license keys have not been loaded into the crypto
      * session.
diff --git a/drm/drm/1.0/IDrmFactory.hal b/drm/drm/1.0/IDrmFactory.hal
index a58bcaa..1ef1d27 100644
--- a/drm/drm/1.0/IDrmFactory.hal
+++ b/drm/drm/1.0/IDrmFactory.hal
@@ -36,14 +36,23 @@
     isCryptoSchemeSupported(uint8_t[16] uuid) generates(bool isSupported);
 
     /**
+     * Determine if the HAL factory is able to construct plugins that support a
+     * given media container format specified by mimeType
+     *
+     * @param mimeType identifies the mime type in question
+     * @return isSupported must be true only if the scheme is supported
+     */
+    isContentTypeSupported(string mimeType) generates(bool isSupported);
+
+    /**
      * Create a drm plugin instance for the specified uuid and scheme-specific
      * initialization data.
      *
      * @param uuid uniquely identifies the drm scheme. See
      * http://dashif.org/identifiers/protection for uuid assignments
-     * @return status the status of the call. If the plugin can't be created,
-     * the HAL implementation must return ERROR_DRM_CANNOT_HANDLE.
-     * @return drmPlugin the created IDrmPlugin
+     * @return status the status of the call. The HAL implementation must return
+     * OK if the plugin is created and ERROR_DRM_CANNOT_HANDLE if the plugin
+     * cannot be created.
      */
     createPlugin(uint8_t[16] uuid) generates (Status status,
             IDrmPlugin drmPlugin);
diff --git a/drm/drm/1.0/IDrmPlugin.hal b/drm/drm/1.0/IDrmPlugin.hal
index e847805..881bf80 100644
--- a/drm/drm/1.0/IDrmPlugin.hal
+++ b/drm/drm/1.0/IDrmPlugin.hal
@@ -30,13 +30,13 @@
     /**
      * Open a new session with the DrmPlugin object. A session ID is returned
      * in the sessionId parameter.
-     * @return status the status of the call. The status must be one of
-     * ERROR_DRM_NOT_PROVISIONED if the device requires provisioning before
-     * it can open a session, ERROR_DRM_RESOURCE_BUSY if there are insufficent
-     * resources available to open a session, ERROR_DRM_CANNOT_HANDLE,
-     * if openSession is not supported at the time of the call or
-     * ERROR_DRM_INVALID_STATE if the HAL is in a state where a session cannot
-     * be opened.
+     * @return status the status of the call. The status must be OK or one of
+     * the following errors: ERROR_DRM_NOT_PROVISIONED if the device requires
+     * provisioning before it can open a session, ERROR_DRM_RESOURCE_BUSY if
+     * there are insufficent resources available to open a session,
+     * ERROR_DRM_CANNOT_HANDLE, if openSession is not supported at the time of
+     * the call or ERROR_DRM_INVALID_STATE if the HAL is in a state where a
+     * session cannot be opened.
      * @return sessionId the session ID for the newly opened session
      */
     openSession() generates (Status status, SessionId sessionId);
@@ -45,9 +45,9 @@
      * Close a session on the DrmPlugin object
      *
      * @param sessionId the session id the call applies to
-     * @return status the status of the call.  The status must be one of
-     * ERROR_DRM_SESSION_NOT_OPENED if the session is not opened,
-     * BAD_VALUE if the sessionId is invalid or ERROR_DRM_INVALID_STATE
+     * @return status the status of the call.  The status must be OK or one of
+     * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not
+     * opened, BAD_VALUE if the sessionId is invalid or ERROR_DRM_INVALID_STATE
      * if the HAL is in a state where the session cannot be closed.
      */
     closeSession(SessionId sessionId) generates (Status status);
@@ -75,13 +75,13 @@
      * allow a client application to provide additional message parameters to
      * the server.
      *
-     * @return status the status of the call.  The status must be one of
-     * ERROR_DRM_SESSION_NOT_OPENED if the session is not opened,
-     * ERROR_DRM_NOT_PROVISIONED if the device requires provisioning before
-     * it can generate a key request, ERROR_DRM_CANNOT_HANDLE if keyKeyRequest
-     * is not supported at the time of the call, BAD_VALUE if any parameters
-     * are invalid or ERROR_DRM_INVALID_STATE if the HAL is in a state where
-     * a key request cannot be generated.
+     * @return status the status of the call.  The status must be OK or one of
+     * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not
+     * opened, ERROR_DRM_NOT_PROVISIONED if the device requires provisioning
+     * before it can generate a key request, ERROR_DRM_CANNOT_HANDLE if
+     * getKeyRequest is not supported at the time of the call, BAD_VALUE if any
+     * parameters are invalid or ERROR_DRM_INVALID_STATE if the HAL is in a state
+     * where a key request cannot be generated.
      * @return request if successful, the opaque key request blob is returned
      * @return requestType indicates type information about the returned
      * request. The type may be one of INITIAL, RENEWAL or RELEASE. An
@@ -109,12 +109,12 @@
      * @param response the response from the key server that is being
      * provided to the drm HAL.
      *
-     * @return status the status of the call.  The status must be one of
-     * ERROR_DRM_SESSION_NOT_OPENED if the session is not opened,
-     * ERROR_DRM_NOT_PROVISIONED if the device requires provisioning before
-     * it can handle the key response, ERROR_DRM_DEVICE_REVOKED if the device
-     * has been disabled by the license policy, ERROR_DRM_CANNOT_HANDLE if
-     * provideKeyResponse is not supported at the time of the call, BAD_VALUE
+     * @return status the status of the call.  The status must be OK or one of
+     * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not
+     * opened, ERROR_DRM_NOT_PROVISIONED if the device requires provisioning
+     * before it can handle the key response, ERROR_DRM_DEVICE_REVOKED if the
+     * device has been disabled by the license policy, ERROR_DRM_CANNOT_HANDLE
+     * if provideKeyResponse is not supported at the time of the call, BAD_VALUE
      * if any parameters are invalid or ERROR_DRM_INVALID_STATE if the HAL is
      * in a state where a key response cannot be handled.
      * @return keySetId when the response is for an offline key request, a
@@ -130,9 +130,9 @@
      * Remove the current keys from a session
      *
      * @param sessionId the session id the call applies to
-     * @return status the status of the call.  The status must be one of
-     * ERROR_DRM_SESSION_NOT_OPENED if the session is not opened,
-     * BAD_VALUE if the sessionId is invalid or ERROR_DRM_INVALID_STATE
+     * @return status the status of the call.  The status must be OK or one of
+     * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not
+     * opened, BAD_VALUE if the sessionId is invalid or ERROR_DRM_INVALID_STATE
      * if the HAL is in a state where the keys cannot be removed.
      */
     removeKeys(SessionId sessionId) generates (Status status);
@@ -143,9 +143,9 @@
      * @param sessionId the session id the call applies to
      * @param keySetId identifies the keys to load, obtained from a prior
      * call to provideKeyResponse().
-     * @return status the status of the call. The status must be one of
-     * ERROR_DRM_SESSION_NOT_OPENED if the session is not opened,
-     * BAD_VALUE if any parameters are invalid or ERROR_DRM_INVALID_STATE
+     * @return status the status of the call. The status must be OK or one of
+     * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not
+     * opened, BAD_VALUE if any parameters are invalid or ERROR_DRM_INVALID_STATE
      * if the HAL is in a state where keys cannot be restored.
      */
     restoreKeys(SessionId sessionId,
@@ -159,9 +159,9 @@
      * the field names for a particular drm scheme.
      *
      * @param sessionId the session id the call applies to
-     * @return status the status of the call. The status must be one of
-     * ERROR_DRM_SESSION_NOT_OPENED if the session is not opened,
-     * BAD_VALUE if the sessionId is invalid or ERROR_DRM_INVALID_STATE
+     * @return status the status of the call. The status must be OK or one of
+     * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not
+     * opened, BAD_VALUE if the sessionId is invalid or ERROR_DRM_INVALID_STATE
      * if the HAL is in a state where key status cannot be queried.
      * @return infoList a list of name value pairs describing the license
      */
@@ -178,10 +178,10 @@
      * @param certificateAuthority identifies the certificate authority. A
      * certificate authority (CA) is an entity which issues digital certificates
      * for use by other parties. It is an example of a trusted third party.
-     * @return status the status of the call. The status must be one of
-     * BAD_VALUE if the sessionId is invalid or ERROR_DRM_INVALID_STATE
-     * if the HAL is in a state where the provision request cannot be
-     * generated.
+     * @return status the status of the call. The status must be OK or one of
+     * the following errors: BAD_VALUE if the sessionId is invalid or
+     * ERROR_DRM_INVALID_STATE if the HAL is in a state where the provision
+     * request cannot be generated.
      * @return request if successful the opaque certificate request blob
      * is returned
      * @return defaultUrl URL that the provisioning request should be
@@ -200,11 +200,11 @@
      * @param response the opaque provisioning response received by the
      * app from a provisioning server.
 
-     * @return status the status of the call. The status must be one of
-     * ERROR_DRM_DEVICE_REVOKED if the device has been disabled by the license
-     * policy, BAD_VALUE if any parameters are invalid or ERROR_DRM_INVALID_STATE
-     * if the HAL is in a state where the provision response cannot be
-     * handled.
+     * @return status the status of the call. The status must be OK or one of
+     * the following errors: ERROR_DRM_DEVICE_REVOKED if the device has been
+     * disabled by the license policy, BAD_VALUE if any parameters are invalid
+     * or ERROR_DRM_INVALID_STATE if the HAL is in a state where the provision
+     * response cannot be handled.
      * @return certificate the public certificate resulting from the provisioning
      * operation, if any. An empty vector indicates that no certificate was
      * returned.
@@ -237,7 +237,7 @@
     /**
      * Get all secure stops on the device
      *
-     * @return status the status of the call. The status must be
+     * @return status the status of the call. The status must be OK or
      * ERROR_DRM_INVALID_STATE if the HAL is in a state where the secure stops
      * cannot be returned.
      * @return secureStops a list of the secure stop opaque objects
@@ -252,9 +252,10 @@
      * secure stop ID is delivered by the key server as part of the key
      * response and must also be known by the app.
      *
-     * @return status the status of the call. The status must be one of
-     * BAD_VALUE if the secureStopId is invalid or ERROR_DRM_INVALID_STATE
-     * if the HAL is in a state where the secure stop cannot be returned.
+     * @return status the status of the call. The status must be OK or one of
+     * the following errors: BAD_VALUE if the secureStopId is invalid or
+     * ERROR_DRM_INVALID_STATE if the HAL is in a state where the secure stop
+     * cannot be returned.
      * @return secureStop the secure stop opaque object
      */
 
@@ -264,7 +265,7 @@
     /**
      * Release all secure stops on the device
      *
-     * @return status the status of the call. The status must be one of
+     * @return status the status of the call. The status must be OK or
      * ERROR_DRM_INVALID_STATE if the HAL is in a state where the secure
      * stops cannot be released.
      */
@@ -277,9 +278,10 @@
      * secure stop ID is delivered by the key server as part of the key
      * response and must also be known by the app.
      *
-     * @return status the status of the call. The status must be one of
-     * BAD_VALUE if the secureStopId is invalid or ERROR_DRM_INVALID_STATE
-     * if the HAL is in a state where the secure stop cannot be released.
+     * @return status the status of the call. The status must be OK or one of
+     * the following errors: BAD_VALUE if the secureStopId is invalid or
+     * ERROR_DRM_INVALID_STATE if the HAL is in a state where the secure stop
+     * cannot be released.
      */
     releaseSecureStop(vec<uint8_t> secureStopId) generates (Status status);
 
@@ -305,10 +307,11 @@
      * Read a string property value given the property name.
      *
      * @param propertyName the name of the property
-     * @return status the status of the call. The status must be one of
-     * BAD_VALUE if the property name is invalid, ERROR_DRM_CANNOT_HANDLE
-     * if the property is not supported, or ERROR_DRM_INVALID_STATE if the
-     * HAL is in a state where the property cannot be obtained.
+     * @return status the status of the call. The status must be OK or one of
+     * the following errors: BAD_VALUE if the property name is invalid,
+     * ERROR_DRM_CANNOT_HANDLE if the property is not supported, or
+     * ERROR_DRM_INVALID_STATE if the HAL is in a state where the property
+     * cannot be obtained.
      * @return value the property value string
      */
     getPropertyString(string propertyName)
@@ -318,10 +321,11 @@
      * Read a byte array property value given the property name.
      *
      * @param propertyName the name of the property
-     * @return status the status of the call. The status must be one of
-     * BAD_VALUE if the property name is invalid, ERROR_DRM_CANNOT_HANDLE
-     * if the property is not supported, or ERROR_DRM_INVALID_STATE if the
-     * HAL is in a state where the property cannot be obtained.
+     * @return status the status of the call. The status must be OK or one of
+     * the following errors: BAD_VALUE if the property name is invalid,
+     * ERROR_DRM_CANNOT_HANDLE if the property is not supported, or
+     * ERROR_DRM_INVALID_STATE if the HAL is in a state where the property
+     * cannot be obtained.
      * @return value the property value byte array
      */
     getPropertyByteArray(string propertyName)
@@ -332,10 +336,11 @@
      *
      * @param propertyName the name of the property
      * @param value the value to write
-     * @return status the status of the call. The status must be one of
-     * BAD_VALUE if the property name is invalid, ERROR_DRM_CANNOT_HANDLE
-     * if the property is not supported, or ERROR_DRM_INVALID_STATE if the
-     * HAL is in a state where the property cannot be set.
+     * @return status the status of the call. The status must be OK or one of
+     * the following errors: BAD_VALUE if the property name is invalid,
+     * ERROR_DRM_CANNOT_HANDLE if the property is not supported, or
+     * ERROR_DRM_INVALID_STATE if the HAL is in a state where the property
+     * cannot be set.
      */
     setPropertyString(string propertyName, string value)
         generates (Status status);
@@ -345,10 +350,11 @@
      *
      * @param propertyName the name of the property
      * @param value the value to write
-     * @return status the status of the call. The status must be one of
-     * BAD_VALUE if the property name is invalid, ERROR_DRM_CANNOT_HANDLE
-     * if the property is not supported, or ERROR_DRM_INVALID_STATE if the
-     * HAL is in a state where the property cannot be set.
+     * @return status the status of the call. The status must be OK or one of
+     * the following errors: BAD_VALUE if the property name is invalid,
+     * ERROR_DRM_CANNOT_HANDLE if the property is not supported, or
+     * ERROR_DRM_INVALID_STATE if the HAL is in a state where the property
+     * cannot be set.
      */
     setPropertyByteArray(string propertyName, vec<uint8_t> value )
         generates (Status status);
@@ -366,9 +372,9 @@
      * @param algorithm the algorithm to use. The string conforms to JCA
      * Standard Names for Cipher Transforms and is case insensitive. An
      * example algorithm is "AES/CBC/PKCS5Padding".
-     * @return status the status of the call. The status must be one of
-     * ERROR_DRM_SESSION_NOT_OPENED if the session is not opened,
-     * BAD_VALUE if any parameters are invalid or ERROR_DRM_INVALID_STATE
+     * @return status the status of the call. The status must be OK or one of
+     * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not
+     * opened, BAD_VALUE if any parameters are invalid or ERROR_DRM_INVALID_STATE
      * if the HAL is in a state where the algorithm cannot be set.
      */
     setCipherAlgorithm(SessionId sessionId, string algorithm)
@@ -381,9 +387,9 @@
      * @param algorithm the algorithm to use. The string conforms to JCA
      * Standard Names for Mac Algorithms and is case insensitive. An example MAC
      * algorithm string is "HmacSHA256".
-     * @return status the status of the call. The status must be one of
-     * ERROR_DRM_SESSION_NOT_OPENED if the session is not opened,
-     * BAD_VALUE if any parameters are invalid or ERROR_DRM_INVALID_STATE
+     * @return status the status of the call. The status must be OK or one of the
+     * following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not
+     * opened, BAD_VALUE if any parameters are invalid or ERROR_DRM_INVALID_STATE
      * if the HAL is in a state where the algorithm cannot be set.
      */
     setMacAlgorithm(SessionId sessionId, string algorithm)
@@ -398,11 +404,10 @@
      * @param keyId the ID of the key to use for encryption
      * @param input the input data to encrypt
      * @param iv the initialization vector to use for encryption
-     * @return status the status of the call. The status must be one of
-     * ERROR_DRM_SESSION_NOT_OPENED if the session is not opened,
+     * @return status the status of the call. The status must be OK or one of the
+     * following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not opened,
      * BAD_VALUE if any parameters are invalid or ERROR_DRM_INVALID_STATE
-     * if the HAL is in a state where the encrypt operation cannot be
-     * performed.
+     * if the HAL is in a state where the encrypt operation cannot be performed.
      * @return output the decrypted data
      */
     encrypt(SessionId sessionId, vec<uint8_t> keyId, vec<uint8_t> input,
@@ -417,9 +422,9 @@
      * @param keyId the ID of the key to use for decryption
      * @param input the input data to decrypt
      * @param iv the initialization vector to use for decryption
-     * @return status the status of the call. The status must be one of
-     * ERROR_DRM_SESSION_NOT_OPENED if the session is not opened,
-     * BAD_VALUE if any parameters are invalid or ERROR_DRM_INVALID_STATE
+     * @return status the status of the call. The status must be OK or one of
+     * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not
+     * opened, BAD_VALUE if any parameters are invalid or ERROR_DRM_INVALID_STATE
      * if the HAL is in a state where the decrypt operation cannot be
      * performed.
      * @return output the decrypted data
@@ -435,9 +440,9 @@
      * @param sessionId the session id the call applies to
      * @param keyId the ID of the key to use for decryption
      * @param message the message to compute a signature over
-     * @return status the status of the call. The status must be one of
-     * ERROR_DRM_SESSION_NOT_OPENED if the session is not opened,
-     * BAD_VALUE if any parameters are invalid or ERROR_DRM_INVALID_STATE
+     * @return status the status of the call. The status must be OK or one of
+     * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not
+     * opened, BAD_VALUE if any parameters are invalid or ERROR_DRM_INVALID_STATE
      * if the HAL is in a state where the sign operation cannot be
      * performed.
      * @return signature the computed signature
@@ -454,9 +459,9 @@
      * @param keyId the ID of the key to use for decryption
      * @param message the message to compute a hash of
      * @param signature the signature to verify
-     * @return status the status of the call. The status must be one of
-     * ERROR_DRM_SESSION_NOT_OPENED if the session is not opened,
-     * BAD_VALUE if any parameters are invalid or ERROR_DRM_INVALID_STATE
+     * @return status the status of the call. The status must be OK or one of
+     * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not
+     * opened, BAD_VALUE if any parameters are invalid or ERROR_DRM_INVALID_STATE
      * if the HAL is in a state where the verify operation cannot be
      * performed.
      * @return match true if the signature is verified positively,
@@ -475,11 +480,11 @@
      * @param message the message to compute the signature on
      * @param wrappedKey the private key returned during provisioning as
      * returned by provideProvisionResponse.
-     * @return status the status of the call. The status must be one of
-     * ERROR_DRM_SESSION_NOT_OPENED if the session is not opened,
-     * BAD_VALUE if any parameters are invalid or ERROR_DRM_INVALID_STATE
-     * if the HAL is in a state where the signRSA operation cannot be
-     * performed.
+     * @return status the status of the call. The status must be OK or one of
+     * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is
+     * not opened, BAD_VALUE if any parameters are invalid or
+     * ERROR_DRM_INVALID_STATE if the HAL is in a state where the signRSA
+     * operation cannot be performed.
      * @return signature the RSA signature computed over the message
      */
     signRSA(SessionId sessionId, string algorithm, vec<uint8_t> message,
diff --git a/drm/drm/1.0/default/DrmFactory.cpp b/drm/drm/1.0/default/DrmFactory.cpp
index 494ca53..f2d4a5a 100644
--- a/drm/drm/1.0/default/DrmFactory.cpp
+++ b/drm/drm/1.0/default/DrmFactory.cpp
@@ -27,7 +27,7 @@
 namespace implementation {
 
     DrmFactory::DrmFactory() :
-        loader("/vendor/lib/mediadrm", "createDrmFactory", "drm") {}
+        loader("/vendor/lib/mediadrm", "createDrmFactory") {}
 
     // Methods from ::android::hardware::drm::drm::V1_0::IDrmFactory follow.
     Return<bool> DrmFactory::isCryptoSchemeSupported (
@@ -40,6 +40,16 @@
         return false;
     }
 
+    Return<bool> DrmFactory::isContentTypeSupported (
+            const hidl_string& mimeType) {
+        for (size_t i = 0; i < loader.factoryCount(); i++) {
+            if (loader.getFactory(i)->isContentTypeSupported(String8(mimeType.c_str()))) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     Return<void> DrmFactory::createPlugin(const hidl_array<uint8_t, 16>& uuid,
             createPlugin_cb _hidl_cb) {
 
diff --git a/drm/drm/1.0/default/DrmFactory.h b/drm/drm/1.0/default/DrmFactory.h
index 4dd9ac0..2b88d00 100644
--- a/drm/drm/1.0/default/DrmFactory.h
+++ b/drm/drm/1.0/default/DrmFactory.h
@@ -47,6 +47,9 @@
     Return<bool> isCryptoSchemeSupported(const hidl_array<uint8_t, 16>& uuid)
             override;
 
+    Return<bool> isContentTypeSupported(const hidl_string &mimeType)
+            override;
+
     Return<void> createPlugin(const hidl_array<uint8_t, 16>& uuid,
             createPlugin_cb _hidl_cb) override;
 
diff --git a/drm/drm/1.0/default/TypeConvert.cpp b/drm/drm/1.0/default/TypeConvert.cpp
index 2b4e2a2..4bed284 100644
--- a/drm/drm/1.0/default/TypeConvert.cpp
+++ b/drm/drm/1.0/default/TypeConvert.cpp
@@ -26,6 +26,9 @@
 Status toStatus(status_t legacyStatus) {
     Status status;
     switch(legacyStatus) {
+    case android::OK:
+        status = Status::OK;
+        break;
     case android::ERROR_DRM_NO_LICENSE:
         status = Status::ERROR_DRM_NO_LICENSE;
         break;
diff --git a/drm/drm/1.0/types.hal b/drm/drm/1.0/types.hal
index 3d77911..e099418 100644
--- a/drm/drm/1.0/types.hal
+++ b/drm/drm/1.0/types.hal
@@ -18,6 +18,12 @@
 
 enum Status : uint32_t {
     /**
+     * The DRM plugin must return OK when an operation completes without any
+     * errors.
+     */
+    OK,
+
+    /**
      * The DRM plugin must return ERROR_DRM_NO_LICENSE, when decryption is
      * attempted and no license keys have been provided.
      */
diff --git a/evs/1.0/default/service.cpp b/evs/1.0/default/service.cpp
index 6ab2975..112c879 100644
--- a/evs/1.0/default/service.cpp
+++ b/evs/1.0/default/service.cpp
@@ -18,8 +18,7 @@
 
 #include <unistd.h>
 
-#include <hwbinder/IPCThreadState.h>
-#include <hwbinder/ProcessState.h>
+#include <hidl/HidlTransportSupport.h>
 #include <utils/Errors.h>
 #include <utils/StrongPointer.h>
 #include <utils/Log.h>
@@ -29,9 +28,9 @@
 #include "EvsDisplay.h"
 
 
-// libhwbinder:
-using android::hardware::IPCThreadState;
-using android::hardware::ProcessState;
+// libhidl:
+using android::hardware::configureRpcThreadpool;
+using android::hardware::joinRpcThreadpool;
 
 // Generated HIDL files
 using android::hardware::evs::V1_0::IEvsEnumerator;
@@ -46,25 +45,14 @@
     ALOGI("EVS Hardware Enumerator service is starting");
     android::sp<IEvsEnumerator> service = new EvsEnumerator();
 
+    configureRpcThreadpool(1, true /* callerWillJoin */);
+
     // Register our service -- if somebody is already registered by our name,
     // they will be killed (their thread pool will throw an exception).
     status_t status = service->registerAsService(kEnumeratorServiceName);
     if (status == OK) {
         ALOGD("%s is ready.", kEnumeratorServiceName);
-
-        // Set thread pool size to ensure the API is not called in parallel.
-        // By setting the size to zero, the main thread will be the only one
-        // serving requests once we "joinThreadPool".
-        ProcessState::self()->setThreadPoolMaxThreadCount(0);
-
-        // Note:  We don't start the thread pool because it'll add at least one (default)
-        //        thread to it, which we don't want.  See b/31226656
-        // ProcessState::self()->startThreadPool();
-
-        // Send this main thread to become a permanent part of the thread pool.
-        // This bumps up the thread count by 1 (from zero in this case).
-        // This is not expected to return.
-        IPCThreadState::self()->joinThreadPool();
+        joinRpcThreadpool();
     } else {
         ALOGE("Could not register service %s (%d).", kEnumeratorServiceName, status);
     }
diff --git a/example/extension/light/2.0/default/service.cpp b/example/extension/light/2.0/default/service.cpp
index 3eb7bdf..d3fb4de 100644
--- a/example/extension/light/2.0/default/service.cpp
+++ b/example/extension/light/2.0/default/service.cpp
@@ -16,15 +16,14 @@
 #define LOG_TAG "android.hardware.light@2.0-service"
 
 #include <android/log.h>
+#include <hidl/HidlTransportSupport.h>
 
 #include "Light.h"
 
+using android::hardware::configureRpcThreadpool;
+using android::hardware::joinRpcThreadpool;
 using android::sp;
 
-// libhwbinder:
-using android::hardware::IPCThreadState;
-using android::hardware::ProcessState;
-
 // Generated HIDL files
 using android::hardware::light::V2_0::ILight;
 
@@ -32,10 +31,7 @@
     const char instance[] = "light";
 
     android::sp<ILight> service = new Light();
-
+    configureRpcThreadpool(1, true /*callerWillJoin*/);
     service->registerAsService(instance);
-
-    ProcessState::self()->setThreadPoolMaxThreadCount(0);
-    ProcessState::self()->startThreadPool();
-    IPCThreadState::self()->joinThreadPool();
+    joinRpcThreadpool();
 }
diff --git a/gnss/1.0/default/Android.mk b/gnss/1.0/default/Android.mk
index 06ef331..6289491 100644
--- a/gnss/1.0/default/Android.mk
+++ b/gnss/1.0/default/Android.mk
@@ -27,3 +27,27 @@
     libhardware
 
 include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_MODULE := android.hardware.gnss@1.0-service
+LOCAL_INIT_RC := android.hardware.gnss@1.0-service.rc
+LOCAL_SRC_FILES := \
+    service.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+    liblog \
+    libcutils \
+    libdl \
+    libbase \
+    libutils \
+    libhardware_legacy \
+    libhardware \
+
+LOCAL_SHARED_LIBRARIES += \
+    libhwbinder \
+    libhidlbase \
+    libhidltransport \
+    android.hardware.gnss@1.0 \
+
+include $(BUILD_EXECUTABLE)
diff --git a/gnss/1.0/default/android.hardware.gnss@1.0-service.rc b/gnss/1.0/default/android.hardware.gnss@1.0-service.rc
new file mode 100644
index 0000000..eeb2e43
--- /dev/null
+++ b/gnss/1.0/default/android.hardware.gnss@1.0-service.rc
@@ -0,0 +1,4 @@
+service gnss_service /system/bin/hw/android.hardware.gnss@1.0-service
+    class main
+    user system
+    group system
diff --git a/gnss/1.0/default/service.cpp b/gnss/1.0/default/service.cpp
new file mode 100644
index 0000000..4e040c5
--- /dev/null
+++ b/gnss/1.0/default/service.cpp
@@ -0,0 +1,12 @@
+#define LOG_TAG "android.hardware.gnss@1.0-service"
+
+#include <android/hardware/gnss/1.0/IGnss.h>
+
+#include <hidl/LegacySupport.h>
+
+using android::hardware::gnss::V1_0::IGnss;
+using android::hardware::defaultPassthroughServiceImplementation;
+
+int main() {
+    return defaultPassthroughServiceImplementation<IGnss>("gnss");
+}
diff --git a/graphics/composer/2.1/IComposerClient.hal b/graphics/composer/2.1/IComposerClient.hal
index 1a82215..b0bd837 100644
--- a/graphics/composer/2.1/IComposerClient.hal
+++ b/graphics/composer/2.1/IComposerClient.hal
@@ -554,7 +554,7 @@
      * @return error is NONE upon success. Otherwise,
      *         NO_RESOURCES when failed to set the queue temporarily.
      */
-    setInputCommandQueue(MQDescriptorSync descriptor)
+    setInputCommandQueue(fmq_sync<uint32_t> descriptor)
               generates (Error error);
 
     /*
@@ -568,7 +568,7 @@
      */
     getOutputCommandQueue()
               generates (Error error,
-                         MQDescriptorSync descriptor);
+                         fmq_sync<uint32_t> descriptor);
 
     /*
      * Executes commands from the input command message queue. Return values
diff --git a/graphics/composer/2.1/default/HwcClient.cpp b/graphics/composer/2.1/default/HwcClient.cpp
index ce6c480..8c2dd6d 100644
--- a/graphics/composer/2.1/default/HwcClient.cpp
+++ b/graphics/composer/2.1/default/HwcClient.cpp
@@ -497,7 +497,7 @@
 }
 
 Return<Error> HwcClient::setInputCommandQueue(
-        const MQDescriptorSync& descriptor)
+        const MQDescriptorSync<uint32_t>& descriptor)
 {
     std::lock_guard<std::mutex> lock(mCommandMutex);
     return mReader.setMQDescriptor(descriptor) ?
@@ -514,7 +514,7 @@
     if (outDescriptor) {
         hidl_cb(Error::NONE, *outDescriptor);
     } else {
-        hidl_cb(Error::NO_RESOURCES, MQDescriptorSync(0, nullptr, 0));
+        hidl_cb(Error::NO_RESOURCES, MQDescriptorSync<uint32_t>());
     }
 
     return Void();
diff --git a/graphics/composer/2.1/default/HwcClient.h b/graphics/composer/2.1/default/HwcClient.h
index a9bc4cd..c719774 100644
--- a/graphics/composer/2.1/default/HwcClient.h
+++ b/graphics/composer/2.1/default/HwcClient.h
@@ -97,7 +97,7 @@
     Return<Error> setClientTargetSlotCount(Display display,
             uint32_t clientTargetSlotCount) override;
     Return<Error> setInputCommandQueue(
-            const MQDescriptorSync& descriptor) override;
+            const MQDescriptorSync<uint32_t>& descriptor) override;
     Return<void> getOutputCommandQueue(
             getOutputCommandQueue_cb hidl_cb) override;
     Return<void> executeCommands(uint32_t inLength,
diff --git a/graphics/composer/2.1/default/IComposerCommandBuffer.h b/graphics/composer/2.1/default/IComposerCommandBuffer.h
index 8f133fe..7e14f19 100644
--- a/graphics/composer/2.1/default/IComposerCommandBuffer.h
+++ b/graphics/composer/2.1/default/IComposerCommandBuffer.h
@@ -120,7 +120,7 @@
         return true;
     }
 
-    const MQDescriptorSync* getMQDescriptor() const
+    const MQDescriptorSync<uint32_t>* getMQDescriptor() const
     {
         return (mQueue) ? mQueue->getDesc() : nullptr;
     }
@@ -626,7 +626,7 @@
         reset();
     }
 
-    bool setMQDescriptor(const MQDescriptorSync& descriptor)
+    bool setMQDescriptor(const MQDescriptorSync<uint32_t>& descriptor)
     {
         mQueue = std::make_unique<CommandQueueType>(descriptor, false);
         if (mQueue->isValid()) {
diff --git a/graphics/composer/2.1/default/service.cpp b/graphics/composer/2.1/default/service.cpp
index 0384a53..c2a2b19 100644
--- a/graphics/composer/2.1/default/service.cpp
+++ b/graphics/composer/2.1/default/service.cpp
@@ -17,14 +17,13 @@
 #define LOG_TAG "HWComposerService"
 
 #include <binder/ProcessState.h>
-#include <hwbinder/IPCThreadState.h>
-#include <hwbinder/ProcessState.h>
+#include <hidl/HidlTransportSupport.h>
 #include <utils/StrongPointer.h>
 #include "Hwc.h"
 
+using android::hardware::configureRpcThreadpool;
+using android::hardware::joinRpcThreadpool;
 using android::sp;
-using android::hardware::IPCThreadState;
-using android::hardware::ProcessState;
 using android::hardware::graphics::composer::V2_1::IComposer;
 using android::hardware::graphics::composer::V2_1::implementation::HIDL_FETCH_IComposer;
 
@@ -34,6 +33,7 @@
 
     ALOGI("Service is starting.");
 
+    configureRpcThreadpool(1, true /* callerWillJoin */);
     sp<IComposer> service = HIDL_FETCH_IComposer(instance);
     if (service == nullptr) {
         ALOGI("getService returned NULL");
@@ -48,9 +48,7 @@
     android::ProcessState::self()->setThreadPoolMaxThreadCount(4);
     android::ProcessState::self()->startThreadPool();
 
-    ProcessState::self()->setThreadPoolMaxThreadCount(0);
-    ProcessState::self()->startThreadPool();
-    IPCThreadState::self()->joinThreadPool();
+    joinRpcThreadpool();
 
     return 0;
 }
diff --git a/keymaster/3.0/default/service.cpp b/keymaster/3.0/default/service.cpp
index 038bf31..dd8c0b2 100644
--- a/keymaster/3.0/default/service.cpp
+++ b/keymaster/3.0/default/service.cpp
@@ -19,15 +19,17 @@
 
 #include <android/hardware/keymaster/3.0/IKeymasterDevice.h>
 
+#include <hidl/HidlTransportSupport.h>
 #include <hidl/LegacySupport.h>
 
-using android::sp;
+using android::hardware::configureRpcThreadpool;
+using android::hardware::joinRpcThreadpool;
 
 using android::hardware::keymaster::V3_0::IKeymasterDevice;
 using android::hardware::registerPassthroughServiceImplementation;
-using android::hardware::launchRpcServer;
 
 int main() {
+    configureRpcThreadpool(1, true /*callerWillJoin*/);
     registerPassthroughServiceImplementation<IKeymasterDevice>("keymaster");
-    return launchRpcServer(1);
+    joinRpcThreadpool();
 }
diff --git a/nfc/1.0/vts/functional/nfc_hidl_hal_test.cpp b/nfc/1.0/vts/functional/nfc_hidl_hal_test.cpp
index 3e40a9c..f5ed4d7 100644
--- a/nfc/1.0/vts/functional/nfc_hidl_hal_test.cpp
+++ b/nfc/1.0/vts/functional/nfc_hidl_hal_test.cpp
@@ -21,14 +21,12 @@
 #include <android/hardware/nfc/1.0/INfcClientCallback.h>
 #include <android/hardware/nfc/1.0/types.h>
 #include <hardware/nfc.h>
-#include <hwbinder/ProcessState.h>
 
 #include <gtest/gtest.h>
 #include <chrono>
 #include <condition_variable>
 #include <mutex>
 
-using ::android::hardware::ProcessState;
 using ::android::hardware::nfc::V1_0::INfc;
 using ::android::hardware::nfc::V1_0::INfcClientCallback;
 using ::android::hardware::nfc::V1_0::NfcEvent;
@@ -66,12 +64,6 @@
     nfc_ = INfc::getService(NFC_NCI_SERVICE_NAME, passthrough);
     ASSERT_NE(nfc_, nullptr);
 
-    // TODO:b/31748996
-    if (nfc_->isRemote()) {
-      ProcessState::self()->setThreadPoolMaxThreadCount(1);
-      ProcessState::self()->startThreadPool();
-    }
-
     nfc_cb_ = new NfcClientCallback(*this);
     ASSERT_NE(nfc_cb_, nullptr);
 
diff --git a/radio/1.0/IRadioIndication.hal b/radio/1.0/IRadioIndication.hal
index 4dbae17..79ebf30 100644
--- a/radio/1.0/IRadioIndication.hal
+++ b/radio/1.0/IRadioIndication.hal
@@ -81,8 +81,9 @@
      * Indicates when new SMS has been stored on SIM card
      *
      * @param type Type of radio indication
+     * @param recordNumber Record number on the sim
      */
-    oneway newSmsOnSim(RadioIndicationType type);
+    oneway newSmsOnSim(RadioIndicationType type, int32_t recordNumber);
 
     /*
      * Indicates when a new USSD message is received.
@@ -91,8 +92,9 @@
      *
      * @param type Type of radio indication
      * @param modeType USSD type code
+     * @param msg Message string in UTF-8, if applicable
      */
-    oneway onUssd(RadioIndicationType type, UssdModeType modeType);
+    oneway onUssd(RadioIndicationType type, UssdModeType modeType, string msg);
 
     /*
      * Indicates when radio has received a NITZ time message.
@@ -146,7 +148,7 @@
      * @param cmd SAT/USAT proactive represented as byte array starting with command tag.
      *        Refer ETSI TS 102.223 section 9.4 for command types
      */
-    oneway stkProactiveCommand(RadioIndicationType type, vec<uint8_t> cmd);
+    oneway stkProactiveCommand(RadioIndicationType type, string cmd);
 
     /*
      * Indicates when SIM notifies applcations some event happens.
@@ -157,7 +159,7 @@
      *        starting with first byte of response data for command tag. Refer
      *        ETSI TS 102.223 section 9.4 for command types
      */
-    oneway stkEventNotify(RadioIndicationType type, vec<uint8_t> cmd);
+    oneway stkEventNotify(RadioIndicationType type, string cmd);
 
     /*
      * Indicates when SIM wants application to setup a voice call.
diff --git a/radio/1.0/types.hal b/radio/1.0/types.hal
index 926ee84..6475b4f 100644
--- a/radio/1.0/types.hal
+++ b/radio/1.0/types.hal
@@ -51,7 +51,6 @@
 };
 
 enum RadioError : int32_t {
-    INVALID_RESPONSE = -1,                // Response from vendor had invalid data
     NONE = 0,                             // Success
     RADIO_NOT_AVAILABLE = 1,              // If radio did not start or is resetting
     GENERIC_FAILURE = 2,
@@ -115,7 +114,8 @@
     NO_NETWORK_FOUND = 63,                // Network cannot be found
     DEVICE_IN_USE = 64,                   // Operation cannot be performed because the device
                                           // is currently in use
-    RIL_E_ABORTED = 65,                   // Operation aborted
+    ABORTED = 65,                         // Operation aborted
+    INVALID_RESPONSE = 66,                // Response from vendor had invalid data
 
     // TODO(May be moved to vendor HAL extension)
     // OEM specific error codes. To be used by OEM when they don't want to reveal
@@ -1789,9 +1789,7 @@
     bool isMT;                             // notification type
                                            // false = MO intermediate result code
                                            // true = MT unsolicited result code
-    bool isCode1;                          // See 27.007 7.17
-                                           // true = "code1" for MO
-                                           // false = "code2" for MT
+    int32_t code;                          // result code. See 27.007 7.17.
     int32_t index;                         // CUG index. See 27.007 7.17.
     int32_t type;                          // "type" from 27.007 7.17 (MT only).
     string number;                         // "number" from 27.007 7.17
diff --git a/tests/msgq/1.0/ITestMsgQ.hal b/tests/msgq/1.0/ITestMsgQ.hal
index b23f48f..933e39b 100644
--- a/tests/msgq/1.0/ITestMsgQ.hal
+++ b/tests/msgq/1.0/ITestMsgQ.hal
@@ -31,7 +31,7 @@
      * set up by the service. Client can use it to set up the FMQ at its end.
      */
     configureFmqSyncReadWrite()
-        generates(bool ret, MQDescriptorSync mqDesc);
+        generates(bool ret, fmq_sync<uint16_t> mqDesc);
 
     /*
      * This method requests the service to set up an unsynchronized write
@@ -42,7 +42,7 @@
      * set up by the service. Client can use it to set up the FMQ at its end.
      */
     configureFmqUnsyncWrite()
-        generates(bool ret, MQDescriptorUnsync mqDesc);
+        generates(bool ret, fmq_unsync<uint16_t> mqDesc);
 
     /*
      * This method request the service to write into the synchronized read/write
diff --git a/tv/input/1.0/Android.bp b/tv/input/1.0/Android.bp
index 21d8893..94dcdc9 100644
--- a/tv/input/1.0/Android.bp
+++ b/tv/input/1.0/Android.bp
@@ -64,3 +64,67 @@
         "android.hidl.base@1.0",
     ],
 }
+
+genrule {
+    name: "android.hardware.tv.input.vts.driver@1.0_genc++",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tv.input@1.0 && $(location vtsc) -mDRIVER -tSOURCE -b$(genDir) android/hardware/tv/input/1.0/ $(genDir)/android/hardware/tv/input/1.0/",
+    srcs: [
+        "types.hal",
+        "ITvInput.hal",
+        "ITvInputCallback.hal",
+    ],
+    out: [
+        "android/hardware/tv/input/1.0/types.vts.cpp",
+        "android/hardware/tv/input/1.0/TvInput.vts.cpp",
+        "android/hardware/tv/input/1.0/TvInputCallback.vts.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.tv.input.vts.driver@1.0_genc++_headers",
+    tools: ["hidl-gen", "vtsc"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lvts -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tv.input@1.0 && $(location vtsc) -mDRIVER -tHEADER -b$(genDir) android/hardware/tv/input/1.0/ $(genDir)/android/hardware/tv/input/1.0/",
+    srcs: [
+        "types.hal",
+        "ITvInput.hal",
+        "ITvInputCallback.hal",
+    ],
+    out: [
+        "android/hardware/tv/input/1.0/types.vts.h",
+        "android/hardware/tv/input/1.0/TvInput.vts.h",
+        "android/hardware/tv/input/1.0/TvInputCallback.vts.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.tv.input.vts.driver@1.0",
+    generated_sources: ["android.hardware.tv.input.vts.driver@1.0_genc++"],
+    generated_headers: ["android.hardware.tv.input.vts.driver@1.0_genc++_headers"],
+    export_generated_headers: ["android.hardware.tv.input.vts.driver@1.0_genc++_headers"],
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+        "libcutils",
+        "libvts_common",
+        "libvts_datatype",
+        "libvts_measurement",
+        "libvts_multidevice_proto",
+        "libcamera_metadata",
+        "libprotobuf-cpp-full",
+        "android.hardware.audio.common@2.0",
+        "android.hidl.base@1.0",
+        "android.hardware.tv.input@1.0",
+    ],
+    export_shared_lib_headers: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libutils",
+        "android.hardware.audio.common@2.0",
+        "android.hidl.base@1.0",
+    ],
+}
diff --git a/tv/input/1.0/Android.mk b/tv/input/1.0/Android.mk
new file mode 100644
index 0000000..f9e3276
--- /dev/null
+++ b/tv/input/1.0/Android.mk
@@ -0,0 +1,19 @@
+#
+# 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 $(call all-subdir-makefiles)
diff --git a/tv/input/1.0/vts/Android.mk b/tv/input/1.0/vts/Android.mk
index 5a60edc..040cfce 100644
--- a/tv/input/1.0/vts/Android.mk
+++ b/tv/input/1.0/vts/Android.mk
@@ -16,74 +16,4 @@
 
 LOCAL_PATH := $(call my-dir)
 
-# build VTS profiler for TvInput
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libvts_profiler_hidl_tv_input@1.0
-
-LOCAL_SRC_FILES := \
-  TvInput.vts \
-  types.vts \
-  ../../../../audio/common/2.0/vts/types.vts \
-
-LOCAL_C_INCLUDES += \
-  test/vts/drivers/libprofiling \
-
-LOCAL_VTS_MODE := PROFILER
-
-LOCAL_SHARED_LIBRARIES += \
-  android.hardware.tv.input@1.0 \
-  libbase \
-  libcutils \
-  liblog \
-  libhidlbase \
-  libhidltransport \
-  libhwbinder \
-  libprotobuf-cpp-full \
-  libvts_common \
-  libvts_multidevice_proto \
-  libvts_profiling \
-  libutils \
-
-LOCAL_PROTOC_OPTIMIZE_TYPE := full
-
-LOCAL_MULTILIB := both
-
-include $(BUILD_SHARED_LIBRARY)
-
-
-# build VTS profiler for TvInputCallback
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libvts_profiler_hidl_tv_input_callback_@1.0
-
-LOCAL_SRC_FILES := \
-  TvInputCallback.vts \
-  types.vts \
-  ../../../../audio/common/2.0/vts/types.vts \
-
-LOCAL_C_INCLUDES += \
-  test/vts/drivers/libprofiling \
-
-LOCAL_VTS_MODE := PROFILER
-
-LOCAL_SHARED_LIBRARIES += \
-  android.hardware.tv.input@1.0 \
-  libbase \
-  libcutils \
-  liblog \
-  libhidlbase \
-  libhidltransport \
-  libhwbinder \
-  libprotobuf-cpp-full \
-  libvts_common \
-  libvts_multidevice_proto \
-  libvts_profiling \
-  libutils \
-
-LOCAL_PROTOC_OPTIMIZE_TYPE := full
-
-LOCAL_MULTILIB := both
-
-include $(BUILD_SHARED_LIBRARY)
-
+include $(LOCAL_PATH)/functional/vts/testcases/hal/tv_input/hidl/host/Android.mk
diff --git a/tv/input/1.0/vts/TvInput.vts b/tv/input/1.0/vts/TvInput.vts
index 638fd08..73b322a 100644
--- a/tv/input/1.0/vts/TvInput.vts
+++ b/tv/input/1.0/vts/TvInput.vts
@@ -57,6 +57,7 @@
             predefined_type: "::android::hardware::tv::input::V1_0::Result"
         }
         return_type_hidl: {
+            type: TYPE_HANDLE
         }
         arg: {
             type: TYPE_SCALAR
diff --git a/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/__init__.py b/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/__init__.py
diff --git a/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/Android.mk b/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/Android.mk
new file mode 100644
index 0000000..f9e3276
--- /dev/null
+++ b/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/Android.mk
@@ -0,0 +1,19 @@
+#
+# 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 $(call all-subdir-makefiles)
diff --git a/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/__init__.py b/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/__init__.py
diff --git a/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/host/Android.mk b/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/host/Android.mk
new file mode 100644
index 0000000..2703d8c
--- /dev/null
+++ b/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/host/Android.mk
@@ -0,0 +1,25 @@
+#
+# 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 $(call all-subdir-makefiles)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := TvInputHidlTest
+VTS_CONFIG_SRC_DIR := testcases/hal/tv_input/hidl/host
+include test/vts/tools/build/Android.host_config.mk
diff --git a/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/host/AndroidTest.xml b/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/host/AndroidTest.xml
new file mode 100644
index 0000000..8fdd72d
--- /dev/null
+++ b/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/host/AndroidTest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<configuration description="Config for VTS Tv Input HIDL HAL's host-side test cases">
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
+        <option name="push-group" value="HidlHalTest.push" />
+        <option name="push" value="spec/hardware/interfaces/tv/input/1.0/vts/TvInput.vts->/data/local/tmp/spec/TvInput.vts" />
+        <option name="push" value="spec/hardware/interfaces/tv/input/1.0/vts/TvInputCallback.vts->/data/local/tmp/spec/TvInputCallback.vts" />
+        <option name="push" value="spec/hardware/interfaces/tv/input/1.0/vts/types.vts->/data/local/tmp/spec/types.vts" />
+        <option name="cleanup" value="true" />
+    </target_preparer>
+    <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer">
+    </target_preparer>
+    <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
+        <option name="test-module-name" value="TvInputHidlTest" />
+        <option name="test-case-path" value="vts/testcases/hal/tv_input/hidl/host/TvInputHidlTest" />
+    </test>
+</configuration>
diff --git a/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/host/TvInputHidlTest.py b/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/host/TvInputHidlTest.py
new file mode 100644
index 0000000..c99c82c
--- /dev/null
+++ b/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/host/TvInputHidlTest.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+import logging
+
+from vts.runners.host import asserts
+from vts.runners.host import base_test_with_webdb
+from vts.runners.host import const
+from vts.runners.host import test_runner
+from vts.utils.python.controllers import android_device
+
+
+class TvInputHidlTest(base_test_with_webdb.BaseTestWithWebDbClass):
+    """Two hello world test cases which use the shell driver."""
+
+    def setUpClass(self):
+        """Creates a mirror and init tv input hal."""
+        self.dut = self.registerController(android_device)[0]
+
+        self.dut.shell.InvokeTerminal("one")
+        self.dut.shell.one.Execute("setenforce 0")  # SELinux permissive mode
+
+        self.dut.hal.InitHidlHal(target_type="tv_input",
+                                 target_basepaths=["/system/lib64"],
+                                 target_version=1.0,
+                                 target_package="android.hardware.tv.input",
+                                 target_component_name="ITvInput",
+                                 bits=64)
+
+        self.dut.shell.InvokeTerminal("one")
+
+    def testGetStreamConfigurations(self):
+        configs = self.dut.hal.tv_input.getStreamConfigurations(0)
+        logging.info('tv input configs: %s', configs)
+
+
+if __name__ == "__main__":
+    test_runner.main()
diff --git a/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/host/__init__.py b/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/host/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tv/input/1.0/vts/functional/vts/testcases/hal/tv_input/hidl/host/__init__.py
diff --git a/tv/input/1.0/vts/types.vts b/tv/input/1.0/vts/types.vts
index 67d84db..d03e065 100644
--- a/tv/input/1.0/vts/types.vts
+++ b/tv/input/1.0/vts/types.vts
@@ -133,7 +133,7 @@
         }
         enumerator: "PUBLIC_CNT"
         scalar_value: {
-            int32_t: 10
+            int32_t: 11
         }
         enumerator: "FOR_POLICY_CNT"
         scalar_value: {
@@ -310,6 +310,82 @@
         scalar_value: {
             uint32_t: 234881024
         }
+        enumerator: "EVRC"
+        scalar_value: {
+            uint32_t: 268435456
+        }
+        enumerator: "EVRCB"
+        scalar_value: {
+            uint32_t: 285212672
+        }
+        enumerator: "EVRCWB"
+        scalar_value: {
+            uint32_t: 301989888
+        }
+        enumerator: "EVRCNW"
+        scalar_value: {
+            uint32_t: 318767104
+        }
+        enumerator: "AAC_ADIF"
+        scalar_value: {
+            uint32_t: 335544320
+        }
+        enumerator: "WMA"
+        scalar_value: {
+            uint32_t: 352321536
+        }
+        enumerator: "WMA_PRO"
+        scalar_value: {
+            uint32_t: 369098752
+        }
+        enumerator: "AMR_WB_PLUS"
+        scalar_value: {
+            uint32_t: 385875968
+        }
+        enumerator: "MP2"
+        scalar_value: {
+            uint32_t: 402653184
+        }
+        enumerator: "QCELP"
+        scalar_value: {
+            uint32_t: 419430400
+        }
+        enumerator: "DSD"
+        scalar_value: {
+            uint32_t: 436207616
+        }
+        enumerator: "FLAC"
+        scalar_value: {
+            uint32_t: 452984832
+        }
+        enumerator: "ALAC"
+        scalar_value: {
+            uint32_t: 469762048
+        }
+        enumerator: "APE"
+        scalar_value: {
+            uint32_t: 486539264
+        }
+        enumerator: "AAC_ADTS"
+        scalar_value: {
+            uint32_t: 503316480
+        }
+        enumerator: "SBC"
+        scalar_value: {
+            uint32_t: 520093696
+        }
+        enumerator: "APTX"
+        scalar_value: {
+            uint32_t: 536870912
+        }
+        enumerator: "APTX_HD"
+        scalar_value: {
+            uint32_t: 553648128
+        }
+        enumerator: "LDAC"
+        scalar_value: {
+            uint32_t: 570425344
+        }
         enumerator: "MAIN_MASK"
         scalar_value: {
             uint32_t: 4278190080
@@ -458,6 +534,46 @@
         scalar_value: {
             uint32_t: 67109376
         }
+        enumerator: "AAC_ADTS_MAIN"
+        scalar_value: {
+            uint32_t: 503316481
+        }
+        enumerator: "AAC_ADTS_LC"
+        scalar_value: {
+            uint32_t: 503316482
+        }
+        enumerator: "AAC_ADTS_SSR"
+        scalar_value: {
+            uint32_t: 503316484
+        }
+        enumerator: "AAC_ADTS_LTP"
+        scalar_value: {
+            uint32_t: 503316488
+        }
+        enumerator: "AAC_ADTS_HE_V1"
+        scalar_value: {
+            uint32_t: 503316496
+        }
+        enumerator: "AAC_ADTS_SCALABLE"
+        scalar_value: {
+            uint32_t: 503316512
+        }
+        enumerator: "AAC_ADTS_ERLC"
+        scalar_value: {
+            uint32_t: 503316544
+        }
+        enumerator: "AAC_ADTS_LD"
+        scalar_value: {
+            uint32_t: 503316608
+        }
+        enumerator: "AAC_ADTS_HE_V2"
+        scalar_value: {
+            uint32_t: 503316736
+        }
+        enumerator: "AAC_ADTS_ELD"
+        scalar_value: {
+            uint32_t: 503316992
+        }
     }
 }
 
@@ -580,6 +696,10 @@
         scalar_value: {
             uint32_t: 3
         }
+        enumerator: "OUT_2POINT1"
+        scalar_value: {
+            uint32_t: 11
+        }
         enumerator: "OUT_QUAD"
         scalar_value: {
             uint32_t: 51
@@ -592,6 +712,14 @@
         scalar_value: {
             uint32_t: 1539
         }
+        enumerator: "OUT_SURROUND"
+        scalar_value: {
+            uint32_t: 263
+        }
+        enumerator: "OUT_PENTA"
+        scalar_value: {
+            uint32_t: 55
+        }
         enumerator: "OUT_5POINT1"
         scalar_value: {
             uint32_t: 63
@@ -604,6 +732,10 @@
         scalar_value: {
             uint32_t: 1551
         }
+        enumerator: "OUT_6POINT1"
+        scalar_value: {
+            uint32_t: 319
+        }
         enumerator: "OUT_7POINT1"
         scalar_value: {
             uint32_t: 1599
@@ -680,6 +812,18 @@
         scalar_value: {
             uint32_t: 48
         }
+        enumerator: "IN_VOICE_UPLINK_MONO"
+        scalar_value: {
+            uint32_t: 16400
+        }
+        enumerator: "IN_VOICE_DNLINK_MONO"
+        scalar_value: {
+            uint32_t: 32784
+        }
+        enumerator: "IN_VOICE_CALL_MONO"
+        scalar_value: {
+            uint32_t: 49168
+        }
         enumerator: "IN_ALL"
         scalar_value: {
             uint32_t: 65532
@@ -907,13 +1051,17 @@
         scalar_value: {
             uint32_t: 16777216
         }
+        enumerator: "OUT_PROXY"
+        scalar_value: {
+            uint32_t: 33554432
+        }
         enumerator: "OUT_DEFAULT"
         scalar_value: {
             uint32_t: 1073741824
         }
         enumerator: "OUT_ALL"
         scalar_value: {
-            uint32_t: 1107296255
+            uint32_t: 1140850687
         }
         enumerator: "OUT_ALL_A2DP"
         scalar_value: {
@@ -1019,13 +1167,17 @@
         scalar_value: {
             uint32_t: 2148532224
         }
+        enumerator: "IN_PROXY"
+        scalar_value: {
+            uint32_t: 2164260864
+        }
         enumerator: "IN_DEFAULT"
         scalar_value: {
             uint32_t: 3221225472
         }
         enumerator: "IN_ALL"
         scalar_value: {
-            uint32_t: 3223322623
+            uint32_t: 3240099839
         }
         enumerator: "IN_ALL_SCO"
         scalar_value: {
@@ -1092,6 +1244,14 @@
         scalar_value: {
             int32_t: 1024
         }
+        enumerator: "DIRECT_PCM"
+        scalar_value: {
+            int32_t: 8192
+        }
+        enumerator: "MMAP_NOIRQ"
+        scalar_value: {
+            int32_t: 16384
+        }
     }
 }
 
@@ -1121,6 +1281,91 @@
         scalar_value: {
             int32_t: 8
         }
+        enumerator: "MMAP_NOIRQ"
+        scalar_value: {
+            int32_t: 16
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::audio::common::V2_0::AudioUsage"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "UNKNOWN"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "MEDIA"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "VOICE_COMMUNICATION"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "VOICE_COMMUNICATION_SIGNALLING"
+        scalar_value: {
+            int32_t: 3
+        }
+        enumerator: "ALARM"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "NOTIFICATION"
+        scalar_value: {
+            int32_t: 5
+        }
+        enumerator: "NOTIFICATION_TELEPHONY_RINGTONE"
+        scalar_value: {
+            int32_t: 6
+        }
+        enumerator: "NOTIFICATION_COMMUNICATION_REQUEST"
+        scalar_value: {
+            int32_t: 7
+        }
+        enumerator: "NOTIFICATION_COMMUNICATION_INSTANT"
+        scalar_value: {
+            int32_t: 8
+        }
+        enumerator: "NOTIFICATION_COMMUNICATION_DELAYED"
+        scalar_value: {
+            int32_t: 9
+        }
+        enumerator: "NOTIFICATION_EVENT"
+        scalar_value: {
+            int32_t: 10
+        }
+        enumerator: "ASSISTANCE_ACCESSIBILITY"
+        scalar_value: {
+            int32_t: 11
+        }
+        enumerator: "ASSISTANCE_NAVIGATION_GUIDANCE"
+        scalar_value: {
+            int32_t: 12
+        }
+        enumerator: "ASSISTANCE_SONIFICATION"
+        scalar_value: {
+            int32_t: 13
+        }
+        enumerator: "GAME"
+        scalar_value: {
+            int32_t: 14
+        }
+        enumerator: "VIRTUAL_SOURCE"
+        scalar_value: {
+            int32_t: 15
+        }
+        enumerator: "CNT"
+        scalar_value: {
+            int32_t: 16
+        }
+        enumerator: "MAX"
+        scalar_value: {
+            int32_t: 15
+        }
     }
 }
 
@@ -1167,6 +1412,21 @@
         type: TYPE_SCALAR
         scalar_type: "bool_t"
     }
+    struct_value: {
+        name: "bitWidth"
+        type: TYPE_SCALAR
+        scalar_type: "uint32_t"
+    }
+    struct_value: {
+        name: "bufferSize"
+        type: TYPE_SCALAR
+        scalar_type: "uint32_t"
+    }
+    struct_value: {
+        name: "usage"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::audio::common::V2_0::AudioUsage"
+    }
 }
 
 attribute: {
diff --git a/update-makefiles.sh b/update-makefiles.sh
index f153a84..d0cb91c 100755
--- a/update-makefiles.sh
+++ b/update-makefiles.sh
@@ -20,7 +20,9 @@
 for p in $packages; do
   echo "Updating $p";
   hidl-gen -Lmakefile -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport $p;
+  rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
   hidl-gen -Landroidbp -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport $p;
+  rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
 done
 
 # subdirectories of hardware/interfaces which contain an Android.bp file
diff --git a/vehicle/2.0/Android.mk b/vehicle/2.0/Android.mk
index 71b587b..9544960 100644
--- a/vehicle/2.0/Android.mk
+++ b/vehicle/2.0/Android.mk
@@ -17,6 +17,177 @@
 
 
 #
+# Build types.hal (CommonIgnitionMonitors)
+#
+GEN := $(intermediates)/android/hardware/vehicle/V2_0/CommonIgnitionMonitors.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.vehicle@2.0::types.CommonIgnitionMonitors
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CompressionIgnitionMonitors)
+#
+GEN := $(intermediates)/android/hardware/vehicle/V2_0/CompressionIgnitionMonitors.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.vehicle@2.0::types.CompressionIgnitionMonitors
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (FuelSystemStatus)
+#
+GEN := $(intermediates)/android/hardware/vehicle/V2_0/FuelSystemStatus.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.vehicle@2.0::types.FuelSystemStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (FuelType)
+#
+GEN := $(intermediates)/android/hardware/vehicle/V2_0/FuelType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.vehicle@2.0::types.FuelType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (IgnitionMonitorKind)
+#
+GEN := $(intermediates)/android/hardware/vehicle/V2_0/IgnitionMonitorKind.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.vehicle@2.0::types.IgnitionMonitorKind
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Obd2FloatSensorIndex)
+#
+GEN := $(intermediates)/android/hardware/vehicle/V2_0/Obd2FloatSensorIndex.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.vehicle@2.0::types.Obd2FloatSensorIndex
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Obd2IntegerSensorIndex)
+#
+GEN := $(intermediates)/android/hardware/vehicle/V2_0/Obd2IntegerSensorIndex.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.vehicle@2.0::types.Obd2IntegerSensorIndex
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (SecondaryAirStatus)
+#
+GEN := $(intermediates)/android/hardware/vehicle/V2_0/SecondaryAirStatus.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.vehicle@2.0::types.SecondaryAirStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (SparkIgnitionMonitors)
+#
+GEN := $(intermediates)/android/hardware/vehicle/V2_0/SparkIgnitionMonitors.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.vehicle@2.0::types.SparkIgnitionMonitors
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
 # Build types.hal (StatusCode)
 #
 GEN := $(intermediates)/android/hardware/vehicle/V2_0/StatusCode.java
@@ -970,6 +1141,177 @@
 
 
 #
+# Build types.hal (CommonIgnitionMonitors)
+#
+GEN := $(intermediates)/android/hardware/vehicle/V2_0/CommonIgnitionMonitors.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.vehicle@2.0::types.CommonIgnitionMonitors
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CompressionIgnitionMonitors)
+#
+GEN := $(intermediates)/android/hardware/vehicle/V2_0/CompressionIgnitionMonitors.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.vehicle@2.0::types.CompressionIgnitionMonitors
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (FuelSystemStatus)
+#
+GEN := $(intermediates)/android/hardware/vehicle/V2_0/FuelSystemStatus.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.vehicle@2.0::types.FuelSystemStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (FuelType)
+#
+GEN := $(intermediates)/android/hardware/vehicle/V2_0/FuelType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.vehicle@2.0::types.FuelType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (IgnitionMonitorKind)
+#
+GEN := $(intermediates)/android/hardware/vehicle/V2_0/IgnitionMonitorKind.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.vehicle@2.0::types.IgnitionMonitorKind
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Obd2FloatSensorIndex)
+#
+GEN := $(intermediates)/android/hardware/vehicle/V2_0/Obd2FloatSensorIndex.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.vehicle@2.0::types.Obd2FloatSensorIndex
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Obd2IntegerSensorIndex)
+#
+GEN := $(intermediates)/android/hardware/vehicle/V2_0/Obd2IntegerSensorIndex.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.vehicle@2.0::types.Obd2IntegerSensorIndex
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (SecondaryAirStatus)
+#
+GEN := $(intermediates)/android/hardware/vehicle/V2_0/SecondaryAirStatus.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.vehicle@2.0::types.SecondaryAirStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (SparkIgnitionMonitors)
+#
+GEN := $(intermediates)/android/hardware/vehicle/V2_0/SparkIgnitionMonitors.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.vehicle@2.0::types.SparkIgnitionMonitors
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
 # Build types.hal (StatusCode)
 #
 GEN := $(intermediates)/android/hardware/vehicle/V2_0/StatusCode.java
diff --git a/vehicle/2.0/default/VehicleService.cpp b/vehicle/2.0/default/VehicleService.cpp
index 651a2ad..493df74 100644
--- a/vehicle/2.0/default/VehicleService.cpp
+++ b/vehicle/2.0/default/VehicleService.cpp
@@ -16,10 +16,10 @@
 
 #define LOG_TAG "android.hardware.vehicle@2.0-service"
 #include <android/log.h>
+#include <hidl/HidlTransportSupport.h>
 
 #include <iostream>
 
-#include <hwbinder/IPCThreadState.h>
 
 #include <vehicle_hal_manager/VehicleHalManager.h>
 #include <impl/DefaultVehicleHal.h>
@@ -32,11 +32,11 @@
     auto hal = std::make_unique<impl::DefaultVehicleHal>();
     auto service = std::make_unique<VehicleHalManager>(hal.get());
 
+    configureRpcThreadpool(1, true /* callerWillJoin */);
+
     ALOGI("Registering as service...");
     service->registerAsService("Vehicle");
 
     ALOGI("Ready");
-    ProcessState::self()->setThreadPoolMaxThreadCount(0);
-    ProcessState::self()->startThreadPool();
-    IPCThreadState::self()->joinThreadPool();
+    joinRpcThreadpool();
 }
diff --git a/vehicle/2.0/types.hal b/vehicle/2.0/types.hal
index 28ccb78..d98a982 100644
--- a/vehicle/2.0/types.hal
+++ b/vehicle/2.0/types.hal
@@ -2531,3 +2531,383 @@
   /* Something unexpected has happened in Vehicle HAL */
   INTERNAL_ERROR = 5,
 };
+
+/* The status of a fuel system as described by the OBD2 specification. */
+enum FuelSystemStatus : int32_t {
+  OPEN_INSUFFICIENT_ENGINE_TEMPERATURE = 1,
+
+  CLOSED_LOOP = 2,
+
+  OPEN_ENGINE_LOAD_OR_DECELERATION = 4,
+
+  OPEN_SYSTEM_FAILURE = 8,
+
+  CLOSED_LOOP_BUT_FEEDBACK_FAULT = 16,
+};
+
+/* Defines which ignition monitors are available to be read. */
+enum IgnitionMonitorKind : int32_t {
+  SPARK = 0,
+
+  COMPRESSION = 1,
+};
+
+/* These ignition monitors are common to both SPARK and COMPRESSION. */
+enum CommonIgnitionMonitors : int32_t {
+  COMPONENTS_AVAILABLE = 0x1 << 0,
+  COMPONENTS_INCOMPLETE = 0x1 << 1,
+
+  FUEL_SYSTEM_AVAILABLE = 0x1 << 2,
+  FUEL_SYSTEM_INCOMPLETE = 0x1 << 3,
+
+  MISFIRE_AVAILABLE = 0x1 << 4,
+  MISFIRE_INCOMPLETE = 0x1 << 5,
+};
+
+/* Ignition monitors available for SPARK vehicles. */
+enum SparkIgnitionMonitors : CommonIgnitionMonitors {
+  EGR_AVAILABLE = 0x1 << 6,
+  EGR_INCOMPLETE = 0x1 << 7,
+
+  OXYGEN_SENSOR_HEATER_AVAILABLE = 0x1 << 8,
+  OXYGEN_SENSOR_HEATER_INCOMPLETE = 0x1 << 9,
+
+  OXYGEN_SENSOR_AVAILABLE = 0x1 << 10,
+  OXYGEN_SENSOR_INCOMPLETE = 0x1 << 11,
+
+  AC_REFRIGERANT_AVAILABLE = 0x1 << 12,
+  AC_REFRIGERANT_INCOMPLETE = 0x1 << 13,
+
+  SECONDARY_AIR_SYSTEM_AVAILABLE = 0x1 << 14,
+  SECONDARY_AIR_SYSTEM_INCOMPLETE = 0x1 << 15,
+
+  EVAPORATIVE_SYSTEM_AVAILABLE = 0x1 << 16,
+  EVAPORATIVE_SYSTEM_INCOMPLETE = 0x1 << 17,
+
+  HEATED_CATALYST_AVAILABLE = 0x1 << 18,
+  HEATED_CATALYST_INCOMPLETE = 0x1 << 19,
+
+  CATALYST_AVAILABLE = 0x1 << 20,
+  CATALYST_INCOMPLETE = 0x1 << 21,
+};
+
+/* Ignition monitors only available for COMPRESSION vehicles. */
+enum CompressionIgnitionMonitors : CommonIgnitionMonitors {
+  EGR_OR_VVT_AVAILABLE = 0x1 << 6,
+  EGR_OR_VVT_INCOMPLETE = 0x1 << 7,
+
+  PM_FILTER_AVAILABLE = 0x1 << 8,
+  PM_FILTER_INCOMPLETE = 0x1 << 9,
+
+  EXHAUST_GAS_SENSOR_AVAILABLE = 0x1 << 10,
+  EXHAUST_GAS_SENSOR_INCOMPLETE = 0x1 << 11,
+
+  BOOST_PRESSURE_AVAILABLE = 0x1 << 12,
+  BOOST_PRESSURE_INCOMPLETE = 0x1 << 13,
+
+  NOx_SCR__AVAILABLE = 0x1 << 14,
+  NOx_SCR_INCOMPLETE = 0x1 << 15,
+
+  NMHC_CATALYST_AVAILABLE = 0x1 << 16,
+  NMHC_CATALYST_INCOMPLETE = 0x1 << 17,
+};
+
+enum SecondaryAirStatus : int32_t {
+  UPSTREAM = 1,
+
+  DOWNSTREAM_OF_CATALYCIC_CONVERTER = 2,
+
+  FROM_OUTSIDE_OR_OFF = 4,
+
+  PUMP_ON_FOR_DIAGNOSTICS = 8,
+};
+
+enum FuelType : int32_t {
+  NOT_AVAILABLE = 0,
+
+  GASOLINE = 1,
+
+  METHANOL = 2,
+
+  ETHANOL = 3,
+
+  DIESEL = 4,
+
+  LPG = 5,
+
+  CNG = 6,
+
+  PROPANE = 7,
+
+  ELECTRIC = 8,
+
+  BIFUEL_RUNNING_GASOLINE = 9,
+
+  BIFUEL_RUNNING_METHANOL = 10,
+
+  BIFUEL_RUNNING_ETHANOL = 11,
+
+  BIFUEL_RUNNING_LPG = 12,
+
+  BIFUEL_RUNNING_CNG = 13,
+
+  BIFUEL_RUNNING_PROPANE = 14,
+
+  BIFUEL_RUNNING_ELECTRIC = 15,
+
+  BIFUEL_RUNNING_ELECTRIC_AND_COMBUSTION = 16,
+
+  HYBRID_GASOLINE = 17,
+
+  HYBRID_ETHANOL = 18,
+
+  HYBRID_DIESEL = 19,
+
+  HYBRID_ELECTRIC = 20,
+
+  HYBRID_RUNNING_ELECTRIC_AND_COMBUSTION = 21,
+
+  HYBRID_REGENERATIVE = 22,
+
+  BIFUEL_RUNNING_DIESEL = 23,
+};
+
+/*
+ * This enum provides the canonical mapping for sensor properties that have an integer value.
+ * The ordering of the values is taken from the OBD2 specification.
+ * Some of the properties are represented as an integer mapping to another enum. In those cases
+ * expect a comment by the property definition describing the enum to look at for the mapping.
+ * Any value greater than the last reserved index is available to vendors to map their extensions.
+ */
+enum Obd2IntegerSensorIndex : int32_t {
+  /* refer to FuelSystemStatus for a description of this value. */
+  FUEL_SYSTEM_STATUS = 0,
+
+  MALFUNCTION_INDICATOR_LIGHT_ON = 1,
+
+  /* refer to IgnitionMonitorKind for a description of this value. */
+  IGNITION_MONITORS_SUPPORTED = 2,
+
+  /*
+   * The value of this sensor is a bitmask that specifies whether ignition-specific
+   * tests are available and whether they are complete. The semantics of the individual
+   * bits in this value are given by, respectively, SparkIgnitionMonitors and
+   * CompressionIgnitionMonitors depending on the value of IGNITION_MONITORS_SUPPORTED.
+  /*
+  IGNITION_SPECIFIC_MONITORS = 3,
+
+  INTAKE_AIR_TEMPERATURE = 4,
+
+  /* refer to SecondaryAirStatus for a description of this value. */
+  COMMANDED_SECONDARY_AIR_STATUS = 5,
+
+  NUM_OXYGEN_SENSORS_PRESENT = 6,
+
+  RUNTIME_SINCE_ENGINE_START = 7,
+
+  DISTANCE_TRAVELED_WITH_MALFUNCTION_INDICATOR_LIGHT_ON = 8,
+
+  WARMUPS_SINCE_CODES_CLEARED = 9,
+
+  DISTANCE_TRAVELED_SINCE_CODES_CLEARED = 10,
+
+  ABSOLUTE_BAROMETRIC_PRESSURE = 11,
+
+  CONTROL_MODULE_VOLTAGE = 12,
+
+  AMBIENT_AIR_TEMPERATURE = 13,
+
+  TIME_WITH_MALFUNCTION_LIGHT_ON = 14,
+
+  TIME_SINCE_TROUBLE_CODES_CLEARED = 15,
+
+  MAX_FUEL_AIR_EQUIVALENCE_RATIO = 16,
+
+  MAX_OXYGEN_SENSOR_VOLTAGE = 17,
+
+  MAX_OXYGEN_SENSOR_CURRENT = 18,
+
+  MAX_INTAKE_MANIFOLD_ABSOLUTE_PRESSURE = 19,
+
+  MAX_AIR_FLOW_RATE_FROM_MASS_AIR_FLOW_SENSOR = 20,
+
+  /* refer to FuelType for a description of this value. */
+  FUEL_TYPE = 21,
+
+  FUEL_RAIL_ABSOLUTE_PRESSURE = 22,
+
+  ENGINE_OIL_TEMPERATURE = 23,
+
+  DRIVER_DEMAND_PERCENT_TORQUE = 24,
+
+  ENGINE_ACTUAL_PERCENT_TORQUE = 25,
+
+  ENGINE_REFERENCE_PERCENT_TORQUE = 26,
+
+  ENGINE_PERCENT_TORQUE_DATA_IDLE = 27,
+
+  ENGINE_PERCENT_TORQUE_DATA_POINT1 = 28,
+
+  ENGINE_PERCENT_TORQUE_DATA_POINT2 = 29,
+
+  ENGINE_PERCENT_TORQUE_DATA_POINT3 = 30,
+
+  ENGINE_PERCENT_TORQUE_DATA_POINT4 = 31,
+
+  LAST_SYSTEM_INDEX = ENGINE_PERCENT_TORQUE_DATA_POINT4,
+
+  VENDOR_START_INDEX = LAST_SYSTEM_INDEX + 1,
+};
+
+/*
+ * This enum provides the canonical mapping for sensor properties that have a floating-point value.
+ * The ordering of the values is taken from the OBD2 specification.
+ * Any value greater than the last reserved index is available to vendors to map their extensions.
+ */
+enum Obd2FloatSensorIndex : int32_t {
+  CALCULATED_ENGINE_LOAD = 0,
+
+  ENGINE_COOLANT_TEMPERATURE = 1,
+
+  SHORT_TERM_FUEL_TRIM_BANK1 = 2,
+
+  LONG_TERM_FUEL_TRIM_BANK1 = 3,
+
+  SHORT_TERM_FUEL_TRIM_BANK2 = 4,
+
+  LONG_TERM_FUEL_TRIM_BANK2 = 5,
+
+  FUEL_PRESSURE = 6,
+
+  INTAKE_MANIFOLD_ABSOLUTE_PRESSURE = 7,
+
+  ENGINE_RPM = 8,
+
+  VEHICLE_SPEED = 9,
+
+  TIMING_ADVANCE = 10,
+
+  MAF_AIR_FLOW_RATE = 11,
+
+  THROTTLE_POSITION = 12,
+
+  OXYGEN_SENSOR1_VOLTAGE = 13,
+
+  OXYGEN_SENSOR1_SHORT_TERM_FUEL_TRIM = 14,
+
+  OXYGEN_SENSOR1_FUEL_AIR_EQUIVALENCE_RATIO = 15,
+
+  OXYGEN_SENSOR2_VOLTAGE = 16,
+
+  OXYGEN_SENSOR2_SHORT_TERM_FUEL_TRIM = 17,
+
+  OXYGEN_SENSOR2_FUEL_AIR_EQUIVALENCE_RATIO = 18,
+
+  OXYGEN_SENSOR3_VOLTAGE = 19,
+
+  OXYGEN_SENSOR3_SHORT_TERM_FUEL_TRIM = 20,
+
+  OXYGEN_SENSOR3_FUEL_AIR_EQUIVALENCE_RATIO = 21,
+
+  OXYGEN_SENSOR4_VOLTAGE = 22,
+
+  OXYGEN_SENSOR4_SHORT_TERM_FUEL_TRIM = 23,
+
+  OXYGEN_SENSOR4_FUEL_AIR_EQUIVALENCE_RATIO = 24,
+
+  OXYGEN_SENSOR5_VOLTAGE = 25,
+
+  OXYGEN_SENSOR5_SHORT_TERM_FUEL_TRIM = 26,
+
+  OXYGEN_SENSOR5_FUEL_AIR_EQUIVALENCE_RATIO = 27,
+
+  OXYGEN_SENSOR6_VOLTAGE = 28,
+
+  OXYGEN_SENSOR6_SHORT_TERM_FUEL_TRIM = 29,
+
+  OXYGEN_SENSOR6_FUEL_AIR_EQUIVALENCE_RATIO = 30,
+
+  OXYGEN_SENSOR7_VOLTAGE = 31,
+
+  OXYGEN_SENSOR7_SHORT_TERM_FUEL_TRIM = 32,
+
+  OXYGEN_SENSOR7_FUEL_AIR_EQUIVALENCE_RATIO = 33,
+
+  OXYGEN_SENSOR8_VOLTAGE = 34,
+
+  OXYGEN_SENSOR8_SHORT_TERM_FUEL_TRIM = 35,
+
+  OXYGEN_SENSOR8_FUEL_AIR_EQUIVALENCE_RATIO = 36,
+
+  FUEL_RAIL_PRESSURE = 37,
+
+  FUEL_RAIL_GAUGE_PRESSURE = 38,
+
+  COMMANDED_EXHAUST_GAS_RECIRCULATION = 39,
+
+  EXHAUST_GAS_RECIRCULATION_ERROR = 40,
+
+  COMMANDED_EVAPORATIVE_PURGE = 41,
+
+  FUEL_TANK_LEVEL_INPUT = 42,
+
+  EVAPORATION_SYSTEM_VAPOR_PRESSURE = 43,
+
+  CATALYST_TEMPERATURE_BANK1_SENSOR1 = 44,
+
+  CATALYST_TEMPERATURE_BANK2_SENSOR1 = 45,
+
+  CATALYST_TEMPERATURE_BANK1_SENSOR2 = 46,
+
+  CATALYST_TEMPERATURE_BANK2_SENSOR2 = 47,
+
+  ABSOLUTE_LOAD_VALUE = 48,
+
+  FUEL_AIR_COMMANDED_EQUIVALENCE_RATIO = 49,
+
+  RELATIVE_THROTTLE_POSITION = 50,
+
+  ABSOLUTE_THROTTLE_POSITION_B = 51,
+
+  ABSOLUTE_THROTTLE_POSITION_C = 52,
+
+  ACCELERATOR_PEDAL_POSITION_D = 53,
+
+  ACCELERATOR_PEDAL_POSITION_E = 54,
+
+  ACCELERATOR_PEDAL_POSITION_F = 55,
+
+  COMMANDED_THROTTLE_ACTUATOR = 56,
+
+  ETHANOL_FUEL_PERCENTAGE = 57,
+
+  ABSOLUTE_EVAPORATION_SYSTEM_VAPOR_PRESSURE = 58,
+
+  SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1 = 59,
+
+  SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2 = 60,
+
+  SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3 = 61,
+
+  SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4 = 62,
+
+  LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1 = 63,
+
+  LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2 = 64,
+
+  LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3 = 65,
+
+  LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4 = 66,
+
+  RELATIVE_ACCELERATOR_PEDAL_POSITION = 67,
+
+  HYBRID_BATTERY_PACK_REMAINING_LIFE = 68,
+
+  FUEL_INJECTION_TIMING = 69,
+
+  ENGINE_FUEL_RATE = 70,
+
+  LAST_SYSTEM_INDEX = ENGINE_FUEL_RATE,
+
+  VENDOR_START_INDEX = LAST_SYSTEM_INDEX + 1,
+};
diff --git a/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/Android.mk b/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/Android.mk
new file mode 100644
index 0000000..9388b8d
--- /dev/null
+++ b/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/Android.mk
@@ -0,0 +1,23 @@
+#
+# 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)
+
+LOCAL_MODULE := VrHidlTest
+VTS_CONFIG_SRC_DIR := testcases/hal/vr/hidl/host
+include test/vts/tools/build/Android.host_config.mk
diff --git a/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/AndroidTest.xml b/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/AndroidTest.xml
new file mode 100644
index 0000000..1cd2a80
--- /dev/null
+++ b/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<configuration description="Config for VTS HAL VR test cases">
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
+        <option name="push-group" value="HidlHalTest.push" />
+        <option name="cleanup" value="true" />
+        <option name="push" value="spec/hardware/interfaces/vr/1.0/vts/Vr.vts->/data/local/tmp/spec/Vr.vts" />
+    </target_preparer>
+    <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer" />
+    <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
+        <option name="test-module-name" value="VrHidlTest" />
+        <option name="test-case-path" value="vts/testcases/hal/vr/hidl/host/VrHidlTest" />
+    </test>
+</configuration>
diff --git a/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/VrHidlTest.py b/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/VrHidlTest.py
new file mode 100644
index 0000000..9ed378f
--- /dev/null
+++ b/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/VrHidlTest.py
@@ -0,0 +1,80 @@
+#!/usr/bin/env python3.4
+#
+# 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.
+#
+
+import logging
+import time
+
+from vts.runners.host import asserts
+from vts.runners.host import base_test_with_webdb
+from vts.runners.host import test_runner
+from vts.utils.python.controllers import android_device
+from vts.utils.python.profiling import profiling_utils
+
+
+class VrHidlTest(base_test_with_webdb.BaseTestWithWebDbClass):
+    """A simple testcase for the VR HIDL HAL."""
+
+    def setUpClass(self):
+        """Creates a mirror and turns on the framework-layer VR service."""
+        self.dut = self.registerController(android_device)[0]
+
+        self.dut.shell.InvokeTerminal("one")
+        self.dut.shell.one.Execute("setenforce 0")  # SELinux permissive mode
+
+        # Test using the binderized mode
+        self.dut.shell.one.Execute(
+            "setprop vts.hal.vts.hidl.get_stub true")
+
+        if self.enable_profiling:
+            profiling_utils.EnableVTSProfiling(self.dut.shell.one)
+
+        self.dut.hal.InitHidlHal(
+            target_type="vr",
+            target_basepaths=["/system/lib64"],
+            target_version=1.0,
+            target_package="android.hardware.vr",
+            target_component_name="IVr",
+            bits=64)
+
+    def tearDownClass(self):
+        """ If profiling is enabled for the test, collect the profiling data
+            and disable profiling after the test is done.
+        """
+        if self.enable_profiling:
+            profiling_trace_path = getattr(
+                self, self.VTS_PROFILING_TRACING_PATH, "")
+            self.ProcessAndUploadTraceData(self.dut, profiling_trace_path)
+            profiling_utils.DisableVTSProfiling(self.dut.shell.one)
+
+    def testVrBasic(self):
+        """A simple test case which just calls each registered function."""
+        result = self.dut.hal.vr.init()
+        logging.info("init result: %s", result)
+
+        time.sleep(1)
+
+        result = self.dut.hal.vr.setVrMode(True)
+        logging.info("setVrMode(true) result: %s", result)
+
+        time.sleep(1)
+
+        result = self.dut.hal.vr.setVrMode(False)
+        logging.info("setVrMode(false) result: %s", result)
+
+
+if __name__ == "__main__":
+    test_runner.main()
diff --git a/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/__init__.py b/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/vr/1.0/vts/functional/vts/testcases/hal/vr/hidl/host/__init__.py
diff --git a/wifi/1.0/default/service.cpp b/wifi/1.0/default/service.cpp
index 751e8f6..40e8b12 100644
--- a/wifi/1.0/default/service.cpp
+++ b/wifi/1.0/default/service.cpp
@@ -15,42 +15,21 @@
  */
 
 #include <android-base/logging.h>
-#include <hwbinder/IPCThreadState.h>
-#include <hwbinder/ProcessState.h>
+#include <hidl/HidlTransportSupport.h>
 #include <utils/Looper.h>
 #include <utils/StrongPointer.h>
 
 #include "wifi.h"
 
-using android::hardware::hidl_version;
-using android::hardware::IPCThreadState;
-using android::hardware::ProcessState;
-using android::Looper;
-
-namespace {
-int OnBinderReadReady(int /*fd*/, int /*events*/, void* /*data*/) {
-  IPCThreadState::self()->handlePolledCommands();
-  return 1;  // continue receiving events
-}
-}
+using android::hardware::configureRpcThreadpool;
+using android::hardware::joinRpcThreadpool;
 
 int main(int /*argc*/, char** argv) {
   android::base::InitLogging(argv,
                              android::base::LogdLogger(android::base::SYSTEM));
   LOG(INFO) << "wifi_hal_legacy is starting up...";
 
-  // Setup binder
-  int binder_fd = -1;
-  ProcessState::self()->setThreadPoolMaxThreadCount(0);
-  CHECK_EQ(IPCThreadState::self()->setupPolling(&binder_fd), android::NO_ERROR)
-      << "Failed to initialize binder polling";
-  CHECK_GE(binder_fd, 0) << "Invalid binder FD: " << binder_fd;
-
-  // Setup looper
-  android::sp<Looper> looper = Looper::prepare(0 /* no options */);
-  CHECK(looper->addFd(
-      binder_fd, 0, Looper::EVENT_INPUT, OnBinderReadReady, nullptr))
-      << "Failed to watch binder FD";
+  configureRpcThreadpool(1, true /* callerWillJoin */);
 
   // Setup hwbinder service
   android::sp<android::hardware::wifi::V1_0::IWifi> service =
@@ -58,10 +37,7 @@
   CHECK_EQ(service->registerAsService("wifi"), android::NO_ERROR)
       << "Failed to register wifi HAL";
 
-  // Loop
-  while (looper->pollAll(-1) != Looper::POLL_ERROR) {
-    // Keep polling until failure.
-  }
+  joinRpcThreadpool();
 
   LOG(INFO) << "wifi_hal_legacy is terminating...";
   return 0;