Merge "memtrack: fix typo"
diff --git a/Android.bp b/Android.bp
index dace522..b13a5f4 100644
--- a/Android.bp
+++ b/Android.bp
@@ -5,6 +5,10 @@
     "audio/effect/2.0",
     "benchmarks/msgq/1.0",
     "biometrics/fingerprint/2.1",
+    "bluetooth/1.0",
+    "boot/1.0",
+    "example/extension/light/2.0",
+    "gnss/1.0",
     "graphics/allocator/2.0",
     "graphics/allocator/2.0/default",
     "graphics/composer/2.1",
@@ -23,14 +27,20 @@
     "sensors/1.0/default",
     "soundtrigger/2.0",
     "tests/bar/1.0",
+    "tests/bar/1.0/default",
     "tests/baz/1.0",
     "tests/expression/1.0",
     "tests/foo/1.0",
+    "tests/foo/1.0/default",
     "tests/libhwbinder/1.0",
     "tests/msgq/1.0",
     "tests/pointer/1.0",
+    "tests/pointer/1.0/default",
+    "thermal/1.0",
+    "thermal/1.0/default",
     "vehicle/2.0",
     "vibrator/1.0",
+    "vibrator/1.0/default",
     "wifi/1.0",
     "wifi/supplicant/1.0",
 ]
diff --git a/benchmarks/msgq/1.0/IBenchmarkMsgQ.hal b/benchmarks/msgq/1.0/IBenchmarkMsgQ.hal
index 2e50335..3af0b71 100644
--- a/benchmarks/msgq/1.0/IBenchmarkMsgQ.hal
+++ b/benchmarks/msgq/1.0/IBenchmarkMsgQ.hal
@@ -20,36 +20,37 @@
     /*
      * This method requests the service to set up Synchronous read/write
      * wait-free FMQ with the client as reader.
-     * @return ret Will be 0 if the setup is successful.
+     * @return ret Will be true if the setup was successful, false otherwise.
      * @return mqDescIn This structure describes the FMQ that was set up
      * by the service. Client can use it to set up the FMQ at its end.
      */
     configureClientInboxSyncReadWrite()
-        generates(int32_t ret, MQDescriptorSync mqDescIn);
+        generates(bool ret, MQDescriptorSync mqDescIn);
 
     /*
      * This method requests the service to set up Synchronous read/write
      * wait-free FMQ with the client as writer.
-     * @return Will be 0 if the setup is successful.
+     * @return ret Will be true if the setup was successful, false otherwise.
      * @return mqDescOut This structure describes the FMQ that was set up
      * by the service. Client can use it to set up the FMQ at its end.
      */
     configureClientOutboxSyncReadWrite()
-        generates(int32_t ret, MQDescriptorSync mqDescOut);
+        generates(bool ret, MQDescriptorSync mqDescOut);
 
     /*
      * This method request the service to write into the FMQ.
      * @param count Number to messages to write.
-     * @ret Number of messages succesfully written.
+     * @return ret Will be true if the write operation was successful,
+     * false otherwise.
      */
-    requestWrite(int32_t count) generates (int32_t ret);
+    requestWrite(int32_t count) generates (bool ret);
 
     /*
      * This method request the service to read from the FMQ.
      * @param count Number to messages to read.
-     * @ret Number of messages succesfully read.
+     * @ret Will be true if the read operation was successful, false otherwise.
      */
-    requestRead(int32_t count) generates (int32_t ret);
+    requestRead(int32_t count) generates (bool ret);
 
     /*
      * This method kicks off a benchmarking experiment where
diff --git a/bluetooth/1.0/Android.bp b/bluetooth/1.0/Android.bp
new file mode 100644
index 0000000..c5f898d
--- /dev/null
+++ b/bluetooth/1.0/Android.bp
@@ -0,0 +1,54 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+    name: "android.hardware.bluetooth@1.0_genc++",
+    tool: "hidl-gen",
+    cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.bluetooth@1.0",
+    srcs: [
+        "types.hal",
+        "IBluetoothHci.hal",
+        "IBluetoothHciCallbacks.hal",
+    ],
+    out: [
+        "android/hardware/bluetooth/1.0/types.cpp",
+        "android/hardware/bluetooth/1.0/BluetoothHciAll.cpp",
+        "android/hardware/bluetooth/1.0/BluetoothHciCallbacksAll.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.bluetooth@1.0_genc++_headers",
+    tool: "hidl-gen",
+    cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.bluetooth@1.0",
+    srcs: [
+        "types.hal",
+        "IBluetoothHci.hal",
+        "IBluetoothHciCallbacks.hal",
+    ],
+    out: [
+        "android/hardware/bluetooth/1.0/types.h",
+        "android/hardware/bluetooth/1.0/IBluetoothHci.h",
+        "android/hardware/bluetooth/1.0/IHwBluetoothHci.h",
+        "android/hardware/bluetooth/1.0/BnBluetoothHci.h",
+        "android/hardware/bluetooth/1.0/BpBluetoothHci.h",
+        "android/hardware/bluetooth/1.0/BsBluetoothHci.h",
+        "android/hardware/bluetooth/1.0/IBluetoothHciCallbacks.h",
+        "android/hardware/bluetooth/1.0/IHwBluetoothHciCallbacks.h",
+        "android/hardware/bluetooth/1.0/BnBluetoothHciCallbacks.h",
+        "android/hardware/bluetooth/1.0/BpBluetoothHciCallbacks.h",
+        "android/hardware/bluetooth/1.0/BsBluetoothHciCallbacks.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.bluetooth@1.0",
+    generated_sources: ["android.hardware.bluetooth@1.0_genc++"],
+    generated_headers: ["android.hardware.bluetooth@1.0_genc++_headers"],
+    export_generated_headers: ["android.hardware.bluetooth@1.0_genc++_headers"],
+    shared_libs: [
+        "libhidl",
+        "libhwbinder",
+        "libutils",
+        "libcutils",
+    ],
+}
diff --git a/bluetooth/1.0/Android.mk b/bluetooth/1.0/Android.mk
new file mode 100644
index 0000000..7100765
--- /dev/null
+++ b/bluetooth/1.0/Android.mk
@@ -0,0 +1,144 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.bluetooth@1.0-java
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build types.hal (Status)
+#
+GEN := $(intermediates)/android/hardware/bluetooth/1.0/Status.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 \
+        android.hardware.bluetooth@1.0::types.Status
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IBluetoothHci.hal
+#
+GEN := $(intermediates)/android/hardware/bluetooth/1.0/IBluetoothHci.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IBluetoothHci.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IBluetoothHciCallbacks.hal
+$(GEN): $(LOCAL_PATH)/IBluetoothHciCallbacks.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava -randroid.hardware:hardware/interfaces \
+        android.hardware.bluetooth@1.0::IBluetoothHci
+
+$(GEN): $(LOCAL_PATH)/IBluetoothHci.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IBluetoothHciCallbacks.hal
+#
+GEN := $(intermediates)/android/hardware/bluetooth/1.0/IBluetoothHciCallbacks.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IBluetoothHciCallbacks.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava -randroid.hardware:hardware/interfaces \
+        android.hardware.bluetooth@1.0::IBluetoothHciCallbacks
+
+$(GEN): $(LOCAL_PATH)/IBluetoothHciCallbacks.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.bluetooth@1.0-java-static
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build types.hal (Status)
+#
+GEN := $(intermediates)/android/hardware/bluetooth/1.0/Status.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 \
+        android.hardware.bluetooth@1.0::types.Status
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IBluetoothHci.hal
+#
+GEN := $(intermediates)/android/hardware/bluetooth/1.0/IBluetoothHci.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IBluetoothHci.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IBluetoothHciCallbacks.hal
+$(GEN): $(LOCAL_PATH)/IBluetoothHciCallbacks.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava -randroid.hardware:hardware/interfaces \
+        android.hardware.bluetooth@1.0::IBluetoothHci
+
+$(GEN): $(LOCAL_PATH)/IBluetoothHci.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IBluetoothHciCallbacks.hal
+#
+GEN := $(intermediates)/android/hardware/bluetooth/1.0/IBluetoothHciCallbacks.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IBluetoothHciCallbacks.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava -randroid.hardware:hardware/interfaces \
+        android.hardware.bluetooth@1.0::IBluetoothHciCallbacks
+
+$(GEN): $(LOCAL_PATH)/IBluetoothHciCallbacks.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/bluetooth/1.0/IBluetoothHci.hal b/bluetooth/1.0/IBluetoothHci.hal
new file mode 100644
index 0000000..10cf914
--- /dev/null
+++ b/bluetooth/1.0/IBluetoothHci.hal
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+package android.hardware.bluetooth@1.0;
+
+import IBluetoothHciCallbacks;
+
+/*
+ * The Host Controller Interface (HCI) is the layer defined by the Bluetooth
+ * specification between the software that runs on the host and the Bluetooth
+ * controller chip. This boundary is the natural choice for a Hardware
+ * Abstraction Layer (HAL). Dealing only in HCI packets and events simplifies
+ * the stack and abstracts away power management, initialization, and other
+ * implementation-specific details related to the hardware.
+ */
+
+interface IBluetoothHci {
+    /**
+     * Initialize the underlying HCI interface.
+     *
+     * This method should be used to initialize any hardware interfaces
+     * required to communicate with the Bluetooth hardware in the
+     * device.
+     *
+     * @param callback implements IBluetoothHciCallbacks which will
+     *    receive callbacks when incoming HCI packets are received
+     *    from the controller to be sent to the host.
+     * @return status result of the initialization
+     */
+    initialize(IBluetoothHciCallbacks callback) generates (Status status);
+
+    /**
+     * Send an HCI command (as specified in the Bluetooth Specification
+     * V4.2, Vol 2, Part 5, Section 5.4.1) to the Bluetooth controller.
+     * Commands must be executed in order.
+     *
+     * @param command is the HCI command to be sent
+     */
+    sendHciCommand(HciPacket command);
+
+    /**
+     * Send an HCI ACL data packet (as specified in the Bluetooth Specification
+     * V4.2, Vol 2, Part 5, Section 5.4.2) to the Bluetooth controller.
+     * Packets must be processed in order.
+     * @param data HCI data packet to be sent
+     */
+    sendAclData(HciPacket data);
+
+    /**
+     * Send an SCO data packet (as specified in the Bluetooth Specification
+     * V4.2, Vol 2, Part 5, Section 5.4.3) to the Bluetooth controller.
+     * Packets must be processed in order.
+     * @param data HCI data packet to be sent
+     */
+    sendScoData(HciPacket data);
+
+    /**
+     * Close the HCI interface
+     */
+    close();
+};
diff --git a/bluetooth/1.0/IBluetoothHciCallbacks.hal b/bluetooth/1.0/IBluetoothHciCallbacks.hal
new file mode 100644
index 0000000..afaab6c
--- /dev/null
+++ b/bluetooth/1.0/IBluetoothHciCallbacks.hal
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+
+package android.hardware.bluetooth@1.0;
+
+/* The interface from the Bluetooth Controller to the stack. */
+interface IBluetoothHciCallbacks {
+    /**
+     * This function is invoked when an HCI event is received from the
+     * Bluetooth controller to be forwarded to the Bluetooth stack.
+     * @param event is the HCI event to be sent to the Bluetooth stack.
+     */
+    oneway hciEventReceived(HciPacket event);
+
+    /**
+     * Send an ACL data packet form the controller to the host.
+     * @param data the ACL HCI packet to be passed to the host stack
+     */
+    oneway aclDataReceived(HciPacket data);
+
+    /**
+     * Send a SCO data packet form the controller to the host.
+     * @param data the SCO HCI packet to be passed to the host stack
+     */
+    oneway scoDataReceived(HciPacket data);
+};
diff --git a/bluetooth/1.0/types.hal b/bluetooth/1.0/types.hal
new file mode 100644
index 0000000..5f5570a
--- /dev/null
+++ b/bluetooth/1.0/types.hal
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+package android.hardware.bluetooth@1.0;
+
+enum Status : int32_t {
+  SUCCESS,
+  TRANSPORT_ERROR,
+  INITIALIZATION_ERROR,
+  UNKNOWN
+};
+
+/**
+ * HCI packets are transmitted as a vector of type uint8_t.
+ */
+typedef vec<uint8_t> HciPacket;
diff --git a/boot/1.0/Android.bp b/boot/1.0/Android.bp
new file mode 100644
index 0000000..98341ef
--- /dev/null
+++ b/boot/1.0/Android.bp
@@ -0,0 +1,46 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+    name: "android.hardware.boot@1.0_genc++",
+    tool: "hidl-gen",
+    cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.boot@1.0",
+    srcs: [
+        "types.hal",
+        "IBootControl.hal",
+    ],
+    out: [
+        "android/hardware/boot/1.0/types.cpp",
+        "android/hardware/boot/1.0/BootControlAll.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.boot@1.0_genc++_headers",
+    tool: "hidl-gen",
+    cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.boot@1.0",
+    srcs: [
+        "types.hal",
+        "IBootControl.hal",
+    ],
+    out: [
+        "android/hardware/boot/1.0/types.h",
+        "android/hardware/boot/1.0/IBootControl.h",
+        "android/hardware/boot/1.0/IHwBootControl.h",
+        "android/hardware/boot/1.0/BnBootControl.h",
+        "android/hardware/boot/1.0/BpBootControl.h",
+        "android/hardware/boot/1.0/BsBootControl.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.boot@1.0",
+    generated_sources: ["android.hardware.boot@1.0_genc++"],
+    generated_headers: ["android.hardware.boot@1.0_genc++_headers"],
+    export_generated_headers: ["android.hardware.boot@1.0_genc++_headers"],
+    shared_libs: [
+        "libhidl",
+        "libhwbinder",
+        "libutils",
+        "libcutils",
+    ],
+}
diff --git a/boot/1.0/Android.mk b/boot/1.0/Android.mk
new file mode 100644
index 0000000..bb19a79
--- /dev/null
+++ b/boot/1.0/Android.mk
@@ -0,0 +1,136 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.boot@1.0-java
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build types.hal (BoolResult)
+#
+GEN := $(intermediates)/android/hardware/boot/1.0/BoolResult.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 \
+        android.hardware.boot@1.0::types.BoolResult
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CommandResult)
+#
+GEN := $(intermediates)/android/hardware/boot/1.0/CommandResult.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 \
+        android.hardware.boot@1.0::types.CommandResult
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IBootControl.hal
+#
+GEN := $(intermediates)/android/hardware/boot/1.0/IBootControl.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IBootControl.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava -randroid.hardware:hardware/interfaces \
+        android.hardware.boot@1.0::IBootControl
+
+$(GEN): $(LOCAL_PATH)/IBootControl.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.boot@1.0-java-static
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build types.hal (BoolResult)
+#
+GEN := $(intermediates)/android/hardware/boot/1.0/BoolResult.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 \
+        android.hardware.boot@1.0::types.BoolResult
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CommandResult)
+#
+GEN := $(intermediates)/android/hardware/boot/1.0/CommandResult.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 \
+        android.hardware.boot@1.0::types.CommandResult
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IBootControl.hal
+#
+GEN := $(intermediates)/android/hardware/boot/1.0/IBootControl.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IBootControl.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava -randroid.hardware:hardware/interfaces \
+        android.hardware.boot@1.0::IBootControl
+
+$(GEN): $(LOCAL_PATH)/IBootControl.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/boot/1.0/IBootControl.hal b/boot/1.0/IBootControl.hal
new file mode 100644
index 0000000..2024f1f
--- /dev/null
+++ b/boot/1.0/IBootControl.hal
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+
+package android.hardware.boot@1.0;
+
+/**
+ * The Boot Control HAL is designed to allow for managing sets of redundant
+ * partitions, called slots, that can be booted from independently. Slots
+ * are sets of partitions whose names differ only by a given suffix.
+ * They are identified here by a 0 indexed number and associated with their
+ * suffix, which is appended to the base name for any particular partition
+ * to find the one associated with that slot.
+ * The primary use of this set up is to allow for background updates while
+ * the device is running, and to provide a fallback in the event that the
+ * update fails.
+ */
+interface IBootControl {
+  /**
+   * getNumberSlots() returns the number of available slots.
+   * For instance, a system with a single set of partitions must return
+   * 1, a system with A/B must return 2, A/B/C -> 3 and so on. A system with
+   * less than two slots doesn't support background updates, for example if
+   * running from a virtual machine with only one copy of each partition for the
+   * purpose of testing.
+   */
+  getNumberSlots() generates (uint32_t numSlots);
+
+  /**
+   * getCurrentSlot() returns the slot number of that the current boot is booted
+   * from, for example slot number 0 (Slot A). It is assumed that if the current
+   * slot is A, then the block devices underlying B can be accessed directly
+   * without any risk of corruption.
+   * The returned value is always guaranteed to be strictly less than the
+   * value returned by getNumberSlots. Slots start at 0 and finish at
+   * getNumberSlots() - 1. The value returned here must match the suffix passed
+   * from the bootloader, regardless of which slot is active or successful.
+   */
+  getCurrentSlot() generates (Slot slot);
+
+  /**
+   * markBootSuccessful() marks the current slot as having booted successfully.
+   *
+   * Returns whether the command succeeded.
+   */
+  markBootSuccessful() generates (CommandResult error);
+
+  /**
+   * setActiveBootSlot() marks the slot passed in parameter as the active boot
+   * slot (see getCurrentSlot for an explanation of the "slot" parameter). This
+   * overrides any previous call to setSlotAsUnbootable.
+   * Returns whether the command succeeded.
+   */
+  setActiveBootSlot(Slot slot) generates (CommandResult error);
+
+  /**
+   * setSlotAsUnbootable() marks the slot passed in parameter as
+   * an unbootable. This can be used while updating the contents of the slot's
+   * partitions, so that the system must not attempt to boot a known bad set up.
+   * Returns whether the command succeeded.
+   */
+  setSlotAsUnbootable(Slot slot) generates (CommandResult error);
+
+  /**
+   * isSlotBootable() returns if the slot passed in parameter is bootable. Note
+   * that slots can be made unbootable by both the bootloader and by the OS
+   * using setSlotAsUnbootable.
+   * Returns TRUE if the slot is bootable, FALSE if it's not, and INVALID_SLOT
+   * if slot does not exist.
+   */
+  isSlotBootable(Slot slot) generates (BoolResult bootable);
+
+  /**
+   * isSlotMarkedSucessful() returns if the slot passed in parameter has been
+   * marked as successful using markBootSuccessful. Note that only the current
+   * slot can be marked as successful but any slot can be queried.
+   * Returns TRUE if the slot has been marked as successful, FALSE if it has
+   * not, and INVALID_SLOT if the slot does not exist.
+   */
+  isSlotMarkedSuccessful(Slot slot) generates (BoolResult successful);
+
+  /**
+   * getSuffix() returns the string suffix used by partitions that correspond to
+   * the slot number passed in as a parameter. The bootloader must pass the
+   * suffix of the currently active slot either through a kernel command line
+   * property at androidboot.slot_suffix, or the device tree at
+   * /firmware/android/slot_suffix.
+   * Returns the empty string "" if slot does not match an existing slot.
+   */
+  getSuffix(Slot slot) generates (string slotSuffix);
+};
+
diff --git a/boot/1.0/default/Android.mk b/boot/1.0/default/Android.mk
new file mode 100644
index 0000000..50fd1e4
--- /dev/null
+++ b/boot/1.0/default/Android.mk
@@ -0,0 +1,34 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.boot@1.0-impl
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_SRC_FILES := \
+    BootControl.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+    liblog \
+    libhidl \
+    libhwbinder \
+    libhardware \
+    libutils \
+    android.hardware.boot@1.0 \
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_MODULE := android.hardware.boot@1.0-service
+LOCAL_INIT_RC := android.hardware.boot@1.0-service.rc
+LOCAL_SRC_FILES := \
+    service.cpp
+
+LOCAL_SHARED_LIBRARIES := \
+    liblog \
+    libhwbinder \
+    libhardware \
+    libhidl \
+    libutils \
+    android.hardware.boot@1.0 \
+
+include $(BUILD_EXECUTABLE)
diff --git a/boot/1.0/default/BootControl.cpp b/boot/1.0/default/BootControl.cpp
new file mode 100644
index 0000000..4c34168
--- /dev/null
+++ b/boot/1.0/default/BootControl.cpp
@@ -0,0 +1,98 @@
+#define LOG_TAG "android.hardware.boot@1.0-impl"
+#include <utils/Log.h>
+
+#include <hardware/hardware.h>
+#include <hardware/boot_control.h>
+#include "BootControl.h"
+
+namespace android {
+namespace hardware {
+namespace boot {
+namespace V1_0 {
+namespace implementation {
+
+BootControl::BootControl(boot_control_module_t *module) : mModule(module){
+}
+
+// Methods from ::android::hardware::boot::V1_0::IBootControl follow.
+Return<uint32_t> BootControl::getNumberSlots()  {
+    return mModule->getNumberSlots(mModule);
+}
+
+Return<uint32_t> BootControl::getCurrentSlot()  {
+    return mModule->getCurrentSlot(mModule);
+}
+
+Return<void> BootControl::markBootSuccessful(markBootSuccessful_cb _hidl_cb)  {
+    int ret = mModule->markBootSuccessful(mModule);
+    struct CommandResult cr;
+    cr.success = (ret == 0);
+    cr.errMsg = strerror(-ret);
+    _hidl_cb(cr);
+    return Void();
+}
+
+Return<void> BootControl::setActiveBootSlot(uint32_t slot, setActiveBootSlot_cb _hidl_cb)  {
+    int ret = mModule->setActiveBootSlot(mModule, slot);
+    struct CommandResult cr;
+    cr.success = (ret == 0);
+    cr.errMsg = strerror(-ret);
+    _hidl_cb(cr);
+    return Void();
+}
+
+Return<void> BootControl::setSlotAsUnbootable(uint32_t slot, setSlotAsUnbootable_cb _hidl_cb)  {
+    int ret = mModule->setSlotAsUnbootable(mModule, slot);
+    struct CommandResult cr;
+    cr.success = (ret == 0);
+    cr.errMsg = strerror(-ret);
+    _hidl_cb(cr);
+    return Void();
+}
+
+Return<BoolResult> BootControl::isSlotBootable(uint32_t slot)  {
+    int32_t ret = mModule->isSlotBootable(mModule, slot);
+    if (ret < 0) {
+        return BoolResult::INVALID_SLOT;
+    }
+    return ret ? BoolResult::TRUE : BoolResult::FALSE;
+}
+
+Return<BoolResult> BootControl::isSlotMarkedSuccessful(uint32_t slot)  {
+    int32_t ret = mModule->isSlotMarkedSuccessful(mModule, slot);
+    if (ret < 0) {
+        return BoolResult::INVALID_SLOT;
+    }
+    return ret ? BoolResult::TRUE : BoolResult::FALSE;
+}
+
+Return<void> BootControl::getSuffix(uint32_t slot, getSuffix_cb _hidl_cb)  {
+    hidl_string ans;
+    const char *suffix = mModule->getSuffix(mModule, slot);
+    if (suffix) {
+        ans = suffix;
+    }
+    _hidl_cb(ans);
+    return Void();
+}
+
+
+IBootControl* HIDL_FETCH_IBootControl(const char* hal) {
+    int ret = 0;
+    boot_control_module_t* module = NULL;
+    hw_module_t **hwm = reinterpret_cast<hw_module_t**>(&module);
+    ret = hw_get_module(hal, const_cast<const hw_module_t**>(hwm));
+    if (ret)
+    {
+        ALOGE("hw_get_module %s failed: %d", hal, ret);
+        return nullptr;
+    }
+    module->init(module);
+    return new BootControl(module);
+}
+
+} // namespace implementation
+}  // namespace V1_0
+}  // namespace boot
+}  // namespace hardware
+}  // namespace android
diff --git a/boot/1.0/default/BootControl.h b/boot/1.0/default/BootControl.h
new file mode 100644
index 0000000..73af4f4
--- /dev/null
+++ b/boot/1.0/default/BootControl.h
@@ -0,0 +1,46 @@
+#ifndef HIDL_GENERATED_android_hardware_boot_V1_0_BootControl_H_
+#define HIDL_GENERATED_android_hardware_boot_V1_0_BootControl_H_
+
+#include <android/hardware/boot/1.0/IBootControl.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace boot {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::boot::V1_0::BoolResult;
+using ::android::hardware::boot::V1_0::CommandResult;
+using ::android::hardware::boot::V1_0::IBootControl;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct BootControl : public IBootControl {
+    BootControl(boot_control_module_t* module);
+    // Methods from ::android::hardware::boot::V1_0::IBootControl follow.
+    Return<uint32_t> getNumberSlots()  override;
+    Return<uint32_t> getCurrentSlot()  override;
+    Return<void> markBootSuccessful(markBootSuccessful_cb _hidl_cb)  override;
+    Return<void> setActiveBootSlot(uint32_t slot, setActiveBootSlot_cb _hidl_cb)  override;
+    Return<void> setSlotAsUnbootable(uint32_t slot, setSlotAsUnbootable_cb _hidl_cb)  override;
+    Return<BoolResult> isSlotBootable(uint32_t slot)  override;
+    Return<BoolResult> isSlotMarkedSuccessful(uint32_t slot)  override;
+    Return<void> getSuffix(uint32_t slot, getSuffix_cb _hidl_cb)  override;
+private:
+    boot_control_module_t* mModule;
+};
+
+extern "C" IBootControl* HIDL_FETCH_IBootControl(const char* name);
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace boot
+}  // namespace hardware
+}  // namespace android
+
+#endif  // HIDL_GENERATED_android_hardware_boot_V1_0_BootControl_H_
diff --git a/boot/1.0/default/android.hardware.boot@1.0-service.rc b/boot/1.0/default/android.hardware.boot@1.0-service.rc
new file mode 100644
index 0000000..57c1aff
--- /dev/null
+++ b/boot/1.0/default/android.hardware.boot@1.0-service.rc
@@ -0,0 +1,4 @@
+service boot-hal-1-0 /system/bin/hw/android.hardware.boot@1.0-service
+    class hal
+    user system
+    group system readproc
diff --git a/boot/1.0/default/service.cpp b/boot/1.0/default/service.cpp
new file mode 100644
index 0000000..b059f9a
--- /dev/null
+++ b/boot/1.0/default/service.cpp
@@ -0,0 +1,44 @@
+#define LOG_TAG "android.hardware.boot@1.0-service"
+#include <utils/Log.h>
+
+#include <iostream>
+#include <unistd.h>
+
+#include <android/hardware/boot/1.0/IBootControl.h>
+
+#include <hidl/IServiceManager.h>
+#include <hwbinder/IPCThreadState.h>
+#include <hwbinder/ProcessState.h>
+#include <utils/Errors.h>
+#include <utils/StrongPointer.h>
+
+using android::sp;
+
+using android::hardware::IPCThreadState;
+using android::hardware::ProcessState;
+
+using ::android::hardware::boot::V1_0::IBootControl;
+
+int main (int /* argc */, char * /* argv */ []) {
+    ALOGI("Service is starting.");
+    const char instance[] = "bootctrl";
+    ALOGI("Retrieving default implementation of instance %s.",
+          instance);
+
+    sp<IBootControl> service = IBootControl::getService(instance, true /* getStub */);
+
+    if (service.get() == nullptr) {
+        ALOGE("IBootControl::getService returned NULL, exiting");
+        return -1;
+    }
+
+    LOG_FATAL_IF(service->isRemote(), "Implementation is REMOTE!");
+
+    ALOGI("Registering instance %s.", instance);
+    service->registerAsService(instance);
+    ALOGI("Ready.");
+
+    ProcessState::self()->setThreadPoolMaxThreadCount(0);
+    ProcessState::self()->startThreadPool();
+    IPCThreadState::self()->joinThreadPool();
+}
diff --git a/boot/1.0/types.hal b/boot/1.0/types.hal
new file mode 100644
index 0000000..87f6109
--- /dev/null
+++ b/boot/1.0/types.hal
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+package android.hardware.boot@1.0;
+
+/**
+ * A command result encapsulating whether the command succeeded and
+ * an error string.
+ */
+struct CommandResult {
+    bool success;
+    string errMsg;
+};
+
+/**
+ * An identifier for a slot number.
+ */
+typedef uint32_t Slot;
+
+/**
+ * A result encapsulating whether a function returned true, false or
+ * failed due to an invalid slot number
+ */
+enum BoolResult : int32_t {
+    FALSE = 0,
+    TRUE = 1,
+    INVALID_SLOT = -1
+};
diff --git a/example/extension/light/2.0/Android.bp b/example/extension/light/2.0/Android.bp
new file mode 100644
index 0000000..42f34f2
--- /dev/null
+++ b/example/extension/light/2.0/Android.bp
@@ -0,0 +1,47 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+    name: "android.hardware.example.extension.light@2.0_genc++",
+    tool: "hidl-gen",
+    cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.example.extension.light@2.0",
+    srcs: [
+        "types.hal",
+        "IExtLight.hal",
+    ],
+    out: [
+        "android/hardware/example/extension/light/2.0/types.cpp",
+        "android/hardware/example/extension/light/2.0/ExtLightAll.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.example.extension.light@2.0_genc++_headers",
+    tool: "hidl-gen",
+    cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.example.extension.light@2.0",
+    srcs: [
+        "types.hal",
+        "IExtLight.hal",
+    ],
+    out: [
+        "android/hardware/example/extension/light/2.0/types.h",
+        "android/hardware/example/extension/light/2.0/IExtLight.h",
+        "android/hardware/example/extension/light/2.0/IHwExtLight.h",
+        "android/hardware/example/extension/light/2.0/BnExtLight.h",
+        "android/hardware/example/extension/light/2.0/BpExtLight.h",
+        "android/hardware/example/extension/light/2.0/BsExtLight.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.example.extension.light@2.0",
+    generated_sources: ["android.hardware.example.extension.light@2.0_genc++"],
+    generated_headers: ["android.hardware.example.extension.light@2.0_genc++_headers"],
+    export_generated_headers: ["android.hardware.example.extension.light@2.0_genc++_headers"],
+    shared_libs: [
+        "libhidl",
+        "libhwbinder",
+        "libutils",
+        "libcutils",
+        "android.hardware.light@2.0",
+    ],
+}
diff --git a/example/extension/light/2.0/Android.mk b/example/extension/light/2.0/Android.mk
new file mode 100644
index 0000000..75157a8
--- /dev/null
+++ b/example/extension/light/2.0/Android.mk
@@ -0,0 +1,178 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.example.extension.light@2.0-java
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+LOCAL_JAVA_LIBRARIES := \
+    android.hardware.light@2.0-java \
+
+
+#
+# Build types.hal (Default)
+#
+GEN := $(intermediates)/android/hardware/example/extension/light/2.0/Default.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 \
+        android.hardware.example.extension.light@2.0::types.Default
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (ExtBrightness)
+#
+GEN := $(intermediates)/android/hardware/example/extension/light/2.0/ExtBrightness.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 \
+        android.hardware.example.extension.light@2.0::types.ExtBrightness
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (ExtLightState)
+#
+GEN := $(intermediates)/android/hardware/example/extension/light/2.0/ExtLightState.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 \
+        android.hardware.example.extension.light@2.0::types.ExtLightState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IExtLight.hal
+#
+GEN := $(intermediates)/android/hardware/example/extension/light/2.0/IExtLight.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IExtLight.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava -randroid.hardware:hardware/interfaces \
+        android.hardware.example.extension.light@2.0::IExtLight
+
+$(GEN): $(LOCAL_PATH)/IExtLight.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.example.extension.light@2.0-java-static
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+LOCAL_STATIC_JAVA_LIBRARIES := \
+    android.hardware.light@2.0-java-static \
+
+
+#
+# Build types.hal (Default)
+#
+GEN := $(intermediates)/android/hardware/example/extension/light/2.0/Default.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 \
+        android.hardware.example.extension.light@2.0::types.Default
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (ExtBrightness)
+#
+GEN := $(intermediates)/android/hardware/example/extension/light/2.0/ExtBrightness.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 \
+        android.hardware.example.extension.light@2.0::types.ExtBrightness
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (ExtLightState)
+#
+GEN := $(intermediates)/android/hardware/example/extension/light/2.0/ExtLightState.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 \
+        android.hardware.example.extension.light@2.0::types.ExtLightState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IExtLight.hal
+#
+GEN := $(intermediates)/android/hardware/example/extension/light/2.0/IExtLight.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IExtLight.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava -randroid.hardware:hardware/interfaces \
+        android.hardware.example.extension.light@2.0::IExtLight
+
+$(GEN): $(LOCAL_PATH)/IExtLight.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/example/extension/light/2.0/IExtLight.hal b/example/extension/light/2.0/IExtLight.hal
new file mode 100644
index 0000000..f12a272
--- /dev/null
+++ b/example/extension/light/2.0/IExtLight.hal
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+// Would normally be 'vendor.example.extension.light@2.0' however, this is
+// a google extension example. A vendor extension should also live in the
+// vendor partition.
+package android.hardware.example.extension.light@2.0;
+
+import android.hardware.light@2.0;
+
+interface IExtLight extends android.hardware.light@2.0::ILight {
+
+    /**
+     * Set the provided lights to the provided values.
+     *
+     * @param type logical light to set
+     * @param state describes what the light should look like.
+     * @return status result of applying state transformation.
+     */
+    setExtLight(Type type, ExtLightState state) generates (Status status);
+
+};
diff --git a/example/extension/light/2.0/default/Android.mk b/example/extension/light/2.0/default/Android.mk
new file mode 100644
index 0000000..fa68787
--- /dev/null
+++ b/example/extension/light/2.0/default/Android.mk
@@ -0,0 +1,17 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.example.extension.light@2.0-service
+LOCAL_INIT_RC := android.hardware.example.extension.light@2.0-service.rc
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_SRC_FILES := \
+    Light.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+    libhidl \
+    libhwbinder \
+    libutils \
+    android.hardware.light@2.0 \
+    android.hardware.example.extension.light@2.0 \
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/example/extension/light/2.0/default/Light.cpp b/example/extension/light/2.0/default/Light.cpp
new file mode 100644
index 0000000..d738a6d
--- /dev/null
+++ b/example/extension/light/2.0/default/Light.cpp
@@ -0,0 +1,56 @@
+#include "Light.h"
+
+namespace android {
+namespace hardware {
+namespace example {
+namespace extension {
+namespace light {
+namespace V2_0 {
+namespace implementation {
+
+// Methods from ::android::hardware::light::V2_0::ILight follow.
+Return<Status> Light::setLight(Type type, const LightState& state)  {
+    // Forward types for new methods.
+
+    ExtLightState extState {
+        .state = state,
+        .interpolationOmega =
+            static_cast<int32_t>(Default::INTERPOLATION_OMEGA),
+        .brightness = // ExtBrightness inherits from Brightness
+            static_cast<ExtBrightness>(state.brightnessMode)
+    };
+
+    return setExtLight(type, extState);
+}
+
+Return<void> Light::getSupportedTypes(getSupportedTypes_cb _hidl_cb)  {
+    // implement unchanged method as you would always
+    hidl_vec<Type> vec{};
+
+    // ******************************************************
+    // Note: awesome proprietary hardware implementation here
+    // ******************************************************
+
+    _hidl_cb(vec);
+
+    return Void();
+}
+
+// Methods from ::android::hardware::example::extension::light::V2_0::ILight follow.
+Return<Status> Light::setExtLight(Type /* type */,
+                                  const ExtLightState& /* state */)  {
+
+    // ******************************************************
+    // Note: awesome proprietary hardware implementation here
+    // ******************************************************
+
+    return Status::SUCCESS;
+}
+
+} // namespace implementation
+}  // namespace V2_0
+}  // namespace light
+}  // namespace extension
+}  // namespace example
+}  // namespace hardware
+}  // namespace android
diff --git a/example/extension/light/2.0/default/Light.h b/example/extension/light/2.0/default/Light.h
new file mode 100644
index 0000000..e09ec92
--- /dev/null
+++ b/example/extension/light/2.0/default/Light.h
@@ -0,0 +1,46 @@
+#ifndef HIDL_GENERATED_android_hardware_example_extension_light_V2_0_Light_H_
+#define HIDL_GENERATED_android_hardware_example_extension_light_V2_0_Light_H_
+
+#include <android/hardware/example/extension/light/2.0/IExtLight.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace example {
+namespace extension {
+namespace light {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::example::extension::light::V2_0::ExtLightState;
+using ::android::hardware::example::extension::light::V2_0::IExtLight;
+using ::android::hardware::light::V2_0::ILight;
+using ::android::hardware::light::V2_0::LightState;
+using ::android::hardware::light::V2_0::Status;
+using ::android::hardware::light::V2_0::Type;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Light : public IExtLight {
+    // Methods from ::android::hardware::light::V2_0::ILight follow.
+    Return<Status> setLight(Type type, const LightState& state)  override;
+    Return<void> getSupportedTypes(getSupportedTypes_cb _hidl_cb)  override;
+
+    // Methods from ::android::hardware::example::extension::light::V2_0::ILight follow.
+    Return<Status> setExtLight(Type type, const ExtLightState& state)  override;
+
+};
+
+}  // namespace implementation
+}  // namespace V2_0
+}  // namespace light
+}  // namespace extension
+}  // namespace example
+}  // namespace hardware
+}  // namespace android
+
+#endif  // HIDL_GENERATED_android_hardware_example_extension_light_V2_0_Light_H_
diff --git a/example/extension/light/2.0/default/android.hardware.example.extension.light@2.0-service.rc b/example/extension/light/2.0/default/android.hardware.example.extension.light@2.0-service.rc
new file mode 100644
index 0000000..8a90d81
--- /dev/null
+++ b/example/extension/light/2.0/default/android.hardware.example.extension.light@2.0-service.rc
@@ -0,0 +1,4 @@
+service light-ext-2-0 /system/bin/hw/android.hardware.example.extension.light@2.0-service
+    class hal
+    user system
+    group system readproc
\ No newline at end of file
diff --git a/example/extension/light/2.0/default/service.cpp b/example/extension/light/2.0/default/service.cpp
new file mode 100644
index 0000000..55121d9
--- /dev/null
+++ b/example/extension/light/2.0/default/service.cpp
@@ -0,0 +1,34 @@
+#define LOG_TAG "android.hardware.light@2.0-service"
+#include <utils/Log.h>
+
+// #include <iostream>
+// #include <unistd.h>
+
+// #include <hidl/IServiceManager.h>
+// #include <hwbinder/IPCThreadState.h>
+// #include <hwbinder/ProcessState.h>
+// #include <utils/Errors.h>
+// #include <utils/StrongPointer.h>
+
+#include "Light.h"
+
+using android::sp;
+
+// libhwbinder:
+using android::hardware::IPCThreadState;
+using android::hardware::ProcessState;
+
+// Generated HIDL files
+using android::hardware::light::V2_0::ILight;
+
+int main() {
+    const char instance[] = "light";
+
+    android::sp<ILight> service = new Light();
+
+    service->registerAsService(instance);
+
+    ProcessState::self()->setThreadPoolMaxThreadCount(0);
+    ProcessState::self()->startThreadPool();
+    IPCThreadState::self()->joinThreadPool();
+}
diff --git a/example/extension/light/2.0/types.hal b/example/extension/light/2.0/types.hal
new file mode 100644
index 0000000..5be41bb
--- /dev/null
+++ b/example/extension/light/2.0/types.hal
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+
+package android.hardware.example.extension.light@2.0;
+
+import android.hardware.light@2.0;
+
+enum Default : int32_t {
+    // for calls to setLight from the framework that don't know about this
+    // extension or its requirements
+    INTERPOLATION_OMEGA = 2
+};
+
+/**
+ * One possibility is renaming an old type. Another possibility is taking
+ * advantages of the different namespaces.
+ */
+enum ExtBrightness : Brightness {
+    /**
+     * Say we're really going to use the phone as a heater.
+     */
+    EXTREME,
+
+    /**
+     * Sometimes at night, we need it to be day.
+     */
+     THE_SUN,
+};
+
+/**
+ * Structs can't inherit eachother in hidl. Use composition instead. In this
+ * case, I won't use inheritence because I want to replace Brightness with
+ * ExtBrightness.
+ */
+struct ExtLightState {
+    LightState state;
+
+    /**
+     * This is the secret sauce that will really make this extension shine.
+     * No other person has such a cool feature in their hals. Don't forget
+     * to describe all details of parameters. An interface is a contract, and
+     * specifying this contract to the letter is what allows that contracted
+     * to be maintained. :)
+     *
+     * So, this parameter represents the speed at which brightness is changed
+     * to the new value in the three dimensional space with coordinates RGB
+     * from the red, blue, and green.
+     */
+    int32_t interpolationOmega;
+
+    /**
+     * Include new values.
+     */
+    ExtBrightness brightness;
+};
diff --git a/gnss/1.0/Android.bp b/gnss/1.0/Android.bp
new file mode 100644
index 0000000..a97531d
--- /dev/null
+++ b/gnss/1.0/Android.bp
@@ -0,0 +1,174 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+    name: "android.hardware.gnss@1.0_genc++",
+    tool: "hidl-gen",
+    cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.gnss@1.0",
+    srcs: [
+        "types.hal",
+        "IAGnss.hal",
+        "IAGnssCallback.hal",
+        "IAGnssRil.hal",
+        "IAGnssRilCallback.hal",
+        "IGnss.hal",
+        "IGnssCallback.hal",
+        "IGnssDebug.hal",
+        "IGnssGeofenceCallback.hal",
+        "IGnssGeofencing.hal",
+        "IGnssMeasurement.hal",
+        "IGnssMeasurementCallback.hal",
+        "IGnssNavigationMessage.hal",
+        "IGnssNavigationMessageCallback.hal",
+        "IGnssNi.hal",
+        "IGnssNiCallback.hal",
+        "IGnssXtra.hal",
+        "IGnssXtraCallback.hal",
+    ],
+    out: [
+        "android/hardware/gnss/1.0/types.cpp",
+        "android/hardware/gnss/1.0/AGnssAll.cpp",
+        "android/hardware/gnss/1.0/AGnssCallbackAll.cpp",
+        "android/hardware/gnss/1.0/AGnssRilAll.cpp",
+        "android/hardware/gnss/1.0/AGnssRilCallbackAll.cpp",
+        "android/hardware/gnss/1.0/GnssAll.cpp",
+        "android/hardware/gnss/1.0/GnssCallbackAll.cpp",
+        "android/hardware/gnss/1.0/GnssDebugAll.cpp",
+        "android/hardware/gnss/1.0/GnssGeofenceCallbackAll.cpp",
+        "android/hardware/gnss/1.0/GnssGeofencingAll.cpp",
+        "android/hardware/gnss/1.0/GnssMeasurementAll.cpp",
+        "android/hardware/gnss/1.0/GnssMeasurementCallbackAll.cpp",
+        "android/hardware/gnss/1.0/GnssNavigationMessageAll.cpp",
+        "android/hardware/gnss/1.0/GnssNavigationMessageCallbackAll.cpp",
+        "android/hardware/gnss/1.0/GnssNiAll.cpp",
+        "android/hardware/gnss/1.0/GnssNiCallbackAll.cpp",
+        "android/hardware/gnss/1.0/GnssXtraAll.cpp",
+        "android/hardware/gnss/1.0/GnssXtraCallbackAll.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.gnss@1.0_genc++_headers",
+    tool: "hidl-gen",
+    cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.gnss@1.0",
+    srcs: [
+        "types.hal",
+        "IAGnss.hal",
+        "IAGnssCallback.hal",
+        "IAGnssRil.hal",
+        "IAGnssRilCallback.hal",
+        "IGnss.hal",
+        "IGnssCallback.hal",
+        "IGnssDebug.hal",
+        "IGnssGeofenceCallback.hal",
+        "IGnssGeofencing.hal",
+        "IGnssMeasurement.hal",
+        "IGnssMeasurementCallback.hal",
+        "IGnssNavigationMessage.hal",
+        "IGnssNavigationMessageCallback.hal",
+        "IGnssNi.hal",
+        "IGnssNiCallback.hal",
+        "IGnssXtra.hal",
+        "IGnssXtraCallback.hal",
+    ],
+    out: [
+        "android/hardware/gnss/1.0/types.h",
+        "android/hardware/gnss/1.0/IAGnss.h",
+        "android/hardware/gnss/1.0/IHwAGnss.h",
+        "android/hardware/gnss/1.0/BnAGnss.h",
+        "android/hardware/gnss/1.0/BpAGnss.h",
+        "android/hardware/gnss/1.0/BsAGnss.h",
+        "android/hardware/gnss/1.0/IAGnssCallback.h",
+        "android/hardware/gnss/1.0/IHwAGnssCallback.h",
+        "android/hardware/gnss/1.0/BnAGnssCallback.h",
+        "android/hardware/gnss/1.0/BpAGnssCallback.h",
+        "android/hardware/gnss/1.0/BsAGnssCallback.h",
+        "android/hardware/gnss/1.0/IAGnssRil.h",
+        "android/hardware/gnss/1.0/IHwAGnssRil.h",
+        "android/hardware/gnss/1.0/BnAGnssRil.h",
+        "android/hardware/gnss/1.0/BpAGnssRil.h",
+        "android/hardware/gnss/1.0/BsAGnssRil.h",
+        "android/hardware/gnss/1.0/IAGnssRilCallback.h",
+        "android/hardware/gnss/1.0/IHwAGnssRilCallback.h",
+        "android/hardware/gnss/1.0/BnAGnssRilCallback.h",
+        "android/hardware/gnss/1.0/BpAGnssRilCallback.h",
+        "android/hardware/gnss/1.0/BsAGnssRilCallback.h",
+        "android/hardware/gnss/1.0/IGnss.h",
+        "android/hardware/gnss/1.0/IHwGnss.h",
+        "android/hardware/gnss/1.0/BnGnss.h",
+        "android/hardware/gnss/1.0/BpGnss.h",
+        "android/hardware/gnss/1.0/BsGnss.h",
+        "android/hardware/gnss/1.0/IGnssCallback.h",
+        "android/hardware/gnss/1.0/IHwGnssCallback.h",
+        "android/hardware/gnss/1.0/BnGnssCallback.h",
+        "android/hardware/gnss/1.0/BpGnssCallback.h",
+        "android/hardware/gnss/1.0/BsGnssCallback.h",
+        "android/hardware/gnss/1.0/IGnssDebug.h",
+        "android/hardware/gnss/1.0/IHwGnssDebug.h",
+        "android/hardware/gnss/1.0/BnGnssDebug.h",
+        "android/hardware/gnss/1.0/BpGnssDebug.h",
+        "android/hardware/gnss/1.0/BsGnssDebug.h",
+        "android/hardware/gnss/1.0/IGnssGeofenceCallback.h",
+        "android/hardware/gnss/1.0/IHwGnssGeofenceCallback.h",
+        "android/hardware/gnss/1.0/BnGnssGeofenceCallback.h",
+        "android/hardware/gnss/1.0/BpGnssGeofenceCallback.h",
+        "android/hardware/gnss/1.0/BsGnssGeofenceCallback.h",
+        "android/hardware/gnss/1.0/IGnssGeofencing.h",
+        "android/hardware/gnss/1.0/IHwGnssGeofencing.h",
+        "android/hardware/gnss/1.0/BnGnssGeofencing.h",
+        "android/hardware/gnss/1.0/BpGnssGeofencing.h",
+        "android/hardware/gnss/1.0/BsGnssGeofencing.h",
+        "android/hardware/gnss/1.0/IGnssMeasurement.h",
+        "android/hardware/gnss/1.0/IHwGnssMeasurement.h",
+        "android/hardware/gnss/1.0/BnGnssMeasurement.h",
+        "android/hardware/gnss/1.0/BpGnssMeasurement.h",
+        "android/hardware/gnss/1.0/BsGnssMeasurement.h",
+        "android/hardware/gnss/1.0/IGnssMeasurementCallback.h",
+        "android/hardware/gnss/1.0/IHwGnssMeasurementCallback.h",
+        "android/hardware/gnss/1.0/BnGnssMeasurementCallback.h",
+        "android/hardware/gnss/1.0/BpGnssMeasurementCallback.h",
+        "android/hardware/gnss/1.0/BsGnssMeasurementCallback.h",
+        "android/hardware/gnss/1.0/IGnssNavigationMessage.h",
+        "android/hardware/gnss/1.0/IHwGnssNavigationMessage.h",
+        "android/hardware/gnss/1.0/BnGnssNavigationMessage.h",
+        "android/hardware/gnss/1.0/BpGnssNavigationMessage.h",
+        "android/hardware/gnss/1.0/BsGnssNavigationMessage.h",
+        "android/hardware/gnss/1.0/IGnssNavigationMessageCallback.h",
+        "android/hardware/gnss/1.0/IHwGnssNavigationMessageCallback.h",
+        "android/hardware/gnss/1.0/BnGnssNavigationMessageCallback.h",
+        "android/hardware/gnss/1.0/BpGnssNavigationMessageCallback.h",
+        "android/hardware/gnss/1.0/BsGnssNavigationMessageCallback.h",
+        "android/hardware/gnss/1.0/IGnssNi.h",
+        "android/hardware/gnss/1.0/IHwGnssNi.h",
+        "android/hardware/gnss/1.0/BnGnssNi.h",
+        "android/hardware/gnss/1.0/BpGnssNi.h",
+        "android/hardware/gnss/1.0/BsGnssNi.h",
+        "android/hardware/gnss/1.0/IGnssNiCallback.h",
+        "android/hardware/gnss/1.0/IHwGnssNiCallback.h",
+        "android/hardware/gnss/1.0/BnGnssNiCallback.h",
+        "android/hardware/gnss/1.0/BpGnssNiCallback.h",
+        "android/hardware/gnss/1.0/BsGnssNiCallback.h",
+        "android/hardware/gnss/1.0/IGnssXtra.h",
+        "android/hardware/gnss/1.0/IHwGnssXtra.h",
+        "android/hardware/gnss/1.0/BnGnssXtra.h",
+        "android/hardware/gnss/1.0/BpGnssXtra.h",
+        "android/hardware/gnss/1.0/BsGnssXtra.h",
+        "android/hardware/gnss/1.0/IGnssXtraCallback.h",
+        "android/hardware/gnss/1.0/IHwGnssXtraCallback.h",
+        "android/hardware/gnss/1.0/BnGnssXtraCallback.h",
+        "android/hardware/gnss/1.0/BpGnssXtraCallback.h",
+        "android/hardware/gnss/1.0/BsGnssXtraCallback.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.gnss@1.0",
+    generated_sources: ["android.hardware.gnss@1.0_genc++"],
+    generated_headers: ["android.hardware.gnss@1.0_genc++_headers"],
+    export_generated_headers: ["android.hardware.gnss@1.0_genc++_headers"],
+    shared_libs: [
+        "libhidl",
+        "libhwbinder",
+        "libutils",
+        "libcutils",
+    ],
+}
diff --git a/gnss/1.0/IAGnss.hal b/gnss/1.0/IAGnss.hal
new file mode 100644
index 0000000..a3172f3
--- /dev/null
+++ b/gnss/1.0/IAGnss.hal
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss@1.0;
+
+import IAGnssCallback;
+
+/*
+ * Extended interface for AGNSS support.
+ */
+interface IAGnss {
+    enum ApnIpType : uint16_t {
+        INVALID  = 0,
+        IPV4     = 1,
+        IPV6     = 2,
+        IPV4V6   = 3
+    };
+
+    /*
+     * Opens the AGNSS interface and provides the callback routines to the
+     * implementation of this interface.
+     *
+     * @param callback Handle to the AGNSS status callback interface.
+     */
+    setCallback(IAGnssCallback callback);
+
+    /*
+     * Notifies that the AGNSS data connection has been closed.
+     *
+     * @return success True if the operation is successful.
+     */
+    dataConnClosed() generates (bool success);
+
+    /*
+     * Notifies that a data connection is not available for AGNSS.
+     *
+     * @return success True if the operation is successful.
+     */
+    dataConnFailed() generates (bool success);
+
+    /*
+     * Sets the hostname and port for the AGNSS server.
+     *
+     * @param type Specifies if SUPL or C2K.
+     * @param hostname Hostname of the AGNSS server.
+     * @param port Port number associated with the server.
+     *
+     * @return success True if the operation is successful.
+     */
+    setServer(AGnssType type, string hostname, int32_t port)
+        generates (bool success);
+
+    /*
+     * Notifies that a data connection is available and sets the name of the
+     * APN, and its IP type, to be used for SUPL connections.
+     *
+     * @param apn Access Point Name(follows regular APN naming convention).
+     * @param apnIpType Specifies if SUPL or C2K.
+     *
+     * @return success True if the operation is successful.
+     */
+    dataConnOpenWithApnIpType(string apn, ApnIpType apnIpType)
+        generates (bool success);
+};
diff --git a/gnss/1.0/IAGnssCallback.hal b/gnss/1.0/IAGnssCallback.hal
new file mode 100644
index 0000000..46641be
--- /dev/null
+++ b/gnss/1.0/IAGnssCallback.hal
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss@1.0;
+
+/** Callback structure for the AGNSS interface. */
+interface IAGnssCallback {
+    /** AGNSS type **/
+    enum AGnssType : uint16_t {
+        TYPE_SUPL         = 1,
+        TYPE_C2K          = 2
+    };
+
+    enum AGnssStatusValue : uint16_t {
+        /** GNSS requests data connection for AGNSS. */
+        REQUEST_AGNSS_DATA_CONN  = 1,
+        /** GNSS releases the AGNSS data connection. */
+        RELEASE_AGNSS_DATA_CONN  = 2,
+        /** AGNSS data connection initiated */
+        AGNSS_DATA_CONNECTED     = 3,
+        /** AGNSS data connection completed */
+        AGNSS_DATA_CONN_DONE     = 4,
+        /** AGNSS data connection failed */
+        AGNSS_DATA_CONN_FAILED   = 5
+    };
+
+    /*
+     * Represents the status of AGNSS augmented to support IPv4.
+     */
+    struct AGnssStatusIpV4 {
+        AGnssType type;
+        AGnssStatusValue status;
+        /*
+         * 32-bit IPv4 address.
+         */
+        uint32_t ipV4Addr;
+    };
+
+    /*
+     * Represents the status of AGNSS augmented to support IPv6.
+     */
+    struct AGnssStatusIpV6 {
+        AGnssType type;
+        AGnssStatusValue status;
+        /*
+         * 128-bit IPv6 address.
+         */
+        uint8_t[16] ipV6Addr;
+    };
+
+    /*
+     * Callback with AGNSS(IpV4) status information.
+     *
+     * @param status Will be of type AGnssStatusIpV4.
+     */
+    agnssStatusIpV4Cb(AGnssStatusIpV4 status);
+
+    /*
+     * Callback with AGNSS(IpV6) status information.
+     *
+     * @param status Will be of type AGnssStatusIpV6.
+     */
+    agnssStatusIpV6Cb(AGnssStatusIpV6 status);
+
+};
diff --git a/gnss/1.0/IAGnssRil.hal b/gnss/1.0/IAGnssRil.hal
new file mode 100644
index 0000000..fb73498
--- /dev/null
+++ b/gnss/1.0/IAGnssRil.hal
@@ -0,0 +1,151 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss@1.0;
+
+import IAGnssRilCallback;
+
+/*
+ * Extended interface for AGNSS RIL support. An Assisted GNSS Radio Interface
+ * Layer interface allows the GNSS chipset to request radio interface layer
+ * information from Android platform. Examples of such information are reference
+ * location, unique subscriber ID, phone number string and network availability changes.
+ */
+interface IAGnssRil {
+    enum SetIDType : uint16_t {
+        NONE    = 0,
+        IMSI    = 1,
+        MSISDM  = 2
+    };
+
+    enum NetworkType : int32_t {
+        MOBILE  = 0,
+        WIFI    = 1,
+        MMS     = 2,
+        SUPL    = 3,
+        DUN     = 4,
+        HIPRI   = 5,
+        WIMAX   = 6,
+    };
+
+    enum AGnssRefLocationType {
+        GSM_CELLID   = 1,
+        UMTS_CELLID  = 2,
+        MAC          = 3,
+        LTE_CELLID   = 4,
+    };
+
+    /* CellID for 2G, 3G and LTE, used in AGNSS. */
+    struct AGnssRefLocationCellID {
+        AGnssRefLocationType type;
+
+        /* Mobile Country Code. */
+        uint16_t mcc;
+
+        /* Mobile Network Code .*/
+        uint16_t mnc;
+
+        /*
+         * Location Area Code in 2G, 3G and LTE. In 3G lac is discarded. In LTE,
+         * lac is populated with tac, to ensure that we don't break old clients that
+         * might rely in the old (wrong) behavior.
+         */
+        uint16_t lac;
+
+        /* Cell id in 2G. Utran Cell id in 3G. Cell Global Id EUTRA in LTE. */
+        uint32_t cid;
+
+        /* Tracking Area Code in LTE. */
+        uint16_t tac;
+
+        /* Physical Cell id in LTE (not used in 2G and 3G) */
+        uint16_t pcid;
+    };
+
+    struct AGnssRefLocationMac {
+        uint8_t[6] mac;
+    };
+
+    /* Represents ref locations */
+    struct AGnssRefLocation {
+        AGnssRefLocationType type;
+
+        union RefLoc {
+            AGnssRefLocationCellID cellID;
+            AGnssRefLocationMac mac;
+        };
+
+        RefLoc refLocVal;
+    };
+
+    /*
+     * Opens the AGNSS interface and provides the callback routines
+     * to the implementation of this interface.
+     *
+     * @param callback Interface for AGnssRil callbacks.
+     */
+    setCallback(IAGnssRilCallback callback);
+
+    /*
+     * Sets the reference location.
+     *
+     * @param agnssReflocation AGNSS reference location CellID/MAC.
+     */
+    setRefLocation(AGnssRefLocation agnssReflocation);
+
+    /*
+     * Sets the SET ID.
+     *
+     * @param type Must be populated with either IMSI or MSISDN or NONE.
+     * @param setid If type is IMSI then setid is populated with
+     * a string representing the unique Subscriber ID, for example, the IMSI for
+     * a GMS phone. If type is MSISDN, then setid must contain
+     * the phone number string for line 1. For example, the MSISDN for a GSM phone.
+     * If the type is NONE, then the string must be empty.
+     *
+     * @return success True if all parameters were valid and operation was
+     * successful.
+     */
+    setSetId(SetIDType type, string setid) generates (bool success);
+
+    /*
+     * Notify GNSS of network status changes.
+     *
+     * @param connected Indicates whether network connectivity exists and
+     * it is possible to establish connections and pass data.
+     * @param type Indicates the kind of network, for eg. mobile, wifi etc.
+     * @param roaming Indicates whether the device is currently roaming on
+     * this network.
+     *
+     * @return success True is all parameters were valid and operation was
+     * successful.
+     */
+    updateNetworkState(bool connected, NetworkType type, bool roaming)
+        generates (bool success);
+
+    /*
+     * Notify GNSS of network status changes.
+     *
+     * @param available Indicates whether network connectivity is available.
+     * @param apn String containing the Access Point Name.
+     *
+     * @return success True if all parameters were valid and the operation was
+     * successful.
+     * TODO(b/32022567): Add VTS test to validate the format of APN.
+     */
+    updateNetworkAvailability(bool available, string apn) generates (bool success);
+
+};
diff --git a/gnss/1.0/IAGnssRilCallback.hal b/gnss/1.0/IAGnssRilCallback.hal
new file mode 100644
index 0000000..6f29820
--- /dev/null
+++ b/gnss/1.0/IAGnssRilCallback.hal
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss@1.0;
+
+/*
+ * Callback for IAGnssRil interface. Used to request SET ID and
+ * Reference Location.
+ */
+interface IAGnssRilCallback {
+    /* Kinds of SET ID that can be requested */
+    enum ID : uint32_t {
+        IMSI    = 1 << 0L,
+        MSISDN  = 1 << 1L,
+    };
+
+    /* Kinds of reference location that can be requested. */
+    enum RefLoc : uint32_t {
+        CELLID = 1 << 0L,
+        MAC    = 1 << 1L
+    };
+
+    /*
+     * The Hal uses this API to request a SET ID.
+     *
+     * @param setIdflag Specifies the kind of SET ID that is required by the HAL.
+     */
+    requestSetIdCb(ID setIdflag);
+
+    /*
+     * The Hal uses this API to request a reference location.
+     *
+     * @param refLocflag Specifies the kind of reference location that is required
+     * by the HAL.
+     */
+    requestRefLocCb(RefLoc refLocflag);
+
+};
diff --git a/gnss/1.0/IGnss.hal b/gnss/1.0/IGnss.hal
new file mode 100644
index 0000000..bc19e78
--- /dev/null
+++ b/gnss/1.0/IGnss.hal
@@ -0,0 +1,210 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss@1.0;
+
+import IAGnss;
+import IAGnssRil;
+import IGnssCallback;
+import IGnssDebug;
+import IGnssMeasurement;
+import IGnssNavigationMessage;
+import IGnssGeofencing;
+import IGnssNi;
+import IGnssXtra;
+
+/* Represents the standard GNSS interface. */
+interface IGnss {
+    /* Requested operational mode for GNSS operation. */
+    enum GnssPositionMode : uint32_t {
+        /** Mode for running GNSS standalone (no assistance). */
+        STANDALONE  = 0,
+        /** AGNSS MS-Based mode. */
+        MS_BASED    = 1,
+        /*
+         * AGNSS MS-Assisted mode. This mode is not maintained by the platform anymore.
+         * It is strongly recommended to use MS_BASED instead.
+         */
+        MS_ASSISTED = 2,
+    };
+
+    /* Requested recurrence mode for GNSS operation. */
+    enum GnssPositionRecurrence : uint32_t {
+        /** Receive GNSS fixes on a recurring basis at a specified period. */
+        RECURRENCE_PERIODIC  = 0,
+        /** Request a single shot GNSS fix. */
+        RECURRENCE_SINGLE    = 1
+    };
+
+    /*
+     * Flags used to specify which aiding data to delete when calling
+     * deleteAidingData().
+     */
+    enum GnssAidingData : uint16_t {
+        DELETE_EPHEMERIS    = 0x0001,
+        DELETE_ALMANAC      = 0x0002,
+        DELETE_POSITION     = 0x0004,
+        DELETE_TIME         = 0x0008,
+        DELETE_IONO         = 0x0010,
+        DELETE_UTC          = 0x0020,
+        DELETE_HEALTH       = 0x0040,
+        DELETE_SVDIR        = 0x0080,
+        DELETE_SVSTEER      = 0x0100,
+        DELETE_SADATA       = 0x0200,
+        DELETE_RTI          = 0x0400,
+        DELETE_CELLDB_INFO  = 0x8000,
+        DELETE_ALL          = 0xFFFF
+    };
+
+    /*
+     * Opens the interface and provides the callback routines
+     * to the implementation of this interface.
+     *
+     * @param callback Callback interface for IGnss.
+     *
+     * @return success Returns true on success.
+     */
+    setCallback(IGnssCallback callback) generates (bool success);
+
+    /*
+     * Starts navigating.
+     *
+     * @return success Returns true on success.
+     */
+    start() generates (bool success);
+
+    /*
+     * Stops navigating.
+     *
+     * @return success Returns true on success.
+     */
+    stop() generates (bool success);
+
+    /*
+     * Closes the interface.
+     */
+    cleanup();
+
+    /*
+     * Injects the current time.
+     *
+     * @param timeMs This is the UTC time received from the NTP server, its value
+     * is given in milliseconds since January 1, 1970.
+     * @param timeReferenceMs The corresponding value of
+     * SystemClock.elapsedRealtime() from the device when the NTP response was
+     * received in milliseconds.
+     * @param uncertaintyMs Uncertainty associated with the value represented by
+     * time. Represented in milliseconds.
+     *
+     * @return success Returns true if the operation is successful.
+     *
+    injectTime(GnssUtcTime timeMs, int64_t timeReferenceMs, int32_t uncertaintyMs)
+        generates (bool success);
+
+    /*
+     * Injects current location from another location provider (typically cell
+     * ID).
+     *
+     * @param latitudeDegrees Measured in Degrees.
+     * @param longitudeDegrees Measured in Degrees.
+     * @param accuracyMeters Measured in meters.
+     *
+     * @return success Returns true if successful.
+     */
+    injectLocation(double latitudeDegrees, double longitudeDegrees, float accuracyMeters)
+        generates (bool success);
+
+    /*
+     * Specifies that the next call to start will not use the
+     * information defined in the flags. GnssAidingData value of DELETE_ALL is
+     * passed for a cold start.
+     *
+     * @param aidingDataFlags Flags specifying the aiding data to be deleted.
+     */
+    deleteAidingData(GnssAidingData aidingDataFlags);
+
+    /*
+     * @param mode  Parameter must be one of MS_BASED or STANDALONE.
+     * It is allowed by the platform (and it is recommended) to fallback to
+     * MS_BASED if MS_ASSISTED is passed in, and MS_BASED is supported.
+     * @recurrence GNSS postion recurrence value, either periodic or single.
+     * @param minIntervalMs Represents the time between fixes in milliseconds.
+     * @param preferredAccuracyMeters Represents the requested fix accuracy in meters.
+     * @param preferredTimeMs Represents the requested time to first fix in milliseconds.
+
+     * @return success Returns true if successful.
+     */
+    setPositionMode(GnssPositionMode mode, GnssPositionRecurrence recurrence,
+                    uint32_t minIntervalMs, uint32_t preferredAccuracyMeters,
+                    uint32_t preferredTimeMs)
+        generates (bool success);
+
+    /*
+     * This method returns the IAGnssRil Interface.
+     *
+     * @return infc Handle to the IAGnssRil interface.
+     */
+    getExtensionAGnssRil() generates (IAGnssRil infc);
+
+    /*
+     * This method returns the IGnssGeofencing Interface.
+     *
+     * @return infc Handle to the IGnssGeofencing interface.
+     */
+    getExtensionGnssGeofencing() generates(IGnssGeofencing infc);
+
+    /*
+     * This method returns the IAGnss Interface.
+     *
+     * @return infc Handle to the IAGnss interface.
+     */
+    getExtensionAGnss() generates (IAGnss infc);
+
+    /*
+     * This method returns the IGnssNi interface.
+     *
+     * @return infc Handle to the IGnssNi interface.
+     */
+    getExtensionGnssNi() generates (IGnssNi infc);
+
+    /*
+     * This method returns the IGnssMeasurement interface.
+     *
+     * @return infc Handle to the IGnssMeasurement interface.
+     */
+    getExtensionGnssMeasurement() generates (IGnssMeasurement infc);
+
+    /*
+     * This method returns the IGnssNavigationMessage interface.
+     *
+     * @return infc Handle to the IGnssNavigationMessage interface.
+     */
+    getExtensionGnssNavigationMessage() generates (IGnssNavigationMessage infc);
+
+    /*
+     * This method returns the IGnssXtra interface.
+     *
+     * @return infc Handle to the IGnssXtra interface.
+     */
+    getExtensionXtra() generates (IGnssXtra infc);
+
+    /*
+     * This method returns the IGnssDebug interface.
+     *
+     * @return infc Handle to the IGnssDebug interface.
+     */
+    getExtensionGnssDebug() generates (IGnssDebug infc);
+};
diff --git a/gnss/1.0/IGnssCallback.hal b/gnss/1.0/IGnssCallback.hal
new file mode 100644
index 0000000..5234688
--- /dev/null
+++ b/gnss/1.0/IGnssCallback.hal
@@ -0,0 +1,222 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss@1.0;
+
+/*
+ * The interface is required for the HAL to communicate certain information
+ * like status and location info back to the platform, the platform implements
+ * the interfaces and passes a handle to the HAL.
+ */
+interface IGnssCallback {
+    /* Flags for the gnssSetCapabilities callback. */
+    enum Capabilities : uint32_t {
+        /*
+         * GNSS HAL schedules fixes for RECURRENCE_PERIODIC mode.
+         * If this is not set, then the framework will use 1000ms for
+         * minInterval and will call start() and stop() to schedule the GNSS.
+         */
+        SCHEDULING     = 1 << 0,
+        /** GNSS supports MS-Based AGNSS mode */
+        MSB            = 1 << 1,
+        /** GNSS supports MS-Assisted AGNSS mode */
+        MSA            = 1 << 2,
+        /** GNSS supports single-shot fixes */
+        SINGLE_SHOT    = 1 << 3,
+        /** GNSS supports on demand time injection */
+        ON_DEMAND_TIME = 1 << 4,
+        /** GNSS supports Geofencing  */
+        GEOFENCING     = 1 << 5,
+        /** GNSS supports Measurements. */
+        MEASUREMENTS   = 1 << 6,
+        /** GNSS supports Navigation Messages */
+        NAV_MESSAGES   = 1 << 7,
+    };
+
+    /* GNSS status event values. */
+    enum GnssStatusValue : uint16_t {
+        /** GNSS status unknown. */
+        STATUS_NONE    = 0,
+        /** GNSS has begun navigating. */
+        SESSION_BEGIN  = 1,
+        /** GNSS has stopped navigating. */
+        SESSION_END    = 2,
+        /** GNSS has powered on but is not navigating. */
+        ENGINE_ON      = 3,
+        /** GNSS is powered off. */
+        ENGINE_OFF     = 4
+    };
+
+    /*
+     * Flags that indicate information about the satellite
+     */
+    enum GnssSvFlags : uint8_t {
+        FLAGS_NONE          = 0,
+        HAS_EPHEMERIS_DATA  = 1 << 0,
+        HAS_ALMANAC_DATA    = 1 << 1,
+        USED_IN_FIX         = 1 << 2
+    };
+
+    struct GnssSvInfo {
+        /*
+         * Pseudo-random number for the SV, or FCN/OSN number for Glonass. The
+         * distinction is made by looking at constellation field. Values must be
+         * in the range of:
+         *
+         * - GNSS:    1-32
+         * - SBAS:    120-151, 183-192
+         * - GLONASS: 1-24, the orbital slot number (OSN), if known.  Or, if not:
+         *            93-106, the frequency channel number (FCN) (-7 to +6) offset by
+         *            + 100
+         *            i.e. report an FCN of -7 as 93, FCN of 0 as 100, and FCN of +6
+         *            as 106.
+         * - QZSS:    193-200
+         * - Galileo: 1-36
+         * - Beidou:  1-37
+         */
+        int16_t svid;
+
+        /*
+         * Defines the constellation of the given SV.
+         */
+        GnssConstellationType constellation;
+
+        /*
+         * Carrier-to-noise density in dB-Hz, typically in the range [0, 63].
+         * It contains the measured C/N0 value for the signal at the antenna port.
+         *
+         * This is a mandatory value.
+         */
+        float cN0Dbhz;
+
+        /** Elevation of SV in degrees. */
+        float elevationDegrees;
+
+        /** Azimuth of SV in degrees. */
+        float azimuthDegrees;
+
+        /*
+         * Contains additional data about the given SV.
+         */
+        GnssSvFlags svFlag;
+    };
+
+    /*
+     * Represents SV status.
+     */
+    struct GnssSvStatus {
+        /*
+         * Number of GNSS SVs currently visible, refers to the SVs stored in sv_list
+         */
+        int32_t numSvs;
+
+        /*
+         * Pointer to an array of SVs information for all GNSS constellations,
+         * except GNSS, which is reported using svList
+         */
+        GnssSvInfo[ConstS32:GNSS_MAX_SVS] gnssSvList;
+
+    };
+
+    /*
+     * Called when a GNSS location is available.
+     *
+     * @param location Location information from HAL.
+     */
+    gnssLocationCb(GnssLocation location);
+
+    /*
+     * Called to communicate the status of the GNSS engine.
+     *
+     * @param status Status information from HAL.
+     */
+    gnssStatusCb(GnssStatusValue status);
+
+    /*
+     * @param svInfo SV status information from HAL.
+     */
+    gnssSvStatusCb(GnssSvStatus svInfo);
+
+    /*
+     * Called when NMEA data is available.
+     * Callback for reporting NMEA sentences.
+     *
+     * @param timestamp Marks the instance of reporting.
+     * @param nmea Follows standard NMEA 0183. Each sentence begins with a '$'
+     * and ends with a carriage return/line feed sequence and can be no longer
+     * than 80 characters of visible text (plus the line terminators). The data
+     * is contained within this single line with data items separated by commas.
+     * The data itself is just ascii text and may extend over multiple sentences
+     * in certain specialized instances but is normally fully contained in one
+     * variable length sentence. The data may vary in the amount of precision
+     * contained in the message. For example time might be indicated to decimal
+     * parts of a second or location may be shown with 3 or even 4 digits after
+     * the decimal point. Programs that read the data must only use the commas
+     * to determine the field boundaries and not depend on column positions.
+     * There is a provision for a checksum at the end of each sentence which may
+     * or may not be checked by the unit that reads the data. The checksum field
+     * consists of a '*' and two hex digits representing an 8 bit exclusive OR
+     * of all characters between, but not including, the '$' and '*'.
+     */
+    gnssNmeaCb(GnssUtcTime timestamp, string nmea);
+
+    /*
+     * Callback to inform framework of the GNSS engine's capabilities.
+     *
+     * @param capabilities Capability parameter is a bit field of
+     * the Capabilities enum.
+     */
+    gnssSetCapabilitesCb(uint32_t capabilities);
+
+    /*
+     * Callback utility for acquiring the GNSS wakelock. This can be used to prevent
+     * the CPU from suspending while handling GNSS events.
+     */
+    gnssAcquireWakelockCb();
+
+    /** Callback utility for releasing the GNSS wakelock. */
+    gnssReleaseWakelockCb();
+
+    /** Callback for requesting NTP time */
+    gnssRequestTimeCb();
+
+    /*
+     * Provides information about how new the underlying GPS/GNSS hardware and
+     * software is.
+     *
+     * This information will be available for Android Test Applications. If a GNSS
+     * HAL does not provide this information, it will be considered "2015 or
+     * earlier".
+     *
+     * If a GNSS HAL does provide this information, then newer years will need to
+     * meet newer CTS standards. E.g. if the date are 2016 or above, then N+ level
+     * GnssMeasurement support will be verified.
+     */
+    struct GnssSystemInfo{
+        /*
+         * year in which the last update was made to the underlying hardware/firmware
+         * used to capture GNSS signals, e.g. 2016
+         */
+        uint16_t yearOfHw;
+    };
+
+    /*
+     * Callback to inform framework of the engine's hardware version information.
+     *
+     * @param info GnssSystemInfo about the GPS/GNSS hardware.
+     */
+    gnssSetSystemInfoCb(GnssSystemInfo info);
+};
diff --git a/gnss/1.0/IGnssDebug.hal b/gnss/1.0/IGnssDebug.hal
new file mode 100644
index 0000000..b0ac69d
--- /dev/null
+++ b/gnss/1.0/IGnssDebug.hal
@@ -0,0 +1,122 @@
+package android.hardware.gnss@1.0;
+
+/* Extended interface for DEBUG support. */
+interface IGnssDebug {
+    enum SatelliteEphemerisType : uint32_t {
+        /* no information is known to the gnss hardware, about this satellite */
+        UNKNOWN,
+        /*  this satellite is known to exist */
+        KNOWN,
+        /*  this satellite is not known to exist */
+        NONEXISTENT,
+        /* Only Almanac (approximate) location known for this satellite */
+        ALMANAC_ONLY,
+        /* Ephemeris is known from demodulating the signal on device */
+        DEMODULATED,
+        /* Ephemeris has been provided by SUPL */
+        SUPL_PROVIDED,
+        /* Ephemeris has been provided by another server */
+        OTHER_SERVER_PROVIDED,
+        /*
+         * Predicted ephemeris has been provided by a server
+         * (e.g. Xtra, Extended Ephemeris, etc...)
+         */
+        SERVER_PREDICTED,
+        /*
+         * Predicted ephemeris in use, generated locally on the device (e.g. from prior
+         * ephemeris)
+         */
+        LOCALLY_PREDICTED
+    };
+
+    /*
+     * Provides the current best known position from any
+     * source (GNSS or injected assistance).
+     */
+    struct PositionDebug {
+        /*
+         * Validity of the data in this struct. False only if no
+         * latitude/longitude information is known.
+         * /
+        bool valid;
+        /* Latitude expressed in degrees */
+        double latitudeDegrees;
+        /* Longitude expressed in degrees */
+        double longitudeDegrees;
+        /* Altitude above ellipsoid expressed in meters */
+        float altitudeDegrees;
+        /*
+         * estimated horizontal accuracy of position expressed in meters, radial,
+         * 68% confidence.
+         */
+        double accuracyMeters;
+        /*
+         * Time duration before this report that this position information was
+         * valid.
+         */
+        float ageSeconds;
+    };
+
+    /*
+     * Provides the current best known UTC time estimate.
+     */
+    struct TimeDebug {
+        /*
+         * Validity of the data in the struct.
+         * False if current time is unknown.
+         */
+        bool valid;
+        /*
+         * UTC time estimate.
+         */
+        GnssUtcTime timeEstimate;
+        /* 68% error estimate in time. */
+        float timeUncertaintyNs;
+    };
+
+    /*
+     * Provides a single satellite info that has decoded navigation data.
+     */
+    struct SatelliteData {
+        /* Satellite vehicle ID number */
+        int16_t svid;
+        /* Defines the constellation type of the given SV. */
+        GnssConstellationType constellation;
+        /* Defines the ephemeris type of the satellite. */
+        SatelliteEphemerisType ephemerisType;
+        /*
+         * Time duration before this report, that the ephemeris source was last
+         * updated, e.g. latest demodulation, or latest server download.
+         * Set to 0 when ephemerisType is UNKNOWN.
+         */
+        float ephemerisAgeSeconds;
+    };
+
+    /*
+     * Provides a set of debug information that is filled by the GNSS chipset
+     * when the method getDebugData() is invoked.
+     */
+    struct DebugData {
+        /* Current best known position. */
+        PositionDebug position;
+        /* Current best know time estimate */
+        TimeDebug time;
+        /*
+         * Provides a list of the decoded satellite ephemeris.
+         * Should provide a complete list for all constellations device can track,
+         * including GnssConstellationType UNKNOWN.
+         */
+        vec<SatelliteData> satelliteDataArray;
+
+    };
+
+    /*
+     * This methods requests position, time and satellite ephemeris debug information
+     * from the HAL.
+     *
+     * @return ret debugData information from GNSS Hal that contains the current best
+     * known position, best known time estimate and a complete list of
+     * constellations that the device can track.
+     */
+    getDebugData() generates (DebugData debugData);
+};
diff --git a/gnss/1.0/IGnssGeofenceCallback.hal b/gnss/1.0/IGnssGeofenceCallback.hal
new file mode 100644
index 0000000..06eb62a
--- /dev/null
+++ b/gnss/1.0/IGnssGeofenceCallback.hal
@@ -0,0 +1,188 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss@1.0;
+
+/*
+ * GNSS Geofence.
+ * There are 3 states associated with a Geofence: Inside, Outside, Unknown.
+ * There are 3 transitions: ENTERED, EXITED, UNCERTAIN.
+ *
+ * An example state diagram with confidence level: 95% and Unknown time limit
+ * set as 30 secs is shown below. (confidence level and Unknown time limit are
+ * explained latter).
+ *                         ____________________________
+ *                        |       Unknown (30 secs)   |
+ *                         """"""""""""""""""""""""""""
+ *                            ^ |                  |  ^
+ *                   UNCERTAIN| |ENTERED     EXITED|  |UNCERTAIN
+ *                            | v                  v  |
+ *                        ________    EXITED     _________
+ *                       | Inside | -----------> | Outside |
+ *                       |        | <----------- |         |
+ *                        """"""""    ENTERED    """""""""
+ *
+ * Inside state: We are 95% confident that the user is inside the geofence.
+ * Outside state: We are 95% confident that the user is outside the geofence
+ * Unknown state: Rest of the time.
+ *
+ * The Unknown state is better explained with an example:
+ *
+ *                            __________
+ *                           |         c|
+ *                           |  ___     |    _______
+ *                           |  |a|     |   |   b   |
+ *                           |  """     |    """""""
+ *                           |          |
+ *                            """"""""""
+ * In the diagram above, "a" and "b" are 2 geofences and "c" is the accuracy
+ * circle reported by the GNSS subsystem. Now with regard to "b", the system is
+ * confident that the user is outside. But with regard to "a" is not confident
+ * whether it is inside or outside the geofence. If the accuracy remains the
+ * same for a sufficient period of time, the UNCERTAIN transition must be
+ * triggered with the state set to Unknown. If the accuracy improves later, an
+ * appropriate transition must be triggered.  This "sufficient period of time"
+ * is defined by the parameter in the addGeofenceArea API.
+ * In other words, Unknown state can be interpreted as a state in which the
+ * GNSS subsystem isn't confident enough that the user is either inside or
+ * outside the Geofence. It moves to Unknown state only after the expiry of the
+ * timeout.
+ *
+ * The geofence callback needs to be triggered for the ENTERED and EXITED
+ * transitions, when the GNSS system is confident that the user has entered
+ * (Inside state) or exited (Outside state) the Geofence. An implementation
+ * which uses a value of 95% as the confidence is recommended. The callback
+ * must be triggered only for the transitions requested by the
+ * addGeofenceArea method.
+ *
+ * Even though the diagram and explanation talks about states and transitions,
+ * the callee is only interested in the transistions. The states are mentioned
+ * here for illustrative purposes.
+ *
+ * Startup Scenario: When the device boots up, if an application adds geofences,
+ * and then we get an accurate GNSS location fix, it needs to trigger the
+ * appropriate (ENTERED or EXITED) transition for every Geofence it knows about.
+ * By default, all the Geofences will be in the Unknown state.
+ *
+ * When the GNSS system is unavailable, gnssGeofenceStatusCb must be
+ * called to inform the upper layers of the same. Similarly, when it becomes
+ * available the callback must be called. This is a global state while the
+ * UNKNOWN transition described above is per geofence.
+ *
+ * An important aspect to note is that users of this API (framework), will use
+ * other subsystems like wifi, sensors, cell to handle Unknown case and
+ * hopefully provide a definitive state transition to the third party
+ * application. GNSS Geofence will just be a signal indicating what the GNSS
+ * subsystem knows about the Geofence.
+ *
+ */
+
+interface IGnssGeofenceCallback {
+    enum GeofenceTransition : int32_t {
+        ENTERED   = (1 << 0L),
+        EXITED    = (1 << 1L),
+        UNCERTAIN = (1 << 2L),
+    };
+
+    enum GeofenceAvailability : int32_t {
+        UNAVAILABLE = (1 << 0L),
+        AVAILABLE   = (1 << 1L),
+    };
+
+    enum GeofenceStatus : int32_t {
+        OPERATION_SUCCESS        = 0,
+        ERROR_TOO_MANY_GEOFENCES = -100,
+        ERROR_ID_EXISTS          = -101,
+        ERROR_ID_UNKNOWN         = -102,
+        ERROR_INVALID_TRANSITION = -103,
+        ERROR_GENERIC            = -149
+    };
+
+    /*
+     * The callback associated with the geofence transition.
+     * The callback must only be called when the caller is interested in that
+     * particular transition. For instance, if the caller is interested only in
+     * ENTERED transition, then the callback must not be called with the EXITED
+     * transition.
+     *
+     * IMPORTANT: If a transition is triggered resulting in this callback, the
+     * GNSS subsystem will wake up the application processor, if its in suspend
+     * state.
+     *
+     * @param geofenceId The id associated with the addGeofenceArea.
+     * @param location The current GNSS location.
+     * @param transition Can be one of ENTERED, EXITED or UNCERTAIN.
+     * @param timestamp Timestamp when the transition was detected.
+     *
+     */
+    gnssGeofenceTransitionCb(int32_t geofenceId, GnssLocation location,
+        GeofenceTransition transition, GnssUtcTime timestamp);
+
+    /*
+     * The callback associated with the availability of the GNSS system for
+     * geofencing monitoring. If the GNSS system determines that it cannot monitor
+     * geofences because of lack of reliability or unavailability of the GNSS
+     * signals, it will call this callback with UNAVAILABLE parameter.
+     *
+     * @param status - UNAVAILABLE or AVAILABLE.
+     * @param lastLocation - Last known location.
+     */
+    gnssGeofenceStatusCb(GeofenceAvailability status, GnssLocation lastLocation);
+
+    /*
+     * The callback associated with the addGeofence call.
+     *
+     * @param geofenceId Id of the geofence.
+     * @param status Will be OPERATION_SUCCESS if the geofence
+     * add was successful. Will be ERROR_TOO_MANY_GEOFENCES if the
+     * geofence limit has been reached.
+     * Will be ERROR_ID_EXISTS if geofence with id already exists.
+     * Will be ERROR_INVALID_TRANSITION if the monitorTransition contains an
+     * invalid transition.
+     * Will be ERROR_GENERIC for other errors.
+     */
+    gnssGeofenceAddCb(int32_t geofenceId, GeofenceStatus status);
+
+    /*
+     * The callback associated with the removeGeofence call.
+     *
+     * @param geofenceId Id of the geofence.
+     * @param status Will return OPERATION_SUCCESS if successful.
+     * Will be ERROR_ID_UNKNOWN for invalid id and
+     * ERROR_GENERIC for others.
+     */
+    gnssGeofenceRemoveCb(int32_t geofenceId, GeofenceStatus status);
+
+    /*
+     * The callback associated with the pauseGeofence call.
+     *
+     * @param geofenceId Id of the geofence.
+     * @param status Will be OPERATION_SUCCESS if success.
+     * Will be ERROR_ID_UNKNOWN for invalid id. Will be
+     * ERROR_INVALID_TRANSITION when monitorTransitions is invalid.
+     * Will be ERROR_GENERIC for other err errors.
+     */
+    gnssGeofencePauseCb(int32_t geofenceId, GeofenceStatus status);
+
+    /*
+     * The callback associated with the resumeGeofence call.
+     *
+     * @param geofenceId - Id of the geofence.
+     * @param status Will be OPERATION_SUCCESS if successful.
+     * Will be ERROR_ID_UNKNOWN for invalid id and ERROR_GENERIC for others.
+     */
+    gnssGeofenceResumeCb(int32_t geofenceId, GeofenceStatus status);
+};
diff --git a/gnss/1.0/IGnssGeofencing.hal b/gnss/1.0/IGnssGeofencing.hal
new file mode 100644
index 0000000..89301f4
--- /dev/null
+++ b/gnss/1.0/IGnssGeofencing.hal
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss@1.0;
+
+import IGnssGeofenceCallback;
+
+/* Extended interface for GNSS Geofencing support */
+interface IGnssGeofencing {
+    /*
+     * Opens the geofence interface and provides the callback routines
+     * to the HAL.
+     *
+     * @param callback Handle to the IGnssGeofenceCallback interface.
+     */
+    setCallback(IGnssGeofenceCallback callback);
+
+    /*
+     * Add a geofence area. This api currently supports circular geofences.
+     *
+     * @param geofenceId The id for the geofence. If a geofence with this id
+     * already exists, an error value (ERROR_ID_EXISTS) must be returned.
+     * @param latitudeDegrees The latitude(in degrees) for the geofence lastTransition.
+     * @param longtitudeDegrees The longitude(in degrees) for the geofence lastTransition.
+     * @param radiusMeters The radius(in meters) for the geofence lastTransition.
+     * @param lastTransition The current state of the geofence. For example, if
+     * the system already knows that the user is inside the geofence, this will
+     * be set to ENTERED. In most cases, it will be UNCERTAIN.
+     * @param monitorTransitions - Which transitions to monitor. Bitwise OR of
+     * ENTERED, EXITED and UNCERTAIN.
+     * @param notificationResponsivenessMs - Defines the best-effort description
+     * of how soon must the callback be called when the transition associated
+     * with the Geofence is triggered. For instance, if set to 1000 millseconds
+     * with ENTERED, the callback must be called 1000 milliseconds within entering
+     * the geofence. This parameter is defined in milliseconds.
+     * NOTE: This is not to be confused with the rate that the GNSS is polled at.
+     * It is acceptable to dynamically vary the rate of sampling the GNSS for
+     * power-saving reasons; thus the rate of sampling may be faster or slower
+     * than this.
+     * @param unknownTimerMs - The time limit after which the UNCERTAIN transition
+     * must be triggered. This parameter is defined in milliseconds.
+     */
+    addGeofenceArea(int32_t geofenceId, double latitudeDegrees, double longitudeDegrees,
+        double radiusMeters, GeofenceTransition lastTransition,
+        int32_t monitorTransitions, uint32_t notificationResponsivenessMs,
+        uint32_t unknownTimerMs);
+
+    /*
+     * Pause monitoring a particular geofence.
+     *
+     * @param geofenceId The id for the geofence.
+     */
+    pauseGeofence(int32_t geofenceId);
+
+    /*
+     * Resume monitoring a particular geofence.
+     *
+     * @param geofenceId - The id for the geofence.
+     * @param monitorTransitions Specifies which transitions to monitor.
+     * It can be a bitwise OR of ENTERED, EXITED and
+     * UNCERTAIN. This supersedes the value associated
+     * provided in the addGeofenceArea call.
+     */
+    resumeGeofence(int32_t geofenceId, int32_t monitorTransitions);
+
+    /*
+     * Remove a geofence area. After the function returns, no notifications
+     * must be sent.
+     *
+     * @param geofenceId The id of the geofence.
+     */
+    removeGeofenceArea(int32_t geofenceId);
+};
diff --git a/gnss/1.0/IGnssMeasurement.hal b/gnss/1.0/IGnssMeasurement.hal
new file mode 100644
index 0000000..5156b32
--- /dev/null
+++ b/gnss/1.0/IGnssMeasurement.hal
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss@1.0;
+
+import IGnssMeasurementCallback;
+
+/*
+ * Extended interface for GNSS Measurements support.
+ */
+interface IGnssMeasurement {
+    enum GnssMeasurementStatus : int32_t {
+        SUCCESS = 0,
+        ERROR_ALREADY_INIT = -100,
+        ERROR_GENERIC = -101
+    };
+
+    /*
+     * Initializes the interface and registers the callback routines with the HAL.
+     * After a successful call to 'setCallback' the HAL must begin to provide updates at
+     * an average output rate of 1Hz (occasional
+     * intra-measurement time offsets in the range from 0-2000msec can be
+     * tolerated.)
+     *
+     * @param callback Handle to GnssMeasurement callback interface.
+     *
+     * @return initRet Returns SUCCESS if successful.
+     * Returns ERROR_ALREADY_INIT if a callback has already been
+     * registered without a corresponding call to 'close'.
+     * Returns ERROR_GENERIC for any other error. The HAL must
+     * not generate any other updates upon returning this error code.
+     */
+    setCallback(IGnssMeasurementCallback callback) generates (int32_t initRet);
+
+    /*
+     * Stops updates from the HAL, and unregisters the callback routines.
+     * After a call to close(), the previously registered callbacks must be
+     * considered invalid by the HAL.
+     * If close() is invoked without a previous setCallback, this function must perform
+     * no work.
+     */
+    close();
+
+};
diff --git a/gnss/1.0/IGnssMeasurementCallback.hal b/gnss/1.0/IGnssMeasurementCallback.hal
new file mode 100644
index 0000000..3650892
--- /dev/null
+++ b/gnss/1.0/IGnssMeasurementCallback.hal
@@ -0,0 +1,554 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss@1.0;
+
+/* The callback interface to report measurements from the HAL. */
+interface IGnssMeasurementCallback {
+    /*
+     * Flags to indicate what fields in GnssClock are valid.
+     */
+    enum GnssClockFlags : uint16_t {
+        /** A valid 'leap second' is stored in the data structure. */
+        HAS_LEAP_SECOND        = 1 << 0,
+        /** A valid 'time uncertainty' is stored in the data structure. */
+        HAS_TIME_UNCERTAINTY   = 1 << 1,
+        /** A valid 'full bias' is stored in the data structure. */
+        HAS_FULL_BIAS          = 1 << 2,
+        /** A valid 'bias' is stored in the data structure. */
+        HAS_BIAS               = 1 << 3,
+        /** A valid 'bias uncertainty' is stored in the data structure. */
+        HAS_BIAS_UNCERTAINTY   = 1 << 4,
+        /** A valid 'drift' is stored in the data structure. */
+        HAS_DRIFT              = 1 << 5,
+        /** A valid 'drift uncertainty' is stored in the data structure. */
+        HAS_DRIFT_UNCERTAINTY  = 1 << 6
+    };
+
+    /*
+     * Flags to indicate what fields in GnssMeasurement are valid.
+     */
+    enum GnssMeasurementFlags : uint32_t {
+        /** A valid 'snr' is stored in the data structure. */
+        HAS_SNR                        = 1 << 0,
+        /** A valid 'carrier frequency' is stored in the data structure. */
+        HAS_CARRIER_FREQUENCY          = 1 << 9,
+        /** A valid 'carrier cycles' is stored in the data structure. */
+        HAS_CARRIER_CYCLES             = 1 << 10,
+        /** A valid 'carrier phase' is stored in the data structure. */
+        HAS_CARRIER_PHASE              = 1 << 11,
+        /** A valid 'carrier phase uncertainty' is stored in the data structure. */
+        HAS_CARRIER_PHASE_UNCERTAINTY  = 1 << 12
+    };
+
+    /*
+     * Enumeration of available values for the GNSS Measurement's multipath
+     * indicator.
+     */
+    enum GnssMultipathIndicator : uint8_t {
+        /** The indicator is not available or unknown. */
+        INDICATOR_UNKNOWN      = 0,
+        /** The measurement is indicated to be affected by multipath. */
+        INDICATOR_PRESENT      = 1,
+        /** The measurement is indicated to be not affected by multipath. */
+        INDICATIOR_NOT_PRESENT = 2
+    };
+
+    /*
+     * Flags indicating the GNSS measurement state.
+     *
+     * The expected behavior here is for GNSS HAL to set all the flags that applies.
+     * For example, if the state for a satellite is only C/A code locked and bit
+     * synchronized, and there is still millisecond ambiguity, the state must be
+     * set as:
+     *
+     * STATE_CODE_LOCK | STATE_BIT_SYNC |  STATE_MSEC_AMBIGUOUS
+     *
+     * If GNSS is still searching for a satellite, the corresponding state must be
+     * set to STATE_UNKNOWN(0).
+     */
+    enum GnssMeasurementState : uint32_t {
+        STATE_UNKNOWN                = 0,
+        STATE_CODE_LOCK              = 1 << 0,
+        STATE_BIT_SYNC               = 1 << 1,
+        STATE_SUBFRAME_SYNC          = 1 << 2,
+        STATE_TOW_DECODED            = 1 << 3,
+        STATE_MSEC_AMBIGUOUS         = 1 << 4,
+        STATE_SYMBOL_SYNC            = 1 << 5,
+        STATE_GLO_STRING_SYNC        = 1 << 6,
+        STATE_GLO_TOD_DECODED        = 1 << 7,
+        STATE_BDS_D2_BIT_SYNC        = 1 << 8,
+        STATE_BDS_D2_SUBFRAME_SYNC   = 1 << 9,
+        STATE_GAL_E1BC_CODE_LOCK     = 1 << 10,
+        STATE_GAL_E1C_2ND_CODE_LOCK  = 1 << 11,
+        STATE_GAL_E1B_PAGE_SYNC      = 1 << 12,
+        STATE_SBAS_SYNC              = 1 << 13
+    };
+
+    /*
+     * Flags indicating the Accumulated Delta Range's states.
+     */
+    enum GnssAccumulatedDeltaRangeState : uint16_t {
+        ADR_STATE_UNKNOWN    = 0,
+        ADR_STATE_VALID      = 1 << 0,
+        ADR_STATE_RESET      = 1 << 1,
+        ADR_STATE_CYCLE_SLIP = 1 << 2,
+    };
+
+    /*
+     * Represents an estimate of the GNSS clock time.
+     */
+    struct GnssClock {
+        /*
+         * A set of flags indicating the validity of the fields in this data
+         * structure.
+         */
+        GnssClockFlags gnssClockFlags;
+
+        /*
+         * Leap second data.
+         * The sign of the value is defined by the following equation:
+         *      utcTimeNs = timeNs - (fullBiasNs + biasNs) - leapSecond *
+         *      1,000,000,000
+         *
+         * If this data is available, gnssClockFlags must contain
+         * HAS_LEAP_SECOND.
+         */
+        int16_t leapSecond;
+
+        /*
+         * The GNSS receiver internal clock value. This is the local hardware clock
+         * value.
+         *
+         * For local hardware clock, this value is expected to be monotonically
+         * increasing while the hardware clock remains powered on. (For the case of a
+         * HW clock that is not continuously on, see the
+         * hwClockDiscontinuityCount field). The receiver's estimate of GNSS time
+         * can be derived by subtracting the sum of fullBiasNs and biasNs (when
+         * available) from this value.
+         *
+         * This GNSS time must be the best estimate of current GNSS time
+         * that GNSS receiver can achieve.
+         *
+         * Sub-nanosecond accuracy can be provided by means of the 'biasNs' field.
+         * The value contains the timeUncertaintyNs in it.
+         *
+         * This field is mandatory.
+         */
+        int64_t timeNs;
+
+        /*
+         * 1-Sigma uncertainty associated with the clock's time in nanoseconds.
+         * The uncertainty is represented as an absolute (single sided) value.
+         *
+         * If the data is available, gnssClockFlags must contain
+         * HAS_TIME_UNCERTAINTY. Ths value is ideally zero, as the time
+         * 'latched' by timeNs is defined as the reference clock vs. which all
+         * other times (and corresponding uncertainties) are measured.
+         */
+        double timeUncertaintyNs;
+
+        /*
+         * The difference between hardware clock ('time' field) inside GNSS receiver
+         * and the true GNSS time since 0000Z, January 6, 1980, in nanoseconds.
+         *
+         * The sign of the value is defined by the following equation:
+         *      local estimate of GNSS time = timeNs - (fullBiasNs + biasNs)
+         *
+         * This value is mandatory if the receiver has estimated GNSS time. If the
+         * computed time is for a non-GNSS constellation, the time offset of that
+         * constellation to GNSS has to be applied to fill this value. The error
+         * estimate for the sum of this and the biasNs is the biasUncertaintyNs,
+         * and the caller is responsible for using this uncertainty (it can be very
+         * large before the GNSS time has been solved for.) If the data is available
+         * gnssClockFlags must contain HAS_FULL_BIAS.
+         */
+        int64_t fullBiasNs;
+
+        /*
+         * Sub-nanosecond bias.
+         * The error estimate for the sum of this and the fullBiasNs is the
+         * biasUncertaintyNs.
+         *
+         * If the data is available gnssClockFlags must contain HAS_BIAS. If GNSS
+         * has computed a position fix. This value is mandatory if the receiver has
+         * estimated GNSS time.
+         */
+        double biasNs;
+
+        /*
+         * 1-Sigma uncertainty associated with the local estimate of GNSS time (clock
+         * bias) in nanoseconds. The uncertainty is represented as an absolute
+         * (single sided) value.
+         *
+         * If the data is available gnssClockFlags must contain
+         * HAS_BIAS_UNCERTAINTY. This value is mandatory if the receiver
+         * has estimated GNSS time.
+         */
+        double biasUncertaintyNs;
+
+        /*
+         * The clock's drift in nanoseconds (per second).
+         *
+         * A positive value means that the frequency is higher than the nominal
+         * frequency, and that the (fullBiasNs + biasNs) is growing more positive
+         * over time.
+         *
+         * The value contains the 'drift uncertainty' in it.
+         * If the data is available gnssClockFlags must contain HAS_DRIFT.
+         *
+         * This value is mandatory if the receiver has estimated GNSS time.
+         */
+        double driftNsps;
+
+        /*
+         * 1-Sigma uncertainty associated with the clock's drift in nanoseconds (per
+         * second).
+         * The uncertainty is represented as an absolute (single sided) value.
+         *
+         * If the data is available gnssClockFlags must contain
+         * HAS_DRIFT_UNCERTAINTY. If GNSS has computed a position fix this
+         * field is mandatory and must be populated.
+         */
+        double driftUncertaintyNsps;
+
+        /*
+         * When there are any discontinuities in the HW clock, this field is
+         * mandatory.
+         *
+         * A "discontinuity" is meant to cover the case of a switch from one source
+         * of clock to another.  A single free-running crystal oscillator (XO)
+         * will generally not have any discontinuities, and this can be set and
+         * left at 0.
+         *
+         * If, however, the timeNs value (HW clock) is derived from a composite of
+         * sources, that is not as smooth as a typical XO, or is otherwise stopped &
+         * restarted, then this value shall be incremented each time a discontinuity
+         * occurs.  (E.g. this value can start at zero at device boot-up and
+         * increment each time there is a change in clock continuity. In the
+         * unlikely event that this value reaches full scale, rollover (not
+         * clamping) is required, such that this value continues to change, during
+         * subsequent discontinuity events.)
+         *
+         * While this number stays the same, between GnssClock reports, it can be
+         * safely assumed that the timeNs value has been running continuously, e.g.
+         * derived from a single, high quality clock (XO like, or better, that is
+         * typically used during continuous GNSS signal sampling.)
+         *
+         * It is expected, esp. during periods where there are few GNSS signals
+         * available, that the HW clock be discontinuity-free as long as possible,
+         * as this avoids the need to use (waste) a GNSS measurement to fully
+         * re-solve for the GNSS clock bias and drift, when using the accompanying
+         * measurements, from consecutive GnssData reports.
+         */
+        uint32_t hwClockDiscontinuityCount;
+
+    };
+
+    /*
+     * Represents a GNSS Measurement, it contains raw and computed information.
+     *
+     * All signal measurement information (e.g. svTime,
+     * pseudorangeRate, multipathIndicator) reported in this struct must be
+     * based on GNSS signal measurements only. You must not synthesize measurements
+     * by calculating or reporting expected measurements based on known or estimated
+     * position, velocity, or time.
+     */
+    struct GnssMeasurement{
+        /*
+         * A set of flags indicating the validity of the fields in this data
+         * structure.
+         */
+        GnssMeasurementFlags flags;
+
+        /*
+         * Satellite vehicle ID number, as defined in GnssSvInfo::svid
+         * This is a mandatory value.
+         */
+        int16_t svid;
+
+        /*
+         * Defines the constellation of the given SV.
+         */
+        GnssConstellationType constellation;
+
+        /*
+         * Time offset at which the measurement was taken in nanoseconds.
+         * The reference receiver's time is specified by GnssData::clock::timeNs.
+         *
+         * The sign of timeOffsetNs is given by the following equation:
+         *      measurement time = GnssClock::timeNs + timeOffsetNs
+         *
+         * It provides an individual time-stamp for the measurement, and allows
+         * sub-nanosecond accuracy.
+         * This is a mandatory value.
+         */
+        double timeOffsetNs;
+
+        /*
+         * Per satellite sync state. It represents the current sync state for the
+         * associated satellite.
+         * Based on the sync state, the 'received GNSS tow' field must be interpreted
+         * accordingly.
+         *
+         * This is a mandatory value.
+         */
+        GnssMeasurementState state;
+
+        /*
+         * The received GNSS Time-of-Week at the measurement time, in nanoseconds.
+         * For GNSS & QZSS, this is the received GNSS Time-of-Week at the
+         * measurement time, in nanoseconds. The value is relative to the
+         * beginning of the current GNSS week.
+         *
+         * Given the highest sync state that can be achieved, per each satellite,
+         * valid range for this field can be:
+         * Searching       : [ 0       ] : STATE_UNKNOWN
+         * C/A code lock   : [ 0 1ms   ] : STATE_CODE_LOCK set
+         * Bit sync        : [ 0 20ms  ] : STATE_BIT_SYNC set
+         * Subframe sync   : [ 0  6s   ] : STATE_SUBFRAME_SYNC set
+         * TOW decoded     : [ 0 1week ] : STATE_TOW_DECODED set
+         *
+         * Note: If there is any ambiguity in integer millisecond,
+         * GNSS_MEASUREMENT_STATE_MSEC_AMBIGUOUS must be set accordingly, in the
+         * 'state' field.
+         *
+         * This value must be populated if 'state' != STATE_UNKNOWN.
+         *
+         * For Glonass, this is the received Glonass time of day, at the
+         * measurement time in nanoseconds.
+         *
+         * Given the highest sync state that can be achieved, per each satellite,
+         * valid range for this field can be:
+         * Searching       : [ 0       ] : STATE_UNKNOWN set
+         * C/A code lock   : [ 0   1ms ] : STATE_CODE_LOCK set
+         * Symbol sync     : [ 0  10ms ] : STATE_SYMBOL_SYNC set
+         * Bit sync        : [ 0  20ms ] : STATE_BIT_SYNC set
+         * String sync     : [ 0    2s ] : STATE_GLO_STRING_SYNC set
+         * Time of day     : [ 0  1day ] : STATE_GLO_TOW_DECODED set
+         *
+         * For Beidou, this is the received Beidou time of week,
+         * at the measurement time in nanoseconds.
+         *
+         * Given the highest sync state that can be achieved, per each satellite,
+         * valid range for this field can be:
+         * Searching    : [ 0       ] : STATE_UNKNOWN set.
+         * C/A code lock: [ 0   1ms ] : STATE_CODE_LOCK set.
+         * Bit sync (D2): [ 0   2ms ] : STATE_BDS_D2_BIT_SYNC set.
+         * Bit sync (D1): [ 0  20ms ] : STATE_BIT_SYNC set.
+         * Subframe (D2): [ 0  0.6s ] : STATE_BDS_D2_SUBFRAME_SYNC set.
+         * Subframe (D1): [ 0    6s ] : STATE_SUBFRAME_SYNC set.
+         * Time of week : [ 0 1week ] : STATE_TOW_DECODED set.
+         *
+         * For Galileo, this is the received Galileo time of week,
+         * at the measurement time in nanoseconds.
+         *
+         * E1BC code lock   : [ 0  4ms ] : STATE_GAL_E1BC_CODE_LOCK set.
+         * E1C 2nd code lock: [ 0 100ms] : STATE_GAL_E1C_2ND_CODE_LOCK set.
+         * E1B page         : [ 0   2s ] : STATE_GAL_E1B_PAGE_SYNC set.
+         * Time of week     : [ 0 1week] : STATE_TOW_DECODED is set.
+         *
+         * For SBAS, this is received SBAS time, at the measurement time in
+         * nanoseconds.
+         *
+         * Given the highest sync state that can be achieved, per each satellite,
+         * valid range for this field can be:
+         * Searching    : [ 0     ] : STATE_UNKNOWN
+         * C/A code lock: [ 0 1ms ] : STATE_CODE_LOCK is set
+         * Symbol sync  : [ 0 2ms ] : STATE_SYMBOL_SYNC is set
+         * Message      : [ 0  1s ] : STATE_SBAS_SYNC is set
+         */
+        int64_t receivedSvTimeInNs;
+
+        /*
+         * 1-Sigma uncertainty of the Received GNSS Time-of-Week in nanoseconds.
+         *
+         * This value must be populated if 'state' != STATE_UNKNOWN.
+         */
+        int64_t receivedSvTimeUncertaintyInNs;
+
+        /*
+         * Carrier-to-noise density in dB-Hz, typically in the range [0, 63].
+         * It contains the measured C/N0 value for the signal at the antenna port.
+         *
+         * This is a mandatory value.
+         */
+        double cN0DbHz;
+
+        /*
+         * Pseudorange rate at the timestamp in m/s. The correction of a given
+         * Pseudorange Rate value includes corrections for receiver and satellite
+         * clock frequency errors. Ensure that this field is independent (see
+         * comment at top of GnssMeasurement struct.)
+         *
+         * It is mandatory to provide the 'uncorrected' 'pseudorange rate', and
+         * provide GnssClock's 'drift' field as well. When providing the
+         * uncorrected pseudorange rate, do not apply the corrections described above.)
+         *
+         * The value includes the 'pseudorange rate uncertainty' in it.
+         * A positive 'uncorrected' value indicates that the SV is moving away from
+         * the receiver.
+         *
+         * The sign of the 'uncorrected' 'pseudorange rate' and its relation to the
+         * sign of 'doppler shift' is given by the equation:
+         *      pseudorange rate = -k * doppler shift   (where k is a constant)
+         *
+         * This must be the most accurate pseudorange rate available, based on
+         * fresh signal measurements from this channel.
+         *
+         * It is mandatory that this value be provided at typical carrier phase PRR
+         * quality (few cm/sec per second of uncertainty, or better) - when signals
+         * are sufficiently strong & stable, e.g. signals from a GNSS simulator at >=
+         * 35 dB-Hz.
+         */
+        double pseudorangeRateMps;
+
+        /*
+         * 1-Sigma uncertainty of the pseudorangeRateMps.
+         * The uncertainty is represented as an absolute (single sided) value.
+         *
+         * This is a mandatory value.
+         */
+        double pseudorangeRateUncertaintyMps;
+
+        /*
+         * Accumulated delta range's state. It indicates whether ADR is reset or
+         * there is a cycle slip(indicating loss of lock).
+         *
+         * This is a mandatory value.
+         */
+        GnssAccumulatedDeltaRangeState accumulatedDeltaRangeState;
+
+        /*
+         * Accumulated delta range since the last channel reset in meters.
+         * A positive value indicates that the SV is moving away from the receiver.
+         *
+         * The sign of the 'accumulated delta range' and its relation to the sign of
+         * 'carrier phase' is given by the equation:
+         * accumulated delta range = -k * carrier phase (where k is a constant)
+         *
+         * This value must be populated if 'accumulated delta range state' !=
+         * ADR_STATE_UNKNOWN.
+         * However, it is expected that the data is only accurate when:
+         *      'accumulated delta range state' == ADR_STATE_VALID.
+         */
+        double accumulatedDeltaRangeM;
+
+        /*
+         * 1-Sigma uncertainty of the accumulated delta range in meters.
+         * This value must be populated if 'accumulated delta range state' !=
+         * ADR_STATE_UNKNOWN.
+         */
+        double accumulatedDeltaRangeUncertaintyM;
+
+        /*
+         * Carrier frequency at which codes and messages are modulated, it can
+         * be L1 or L2. If the field is not set, the carrier frequency is
+         * assumed to be L1.
+         *
+         * If the data is available, gnssClockFlags must contain
+         * HAS_CARRIER_FREQUENCY.
+         */
+        float carrierFrequencyHz;
+
+        /*
+         * The number of full carrier cycles between the satellite and the
+         * receiver. The reference frequency is given by the field
+         * 'carrierFrequencyHz'. Indications of possible cycle slips and
+         * resets in the accumulation of this value can be inferred from the
+         * accumulatedDeltaRangeState flags.
+         *
+         * If the data is available, gnssClockFlags must contain
+         * HAS_CARRIER_CYCLES.
+         */
+        int64_t carrierCycles;
+
+        /*
+         * The RF phase detected by the receiver, in the range [0.0, 1.0].
+         * This is usually the fractional part of the complete carrier phase
+         * measurement.
+         *
+         * The reference frequency is given by the field 'carrierFrequencyHz'.
+         * The value contains the 'carrier-phase uncertainty' in it.
+         *
+         * If the data is available, gnssClockFlags must contain
+         * HAS_CARRIER_PHASE.
+         */
+        double carrierPhase;
+
+        /*
+         * 1-Sigma uncertainty of the carrier-phase.
+         * If the data is available, gnssClockFlags must contain
+         * HAS_CARRIER_PHASE_UNCERTAINTY.
+         */
+        double carrierPhaseUncertainty;
+
+        /*
+         * An enumeration that indicates the 'multipath' state of the event.
+         *
+         * The multipath Indicator is intended to report the presence of overlapping
+         * signals that manifest as distorted correlation peaks.
+         *
+         * - if there is a distorted correlation peak shape, report that multipath
+         *   is MULTIPATH_INDICATOR_PRESENT.
+         * - if there is no distorted correlation peak shape, report
+         *   MULTIPATH_INDICATOR_NOT_PRESENT
+         * - if signals are too weak to discern this information, report
+         *   MULTIPATH_INDICATOR_UNKNOWN
+         *
+         * Example: when doing the standardized overlapping Multipath Performance
+         * test (3GPP TS 34.171) the Multipath indicator must report
+         * MULTIPATH_INDICATOR_PRESENT for those signals that are tracked, and
+         * contain multipath, and MULTIPATH_INDICATOR_NOT_PRESENT for those
+         * signals that are tracked and do not contain multipath.
+         */
+        GnssMultipathIndicator multipathIndicator;
+
+        /*
+         * Signal-to-noise ratio at correlator output in dB.
+         * If the data is available, gnssClockFlags must contain MEASUREMENT_HAS_SNR.
+         * This is the power ratio of the "correlation peak height above the
+         * observed noise floor" to "the noise RMS".
+         */
+        double snrDb;
+    };
+
+    /*
+     * Represents a reading of GNSS measurements. For devices where GnssSystemInfo's
+     * yearOfHw is set to 2016+, it is mandatory that these be provided, on
+     * request, when the GNSS receiver is searching/tracking signals.
+     *
+     * - Reporting of GNSS constellation measurements is mandatory.
+     * - Reporting of all tracked constellations are encouraged.
+     */
+    struct GnssData {
+        /* Number of GnssMeasurement elements. */
+        uint32_t measurementCount;
+
+        /* The array of measurements. */
+        GnssMeasurement[ConstS32:GNSS_MAX_MEASUREMENT] measurements;
+
+        /** The GNSS clock time reading. */
+        GnssClock clock;
+    };
+
+    /*
+     * Callback for the hal to pass a GnssData structure back to the client.
+     *
+     * @param data Contains a reading of GNSS measurements.
+     */
+    GnssMeasurementCb(GnssData data);
+};
diff --git a/gnss/1.0/IGnssNavigationMessage.hal b/gnss/1.0/IGnssNavigationMessage.hal
new file mode 100644
index 0000000..d59b538
--- /dev/null
+++ b/gnss/1.0/IGnssNavigationMessage.hal
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss@1.0;
+
+import IGnssNavigationMessageCallback;
+
+/*
+ * Extended interface for GNSS navigation message reporting support.
+ */
+interface IGnssNavigationMessage {
+    enum GnssNavigationMessageStatus : int32_t {
+        SUCCESS = 0,
+        ERROR_ALREADY_INIT = -100,
+        ERROR_GENERIC = -101
+    };
+
+    /*
+     * Initializes the interface and registers the callback routines with the HAL.
+     * After a successful call to 'setCallback' the HAL must begin to provide updates as
+     * they become available.
+     * @param callback handle to IGnssNavigationMessageCallack interface.
+     *
+     * @return initRet Returns SUCCESS if the operation
+     * is successful.
+     * Returns ERROR_ALREADY_INIT if a callback has
+     * already been registered without a corresponding call to close().
+     * Returns ERROR_GENERIC if any other error occurred. It is
+     * expected that the HAL will not generate any updates upon returning
+     * this error code.
+     */
+     setCallback(IGnssNavigationMessageCallback callback) generates (int32_t initRet);
+
+    /*
+     * Stops updates from the HAL, and unregisters the callback routines.
+     * After a call to close(), the previously registered callbacks must be
+     * considered invalid by the HAL.
+     * If close() is invoked without a previous setCallback, this function must perform
+     * no work.
+     */
+    close();
+};
diff --git a/gnss/1.0/IGnssNavigationMessageCallback.hal b/gnss/1.0/IGnssNavigationMessageCallback.hal
new file mode 100644
index 0000000..a714fd7
--- /dev/null
+++ b/gnss/1.0/IGnssNavigationMessageCallback.hal
@@ -0,0 +1,166 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss@1.0;
+
+/** Represents a GNSS navigation message (or a fragment of it). */
+interface IGnssNavigationMessageCallback {
+    /*
+     * Enumeration of available values to indicate the GNSS Navigation message
+     * types.
+     *
+     * For convenience, first byte is the GnssConstellationType on which that signal
+     * is typically transmitted.
+     */
+    enum GnssNavigationMessageType : int16_t {
+        TYPE_UNKNOWN    = 0,
+        /** GNSS L1 C/A message contained in the structure.  */
+        GNSS_L1CA       = 0x0101,
+        /** GNSS L2-CNAV message contained in the structure. */
+        GNSS_L2CNAV     = 0x0102,
+        /** GNSS L5-CNAV message contained in the structure. */
+        GNSS_L5CNAV     = 0x0103,
+        /** GNSS CNAV-2 message contained in the structure. */
+        GNSS_CNAV2      = 0x0104,
+        /** Glonass L1 CA message contained in the structure. */
+        GLO_L1CA        = 0x0301,
+        /** Beidou D1 message contained in the structure. */
+        BDS_D1          = 0x0501,
+        /** Beidou D2 message contained in the structure. */
+        BDS_D2          = 0x0502,
+        /** Galileo I/NAV message contained in the structure. */
+        GAL_I           = 0x0601,
+        /** Galileo F/NAV message contained in the structure. */
+        GAL_F           = 0x0602
+    };
+
+    /*
+     * Status of Navigation Message
+     * When a message is received properly without any parity error in its
+     * navigation words, the status must be set to PARITY_PASSED. But if a message is
+     * received with words that failed parity check, but GNSS is able to correct
+     * those words, the status must be set to PARITY_REBUILT.
+     * No need to send any navigation message that contains words with parity error
+     * and cannot be corrected.
+     */
+    enum NavigationMessageStatus : uint16_t {
+        PARITY_PASSED  = (1 << 0),
+        PARITY_REBUILT = (1 << 1),
+        STATUS_UNKOWN  = 0
+    };
+
+    struct GnssNavigationMessage {
+        /*
+         * Satellite vehicle ID number, as defined in GnssSvInfo::svid
+         * This is a mandatory value.
+         */
+        int16_t svid;
+
+        /*
+         * The type of message contained in the structure.
+         * This is a mandatory value.
+         */
+        GnssNavigationMessageType type;
+
+        /*
+         * The status of the received navigation message.
+         * No need to send any navigation message that contains words with parity
+         * error and cannot be corrected.
+         */
+        NavigationMessageStatus status;
+
+        /*
+         * Message identifier. It provides an index so the complete Navigation
+         * Message can be assembled.
+         *
+         * - For GNSS L1 C/A subframe 4 and 5, this value corresponds to the 'frame
+         *   id' of the navigation message, in the range of 1-25 (Subframe 1, 2, 3
+         *   does not contain a 'frame id' and this value can be set to -1.)
+         *
+         * - For Glonass L1 C/A, this refers to the frame ID, in the range of 1-5.
+         *
+         * - For BeiDou D1, this refers to the frame number in the range of 1-24
+         *
+         * - For Beidou D2, this refers to the frame number, in the range of 1-120
+         *
+         * - For Galileo F/NAV nominal frame structure, this refers to the subframe
+         *   number, in the range of 1-12
+         *
+         * - For Galileo I/NAV nominal frame structure, this refers to the subframe
+         *   number in the range of 1-24
+         */
+        int16_t messageId;
+
+        /*
+         * Sub-message identifier. If required by the message 'type', this value
+         * contains a sub-index within the current message (or frame) that is being
+         * transmitted.
+         *
+         * - For GNSS L1 C/A, BeiDou D1 & BeiDou D2, the submessage id corresponds to
+         *   the subframe number of the navigation message, in the range of 1-5.
+         *
+         * - For Glonass L1 C/A, this refers to the String number, in the range from
+         *   1-15
+         *
+         * - For Galileo F/NAV, this refers to the page type in the range 1-6
+         *
+         * - For Galileo I/NAV, this refers to the word type in the range 1-10+
+         */
+        int16_t submessageId;
+
+        /*
+         * The data of the reported GNSS message. The bytes (or words) are specified
+         * using big endian format (MSB first). The data is stored and decoded
+         * in a server for research purposes.
+         *
+         * - For GNSS L1 C/A, Beidou D1 & Beidou D2, each subframe contains 10 30-bit
+         *   words. Each word (30 bits) must fit into the last 30 bits in a
+         *   4-byte word (skip B31 and B32), with MSB first, for a total of 40
+         *   bytes, covering a time period of 6, 6, and 0.6 seconds, respectively.
+         *   The standard followed is 1995 SPS Signal specification.
+         *
+         * - For Glonass L1 C/A, each string contains 85 data bits, including the
+         *   checksum.  These bits must fit into 11 bytes, with MSB first (skip
+         *   B86-B88), covering a time period of 2 seconds.
+         *   The standard followed is Glonass Interface Control Document Edition 5.1.
+         *
+         * - For Galileo F/NAV, each word consists of 238-bit (sync & tail symbols
+         *   excluded). Each word must fit into 30-bytes, with MSB first (skip
+         *   B239, B240), covering a time period of 10 seconds. The standard
+         *   followed is European GNSS(Galileo) Signal in Space Interface
+         *   Control Document Issue 1.2.
+         *
+         * - For Galileo I/NAV, each page contains 2 page parts, even and odd, with
+         *   a total of 2x114 = 228 bits, (sync & tail excluded) that must fit
+         *   into 29 bytes, with MSB first (skip B229-B232). The standard followed
+         *   is same as above.
+         *
+         * TODO(b/32022567): Describe this relationship with data to the VTS
+         * via custom annotations and plug in a VTS test to verify that the data
+         * correctly follows the standard.
+         *
+         */
+        vec<uint8_t> data;
+    };
+
+    /*
+     * The callback to report an available fragment of a GNSS navigation messages
+     * from the HAL.
+     *
+     * @param message - The GNSS navigation submessage/subframe representation.
+     */
+     gnssNavigationMessageCb(GnssNavigationMessage message);
+};
diff --git a/gnss/1.0/IGnssNi.hal b/gnss/1.0/IGnssNi.hal
new file mode 100644
index 0000000..c823bf0
--- /dev/null
+++ b/gnss/1.0/IGnssNi.hal
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss@1.0;
+import IGnssNiCallback;
+
+/*
+ * Extended interface for Network-initiated (NI) support. This interface is used
+ * to respond to NI notifications originating from the HAL.
+ */
+interface IGnssNi {
+    /*
+     * Registers the callbacks for HAL to use.
+     *
+     * @param callback handle to IGnssNiCallback interface.
+     */
+    setCallback(IGnssNiCallback callback);
+
+    /*
+     * Sends a response to HAL.
+     *
+     * @param notifId An ID generated by HAL to associate NI notifications and
+     * framework responses.
+     * @param userResponse A GNSS Ni response indicating if the notification was
+     * accepted, denied or not responded to.
+     */
+    respond(int32_t notifId, GnssUserResponseType userResponse);
+};
diff --git a/gnss/1.0/IGnssNiCallback.hal b/gnss/1.0/IGnssNiCallback.hal
new file mode 100644
index 0000000..c696a92
--- /dev/null
+++ b/gnss/1.0/IGnssNiCallback.hal
@@ -0,0 +1,123 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss@1.0;
+
+/* GNSS Network Initiated callback interface. */
+interface IGnssNiCallback {
+    /*
+     * GnssNiType constants
+     */
+    enum GnssNiType : uint32_t {
+        VOICE           = 1,
+        UMTS_SUPL       = 2,
+        UMTS_CTRL_PLANE = 3
+    };
+
+    /*
+     * GnssNiNotifyFlags constants
+     */
+    enum GnssNiNotifyFlags : uint32_t {
+        /** NI requires notification */
+        NEED_NOTIFY      = 0x0001,
+        /** NI requires verification */
+        NEED_VERIFY      = 0x0002,
+        /** NI requires privacy override, no notification/minimal trace */
+        PRIVACY_OVERRIDE = 0x0004,
+    };
+
+    /*
+     * GNSS NI responses, used to define the response in
+     * NI structures
+     */
+    enum GnssUserResponseType : int32_t {
+        RESPONSE_ACCEPT  = 1,
+        RESPONSE_DENY    = 2,
+        RESPONSE_NORESP  = 3,
+    };
+
+    /*
+     * NI data encoding scheme
+     */
+    enum GnssNiEncodingType : int32_t {
+        ENC_NONE              = 0,
+        ENC_SUPL_GSM_DEFAULT  = 1,
+        ENC_SUPL_UTF8         = 2,
+        ENC_SUPL_UCS2         = 3,
+        ENC_UNKNOWN           = -1,
+    };
+
+    /** Represents an NI request */
+    struct GnssNiNotification{
+        /*
+         * An ID generated by HAL to associate NI notifications and UI
+         * responses.
+         */
+        int32_t notificationId;
+
+        /*
+         * A type used to distinguish different categories of NI
+         * events, such as VOICE, UMTS_SUPL etc.
+         */
+        GnssNiType niType;
+
+        /*
+         * Notification/verification options, combinations of GnssNiNotifyFlags
+         * constants.
+         */
+        GnssNiNotifyFlags notifyFlags;
+
+        /*
+         * Timeout period to wait for user response.
+         * Set to 0 for no timeout limit. Specified in seconds.
+         */
+        uint32_t timeoutSec;
+
+        /*
+         * Default response when timeout.
+         */
+        GnssUserResponseType defaultResponse;
+
+        /*
+         * String representing the requester of the network inititated location
+         * request.
+         */
+        string requestorId;
+
+        /*
+         * Notification message. String representing the service(for eg. SUPL-service)
+         * who sent the network initiated location request.
+         */
+        string notificationMessage;
+
+        /*
+         * requestorId decoding scheme.
+         */
+        GnssNiEncodingType requestorIdEncoding;
+
+        /*
+         * notificationId decoding scheme
+         */
+        GnssNiEncodingType notificationIdEncoding;
+    };
+
+    /*
+     * Callback with a network initiated request.
+     *
+     * @param notification network initiated request.
+     */
+    niNotifyCb(GnssNiNotification notification);
+};
diff --git a/gnss/1.0/IGnssXtra.hal b/gnss/1.0/IGnssXtra.hal
new file mode 100644
index 0000000..5222fde
--- /dev/null
+++ b/gnss/1.0/IGnssXtra.hal
@@ -0,0 +1,27 @@
+package android.hardware.gnss@1.0;
+import IGnssXtraCallback;
+
+/*
+ * This interface is used by the GNSS HAL to request the framework
+ * to download XTRA data.
+ */
+interface IGnssXtra {
+    /*
+     * Opens the XTRA interface and provides the callback routines
+     * to the implementation of this interface.
+     *
+     * @param callback Handle to the IGnssXtraCallback interface.
+     *
+     * @return success True if the operation is successful.
+     */
+    setCallback(IGnssXtraCallback callback) generates (bool success);
+
+    /*
+     * Inject the downloaded XTRA data into the GNSS receiver.
+     *
+     * @param xtraData GNSS XTRA data.
+     *
+     * @return success True if the operation is successful.
+     */
+    injectXtraData(string xtraData) generates (bool success);
+};
diff --git a/gnss/1.0/IGnssXtraCallback.hal b/gnss/1.0/IGnssXtraCallback.hal
new file mode 100644
index 0000000..42df082
--- /dev/null
+++ b/gnss/1.0/IGnssXtraCallback.hal
@@ -0,0 +1,12 @@
+package android.hardware.gnss@1.0;
+
+/*
+ * This interface is used by the GNSS HAL to request download of XTRA data.
+ */
+interface IGnssXtraCallback {
+   /*
+    * Callback to request the client to download XTRA data. The client should
+    * download XTRA data and inject it by calling injectXtraData().
+    */
+   downloadRequestCb();
+};
diff --git a/gnss/1.0/types.hal b/gnss/1.0/types.hal
new file mode 100644
index 0000000..3120648
--- /dev/null
+++ b/gnss/1.0/types.hal
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss@1.0;
+
+enum ConstS32 : int32_t {
+/** Maximum number of SVs for gnssSvStatusCb(). */
+    GNSS_MAX_SVS = 64,
+
+/* Maximum number of Measurements in gnssMeasurementCb(). */
+    GNSS_MAX_MEASUREMENT = 64,
+};
+
+/* Milliseconds since January 1, 1970 */
+typedef int64_t GnssUtcTime;
+
+/*
+ * Constellation type of GnssSvInfo
+ */
+enum GnssConstellationType : uint8_t {
+    UNKNOWN = 0,
+    GNSS     = 1,
+    SBAS    = 2,
+    GLONASS = 3,
+    QZSS    = 4,
+    BEIDOU  = 5,
+    GALILEO = 6,
+};
+
+/* Represents a location. */
+struct GnssLocation {
+    /* Contains GnssLocationFlags bits. */
+    uint16_t gnssLocationFlags;
+
+    /* Represents latitude in degrees. */
+    double latitude;
+
+    /* Represents longitude in degrees. */
+    double longitude;
+
+    /*
+     * Represents altitude in meters above the WGS 84 reference ellipsoid.
+     */
+    double altitude;
+
+    /* Represents speed in meters per second. */
+    float speedMetersperSec;
+
+    /* Represents heading in degrees. */
+    float bearingDegrees;
+
+    /* Represents expected accuracy in meters. */
+    float accuracyMeters;
+
+    /* Timestamp for the location fix. */
+    GnssUtcTime timestamp;
+
+};
diff --git a/graphics/allocator/2.0/default/Android.bp b/graphics/allocator/2.0/default/Android.bp
index 9a24773..8eac8f5 100644
--- a/graphics/allocator/2.0/default/Android.bp
+++ b/graphics/allocator/2.0/default/Android.bp
@@ -15,6 +15,21 @@
     ],
 }
 
+cc_binary {
+    name: "android.hardware.graphics.allocator@2.0-service",
+    relative_install_path: "hw",
+    srcs: ["service.cpp"],
+    init_rc: ["android.hardware.graphics.allocator@2.0-service.rc"],
+
+    shared_libs: [
+        "android.hardware.graphics.allocator@2.0",
+        "libhidl",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+    ],
+}
+
 cc_library_static {
     name: "libgralloc1-adapter",
     srcs: ["gralloc1-adapter.c"],
diff --git a/graphics/allocator/2.0/default/android.hardware.graphics.allocator@2.0-service.rc b/graphics/allocator/2.0/default/android.hardware.graphics.allocator@2.0-service.rc
new file mode 100644
index 0000000..8bb0d85
--- /dev/null
+++ b/graphics/allocator/2.0/default/android.hardware.graphics.allocator@2.0-service.rc
@@ -0,0 +1,5 @@
+service gralloc-2-0 /system/bin/hw/android.hardware.graphics.allocator@2.0-service
+    class hal
+    user system
+    group graphics drmrpc readproc
+    onrestart restart surfaceflinger
diff --git a/graphics/allocator/2.0/default/service.cpp b/graphics/allocator/2.0/default/service.cpp
new file mode 100644
index 0000000..fd89aa8
--- /dev/null
+++ b/graphics/allocator/2.0/default/service.cpp
@@ -0,0 +1,51 @@
+/*
+ * 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 "GrallocService"
+
+#include <android/hardware/graphics/allocator/2.0/IAllocator.h>
+#include <hwbinder/IPCThreadState.h>
+#include <hwbinder/ProcessState.h>
+#include <utils/StrongPointer.h>
+
+using android::sp;
+using android::hardware::IPCThreadState;
+using android::hardware::ProcessState;
+using android::hardware::graphics::allocator::V2_0::IAllocator;
+
+int main()
+{
+    const char instance[] = "gralloc";
+
+    ALOGI("Service is starting.");
+
+    sp<IAllocator> service = IAllocator::getService(instance,
+            true /* getStub */);
+    if (service == nullptr) {
+        ALOGI("getService returned NULL");
+        return -1;
+    }
+
+    LOG_FATAL_IF(service->isRemote(), "Service is REMOTE!");
+
+    service->registerAsService(instance);
+
+    ProcessState::self()->setThreadPoolMaxThreadCount(0);
+    ProcessState::self()->startThreadPool();
+    IPCThreadState::self()->joinThreadPool();
+
+    return 0;
+}
diff --git a/graphics/composer/2.1/default/Android.bp b/graphics/composer/2.1/default/Android.bp
index f91c9a2..6936347 100644
--- a/graphics/composer/2.1/default/Android.bp
+++ b/graphics/composer/2.1/default/Android.bp
@@ -14,3 +14,24 @@
         "libutils",
     ],
 }
+
+cc_binary {
+    name: "android.hardware.graphics.composer@2.1-service",
+    relative_install_path: "hw",
+    srcs: ["service.cpp", "Hwc.cpp"],
+    cppflags: ["-DBINDERIZED"],
+    init_rc: ["android.hardware.graphics.composer@2.1-service.rc"],
+
+    shared_libs: [
+        "android.hardware.graphics.allocator@2.0",
+        "android.hardware.graphics.composer@2.1",
+        "libbase",
+        "libbinder",
+        "libcutils",
+        "libhardware",
+        "libhidl",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+    ],
+}
diff --git a/graphics/composer/2.1/default/Hwc.cpp b/graphics/composer/2.1/default/Hwc.cpp
index 09c62f0..d45a955 100644
--- a/graphics/composer/2.1/default/Hwc.cpp
+++ b/graphics/composer/2.1/default/Hwc.cpp
@@ -698,6 +698,14 @@
 Return<Error> HwcHal::destroyLayer(Display display, Layer layer)
 {
     auto error = mDispatch.destroyLayer(mDevice, display, layer);
+    if (error == HWC2_ERROR_NONE) {
+        std::lock_guard<std::mutex> lock(mDisplayMutex);
+
+        auto dpy = mDisplays.find(display);
+        dpy->second.LayerBuffers.erase(layer);
+        dpy->second.LayerSidebandStreams.erase(layer);
+    }
+
     return static_cast<Error>(error);
 }
 
diff --git a/graphics/composer/2.1/default/android.hardware.graphics.composer@2.1-service.rc b/graphics/composer/2.1/default/android.hardware.graphics.composer@2.1-service.rc
new file mode 100644
index 0000000..fc21d59
--- /dev/null
+++ b/graphics/composer/2.1/default/android.hardware.graphics.composer@2.1-service.rc
@@ -0,0 +1,5 @@
+service hwcomposer-2-1 /system/bin/hw/android.hardware.graphics.composer@2.1-service
+    class hal
+    user system
+    group graphics drmrpc readproc
+    onrestart restart surfaceflinger
diff --git a/graphics/composer/2.1/default/service.cpp b/graphics/composer/2.1/default/service.cpp
new file mode 100644
index 0000000..0384a53
--- /dev/null
+++ b/graphics/composer/2.1/default/service.cpp
@@ -0,0 +1,56 @@
+/*
+ * 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 "HWComposerService"
+
+#include <binder/ProcessState.h>
+#include <hwbinder/IPCThreadState.h>
+#include <hwbinder/ProcessState.h>
+#include <utils/StrongPointer.h>
+#include "Hwc.h"
+
+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;
+
+int main()
+{
+    const char instance[] = "hwcomposer";
+
+    ALOGI("Service is starting.");
+
+    sp<IComposer> service = HIDL_FETCH_IComposer(instance);
+    if (service == nullptr) {
+        ALOGI("getService returned NULL");
+        return -1;
+    }
+
+    LOG_FATAL_IF(service->isRemote(), "Service is REMOTE!");
+
+    service->registerAsService(instance);
+
+    // the conventional HAL might start binder services
+    android::ProcessState::self()->setThreadPoolMaxThreadCount(4);
+    android::ProcessState::self()->startThreadPool();
+
+    ProcessState::self()->setThreadPoolMaxThreadCount(0);
+    ProcessState::self()->startThreadPool();
+    IPCThreadState::self()->joinThreadPool();
+
+    return 0;
+}
diff --git a/light/2.0/default/service.cpp b/light/2.0/default/service.cpp
index 582d224..e446878 100644
--- a/light/2.0/default/service.cpp
+++ b/light/2.0/default/service.cpp
@@ -27,11 +27,11 @@
     ALOGI("Retrieving default implementation of instance %s.",
           instance);
 
-    android::sp<ILight> service = ILight::getService(instance, true);
+    android::sp<ILight> service = ILight::getService(instance, true /* getStub */);
 
     if (service.get() == nullptr) {
         ALOGE("ILight::getService returned NULL, exiting");
-        return -1;
+        return EXIT_FAILURE;
     }
 
     LOG_FATAL_IF(service->isRemote(), "Implementation is REMOTE!");
diff --git a/memtrack/1.0/default/Android.bp b/memtrack/1.0/default/Android.bp
index 50d2318..c6ab6b9 100644
--- a/memtrack/1.0/default/Android.bp
+++ b/memtrack/1.0/default/Android.bp
@@ -32,7 +32,6 @@
 cc_binary {
     relative_install_path: "hw",
     name: "android.hardware.memtrack@1.0-service",
-    init_rc: ["android.hardware.memtrack@1.0-service.rc"],
     srcs: ["service.cpp"],
 
     shared_libs: [
diff --git a/memtrack/1.0/default/android.hardware.memtrack@1.0-service.rc b/memtrack/1.0/default/android.hardware.memtrack@1.0-service.rc
deleted file mode 100644
index 14e7d00..0000000
--- a/memtrack/1.0/default/android.hardware.memtrack@1.0-service.rc
+++ /dev/null
@@ -1,4 +0,0 @@
-service memtrack-hal-1-0 /system/bin/hw/android.hardware.memtrack@1.0-service
-    class hal
-    user system
-    group system
diff --git a/nfc/1.0/default/service.cpp b/nfc/1.0/default/service.cpp
index 8952052..32f9c28 100644
--- a/nfc/1.0/default/service.cpp
+++ b/nfc/1.0/default/service.cpp
@@ -1,44 +1,13 @@
 #define LOG_TAG "android.hardware.nfc@1.0-service"
-#include <utils/Log.h>
-
-#include <iostream>
-#include <unistd.h>
 
 #include <android/hardware/nfc/1.0/INfc.h>
 
-#include <hidl/IServiceManager.h>
-#include <hwbinder/IPCThreadState.h>
-#include <hwbinder/ProcessState.h>
-#include <utils/Errors.h>
-#include <utils/StrongPointer.h>
-
-using android::sp;
-
-// libhwbinder:
-using android::hardware::IPCThreadState;
-using android::hardware::ProcessState;
+#include <hidl/LegacySupport.h>
 
 // Generated HIDL files
 using android::hardware::nfc::V1_0::INfc;
+using android::hardware::defaultPassthroughServiceImplementation;
 
 int main() {
-    ALOGI("Service is starting.");
-    const char instance[] = "nfc_nci";
-    ALOGI("Retrieving default implementation of instance %s.",
-          instance);
-    android::sp<INfc> service = INfc::getService(instance, true);
-    if (service.get() == nullptr) {
-        ALOGE("INfc::getService returned NULL, exiting");
-        return -1;
-    }
-    ALOGI("Default implementation using %s is %s",
-          instance, (service->isRemote() ? "REMOTE" : "LOCAL"));
-    LOG_FATAL_IF(service->isRemote(), "Implementation is REMOTE!");
-    ALOGI("Registering instance %s.", instance);
-    service->registerAsService("nfc_nci");
-    ALOGI("Ready.");
-
-    ProcessState::self()->setThreadPoolMaxThreadCount(0);
-    ProcessState::self()->startThreadPool();
-    IPCThreadState::self()->joinThreadPool();
+    return defaultPassthroughServiceImplementation<INfc>("nfc_nci");
 }
diff --git a/nfc/1.0/vts/Nfc.vts b/nfc/1.0/vts/Nfc.vts
index 8c18653..1f50698 100644
--- a/nfc/1.0/vts/Nfc.vts
+++ b/nfc/1.0/vts/Nfc.vts
@@ -1,7 +1,6 @@
 component_class: HAL_HIDL
 component_type_version: 1.0
 component_name: "INfc"
-component_type: NFC
 
 package: "android.hardware.nfc"
 
diff --git a/nfc/1.0/vts/NfcClientCallback.vts b/nfc/1.0/vts/NfcClientCallback.vts
index e468935..e2a3e5b 100644
--- a/nfc/1.0/vts/NfcClientCallback.vts
+++ b/nfc/1.0/vts/NfcClientCallback.vts
@@ -1,7 +1,6 @@
 component_class: HAL_HIDL
 component_type_version: 1.0
 component_name: "INfcClientCallback"
-component_type: NFC
 
 package: "android.hardware.nfc"
 
diff --git a/nfc/1.0/vts/types.vts b/nfc/1.0/vts/types.vts
index f56ddf1..969a8af 100644
--- a/nfc/1.0/vts/types.vts
+++ b/nfc/1.0/vts/types.vts
@@ -1,7 +1,6 @@
 component_class: HAL_HIDL
 component_type_version: 1.0
 component_name: "types"
-component_type: NFC
 
 package: "android.hardware.nfc"
 
diff --git a/soundtrigger/2.0/ISoundTriggerHw.hal b/soundtrigger/2.0/ISoundTriggerHw.hal
index a1be85d..cf35ef1 100644
--- a/soundtrigger/2.0/ISoundTriggerHw.hal
+++ b/soundtrigger/2.0/ISoundTriggerHw.hal
@@ -159,6 +159,34 @@
             generates (int32_t retval, SoundModelHandle modelHandle);
 
     /*
+     * Load a key phrase sound model. Once loaded, recognition of this model can
+     * be started and stopped. Only one active recognition per model at a time.
+     * The SoundTrigger service must handle concurrent recognition requests by
+     * different users/applications on the same model.
+     * The implementation returns a unique handle used by other functions
+     * (unloadSoundModel(), startRecognition(), etc...
+     * @param soundModel A PhraseSoundModel structure describing the sound model
+     *                   to load.
+     * @param callback The callback interface on which the soundmodelCallback()
+     *                 method will be called upon completion.
+     * @param cookie The value of the cookie argument passed to the completion
+     *               callback. This unique context information is assigned and
+     *               used only by the framework.
+     * @return retval Operation completion status: 0 in case of success,
+     *                -EINVAL in case of invalid sound model (e.g 0 data size),
+     *                -ENOSYS in case of invalid operation (e.g max number of
+     *                models exceeded),
+     *                -ENOMEM in case of memory allocation failure,
+     *                -ENODEV in case of initialization error.
+     * @return modelHandle A unique handle assigned by the HAL for use by the
+     *                framework when controlling activity for this sound model.
+     */
+    loadPhraseSoundModel(PhraseSoundModel soundModel,
+                   ISoundTriggerHwCallback callback,
+                   CallbackCookie cookie)
+            generates (int32_t retval, SoundModelHandle modelHandle);
+
+    /*
      * Unload a sound model. A sound model may be unloaded to make room for a
      * new one to overcome implementation limitations.
      * @param modelHandle the handle of the sound model to unload
diff --git a/soundtrigger/2.0/ISoundTriggerHwCallback.hal b/soundtrigger/2.0/ISoundTriggerHwCallback.hal
index 294d451..c6555f6 100644
--- a/soundtrigger/2.0/ISoundTriggerHwCallback.hal
+++ b/soundtrigger/2.0/ISoundTriggerHwCallback.hal
@@ -92,6 +92,17 @@
      *               started (see ISoundtriggerHw.startRecognition()
      */
     recognitionCallback(RecognitionEvent event, CallbackCookie cookie);
+
+    /*
+     * Callback method called by the HAL when the sound recognition triggers
+     * for a key phrase sound model.
+     * @param event A RecognitionEvent structure containing detailed results
+     *              of the recognition triggered
+     * @param cookie The cookie passed by the framework when recognition was
+     *               started (see ISoundtriggerHw.startRecognition()
+     */
+    phraseRecognitionCallback(PhraseRecognitionEvent event,
+                              CallbackCookie cookie);
     /*
      * Callback method called by the HAL when the sound model loading completes
      * @param event A ModelEvent structure containing detailed results of the
diff --git a/tests/bar/1.0/default/Android.bp b/tests/bar/1.0/default/Android.bp
new file mode 100644
index 0000000..0d47001
--- /dev/null
+++ b/tests/bar/1.0/default/Android.bp
@@ -0,0 +1,21 @@
+
+
+cc_library_shared {
+    name: "android.hardware.tests.bar@1.0-impl",
+    relative_install_path: "hw",
+    srcs: [
+        "Bar.cpp",
+        "ImportTypes.cpp",
+    ],
+
+    shared_libs: [
+        "libbase",
+        "libhidl",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+        "android.hardware.tests.foo@1.0",
+        "android.hardware.tests.bar@1.0",
+    ],
+
+}
diff --git a/tests/bar/1.0/default/Bar.cpp b/tests/bar/1.0/default/Bar.cpp
new file mode 100644
index 0000000..4433802
--- /dev/null
+++ b/tests/bar/1.0/default/Bar.cpp
@@ -0,0 +1,137 @@
+
+#define LOG_TAG "hidl_test"
+
+#include "Bar.h"
+#include <android-base/logging.h>
+#include <inttypes.h>
+
+namespace android {
+namespace hardware {
+namespace tests {
+namespace bar {
+namespace V1_0 {
+namespace implementation {
+
+Bar::Bar() {
+    mFoo = IFoo::getService("", true);
+}
+
+// Methods from ::android::hardware::tests::foo::V1_0::IFoo follow.
+Return<void> Bar::doThis(float param) {
+    return mFoo->doThis(param);
+}
+
+Return<void> Bar::doThis(uint32_t param) {
+    return mFoo->doThis(param);
+}
+
+Return<int32_t> Bar::doThatAndReturnSomething(
+        int64_t param) {
+    return mFoo->doThatAndReturnSomething(param);
+}
+
+Return<double> Bar::doQuiteABit(
+        int32_t a,
+        int64_t b,
+        float c,
+        double d) {
+    return mFoo->doQuiteABit(a, b, c, d);
+}
+
+Return<void> Bar::doSomethingElse(
+        const hidl_array<int32_t, 15> &param, doSomethingElse_cb _cb) {
+    return mFoo->doSomethingElse(param, _cb);
+}
+
+Return<void> Bar::doStuffAndReturnAString(
+        doStuffAndReturnAString_cb _cb) {
+    return mFoo->doStuffAndReturnAString(_cb);
+}
+
+Return<void> Bar::mapThisVector(
+        const hidl_vec<int32_t> &param, mapThisVector_cb _cb) {
+    return mFoo->mapThisVector(param, _cb);
+}
+
+Return<void> Bar::callMe(
+        const sp<IFooCallback> &cb) {
+    return mFoo->callMe(cb);
+}
+
+Return<Bar::SomeEnum> Bar::useAnEnum(SomeEnum param) {
+    return mFoo->useAnEnum(param);
+}
+
+Return<void> Bar::haveAGooberVec(const hidl_vec<Goober>& param) {
+    return mFoo->haveAGooberVec(param);
+}
+
+Return<void> Bar::haveAGoober(const Goober &g) {
+    return mFoo->haveAGoober(g);
+}
+
+Return<void> Bar::haveAGooberArray(const hidl_array<Goober, 20> &lots) {
+    return mFoo->haveAGooberArray(lots);
+}
+
+Return<void> Bar::haveATypeFromAnotherFile(const Abc &def) {
+    return mFoo->haveATypeFromAnotherFile(def);
+}
+
+Return<void> Bar::haveSomeStrings(
+        const hidl_array<hidl_string, 3> &array,
+        haveSomeStrings_cb _cb) {
+    return mFoo->haveSomeStrings(array, _cb);
+}
+
+Return<void> Bar::haveAStringVec(
+        const hidl_vec<hidl_string> &vector,
+        haveAStringVec_cb _cb) {
+    return mFoo->haveAStringVec(vector, _cb);
+}
+
+Return<void> Bar::transposeMe(
+        const hidl_array<float, 3, 5> &in, transposeMe_cb _cb) {
+    return mFoo->transposeMe(in, _cb);
+}
+
+Return<void> Bar::callingDrWho(
+        const MultiDimensional &in, callingDrWho_cb _hidl_cb) {
+    return mFoo->callingDrWho(in, _hidl_cb);
+}
+
+Return<void> Bar::transpose(const StringMatrix5x3 &in, transpose_cb _hidl_cb) {
+    return mFoo->transpose(in, _hidl_cb);
+}
+
+Return<void> Bar::transpose2(
+        const hidl_array<hidl_string, 5, 3> &in, transpose2_cb _hidl_cb) {
+    return mFoo->transpose2(in, _hidl_cb);
+}
+
+Return<void> Bar::sendVec(
+        const hidl_vec<uint8_t> &data, sendVec_cb _hidl_cb) {
+    return mFoo->sendVec(data, _hidl_cb);
+}
+
+Return<void> Bar::sendVecVec(sendVecVec_cb _hidl_cb) {
+    return mFoo->sendVecVec(_hidl_cb);
+}
+
+// Methods from ::android::hardware::tests::bar::V1_0::IBar follow.
+Return<void> Bar::thisIsNew()  {
+    ALOGI("SERVER(Bar) thisIsNew");
+
+    return Void();
+}
+
+IBar* HIDL_FETCH_IBar(const char* /* name */) {
+    return new Bar();
+}
+
+} // namespace implementation
+}  // namespace V1_0
+}  // namespace bar
+}  // namespace tests
+}  // namespace hardware
+}  // namespace android
diff --git a/tests/bar/1.0/default/Bar.h b/tests/bar/1.0/default/Bar.h
new file mode 100644
index 0000000..58d9f9a
--- /dev/null
+++ b/tests/bar/1.0/default/Bar.h
@@ -0,0 +1,68 @@
+#ifndef HIDL_GENERATED_android_hardware_tests_bar_V1_0_Bar_H_
+#define HIDL_GENERATED_android_hardware_tests_bar_V1_0_Bar_H_
+
+#include <android/hardware/tests/bar/1.0/IBar.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace tests {
+namespace bar {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::tests::bar::V1_0::IBar;
+using ::android::hardware::tests::foo::V1_0::Abc;
+using ::android::hardware::tests::foo::V1_0::IFoo;
+using ::android::hardware::tests::foo::V1_0::IFooCallback;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Bar : public IBar {
+
+    Bar();
+
+    // Methods from ::android::hardware::tests::foo::V1_0::IFoo follow.
+    virtual Return<void> doThis(float param)  override;
+    virtual Return<void> doThis(uint32_t param)  override;
+    virtual Return<int32_t> doThatAndReturnSomething(int64_t param)  override;
+    virtual Return<double> doQuiteABit(int32_t a, int64_t b, float c, double d)  override;
+    virtual Return<void> doSomethingElse(const hidl_array<int32_t, 15 /* 15 */>& param, doSomethingElse_cb _hidl_cb)  override;
+    virtual Return<void> doStuffAndReturnAString(doStuffAndReturnAString_cb _hidl_cb)  override;
+    virtual Return<void> mapThisVector(const hidl_vec<int32_t>& param, mapThisVector_cb _hidl_cb)  override;
+    virtual Return<void> callMe(const sp<IFooCallback>& cb)  override;
+    virtual Return<IFoo::SomeEnum> useAnEnum(IFoo::SomeEnum zzz)  override;
+    virtual Return<void> haveAGooberVec(const hidl_vec<IFoo::Goober>& param)  override;
+    virtual Return<void> haveAGoober(const IFoo::Goober& g)  override;
+    virtual Return<void> haveAGooberArray(const hidl_array<IFoo::Goober, 20 /* 20 */>& lots)  override;
+    virtual Return<void> haveATypeFromAnotherFile(const Abc& def)  override;
+    virtual Return<void> haveSomeStrings(const hidl_array<hidl_string, 3 /* 3 */>& array, haveSomeStrings_cb _hidl_cb)  override;
+    virtual Return<void> haveAStringVec(const hidl_vec<hidl_string>& vector, haveAStringVec_cb _hidl_cb)  override;
+    virtual Return<void> transposeMe(const hidl_array<float, 3 /* 3 */, 5 /* 5 */>& in, transposeMe_cb _hidl_cb)  override;
+    virtual Return<void> callingDrWho(const IFoo::MultiDimensional& in, callingDrWho_cb _hidl_cb)  override;
+    virtual Return<void> transpose(const IFoo::StringMatrix5x3& in, transpose_cb _hidl_cb)  override;
+    virtual Return<void> transpose2(const hidl_array<hidl_string, 5 /* 5 */, 3 /* 3 */>& in, transpose2_cb _hidl_cb)  override;
+    virtual Return<void> sendVec(const hidl_vec<uint8_t>& data, sendVec_cb _hidl_cb)  override;
+    virtual Return<void> sendVecVec(sendVecVec_cb _hidl_cb)  override;
+
+    // Methods from ::android::hardware::tests::bar::V1_0::IBar follow.
+    Return<void> thisIsNew()  override;
+
+private:
+    sp<IFoo> mFoo;
+};
+
+extern "C" IBar* HIDL_FETCH_IBar(const char* name);
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace bar
+}  // namespace tests
+}  // namespace hardware
+}  // namespace android
+
+#endif  // HIDL_GENERATED_android_hardware_tests_bar_V1_0_Bar_H_
diff --git a/tests/bar/1.0/default/ImportTypes.cpp b/tests/bar/1.0/default/ImportTypes.cpp
new file mode 100644
index 0000000..06ce4e5
--- /dev/null
+++ b/tests/bar/1.0/default/ImportTypes.cpp
@@ -0,0 +1,21 @@
+#include "ImportTypes.h"
+
+namespace android {
+namespace hardware {
+namespace tests {
+namespace bar {
+namespace V1_0 {
+namespace implementation {
+
+// Methods from ::android::hardware::tests::bar::V1_0::IImportTypes follow.
+
+IImportTypes* HIDL_FETCH_IImportTypes(const char* /* name */) {
+    return new ImportTypes();
+}
+
+} // namespace implementation
+}  // namespace V1_0
+}  // namespace bar
+}  // namespace tests
+}  // namespace hardware
+}  // namespace android
diff --git a/tests/bar/1.0/default/ImportTypes.h b/tests/bar/1.0/default/ImportTypes.h
new file mode 100644
index 0000000..b43be70
--- /dev/null
+++ b/tests/bar/1.0/default/ImportTypes.h
@@ -0,0 +1,36 @@
+#ifndef HIDL_GENERATED_android_hardware_tests_bar_V1_0_ImportTypes_H_
+#define HIDL_GENERATED_android_hardware_tests_bar_V1_0_ImportTypes_H_
+
+#include <android/hardware/tests/bar/1.0/IImportTypes.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace tests {
+namespace bar {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::tests::bar::V1_0::IImportTypes;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct ImportTypes : public IImportTypes {
+    // Methods from ::android::hardware::tests::bar::V1_0::IImportTypes follow.
+
+};
+
+extern "C" IImportTypes* HIDL_FETCH_IImportTypes(const char* name);
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace bar
+}  // namespace tests
+}  // namespace hardware
+}  // namespace android
+
+#endif  // HIDL_GENERATED_android_hardware_tests_bar_V1_0_ImportTypes_H_
diff --git a/tests/baz/1.0/IBase.hal b/tests/baz/1.0/IBase.hal
index 3f18d41..add4153 100644
--- a/tests/baz/1.0/IBase.hal
+++ b/tests/baz/1.0/IBase.hal
@@ -76,6 +76,9 @@
 
     someMethodWithVectorOfArray(VectorOfArray in) generates (VectorOfArray out);
 
+    someMethodTakingAVectorOfArray(vec<MacAddress> in)
+        generates (vec<MacAddress> out);
+
     transpose(StringMatrix5x3 in) generates (StringMatrix3x5 out);
     transpose2(ThreeStrings[5] in) generates (FiveStrings[3] out);
 };
diff --git a/tests/foo/1.0/default/Android.bp b/tests/foo/1.0/default/Android.bp
new file mode 100644
index 0000000..a2acd14
--- /dev/null
+++ b/tests/foo/1.0/default/Android.bp
@@ -0,0 +1,22 @@
+
+
+cc_library_shared {
+    name: "android.hardware.tests.foo@1.0-impl",
+    relative_install_path: "hw",
+    srcs: [
+        "Foo.cpp",
+        "FooCallback.cpp",
+        "MyTypes.cpp",
+        "TheirTypes.cpp",
+    ],
+
+    shared_libs: [
+        "libbase",
+        "libhidl",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+        "android.hardware.tests.foo@1.0",
+    ],
+
+}
diff --git a/tests/foo/1.0/default/Foo.cpp b/tests/foo/1.0/default/Foo.cpp
new file mode 100644
index 0000000..81aa78b
--- /dev/null
+++ b/tests/foo/1.0/default/Foo.cpp
@@ -0,0 +1,409 @@
+
+#define LOG_TAG "hidl_test"
+
+#include "Foo.h"
+#include "FooCallback.h"
+#include <android-base/logging.h>
+#include <inttypes.h>
+#include <utils/Timers.h>
+
+namespace android {
+namespace hardware {
+namespace tests {
+namespace foo {
+namespace V1_0 {
+namespace implementation {
+
+// Methods from ::android::hardware::tests::foo::V1_0::IFoo follow.
+Return<void> Foo::doThis(float param) {
+    ALOGI("SERVER(Foo) doThis(%.2f)", param);
+
+    return Void();
+}
+
+Return<void> Foo::doThis(uint32_t param) {
+    ALOGI("SERVER(Foo) doThis (int) (%d)", param);
+    return Void();
+}
+
+Return<int32_t> Foo::doThatAndReturnSomething(
+        int64_t param) {
+    LOG(INFO) << "SERVER(Foo) doThatAndReturnSomething(" << param << ")";
+
+    return 666;
+}
+
+Return<double> Foo::doQuiteABit(
+        int32_t a,
+        int64_t b,
+        float c,
+        double d) {
+    LOG(INFO) << "SERVER(Foo) doQuiteABit("
+              << a
+              << ", "
+              << b
+              << ", "
+              << c
+              << ", "
+              << d
+              << ")";
+
+    return 666.5;
+}
+
+Return<void> Foo::doSomethingElse(
+        const hidl_array<int32_t, 15> &param, doSomethingElse_cb _cb) {
+    ALOGI("SERVER(Foo) doSomethingElse(...)");
+
+    hidl_array<int32_t, 32> result;
+    for (size_t i = 0; i < 15; ++i) {
+        result[i] = 2 * param[i];
+        result[15 + i] = param[i];
+    }
+    result[30] = 1;
+    result[31] = 2;
+
+    _cb(result);
+
+    return Void();
+}
+
+Return<void> Foo::doStuffAndReturnAString(
+        doStuffAndReturnAString_cb _cb) {
+    ALOGI("SERVER(Foo) doStuffAndReturnAString");
+
+    hidl_string s;
+    s = "Hello, world";
+
+    _cb(s);
+
+    return Void();
+}
+
+Return<void> Foo::mapThisVector(
+        const hidl_vec<int32_t> &param, mapThisVector_cb _cb) {
+    ALOGI("SERVER(Foo) mapThisVector");
+
+    hidl_vec<int32_t> out;
+    out.resize(param.size());
+
+    for (size_t i = 0; i < out.size(); ++i) {
+        out[i] = param[i] * 2;
+    }
+
+    _cb(out);
+
+    return Void();
+}
+
+Return<void> Foo::callMe(
+        const sp<IFooCallback> &cb) {
+    ALOGI("SERVER(Foo) callMe %p", cb.get());
+
+    if (cb != NULL) {
+
+        hidl_array<nsecs_t, 3> c;
+        ALOGI("SERVER(Foo) callMe %p calling IFooCallback::heyItsYou, " \
+              "should return immediately", cb.get());
+        c[0] = systemTime();
+        cb->heyItsYou(cb);
+        c[0] = systemTime() - c[0];
+        ALOGI("SERVER(Foo) callMe %p calling IFooCallback::heyItsYou " \
+              "returned after %" PRId64 "ns", cb.get(), c[0]);
+
+        ALOGI("SERVER(Foo) callMe %p calling IFooCallback::heyItsYouIsntIt, " \
+              "should block for %" PRId64 " seconds", cb.get(),
+              FooCallback::DELAY_S);
+        c[1] = systemTime();
+        bool answer = cb->heyItsYouIsntIt(cb);
+        c[1] = systemTime() - c[1];
+        ALOGI("SERVER(Foo) callMe %p IFooCallback::heyItsYouIsntIt " \
+              "responded with %d after %" PRId64 "ns", cb.get(), answer, c[1]);
+
+        ALOGI("SERVER(Foo) callMe %p calling " \
+              "IFooCallback::heyItsTheMeaningOfLife, " \
+              "should return immediately ", cb.get());
+        c[2] = systemTime();
+        cb->heyItsTheMeaningOfLife(42);
+        c[2] = systemTime() - c[2];
+        ALOGI("SERVER(Foo) callMe %p After call to " \
+              "IFooCallback::heyItsTheMeaningOfLife " \
+              "responded after %" PRId64 "ns", cb.get(), c[2]);
+
+        ALOGI("SERVER(Foo) callMe %p calling IFooCallback::youBlockedMeFor " \
+              "to report times", cb.get());
+        cb->youBlockedMeFor(c);
+        ALOGI("SERVER(Foo) callMe %p After call to " \
+              "IFooCallback::heyYouBlockedMeFor", cb.get());
+    }
+
+    return Void();
+}
+
+Return<Foo::SomeEnum> Foo::useAnEnum(SomeEnum param) {
+    ALOGI("SERVER(Foo) useAnEnum %d", (int)param);
+
+    return SomeEnum::goober;
+}
+
+Return<void> Foo::haveAGooberVec(const hidl_vec<Goober>& param) {
+    ALOGI("SERVER(Foo) haveAGooberVec &param = %p", &param);
+
+    return Void();
+}
+
+Return<void> Foo::haveAGoober(const Goober &g) {
+    ALOGI("SERVER(Foo) haveaGoober g=%p", &g);
+
+    return Void();
+}
+
+Return<void> Foo::haveAGooberArray(const hidl_array<Goober, 20> & /* lots */) {
+    ALOGI("SERVER(Foo) haveAGooberArray");
+
+    return Void();
+}
+
+Return<void> Foo::haveATypeFromAnotherFile(const Abc &def) {
+    ALOGI("SERVER(Foo) haveATypeFromAnotherFile def=%p", &def);
+
+    return Void();
+}
+
+Return<void> Foo::haveSomeStrings(
+        const hidl_array<hidl_string, 3> &array,
+        haveSomeStrings_cb _cb) {
+    ALOGI("SERVER(Foo) haveSomeStrings([\"%s\", \"%s\", \"%s\"])",
+          array[0].c_str(),
+          array[1].c_str(),
+          array[2].c_str());
+
+    hidl_array<hidl_string, 2> result;
+    result[0] = "Hello";
+    result[1] = "World";
+
+    _cb(result);
+
+    return Void();
+}
+
+Return<void> Foo::haveAStringVec(
+        const hidl_vec<hidl_string> &vector,
+        haveAStringVec_cb _cb) {
+    ALOGI("SERVER(Foo) haveAStringVec([\"%s\", \"%s\", \"%s\"])",
+          vector[0].c_str(),
+          vector[1].c_str(),
+          vector[2].c_str());
+
+    hidl_vec<hidl_string> result;
+    result.resize(2);
+
+    result[0] = "Hello";
+    result[1] = "World";
+
+    _cb(result);
+
+    return Void();
+}
+
+// NOTE: duplicated code in hidl_test
+using std::to_string;
+
+static std::string to_string(const IFoo::StringMatrix5x3 &M);
+static std::string to_string(const IFoo::StringMatrix3x5 &M);
+static std::string to_string(const hidl_string &s);
+
+template<typename T>
+static std::string to_string(const T *elems, size_t n) {
+    std::string out;
+    out = "[";
+    for (size_t i = 0; i < n; ++i) {
+        if (i > 0) {
+            out += ", ";
+        }
+        out += to_string(elems[i]);
+    }
+    out += "]";
+
+    return out;
+}
+
+template<typename T, size_t SIZE>
+static std::string to_string(const hidl_array<T, SIZE> &array) {
+    return to_string(&array[0], SIZE);
+}
+
+template<typename T, size_t SIZE1, size_t SIZE2>
+static std::string to_string(const hidl_array<T, SIZE1, SIZE2> &array) {
+    std::string out;
+    out = "[";
+    for (size_t i = 0; i < SIZE1; ++i) {
+        if (i > 0) {
+            out += ", ";
+        }
+
+        out += "[";
+        for (size_t j = 0; j < SIZE2; ++j) {
+            if (j > 0) {
+                out += ", ";
+            }
+
+            out += to_string(array[i][j]);
+        }
+        out += "]";
+    }
+    out += "]";
+
+    return out;
+}
+
+template<typename T>
+static std::string to_string(const hidl_vec<T> &vec) {
+    return to_string(&vec[0], vec.size());
+}
+
+static std::string to_string(const IFoo::StringMatrix5x3 &M) {
+    return to_string(M.s);
+}
+
+static std::string to_string(const IFoo::StringMatrix3x5 &M) {
+    return to_string(M.s);
+}
+
+static std::string to_string(const hidl_string &s) {
+    return std::string("'") + s.c_str() + "'";
+}
+
+Return<void> Foo::transposeMe(
+        const hidl_array<float, 3, 5> &in, transposeMe_cb _cb) {
+    ALOGI("SERVER(Foo) transposeMe(%s)", to_string(in).c_str());
+
+    hidl_array<float, 5, 3> out;
+    for (size_t i = 0; i < 5; ++i) {
+        for (size_t j = 0; j < 3; ++j) {
+            out[i][j] = in[j][i];
+        }
+    }
+
+    ALOGI("SERVER(Foo) transposeMe returning %s", to_string(out).c_str());
+
+    _cb(out);
+
+    return Void();
+}
+// end duplicated code
+
+static std::string QuuxToString(const IFoo::Quux &val) {
+    std::string s;
+
+    s = "Quux(first='";
+    s += val.first.c_str();
+    s += "', last='";
+    s += val.last.c_str();
+    s += "')";
+
+    return s;
+}
+
+static std::string MultiDimensionalToString(const IFoo::MultiDimensional &val) {
+    std::string s;
+
+    s += "MultiDimensional(";
+
+    s += "quuxMatrix=[";
+
+    size_t k = 0;
+    for (size_t i = 0; i < 5; ++i) {
+        if (i > 0) {
+            s += ", ";
+        }
+
+        s += "[";
+        for (size_t j = 0; j < 3; ++j, ++k) {
+            if (j > 0) {
+                s += ", ";
+            }
+
+            s += QuuxToString(val.quuxMatrix[i][j]);
+        }
+    }
+    s += "]";
+
+    s += ")";
+
+    return s;
+}
+
+Return<void> Foo::callingDrWho(
+        const MultiDimensional &in, callingDrWho_cb _hidl_cb) {
+    ALOGI("SERVER(Foo) callingDrWho(%s)", MultiDimensionalToString(in).c_str());
+
+    MultiDimensional out;
+    for (size_t i = 0; i < 5; ++i) {
+        for (size_t j = 0; j < 3; ++j) {
+            out.quuxMatrix[i][j].first = in.quuxMatrix[4 - i][2 - j].last;
+            out.quuxMatrix[i][j].last = in.quuxMatrix[4 - i][2 - j].first;
+        }
+    }
+
+    _hidl_cb(out);
+
+    return Void();
+}
+
+Return<void> Foo::transpose(const StringMatrix5x3 &in, transpose_cb _hidl_cb) {
+    LOG(INFO) << "SERVER(Foo) transpose " << to_string(in);
+
+    StringMatrix3x5 out;
+    for (size_t i = 0; i < 3; ++i) {
+        for (size_t j = 0; j < 5; ++j) {
+            out.s[i][j] = in.s[j][i];
+        }
+    }
+
+    _hidl_cb(out);
+
+    return Void();
+}
+
+Return<void> Foo::transpose2(
+        const hidl_array<hidl_string, 5, 3> &in, transpose2_cb _hidl_cb) {
+    LOG(INFO) << "SERVER(Foo) transpose2 " << to_string(in);
+
+    hidl_array<hidl_string, 3, 5> out;
+    for (size_t i = 0; i < 3; ++i) {
+        for (size_t j = 0; j < 5; ++j) {
+            out[i][j] = in[j][i];
+        }
+    }
+
+    _hidl_cb(out);
+
+    return Void();
+}
+
+Return<void> Foo::sendVec(
+        const hidl_vec<uint8_t> &data, sendVec_cb _hidl_cb) {
+    _hidl_cb(data);
+
+    return Void();
+}
+
+Return<void> Foo::sendVecVec(sendVecVec_cb _hidl_cb) {
+    hidl_vec<hidl_vec<uint8_t>> data;
+    _hidl_cb(data);
+
+    return Void();
+}
+
+
+IFoo* HIDL_FETCH_IFoo(const char* /* name */) {
+    return new Foo();
+}
+
+} // namespace implementation
+}  // namespace V1_0
+}  // namespace foo
+}  // namespace tests
+}  // namespace hardware
+}  // namespace android
diff --git a/tests/foo/1.0/default/Foo.h b/tests/foo/1.0/default/Foo.h
new file mode 100644
index 0000000..00a29f5
--- /dev/null
+++ b/tests/foo/1.0/default/Foo.h
@@ -0,0 +1,59 @@
+#ifndef HIDL_GENERATED_android_hardware_tests_foo_V1_0_Foo_H_
+#define HIDL_GENERATED_android_hardware_tests_foo_V1_0_Foo_H_
+
+#include <android/hardware/tests/foo/1.0/IFoo.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace tests {
+namespace foo {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::tests::foo::V1_0::Abc;
+using ::android::hardware::tests::foo::V1_0::IFoo;
+using ::android::hardware::tests::foo::V1_0::IFooCallback;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Foo : public IFoo {
+    // Methods from ::android::hardware::tests::foo::V1_0::IFoo follow.
+    virtual Return<void> doThis(float param)  override;
+    virtual Return<void> doThis(uint32_t param)  override;
+    virtual Return<int32_t> doThatAndReturnSomething(int64_t param)  override;
+    virtual Return<double> doQuiteABit(int32_t a, int64_t b, float c, double d)  override;
+    virtual Return<void> doSomethingElse(const hidl_array<int32_t, 15 /* 15 */>& param, doSomethingElse_cb _hidl_cb)  override;
+    virtual Return<void> doStuffAndReturnAString(doStuffAndReturnAString_cb _hidl_cb)  override;
+    virtual Return<void> mapThisVector(const hidl_vec<int32_t>& param, mapThisVector_cb _hidl_cb)  override;
+    virtual Return<void> callMe(const sp<IFooCallback>& cb)  override;
+    virtual Return<IFoo::SomeEnum> useAnEnum(IFoo::SomeEnum zzz)  override;
+    virtual Return<void> haveAGooberVec(const hidl_vec<IFoo::Goober>& param)  override;
+    virtual Return<void> haveAGoober(const IFoo::Goober& g)  override;
+    virtual Return<void> haveAGooberArray(const hidl_array<IFoo::Goober, 20 /* 20 */>& lots)  override;
+    virtual Return<void> haveATypeFromAnotherFile(const Abc& def)  override;
+    virtual Return<void> haveSomeStrings(const hidl_array<hidl_string, 3 /* 3 */>& array, haveSomeStrings_cb _hidl_cb)  override;
+    virtual Return<void> haveAStringVec(const hidl_vec<hidl_string>& vector, haveAStringVec_cb _hidl_cb)  override;
+    virtual Return<void> transposeMe(const hidl_array<float, 3 /* 3 */, 5 /* 5 */>& in, transposeMe_cb _hidl_cb)  override;
+    virtual Return<void> callingDrWho(const IFoo::MultiDimensional& in, callingDrWho_cb _hidl_cb)  override;
+    virtual Return<void> transpose(const IFoo::StringMatrix5x3& in, transpose_cb _hidl_cb)  override;
+    virtual Return<void> transpose2(const hidl_array<hidl_string, 5 /* 5 */, 3 /* 3 */>& in, transpose2_cb _hidl_cb)  override;
+    virtual Return<void> sendVec(const hidl_vec<uint8_t>& data, sendVec_cb _hidl_cb)  override;
+    virtual Return<void> sendVecVec(sendVecVec_cb _hidl_cb)  override;
+
+};
+
+extern "C" IFoo* HIDL_FETCH_IFoo(const char* name);
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace foo
+}  // namespace tests
+}  // namespace hardware
+}  // namespace android
+
+#endif  // HIDL_GENERATED_android_hardware_tests_foo_V1_0_Foo_H_
diff --git a/tests/foo/1.0/default/FooCallback.cpp b/tests/foo/1.0/default/FooCallback.cpp
new file mode 100644
index 0000000..d3eef77
--- /dev/null
+++ b/tests/foo/1.0/default/FooCallback.cpp
@@ -0,0 +1,132 @@
+
+#define LOG_TAG "hidl_test"
+
+#include "FooCallback.h"
+#include <android-base/logging.h>
+#include <inttypes.h>
+
+namespace android {
+namespace hardware {
+namespace tests {
+namespace foo {
+namespace V1_0 {
+namespace implementation {
+
+enum {
+    NOT_REPORTED = -1LL
+};
+
+FooCallback::FooCallback()
+        : mLock{}, mCond{} {
+    for (size_t i = 0; i < invokeInfo.size(); i++) {
+        invokeInfo[i].invoked = false;
+        invokeInfo[i].timeNs = NOT_REPORTED;
+        invokeInfo[i].callerBlockedNs = NOT_REPORTED;
+    }
+}
+
+Return<void> FooCallback::heyItsYou(
+        const sp<IFooCallback> &_cb) {
+    nsecs_t start = systemTime();
+    ALOGI("SERVER(FooCallback) 1: heyItsYou cb = %p", _cb.get());
+    nsecs_t end = systemTime();
+    {
+        Mutex::Autolock lock(mLock);
+        invokeInfo[0].invoked = true;
+        invokeInfo[0].timeNs = end - start;
+        mCond.signal();
+    }
+    ALOGI("SERVER(FooCallback) 2: heyItsYou returned");
+    return Void();
+}
+
+Return<bool> FooCallback::heyItsYouIsntIt(const sp<IFooCallback> &_cb) {
+    nsecs_t start = systemTime();
+    ALOGI("SERVER(FooCallback) 3: heyItsYouIsntIt cb = %p sleeping for %" PRId64 " seconds", _cb.get(), DELAY_S);
+    sleep(DELAY_S);
+    ALOGI("SERVER(FooCallback) 4: heyItsYouIsntIt cb = %p responding", _cb.get());
+    nsecs_t end = systemTime();
+    {
+        Mutex::Autolock lock(mLock);
+        invokeInfo[1].invoked = true;
+        invokeInfo[1].timeNs = end - start;
+        mCond.signal();
+    }
+    ALOGI("SERVER(FooCallback) 5: heyItsYouIsntIt cb = %p responding", _cb.get());
+    return true;
+}
+
+Return<void> FooCallback::heyItsTheMeaningOfLife(uint8_t tmol) {
+    nsecs_t start = systemTime();
+    ALOGI("SERVER(FooCallback) 6.1: heyItsTheMeaningOfLife = %d sleeping for %" PRId64 " seconds", tmol, DELAY_S);
+    sleep(DELAY_S);
+    ALOGI("SERVER(FooCallback) 6.2: heyItsTheMeaningOfLife = %d done sleeping", tmol);
+    nsecs_t end = systemTime();
+    {
+        Mutex::Autolock lock(mLock);
+        invokeInfo[2].invoked = true;
+        invokeInfo[2].timeNs = end - start;
+        mCond.signal();
+    }
+    ALOGI("SERVER(FooCallback) 6.3: heyItsTheMeaningOfLife returned");
+    return Void();
+}
+
+Return<void> FooCallback::reportResults(int64_t ns, reportResults_cb cb) {
+    ALOGI("SERVER(FooCallback) 8.1: reportResults(%" PRId64 " seconds)", nanoseconds_to_seconds(ns));
+    nsecs_t leftToWaitNs = ns;
+    bool cond;
+    {
+        Mutex::Autolock lock(mLock);
+        while ((cond = ((!invokeInfo[0].invoked ||
+                !invokeInfo[1].invoked ||
+                !invokeInfo[2].invoked ||
+                invokeInfo[0].callerBlockedNs == NOT_REPORTED ||
+                invokeInfo[1].callerBlockedNs == NOT_REPORTED ||
+                invokeInfo[2].callerBlockedNs == NOT_REPORTED)   &&
+               leftToWaitNs > 0))) {
+            nsecs_t start = systemTime();
+            ::android::status_t rc = mCond.waitRelative(mLock, leftToWaitNs);
+            if (rc != ::android::OK) {
+                ALOGW("SERVER(FooCallback)::reportResults(%" PRId64 " ns) Condition::waitRelative(%" PRId64 ") returned error (%d)", ns, leftToWaitNs, rc);
+                if (rc == -ETIMEDOUT) {
+                    // time's up
+                    leftToWaitNs = -1;
+                }
+                break;
+            }
+            ALOGI("SERVER(FooCallback)::reportResults(%" PRId64 " ns) Condition::waitRelative was signalled", ns);
+            leftToWaitNs -= systemTime() - start;
+        }
+    }
+    ALOGI("SERVER(FooCallback) 8.2: reportResults returned;"
+            "invoked? %d, %d, %d; leftToWaitNs = %" PRId64 "; cond = %d",
+            invokeInfo[0].invoked, invokeInfo[1].invoked, invokeInfo[2].invoked,
+            leftToWaitNs, cond);
+    cb(leftToWaitNs, invokeInfo);
+    return Void();
+}
+
+Return<void> FooCallback::youBlockedMeFor(const hidl_array<int64_t, 3> &ns) {
+    ALOGI("SERVER(FooCallback) 7.1: youBlockedMeFor");
+    {
+        Mutex::Autolock lock(mLock);
+        for (size_t i = 0; i < 3; i++) {
+            invokeInfo[i].callerBlockedNs = ns[i];
+        }
+        mCond.signal();
+    }
+    ALOGI("SERVER(FooCallback) 7.2: returned");
+    return Void();
+}
+
+IFooCallback* HIDL_FETCH_IFooCallback(const char* /* name */) {
+    return new FooCallback();
+}
+
+} // namespace implementation
+}  // namespace V1_0
+}  // namespace foo
+}  // namespace tests
+}  // namespace hardware
+}  // namespace android
diff --git a/tests/foo/1.0/default/FooCallback.h b/tests/foo/1.0/default/FooCallback.h
new file mode 100644
index 0000000..5921972
--- /dev/null
+++ b/tests/foo/1.0/default/FooCallback.h
@@ -0,0 +1,52 @@
+#ifndef HIDL_GENERATED_android_hardware_tests_foo_V1_0_FooCallback_H_
+#define HIDL_GENERATED_android_hardware_tests_foo_V1_0_FooCallback_H_
+
+#include <android/hardware/tests/foo/1.0/IFooCallback.h>
+#include <hidl/Status.h>
+#include <hidl/MQDescriptor.h>
+
+#include <utils/Condition.h>
+#include <utils/Timers.h>
+namespace android {
+namespace hardware {
+namespace tests {
+namespace foo {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::tests::foo::V1_0::IFooCallback;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct FooCallback : public IFooCallback {
+    FooCallback();
+    // Methods from ::android::hardware::tests::foo::V1_0::IFooCallback follow.
+    Return<void> heyItsYou(const sp<IFooCallback>& cb)  override;
+    Return<bool> heyItsYouIsntIt(const sp<IFooCallback>& cb)  override;
+    Return<void> heyItsTheMeaningOfLife(uint8_t tmol)  override;
+    Return<void> reportResults(int64_t ns, reportResults_cb _hidl_cb)  override;
+    Return<void> youBlockedMeFor(const hidl_array<int64_t, 3 /* 3 */>& callerBlockedInfo)  override;
+
+    static constexpr nsecs_t DELAY_S = 1;
+    static constexpr nsecs_t DELAY_NS = seconds_to_nanoseconds(DELAY_S);
+    static constexpr nsecs_t TOLERANCE_NS = milliseconds_to_nanoseconds(10);
+    static constexpr nsecs_t ONEWAY_TOLERANCE_NS = milliseconds_to_nanoseconds(1);
+
+    hidl_array<InvokeInfo, 3> invokeInfo;
+    Mutex mLock;
+    Condition mCond;
+};
+
+extern "C" IFooCallback* HIDL_FETCH_IFooCallback(const char* name);
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace foo
+}  // namespace tests
+}  // namespace hardware
+}  // namespace android
+
+#endif  // HIDL_GENERATED_android_hardware_tests_foo_V1_0_FooCallback_H_
diff --git a/tests/foo/1.0/default/MyTypes.cpp b/tests/foo/1.0/default/MyTypes.cpp
new file mode 100644
index 0000000..0d1a458
--- /dev/null
+++ b/tests/foo/1.0/default/MyTypes.cpp
@@ -0,0 +1,21 @@
+#include "MyTypes.h"
+
+namespace android {
+namespace hardware {
+namespace tests {
+namespace foo {
+namespace V1_0 {
+namespace implementation {
+
+// Methods from ::android::hardware::tests::foo::V1_0::IMyTypes follow.
+
+IMyTypes* HIDL_FETCH_IMyTypes(const char* /* name */) {
+    return new MyTypes();
+}
+
+} // namespace implementation
+}  // namespace V1_0
+}  // namespace foo
+}  // namespace tests
+}  // namespace hardware
+}  // namespace android
diff --git a/tests/foo/1.0/default/MyTypes.h b/tests/foo/1.0/default/MyTypes.h
new file mode 100644
index 0000000..6e9a3e1
--- /dev/null
+++ b/tests/foo/1.0/default/MyTypes.h
@@ -0,0 +1,36 @@
+#ifndef HIDL_GENERATED_android_hardware_tests_foo_V1_0_MyTypes_H_
+#define HIDL_GENERATED_android_hardware_tests_foo_V1_0_MyTypes_H_
+
+#include <android/hardware/tests/foo/1.0/IMyTypes.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace tests {
+namespace foo {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::tests::foo::V1_0::IMyTypes;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct MyTypes : public IMyTypes {
+    // Methods from ::android::hardware::tests::foo::V1_0::IMyTypes follow.
+
+};
+
+extern "C" IMyTypes* HIDL_FETCH_IMyTypes(const char* name);
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace foo
+}  // namespace tests
+}  // namespace hardware
+}  // namespace android
+
+#endif  // HIDL_GENERATED_android_hardware_tests_foo_V1_0_MyTypes_H_
diff --git a/tests/foo/1.0/default/TheirTypes.cpp b/tests/foo/1.0/default/TheirTypes.cpp
new file mode 100644
index 0000000..0f678f0
--- /dev/null
+++ b/tests/foo/1.0/default/TheirTypes.cpp
@@ -0,0 +1,21 @@
+#include "TheirTypes.h"
+
+namespace android {
+namespace hardware {
+namespace tests {
+namespace foo {
+namespace V1_0 {
+namespace implementation {
+
+// Methods from ::android::hardware::tests::foo::V1_0::ITheirTypes follow.
+
+ITheirTypes* HIDL_FETCH_ITheirTypes(const char* /* name */) {
+    return new TheirTypes();
+}
+
+} // namespace implementation
+}  // namespace V1_0
+}  // namespace foo
+}  // namespace tests
+}  // namespace hardware
+}  // namespace android
diff --git a/tests/foo/1.0/default/TheirTypes.h b/tests/foo/1.0/default/TheirTypes.h
new file mode 100644
index 0000000..24ade70
--- /dev/null
+++ b/tests/foo/1.0/default/TheirTypes.h
@@ -0,0 +1,36 @@
+#ifndef HIDL_GENERATED_android_hardware_tests_foo_V1_0_TheirTypes_H_
+#define HIDL_GENERATED_android_hardware_tests_foo_V1_0_TheirTypes_H_
+
+#include <android/hardware/tests/foo/1.0/ITheirTypes.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace tests {
+namespace foo {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::tests::foo::V1_0::ITheirTypes;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct TheirTypes : public ITheirTypes {
+    // Methods from ::android::hardware::tests::foo::V1_0::ITheirTypes follow.
+
+};
+
+extern "C" ITheirTypes* HIDL_FETCH_ITheirTypes(const char* name);
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace foo
+}  // namespace tests
+}  // namespace hardware
+}  // namespace android
+
+#endif  // HIDL_GENERATED_android_hardware_tests_foo_V1_0_TheirTypes_H_
diff --git a/tests/msgq/1.0/ITestMsgQ.hal b/tests/msgq/1.0/ITestMsgQ.hal
index 93a6e8a..fc96181 100644
--- a/tests/msgq/1.0/ITestMsgQ.hal
+++ b/tests/msgq/1.0/ITestMsgQ.hal
@@ -20,24 +20,26 @@
     /*
      * This method requests the service to set up Synchronous read/write
      * wait-free FMQ with the client as reader.
-     * @return ret Will be 0 if the setup is successful.
+     * @return ret Will be true if the setup is successful, false otherwise.
      * @return mqDesc This structure describes the FMQ that was
      * set up by the service. Client can use it to set up the FMQ at its end.
      */
     configureFmqSyncReadWrite()
-        generates(int32_t ret, MQDescriptorSync mqDesc);
+        generates(bool ret, MQDescriptorSync mqDesc);
 
     /*
      * This method request the service to write into the FMQ.
      * @param count Number to messages to write.
-     * @ret Number of messages succesfully written.
+     * @return ret Will be true if the write operation was successful,
+     * false otherwise.
      */
-    requestWrite(int32_t count) generates(int32_t ret);
+    requestWrite(int32_t count) generates(bool ret);
 
     /*
      * This method request the service to read from the FMQ.
      * @param count Number to messages to read.
-     * @ret Number of messages succesfully read.
+     * @return ret Will be true if the read operation was successful, false
+     * otherwise.
      */
-    requestRead(int32_t count) generates(int32_t ret);
+    requestRead(int32_t count) generates(bool ret);
 };
diff --git a/tests/pointer/1.0/IPointer.hal b/tests/pointer/1.0/IPointer.hal
index e68fb31..4560a4a 100644
--- a/tests/pointer/1.0/IPointer.hal
+++ b/tests/pointer/1.0/IPointer.hal
@@ -17,6 +17,8 @@
 package android.hardware.tests.pointer@1.0;
 
 interface IPointer {
+  struct S { int32_t data; };
+  struct A { S s; };
   // type declarations
   struct Sam { int32_t data; };
   struct Ada { ref<Sam> s_ptr; };
diff --git a/tests/pointer/1.0/default/Android.bp b/tests/pointer/1.0/default/Android.bp
new file mode 100644
index 0000000..cee6c91
--- /dev/null
+++ b/tests/pointer/1.0/default/Android.bp
@@ -0,0 +1,20 @@
+
+
+cc_library_shared {
+    name: "android.hardware.tests.pointer@1.0-impl",
+    relative_install_path: "hw",
+    srcs: [
+        "Graph.cpp",
+        "Pointer.cpp",
+    ],
+
+    shared_libs: [
+        "libbase",
+        "libhidl",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+        "android.hardware.tests.pointer@1.0",
+    ],
+
+}
diff --git a/tests/pointer/1.0/default/Graph.cpp b/tests/pointer/1.0/default/Graph.cpp
new file mode 100644
index 0000000..a43df81
--- /dev/null
+++ b/tests/pointer/1.0/default/Graph.cpp
@@ -0,0 +1,116 @@
+#include "Graph.h"
+#include <android-base/logging.h>
+
+#define PUSH_ERROR_IF(__cond__) if(__cond__) { errors.push_back(std::to_string(__LINE__) + ": " + #__cond__); }
+
+namespace android {
+namespace hardware {
+namespace tests {
+namespace pointer {
+namespace V1_0 {
+namespace implementation {
+
+static void simpleGraph(IGraph::Graph& g) {
+    g.nodes.resize(2);
+    g.edges.resize(1);
+    g.nodes[0].data = 10;
+    g.nodes[1].data = 20;
+    g.edges[0].left = &g.nodes[0];
+    g.edges[0].right = &g.nodes[1];
+}
+
+static bool isSimpleGraph(const IGraph::Graph &g) {
+    if(g.nodes.size() != 2) return false;
+    if(g.edges.size() != 1) return false;
+    if(g.nodes[0].data != 10) return false;
+    if(g.nodes[1].data != 20) return false;
+    if(g.edges[0].left != &g.nodes[0]) return false;
+    if(g.edges[0].right != &g.nodes[1]) return false;
+    return true;
+}
+
+static void logSimpleGraph(const char *prefix, const IGraph::Graph& g) {
+    ALOGI("%s Graph %p, %d nodes, %d edges", prefix, &g, (int)g.nodes.size(), (int)g.edges.size());
+    std::ostringstream os;
+    for(size_t i = 0; i < g.nodes.size(); i++)
+      os << &g.nodes[i] << " = " << g.nodes[i].data << ", ";
+    ALOGI("%s Nodes: [%s]", prefix, os.str().c_str());
+    os.str("");
+    os.clear();
+    for(size_t i = 0; i < g.edges.size(); i++)
+      os << g.edges[i].left << " -> " << g.edges[i].right << ", ";
+    ALOGI("%s Edges: [%s]", prefix, os.str().c_str());
+}
+
+// Methods from ::android::hardware::tests::pointer::V1_0::IGraph follow.
+Return<void> Graph::passAGraph(const IGraph::Graph& g) {
+    ALOGI("SERVER(Graph) passAGraph start.");
+    PUSH_ERROR_IF(!isSimpleGraph(g));
+    // logSimpleGraph("SERVER(Graph) passAGraph:", g);
+    return Void();
+}
+
+Return<void> Graph::giveAGraph(giveAGraph_cb _cb) {
+    IGraph::Graph g;
+    simpleGraph(g);
+    _cb(g);
+    return Void();
+}
+
+Return<void> Graph::passANode(const IGraph::Node& n) {
+    PUSH_ERROR_IF(n.data != 10);
+    return Void();
+}
+
+Return<void> Graph::passTwoGraphs(IGraph::Graph const* g1, IGraph::Graph const* g2) {
+    PUSH_ERROR_IF(g1 != g2);
+    PUSH_ERROR_IF(!isSimpleGraph(*g1));
+    logSimpleGraph("SERVER(Graph): passTwoGraphs", *g2);
+    return Void();
+}
+
+Return<void> Graph::passAGamma(const IGraph::Gamma& c) {
+    if(c.a_ptr == nullptr && c.b_ptr == nullptr)
+      return Void();
+    ALOGI("SERVER(Graph) passAGamma received c.a = %p, c.b = %p, c.a->s = %p, c.b->s = %p",
+        c.a_ptr, c.b_ptr, c.a_ptr->s_ptr, c.b_ptr->s_ptr);
+    ALOGI("SERVER(Graph) passAGamma received data %d, %d",
+        (int)c.a_ptr->s_ptr->data, (int)c.b_ptr->s_ptr->data);
+    PUSH_ERROR_IF(c.a_ptr->s_ptr != c.b_ptr->s_ptr);
+    return Void();
+}
+Return<void> Graph::passASimpleRef(const IGraph::Alpha * a_ptr) {
+    ALOGI("SERVER(Graph) passASimpleRef received %d", a_ptr->s_ptr->data);
+    PUSH_ERROR_IF(a_ptr->s_ptr->data != 500);
+    return Void();
+}
+Return<void> Graph::passASimpleRefS(const IGraph::Theta * s_ptr) {
+    ALOGI("SERVER(Graph) passASimpleRefS received %d @ %p", s_ptr->data, s_ptr);
+    PUSH_ERROR_IF(s_ptr->data == 10);
+    return Void();
+}
+Return<void> Graph::giveASimpleRef(giveASimpleRef_cb _cb) {
+    IGraph::Theta s; s.data = 500;
+    IGraph::Alpha a; a.s_ptr = &s;
+    _cb(&a);
+    return Void();
+}
+
+Return<int32_t> Graph::getErrors() {
+    if(!errors.empty()) {
+        for(const auto& e : errors)
+            ALOGW("SERVER(Graph) error: %s", e.c_str());
+    }
+    return errors.size();
+}
+
+IGraph* HIDL_FETCH_IGraph(const char* /* name */) {
+    return new Graph();
+}
+
+} // namespace implementation
+}  // namespace V1_0
+}  // namespace pointer
+}  // namespace tests
+}  // namespace hardware
+}  // namespace android
diff --git a/tests/pointer/1.0/default/Graph.h b/tests/pointer/1.0/default/Graph.h
new file mode 100644
index 0000000..cbd5a8a
--- /dev/null
+++ b/tests/pointer/1.0/default/Graph.h
@@ -0,0 +1,47 @@
+#ifndef HIDL_GENERATED_android_hardware_tests_pointer_V1_0_Graph_H_
+#define HIDL_GENERATED_android_hardware_tests_pointer_V1_0_Graph_H_
+
+#include <android/hardware/tests/pointer/1.0/IGraph.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace tests {
+namespace pointer {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::tests::pointer::V1_0::IGraph;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Graph : public IGraph {
+    // Methods from ::android::hardware::tests::pointer::V1_0::IGraph follow.
+    Return<void> passANode(const IGraph::Node& n)  override;
+    Return<void> passAGraph(const IGraph::Graph& g)  override;
+    Return<void> passTwoGraphs(::android::hardware::tests::pointer::V1_0::IGraph::Graph const* g1, ::android::hardware::tests::pointer::V1_0::IGraph::Graph const* g2)  override;
+    Return<void> giveAGraph(giveAGraph_cb _hidl_cb)  override;
+    Return<void> passAGamma(const IGraph::Gamma& c)  override;
+    Return<void> passASimpleRef(::android::hardware::tests::pointer::V1_0::IGraph::Alpha const* a)  override;
+    Return<void> passASimpleRefS(::android::hardware::tests::pointer::V1_0::IGraph::Theta const* s)  override;
+    Return<void> giveASimpleRef(giveASimpleRef_cb _hidl_cb)  override;
+    Return<int32_t> getErrors()  override;
+private:
+    std::vector<std::string> errors;
+
+};
+
+extern "C" IGraph* HIDL_FETCH_IGraph(const char* name);
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace pointer
+}  // namespace tests
+}  // namespace hardware
+}  // namespace android
+
+#endif  // HIDL_GENERATED_android_hardware_tests_pointer_V1_0_Graph_H_
diff --git a/tests/pointer/1.0/default/Pointer.cpp b/tests/pointer/1.0/default/Pointer.cpp
new file mode 100644
index 0000000..d7cd772
--- /dev/null
+++ b/tests/pointer/1.0/default/Pointer.cpp
@@ -0,0 +1,19 @@
+#include "Pointer.h"
+
+namespace android {
+namespace hardware {
+namespace tests {
+namespace pointer {
+namespace V1_0 {
+namespace implementation {
+
+IPointer* HIDL_FETCH_IPointer(const char* /* name */) {
+    return new Pointer();
+}
+
+} // namespace implementation
+}  // namespace V1_0
+}  // namespace pointer
+}  // namespace tests
+}  // namespace hardware
+}  // namespace android
diff --git a/tests/pointer/1.0/default/Pointer.h b/tests/pointer/1.0/default/Pointer.h
new file mode 100644
index 0000000..1579aea
--- /dev/null
+++ b/tests/pointer/1.0/default/Pointer.h
@@ -0,0 +1,348 @@
+#ifndef HIDL_GENERATED_android_hardware_tests_pointer_V1_0_Pointer_H_
+#define HIDL_GENERATED_android_hardware_tests_pointer_V1_0_Pointer_H_
+
+#include <android/hardware/tests/pointer/1.0/IPointer.h>
+#include <android-base/logging.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+
+// TODO move to Pointer.cpp so that I won't have weird macros in headers
+#define PUSH_ERROR_IF(__cond__) if(__cond__) { errors.push_back(std::to_string(__LINE__) + ": " + #__cond__); }
+
+namespace android {
+namespace hardware {
+namespace tests {
+namespace pointer {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::tests::pointer::V1_0::IPointer;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Pointer : public IPointer {
+private:
+    std::vector<std::string> errors;
+public:
+    Return<int32_t> getErrors() {
+        if(!errors.empty()) {
+            for(const auto& e : errors)
+                ALOGW("SERVER(Pointer) error: %s", e.c_str());
+        }
+        return errors.size();
+    }
+    Return<void> foo1(const IPointer::Sam& s, IPointer::Sam const* s_ptr) override {
+        PUSH_ERROR_IF(!(&s == s_ptr));
+        return Void();
+    }
+    Return<void> foo2(const IPointer::Sam& s, const IPointer::Ada& a) override {
+        PUSH_ERROR_IF(!(&s == a.s_ptr));
+        return Void();
+    }
+    Return<void> foo3(const IPointer::Sam& s, const IPointer::Ada& a, const IPointer::Bob& b) override {
+        PUSH_ERROR_IF(!(&a == b.a_ptr && a.s_ptr == b.s_ptr && a.s_ptr == &s));
+        return Void();
+    }
+    Return<void> foo4(IPointer::Sam const* s_ptr) override {
+        PUSH_ERROR_IF(!(s_ptr->data == 500));
+        return Void();
+    }
+    Return<void> foo5(const IPointer::Ada& a, const IPointer::Bob& b) override {
+        PUSH_ERROR_IF(!(a.s_ptr == b.s_ptr && b.a_ptr == &a));
+        return Void();
+    }
+    Return<void> foo6(IPointer::Ada const* a_ptr) override {
+        PUSH_ERROR_IF(!(a_ptr->s_ptr->data == 500));
+        return Void();
+    }
+    Return<void> foo7(IPointer::Ada const* a_ptr, IPointer::Bob const* b_ptr) override {
+        PUSH_ERROR_IF(!(a_ptr->s_ptr == b_ptr->s_ptr && a_ptr == b_ptr->a_ptr && a_ptr->s_ptr->data == 500));
+        return Void();
+    }
+    Return<void> foo8(const IPointer::Dom& d) override {
+        const IPointer::Cin& c = d.c;
+        PUSH_ERROR_IF(&c.a != c.b_ptr->a_ptr);
+        PUSH_ERROR_IF(c.a.s_ptr != c.b_ptr->s_ptr);
+        PUSH_ERROR_IF(c.a.s_ptr->data != 500);
+        return Void();
+    }
+    Return<void> foo9(::android::hardware::hidl_string const* str_ref) override {
+        ALOGI("SERVER(Pointer) foo9 got string @ %p (size = %ld) \"%s\"",
+            str_ref->c_str(),
+            (unsigned long) str_ref->size(), str_ref->c_str());
+        PUSH_ERROR_IF(!(strcmp(str_ref->c_str(), "meowmeowmeow") == 0));
+        return Void();
+    }
+    Return<void> foo10(const ::android::hardware::hidl_vec<IPointer::Sam const*>& s_ptr_vec) override {
+        PUSH_ERROR_IF(s_ptr_vec[0]->data != 500);
+        if(s_ptr_vec.size() != 5) {
+            errors.push_back("foo10: s_ptr_vec.size() != 5");
+            return Void();
+        }
+        for(size_t i = 0; i < s_ptr_vec.size(); i++)
+            PUSH_ERROR_IF(s_ptr_vec[0] != s_ptr_vec[i]);
+        return Void();
+    }
+    Return<void> foo11(::android::hardware::hidl_vec<IPointer::Sam> const* s_vec_ptr) override {
+        if(s_vec_ptr->size() != 5) {
+            errors.push_back("foo11: s_vec_ptr->size() != 5");
+            return Void();
+        }
+        for(size_t i = 0; i < 5; i++)
+            PUSH_ERROR_IF((*s_vec_ptr)[i].data != 500);
+        return Void();
+    }
+    Return<void> foo12(hidl_array<IPointer::Sam, 5> const* s_array_ref) override {
+        for(size_t i = 0; i < 5; ++i)
+            PUSH_ERROR_IF((*s_array_ref)[i].data != 500);
+        return Void();
+    }
+    Return<void> foo13(const hidl_array<IPointer::Sam const*, 5>& s_ref_array) override {
+        PUSH_ERROR_IF(s_ref_array[0]->data != 500)
+        for(size_t i = 0; i < 5; i++)
+            PUSH_ERROR_IF(s_ref_array[i] != s_ref_array[0])
+        return Void();
+    }
+    Return<void> foo14(IPointer::Sam const* const* const* s_3ptr) override {
+        PUSH_ERROR_IF(!((***s_3ptr).data == 500))
+        return Void();
+    }
+    Return<void> foo15(int32_t const* const* const* i_3ptr) override {
+        PUSH_ERROR_IF(!((***i_3ptr) == 500))
+        return Void();
+    }
+
+    Return<void> foo16(const IPointer::Ptr& p) override {
+        PUSH_ERROR_IF((*p.array_ptr)[0].s_ptr->data != 500);
+        for(size_t i = 0; i < 5; i++) PUSH_ERROR_IF((*p.array_ptr)[i].s_ptr != (*p.array_ptr)[0].s_ptr);
+        PUSH_ERROR_IF(*(p.int_ptr) != 500);
+        for(size_t i = 0; i < 5; i++) PUSH_ERROR_IF((*p.int_array_ptr)[i] != 500);
+        for(size_t i = 0; i < 5; i++) PUSH_ERROR_IF(p.int_ptr_array[i] != p.int_ptr);
+        PUSH_ERROR_IF(p.a_ptr_vec.size() != 5);
+        PUSH_ERROR_IF(p.a_ptr_vec[0]->s_ptr->data != 500);
+        for(size_t i = 0; i < 5; i++) PUSH_ERROR_IF(p.a_ptr_vec[i]->s_ptr != p.a_ptr_vec[0]->s_ptr);
+        PUSH_ERROR_IF(strcmp(p.str_ref->c_str(), "meowmeowmeow") != 0);
+        PUSH_ERROR_IF(p.a_vec_ptr->size() != 5);
+        PUSH_ERROR_IF((*p.a_vec_ptr)[0].s_ptr->data != 500);
+        for(size_t i = 0; i < 5; i++) PUSH_ERROR_IF((*p.a_vec_ptr)[i].s_ptr != (*p.a_vec_ptr)[0].s_ptr);
+        return Void();
+    };
+    Return<void> foo17(IPointer::Ptr const* p) override {
+        return foo16(*p);
+    };
+    Return<void> foo18(hidl_string const* str_ref, hidl_string const* str_ref2, const hidl_string& str) override {
+        PUSH_ERROR_IF(&str != str_ref);
+        PUSH_ERROR_IF(str_ref != str_ref2);
+        PUSH_ERROR_IF(strcmp(str.c_str(), "meowmeowmeow") != 0)
+        return Void();
+    };
+    Return<void> foo19(
+                hidl_vec<IPointer::Ada> const* a_vec_ref,
+                const hidl_vec<IPointer::Ada>& a_vec,
+                hidl_vec<IPointer::Ada> const* a_vec_ref2) {
+        PUSH_ERROR_IF(&a_vec != a_vec_ref);
+        PUSH_ERROR_IF(a_vec_ref2 != a_vec_ref);
+        PUSH_ERROR_IF(a_vec.size() != 5);
+        PUSH_ERROR_IF(a_vec[0].s_ptr->data != 500);
+        for(size_t i = 0; i < 5; i++)
+            PUSH_ERROR_IF(a_vec[i].s_ptr != a_vec[0].s_ptr);
+        return Void();
+    };
+
+    Return<void> foo20(const hidl_vec<IPointer::Sam const*>&) override {
+        return Void();
+    }
+    Return<void> foo21(hidl_array<IPointer::Ada, 3, 2, 1> const* a_array_ptr) override {
+        const hidl_array<IPointer::Ada, 3, 2, 1>& a_array = *a_array_ptr;
+        PUSH_ERROR_IF(a_array[0][0][0].s_ptr->data != 500);
+        for(size_t i = 0; i < 3; i++)
+            for(size_t j = 0; j < 2; j++)
+                for(size_t k = 0; k < 1; k++)
+                    PUSH_ERROR_IF(a_array[i][j][k].s_ptr != a_array[0][0][0].s_ptr);
+        return Void();
+    }
+    Return<void> foo22(const hidl_array<IPointer::Ada const*, 3, 2, 1>& a_ptr_array) override {
+        PUSH_ERROR_IF(a_ptr_array[0][0][0]->s_ptr->data != 500);
+        for(size_t i = 0; i < 3; i++)
+            for(size_t j = 0; j < 2; j++)
+                for(size_t k = 0; k < 1; k++)
+                    PUSH_ERROR_IF(a_ptr_array[i][j][k] != a_ptr_array[0][0][0]);
+        return Void();
+    }
+
+    IPointer::Sam *s;
+    IPointer::Ada *a;
+    IPointer::Bob *b;
+    IPointer::Cin *c;
+    IPointer::Dom *d;
+
+    IPointer::Ptr p;
+    hidl_array<IPointer::Ada, 5> a_array;
+    int32_t someInt;
+    hidl_array<int32_t, 5> someIntArray;
+    hidl_string str;
+    hidl_vec<IPointer::Ada> a_vec;
+    Pointer() {
+        d = new IPointer::Dom();
+        s = new IPointer::Sam();
+        b = new IPointer::Bob();
+        c = &d->c;
+        a = &c->a;
+        b->s_ptr = a->s_ptr = s;
+        b->a_ptr = a;
+        c->b_ptr = b;
+        s->data = 500;
+
+        someInt = 500;
+        for(size_t i = 0; i < 5; i++) someIntArray[i] = 500;
+
+        for(size_t i = 0; i < 5; i++) a_array[i] = *a;
+
+        for(size_t i = 0; i < 5; i++) p.ptr_array[i] = a;
+        p.array_ptr = &a_array;
+        p.int_ptr = &someInt;
+        p.int_array_ptr = &someIntArray;
+        for(size_t i = 0; i < 5; i++) p.int_ptr_array[i] = &someInt;
+        p.a_ptr_vec.resize(5);
+        for(size_t i = 0; i < 5; i++) p.a_ptr_vec[i] = a;
+        str = "meowmeowmeow";
+        p.str_ref = &str;
+        a_vec.resize(5);
+        for(size_t i = 0; i < 5; i++) a_vec[i].s_ptr = s;
+        p.a_vec_ptr = &a_vec;
+    }
+    ~Pointer() {
+        delete d; delete s; delete b;
+    }
+    Return<void> bar1(bar1_cb _cb) override {
+        _cb(*s, s);
+        return Void();
+    }
+    Return<void> bar2(bar2_cb _cb) override {
+        _cb(*s, *a);
+        return Void();
+    }
+    Return<void> bar3(bar3_cb _cb) override {
+        _cb(*s, *a, *b);
+        return Void();
+    }
+    Return<void> bar4(bar4_cb _cb) override {
+        _cb(s);
+        return Void();
+    }
+    Return<void> bar5(bar5_cb _cb) override {
+        _cb(*a, *b);
+        return Void();
+    }
+    Return<void> bar6(bar6_cb _cb) override {
+        _cb(a);
+        return Void();
+    }
+    Return<void> bar7(bar7_cb _cb) override {
+        _cb(a, b);
+        return Void();
+    }
+    Return<void> bar8(bar8_cb _cb) override {
+        _cb(*d);
+        return Void();
+    }
+    Return<void> bar9(bar9_cb _cb) override {
+        _cb(&str);
+        return Void();
+    }
+    Return<void> bar10(bar10_cb _cb) override {
+        hidl_vec<const IPointer::Sam *> v; v.resize(5);
+        for(size_t i = 0; i < 5; i++) v[i] = s;
+        _cb(v);
+        return Void();
+    }
+    Return<void> bar11(bar11_cb _cb) override {
+        hidl_vec<IPointer::Sam> v; v.resize(5);
+        for(size_t i = 0; i < 5; i++) v[i].data = 500;
+            _cb(&v);
+        return Void();
+    }
+    Return<void> bar12(bar12_cb _cb) override {
+        hidl_array<IPointer::Sam, 5> array;
+        for(size_t i = 0; i < 5; i++) array[i] = *s;
+        _cb(&array);
+        return Void();
+    }
+    Return<void> bar13(bar13_cb _cb) override {
+        hidl_array<const IPointer::Sam *, 5> array;
+        for(size_t i = 0; i < 5; i++) array[i] = s;
+        _cb(array);
+        return Void();
+    }
+    Return<void> bar14(bar14_cb _cb) override {
+        IPointer::Sam const* p1 = s;
+        IPointer::Sam const* const* p2 = &p1;
+        _cb(&p2);
+        return Void();
+    }
+    Return<void> bar15(bar15_cb _cb) override {
+        int32_t const* p1 = &someInt;
+        int32_t const* const* p2 = &p1;
+        _cb(&p2);
+        return Void();
+    }
+    Return<void> bar16(bar16_cb _cb) override {
+        _cb(p);
+        return Void();
+    }
+    Return<void> bar17(bar17_cb _cb) override {
+        _cb(&p);
+        return Void();
+    }
+    Return<void> bar18(bar18_cb _cb) override {
+        _cb(&str, &str, str);
+        return Void();
+    }
+    Return<void> bar19(bar19_cb _cb) override {
+        _cb(&a_vec, a_vec, &a_vec);
+        return Void();
+    }
+    Return<void> bar20(bar20_cb _cb) override {
+        // 1026 == PARCEL_REF_CAP + 2.
+        // 1026 means 1 writeBuffer and 1025 writeReferences. 1025 > PARCEL_REF_CAP.
+        hidl_vec<const IPointer::Sam *> v; v.resize(1026);
+        for(size_t i = 0; i < 1026; i++) v[i] = s;
+        _cb(v);
+        return Void();
+    }
+    Return<void> bar21(bar21_cb _cb) override {
+        hidl_array<IPointer::Ada, 3, 2, 1> a_array;
+        for(size_t i = 0; i < 3; i++)
+            for(size_t j = 0; j < 2; j++)
+                for(size_t k = 0; k < 1; k++)
+                    a_array[i][j][k] = *a;
+        _cb(&a_array);
+        return Void();
+    }
+    Return<void> bar22(bar22_cb _cb) override {
+        hidl_array<const IPointer::Ada *, 3, 2, 1> a_ptr_array;
+        for(size_t i = 0; i < 3; i++)
+            for(size_t j = 0; j < 2; j++)
+                for(size_t k = 0; k < 1; k++)
+                    a_ptr_array[i][j][k] = a;
+        _cb(a_ptr_array);
+        return Void();
+    }
+};
+
+extern "C" IPointer* HIDL_FETCH_IPointer(const char* name);
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace pointer
+}  // namespace tests
+}  // namespace hardware
+}  // namespace android
+
+#undef PUSH_ERROR_IF
+
+#endif  // HIDL_GENERATED_android_hardware_tests_pointer_V1_0_Pointer_H_
diff --git a/thermal/1.0/Android.bp b/thermal/1.0/Android.bp
new file mode 100644
index 0000000..0c5dd19
--- /dev/null
+++ b/thermal/1.0/Android.bp
@@ -0,0 +1,46 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+    name: "android.hardware.thermal@1.0_genc++",
+    tool: "hidl-gen",
+    cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.thermal@1.0",
+    srcs: [
+        "types.hal",
+        "IThermal.hal",
+    ],
+    out: [
+        "android/hardware/thermal/1.0/types.cpp",
+        "android/hardware/thermal/1.0/ThermalAll.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.thermal@1.0_genc++_headers",
+    tool: "hidl-gen",
+    cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.thermal@1.0",
+    srcs: [
+        "types.hal",
+        "IThermal.hal",
+    ],
+    out: [
+        "android/hardware/thermal/1.0/types.h",
+        "android/hardware/thermal/1.0/IThermal.h",
+        "android/hardware/thermal/1.0/IHwThermal.h",
+        "android/hardware/thermal/1.0/BnThermal.h",
+        "android/hardware/thermal/1.0/BpThermal.h",
+        "android/hardware/thermal/1.0/BsThermal.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.thermal@1.0",
+    generated_sources: ["android.hardware.thermal@1.0_genc++"],
+    generated_headers: ["android.hardware.thermal@1.0_genc++_headers"],
+    export_generated_headers: ["android.hardware.thermal@1.0_genc++_headers"],
+    shared_libs: [
+        "libhidl",
+        "libhwbinder",
+        "libutils",
+        "libcutils",
+    ],
+}
diff --git a/thermal/1.0/Android.mk b/thermal/1.0/Android.mk
new file mode 100644
index 0000000..47a4d61
--- /dev/null
+++ b/thermal/1.0/Android.mk
@@ -0,0 +1,306 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.thermal@1.0-java
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build types.hal (CoolingDevice)
+#
+GEN := $(intermediates)/android/hardware/thermal/1.0/CoolingDevice.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 \
+        android.hardware.thermal@1.0::types.CoolingDevice
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CoolingType)
+#
+GEN := $(intermediates)/android/hardware/thermal/1.0/CoolingType.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 \
+        android.hardware.thermal@1.0::types.CoolingType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CpuUsage)
+#
+GEN := $(intermediates)/android/hardware/thermal/1.0/CpuUsage.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 \
+        android.hardware.thermal@1.0::types.CpuUsage
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Temperature)
+#
+GEN := $(intermediates)/android/hardware/thermal/1.0/Temperature.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 \
+        android.hardware.thermal@1.0::types.Temperature
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (TemperatureType)
+#
+GEN := $(intermediates)/android/hardware/thermal/1.0/TemperatureType.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 \
+        android.hardware.thermal@1.0::types.TemperatureType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (ThermalStatus)
+#
+GEN := $(intermediates)/android/hardware/thermal/1.0/ThermalStatus.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 \
+        android.hardware.thermal@1.0::types.ThermalStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (ThermalStatusCode)
+#
+GEN := $(intermediates)/android/hardware/thermal/1.0/ThermalStatusCode.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 \
+        android.hardware.thermal@1.0::types.ThermalStatusCode
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IThermal.hal
+#
+GEN := $(intermediates)/android/hardware/thermal/1.0/IThermal.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IThermal.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava -randroid.hardware:hardware/interfaces \
+        android.hardware.thermal@1.0::IThermal
+
+$(GEN): $(LOCAL_PATH)/IThermal.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.thermal@1.0-java-static
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build types.hal (CoolingDevice)
+#
+GEN := $(intermediates)/android/hardware/thermal/1.0/CoolingDevice.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 \
+        android.hardware.thermal@1.0::types.CoolingDevice
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CoolingType)
+#
+GEN := $(intermediates)/android/hardware/thermal/1.0/CoolingType.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 \
+        android.hardware.thermal@1.0::types.CoolingType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CpuUsage)
+#
+GEN := $(intermediates)/android/hardware/thermal/1.0/CpuUsage.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 \
+        android.hardware.thermal@1.0::types.CpuUsage
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Temperature)
+#
+GEN := $(intermediates)/android/hardware/thermal/1.0/Temperature.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 \
+        android.hardware.thermal@1.0::types.Temperature
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (TemperatureType)
+#
+GEN := $(intermediates)/android/hardware/thermal/1.0/TemperatureType.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 \
+        android.hardware.thermal@1.0::types.TemperatureType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (ThermalStatus)
+#
+GEN := $(intermediates)/android/hardware/thermal/1.0/ThermalStatus.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 \
+        android.hardware.thermal@1.0::types.ThermalStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (ThermalStatusCode)
+#
+GEN := $(intermediates)/android/hardware/thermal/1.0/ThermalStatusCode.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 \
+        android.hardware.thermal@1.0::types.ThermalStatusCode
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IThermal.hal
+#
+GEN := $(intermediates)/android/hardware/thermal/1.0/IThermal.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IThermal.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava -randroid.hardware:hardware/interfaces \
+        android.hardware.thermal@1.0::IThermal
+
+$(GEN): $(LOCAL_PATH)/IThermal.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/thermal/1.0/IThermal.hal b/thermal/1.0/IThermal.hal
new file mode 100644
index 0000000..a60bc7d
--- /dev/null
+++ b/thermal/1.0/IThermal.hal
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+
+package android.hardware.thermal@1.0;
+
+interface IThermal {
+
+    /*
+     * Retrieves temperatures in Celsius.
+     *
+     * @return status Status of the operation. If status code is FAILURE,
+     *         the status.debugMessage must be populated with the human-readable
+     *         error message.
+     * @return temperatures If status code is SUCCESS, it's filled with the
+     *         current temperatures. The order of temperatures of built-in
+     *         devices (such as CPUs, GPUs and etc.) in the list must be kept
+     *         the same regardless the number of calls to this method even if
+     *         they go offline, if these devices exist on boot. The method
+     *         always returns and never removes such temperatures.
+     *
+     */
+    getTemperatures()
+        generates (ThermalStatus status, vec<Temperature> temperatures);
+
+    /*
+     * Retrieves CPU usage information of each core: active and total times
+     * in ms since first boot.
+     *
+     * @return status Status of the operation. If status code is FAILURE,
+     *         the status.debugMessage must be populated with the human-readable
+     *         error message.
+     * @return cpuUsages If status code is SUCCESS, it's filled with the current
+     *         CPU usages. The order and number of CPUs in the list must be kept
+     *         the same regardless the number of calls to this method.
+     *
+     */
+    getCpuUsages() generates (ThermalStatus status, vec<CpuUsage> cpuUsages);
+
+    /*
+     * Retrieves the cooling devices information.
+     *
+     * @return status Status of the operation. If status code is FAILURE,
+     *         the status.debugMessage must be populated with the human-readable
+     *         error message.
+     * @return devices If status code is SUCCESS, it's filled with the current
+     *         cooling device information. The order of built-in cooling
+     *         devices in the list must be kept the same regardless the number
+     *         of calls to this method even if they go offline, if these devices
+     *         exist on boot. The method always returns and never removes from
+     *         the list such cooling devices.
+     *
+     */
+    getCoolingDevices()
+        generates (ThermalStatus status, vec<CoolingDevice> devices);
+
+};
diff --git a/thermal/1.0/default/Android.bp b/thermal/1.0/default/Android.bp
new file mode 100644
index 0000000..626dcaf
--- /dev/null
+++ b/thermal/1.0/default/Android.bp
@@ -0,0 +1,16 @@
+cc_library_shared {
+    name: "android.hardware.thermal@1.0-impl",
+    relative_install_path: "hw",
+    srcs: ["Thermal.cpp"],
+    shared_libs: [
+        "liblog",
+        "libcutils",
+        "libhardware",
+        "libhwbinder",
+        "libbase",
+        "libcutils",
+        "libutils",
+        "libhidl",
+        "android.hardware.thermal@1.0",
+    ],
+}
diff --git a/thermal/1.0/default/Android.mk b/thermal/1.0/default/Android.mk
new file mode 100644
index 0000000..fa7414e
--- /dev/null
+++ b/thermal/1.0/default/Android.mk
@@ -0,0 +1,39 @@
+#
+# 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_RELATIVE_PATH := hw
+LOCAL_MODULE := android.hardware.thermal@1.0-service
+LOCAL_INIT_RC := android.hardware.thermal@1.0-service.rc
+LOCAL_SRC_FILES := \
+        service.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+        liblog \
+        libcutils \
+        libdl \
+        libbase \
+        libutils \
+        libhardware_legacy \
+        libhardware \
+
+LOCAL_SHARED_LIBRARIES += \
+        libhwbinder \
+        libhidl \
+        android.hardware.thermal@1.0 \
+
+include $(BUILD_EXECUTABLE)
diff --git a/thermal/1.0/default/Thermal.cpp b/thermal/1.0/default/Thermal.cpp
new file mode 100644
index 0000000..1b91687
--- /dev/null
+++ b/thermal/1.0/default/Thermal.cpp
@@ -0,0 +1,202 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "android.hardware.thermal@1.0-impl"
+#include <utils/Log.h>
+
+#include <errno.h>
+#include <hardware/hardware.h>
+#include <hardware/thermal.h>
+
+#include "Thermal.h"
+
+namespace android {
+namespace hardware {
+namespace thermal {
+namespace V1_0 {
+namespace implementation {
+
+Thermal::Thermal(thermal_module_t* module) : mModule(module) {
+}
+
+// Methods from ::android::hardware::thermal::V1_0::IThermal follow.
+Return<void> Thermal::getTemperatures(getTemperatures_cb _hidl_cb)  {
+    ThermalStatus status;
+    status.code = ThermalStatusCode::SUCCESS;
+    hidl_vec<Temperature> temperatures;
+
+    if (!mModule || !mModule->getTemperatures) {
+        ALOGI("getTemperatures is not implemented in Thermal HAL.");
+        _hidl_cb(status, temperatures);
+        return Void();
+    }
+
+    ssize_t list_size = mModule->getTemperatures(mModule, nullptr, 0);
+    if (list_size >= 0) {
+       temperature_t *list = new temperature_t[list_size];
+       ssize_t size = mModule->getTemperatures(mModule, list, list_size);
+       if (size >= 0) {
+           if (list_size > size) {
+               list_size = size;
+           }
+
+           temperatures.resize(list_size);
+           for (ssize_t i = 0; i < list_size; ++i) {
+               switch (list[i].type) {
+                   case DEVICE_TEMPERATURE_UNKNOWN:
+                       temperatures[i].type = TemperatureType::UNKNOWN;
+                       break;
+                   case DEVICE_TEMPERATURE_CPU:
+                       temperatures[i].type = TemperatureType::CPU;
+                       break;
+                   case DEVICE_TEMPERATURE_GPU:
+                       temperatures[i].type = TemperatureType::GPU;
+                       break;
+                   case DEVICE_TEMPERATURE_BATTERY:
+                       temperatures[i].type = TemperatureType::BATTERY;
+                       break;
+                   case DEVICE_TEMPERATURE_SKIN:
+                       temperatures[i].type = TemperatureType::SKIN;
+                       break;
+                   default:
+                       ALOGE("Unknown temperature %s type", list[i].name);;
+               }
+               temperatures[i].name = list[i].name;
+               temperatures[i].currentValue = list[i].current_value;
+               temperatures[i].throttlingThreshold = list[i].throttling_threshold;
+               temperatures[i].shutdownThreshold = list[i].shutdown_threshold;
+               temperatures[i].vrThrottlingThreshold = list[i].vr_throttling_threshold;
+           }
+       } else {
+           status.code = ThermalStatusCode::FAILURE;
+           status.debugMessage = strerror(-size);
+       }
+       delete[] list;
+    } else {
+        status.code = ThermalStatusCode::FAILURE;
+        status.debugMessage = strerror(-list_size);
+    }
+    _hidl_cb(status, temperatures);
+    return Void();
+}
+
+Return<void> Thermal::getCpuUsages(getCpuUsages_cb _hidl_cb)  {
+    ThermalStatus status;
+    hidl_vec<CpuUsage> cpuUsages;
+    status.code = ThermalStatusCode::SUCCESS;
+
+    if (!mModule || !mModule->getCpuUsages) {
+        ALOGI("getCpuUsages is not implemented in Thermal HAL");
+        _hidl_cb(status, cpuUsages);
+        return Void();
+    }
+
+    ssize_t size = mModule->getCpuUsages(mModule, nullptr);
+    if (size >= 0) {
+        cpu_usage_t *list = new cpu_usage_t[size];
+        size = mModule->getCpuUsages(mModule, list);
+        if (size >= 0) {
+            cpuUsages.resize(size);
+            for (ssize_t i = 0; i < size; ++i) {
+                cpuUsages[i].name = list[i].name;
+                cpuUsages[i].active = list[i].active;
+                cpuUsages[i].total = list[i].total;
+                cpuUsages[i].isOnline = list[i].is_online;
+            }
+        } else {
+            status.code = ThermalStatusCode::FAILURE;
+            status.debugMessage = strerror(-size);
+        }
+        delete[] list;
+    } else {
+        status.code = ThermalStatusCode::FAILURE;
+        status.debugMessage = strerror(-size);
+    }
+    _hidl_cb(status, cpuUsages);
+    return Void();
+}
+
+Return<void> Thermal::getCoolingDevices(getCoolingDevices_cb _hidl_cb)  {
+    ThermalStatus status;
+    status.code = ThermalStatusCode::SUCCESS;
+    hidl_vec<CoolingDevice> coolingDevices;
+
+    if (!mModule || !mModule->getCoolingDevices) {
+        ALOGI("getCoolingDevices is not implemented in Thermal HAL.");
+        _hidl_cb(status, coolingDevices);
+        return Void();
+    }
+
+    ssize_t list_size = mModule->getCoolingDevices(mModule, nullptr, 0);
+    if (list_size >= 0) {
+        cooling_device_t *list = new cooling_device_t[list_size];
+        ssize_t size = mModule->getCoolingDevices(mModule, list, list_size);
+        if (size >= 0) {
+            if (list_size > size) {
+                list_size = size;
+            }
+            coolingDevices.resize(list_size);
+            for (ssize_t i = 0; i < list_size; ++i) {
+                switch (list[i].type) {
+                    case FAN_RPM:
+                        coolingDevices[i].type = CoolingType::FAN_RPM;
+                        break;
+                    default:
+                        ALOGE("Unknown cooling device %s type", list[i].name);
+                }
+                coolingDevices[i].name = list[i].name;
+                coolingDevices[i].currentValue = list[i].current_value;
+            }
+
+        } else {
+            status.code = ThermalStatusCode::FAILURE;
+            status.debugMessage = strerror(-size);
+        }
+        delete[] list;
+    } else {
+        status.code = ThermalStatusCode::FAILURE;
+        status.debugMessage = strerror(-list_size);
+    }
+    _hidl_cb(status, coolingDevices);
+    return Void();
+}
+
+IThermal* HIDL_FETCH_IThermal(const char* /* name */) {
+    thermal_module_t* module;
+    status_t err = hw_get_module(THERMAL_HARDWARE_MODULE_ID,
+            const_cast<hw_module_t const**>(reinterpret_cast<hw_module_t**>(&module)));
+    if (err || !module) {
+        ALOGE("Couldn't load %s module (%s)", THERMAL_HARDWARE_MODULE_ID,
+              strerror(-err));
+    }
+
+    if (err == 0 && module->common.methods->open) {
+        struct hw_device_t* device;
+        err = module->common.methods->open(&module->common, THERMAL_HARDWARE_MODULE_ID, &device);
+        if (err) {
+            ALOGE("Couldn't open %s module (%s)", THERMAL_HARDWARE_MODULE_ID, strerror(-err));
+        } else {
+            return new Thermal(reinterpret_cast<thermal_module_t*>(device));
+        }
+    }
+    return new Thermal(module);
+}
+
+} // namespace implementation
+}  // namespace V1_0
+}  // namespace thermal
+}  // namespace hardware
+}  // namespace android
diff --git a/thermal/1.0/default/Thermal.h b/thermal/1.0/default/Thermal.h
new file mode 100644
index 0000000..8212ab9
--- /dev/null
+++ b/thermal/1.0/default/Thermal.h
@@ -0,0 +1,45 @@
+#ifndef HIDL_GENERATED_android_hardware_thermal_V1_0_Thermal_H_
+#define HIDL_GENERATED_android_hardware_thermal_V1_0_Thermal_H_
+
+#include <android/hardware/thermal/1.0/IThermal.h>
+#include <hidl/Status.h>
+#include <hardware/thermal.h>
+
+#include <hidl/MQDescriptor.h>
+
+namespace android {
+namespace hardware {
+namespace thermal {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::thermal::V1_0::CoolingDevice;
+using ::android::hardware::thermal::V1_0::CpuUsage;
+using ::android::hardware::thermal::V1_0::IThermal;
+using ::android::hardware::thermal::V1_0::Temperature;
+using ::android::hardware::thermal::V1_0::ThermalStatus;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Thermal : public IThermal {
+    Thermal(thermal_module_t* module);
+    // Methods from ::android::hardware::thermal::V1_0::IThermal follow.
+    Return<void> getTemperatures(getTemperatures_cb _hidl_cb)  override;
+    Return<void> getCpuUsages(getCpuUsages_cb _hidl_cb)  override;
+    Return<void> getCoolingDevices(getCoolingDevices_cb _hidl_cb)  override;
+    private:
+        thermal_module_t* mModule;
+};
+
+extern "C" IThermal* HIDL_FETCH_IThermal(const char* name);
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace thermal
+}  // namespace hardware
+}  // namespace android
+
+#endif  // HIDL_GENERATED_android_hardware_thermal_V1_0_Thermal_H_
diff --git a/thermal/1.0/default/android.hardware.thermal@1.0-service.rc b/thermal/1.0/default/android.hardware.thermal@1.0-service.rc
new file mode 100644
index 0000000..cc7ba6a
--- /dev/null
+++ b/thermal/1.0/default/android.hardware.thermal@1.0-service.rc
@@ -0,0 +1,4 @@
+service thermal-hal-1-0 /system/bin/hw/android.hardware.thermal@1.0-service
+    class hal
+    user system
+    group system readproc
diff --git a/thermal/1.0/default/service.cpp b/thermal/1.0/default/service.cpp
new file mode 100644
index 0000000..b09b5ec
--- /dev/null
+++ b/thermal/1.0/default/service.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <iostream>
+#include <unistd.h>
+
+#include <android/hardware/thermal/1.0/IThermal.h>
+
+#include <hidl/IServiceManager.h>
+#include <hwbinder/IPCThreadState.h>
+#include <hwbinder/ProcessState.h>
+#include <utils/Errors.h>
+
+#define LOG_TAG "android.hardware.thermal@1.0-service"
+#include <utils/Log.h>
+#include <utils/StrongPointer.h>
+
+using android::sp;
+
+// libhwbinder:
+using android::hardware::IPCThreadState;
+using android::hardware::ProcessState;
+
+// Generated HIDL files
+using android::hardware::thermal::V1_0::IThermal;
+
+int main() {
+    const char instance[] = "thermal";
+    sp<IThermal> service = IThermal::getService(instance, true /* getStub */);
+    if (service.get() == nullptr) {
+        ALOGE("IThermal::getService returned NULL, exiting");
+        return EXIT_FAILURE;
+    }
+    LOG_FATAL_IF(service->isRemote(), "Implementation is REMOTE!");
+    service->registerAsService(instance);
+
+    ProcessState::self()->setThreadPoolMaxThreadCount(0);
+    ProcessState::self()->startThreadPool();
+    IPCThreadState::self()->joinThreadPool();
+}
diff --git a/thermal/1.0/types.hal b/thermal/1.0/types.hal
new file mode 100644
index 0000000..b3dcc7d
--- /dev/null
+++ b/thermal/1.0/types.hal
@@ -0,0 +1,140 @@
+/*
+ * 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.
+ */
+
+package android.hardware.thermal@1.0;
+
+/** Device temperature types */
+enum TemperatureType : int32_t {
+    UNKNOWN = -1,
+    CPU = 0,
+    GPU = 1,
+    BATTERY = 2,
+    SKIN = 3,
+};
+
+enum CoolingType : int32_t {
+    /** Fan cooling device speed in RPM. */
+    FAN_RPM = 0,
+};
+
+struct Temperature {
+    /**
+     * This temperature's type.
+     */
+    TemperatureType type;
+
+    /**
+     * Name of this temperature.
+     * All temperatures of the same "type" must have a different "name",
+     * e.g., cpu0, battery.
+     */
+    string name;
+
+    /**
+     * Current temperature in Celsius. If not available set by HAL to
+     * UNKNOWN_TEMPERATURE.
+     * Current temperature can be in any units if type=UNKNOWN.
+     */
+    float currentValue;
+
+    /**
+     * Throttling temperature constant for this temperature.
+     * If not available, set by HAL to UNKNOWN_TEMPERATURE.
+     */
+    float throttlingThreshold;
+
+    /**
+     * Shutdown temperature constant for this temperature.
+     * If not available, set by HAL to UNKNOWN_TEMPERATURE.
+     */
+    float shutdownThreshold;
+
+    /**
+     * Threshold temperature above which the VR mode clockrate minimums cannot
+     * be maintained for this device.
+     * If not available, set by HAL to UNKNOWN_TEMPERATURE.
+     */
+    float vrThrottlingThreshold;
+
+};
+
+struct CoolingDevice {
+    /**
+     * This cooling device type.
+     */
+    CoolingType type;
+
+    /**
+     * Name of this cooling device.
+     * All cooling devices of the same "type" must have a different "name".
+     */
+    string name;
+
+    /**
+     * Current cooling device value. Units depend on cooling device "type".
+     */
+    float currentValue;
+
+};
+
+struct CpuUsage {
+    /**
+     * Name of this CPU.
+     * All CPUs must have a different "name".
+     */
+    string name;
+
+    /**
+     * Active time since the last boot in ms.
+     */
+    uint64_t active;
+
+    /**
+     * Total time since the last boot in ms.
+     */
+    uint64_t total;
+
+    /**
+     * Is set to true when a core is online.
+     * If the core is offline, all other members except |name| should be ignored.
+     */
+    bool isOnline;
+
+};
+
+enum ThermalStatusCode : uint32_t {
+    /** No errors. */
+    SUCCESS,
+    /** Unknown failure occured. */
+    FAILURE
+};
+
+/**
+ * Generic structure to return the status of any thermal operation.
+ */
+struct ThermalStatus {
+    ThermalStatusCode code;
+
+    /**
+     * A specific error message to provide more information.
+     * This can be used for debugging purposes only.
+     */
+    string debugMessage;
+};
+
+/**
+ * TODO(pbond): add float constant UNDEFINED_TEMPERATURE.
+ */
diff --git a/vibrator/1.0/vts/Android.mk b/vibrator/1.0/vts/Android.mk
new file mode 100644
index 0000000..cb70548
--- /dev/null
+++ b/vibrator/1.0/vts/Android.mk
@@ -0,0 +1,55 @@
+#
+# 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)
+
+# build VTS driver for Vibrator v1.0.
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libvts_driver_hidl_vibrator@1.0
+
+LOCAL_SRC_FILES := \
+  Vibrator.vts \
+  types.vts \
+
+LOCAL_C_INCLUDES := \
+  android.hardware.vibrator@1.0 \
+  system/core/base/include \
+  system/core/include \
+
+LOCAL_SHARED_LIBRARIES += \
+  android.hardware.vibrator@1.0 \
+  libbase \
+  libutils \
+  libcutils \
+  liblog \
+  libhidl \
+  libhwbinder \
+  libprotobuf-cpp-full \
+  libvts_common \
+  libvts_datatype \
+  libvts_measurement \
+  libvts_multidevice_proto \
+
+LOCAL_CFLAGS += -DENABLE_TREBLE
+
+LOCAL_STATIC_LIBRARIES := \
+
+LOCAL_PROTOC_OPTIMIZE_TYPE := full
+
+LOCAL_MULTILIB := both
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/vibrator/1.0/vts/Vibrator.vts b/vibrator/1.0/vts/Vibrator.vts
new file mode 100644
index 0000000..f1ab053
--- /dev/null
+++ b/vibrator/1.0/vts/Vibrator.vts
@@ -0,0 +1,30 @@
+component_class: HAL_HIDL
+component_type_version: 1.0
+component_name: "IVibrator"
+
+package: "android.hardware.vibrator"
+
+import: "android.hardware.vibrator@1.0::types"
+
+interface: {
+    api: {
+        name: "on"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "Status"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "uint32_t"
+        }
+    }
+
+    api: {
+        name: "off"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "Status"
+        }
+    }
+
+}
diff --git a/vibrator/1.0/vts/types.vts b/vibrator/1.0/vts/types.vts
new file mode 100644
index 0000000..0eba051
--- /dev/null
+++ b/vibrator/1.0/vts/types.vts
@@ -0,0 +1,24 @@
+component_class: HAL_HIDL
+component_type_version: 1.0
+component_name: "types"
+
+package: "android.hardware.vibrator"
+
+
+attribute: {
+    name: "Status"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "uint32_t"
+
+        enumerator: "OK"
+        scalar_value: {
+            uint32_t: 0
+        }
+        enumerator: "ERR"
+        scalar_value: {
+            uint32_t: 1
+        }
+    }
+}
+