Merge "Emit android.hardware.thermal@1.0-java-constants library"
diff --git a/Android.bp b/Android.bp
index 3c441bb..7aef46b 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,53 +1,3 @@
-// This is an autogenerated file, do not edit.
 subdirs = [
-    "audio/2.0",
-    "audio/2.0/default",
-    "audio/common/2.0",
-    "audio/effect/2.0",
-    "benchmarks/msgq/1.0",
-    "biometrics/fingerprint/2.1",
-    "bluetooth/1.0",
-    "boot/1.0",
-    "broadcastradio/1.0",
-    "example/extension/light/2.0",
-    "gnss/1.0",
-    "graphics/allocator/2.0",
-    "graphics/allocator/2.0/default",
-    "graphics/composer/2.1",
-    "graphics/composer/2.1/default",
-    "graphics/mapper/2.0",
-    "graphics/mapper/2.0/default",
-    "light/2.0",
-    "memtrack/1.0",
-    "memtrack/1.0/default",
-    "nfc/1.0",
-    "nfc/1.0/default",
-    "power/1.0",
-    "power/1.0/default",
-    "radio/1.0",
-    "sensors/1.0",
-    "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/foo/1.0/default/lib",
-    "tests/libhwbinder/1.0",
-    "tests/libhwbinder/1.0/default",
-    "tests/msgq/1.0",
-    "tests/pointer/1.0",
-    "tests/pointer/1.0/default",
-    "tests/pointer/1.0/default/lib",
-    "thermal/1.0",
-    "thermal/1.0/default",
-    "vehicle/2.0",
-    "vibrator/1.0",
-    "vibrator/1.0/default",
-    "vr/1.0",
-    "vr/1.0/default",
-    "wifi/1.0",
-    "wifi/supplicant/1.0",
+    "*"
 ]
diff --git a/audio/2.0/Android.bp b/audio/2.0/Android.bp
index 5edb042..2fd2d67 100644
--- a/audio/2.0/Android.bp
+++ b/audio/2.0/Android.bp
@@ -93,4 +93,9 @@
         "android.hardware.audio.common@2.0",
         "android.hardware.audio.effect@2.0",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/audio/2.0/Android.mk b/audio/2.0/Android.mk
new file mode 100644
index 0000000..8557ea2
--- /dev/null
+++ b/audio/2.0/Android.mk
@@ -0,0 +1,44 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.audio@2.0-java-constants
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+#
+GEN := $(intermediates)/android/hardware/audio/2.0/Constants.java
+$(GEN): $(HIDL)
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/IDevice.hal
+$(GEN): $(LOCAL_PATH)/IDevicesFactory.hal
+$(GEN): $(LOCAL_PATH)/IPrimaryDevice.hal
+$(GEN): $(LOCAL_PATH)/IStream.hal
+$(GEN): $(LOCAL_PATH)/IStreamIn.hal
+$(GEN): $(LOCAL_PATH)/IStreamOut.hal
+$(GEN): $(LOCAL_PATH)/IStreamOutCallback.hal
+
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava-constants -randroid.hardware:hardware/interfaces \
+        android.hardware.audio@2.0
+
+$(GEN):
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+# Avoid dependency cycle of framework.jar -> this-library -> framework.jar
+LOCAL_NO_STANDARD_LIBRARIES := true
+LOCAL_JAVA_LIBRARIES := core-oj
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/audio/Android.bp b/audio/Android.bp
new file mode 100644
index 0000000..4117288
--- /dev/null
+++ b/audio/Android.bp
@@ -0,0 +1,6 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "2.0",
+    "common/2.0",
+    "effect/2.0",
+]
diff --git a/audio/common/2.0/Android.bp b/audio/common/2.0/Android.bp
index 655c0c9..783623a 100644
--- a/audio/common/2.0/Android.bp
+++ b/audio/common/2.0/Android.bp
@@ -35,4 +35,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/audio/common/2.0/Android.mk b/audio/common/2.0/Android.mk
new file mode 100644
index 0000000..f8346b1
--- /dev/null
+++ b/audio/common/2.0/Android.mk
@@ -0,0 +1,37 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.audio.common@2.0-java-constants
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+#
+GEN := $(intermediates)/android/hardware/audio/common/2.0/Constants.java
+$(GEN): $(HIDL)
+$(GEN): $(LOCAL_PATH)/types.hal
+
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava-constants -randroid.hardware:hardware/interfaces \
+        android.hardware.audio.common@2.0
+
+$(GEN):
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+# Avoid dependency cycle of framework.jar -> this-library -> framework.jar
+LOCAL_NO_STANDARD_LIBRARIES := true
+LOCAL_JAVA_LIBRARIES := core-oj
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/audio/effect/2.0/Android.bp b/audio/effect/2.0/Android.bp
index 4dd2b1e..31c1b90 100644
--- a/audio/effect/2.0/Android.bp
+++ b/audio/effect/2.0/Android.bp
@@ -148,4 +148,9 @@
         "libcutils",
         "android.hardware.audio.common@2.0",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/audio/effect/2.0/Android.mk b/audio/effect/2.0/Android.mk
new file mode 100644
index 0000000..a30de1c
--- /dev/null
+++ b/audio/effect/2.0/Android.mk
@@ -0,0 +1,51 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.audio.effect@2.0-java-constants
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+#
+GEN := $(intermediates)/android/hardware/audio/effect/2.0/Constants.java
+$(GEN): $(HIDL)
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/IAcousticEchoCancelerEffect.hal
+$(GEN): $(LOCAL_PATH)/IAutomaticGainControlEffect.hal
+$(GEN): $(LOCAL_PATH)/IBassBoostEffect.hal
+$(GEN): $(LOCAL_PATH)/IDownmixEffect.hal
+$(GEN): $(LOCAL_PATH)/IEffect.hal
+$(GEN): $(LOCAL_PATH)/IEffectBufferProviderCallback.hal
+$(GEN): $(LOCAL_PATH)/IEffectsFactory.hal
+$(GEN): $(LOCAL_PATH)/IEnvironmentalReverbEffect.hal
+$(GEN): $(LOCAL_PATH)/IEqualizerEffect.hal
+$(GEN): $(LOCAL_PATH)/ILoudnessEnhancerEffect.hal
+$(GEN): $(LOCAL_PATH)/INoiseSuppressionEffect.hal
+$(GEN): $(LOCAL_PATH)/IPresetReverbEffect.hal
+$(GEN): $(LOCAL_PATH)/IVirtualizerEffect.hal
+$(GEN): $(LOCAL_PATH)/IVisualizerEffect.hal
+
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava-constants -randroid.hardware:hardware/interfaces \
+        android.hardware.audio.effect@2.0
+
+$(GEN):
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+# Avoid dependency cycle of framework.jar -> this-library -> framework.jar
+LOCAL_NO_STANDARD_LIBRARIES := true
+LOCAL_JAVA_LIBRARIES := core-oj
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/benchmarks/Android.bp b/benchmarks/Android.bp
new file mode 100644
index 0000000..ab0f308
--- /dev/null
+++ b/benchmarks/Android.bp
@@ -0,0 +1,4 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "msgq/1.0",
+]
diff --git a/biometrics/Android.bp b/biometrics/Android.bp
new file mode 100644
index 0000000..eea4604
--- /dev/null
+++ b/biometrics/Android.bp
@@ -0,0 +1,4 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "fingerprint/2.1",
+]
diff --git a/biometrics/fingerprint/2.1/Android.bp b/biometrics/fingerprint/2.1/Android.bp
index 77b41b8..e1fd755 100644
--- a/biometrics/fingerprint/2.1/Android.bp
+++ b/biometrics/fingerprint/2.1/Android.bp
@@ -51,4 +51,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/bluetooth/Android.bp b/bluetooth/Android.bp
new file mode 100644
index 0000000..bbb3e4b
--- /dev/null
+++ b/bluetooth/Android.bp
@@ -0,0 +1,4 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "1.0",
+]
diff --git a/boot/Android.bp b/boot/Android.bp
new file mode 100644
index 0000000..bbb3e4b
--- /dev/null
+++ b/boot/Android.bp
@@ -0,0 +1,4 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "1.0",
+]
diff --git a/broadcastradio/1.0/Android.bp b/broadcastradio/1.0/Android.bp
index 44af4aa..7883d67 100644
--- a/broadcastradio/1.0/Android.bp
+++ b/broadcastradio/1.0/Android.bp
@@ -67,4 +67,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/broadcastradio/Android.bp b/broadcastradio/Android.bp
new file mode 100644
index 0000000..bbb3e4b
--- /dev/null
+++ b/broadcastradio/Android.bp
@@ -0,0 +1,4 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "1.0",
+]
diff --git a/example/Android.bp b/example/Android.bp
new file mode 100644
index 0000000..ea6dbb5
--- /dev/null
+++ b/example/Android.bp
@@ -0,0 +1,4 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "extension/light/2.0",
+]
diff --git a/example/extension/light/2.0/Android.bp b/example/extension/light/2.0/Android.bp
index 42f34f2..3e6d2b1 100644
--- a/example/extension/light/2.0/Android.bp
+++ b/example/extension/light/2.0/Android.bp
@@ -44,4 +44,9 @@
         "libcutils",
         "android.hardware.light@2.0",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/gnss/1.0/Android.bp b/gnss/1.0/Android.bp
index a97531d..fe90f1e 100644
--- a/gnss/1.0/Android.bp
+++ b/gnss/1.0/Android.bp
@@ -171,4 +171,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/gnss/Android.bp b/gnss/Android.bp
new file mode 100644
index 0000000..bbb3e4b
--- /dev/null
+++ b/gnss/Android.bp
@@ -0,0 +1,4 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "1.0",
+]
diff --git a/graphics/Android.bp b/graphics/Android.bp
new file mode 100644
index 0000000..92bcb2a
--- /dev/null
+++ b/graphics/Android.bp
@@ -0,0 +1,9 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "allocator/2.0",
+    "allocator/2.0/default",
+    "composer/2.1",
+    "composer/2.1/default",
+    "mapper/2.0",
+    "mapper/2.0/default",
+]
diff --git a/graphics/allocator/2.0/Android.bp b/graphics/allocator/2.0/Android.bp
index f29c50b..1e9edac 100644
--- a/graphics/allocator/2.0/Android.bp
+++ b/graphics/allocator/2.0/Android.bp
@@ -43,4 +43,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/graphics/allocator/2.0/Android.mk b/graphics/allocator/2.0/Android.mk
new file mode 100644
index 0000000..3165fed
--- /dev/null
+++ b/graphics/allocator/2.0/Android.mk
@@ -0,0 +1,38 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.graphics.allocator@2.0-java-constants
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+#
+GEN := $(intermediates)/android/hardware/graphics/allocator/2.0/Constants.java
+$(GEN): $(HIDL)
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/IAllocator.hal
+
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava-constants -randroid.hardware:hardware/interfaces \
+        android.hardware.graphics.allocator@2.0
+
+$(GEN):
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+# Avoid dependency cycle of framework.jar -> this-library -> framework.jar
+LOCAL_NO_STANDARD_LIBRARIES := true
+LOCAL_JAVA_LIBRARIES := core-oj
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/graphics/composer/2.1/Android.bp b/graphics/composer/2.1/Android.bp
index 3c63a68..094d09e 100644
--- a/graphics/composer/2.1/Android.bp
+++ b/graphics/composer/2.1/Android.bp
@@ -52,4 +52,9 @@
         "libcutils",
         "android.hardware.graphics.allocator@2.0",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/light/2.0/Android.bp b/light/2.0/Android.bp
index a3b03a7..33b4af2 100644
--- a/light/2.0/Android.bp
+++ b/light/2.0/Android.bp
@@ -43,4 +43,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/light/Android.bp b/light/Android.bp
new file mode 100644
index 0000000..c12cd4f
--- /dev/null
+++ b/light/Android.bp
@@ -0,0 +1,4 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "2.0",
+]
diff --git a/memtrack/1.0/Android.bp b/memtrack/1.0/Android.bp
index 3696aea..996dbb6 100644
--- a/memtrack/1.0/Android.bp
+++ b/memtrack/1.0/Android.bp
@@ -43,4 +43,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/memtrack/Android.bp b/memtrack/Android.bp
new file mode 100644
index 0000000..ba90f2c
--- /dev/null
+++ b/memtrack/Android.bp
@@ -0,0 +1,5 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "1.0",
+    "1.0/default",
+]
diff --git a/nfc/1.0/vts/functional/Android.bp b/nfc/1.0/vts/functional/Android.bp
new file mode 100644
index 0000000..0f1afbd
--- /dev/null
+++ b/nfc/1.0/vts/functional/Android.bp
@@ -0,0 +1,36 @@
+//
+// 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.
+//
+
+cc_test {
+    name: "nfc_hidl_hal_test",
+    gtest: true,
+    srcs: ["nfc_hidl_hal_test.cpp"],
+    shared_libs: [
+        "libbase",
+        "liblog",
+        "libcutils",
+        "libhidl",
+        "libhwbinder",
+        "libnativehelper",
+        "libutils",
+        "android.hardware.nfc@1.0",
+    ],
+    static_libs: ["libgtest"],
+    cflags: [
+        "-O0",
+        "-g",
+    ],
+}
\ No newline at end of file
diff --git a/nfc/1.0/vts/functional/nfc_hidl_hal_test.cpp b/nfc/1.0/vts/functional/nfc_hidl_hal_test.cpp
new file mode 100644
index 0000000..e215704
--- /dev/null
+++ b/nfc/1.0/vts/functional/nfc_hidl_hal_test.cpp
@@ -0,0 +1,97 @@
+/*
+ * 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 "nfc_hidl_hal_test"
+#include <android-base/logging.h>
+
+#include <hardware/nfc.h>
+#include <android/hardware/nfc/1.0/types.h>
+#include <android/hardware/nfc/1.0/INfc.h>
+#include <android/hardware/nfc/1.0/INfcClientCallback.h>
+
+#include <gtest/gtest.h>
+
+using ::android::hardware::nfc::V1_0::INfc;
+using ::android::hardware::nfc::V1_0::INfcClientCallback;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::sp;
+
+#define NFC_NCI_SERVICE_NAME "nfc_nci"
+
+
+// Simple NfcClientCallback used as part of testing.
+class NfcClientCallback : public INfcClientCallback {
+  public:
+   NfcClientCallback() {};
+
+   virtual ~NfcClientCallback() = default;
+
+   // sendEvent callback function - currently no-op.
+   Return<void> sendEvent(
+           ::android::hardware::nfc::V1_0::NfcEvent event,
+           ::android::hardware::nfc::V1_0::NfcStatus event_status) override {
+     return Void();
+   };
+
+   // sendData callback function - currently no-op.
+   Return<void> sendData(const ::android::hardware::nfc::V1_0::NfcData &data ) override {
+     ::android::hardware::nfc::V1_0::NfcData copy = data;
+     return Void();
+   };
+};
+
+
+// The main test class for NFC HIDL HAL.
+class NfcHidlTest : public ::testing::Test {
+ public:
+  virtual void SetUp() override {
+    // currently test passthrough mode only
+    nfc = INfc::getService(NFC_NCI_SERVICE_NAME, true);
+    ASSERT_NE(nfc, nullptr);
+
+    nfc_cb = new NfcClientCallback();
+    ASSERT_NE(nfc_cb, nullptr);
+  }
+
+  virtual void TearDown() override {}
+
+  sp<INfc> nfc;
+  sp<INfcClientCallback> nfc_cb;
+};
+
+
+// A class for test environment setup (kept since this file is a template).
+class NfcHidlEnvironment : public ::testing::Environment {
+ public:
+  virtual void SetUp() {}
+  virtual void TearDown() {}
+
+ private:
+};
+
+TEST_F(NfcHidlTest, OpenAndClose) {
+  EXPECT_EQ(0, (int)nfc->open(nfc_cb));
+  EXPECT_EQ(0, (int)nfc->close());
+}
+
+int main(int argc, char **argv) {
+  ::testing::AddGlobalTestEnvironment(new NfcHidlEnvironment);
+  ::testing::InitGoogleTest(&argc, argv);
+  int status = RUN_ALL_TESTS();
+  ALOGI("Test result = %d", status);
+  return status;
+}
diff --git a/nfc/Android.bp b/nfc/Android.bp
new file mode 100644
index 0000000..ed19a37
--- /dev/null
+++ b/nfc/Android.bp
@@ -0,0 +1,6 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "1.0",
+    "1.0/default",
+    "1.0/vts/functional",
+]
diff --git a/power/1.0/Android.bp b/power/1.0/Android.bp
index 9b4d81e..4b6d34b 100644
--- a/power/1.0/Android.bp
+++ b/power/1.0/Android.bp
@@ -43,4 +43,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/power/Android.bp b/power/Android.bp
new file mode 100644
index 0000000..ba90f2c
--- /dev/null
+++ b/power/Android.bp
@@ -0,0 +1,5 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "1.0",
+    "1.0/default",
+]
diff --git a/radio/Android.bp b/radio/Android.bp
new file mode 100644
index 0000000..bbb3e4b
--- /dev/null
+++ b/radio/Android.bp
@@ -0,0 +1,4 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "1.0",
+]
diff --git a/sensors/1.0/Android.bp b/sensors/1.0/Android.bp
index 32ee049..5b1fd05 100644
--- a/sensors/1.0/Android.bp
+++ b/sensors/1.0/Android.bp
@@ -43,4 +43,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/sensors/1.0/Android.mk b/sensors/1.0/Android.mk
new file mode 100644
index 0000000..dd9e21b
--- /dev/null
+++ b/sensors/1.0/Android.mk
@@ -0,0 +1,38 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.sensors@1.0-java-constants
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+#
+GEN := $(intermediates)/android/hardware/sensors/1.0/Constants.java
+$(GEN): $(HIDL)
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/ISensors.hal
+
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava-constants -randroid.hardware:hardware/interfaces \
+        android.hardware.sensors@1.0
+
+$(GEN):
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+# Avoid dependency cycle of framework.jar -> this-library -> framework.jar
+LOCAL_NO_STANDARD_LIBRARIES := true
+LOCAL_JAVA_LIBRARIES := core-oj
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/sensors/Android.bp b/sensors/Android.bp
new file mode 100644
index 0000000..ba90f2c
--- /dev/null
+++ b/sensors/Android.bp
@@ -0,0 +1,5 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "1.0",
+    "1.0/default",
+]
diff --git a/soundtrigger/2.0/Android.bp b/soundtrigger/2.0/Android.bp
index 10a917b..a7a42a0 100644
--- a/soundtrigger/2.0/Android.bp
+++ b/soundtrigger/2.0/Android.bp
@@ -52,4 +52,9 @@
         "libcutils",
         "android.hardware.audio.common@2.0",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/soundtrigger/Android.bp b/soundtrigger/Android.bp
new file mode 100644
index 0000000..c12cd4f
--- /dev/null
+++ b/soundtrigger/Android.bp
@@ -0,0 +1,4 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "2.0",
+]
diff --git a/tests/Android.bp b/tests/Android.bp
new file mode 100644
index 0000000..e9b0148
--- /dev/null
+++ b/tests/Android.bp
@@ -0,0 +1,16 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "bar/1.0",
+    "bar/1.0/default",
+    "baz/1.0",
+    "expression/1.0",
+    "foo/1.0",
+    "foo/1.0/default",
+    "foo/1.0/default/lib",
+    "libhwbinder/1.0",
+    "libhwbinder/1.0/default",
+    "msgq/1.0",
+    "pointer/1.0",
+    "pointer/1.0/default",
+    "pointer/1.0/default/lib",
+]
diff --git a/tests/foo/1.0/default/Foo.cpp b/tests/foo/1.0/default/Foo.cpp
index 235a12d..f855f21 100644
--- a/tests/foo/1.0/default/Foo.cpp
+++ b/tests/foo/1.0/default/Foo.cpp
@@ -68,10 +68,7 @@
         doStuffAndReturnAString_cb _cb) {
     ALOGI("SERVER(Foo) doStuffAndReturnAString");
 
-    hidl_string s;
-    s = "Hello, world";
-
-    _cb(s);
+    _cb("Hello, world");
 
     return Void();
 }
diff --git a/tests/msgq/1.0/ITestMsgQ.hal b/tests/msgq/1.0/ITestMsgQ.hal
index fc96181..dcdc74a 100644
--- a/tests/msgq/1.0/ITestMsgQ.hal
+++ b/tests/msgq/1.0/ITestMsgQ.hal
@@ -18,9 +18,10 @@
 
 interface ITestMsgQ {
     /*
-     * This method requests the service to set up Synchronous read/write
+     * This method requests the service to set up a synchronous read/write
      * wait-free FMQ with the client as reader.
-     * @return ret Will be true if the setup is successful, false otherwise.
+     *
+     * @return ret True if the setup is successful.
      * @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.
      */
@@ -28,18 +29,54 @@
         generates(bool ret, MQDescriptorSync mqDesc);
 
     /*
-     * This method request the service to write into the FMQ.
-     * @param count Number to messages to write.
-     * @return ret Will be true if the write operation was successful,
-     * false otherwise.
+     * This method requests the service to set up an unsynchronized write
+     * wait-free FMQ with the client as reader.
+     *
+     * @return ret True if the setup is successful.
+     * @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.
      */
-    requestWrite(int32_t count) generates(bool ret);
+    configureFmqUnsyncWrite()
+        generates(bool ret, MQDescriptorUnsync mqDesc);
 
     /*
-     * This method request the service to read from the FMQ.
-     * @param count Number to messages to read.
-     * @return ret Will be true if the read operation was successful, false
-     * otherwise.
+     * This method request the service to write into the synchronized read/write
+     * flavor of the FMQ.
+     *
+     * @param count Number to messages to write.
+     *
+     * @return ret True if the write operation was successful.
      */
-    requestRead(int32_t count) generates(bool ret);
+    requestWriteFmqSync(int32_t count) generates(bool ret);
+
+    /*
+     * This method request the service to read from the synchronized read/write
+     * FMQ.
+     *
+     * @param count Number to messages to read.
+     *
+     * @return ret True if the read operation was successful.
+     */
+    requestReadFmqSync(int32_t count) generates(bool ret);
+
+    /*
+     * This method request the service to write into the unsynchronized flavor
+     * of FMQ.
+     *
+     * @param count Number to messages to write.
+     *
+     * @return ret True if the write operation was successful.
+     */
+    requestWriteFmqUnsync(int32_t count) generates(bool ret);
+
+    /*
+     * This method request the service to read from the unsynchronized flavor of
+     * FMQ.
+     *
+     * @param count Number to messages to read.
+     *
+     * @return ret Will be True if the read operation was successful.
+     */
+    requestReadFmqUnsync(int32_t count) generates(bool ret);
+
 };
diff --git a/thermal/1.0/Android.bp b/thermal/1.0/Android.bp
index 0c5dd19..ae64dde 100644
--- a/thermal/1.0/Android.bp
+++ b/thermal/1.0/Android.bp
@@ -43,4 +43,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/thermal/Android.bp b/thermal/Android.bp
new file mode 100644
index 0000000..ba90f2c
--- /dev/null
+++ b/thermal/Android.bp
@@ -0,0 +1,5 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "1.0",
+    "1.0/default",
+]
diff --git a/tv/Android.bp b/tv/Android.bp
new file mode 100644
index 0000000..095839f
--- /dev/null
+++ b/tv/Android.bp
@@ -0,0 +1,4 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "input/1.0",
+]
diff --git a/tv/input/1.0/Android.bp b/tv/input/1.0/Android.bp
new file mode 100644
index 0000000..895aa73
--- /dev/null
+++ b/tv/input/1.0/Android.bp
@@ -0,0 +1,60 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+    name: "android.hardware.tv.input@1.0_genc++",
+    tool: "hidl-gen",
+    cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tv.input@1.0",
+    srcs: [
+        "types.hal",
+        "ITvInput.hal",
+        "ITvInputCallback.hal",
+    ],
+    out: [
+        "android/hardware/tv/input/1.0/types.cpp",
+        "android/hardware/tv/input/1.0/TvInputAll.cpp",
+        "android/hardware/tv/input/1.0/TvInputCallbackAll.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.tv.input@1.0_genc++_headers",
+    tool: "hidl-gen",
+    cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tv.input@1.0",
+    srcs: [
+        "types.hal",
+        "ITvInput.hal",
+        "ITvInputCallback.hal",
+    ],
+    out: [
+        "android/hardware/tv/input/1.0/types.h",
+        "android/hardware/tv/input/1.0/ITvInput.h",
+        "android/hardware/tv/input/1.0/IHwTvInput.h",
+        "android/hardware/tv/input/1.0/BnTvInput.h",
+        "android/hardware/tv/input/1.0/BpTvInput.h",
+        "android/hardware/tv/input/1.0/BsTvInput.h",
+        "android/hardware/tv/input/1.0/ITvInputCallback.h",
+        "android/hardware/tv/input/1.0/IHwTvInputCallback.h",
+        "android/hardware/tv/input/1.0/BnTvInputCallback.h",
+        "android/hardware/tv/input/1.0/BpTvInputCallback.h",
+        "android/hardware/tv/input/1.0/BsTvInputCallback.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.tv.input@1.0",
+    generated_sources: ["android.hardware.tv.input@1.0_genc++"],
+    generated_headers: ["android.hardware.tv.input@1.0_genc++_headers"],
+    export_generated_headers: ["android.hardware.tv.input@1.0_genc++_headers"],
+    shared_libs: [
+        "libhidl",
+        "libhwbinder",
+        "libutils",
+        "libcutils",
+        "android.hardware.audio.common@2.0",
+    ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
+}
diff --git a/tv/input/1.0/ITvInput.hal b/tv/input/1.0/ITvInput.hal
new file mode 100644
index 0000000..43de276
--- /dev/null
+++ b/tv/input/1.0/ITvInput.hal
@@ -0,0 +1,79 @@
+/*
+ * 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.tv.input@1.0;
+
+import ITvInputCallback;
+
+interface ITvInput {
+    /*
+     * Sets a callback for events.
+     *
+     * Note that initially no device is available in the client side, so the
+     * implementation must notify all the currently available devices including
+     * static devices via callback once callback is set.
+     *
+     * @param callback Callback object to pass events.
+     */
+    @entry
+    @exit
+    @callflow(next={"getStreamConfigurations"})
+    setCallback(ITvInputCallback callback);
+
+    /*
+     * Gets stream configurations for a specific device.
+     *
+     * The configs object is valid only until the next
+     * STREAM_CONFIGURATIONS_CHANGED event.
+     *
+     * @param deviceId Device ID for the configurations.
+     * @return result OK upon success. Otherwise,
+     *         INVALID_ARGUMENTS if the given device ID is not valid.
+     * @return configurations An array of available configurations.
+     */
+    @callflow(next={"openStream", "getStreamConfigurations", "closeStream"})
+    getStreamConfigurations(int32_t deviceId)
+            generates (Result result, vec<TvStreamConfig> configurations);
+
+    /*
+     * Opens a specific stream in a device.
+     *
+     * @param deviceId Device ID for the steam to open.
+     * @param streamId Steam ID for the steam to open. Must be one of the
+     *         stream IDs returned from getStreamConfigurations().
+     * @return result OK upon success. Otherwise,
+     *         INVALID_ARGUMENTS if any of given IDs are not valid;
+     *         INVALID_STATE if the stream with the given ID is already open;
+     *         NO_RESOURCE if the client must close other streams to open the
+     *                 stream.
+     * @return sidebandStream handle for sideband stream.
+     */
+    @callflow(next={"closeStream", "getStreamConfigurations", "openStream"})
+    openStream(int32_t deviceId, int32_t streamId)
+            generates (Result result, handle sidebandStream);
+
+    /*
+     * Closes a specific stream in a device.
+     *
+     * @param deviceId Device ID for the steam to open.
+     * @param streamId Steam ID for the steam to open.
+     * @return result OK upon success. Otherwise,
+     *         INVALID_ARGUMENTS if any of given IDs are not valid;
+     *         INVALID_STATE if the stream with the given ID is not open.
+     */
+    @callflow(next={"getStreamConfigurations", "openStream", "closeStream"})
+    closeStream(int32_t deviceId, int32_t streamId) generates (Result result);
+};
diff --git a/tv/input/1.0/ITvInputCallback.hal b/tv/input/1.0/ITvInputCallback.hal
new file mode 100644
index 0000000..f2f07a0
--- /dev/null
+++ b/tv/input/1.0/ITvInputCallback.hal
@@ -0,0 +1,27 @@
+/*
+ * 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.tv.input@1.0;
+
+interface ITvInputCallback {
+    /*
+     * Notifies the client that an event has occured. For possible event types,
+     * check TvInputEventType.
+     *
+     * @param event Event passed to the client.
+     */
+    notify(TvInputEvent event);
+};
diff --git a/tv/input/1.0/default/Android.mk b/tv/input/1.0/default/Android.mk
new file mode 100644
index 0000000..520b0bf
--- /dev/null
+++ b/tv/input/1.0/default/Android.mk
@@ -0,0 +1,44 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.tv.input@1.0-impl
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_SRC_FILES := \
+    TvInput.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+    libbase \
+    liblog \
+    libhardware \
+    libhidl \
+    libhwbinder \
+    libutils \
+    android.hardware.audio.common@2.0 \
+    android.hardware.tv.input@1.0 \
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_MODULE := android.hardware.tv.input@1.0-service
+LOCAL_INIT_RC := android.hardware.tv.input@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.audio.common@2.0 \
+    android.hardware.tv.input@1.0 \
+
+include $(BUILD_EXECUTABLE)
+
diff --git a/tv/input/1.0/default/TvInput.cpp b/tv/input/1.0/default/TvInput.cpp
new file mode 100644
index 0000000..6181ffb
--- /dev/null
+++ b/tv/input/1.0/default/TvInput.cpp
@@ -0,0 +1,226 @@
+/*
+ * 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.tv.input@1.0-service"
+#include <android-base/logging.h>
+
+#include "TvInput.h"
+
+const native_handle_t kNullNativeHandle{sizeof(native_handle_t), 0, 0, {}};
+
+namespace android {
+namespace hardware {
+namespace tv {
+namespace input {
+namespace V1_0 {
+namespace implementation {
+
+static_assert(TV_INPUT_TYPE_OTHER_HARDWARE == static_cast<int>(TvInputType::OTHER),
+        "TvInputType::OTHER must match legacy value.");
+static_assert(TV_INPUT_TYPE_TUNER == static_cast<int>(TvInputType::TUNER),
+        "TvInputType::TUNER must match legacy value.");
+static_assert(TV_INPUT_TYPE_COMPOSITE == static_cast<int>(TvInputType::COMPOSITE),
+        "TvInputType::COMPOSITE must match legacy value.");
+static_assert(TV_INPUT_TYPE_SVIDEO == static_cast<int>(TvInputType::SVIDEO),
+        "TvInputType::SVIDEO must match legacy value.");
+static_assert(TV_INPUT_TYPE_SCART == static_cast<int>(TvInputType::SCART),
+        "TvInputType::SCART must match legacy value.");
+static_assert(TV_INPUT_TYPE_COMPONENT == static_cast<int>(TvInputType::COMPONENT),
+        "TvInputType::COMPONENT must match legacy value.");
+static_assert(TV_INPUT_TYPE_VGA == static_cast<int>(TvInputType::VGA),
+        "TvInputType::VGA must match legacy value.");
+static_assert(TV_INPUT_TYPE_DVI == static_cast<int>(TvInputType::DVI),
+        "TvInputType::DVI must match legacy value.");
+static_assert(TV_INPUT_TYPE_HDMI == static_cast<int>(TvInputType::HDMI),
+        "TvInputType::HDMI must match legacy value.");
+static_assert(TV_INPUT_TYPE_DISPLAY_PORT == static_cast<int>(TvInputType::DISPLAY_PORT),
+        "TvInputType::DISPLAY_PORT must match legacy value.");
+
+static_assert(TV_INPUT_EVENT_DEVICE_AVAILABLE == static_cast<int>(
+        TvInputEventType::DEVICE_AVAILABLE),
+        "TvInputEventType::DEVICE_AVAILABLE must match legacy value.");
+static_assert(TV_INPUT_EVENT_DEVICE_UNAVAILABLE == static_cast<int>(
+        TvInputEventType::DEVICE_UNAVAILABLE),
+        "TvInputEventType::DEVICE_UNAVAILABLE must match legacy value.");
+static_assert(TV_INPUT_EVENT_STREAM_CONFIGURATIONS_CHANGED == static_cast<int>(
+        TvInputEventType::STREAM_CONFIGURATIONS_CHANGED),
+        "TvInputEventType::STREAM_CONFIGURATIONS_CHANGED must match legacy value.");
+
+sp<ITvInputCallback> TvInput::mCallback = nullptr;
+
+TvInput::TvInput(tv_input_device_t* device) : mDevice(device) {
+    mCallbackOps.notify = &TvInput::notify;
+}
+
+TvInput::~TvInput() {
+    if (mDevice != nullptr) {
+        free(mDevice);
+    }
+}
+
+// Methods from ::android::hardware::tv_input::V1_0::ITvInput follow.
+Return<void> TvInput::setCallback(const sp<ITvInputCallback>& callback)  {
+    mCallback = callback;
+    if (mCallback != nullptr) {
+        mDevice->initialize(mDevice, &mCallbackOps, nullptr);
+    }
+    return Void();
+}
+
+Return<void> TvInput::getStreamConfigurations(int32_t deviceId, getStreamConfigurations_cb cb)  {
+    int32_t configCount = 0;
+    const tv_stream_config_t* configs = nullptr;
+    int ret = mDevice->get_stream_configurations(mDevice, deviceId, &configCount, &configs);
+    Result res = Result::UNKNOWN;
+    hidl_vec<TvStreamConfig> tvStreamConfigs;
+    if (ret == 0) {
+        res = Result::OK;
+        tvStreamConfigs.resize(getSupportedConfigCount(configCount, configs));
+        int32_t pos = 0;
+        for (int32_t i = 0; i < configCount; ++i) {
+            if (isSupportedStreamType(configs[i].type)) {
+                tvStreamConfigs[pos].streamId = configs[i].stream_id;
+                tvStreamConfigs[pos].maxVideoWidth = configs[i].max_video_width;
+                tvStreamConfigs[pos].maxVideoHeight = configs[i].max_video_height;
+                ++pos;
+            }
+        }
+    }
+    cb(res, tvStreamConfigs);
+    return Void();
+}
+
+Return<void> TvInput::openStream(int32_t deviceId, int32_t streamId, openStream_cb cb)  {
+    tv_stream_t stream;
+    stream.stream_id = streamId;
+    int ret = mDevice->open_stream(mDevice, deviceId, &stream);
+    Result res = Result::UNKNOWN;
+    native_handle_t* sidebandStream = nullptr;
+    if (ret == 0) {
+        if (isSupportedStreamType(stream.type)) {
+            res = Result::OK;
+            sidebandStream = stream.sideband_stream_source_handle;
+        }
+    } else {
+        // TODO(b/30814137)
+        sidebandStream = const_cast<native_handle_t*>(&kNullNativeHandle);
+        if (ret == -EBUSY) {
+            res = Result::NO_RESOURCE;
+        } else if (ret == -EEXIST) {
+            res = Result::INVALID_STATE;
+        } else if (ret == -EINVAL) {
+            res = Result::INVALID_ARGUMENTS;
+        }
+    }
+    cb(res, sidebandStream);
+    return Void();
+}
+
+Return<Result> TvInput::closeStream(int32_t deviceId, int32_t streamId)  {
+    int ret = mDevice->close_stream(mDevice, deviceId, streamId);
+    Result res = Result::UNKNOWN;
+    if (ret == 0) {
+        res = Result::OK;
+    } else if (ret == -ENOENT) {
+        res = Result::INVALID_STATE;
+    } else if (ret == -EINVAL) {
+        res = Result::INVALID_ARGUMENTS;
+    }
+    return res;
+}
+
+// static
+void TvInput::notify(struct tv_input_device* __unused, tv_input_event_t* event,
+        void* __unused) {
+    if (mCallback != nullptr && event != nullptr) {
+        // Capturing is no longer supported.
+        if (event->type >= TV_INPUT_EVENT_CAPTURE_SUCCEEDED) {
+            return;
+        }
+        TvInputEvent tvInputEvent;
+        tvInputEvent.type = static_cast<TvInputEventType>(event->type);
+        tvInputEvent.deviceInfo.deviceId = event->device_info.device_id;
+        tvInputEvent.deviceInfo.type = static_cast<TvInputType>(
+                event->device_info.type);
+        tvInputEvent.deviceInfo.portId = event->device_info.hdmi.port_id;
+        // TODO: Ensure the legacy audio type code is the same once audio HAL default
+        // implementation is ready.
+        tvInputEvent.deviceInfo.audioType = static_cast<AudioDevice>(
+                event->device_info.audio_type);
+        memset(tvInputEvent.deviceInfo.audioAddress.data(), 0,
+                tvInputEvent.deviceInfo.audioAddress.size());
+        const char* address = event->device_info.audio_address;
+        if (address != nullptr) {
+            size_t size = strlen(address);
+            if (size > tvInputEvent.deviceInfo.audioAddress.size()) {
+                LOG(ERROR) << "Audio address is too long. Address:" << address << "";
+                return;
+            }
+            for (size_t i = 0; i < size; ++i) {
+                tvInputEvent.deviceInfo.audioAddress[i] =
+                    static_cast<uint8_t>(event->device_info.audio_address[i]);
+            }
+        }
+        mCallback->notify(tvInputEvent);
+    }
+}
+
+// static
+uint32_t TvInput::getSupportedConfigCount(uint32_t configCount,
+        const tv_stream_config_t* configs) {
+    uint32_t supportedConfigCount = 0;
+    for (uint32_t i = 0; i < configCount; ++i) {
+        if (isSupportedStreamType(configs[i].type)) {
+            supportedConfigCount++;
+        }
+    }
+    return supportedConfigCount;
+}
+
+// static
+bool TvInput::isSupportedStreamType(int type) {
+    // Buffer producer type is no longer supported.
+    return type != TV_STREAM_TYPE_BUFFER_PRODUCER;
+}
+
+ITvInput* HIDL_FETCH_ITvInput(const char* name) {
+    int ret = 0;
+    const hw_module_t* hw_module = nullptr;
+    tv_input_device_t* input_device;
+    ret = hw_get_module(TV_INPUT_HARDWARE_MODULE_ID, &hw_module);
+    if (ret == 0 && hw_module->methods->open != nullptr) {
+        ret = hw_module->methods->open(hw_module, TV_INPUT_DEFAULT_DEVICE,
+                reinterpret_cast<hw_device_t**>(&input_device));
+        if (ret == 0) {
+            return new TvInput(input_device);
+        }
+        else {
+            LOG(ERROR) << "Passthrough failed to load legacy HAL.";
+            return nullptr;
+        }
+    }
+    else {
+        LOG(ERROR) << "hw_get_module " << name << " failed: " << ret;
+        return nullptr;
+    }
+}
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace input
+}  // namespace tv
+}  // namespace hardware
+}  // namespace android
diff --git a/tv/input/1.0/default/TvInput.h b/tv/input/1.0/default/TvInput.h
new file mode 100644
index 0000000..81cbb20
--- /dev/null
+++ b/tv/input/1.0/default/TvInput.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef HIDL_GENERATED_android_hardware_tv_input_V1_0_TvInput_H_
+#define HIDL_GENERATED_android_hardware_tv_input_V1_0_TvInput_H_
+
+#include <android/hardware/tv/input/1.0/ITvInput.h>
+#include <hidl/Status.h>
+#include <hardware/tv_input.h>
+
+#include <hidl/MQDescriptor.h>
+
+namespace android {
+namespace hardware {
+namespace tv {
+namespace input {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::audio::common::V2_0::AudioDevice;
+using ::android::hardware::tv::input::V1_0::ITvInput;
+using ::android::hardware::tv::input::V1_0::ITvInputCallback;
+using ::android::hardware::tv::input::V1_0::Result;
+using ::android::hardware::tv::input::V1_0::TvInputEvent;
+using ::android::hardware::tv::input::V1_0::TvStreamConfig;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct TvInput : public ITvInput {
+    TvInput(tv_input_device_t* device);
+    ~TvInput();
+    Return<void> setCallback(const sp<ITvInputCallback>& callback)  override;
+    Return<void> getStreamConfigurations(int32_t deviceId,
+            getStreamConfigurations_cb _hidl_cb)  override;
+    Return<void> openStream(int32_t deviceId, int32_t streamId,
+            openStream_cb _hidl_cb)  override;
+    Return<Result> closeStream(int32_t deviceId, int32_t streamId)  override;
+
+    static void notify(struct tv_input_device* __unused, tv_input_event_t* event,
+            void* __unused);
+    static uint32_t getSupportedConfigCount(uint32_t configCount,
+            const tv_stream_config_t* configs);
+    static bool isSupportedStreamType(int type);
+
+    private:
+    static sp<ITvInputCallback> mCallback;
+    tv_input_callback_ops_t mCallbackOps;
+    tv_input_device_t* mDevice;
+};
+
+extern "C" ITvInput* HIDL_FETCH_ITvInput(const char* name);
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace input
+}  // namespace tv
+}  // namespace hardware
+}  // namespace android
+
+#endif  // HIDL_GENERATED_android_hardware_tv_input_V1_0_TvInput_H_
diff --git a/tv/input/1.0/default/android.hardware.tv.input@1.0-service.rc b/tv/input/1.0/default/android.hardware.tv.input@1.0-service.rc
new file mode 100644
index 0000000..c5bc0b7
--- /dev/null
+++ b/tv/input/1.0/default/android.hardware.tv.input@1.0-service.rc
@@ -0,0 +1,4 @@
+service tv-input-1-0 /system/bin/hw/android.hardware.tv.input@1.0-service
+    class hal
+    user system
+    group system readproc
diff --git a/tv/input/1.0/default/service.cpp b/tv/input/1.0/default/service.cpp
new file mode 100644
index 0000000..d59c848
--- /dev/null
+++ b/tv/input/1.0/default/service.cpp
@@ -0,0 +1,31 @@
+/*
+ * 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.tv_input@1.0-service"
+
+#include <android/hardware/tv/input/1.0/ITvInput.h>
+
+#include <hidl/LegacySupport.h>
+
+using android::sp;
+
+// Generated HIDL files
+using android::hardware::tv::input::V1_0::ITvInput;
+using android::hardware::defaultPassthroughServiceImplementation;
+
+int main() {
+    return defaultPassthroughServiceImplementation<ITvInput>("tv.input");
+}
diff --git a/tv/input/1.0/types.hal b/tv/input/1.0/types.hal
new file mode 100644
index 0000000..89a7acc
--- /dev/null
+++ b/tv/input/1.0/types.hal
@@ -0,0 +1,125 @@
+/*
+ * 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.tv.input@1.0;
+
+import android.hardware.audio.common@2.0;
+
+enum Result {
+    OK,
+    UNKNOWN,
+    NO_RESOURCE,
+    INVALID_ARGUMENTS,
+    INVALID_STATE,
+};
+
+/* Type of physical TV input. */
+enum TvInputType {
+    OTHER = 1,         // Generic hardware.
+    TUNER = 2,         // Tuner. e.g. built-in terrestrial tuner
+    COMPOSITE = 3,
+    SVIDEO = 4,
+    SCART = 5,
+    COMPONENT = 6,
+    VGA = 7,
+    DVI = 8,
+    HDMI = 9,          // Physical HDMI port. e.g. HDMI 1
+    DISPLAY_PORT = 10,
+};
+
+struct TvInputDeviceInfo {
+    int32_t deviceId;
+    TvInputType type;
+    uint32_t portId;          // HDMI port ID number. e.g. 2 for HDMI 2
+    AudioDevice audioType;    // Audio device type. e.g AudioDevice::IN_HDMI
+    uint8_t[32] audioAddress; // Audio device address. "" if N/A. If the text
+                              // length is less than 32, the remaining part
+                              // must be filled with 0s.
+};
+
+enum TvInputEventType {
+    /*
+     * Hardware notifies the framework that a device is available.
+     *
+     * Note that DEVICE_AVAILABLE and DEVICE_UNAVAILABLE events do not represent
+     * hotplug events (i.e. plugging cable into or out of the physical port).
+     * These events notify the framework whether the port is available or not.
+     * For a concrete example, when a user plugs in or pulls out the HDMI cable
+     * from a HDMI port, it does not generate DEVICE_AVAILABLE and/or
+     * DEVICE_UNAVAILABLE events. However, if a user inserts a pluggable USB
+     * tuner into the Android device, it must generate a DEVICE_AVAILABLE event
+     * and when the port is removed, it must generate a DEVICE_UNAVAILABLE
+     * event.
+     *
+     * For hotplug events, please see STREAM_CONFIGURATION_CHANGED for more
+     * details.
+     *
+     * HAL implementation must register devices by using this event when the
+     * device boots up. The framework must recognize device reported via this
+     * event only.
+     */
+    DEVICE_AVAILABLE = 1,
+
+    /*
+     * Hardware notifies the framework that a device is unavailable.
+     *
+     * HAL implementation must generate this event when a device registered
+     * by DEVICE_AVAILABLE is no longer available. For example,
+     * the event can indicate that a USB tuner is plugged out from the Android
+     * device.
+     *
+     * Note that this event is not for indicating cable plugged out of the port;
+     * for that purpose, the implementation must use
+     * STREAM_CONFIGURATION_CHANGED event. This event represents the port itself
+     * being no longer available.
+     */
+    DEVICE_UNAVAILABLE = 2,
+
+    /*
+     * Stream configurations are changed. Client must regard all open streams
+     * at the specific device are closed, and must call
+     * getStreamConfigurations() again, opening some of them if necessary.
+     *
+     * HAL implementation must generate this event when the available stream
+     * configurations change for any reason. A typical use case of this event
+     * is to notify the framework that the input signal has changed resolution,
+     * or that the cable is plugged out so that the number of available streams
+     * is 0.
+     *
+     * The implementation must use this event to indicate hotplug status of the
+     * port. the framework regards input devices with no available streams as
+     * disconnected, so the implementation can generate this event with no
+     * available streams to indicate that this device is disconnected, and vice
+     * versa.
+     */
+    STREAM_CONFIGURATIONS_CHANGED = 3,
+};
+
+struct TvInputEvent {
+    TvInputEventType type;
+    /*
+     * DEVICE_AVAILABLE: all fields are relevant.
+     * DEVICE_UNAVAILABLE: only deviceId is relevant.
+     * STREAM_CONFIGURATIONS_CHANGED: only deviceId is relevant.
+     */
+    TvInputDeviceInfo deviceInfo;
+};
+
+struct TvStreamConfig {
+    int32_t streamId;
+    uint32_t maxVideoWidth;  // Max width of the stream.
+    uint32_t maxVideoHeight; // Max height of the stream.
+};
diff --git a/update-makefiles.sh b/update-makefiles.sh
index 939a9c7..8b82013 100755
--- a/update-makefiles.sh
+++ b/update-makefiles.sh
@@ -18,17 +18,28 @@
   hidl-gen -Landroidbp -r android.hardware:hardware/interfaces $p;
 done
 
-bp="hardware/interfaces/Android.bp"
-androidbps=$(find hardware/interfaces/*/      \
-             -name "Android.bp"               \
-             -exec dirname {} \;              \
-             | sort)
+# subdirectories of hardware/interfaces which contain an Android.bp file
+android_dirs=$(find hardware/interfaces/*/     \
+              -name "Android.bp"               \
+              -printf "%h\n"                   \
+              | cut -d "/" -f1-3               \
+              | sort | uniq)
 
-echo "Updating $bp"
+echo "Updating Android.bp files."
 
-echo "// This is an autogenerated file, do not edit." > $bp;
-echo "subdirs = [" >> $bp;
-for a in $androidbps; do
-  echo "    \"${a#*hardware/interfaces/}\"," >> $bp;
+for bp_dir in $android_dirs; do
+  bp="$bp_dir/Android.bp"
+  # locations of Android.bp files in specific subdirectory of hardware/interfaces
+  android_bps=$(find $bp_dir                   \
+                -name "Android.bp"             \
+                ! -path $bp_dir/Android.bp     \
+                -printf "%h\n"                 \
+                | sort)
+
+  echo "// This is an autogenerated file, do not edit." > "$bp";
+  echo "subdirs = [" >> "$bp";
+  for a in $android_bps; do
+    echo "    \"${a#$bp_dir/}\"," >> "$bp";
+  done
+  echo "]" >> "$bp";
 done
-echo "]" >> $bp;
\ No newline at end of file
diff --git a/vehicle/2.0/Android.bp b/vehicle/2.0/Android.bp
index cb30e1b..981103c 100644
--- a/vehicle/2.0/Android.bp
+++ b/vehicle/2.0/Android.bp
@@ -51,4 +51,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/vehicle/Android.bp b/vehicle/Android.bp
new file mode 100644
index 0000000..c12cd4f
--- /dev/null
+++ b/vehicle/Android.bp
@@ -0,0 +1,4 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "2.0",
+]
diff --git a/vibrator/1.0/Android.bp b/vibrator/1.0/Android.bp
index 64afdb5..270e7bf 100644
--- a/vibrator/1.0/Android.bp
+++ b/vibrator/1.0/Android.bp
@@ -43,4 +43,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/vibrator/Android.bp b/vibrator/Android.bp
new file mode 100644
index 0000000..ba90f2c
--- /dev/null
+++ b/vibrator/Android.bp
@@ -0,0 +1,5 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "1.0",
+    "1.0/default",
+]
diff --git a/vr/1.0/Android.bp b/vr/1.0/Android.bp
index 8fd00c5..63a0789 100644
--- a/vr/1.0/Android.bp
+++ b/vr/1.0/Android.bp
@@ -39,4 +39,9 @@
         "libutils",
         "libcutils",
     ],
+export_shared_lib_headers: [
+    "libhidl",
+    "libhwbinder",
+    "libutils",
+    ],
 }
diff --git a/vr/1.0/Android.mk b/vr/1.0/Android.mk
new file mode 100644
index 0000000..b35ca3d
--- /dev/null
+++ b/vr/1.0/Android.mk
@@ -0,0 +1,64 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.vr@1.0-java
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build IVr.hal
+#
+GEN := $(intermediates)/android/hardware/vr/1.0/IVr.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IVr.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava -randroid.hardware:hardware/interfaces \
+        android.hardware.vr@1.0::IVr
+
+$(GEN): $(LOCAL_PATH)/IVr.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.vr@1.0-java-static
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build IVr.hal
+#
+GEN := $(intermediates)/android/hardware/vr/1.0/IVr.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IVr.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava -randroid.hardware:hardware/interfaces \
+        android.hardware.vr@1.0::IVr
+
+$(GEN): $(LOCAL_PATH)/IVr.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/vr/Android.bp b/vr/Android.bp
new file mode 100644
index 0000000..ba90f2c
--- /dev/null
+++ b/vr/Android.bp
@@ -0,0 +1,5 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "1.0",
+    "1.0/default",
+]
diff --git a/wifi/Android.bp b/wifi/Android.bp
new file mode 100644
index 0000000..ea43db4
--- /dev/null
+++ b/wifi/Android.bp
@@ -0,0 +1,5 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "1.0",
+    "supplicant/1.0",
+]