Merge "Replace sys_nice capability with rlimit rtprio"
diff --git a/audio/2.0/Android.bp b/audio/2.0/Android.bp
index ea3ea84..06299b6 100644
--- a/audio/2.0/Android.bp
+++ b/audio/2.0/Android.bp
@@ -186,6 +186,7 @@
 
 cc_test {
     name: "android.hardware.audio@2.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/audio/common/2.0/default/Android.bp b/audio/common/2.0/default/Android.bp
index 0486a5c..7fab220 100644
--- a/audio/common/2.0/default/Android.bp
+++ b/audio/common/2.0/default/Android.bp
@@ -15,6 +15,7 @@
 
 cc_library_shared {
     name: "android.hardware.audio.common@2.0-util",
+    defaults: ["hidl_defaults"],
     vendor_available: true,
     srcs: [
         "EffectMap.cpp",
diff --git a/audio/common/Android.mk b/audio/common/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/audio/common/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/audio/effect/2.0/Android.bp b/audio/effect/2.0/Android.bp
index e940296..e939ece 100644
--- a/audio/effect/2.0/Android.bp
+++ b/audio/effect/2.0/Android.bp
@@ -249,6 +249,7 @@
 
 cc_test {
     name: "android.hardware.audio.effect@2.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/audio/effect/2.0/vts/Android.mk b/audio/effect/2.0/vts/Android.mk
deleted file mode 100644
index abdd5bf..0000000
--- a/audio/effect/2.0/vts/Android.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/audio/effect/Android.mk b/audio/effect/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/audio/effect/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/automotive/evs/1.0/Android.bp b/automotive/evs/1.0/Android.bp
index be58711..da68c2a 100644
--- a/automotive/evs/1.0/Android.bp
+++ b/automotive/evs/1.0/Android.bp
@@ -155,6 +155,7 @@
 
 cc_test {
     name: "android.hardware.automotive.evs@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/automotive/vehicle/2.0/Android.bp b/automotive/vehicle/2.0/Android.bp
index ffc768e..0d0d28f 100644
--- a/automotive/vehicle/2.0/Android.bp
+++ b/automotive/vehicle/2.0/Android.bp
@@ -137,6 +137,7 @@
 
 cc_test {
     name: "android.hardware.automotive.vehicle@2.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/biometrics/fingerprint/2.1/Android.bp b/biometrics/fingerprint/2.1/Android.bp
index 719f47d..e6e4827 100644
--- a/biometrics/fingerprint/2.1/Android.bp
+++ b/biometrics/fingerprint/2.1/Android.bp
@@ -137,6 +137,7 @@
 
 cc_test {
     name: "android.hardware.biometrics.fingerprint@2.1-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/bluetooth/1.0/Android.bp b/bluetooth/1.0/Android.bp
index 5637aa4..9d2cf6e 100644
--- a/bluetooth/1.0/Android.bp
+++ b/bluetooth/1.0/Android.bp
@@ -137,6 +137,7 @@
 
 cc_test {
     name: "android.hardware.bluetooth@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/boot/1.0/Android.bp b/boot/1.0/Android.bp
index ad9cfc7..e15b2d0 100644
--- a/boot/1.0/Android.bp
+++ b/boot/1.0/Android.bp
@@ -128,6 +128,7 @@
 
 cc_test {
     name: "android.hardware.boot@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/boot/1.0/vts/Android.bp b/boot/1.0/vts/Android.bp
deleted file mode 100644
index 7aef46b..0000000
--- a/boot/1.0/vts/Android.bp
+++ /dev/null
@@ -1,3 +0,0 @@
-subdirs = [
-    "*"
-]
diff --git a/boot/1.0/vts/Android.mk b/boot/1.0/vts/Android.mk
deleted file mode 100644
index df5dac8..0000000
--- a/boot/1.0/vts/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
\ No newline at end of file
diff --git a/boot/Android.bp b/boot/Android.bp
index 67af5bb..33f70eb 100644
--- a/boot/Android.bp
+++ b/boot/Android.bp
@@ -1,6 +1,5 @@
 // This is an autogenerated file, do not edit.
 subdirs = [
     "1.0",
-    "1.0/vts",
     "1.0/vts/functional",
 ]
diff --git a/broadcastradio/1.0/Android.bp b/broadcastradio/1.0/Android.bp
index 9b8c5b3..b394fdc 100644
--- a/broadcastradio/1.0/Android.bp
+++ b/broadcastradio/1.0/Android.bp
@@ -155,6 +155,7 @@
 
 cc_test {
     name: "android.hardware.broadcastradio@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/broadcastradio/1.0/Android.mk b/broadcastradio/1.0/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/broadcastradio/1.0/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/broadcastradio/1.0/vts/Android.mk b/broadcastradio/1.0/vts/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/broadcastradio/1.0/vts/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/broadcastradio/1.1/Android.bp b/broadcastradio/1.1/Android.bp
index 2111c16..fa1c3e9 100644
--- a/broadcastradio/1.1/Android.bp
+++ b/broadcastradio/1.1/Android.bp
@@ -161,6 +161,7 @@
 
 cc_test {
     name: "android.hardware.broadcastradio@1.1-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/broadcastradio/1.1/vts/Android.mk b/broadcastradio/1.1/vts/Android.mk
deleted file mode 100644
index 0c4c55d..0000000
--- a/broadcastradio/1.1/vts/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2017 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/camera/device/1.0/Android.bp b/camera/device/1.0/Android.bp
index dfc58c9..5b2d4c0 100644
--- a/camera/device/1.0/Android.bp
+++ b/camera/device/1.0/Android.bp
@@ -154,6 +154,7 @@
 
 cc_test {
     name: "android.hardware.camera.device@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/camera/device/3.2/Android.bp b/camera/device/3.2/Android.bp
index d770964..15a7dcd 100644
--- a/camera/device/3.2/Android.bp
+++ b/camera/device/3.2/Android.bp
@@ -154,6 +154,7 @@
 
 cc_test {
     name: "android.hardware.camera.device@3.2-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/camera/provider/2.4/Android.bp b/camera/provider/2.4/Android.bp
index 40f7594..15a31fc 100644
--- a/camera/provider/2.4/Android.bp
+++ b/camera/provider/2.4/Android.bp
@@ -153,6 +153,7 @@
 
 cc_test {
     name: "android.hardware.camera.provider@2.4-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/configstore/1.0/Android.bp b/configstore/1.0/Android.bp
index bd11112..3e9c200 100644
--- a/configstore/1.0/Android.bp
+++ b/configstore/1.0/Android.bp
@@ -128,6 +128,7 @@
 
 cc_test {
     name: "android.hardware.configstore@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/contexthub/1.0/Android.bp b/contexthub/1.0/Android.bp
index 74e028c..e8f7103 100644
--- a/contexthub/1.0/Android.bp
+++ b/contexthub/1.0/Android.bp
@@ -137,6 +137,7 @@
 
 cc_test {
     name: "android.hardware.contexthub@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/drm/1.0/Android.bp b/drm/1.0/Android.bp
index c5f814c..502d10e 100644
--- a/drm/1.0/Android.bp
+++ b/drm/1.0/Android.bp
@@ -164,6 +164,7 @@
 
 cc_test {
     name: "android.hardware.drm@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/drm/1.0/vts/functional/Android.bp b/drm/1.0/vts/functional/Android.bp
index b45ce84..18aebee 100644
--- a/drm/1.0/vts/functional/Android.bp
+++ b/drm/1.0/vts/functional/Android.bp
@@ -16,6 +16,7 @@
 
 cc_test {
     name: "VtsHalDrmV1_0TargetTest",
+    defaults: ["VtsHalTargetTestDefaults"],
     srcs: [
         "drm_hal_clearkey_test.cpp",
         "drm_hal_vendor_test.cpp",
diff --git a/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp b/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp
index 04f2658..194b2a7 100644
--- a/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp
+++ b/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp
@@ -1064,8 +1064,6 @@
     AES_set_encrypt_key(&key[0], 128, &decryptionKey);
 
     size_t offset = 0;
-    size_t num = 0;
-    size_t ecount_buf = 0;
     for (size_t i = 0; i < subSamples.size(); i++) {
         memcpy(dest + offset, src + offset, subSamples[i].numBytesOfClearData);
         offset += subSamples[i].numBytesOfClearData;
@@ -1106,7 +1104,6 @@
     Status status = cryptoPlugin->setMediaDrmSession(sessionId);
     EXPECT_EQ(Status::OK, status);
 
-    const bool kNotSecure = false;
     uint32_t byteCount = decrypt(Mode::UNENCRYPTED, &iv[0], subSamples,
             noPattern, Status::OK);
     EXPECT_EQ(kByteCount, byteCount);
@@ -1133,7 +1130,6 @@
     Status status = cryptoPlugin->setMediaDrmSession(sessionId);
     EXPECT_EQ(Status::OK, status);
 
-    const bool kNotSecure = false;
     uint32_t byteCount = decrypt(Mode::AES_CTR, &iv[0], subSamples,
             noPattern, Status::OK);
     EXPECT_EQ(kClearBytes + kEncryptedBytes, byteCount);
@@ -1154,7 +1150,6 @@
     Status status = cryptoPlugin->setMediaDrmSession(sessionId);
     EXPECT_EQ(Status::OK, status);
 
-    const bool kNotSecure = false;
     uint32_t byteCount = decrypt(Mode::AES_CTR, &iv[0], subSamples,
             noPattern, Status::ERROR_DRM_NO_LICENSE);
     EXPECT_EQ(0u, byteCount);
diff --git a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
index 33fb6fb..389ffec 100644
--- a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
+++ b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
@@ -1407,8 +1407,6 @@
     AES_set_encrypt_key(&key[0], 128, &decryptionKey);
 
     size_t offset = 0;
-    size_t num = 0;
-    size_t ecount_buf = 0;
     for (size_t i = 0; i < subSamples.size(); i++) {
         const SubSample& subSample = subSamples[i];
 
diff --git a/dumpstate/1.0/Android.bp b/dumpstate/1.0/Android.bp
index 684ab35..5a028a5 100644
--- a/dumpstate/1.0/Android.bp
+++ b/dumpstate/1.0/Android.bp
@@ -124,6 +124,7 @@
 
 cc_test {
     name: "android.hardware.dumpstate@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/gatekeeper/1.0/Android.bp b/gatekeeper/1.0/Android.bp
index b3cd75e..5692bf1 100644
--- a/gatekeeper/1.0/Android.bp
+++ b/gatekeeper/1.0/Android.bp
@@ -128,6 +128,7 @@
 
 cc_test {
     name: "android.hardware.gatekeeper@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/gnss/1.0/Android.bp b/gnss/1.0/Android.bp
index f40e6e1..36b2095 100644
--- a/gnss/1.0/Android.bp
+++ b/gnss/1.0/Android.bp
@@ -299,6 +299,7 @@
 
 cc_test {
     name: "android.hardware.gnss@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/graphics/allocator/2.0/Android.bp b/graphics/allocator/2.0/Android.bp
index c24da12..6532065 100644
--- a/graphics/allocator/2.0/Android.bp
+++ b/graphics/allocator/2.0/Android.bp
@@ -135,6 +135,7 @@
 
 cc_test {
     name: "android.hardware.graphics.allocator@2.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/graphics/allocator/2.0/Android.mk b/graphics/allocator/2.0/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/graphics/allocator/2.0/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/graphics/allocator/Android.mk b/graphics/allocator/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/graphics/allocator/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/graphics/bufferqueue/1.0/Android.bp b/graphics/bufferqueue/1.0/Android.bp
index c96c3c3..44052c7 100644
--- a/graphics/bufferqueue/1.0/Android.bp
+++ b/graphics/bufferqueue/1.0/Android.bp
@@ -141,6 +141,7 @@
 
 cc_test {
     name: "android.hardware.graphics.bufferqueue@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/graphics/composer/2.1/Android.bp b/graphics/composer/2.1/Android.bp
index 9080781..3bdd0a6 100644
--- a/graphics/composer/2.1/Android.bp
+++ b/graphics/composer/2.1/Android.bp
@@ -150,6 +150,7 @@
 
 cc_test {
     name: "android.hardware.graphics.composer@2.1-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/graphics/composer/2.1/Android.mk b/graphics/composer/2.1/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/graphics/composer/2.1/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/graphics/composer/Android.mk b/graphics/composer/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/graphics/composer/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/graphics/mapper/2.0/Android.bp b/graphics/mapper/2.0/Android.bp
index f829840..6ab99b5 100644
--- a/graphics/mapper/2.0/Android.bp
+++ b/graphics/mapper/2.0/Android.bp
@@ -133,6 +133,7 @@
 
 cc_test {
     name: "android.hardware.graphics.mapper@2.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/graphics/mapper/2.0/Android.mk b/graphics/mapper/2.0/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/graphics/mapper/2.0/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/graphics/mapper/Android.mk b/graphics/mapper/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/graphics/mapper/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/health/1.0/Android.bp b/health/1.0/Android.bp
index 1b5661c..aff56a8 100644
--- a/health/1.0/Android.bp
+++ b/health/1.0/Android.bp
@@ -128,6 +128,7 @@
 
 cc_test {
     name: "android.hardware.health@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/health/2.0/Android.bp b/health/2.0/Android.bp
new file mode 100644
index 0000000..f944471
--- /dev/null
+++ b/health/2.0/Android.bp
@@ -0,0 +1,157 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+filegroup {
+    name: "android.hardware.health@2.0_hal",
+    srcs: [
+        "types.hal",
+        "IHealth.hal",
+        "IHealthInfoCallback.hal",
+    ],
+}
+
+genrule {
+    name: "android.hardware.health@2.0_genc++",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++-sources -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.health@2.0",
+    srcs: [
+        ":android.hardware.health@2.0_hal",
+    ],
+    out: [
+        "android/hardware/health/2.0/types.cpp",
+        "android/hardware/health/2.0/HealthAll.cpp",
+        "android/hardware/health/2.0/HealthInfoCallbackAll.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.health@2.0_genc++_headers",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++-headers -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.health@2.0",
+    srcs: [
+        ":android.hardware.health@2.0_hal",
+    ],
+    out: [
+        "android/hardware/health/2.0/types.h",
+        "android/hardware/health/2.0/hwtypes.h",
+        "android/hardware/health/2.0/IHealth.h",
+        "android/hardware/health/2.0/IHwHealth.h",
+        "android/hardware/health/2.0/BnHwHealth.h",
+        "android/hardware/health/2.0/BpHwHealth.h",
+        "android/hardware/health/2.0/BsHealth.h",
+        "android/hardware/health/2.0/IHealthInfoCallback.h",
+        "android/hardware/health/2.0/IHwHealthInfoCallback.h",
+        "android/hardware/health/2.0/BnHwHealthInfoCallback.h",
+        "android/hardware/health/2.0/BpHwHealthInfoCallback.h",
+        "android/hardware/health/2.0/BsHealthInfoCallback.h",
+    ],
+}
+
+cc_library {
+    name: "android.hardware.health@2.0",
+    defaults: ["hidl-module-defaults"],
+    generated_sources: ["android.hardware.health@2.0_genc++"],
+    generated_headers: ["android.hardware.health@2.0_genc++_headers"],
+    export_generated_headers: ["android.hardware.health@2.0_genc++_headers"],
+    vendor_available: true,
+    vndk: {
+        enabled: true,
+    },
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+        "libcutils",
+        "android.hardware.health@1.0",
+    ],
+    export_shared_lib_headers: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libutils",
+        "android.hardware.health@1.0",
+    ],
+}
+
+genrule {
+    name: "android.hardware.health@2.0-adapter-helper_genc++",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++-adapter-sources -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.health@2.0",
+    srcs: [
+        ":android.hardware.health@2.0_hal",
+    ],
+    out: [
+        "android/hardware/health/2.0/AHealth.cpp",
+        "android/hardware/health/2.0/AHealthInfoCallback.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.health@2.0-adapter-helper_genc++_headers",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++-adapter-headers -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.health@2.0",
+    srcs: [
+        ":android.hardware.health@2.0_hal",
+    ],
+    out: [
+        "android/hardware/health/2.0/AHealth.h",
+        "android/hardware/health/2.0/AHealthInfoCallback.h",
+    ],
+}
+
+
+cc_library {
+    name: "android.hardware.health@2.0-adapter-helper",
+    defaults: ["hidl-module-defaults"],
+    generated_sources: ["android.hardware.health@2.0-adapter-helper_genc++"],
+    generated_headers: ["android.hardware.health@2.0-adapter-helper_genc++_headers"],
+    export_generated_headers: ["android.hardware.health@2.0-adapter-helper_genc++_headers"],
+    vendor_available: true,
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+        "libcutils",
+        "libhidladapter",
+        "android.hardware.health@1.0",
+        "android.hardware.health@2.0",
+        "android.hardware.health@1.0-adapter-helper",
+        "android.hidl.base@1.0-adapter-helper",
+    ],
+    export_shared_lib_headers: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libutils",
+        "libhidladapter",
+        "android.hardware.health@1.0",
+        "android.hardware.health@2.0",
+        "android.hardware.health@1.0-adapter-helper",
+        "android.hidl.base@1.0-adapter-helper",
+    ],
+}
+
+genrule {
+    name: "android.hardware.health@2.0-adapter_genc++",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++-adapter-main -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.health@2.0",
+    out: ["main.cpp"]
+}
+
+cc_test {
+    name: "android.hardware.health@2.0-adapter",
+    defaults: ["hidl-module-defaults"],
+    shared_libs: [
+        "libhidladapter",
+        "libhidlbase",
+        "libhidltransport",
+        "libutils",
+        "android.hardware.health@1.0",
+        "android.hardware.health@2.0",
+        "android.hardware.health@2.0-adapter-helper",
+    ],
+    generated_sources: ["android.hardware.health@2.0-adapter_genc++"],
+}
diff --git a/health/2.0/Android.mk b/health/2.0/Android.mk
new file mode 100644
index 0000000..344c963
--- /dev/null
+++ b/health/2.0/Android.mk
@@ -0,0 +1,86 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.health-V2.0-java
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(call local-generated-sources-dir, COMMON)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+LOCAL_JAVA_LIBRARIES := \
+    android.hardware.health-V1.0-java \
+    android.hidl.base-V1.0-java \
+
+LOCAL_NO_STANDARD_LIBRARIES := true
+LOCAL_JAVA_LIBRARIES += core-oj hwbinder
+
+#
+# Build types.hal (Result)
+#
+GEN := $(intermediates)/android/hardware/health/V2_0/Result.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.health@2.0::types.Result
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IHealth.hal
+#
+GEN := $(intermediates)/android/hardware/health/V2_0/IHealth.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IHealth.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IHealthInfoCallback.hal
+$(GEN): $(LOCAL_PATH)/IHealthInfoCallback.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 \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.health@2.0::IHealth
+
+$(GEN): $(LOCAL_PATH)/IHealth.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IHealthInfoCallback.hal
+#
+GEN := $(intermediates)/android/hardware/health/V2_0/IHealthInfoCallback.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IHealthInfoCallback.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.health@2.0::IHealthInfoCallback
+
+$(GEN): $(LOCAL_PATH)/IHealthInfoCallback.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/health/2.0/IHealth.hal b/health/2.0/IHealth.hal
new file mode 100644
index 0000000..3e10701
--- /dev/null
+++ b/health/2.0/IHealth.hal
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.health@2.0;
+
+import @1.0::BatteryStatus;
+
+import IHealthInfoCallback;
+
+/**
+ * IHealth manages health info and posts events on registered callbacks.
+ */
+interface IHealth {
+
+    /**
+     * Register a callback for any health info events.
+     *
+     * Registering a new callback must not unregister the old one; the old
+     * callback remains registered until one of the following happens:
+     * - A client explicitly calls {@link unregisterCallback} to unregister it.
+     * - The client process that hosts the callback dies.
+     *
+     * @param callback the callback to register.
+     * @return result SUCCESS if successful,
+     *                UNKNOWN for other errors.
+     */
+    registerCallback(IHealthInfoCallback callback) generates (Result result);
+
+    /**
+     * Explicitly unregister a callback that is previously registered through
+     * {@link registerCallback}.
+     *
+     * @param callback the callback to unregister
+     * @return result SUCCESS if successful,
+     *                NOT_FOUND if callback is not registered previously,
+     *                UNKNOWN for other errors.
+     */
+    unregisterCallback(IHealthInfoCallback callback) generates (Result result);
+
+    /**
+     * Schedule update.
+     *
+     * When update() is called, the service must notify all registered callbacks
+     * with the most recent health info.
+     *
+     * @return result SUCCESS if successful,
+     *                CALLBACK_DIED if any registered callback is dead,
+     *                UNKNOWN for other errors.
+     */
+    update() generates (Result result);
+
+    /**
+     * Get battery capacity in microampere-hours(µAh).
+     *
+     * @return result SUCCESS if successful,
+     *                NOT_SUPPORTED if this property is not supported
+     *                 (e.g. the file that stores this property does not exist),
+     *                UNKNOWN for other errors.
+     * @return value battery capacity, or INT32_MIN if not successful.
+     */
+    getChargeCounter() generates (Result result, int32_t value);
+
+    /**
+     * Get instantaneous battery current in microamperes(µA).
+     *
+     * Positive values indicate net current entering the battery from a charge
+     * source, negative values indicate net current discharging from the
+     * battery.
+     *
+     * @return result SUCCESS if successful,
+     *                NOT_SUPPORTED if this property is not supported
+     *                 (e.g. the file that stores this property does not exist),
+     *                UNKNOWN for other errors.
+     * @return value instantaneous battery current, or INT32_MIN if not
+     *               successful.
+     */
+    getCurrentNow() generates (Result result, int32_t value);
+
+    /**
+     * Get average battery current in microamperes(µA).
+     *
+     * Positive values indicate net current entering the battery from a charge
+     * source, negative values indicate net current discharging from the
+     * battery. The time period over which the average is computed may depend on
+     * the fuel gauge hardware and its configuration.
+     *
+     * @return result SUCCESS if successful,
+     *                NOT_SUPPORTED if this property is not supported
+     *                 (e.g. the file that stores this property does not exist),
+     *                UNKNOWN for other errors.
+     * @return value average battery current, or INT32_MIN if not successful.
+     */
+    getCurrentAverage() generates (Result result, int32_t value);
+
+    /**
+     * Get remaining battery capacity percentage of total capacity
+     * (with no fractional part).
+     *
+     * @return result SUCCESS if successful,
+     *                NOT_SUPPORTED if this property is not supported
+     *                 (e.g. the file that stores this property does not exist),
+     *                UNKNOWN for other errors.
+     * @return value remaining battery capacity, or INT32_MIN if not successful.
+     */
+    getCapacity() generates (Result result, int32_t value);
+
+    /**
+     * Get battery remaining energy in nanowatt-hours.
+     *
+     * @return result SUCCESS if successful,
+     *                NOT_SUPPORTED if this property is not supported,
+     *                UNKNOWN for other errors.
+     * @return value remaining energy, or INT64_MIN if not successful.
+     */
+    getEnergyCounter() generates (Result result, int64_t value);
+
+    /**
+     * Get battery charge status.
+     *
+     * @return result SUCCESS if successful,
+     *                NOT_SUPPORTED if this property is not supported
+     *                 (e.g. the file that stores this property does not exist),
+     *                UNKNOWN other errors.
+     * @return value charge status, or UNKNOWN if not successful.
+     */
+    getChargeStatus() generates (Result result, BatteryStatus value);
+};
diff --git a/health/2.0/IHealthInfoCallback.hal b/health/2.0/IHealthInfoCallback.hal
new file mode 100644
index 0000000..8e17bb9
--- /dev/null
+++ b/health/2.0/IHealthInfoCallback.hal
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.health@2.0;
+
+import @1.0::HealthInfo;
+
+/**
+ * IHealthInfoCallback is the callback interface to
+ * {@link IHealthInfoBus.registerCallback}.
+ */
+interface IHealthInfoCallback {
+    /**
+     * An implementation of IHealthInfoBus must call healthInfoChanged on all
+     * registered callbacks after health info changes.
+     * @param info the updated HealthInfo
+     */
+    oneway healthInfoChanged(HealthInfo info);
+};
diff --git a/health/2.0/types.hal b/health/2.0/types.hal
new file mode 100644
index 0000000..89ea444
--- /dev/null
+++ b/health/2.0/types.hal
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.health@2.0;
+
+import @1.0::Result;
+
+/**
+ * Status values for HAL methods.
+ */
+enum Result : @1.0::Result {
+    NOT_FOUND,
+    CALLBACK_DIED,
+};
diff --git a/health/2.0/vts/OWNERS b/health/2.0/vts/OWNERS
new file mode 100644
index 0000000..885f6a8
--- /dev/null
+++ b/health/2.0/vts/OWNERS
@@ -0,0 +1,6 @@
+elsk@google.com
+sspatil@google.com
+
+# VTS team
+yim@google.com
+ryanjcampbell@google.com
diff --git a/health/Android.bp b/health/Android.bp
index 33f70eb..31e042a 100644
--- a/health/Android.bp
+++ b/health/Android.bp
@@ -2,4 +2,5 @@
 subdirs = [
     "1.0",
     "1.0/vts/functional",
+    "2.0",
 ]
diff --git a/ir/1.0/Android.bp b/ir/1.0/Android.bp
index 6ca7701..e686d23 100644
--- a/ir/1.0/Android.bp
+++ b/ir/1.0/Android.bp
@@ -128,6 +128,7 @@
 
 cc_test {
     name: "android.hardware.ir@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/ir/Android.mk b/ir/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/ir/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/keymaster/3.0/Android.bp b/keymaster/3.0/Android.bp
index 9019739..0e55133 100644
--- a/keymaster/3.0/Android.bp
+++ b/keymaster/3.0/Android.bp
@@ -128,6 +128,7 @@
 
 cc_test {
     name: "android.hardware.keymaster@3.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/keymaster/3.0/default/OWNERS b/keymaster/3.0/default/OWNERS
new file mode 100644
index 0000000..335660d
--- /dev/null
+++ b/keymaster/3.0/default/OWNERS
@@ -0,0 +1,2 @@
+jdanis@google.com
+swillden@google.com
diff --git a/keymaster/3.0/vts/OWNERS b/keymaster/3.0/vts/OWNERS
new file mode 100644
index 0000000..d53aadd
--- /dev/null
+++ b/keymaster/3.0/vts/OWNERS
@@ -0,0 +1,4 @@
+jdanis@google.com
+swillden@google.com
+yim@google.com
+ryanjcampbell@google.com
diff --git a/keymaster/3.0/vts/functional/attestation_record.cpp b/keymaster/3.0/vts/functional/attestation_record.cpp
index 5d96fff..a428989 100644
--- a/keymaster/3.0/vts/functional/attestation_record.cpp
+++ b/keymaster/3.0/vts/functional/attestation_record.cpp
@@ -274,10 +274,12 @@
     *keymaster_security_level =
         static_cast<SecurityLevel>(ASN1_ENUMERATED_get(record->keymaster_security_level));
 
-    attestation_challenge->setToExternal(record->attestation_challenge->data,
-                                         record->attestation_challenge->length);
-
-    unique_id->setToExternal(record->unique_id->data, record->unique_id->length);
+    auto& chall = record->attestation_challenge;
+    attestation_challenge->resize(chall->length);
+    memcpy(attestation_challenge->data(), chall->data, chall->length);
+    auto& uid = record->unique_id;
+    unique_id->resize(uid->length);
+    memcpy(unique_id->data(), uid->data, uid->length);
 
     ErrorCode error = extract_auth_list(record->software_enforced, software_enforced);
     if (error != ErrorCode::OK) return error;
diff --git a/light/2.0/Android.bp b/light/2.0/Android.bp
index 3412fcc..f1ce520 100644
--- a/light/2.0/Android.bp
+++ b/light/2.0/Android.bp
@@ -128,6 +128,7 @@
 
 cc_test {
     name: "android.hardware.light@2.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/light/2.0/vts/Android.mk b/light/2.0/vts/Android.mk
deleted file mode 100644
index 089503b..0000000
--- a/light/2.0/vts/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/media/omx/1.0/Android.bp b/media/omx/1.0/Android.bp
index 378c18e..7367409 100644
--- a/media/omx/1.0/Android.bp
+++ b/media/omx/1.0/Android.bp
@@ -187,6 +187,7 @@
 
 cc_test {
     name: "android.hardware.media.omx@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/memtrack/1.0/Android.bp b/memtrack/1.0/Android.bp
index fc6aa9d..fe88d0f 100644
--- a/memtrack/1.0/Android.bp
+++ b/memtrack/1.0/Android.bp
@@ -128,6 +128,7 @@
 
 cc_test {
     name: "android.hardware.memtrack@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/minijail/Android.bp b/minijail/Android.bp
new file mode 100644
index 0000000..c01a12b
--- /dev/null
+++ b/minijail/Android.bp
@@ -0,0 +1,13 @@
+cc_library_shared {
+    name: "libhwminijail",
+    defaults: ["hidl_defaults"],
+    vendor: true,
+    export_include_dirs: ["include"],
+
+    srcs: ["HardwareMinijail.cpp"],
+
+    shared_libs: [
+        "libbase",
+        "libminijail",
+    ],
+}
diff --git a/minijail/Android.mk b/minijail/Android.mk
deleted file mode 100644
index 272bb0e..0000000
--- a/minijail/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := libhwminijail
-LOCAL_PROPRIETARY_MODULE := true
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
-LOCAL_SRC_FILES := HardwareMinijail.cpp
-
-LOCAL_SHARED_LIBRARIES := \
-    libbase \
-    libminijail_vendor
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/nfc/1.0/Android.bp b/nfc/1.0/Android.bp
index ac02e44..ad84683 100644
--- a/nfc/1.0/Android.bp
+++ b/nfc/1.0/Android.bp
@@ -137,6 +137,7 @@
 
 cc_test {
     name: "android.hardware.nfc@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/nfc/1.0/default/Android.bp b/nfc/1.0/default/Android.bp
index d7f7203..3b53d16 100644
--- a/nfc/1.0/default/Android.bp
+++ b/nfc/1.0/default/Android.bp
@@ -19,6 +19,7 @@
 
 cc_binary {
     name: "android.hardware.nfc@1.0-service",
+    defaults: ["hidl_defaults"],
     relative_install_path: "hw",
     proprietary: true,
     init_rc: ["android.hardware.nfc@1.0-service.rc"],
diff --git a/nfc/1.0/vts/Android.mk b/nfc/1.0/vts/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/nfc/1.0/vts/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/power/1.0/Android.bp b/power/1.0/Android.bp
index 5cc4ae0..789fdcc 100644
--- a/power/1.0/Android.bp
+++ b/power/1.0/Android.bp
@@ -128,6 +128,7 @@
 
 cc_test {
     name: "android.hardware.power@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/power/1.0/vts/Android.mk b/power/1.0/vts/Android.mk
deleted file mode 100644
index df5dac8..0000000
--- a/power/1.0/vts/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
\ No newline at end of file
diff --git a/radio/1.0/Android.bp b/radio/1.0/Android.bp
index 4485e74..da496e7 100644
--- a/radio/1.0/Android.bp
+++ b/radio/1.0/Android.bp
@@ -164,6 +164,7 @@
 
 cc_test {
     name: "android.hardware.radio@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/radio/1.0/vts/functional/Android.bp b/radio/1.0/vts/functional/Android.bp
index 82a8a72..61136ae 100644
--- a/radio/1.0/vts/functional/Android.bp
+++ b/radio/1.0/vts/functional/Android.bp
@@ -50,6 +50,7 @@
 
 cc_library_static {
     name: "RadioVtsTestUtilBase",
+    defaults: ["hidl_defaults"],
     srcs : [
         "vts_test_util.cpp"
     ],
diff --git a/radio/1.1/Android.bp b/radio/1.1/Android.bp
index d89211b..462bd85 100644
--- a/radio/1.1/Android.bp
+++ b/radio/1.1/Android.bp
@@ -161,6 +161,7 @@
 
 cc_test {
     name: "android.hardware.radio@1.1-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/radio/1.1/vts/Android.mk b/radio/1.1/vts/Android.mk
deleted file mode 100644
index df5dac8..0000000
--- a/radio/1.1/vts/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
\ No newline at end of file
diff --git a/radio/deprecated/1.0/Android.bp b/radio/deprecated/1.0/Android.bp
index 82a7c8d..7b0c01e 100644
--- a/radio/deprecated/1.0/Android.bp
+++ b/radio/deprecated/1.0/Android.bp
@@ -148,6 +148,7 @@
 
 cc_test {
     name: "android.hardware.radio.deprecated@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/renderscript/1.0/Android.bp b/renderscript/1.0/Android.bp
index c687ea9..0fd5186 100644
--- a/renderscript/1.0/Android.bp
+++ b/renderscript/1.0/Android.bp
@@ -138,6 +138,7 @@
 
 cc_test {
     name: "android.hardware.renderscript@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/sensors/1.0/Android.bp b/sensors/1.0/Android.bp
index 8a91ee6..d3ec0be 100644
--- a/sensors/1.0/Android.bp
+++ b/sensors/1.0/Android.bp
@@ -128,6 +128,7 @@
 
 cc_test {
     name: "android.hardware.sensors@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/soundtrigger/2.0/Android.bp b/soundtrigger/2.0/Android.bp
index 173aa75..d902dd0 100644
--- a/soundtrigger/2.0/Android.bp
+++ b/soundtrigger/2.0/Android.bp
@@ -141,6 +141,7 @@
 
 cc_test {
     name: "android.hardware.soundtrigger@2.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/soundtrigger/2.0/Android.mk b/soundtrigger/2.0/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/soundtrigger/2.0/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/soundtrigger/2.0/vts/Android.mk b/soundtrigger/2.0/vts/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/soundtrigger/2.0/vts/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/tests/Android.bp b/tests/Android.bp
index 18fc473..0031637 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -6,6 +6,7 @@
     "baz/1.0/default",
     "expression/1.0",
     "extension/light/2.0",
+    "extension/light/2.0/default",
     "foo/1.0",
     "foo/1.0/default",
     "foo/1.0/default/lib",
diff --git a/tests/bar/1.0/Android.bp b/tests/bar/1.0/Android.bp
index ce4b4fc..b862c9b 100644
--- a/tests/bar/1.0/Android.bp
+++ b/tests/bar/1.0/Android.bp
@@ -167,6 +167,7 @@
 
 cc_test {
     name: "android.hardware.tests.bar@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/tests/bar/Android.mk b/tests/bar/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/tests/bar/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/tests/baz/1.0/Android.bp b/tests/baz/1.0/Android.bp
index 3a208a8..41b6ef2 100644
--- a/tests/baz/1.0/Android.bp
+++ b/tests/baz/1.0/Android.bp
@@ -152,6 +152,7 @@
 
 cc_test {
     name: "android.hardware.tests.baz@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/tests/baz/Android.mk b/tests/baz/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/tests/baz/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/tests/expression/1.0/Android.bp b/tests/expression/1.0/Android.bp
index a54538c..bbb6f33 100644
--- a/tests/expression/1.0/Android.bp
+++ b/tests/expression/1.0/Android.bp
@@ -130,6 +130,7 @@
 
 cc_test {
     name: "android.hardware.tests.expression@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/tests/expression/Android.mk b/tests/expression/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/tests/expression/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/tests/extension/light/2.0/Android.bp b/tests/extension/light/2.0/Android.bp
index 5220630..07dcea3 100644
--- a/tests/extension/light/2.0/Android.bp
+++ b/tests/extension/light/2.0/Android.bp
@@ -131,6 +131,7 @@
 
 cc_test {
     name: "android.hardware.tests.extension.light@2.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/tests/extension/light/2.0/default/Android.bp b/tests/extension/light/2.0/default/Android.bp
new file mode 100644
index 0000000..365a34a
--- /dev/null
+++ b/tests/extension/light/2.0/default/Android.bp
@@ -0,0 +1,34 @@
+//
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_binary {
+    name: "android.hardware.tests.extension.light@2.0-service",
+    init_rc: ["android.hardware.tests.extension.light@2.0-service.rc"],
+    vendor: true,
+    relative_install_path: "hw",
+    srcs: [
+        "Light.cpp",
+        "service.cpp",
+    ],
+
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libutils",
+        "android.hardware.light@2.0",
+        "android.hardware.tests.extension.light@2.0",
+    ],
+}
diff --git a/tests/extension/light/2.0/default/Android.mk b/tests/extension/light/2.0/default/Android.mk
deleted file mode 100644
index b30d11c..0000000
--- a/tests/extension/light/2.0/default/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.tests.extension.light@2.0-service
-LOCAL_INIT_RC := android.hardware.tests.extension.light@2.0-service.rc
-LOCAL_PROPRIETARY_MODULE := true
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := \
-    Light.cpp \
-    service.cpp
-
-LOCAL_SHARED_LIBRARIES := \
-    libhidlbase \
-    libhidltransport \
-    libutils \
-    android.hardware.light@2.0 \
-    android.hardware.tests.extension.light@2.0 \
-
-include $(BUILD_EXECUTABLE)
diff --git a/tests/foo/1.0/Android.bp b/tests/foo/1.0/Android.bp
index acf4fdd..51b5dc6 100644
--- a/tests/foo/1.0/Android.bp
+++ b/tests/foo/1.0/Android.bp
@@ -161,6 +161,7 @@
 
 cc_test {
     name: "android.hardware.tests.foo@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/tests/foo/Android.mk b/tests/foo/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/tests/foo/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/tests/hash/1.0/Android.bp b/tests/hash/1.0/Android.bp
index 3f7205e..ffff051 100644
--- a/tests/hash/1.0/Android.bp
+++ b/tests/hash/1.0/Android.bp
@@ -121,6 +121,7 @@
 
 cc_test {
     name: "android.hardware.tests.hash@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/tests/hash/1.0/default/Android.bp b/tests/hash/1.0/default/Android.bp
index ae44876..67f9097 100644
--- a/tests/hash/1.0/default/Android.bp
+++ b/tests/hash/1.0/default/Android.bp
@@ -1,5 +1,6 @@
 cc_library_shared {
     name: "android.hardware.tests.hash@1.0-impl",
+    defaults: ["hidl_defaults"],
     relative_install_path: "hw",
     srcs: [
         "Hash.cpp",
diff --git a/tests/inheritance/1.0/Android.bp b/tests/inheritance/1.0/Android.bp
index e693082..bd34512 100644
--- a/tests/inheritance/1.0/Android.bp
+++ b/tests/inheritance/1.0/Android.bp
@@ -148,6 +148,7 @@
 
 cc_test {
     name: "android.hardware.tests.inheritance@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/tests/inheritance/1.0/default/Parent.cpp b/tests/inheritance/1.0/default/Parent.cpp
index d3f1932..1fabf1b 100644
--- a/tests/inheritance/1.0/default/Parent.cpp
+++ b/tests/inheritance/1.0/default/Parent.cpp
@@ -1,8 +1,10 @@
 #define LOG_TAG "hidl_test"
 
+#include "Parent.h"
+
 #include <log/log.h>
 
-#include "Parent.h"
+#include "Child.h"
 
 namespace android {
 namespace hardware {
@@ -23,8 +25,11 @@
     return Void();
 }
 
+IParent* HIDL_FETCH_IParent(const char* name) {
+    if (name == std::string("child")) {
+        return new Child();
+    }
 
-IParent* HIDL_FETCH_IParent(const char* /* name */) {
     return new Parent();
 }
 
diff --git a/tests/inheritance/Android.mk b/tests/inheritance/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/tests/inheritance/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/tests/libhwbinder/1.0/Android.bp b/tests/libhwbinder/1.0/Android.bp
index 0a84abb..139aec5 100644
--- a/tests/libhwbinder/1.0/Android.bp
+++ b/tests/libhwbinder/1.0/Android.bp
@@ -130,6 +130,7 @@
 
 cc_test {
     name: "android.hardware.tests.libhwbinder@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/tests/libhwbinder/1.0/default/Android.bp b/tests/libhwbinder/1.0/default/Android.bp
index f1f99a6..3d18720 100644
--- a/tests/libhwbinder/1.0/default/Android.bp
+++ b/tests/libhwbinder/1.0/default/Android.bp
@@ -1,5 +1,6 @@
 cc_library_shared {
     name: "android.hardware.tests.libhwbinder@1.0-impl",
+    defaults: ["hidl_defaults"],
     relative_install_path: "hw",
     srcs: [
         "Benchmark.cpp",
diff --git a/tests/libhwbinder/Android.mk b/tests/libhwbinder/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/tests/libhwbinder/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/tests/libhwbinder/aidl/Android.bp b/tests/libhwbinder/aidl/Android.bp
index a662085..6d49704 100644
--- a/tests/libhwbinder/aidl/Android.bp
+++ b/tests/libhwbinder/aidl/Android.bp
@@ -1,5 +1,6 @@
 cc_library_shared {
     name: "android.hardware.tests.libbinder",
+    defaults: ["hidl_defaults"],
 
     srcs: ["android/tests/binder/IBenchmark.aidl"],
 
diff --git a/tests/memory/1.0/Android.bp b/tests/memory/1.0/Android.bp
index 7a36c0e..5653e97 100644
--- a/tests/memory/1.0/Android.bp
+++ b/tests/memory/1.0/Android.bp
@@ -121,6 +121,7 @@
 
 cc_test {
     name: "android.hardware.tests.memory@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/tests/msgq/1.0/Android.bp b/tests/msgq/1.0/Android.bp
index 0af5420..39a34cb 100644
--- a/tests/msgq/1.0/Android.bp
+++ b/tests/msgq/1.0/Android.bp
@@ -130,6 +130,7 @@
 
 cc_test {
     name: "android.hardware.tests.msgq@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/tests/msgq/1.0/default/Android.bp b/tests/msgq/1.0/default/Android.bp
index eb25ac2..be4fe94 100644
--- a/tests/msgq/1.0/default/Android.bp
+++ b/tests/msgq/1.0/default/Android.bp
@@ -35,6 +35,7 @@
 
 cc_test {
     name: "android.hardware.tests.msgq@1.0-service-benchmark",
+    defaults: ["hidl_defaults"],
     srcs: ["mq_benchmark_service.cpp"],
     gtest: false,
 
@@ -51,6 +52,7 @@
 
 cc_test {
     name: "android.hardware.tests.msgq@1.0-service-test",
+    defaults: ["hidl_defaults"],
     srcs: ["mq_test_service.cpp"],
     gtest: false,
 
diff --git a/tests/msgq/Android.mk b/tests/msgq/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/tests/msgq/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/tests/multithread/1.0/Android.bp b/tests/multithread/1.0/Android.bp
index df38695..98cbd5e 100644
--- a/tests/multithread/1.0/Android.bp
+++ b/tests/multithread/1.0/Android.bp
@@ -121,6 +121,7 @@
 
 cc_test {
     name: "android.hardware.tests.multithread@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/tests/pointer/1.0/Android.bp b/tests/pointer/1.0/Android.bp
index 1644186..2c13cb1 100644
--- a/tests/pointer/1.0/Android.bp
+++ b/tests/pointer/1.0/Android.bp
@@ -130,6 +130,7 @@
 
 cc_test {
     name: "android.hardware.tests.pointer@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/tests/pointer/Android.mk b/tests/pointer/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/tests/pointer/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/tests/trie/1.0/Android.bp b/tests/trie/1.0/Android.bp
index 27b5ea5..73f1b0b 100644
--- a/tests/trie/1.0/Android.bp
+++ b/tests/trie/1.0/Android.bp
@@ -125,6 +125,7 @@
 
 cc_test {
     name: "android.hardware.tests.trie@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/tetheroffload/config/1.0/Android.bp b/tetheroffload/config/1.0/Android.bp
index 705253d..5cafb5d 100644
--- a/tetheroffload/config/1.0/Android.bp
+++ b/tetheroffload/config/1.0/Android.bp
@@ -124,6 +124,7 @@
 
 cc_test {
     name: "android.hardware.tetheroffload.config@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/tetheroffload/control/1.0/Android.bp b/tetheroffload/control/1.0/Android.bp
index 75750f0..f4f120a 100644
--- a/tetheroffload/control/1.0/Android.bp
+++ b/tetheroffload/control/1.0/Android.bp
@@ -137,6 +137,7 @@
 
 cc_test {
     name: "android.hardware.tetheroffload.control@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/thermal/1.0/Android.bp b/thermal/1.0/Android.bp
index da1e641..199da79 100644
--- a/thermal/1.0/Android.bp
+++ b/thermal/1.0/Android.bp
@@ -128,6 +128,7 @@
 
 cc_test {
     name: "android.hardware.thermal@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/thermal/1.0/vts/Android.mk b/thermal/1.0/vts/Android.mk
deleted file mode 100644
index 60cc723..0000000
--- a/thermal/1.0/vts/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/tv/cec/1.0/Android.bp b/tv/cec/1.0/Android.bp
index 10902ef..f333777 100644
--- a/tv/cec/1.0/Android.bp
+++ b/tv/cec/1.0/Android.bp
@@ -137,6 +137,7 @@
 
 cc_test {
     name: "android.hardware.tv.cec@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/tv/cec/Android.mk b/tv/cec/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/tv/cec/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/tv/input/1.0/Android.bp b/tv/input/1.0/Android.bp
index 36b2f13..b07b2c7 100644
--- a/tv/input/1.0/Android.bp
+++ b/tv/input/1.0/Android.bp
@@ -141,6 +141,7 @@
 
 cc_test {
     name: "android.hardware.tv.input@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/tv/input/Android.mk b/tv/input/Android.mk
deleted file mode 100644
index f9e3276..0000000
--- a/tv/input/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
diff --git a/usb/1.0/Android.bp b/usb/1.0/Android.bp
index e97dbf9..ce4bc25 100644
--- a/usb/1.0/Android.bp
+++ b/usb/1.0/Android.bp
@@ -137,6 +137,7 @@
 
 cc_test {
     name: "android.hardware.usb@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/usb/1.0/default/Android.bp b/usb/1.0/default/Android.bp
new file mode 100644
index 0000000..2ebe61f
--- /dev/null
+++ b/usb/1.0/default/Android.bp
@@ -0,0 +1,34 @@
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+cc_binary {
+    name: "android.hardware.usb@1.0-service",
+    init_rc: ["android.hardware.usb@1.0-service.rc"],
+    relative_install_path: "hw",
+    vendor: true,
+    srcs: [
+        "service.cpp",
+        "Usb.cpp",
+    ],
+
+    shared_libs: [
+        "libcutils",
+        "libhidlbase",
+        "libhidltransport",
+        "liblog",
+        "libutils",
+        "libhardware",
+        "android.hardware.usb@1.0",
+    ],
+}
diff --git a/usb/1.0/default/Android.mk b/usb/1.0/default/Android.mk
deleted file mode 100644
index afd53cf..0000000
--- a/usb/1.0/default/Android.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_PROPRIETARY_MODULE := true
-LOCAL_MODULE := android.hardware.usb@1.0-service
-LOCAL_INIT_RC := android.hardware.usb@1.0-service.rc
-LOCAL_SRC_FILES := \
-    service.cpp \
-    Usb.cpp
-
-LOCAL_SHARED_LIBRARIES := \
-    libcutils \
-    libhidlbase \
-    libhidltransport \
-    liblog \
-    libutils \
-    libhardware \
-    android.hardware.usb@1.0 \
-
-include $(BUILD_EXECUTABLE)
diff --git a/usb/Android.bp b/usb/Android.bp
index 33f70eb..ed19a37 100644
--- a/usb/Android.bp
+++ b/usb/Android.bp
@@ -1,5 +1,6 @@
 // This is an autogenerated file, do not edit.
 subdirs = [
     "1.0",
+    "1.0/default",
     "1.0/vts/functional",
 ]
diff --git a/vibrator/1.0/Android.bp b/vibrator/1.0/Android.bp
index 0a48e00..9289657 100644
--- a/vibrator/1.0/Android.bp
+++ b/vibrator/1.0/Android.bp
@@ -128,6 +128,7 @@
 
 cc_test {
     name: "android.hardware.vibrator@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/vibrator/1.0/default/Android.bp b/vibrator/1.0/default/Android.bp
index d4200da..9170b39 100644
--- a/vibrator/1.0/default/Android.bp
+++ b/vibrator/1.0/default/Android.bp
@@ -16,7 +16,7 @@
 cc_library_shared {
     name: "android.hardware.vibrator@1.0-impl",
     defaults: ["hidl_defaults"],
-    proprietary: true,
+    vendor: true,
     relative_install_path: "hw",
     srcs: ["Vibrator.cpp"],
     shared_libs: [
@@ -28,3 +28,20 @@
         "android.hardware.vibrator@1.0",
     ],
 }
+
+cc_binary {
+    name: "android.hardware.vibrator@1.0-service",
+    init_rc: ["android.hardware.vibrator@1.0-service.rc"],
+    vendor: true,
+    relative_install_path: "hw",
+    srcs: ["service.cpp"],
+
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "liblog",
+        "libutils",
+        "libhardware",
+        "android.hardware.vibrator@1.0",
+    ],
+}
diff --git a/vibrator/1.0/default/Android.mk b/vibrator/1.0/default/Android.mk
deleted file mode 100644
index af4a955..0000000
--- a/vibrator/1.0/default/Android.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.vibrator@1.0-service
-LOCAL_INIT_RC := android.hardware.vibrator@1.0-service.rc
-LOCAL_PROPRIETARY_MODULE := true
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := \
-  service.cpp \
-
-LOCAL_SHARED_LIBRARIES := \
-  libhidlbase \
-  libhidltransport \
-  liblog \
-  libutils \
-  libhardware \
-  android.hardware.vibrator@1.0
-
-include $(BUILD_EXECUTABLE)
diff --git a/vibrator/1.0/vts/Android.mk b/vibrator/1.0/vts/Android.mk
deleted file mode 100644
index df5dac8..0000000
--- a/vibrator/1.0/vts/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-subdir-makefiles)
\ No newline at end of file
diff --git a/vr/1.0/Android.bp b/vr/1.0/Android.bp
index 5da5857..6fda0e6 100644
--- a/vr/1.0/Android.bp
+++ b/vr/1.0/Android.bp
@@ -124,6 +124,7 @@
 
 cc_test {
     name: "android.hardware.vr@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/wifi/1.0/Android.bp b/wifi/1.0/Android.bp
index 088591a..c61d989 100644
--- a/wifi/1.0/Android.bp
+++ b/wifi/1.0/Android.bp
@@ -236,6 +236,7 @@
 
 cc_test {
     name: "android.hardware.wifi@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",
diff --git a/wifi/1.0/vts/functional/Android.bp b/wifi/1.0/vts/functional/Android.bp
index e164cdf..10f1987 100644
--- a/wifi/1.0/vts/functional/Android.bp
+++ b/wifi/1.0/vts/functional/Android.bp
@@ -16,6 +16,7 @@
 
 cc_library_static {
     name: "VtsHalWifiV1_0TargetTestUtil",
+    defaults: ["hidl_defaults"],
     srcs: [
 
         "wifi_hidl_call_util_selftest.cpp",
diff --git a/wifi/supplicant/1.0/Android.bp b/wifi/supplicant/1.0/Android.bp
index 4bf8e68..8a0b802 100644
--- a/wifi/supplicant/1.0/Android.bp
+++ b/wifi/supplicant/1.0/Android.bp
@@ -227,6 +227,7 @@
 
 cc_test {
     name: "android.hardware.wifi.supplicant@1.0-adapter",
+    defaults: ["hidl-module-defaults"],
     shared_libs: [
         "libhidladapter",
         "libhidlbase",