Merge "Add sched_setscheduler to the arm64 policy."
diff --git a/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp b/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
index eec2b10..7c213d4 100644
--- a/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
+++ b/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
@@ -24,6 +24,9 @@
 #include <string>
 #include <vector>
 
+#include <fcntl.h>
+#include <unistd.h>
+
 #include <VtsHalHidlTargetTestBase.h>
 
 #include <android-base/logging.h>
@@ -473,19 +476,23 @@
 
 template <class DebugDump>
 static void testDebugDump(DebugDump debugDump) {
-    // Dump in a temporary file
-    // Note that SELinux must be deactivate for this test to work
-    FILE* file = tmpfile();
-    ASSERT_NE(nullptr, file) << errno;
+    // File descriptors to our pipe. fds[0] corresponds to the read end and
+    // fds[1] to the write end.
+    int fds[2];
+    ASSERT_EQ(0, pipe2(fds, O_NONBLOCK)) << errno;
+
+    // Make sure that the pipe is at least 1 MB in size. The test process runs
+    // in su domain, so it should be safe to make this call.
+    fcntl(fds[0], F_SETPIPE_SZ, 1 << 20);
 
     // Wrap the temporary file file descriptor in a native handle
     auto* nativeHandle = native_handle_create(1, 0);
     ASSERT_NE(nullptr, nativeHandle);
-    nativeHandle->data[0] = fileno(file);
+    nativeHandle->data[0] = fds[1];
 
     // Wrap this native handle in a hidl handle
     hidl_handle handle;
-    handle.setTo(nativeHandle, true /*take ownership*/);
+    handle.setTo(nativeHandle, false /*take ownership*/);
 
     ASSERT_OK(debugDump(handle));
 
@@ -493,12 +500,12 @@
     // TODO: debugDump does not return a Result.
     // This mean that the hal can not report that it not implementing the
     // function.
-    rewind(file);  // can not fail
     char buff;
-    if (fread(&buff, sizeof(buff), 1, file) != 1) {
+    if (read(fds[0], &buff, 1) != 1) {
         doc::note("debugDump does not seem implemented");
     }
-    EXPECT_EQ(0, fclose(file)) << errno;
+    EXPECT_EQ(0, close(fds[0])) << errno;
+    EXPECT_EQ(0, close(fds[1])) << errno;
 }
 
 TEST_F(AudioPrimaryHidlTest, DebugDump) {
diff --git a/biometrics/fingerprint/2.1/vts/functional/VtsHalBiometricsFingerprintV2_1TargetTest.cpp b/biometrics/fingerprint/2.1/vts/functional/VtsHalBiometricsFingerprintV2_1TargetTest.cpp
index 29776b4..638af9f 100644
--- a/biometrics/fingerprint/2.1/vts/functional/VtsHalBiometricsFingerprintV2_1TargetTest.cpp
+++ b/biometrics/fingerprint/2.1/vts/functional/VtsHalBiometricsFingerprintV2_1TargetTest.cpp
@@ -43,7 +43,7 @@
 static const uint32_t kTimeout = 3;
 static const std::chrono::seconds kTimeoutInSeconds = std::chrono::seconds(kTimeout);
 static const uint32_t kGroupId = 99;
-static const std::string kTmpDir = "/data/system/";
+static const std::string kTmpDir = "/data/system/users/0/fpdata/";
 static const uint32_t kIterations = 1000;
 
 // Wait for a callback to occur (signaled by the given future) up to the
@@ -186,7 +186,7 @@
     ASSERT_FALSE(mService == nullptr);
 
     // Create an active group
-    // FP service can only write to /data/system due to
+    // FP service can only write to /data/system/users/*/fpdata/ due to
     // SELinux Policy and Linux Dir Permissions
     Return<RequestStatus> res = mService->setActiveGroup(kGroupId, kTmpDir);
     ASSERT_EQ(RequestStatus::SYS_OK, static_cast<RequestStatus>(res));
diff --git a/current.txt b/current.txt
index 5296efb..b46ea62 100644
--- a/current.txt
+++ b/current.txt
@@ -228,6 +228,9 @@
 b056e1defab4071584214584057d0bc73a613081bf1152590549649d4582c13c android.hardware.wifi@1.1::IWifiChip
 
 # ABI preserving changes to HALs during Android O MR1 (Final Set)
+09342041e17c429fce0034b9096d17849122111436a5f0053e7e59500e1cb89c android.hardware.media.omx@1.0::IOmxStore
+2d833aeed0cd1d59437aca210be590a953cf32bcb6683cd63d089762a643fb49 android.hardware.radio@1.0::IRadioResponse
+0a159f81359cd4f71bbe00972ee8403ea79351fb7c0cd48be72ebb3e424dbaef android.hardware.radio@1.0::types
 05aa3de6130a9788fdb6f4d3cc57c3ea90f067e77a5e09d6a772ec7f6bca33d2 android.hardware.radio@1.1::IRadioResponse
 
 # HALs released in Android O MR1 (Final Set)
@@ -245,8 +248,6 @@
 86ba9c03978b79a742e990420bc5ced0673d25a939f82572996bef92621e2014 android.hardware.cas@1.0::IMediaCasService
 503da837d1a67cbdb7c08a033e927e5430ae1b159d98bf72c6336b4dcc5e76f5 android.hardware.cas.native@1.0::types
 619600109232ed64b827c8a11beed8070b1827ae464547d7aa146cf0473b4bca android.hardware.cas.native@1.0::IDescrambler
-0a159f81359cd4f71bbe00972ee8403ea79351fb7c0cd48be72ebb3e424dbaef android.hardware.radio@1.0::types
-09342041e17c429fce0034b9096d17849122111436a5f0053e7e59500e1cb89c android.hardware.media.omx@1.0::IOmxStore
 246a56d37d57a47224562c9d077b4a2886ce6242b9311bd98a17325944c280d7 android.hardware.neuralnetworks@1.0::types
 93eb3757ceaf21590fa4cd1d4a7dfe3b3794af5396100a6d25630879352abce9 android.hardware.neuralnetworks@1.0::IDevice
 f66f9a38541bf92001d3adcce678cd7e3da2262124befb460b1c9aea9492813b android.hardware.neuralnetworks@1.0::IExecutionCallback
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
index 9e185f2..38cdcd6 100644
--- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
+++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
@@ -230,6 +230,10 @@
 
     virtual void TearDown() override {
         if (omxNode != nullptr) {
+            // If you have encountered a fatal failure, it is possible that
+            // freeNode() will not go through. Instead of hanging the app.
+            // let it pass through and report errors
+            if (::testing::Test::HasFatalFailure()) return;
             EXPECT_TRUE((omxNode->freeNode()).isOk());
             omxNode = nullptr;
         }
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp
index d872444..953dc75 100644
--- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp
+++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp
@@ -216,6 +216,10 @@
 
     virtual void TearDown() override {
         if (omxNode != nullptr) {
+            // If you have encountered a fatal failure, it is possible that
+            // freeNode() will not go through. Instead of hanging the app.
+            // let it pass through and report errors
+            if (::testing::Test::HasFatalFailure()) return;
             EXPECT_TRUE((omxNode->freeNode()).isOk());
             omxNode = nullptr;
         }
diff --git a/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp b/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
index 401e54a..d66136d 100644
--- a/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
+++ b/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
@@ -191,6 +191,10 @@
 
     virtual void TearDown() override {
         if (omxNode != nullptr) {
+            // If you have encountered a fatal failure, it is possible that
+            // freeNode() will not go through. Instead of hanging the app.
+            // let it pass through and report errors
+            if (::testing::Test::HasFatalFailure()) return;
             EXPECT_TRUE((omxNode->freeNode()).isOk());
             omxNode = nullptr;
         }
diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
index 667c2e1..9b74a33 100644
--- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
+++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
@@ -232,6 +232,10 @@
 
     virtual void TearDown() override {
         if (omxNode != nullptr) {
+            // If you have encountered a fatal failure, it is possible that
+            // freeNode() will not go through. Instead of hanging the app.
+            // let it pass through and report errors
+            if (::testing::Test::HasFatalFailure()) return;
             EXPECT_TRUE((omxNode->freeNode()).isOk());
             omxNode = nullptr;
         }
diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
index 743ff78..099658f 100644
--- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
+++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
@@ -243,6 +243,10 @@
 
     virtual void TearDown() override {
         if (omxNode != nullptr) {
+            // If you have encountered a fatal failure, it is possible that
+            // freeNode() will not go through. Instead of hanging the app.
+            // let it pass through and report errors
+            if (::testing::Test::HasFatalFailure()) return;
             EXPECT_TRUE((omxNode->freeNode()).isOk());
             omxNode = nullptr;
         }
diff --git a/radio/1.0/IRadioResponse.hal b/radio/1.0/IRadioResponse.hal
index 94b304a..27945cb 100644
--- a/radio/1.0/IRadioResponse.hal
+++ b/radio/1.0/IRadioResponse.hal
@@ -1190,6 +1190,7 @@
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:NO_RESOURCES
      *   RadioError:CANCELLED
+     *   RadioError:SIM_ABSENT
      */
     oneway setSuppServiceNotificationsResponse(RadioResponseInfo info);
 
@@ -1295,6 +1296,7 @@
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:MODEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:SIM_ABSENT
      */
     oneway sendEnvelopeResponse(RadioResponseInfo info, string commandResponse);
 
@@ -1312,6 +1314,7 @@
      *   RadioError:CANCELLED
      *   RadioError:INVALID_MODEM_STATE
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:SIM_ABSENT
      */
     oneway sendTerminalResponseToSimResponse(RadioResponseInfo info);
 
@@ -1329,6 +1332,7 @@
      *   RadioError:NO_RESOURCES
      *   RadioError:CANCELLED
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:SIM_ABSENT
      */
     oneway handleStkCallSetupRequestFromSimResponse(RadioResponseInfo info);
 
@@ -1425,6 +1429,7 @@
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:NO_RESOURCES
      *   RadioError:CANCELLED
+     *   RadioError:SIM_ABSENT
      */
     oneway setLocationUpdatesResponse(RadioResponseInfo info);
 
@@ -1459,6 +1464,7 @@
      *   RadioError:OPERATION_NOT_ALLOWED
      *   RadioError:NO_RESOURCES
      *   RadioError:CANCELLED
+     *   RadioError:SIM_ABSENT
      */
     oneway setCdmaRoamingPreferenceResponse(RadioResponseInfo info);
 
@@ -1477,6 +1483,7 @@
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:NO_RESOURCES
      *   RadioError:CANCELLED
+     *   RadioError:SIM_ABSENT
      */
     oneway getCdmaRoamingPreferenceResponse(RadioResponseInfo info, CdmaRoamingType type);
 
@@ -1801,6 +1808,7 @@
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:NO_RESOURCES
      *   RadioError:CANCELLED
+     *   RadioError:SIM_ABSENT
      */
     oneway getCDMASubscriptionResponse(RadioResponseInfo info, string mdn, string hSid,
             string hNid, string min, string prl);
@@ -1896,6 +1904,7 @@
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:NO_RESOURCES
      *   RadioError:CANCELLED
+     *   RadioError:SIM_ABSENT
      */
     oneway exitEmergencyCallbackModeResponse(RadioResponseInfo info);
 
@@ -1991,6 +2000,7 @@
      *   RadioError:NO_RESOURCES
      *   RadioError:CANCELLED
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:SIM_ABSENT
      */
     oneway getCdmaSubscriptionSourceResponse(RadioResponseInfo info, CdmaSubscriptionSource source);
 
@@ -2008,6 +2018,7 @@
      *   RadioError:INVALID_MODEM_STATE
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:SIM_ABSENT
      */
     oneway requestIsimAuthenticationResponse(RadioResponseInfo info, string response);
 
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_ims.cpp b/radio/1.0/vts/functional/radio_hidl_hal_ims.cpp
index c1834c5..aa9d987 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_ims.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_ims.cpp
@@ -155,7 +155,8 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+                    radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
     }
 }
 
@@ -173,7 +174,7 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(CheckGeneralError());
+        ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
     }
 }
 
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
index a502c12..f813532 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
@@ -265,7 +265,8 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+                    radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
     }
 }
 
@@ -282,7 +283,8 @@
 
     if (cardStatus.cardState == CardState::ABSENT) {
         ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
-                    radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
+                    radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED ||
+                    radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
     }
 }
 
@@ -299,7 +301,8 @@
 
     if (cardStatus.cardState == CardState::ABSENT) {
         ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::NONE ||
-                    radioRsp->rspInfo.error == RadioError::MODEM_ERR);
+                    radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                    radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
     }
 }
 
@@ -381,7 +384,9 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+                    radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED ||
+                    radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
     }
 }
 
@@ -414,7 +419,9 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+                    radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED ||
+                    radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
     }
 }
 
@@ -430,7 +437,9 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+                    radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED ||
+                    radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
     }
 }
 
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp b/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp
index da46e88..611867a 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp
@@ -38,7 +38,8 @@
         ASSERT_TRUE(CheckGeneralError() ||
                     radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
                     radioRsp->rspInfo.error == RadioError::NONE ||
-                    radioRsp->rspInfo.error == RadioError::MODEM_ERR);
+                    radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                    radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
     }
 }
 
@@ -61,7 +62,8 @@
         std::cout << static_cast<int>(radioRsp->rspInfo.error) << std::endl;
         ASSERT_TRUE(CheckGeneralError() ||
                     radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
-                    radioRsp->rspInfo.error == RadioError::NONE);
+                    radioRsp->rspInfo.error == RadioError::NONE ||
+                    radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
     }
 }
 
@@ -81,7 +83,8 @@
     if (cardStatus.cardState == CardState::ABSENT) {
         ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::NONE ||
                     radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
-                    radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS);
+                    radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                    radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
     }
 }
 
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/Android.bp b/tests/extension/light/2.0/Android.bp
index 796e256..612c2d6 100644
--- a/tests/extension/light/2.0/Android.bp
+++ b/tests/extension/light/2.0/Android.bp
@@ -4,7 +4,7 @@
     name: "android.hardware.tests.extension.light@2.0_hal",
     srcs: [
         "types.hal",
-        "IExtLight.hal",
+        "ILight.hal",
     ],
 }
 
@@ -17,7 +17,7 @@
     ],
     out: [
         "android/hardware/tests/extension/light/2.0/types.cpp",
-        "android/hardware/tests/extension/light/2.0/ExtLightAll.cpp",
+        "android/hardware/tests/extension/light/2.0/LightAll.cpp",
     ],
 }
 
@@ -31,11 +31,11 @@
     out: [
         "android/hardware/tests/extension/light/2.0/types.h",
         "android/hardware/tests/extension/light/2.0/hwtypes.h",
-        "android/hardware/tests/extension/light/2.0/IExtLight.h",
-        "android/hardware/tests/extension/light/2.0/IHwExtLight.h",
-        "android/hardware/tests/extension/light/2.0/BnHwExtLight.h",
-        "android/hardware/tests/extension/light/2.0/BpHwExtLight.h",
-        "android/hardware/tests/extension/light/2.0/BsExtLight.h",
+        "android/hardware/tests/extension/light/2.0/ILight.h",
+        "android/hardware/tests/extension/light/2.0/IHwLight.h",
+        "android/hardware/tests/extension/light/2.0/BnHwLight.h",
+        "android/hardware/tests/extension/light/2.0/BpHwLight.h",
+        "android/hardware/tests/extension/light/2.0/BsLight.h",
     ],
 }
 
@@ -72,10 +72,10 @@
         ":android.hardware.tests.extension.light@2.0_hal",
     ],
     out: [
+        "android/hardware/tests/extension/light/V2_0/Brightness.java",
         "android/hardware/tests/extension/light/V2_0/Default.java",
-        "android/hardware/tests/extension/light/V2_0/ExtBrightness.java",
-        "android/hardware/tests/extension/light/V2_0/ExtLightState.java",
-        "android/hardware/tests/extension/light/V2_0/IExtLight.java",
+        "android/hardware/tests/extension/light/V2_0/LightState.java",
+        "android/hardware/tests/extension/light/V2_0/ILight.java",
     ],
 }
 
@@ -102,7 +102,7 @@
         ":android.hardware.tests.extension.light@2.0_hal",
     ],
     out: [
-        "android/hardware/tests/extension/light/2.0/AExtLight.cpp",
+        "android/hardware/tests/extension/light/2.0/ALight.cpp",
     ],
 }
 
@@ -114,7 +114,7 @@
         ":android.hardware.tests.extension.light@2.0_hal",
     ],
     out: [
-        "android/hardware/tests/extension/light/2.0/AExtLight.h",
+        "android/hardware/tests/extension/light/2.0/ALight.h",
     ],
 }
 
diff --git a/tests/extension/light/2.0/IExtLight.hal b/tests/extension/light/2.0/ILight.hal
similarity index 75%
rename from tests/extension/light/2.0/IExtLight.hal
rename to tests/extension/light/2.0/ILight.hal
index 1515b86..94781c0 100644
--- a/tests/extension/light/2.0/IExtLight.hal
+++ b/tests/extension/light/2.0/ILight.hal
@@ -19,17 +19,21 @@
 // vendor partition.
 package android.hardware.tests.extension.light@2.0;
 
-import android.hardware.light@2.0;
+import android.hardware.light@2.0::ILight;
+import android.hardware.light@2.0::Status;
+import android.hardware.light@2.0::Type;
 
-interface IExtLight extends android.hardware.light@2.0::ILight {
+interface ILight extends android.hardware.light@2.0::ILight {
 
     /**
      * Set the provided lights to the provided values.
      *
+     * If this was a minor version extension, the recommended
+     * name would be setLight_2_1.
+     *
      * @param type logical light to set
      * @param state describes what the light should look like.
      * @return status result of applying state transformation.
      */
-    setExtLight(Type type, ExtLightState state) generates (Status status);
-
+    setLightExt(Type type, LightState state) generates (Status status);
 };
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/Light.cpp b/tests/extension/light/2.0/default/Light.cpp
index d941e73..9df7924 100644
--- a/tests/extension/light/2.0/default/Light.cpp
+++ b/tests/extension/light/2.0/default/Light.cpp
@@ -24,18 +24,15 @@
 namespace implementation {
 
 // Methods from ::android::hardware::light::V2_0::ILight follow.
-Return<Status> Light::setLight(Type type, const LightState& state)  {
+Return<Status> Light::setLight(Type type, const OldLightState& state) {
     // Forward types for new methods.
 
-    ExtLightState extState {
-        .state = state,
-        .interpolationOmega =
-            static_cast<int32_t>(Default::INTERPOLATION_OMEGA),
-        .brightness = // ExtBrightness inherits from Brightness
-            static_cast<ExtBrightness>(state.brightnessMode)
-    };
+    LightState extState{.state = state,
+                        .interpolationOmega = static_cast<int32_t>(Default::INTERPOLATION_OMEGA),
+                        .brightness =  // Brightness inherits from Brightness
+                        static_cast<Brightness>(state.brightnessMode)};
 
-    return setExtLight(type, extState);
+    return setLightExt(type, extState);
 }
 
 Return<void> Light::getSupportedTypes(getSupportedTypes_cb _hidl_cb)  {
@@ -52,9 +49,7 @@
 }
 
 // Methods from ::android::hardware::example::extension::light::V2_0::ILight follow.
-Return<Status> Light::setExtLight(Type /* type */,
-                                  const ExtLightState& /* state */)  {
-
+Return<Status> Light::setLightExt(Type /* type */, const LightState& /* state */) {
     // ******************************************************
     // Note: awesome proprietary hardware implementation here
     // ******************************************************
diff --git a/tests/extension/light/2.0/default/Light.h b/tests/extension/light/2.0/default/Light.h
index dc2c5dd..d178e75 100644
--- a/tests/extension/light/2.0/default/Light.h
+++ b/tests/extension/light/2.0/default/Light.h
@@ -16,7 +16,7 @@
 #ifndef ANDROID_HARDWARE_TESTS_EXTENSION_LIGHT_V2_0_LIGHT_H
 #define ANDROID_HARDWARE_TESTS_EXTENSION_LIGHT_V2_0_LIGHT_H
 
-#include <android/hardware/tests/extension/light/2.0/IExtLight.h>
+#include <android/hardware/tests/extension/light/2.0/ILight.h>
 #include <hidl/Status.h>
 
 #include <hidl/MQDescriptor.h>
@@ -28,26 +28,25 @@
 namespace V2_0 {
 namespace implementation {
 
-using ::android::hardware::tests::extension::light::V2_0::ExtLightState;
-using ::android::hardware::tests::extension::light::V2_0::IExtLight;
-using ::android::hardware::light::V2_0::ILight;
-using ::android::hardware::light::V2_0::LightState;
+using ::android::hardware::tests::extension::light::V2_0::LightState;
+using ::android::hardware::tests::extension::light::V2_0::ILight;
+// If using a minor version upgrade, we could just reference these as
+// V2_0::LightState vs. V2_1::LightState, but this makes things easier.
+using OldLightState = ::android::hardware::light::V2_0::LightState;
 using ::android::hardware::light::V2_0::Status;
 using ::android::hardware::light::V2_0::Type;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
 using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
 using ::android::sp;
 
-struct Light : public IExtLight {
+struct Light : public ILight {
     // Methods from ::android::hardware::light::V2_0::ILight follow.
-    Return<Status> setLight(Type type, const LightState& state)  override;
+    Return<Status> setLight(Type type, const OldLightState& state) override;
     Return<void> getSupportedTypes(getSupportedTypes_cb _hidl_cb)  override;
 
     // Methods from ::android::hardware::example::extension::light::V2_0::ILight follow.
-    Return<Status> setExtLight(Type type, const ExtLightState& state)  override;
-
+    Return<Status> setLightExt(Type type, const LightState& state) override;
 };
 
 }  // namespace implementation
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/extension/light/2.0/types.hal b/tests/extension/light/2.0/types.hal
index 1b09479..c05e099 100644
--- a/tests/extension/light/2.0/types.hal
+++ b/tests/extension/light/2.0/types.hal
@@ -16,7 +16,11 @@
 
 package android.hardware.tests.extension.light@2.0;
 
-import android.hardware.light@2.0;
+// If importing something from the same package, the preference is:
+// import @2.0::Foo. However, since this isn't a minor version upgrade
+// we have to use the fully-qualified names here.
+import android.hardware.light@2.0::Brightness;
+import android.hardware.light@2.0::LightState;
 
 enum Default : int32_t {
     // for calls to setLight from the framework that don't know about this
@@ -28,7 +32,7 @@
  * One possibility is renaming an old type. Another possibility is taking
  * advantages of the different namespaces.
  */
-enum ExtBrightness : Brightness {
+enum Brightness : android.hardware.light@2.0::Brightness {
     /**
      * Say we're really going to use the phone as a heater.
      */
@@ -43,10 +47,10 @@
 /**
  * Structs can't inherit eachother in hidl. Use composition instead. In this
  * case, I won't use inheritence because I want to replace Brightness with
- * ExtBrightness.
+ * the new enumeration.
  */
-struct ExtLightState {
-    LightState state;
+struct LightState {
+    android.hardware.light@2.0::LightState state;
 
     /**
      * This is the secret sauce that will really make this extension shine.
@@ -64,5 +68,5 @@
     /**
      * Include new values.
      */
-    ExtBrightness brightness;
+    Brightness brightness;
 };
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/tetheroffload/config/1.0/vts/functional/VtsHalTetheroffloadConfigV1_0TargetTest.cpp b/tetheroffload/config/1.0/vts/functional/VtsHalTetheroffloadConfigV1_0TargetTest.cpp
index 2cbe479..bf211f0 100644
--- a/tetheroffload/config/1.0/vts/functional/VtsHalTetheroffloadConfigV1_0TargetTest.cpp
+++ b/tetheroffload/config/1.0/vts/functional/VtsHalTetheroffloadConfigV1_0TargetTest.cpp
@@ -43,8 +43,8 @@
 #define ASSERT_FALSE_CALLBACK \
     [&](bool success, const hidl_string& errMsg) { ASSERT_FALSE(success) << errMsg.c_str(); }
 
-const unsigned kFd1Groups = NFNLGRP_CONNTRACK_NEW | NFNLGRP_CONNTRACK_DESTROY;
-const unsigned kFd2Groups = NFNLGRP_CONNTRACK_UPDATE | NFNLGRP_CONNTRACK_DESTROY;
+const unsigned kFd1Groups = NF_NETLINK_CONNTRACK_NEW | NF_NETLINK_CONNTRACK_DESTROY;
+const unsigned kFd2Groups = NF_NETLINK_CONNTRACK_UPDATE | NF_NETLINK_CONNTRACK_DESTROY;
 
 inline const sockaddr* asSockaddr(const sockaddr_nl* nladdr) {
     return reinterpret_cast<const sockaddr*>(nladdr);
diff --git a/tetheroffload/control/1.0/vts/functional/VtsHalTetheroffloadControlV1_0TargetTest.cpp b/tetheroffload/control/1.0/vts/functional/VtsHalTetheroffloadControlV1_0TargetTest.cpp
index 52dd026..d572728 100644
--- a/tetheroffload/control/1.0/vts/functional/VtsHalTetheroffloadControlV1_0TargetTest.cpp
+++ b/tetheroffload/control/1.0/vts/functional/VtsHalTetheroffloadControlV1_0TargetTest.cpp
@@ -131,7 +131,7 @@
         config = testing::VtsHalHidlTargetTestBase::getService<IOffloadConfig>();
         ASSERT_NE(nullptr, config.get()) << "Could not get HIDL instance";
 
-        unique_fd fd1(conntrackSocket(NFNLGRP_CONNTRACK_NEW | NFNLGRP_CONNTRACK_DESTROY));
+        unique_fd fd1(conntrackSocket(NF_NETLINK_CONNTRACK_NEW | NF_NETLINK_CONNTRACK_DESTROY));
         if (fd1.get() < 0) {
             ALOGE("Unable to create conntrack handles: %d/%s", errno, strerror(errno));
             FAIL();
@@ -141,7 +141,7 @@
         hidl_handle h1;
         h1.setTo(nativeHandle1, true);
 
-        unique_fd fd2(conntrackSocket(NFNLGRP_CONNTRACK_UPDATE | NFNLGRP_CONNTRACK_DESTROY));
+        unique_fd fd2(conntrackSocket(NF_NETLINK_CONNTRACK_UPDATE | NF_NETLINK_CONNTRACK_DESTROY));
         if (fd2.get() < 0) {
             ALOGE("Unable to create conntrack handles: %d/%s", errno, strerror(errno));
             FAIL();
@@ -231,7 +231,6 @@
     initOffload(false);
     initOffload(false);
     initOffload(false);
-    stopOffload(ExpectBoolean::True);  // balance out initOffload(true)
 }
 
 // Check that calling stopOffload() without first having called initOffload() returns false.
@@ -244,6 +243,14 @@
 // Check that calling stopOffload() after a complete init/stop cycle returns false.
 TEST_F(OffloadControlHidlTestBase, AdditionalStopsWithInitReturnFalse) {
     initOffload(true);
+    // Call setUpstreamParameters() so that "offload" can be reasonably said
+    // to be both requested and operational.
+    const hidl_string v4Addr("192.0.0.2");
+    const hidl_string v4Gw("192.0.0.1");
+    const vector<hidl_string> v6Gws{hidl_string("fe80::db8:1"), hidl_string("fe80::db8:2")};
+    const Return<void> upstream =
+        control->setUpstreamParameters("rmnet_data0", v4Addr, v4Gw, v6Gws, ASSERT_TRUE_CALLBACK);
+    EXPECT_TRUE(upstream.isOk());
     stopOffload(ExpectBoolean::True);  // balance out initOffload(true)
     stopOffload(ExpectBoolean::False);
     stopOffload(ExpectBoolean::False);
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",