Merge "Set pipe size to >1MB for debugDump test cases."
diff --git a/keymaster/3.0/default/Android.mk b/keymaster/3.0/default/Android.mk
index 9df5bf8..87ad245 100644
--- a/keymaster/3.0/default/Android.mk
+++ b/keymaster/3.0/default/Android.mk
@@ -11,7 +11,8 @@
     liblog \
     libsoftkeymasterdevice \
     libcrypto \
-    libkeymaster1 \
+    libkeymaster_portable \
+    libkeymaster_staging \
     libhidlbase \
     libhidltransport \
     libutils \
diff --git a/keymaster/3.0/default/KeymasterDevice.cpp b/keymaster/3.0/default/KeymasterDevice.cpp
index fcdd329..d83963f 100644
--- a/keymaster/3.0/default/KeymasterDevice.cpp
+++ b/keymaster/3.0/default/KeymasterDevice.cpp
@@ -64,7 +64,7 @@
     assert(mod->module_api_version < KEYMASTER_MODULE_API_VERSION_1_0);
     ALOGI("Found keymaster0 module %s, version %x", mod->name, mod->module_api_version);
 
-    UniquePtr<SoftKeymasterDevice> soft_keymaster(new SoftKeymasterDevice);
+    std::unique_ptr<SoftKeymasterDevice> soft_keymaster(new SoftKeymasterDevice);
     keymaster0_device_t* km0_device = NULL;
     keymaster_error_t error = KM_ERROR_OK;
 
@@ -107,7 +107,7 @@
     assert(mod->module_api_version >= KEYMASTER_MODULE_API_VERSION_1_0);
     ALOGI("Found keymaster1 module %s, version %x", mod->name, mod->module_api_version);
 
-    UniquePtr<SoftKeymasterDevice> soft_keymaster(new SoftKeymasterDevice);
+    std::unique_ptr<SoftKeymasterDevice> soft_keymaster(new SoftKeymasterDevice);
     keymaster1_device_t* km1_device = nullptr;
     keymaster_error_t error = KM_ERROR_OK;
 
diff --git a/radio/1.2/Android.bp b/radio/1.2/Android.bp
new file mode 100644
index 0000000..d6535f5
--- /dev/null
+++ b/radio/1.2/Android.bp
@@ -0,0 +1,197 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+filegroup {
+    name: "android.hardware.radio@1.2_hal",
+    srcs: [
+        "types.hal",
+        "IRadio.hal",
+        "ISap.hal",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio@1.2_genc++",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++-sources -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio@1.2",
+    srcs: [
+        ":android.hardware.radio@1.2_hal",
+    ],
+    out: [
+        "android/hardware/radio/1.2/types.cpp",
+        "android/hardware/radio/1.2/RadioAll.cpp",
+        "android/hardware/radio/1.2/SapAll.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio@1.2_genc++_headers",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++-headers -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio@1.2",
+    srcs: [
+        ":android.hardware.radio@1.2_hal",
+    ],
+    out: [
+        "android/hardware/radio/1.2/types.h",
+        "android/hardware/radio/1.2/hwtypes.h",
+        "android/hardware/radio/1.2/IRadio.h",
+        "android/hardware/radio/1.2/IHwRadio.h",
+        "android/hardware/radio/1.2/BnHwRadio.h",
+        "android/hardware/radio/1.2/BpHwRadio.h",
+        "android/hardware/radio/1.2/BsRadio.h",
+        "android/hardware/radio/1.2/ISap.h",
+        "android/hardware/radio/1.2/IHwSap.h",
+        "android/hardware/radio/1.2/BnHwSap.h",
+        "android/hardware/radio/1.2/BpHwSap.h",
+        "android/hardware/radio/1.2/BsSap.h",
+    ],
+}
+
+cc_library {
+    name: "android.hardware.radio@1.2",
+    defaults: ["hidl-module-defaults"],
+    generated_sources: ["android.hardware.radio@1.2_genc++"],
+    generated_headers: ["android.hardware.radio@1.2_genc++_headers"],
+    export_generated_headers: ["android.hardware.radio@1.2_genc++_headers"],
+    vendor_available: true,
+    vndk: {
+        enabled: true,
+    },
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+        "libcutils",
+        "android.hardware.radio@1.0",
+        "android.hardware.radio@1.1",
+    ],
+    export_shared_lib_headers: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libutils",
+        "android.hardware.radio@1.0",
+        "android.hardware.radio@1.1",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio-V1.2-java_gen_java",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Ljava -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio@1.2",
+    srcs: [
+        ":android.hardware.radio@1.2_hal",
+    ],
+    out: [
+        "android/hardware/radio/V1_2/IncrementalResultsPeriodicityRange.java",
+        "android/hardware/radio/V1_2/MaxSearchTimeRange.java",
+        "android/hardware/radio/V1_2/NetworkScanRequest.java",
+        "android/hardware/radio/V1_2/RadioConst.java",
+        "android/hardware/radio/V1_2/ScanIntervalRange.java",
+        "android/hardware/radio/V1_2/IRadio.java",
+        "android/hardware/radio/V1_2/ISap.java",
+    ],
+}
+
+java_library {
+    name: "android.hardware.radio-V1.2-java",
+    no_framework_libs: true,
+    defaults: ["hidl-java-module-defaults"],
+    srcs: [":android.hardware.radio-V1.2-java_gen_java"],
+    libs: [
+        "hwbinder",
+        "android.hardware.radio-V1.0-java",
+        "android.hardware.radio-V1.1-java",
+        "android.hidl.base-V1.0-java",
+    ]
+}
+
+// This package does not export any types. Not creating java constants export.
+
+
+genrule {
+    name: "android.hardware.radio@1.2-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.radio@1.2",
+    srcs: [
+        ":android.hardware.radio@1.2_hal",
+    ],
+    out: [
+        "android/hardware/radio/1.2/ARadio.cpp",
+        "android/hardware/radio/1.2/ASap.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio@1.2-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.radio@1.2",
+    srcs: [
+        ":android.hardware.radio@1.2_hal",
+    ],
+    out: [
+        "android/hardware/radio/1.2/ARadio.h",
+        "android/hardware/radio/1.2/ASap.h",
+    ],
+}
+
+cc_library {
+    name: "android.hardware.radio@1.2-adapter-helper",
+    defaults: ["hidl-module-defaults"],
+    generated_sources: ["android.hardware.radio@1.2-adapter-helper_genc++"],
+    generated_headers: ["android.hardware.radio@1.2-adapter-helper_genc++_headers"],
+    export_generated_headers: ["android.hardware.radio@1.2-adapter-helper_genc++_headers"],
+    vendor_available: true,
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+        "libcutils",
+        "libhidladapter",
+        "android.hardware.radio@1.0",
+        "android.hardware.radio@1.1",
+        "android.hardware.radio@1.2",
+        "android.hardware.radio@1.0-adapter-helper",
+        "android.hardware.radio@1.1-adapter-helper",
+        "android.hidl.base@1.0-adapter-helper",
+    ],
+    export_shared_lib_headers: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libutils",
+        "libhidladapter",
+        "android.hardware.radio@1.0",
+        "android.hardware.radio@1.1",
+        "android.hardware.radio@1.2",
+        "android.hardware.radio@1.0-adapter-helper",
+        "android.hardware.radio@1.1-adapter-helper",
+        "android.hidl.base@1.0-adapter-helper",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio@1.2-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.radio@1.2",
+    out: ["main.cpp"]
+}
+
+cc_test {
+    name: "android.hardware.radio@1.2-adapter",
+    defaults: ["hidl-module-defaults"],
+    shared_libs: [
+        "libhidladapter",
+        "libhidlbase",
+        "libhidltransport",
+        "libutils",
+        "android.hardware.radio@1.0",
+        "android.hardware.radio@1.1",
+        "android.hardware.radio@1.2",
+        "android.hardware.radio@1.2-adapter-helper",
+    ],
+    generated_sources: ["android.hardware.radio@1.2-adapter_genc++"],
+}
diff --git a/radio/1.2/IRadio.hal b/radio/1.2/IRadio.hal
new file mode 100644
index 0000000..6ae78a0
--- /dev/null
+++ b/radio/1.2/IRadio.hal
@@ -0,0 +1,40 @@
+/*
+ * 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.radio@1.2;
+
+import @1.1::IRadio;
+
+/**
+ * This interface is used by telephony and telecom to talk to cellular radio.
+ * All the functions have minimum one parameter:
+ * serial: which corresponds to serial no. of request. Serial numbers must only be memorized for the
+ * duration of a method call. If clients provide colliding serials (including passing the same
+ * serial to different methods), multiple responses (one for each method call) must still be served.
+ * setResponseFunctions must work with @1.1::IRadioResponse and @1.1::IRadioIndication.
+ */
+interface IRadio extends @1.1::IRadio {
+
+    /**
+     * Starts a network scan
+     *
+     * @param serial Serial number of request.
+     * @param request Defines the radio networks/bands/channels which need to be scanned.
+     *
+     * Response function is IRadioResponse.startNetworkScanResponse()
+     */
+    oneway startNetworkScan_1_2(int32_t serial, NetworkScanRequest request);
+};
diff --git a/radio/1.2/ISap.hal b/radio/1.2/ISap.hal
new file mode 100644
index 0000000..757027c
--- /dev/null
+++ b/radio/1.2/ISap.hal
@@ -0,0 +1,25 @@
+/*
+ * 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.radio@1.2;
+
+import @1.1::ISap;
+
+interface ISap extends @1.1::ISap {
+    /**
+     * Empty top level interface.
+     */
+};
diff --git a/radio/1.2/types.hal b/radio/1.2/types.hal
new file mode 100644
index 0000000..381eb85
--- /dev/null
+++ b/radio/1.2/types.hal
@@ -0,0 +1,99 @@
+/*
+ * 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.radio@1.2;
+
+import @1.0::RadioConst;
+import @1.1::RadioAccessSpecifier;
+import @1.1::ScanType;
+
+enum RadioConst : @1.0::RadioConst {
+    RADIO_ACCESS_SPEFICIER_MAX_SIZE = 8,
+};
+
+/**
+ * values are in seconds
+ */
+enum ScanIntervalRange : int32_t {
+    MIN = 5,
+    MAX = 300,
+};
+
+/**
+ * value are in seconds
+ */
+enum MaxSearchTimeRange : int32_t {
+    MIN = 60,
+    MAX = 3600,
+};
+
+/**
+ * values are in seconds
+ */
+enum IncrementalResultsPeriodicityRange : int32_t {
+    MIN = 1,
+    MAX = 10,
+};
+
+struct NetworkScanRequest {
+    ScanType type;
+
+    /**
+     * Time interval in seconds between periodic scans, only valid when type = PERIODIC
+     * Range: ScanIntervalRange:MIN to ScanIntervalRange:MAX
+     */
+    int32_t interval;
+
+    /**
+     * Networks with bands/channels to scan
+     * Maximum length of the vector is
+     * RadioConst:RADIO_ACCESS_SPEFICIER_MAX_SIZE
+     */
+    vec<RadioAccessSpecifier> specifiers;
+
+    /**
+     * Maximum duration of the periodic search (in seconds).
+     * Expected range for the input is [MaxSearchTimeRange:MIN - MaxSearchTimeRange:MAX]
+     * If the search lasts maxSearchTime, it must be terminated.
+     */
+    int32_t maxSearchTime;
+
+    /**
+     * Indicates whether the modem must report incremental results of the network scan
+     * to the client.
+     * FALSE – Incremental results must not be reported.
+     * TRUE  – Incremental must be reported.
+     */
+    bool incrementalResults;
+
+    /**
+     * Indicates the periodicity with which the modem must report incremental results to
+     * the client (in seconds).
+     * Expected range for the input is
+     * [IncrementalResultsPeriodicityRange:MIN - IncrementalResultsPeriodicityRange:MAX]
+     * This value must be less than or equal to maxSearchTime.
+     */
+    int32_t incrementalResultsPeriodicity;
+
+    /**
+     * Describes the List of PLMN ids (MCC-MNC)
+     * If any PLMN of this list is found, search must end at that point and results with all
+     * PLMN found until that point should be sent as response.
+     * If the list is not sent, search to be completed until end and all PLMNs found to be
+     * reported.
+     */
+    vec<string> mccMncs;
+};
diff --git a/radio/Android.bp b/radio/Android.bp
index 0acb2ee..a209d9d 100644
--- a/radio/Android.bp
+++ b/radio/Android.bp
@@ -4,5 +4,6 @@
     "1.0/vts/functional",
     "1.1",
     "1.1/vts/functional",
+    "1.2",
     "deprecated/1.0",
 ]
diff --git a/tests/bar/1.0/default/Android.bp b/tests/bar/1.0/default/Android.bp
index 82d34a9..8aa6135 100644
--- a/tests/bar/1.0/default/Android.bp
+++ b/tests/bar/1.0/default/Android.bp
@@ -1,6 +1,6 @@
 
 
-cc_library_shared {
+cc_library {
     name: "android.hardware.tests.bar@1.0-impl",
     defaults: ["hidl_defaults"],
     relative_install_path: "hw",
@@ -14,10 +14,15 @@
         "libcutils",
         "libhidlbase",
         "libhidltransport",
+        "libhwbinder",
         "liblog",
         "libutils",
+    ],
+
+    // These are static libs only for testing purposes and portability. Shared
+    // libs should be used on device.
+    static_libs: [
         "android.hardware.tests.foo@1.0",
         "android.hardware.tests.bar@1.0",
     ],
-
 }
diff --git a/tests/baz/1.0/IBaz.hal b/tests/baz/1.0/IBaz.hal
index e4eb145..8c6a9a4 100644
--- a/tests/baz/1.0/IBaz.hal
+++ b/tests/baz/1.0/IBaz.hal
@@ -68,7 +68,6 @@
         bitfield<BitField> bf;
     };
 
-    @Fragile @NoReally(very="yes", array={"a","b","c"})
     oneway doThis(float param);
 
     doThatAndReturnSomething(int64_t param) generates (int32_t result);
diff --git a/tests/baz/1.0/default/Android.bp b/tests/baz/1.0/default/Android.bp
index f247b83..492e0b4 100644
--- a/tests/baz/1.0/default/Android.bp
+++ b/tests/baz/1.0/default/Android.bp
@@ -1,4 +1,4 @@
-cc_library_shared {
+cc_library {
     name: "android.hardware.tests.baz@1.0-impl",
     defaults: ["hidl_defaults"],
     relative_install_path: "hw",
@@ -7,9 +7,15 @@
     ],
     shared_libs: [
         "libbase",
+        "libcutils",
         "libhidlbase",
         "libhidltransport",
+        "libhwbinder",
+        "liblog",
         "libutils",
-        "android.hardware.tests.baz@1.0",
     ],
+
+    // These are static libs only for testing purposes and portability. Shared
+    // libs should be used on device.
+    static_libs: ["android.hardware.tests.baz@1.0"],
 }
diff --git a/tests/extension/light/2.0/default/Android.bp b/tests/extension/light/2.0/default/Android.bp
index 365a34a..dcac97c 100644
--- a/tests/extension/light/2.0/default/Android.bp
+++ b/tests/extension/light/2.0/default/Android.bp
@@ -16,6 +16,7 @@
 
 cc_binary {
     name: "android.hardware.tests.extension.light@2.0-service",
+    defaults: ["hidl_defaults"],
     init_rc: ["android.hardware.tests.extension.light@2.0-service.rc"],
     vendor: true,
     relative_install_path: "hw",
diff --git a/tests/extension/light/2.0/default/service.cpp b/tests/extension/light/2.0/default/service.cpp
index 4d839b2..af287e9 100644
--- a/tests/extension/light/2.0/default/service.cpp
+++ b/tests/extension/light/2.0/default/service.cpp
@@ -30,6 +30,8 @@
 int main() {
     android::sp<ILight> service = new Light();
     configureRpcThreadpool(1, true /*callerWillJoin*/);
-    service->registerAsService();
+    if (service->registerAsService() != android::OK) {
+        exit(1);
+    }
     joinRpcThreadpool();
 }
diff --git a/tests/foo/1.0/default/Android.bp b/tests/foo/1.0/default/Android.bp
index 0e1d34d..d9dfc69 100644
--- a/tests/foo/1.0/default/Android.bp
+++ b/tests/foo/1.0/default/Android.bp
@@ -1,6 +1,6 @@
 
 
-cc_library_shared {
+cc_library {
     name: "android.hardware.tests.foo@1.0-impl",
     defaults: ["hidl_defaults"],
     relative_install_path: "hw",
@@ -11,12 +11,16 @@
     shared_libs: [
         "libbase",
         "libcutils",
+        "libfootest",
         "libhidlbase",
         "libhidltransport",
-        "libfootest",
+        "libhwbinder",
         "liblog",
         "libutils",
-        "android.hardware.tests.foo@1.0",
     ],
 
+    // These are static libs only for testing purposes and portability. Shared
+    // libs should be used on device.
+    static_libs: ["android.hardware.tests.foo@1.0"],
+
 }
diff --git a/tests/foo/1.0/default/lib/Android.bp b/tests/foo/1.0/default/lib/Android.bp
index 895582c..2cc96c5 100644
--- a/tests/foo/1.0/default/lib/Android.bp
+++ b/tests/foo/1.0/default/lib/Android.bp
@@ -1,4 +1,4 @@
-cc_library_shared {
+cc_library {
     name: "libfootest",
     defaults: ["hidl_defaults"],
     srcs: [
@@ -6,10 +6,14 @@
     ],
 
     shared_libs: [
+        "libcutils",
         "libhidlbase",
         "libhidltransport",
-        "android.hardware.tests.foo@1.0",
+        "libhwbinder",
+        "liblog",
     ],
+    static_libs: ["android.hardware.tests.foo@1.0"],
+
     local_include_dirs: ["include/hidl-test"],
     export_include_dirs: ["include"],
 
diff --git a/tests/hash/1.0/default/Android.bp b/tests/hash/1.0/default/Android.bp
index 67f9097..6e6d6a8 100644
--- a/tests/hash/1.0/default/Android.bp
+++ b/tests/hash/1.0/default/Android.bp
@@ -1,4 +1,4 @@
-cc_library_shared {
+cc_library {
     name: "android.hardware.tests.hash@1.0-impl",
     defaults: ["hidl_defaults"],
     relative_install_path: "hw",
@@ -6,9 +6,15 @@
         "Hash.cpp",
     ],
     shared_libs: [
+        "libcutils",
         "libhidlbase",
         "libhidltransport",
+        "libhwbinder",
+        "liblog",
         "libutils",
-        "android.hardware.tests.hash@1.0",
     ],
+
+    // These are static libs only for testing purposes and portability. Shared
+    // libs should be used on device.
+    static_libs: ["android.hardware.tests.hash@1.0"],
 }
diff --git a/tests/inheritance/1.0/default/Android.bp b/tests/inheritance/1.0/default/Android.bp
index 158da4b..891355b 100644
--- a/tests/inheritance/1.0/default/Android.bp
+++ b/tests/inheritance/1.0/default/Android.bp
@@ -1,6 +1,6 @@
 
 
-cc_library_shared {
+cc_library {
     name: "android.hardware.tests.inheritance@1.0-impl",
     defaults: ["hidl_defaults"],
     relative_install_path: "hw",
@@ -12,11 +12,16 @@
 
     shared_libs: [
         "libbase",
+        "libcutils",
         "libhidlbase",
         "libhidltransport",
+        "libhwbinder",
         "liblog",
         "libutils",
-        "android.hardware.tests.inheritance@1.0",
     ],
 
+    // These are static libs only for testing purposes and portability. Shared
+    // libs should be used on device.
+    static_libs: ["android.hardware.tests.inheritance@1.0"],
+
 }
diff --git a/tests/memory/1.0/default/Android.bp b/tests/memory/1.0/default/Android.bp
index efd4165..985183b 100644
--- a/tests/memory/1.0/default/Android.bp
+++ b/tests/memory/1.0/default/Android.bp
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-cc_library_shared {
+cc_library {
     name: "android.hardware.tests.memory@1.0-impl",
     defaults: ["hidl_defaults"],
     relative_install_path: "hw",
@@ -20,12 +20,17 @@
         "MemoryTest.cpp",
     ],
     shared_libs: [
+        "libcutils",
         "libhidlbase",
         "libhidltransport",
         "libhidlmemory",
+        "libhwbinder",
         "liblog",
         "libutils",
-        "android.hardware.tests.memory@1.0",
         "android.hidl.memory@1.0",
     ],
+
+    // These are static libs only for testing purposes and portability. Shared
+    // libs should be used on device.
+    static_libs: ["android.hardware.tests.memory@1.0"],
 }
\ No newline at end of file
diff --git a/tests/msgq/1.0/default/Android.bp b/tests/msgq/1.0/default/Android.bp
index be4fe94..6bbca24 100644
--- a/tests/msgq/1.0/default/Android.bp
+++ b/tests/msgq/1.0/default/Android.bp
@@ -13,7 +13,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-cc_library_shared {
+cc_library {
     name: "android.hardware.tests.msgq@1.0-impl",
     defaults: ["hidl_defaults"],
     relative_install_path: "hw",
@@ -27,10 +27,16 @@
         "libfmq",
         "libhidlbase",
         "libhidltransport",
+        "libhwbinder",
         "liblog",
         "libutils",
-        "android.hardware.tests.msgq@1.0",
     ],
+
+    // These are static libs only for testing purposes and portability. Shared
+    // libs should be used on device.
+    static_libs: [
+        "android.hardware.tests.msgq@1.0",
+    ]
 }
 
 cc_test {
@@ -59,10 +65,19 @@
     shared_libs: [
         "libbase",
         "libcutils",
+        "libfmq",
         "libhidlbase",
         "libhidltransport",
+        "libhwbinder",
         "liblog",
         "libutils",
-        "android.hardware.tests.msgq@1.0"
     ],
+
+    // Allow dlsym'ing self for statically linked passthrough implementations
+    ldflags: ["-rdynamic"],
+
+    // These are static libs only for testing purposes and portability. Shared
+    // libs should be used on device.
+    static_libs: ["android.hardware.tests.msgq@1.0"],
+    whole_static_libs: ["android.hardware.tests.msgq@1.0-impl"],
 }
diff --git a/tests/multithread/1.0/default/Android.bp b/tests/multithread/1.0/default/Android.bp
index a7a750a..a94ee3e 100644
--- a/tests/multithread/1.0/default/Android.bp
+++ b/tests/multithread/1.0/default/Android.bp
@@ -1,4 +1,4 @@
-cc_library_shared {
+cc_library {
     name: "android.hardware.tests.multithread@1.0-impl",
     defaults: ["hidl_defaults"],
     relative_install_path: "hw",
@@ -7,10 +7,15 @@
     ],
     shared_libs: [
         "libbase",
+        "libcutils",
         "libhidlbase",
         "libhidltransport",
+        "libhwbinder",
         "liblog",
         "libutils",
-        "android.hardware.tests.multithread@1.0",
     ],
+
+    // These are static libs only for testing purposes and portability. Shared
+    // libs should be used on device.
+    static_libs: ["android.hardware.tests.multithread@1.0"],
 }
diff --git a/tests/pointer/1.0/default/Android.bp b/tests/pointer/1.0/default/Android.bp
index 0c91edb..4825ac7 100644
--- a/tests/pointer/1.0/default/Android.bp
+++ b/tests/pointer/1.0/default/Android.bp
@@ -1,6 +1,6 @@
 
 
-cc_library_shared {
+cc_library {
     name: "android.hardware.tests.pointer@1.0-impl",
     defaults: ["hidl_defaults"],
     relative_install_path: "hw",
@@ -11,12 +11,17 @@
 
     shared_libs: [
         "libbase",
+        "libcutils",
         "libhidlbase",
         "libhidltransport",
+        "libhwbinder",
         "libpointertest",
         "liblog",
         "libutils",
-        "android.hardware.tests.pointer@1.0",
     ],
 
+    // These are static libs only for testing purposes and portability. Shared
+    // libs should be used on device.
+    static_libs: ["android.hardware.tests.pointer@1.0"],
+
 }
diff --git a/tests/pointer/1.0/default/lib/Android.bp b/tests/pointer/1.0/default/lib/Android.bp
index ae07b04..180906b 100644
--- a/tests/pointer/1.0/default/lib/Android.bp
+++ b/tests/pointer/1.0/default/lib/Android.bp
@@ -1,4 +1,4 @@
-cc_library_shared {
+cc_library {
     name: "libpointertest",
     defaults: ["hidl_defaults"],
     srcs: [
@@ -10,8 +10,9 @@
         "libhidlbase",
         "libhidltransport",
         "liblog",
-        "android.hardware.tests.pointer@1.0",
     ],
+    static_libs: ["android.hardware.tests.pointer@1.0"],
+
     local_include_dirs: ["include/hidl-test"],
     export_include_dirs: ["include"],
 
diff --git a/tests/trie/1.0/default/Android.bp b/tests/trie/1.0/default/Android.bp
index 315c8bb..948a8cb 100644
--- a/tests/trie/1.0/default/Android.bp
+++ b/tests/trie/1.0/default/Android.bp
@@ -1,4 +1,4 @@
-cc_library_shared {
+cc_library {
     name: "android.hardware.tests.trie@1.0-impl",
     defaults: ["hidl_defaults"],
     relative_install_path: "hw",
@@ -7,10 +7,15 @@
     ],
     shared_libs: [
         "libbase",
+        "libcutils",
         "libhidlbase",
         "libhidltransport",
+        "libhwbinder",
         "liblog",
         "libutils",
-        "android.hardware.tests.trie@1.0",
     ],
+
+    // These are static libs only for testing purposes and portability. Shared
+    // libs should be used on device.
+    static_libs: ["android.hardware.tests.trie@1.0"],
 }
diff --git a/usb/1.0/default/Android.bp b/usb/1.0/default/Android.bp
index 2ebe61f..64de821 100644
--- a/usb/1.0/default/Android.bp
+++ b/usb/1.0/default/Android.bp
@@ -14,6 +14,7 @@
 
 cc_binary {
     name: "android.hardware.usb@1.0-service",
+    defaults: ["hidl_defaults"],
     init_rc: ["android.hardware.usb@1.0-service.rc"],
     relative_install_path: "hw",
     vendor: true,
diff --git a/vibrator/1.0/default/Android.bp b/vibrator/1.0/default/Android.bp
index 9170b39..0c7d155 100644
--- a/vibrator/1.0/default/Android.bp
+++ b/vibrator/1.0/default/Android.bp
@@ -31,6 +31,7 @@
 
 cc_binary {
     name: "android.hardware.vibrator@1.0-service",
+    defaults: ["hidl_defaults"],
     init_rc: ["android.hardware.vibrator@1.0-service.rc"],
     vendor: true,
     relative_install_path: "hw",