Merge "Fix Keymaster VTS for OpenSSL error code change"
diff --git a/health/2.0/vts/OWNERS b/health/2.0/vts/OWNERS
index 885f6a8..4024ec0 100644
--- a/health/2.0/vts/OWNERS
+++ b/health/2.0/vts/OWNERS
@@ -3,4 +3,3 @@
 
 # VTS team
 yim@google.com
-ryanjcampbell@google.com
diff --git a/keymaster/3.0/vts/OWNERS b/keymaster/3.0/vts/OWNERS
index d53aadd..376c12b 100644
--- a/keymaster/3.0/vts/OWNERS
+++ b/keymaster/3.0/vts/OWNERS
@@ -1,4 +1,4 @@
 jdanis@google.com
 swillden@google.com
 yim@google.com
-ryanjcampbell@google.com
+yuexima@google.com
diff --git a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp
index c6eecd6..0636cf9 100644
--- a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp
+++ b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp
@@ -18,7 +18,8 @@
 
 // The main test class for RENDERSCRIPT HIDL HAL.
 void RenderscriptHidlTest::SetUp() {
-    device = ::testing::VtsHalHidlTargetTestBase::getService<IDevice>();
+    device = ::testing::VtsHalHidlTargetTestBase::getService<IDevice>(
+        RenderscriptHidlEnvironment::Instance()->getServiceName<IDevice>());
     ASSERT_NE(nullptr, device.get());
 
     uint32_t version = 0;
@@ -34,17 +35,10 @@
     }
 }
 
-// A class for test environment setup (kept since this file is a template).
-class RenderscriptHidlEnvironment : public ::testing::Environment {
-public:
-    virtual void SetUp() {}
-    virtual void TearDown() {}
-};
-
-
 int main(int argc, char** argv) {
-    ::testing::AddGlobalTestEnvironment(new RenderscriptHidlEnvironment);
+    ::testing::AddGlobalTestEnvironment(RenderscriptHidlEnvironment::Instance());
     ::testing::InitGoogleTest(&argc, argv);
+    RenderscriptHidlEnvironment::Instance()->init(&argc, argv);
     int status = RUN_ALL_TESTS();
     LOG(INFO) << "Test result = " << status;
     return status;
diff --git a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.h b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.h
index 527fef0..e11ab92 100644
--- a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.h
+++ b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.h
@@ -25,6 +25,7 @@
 #include <android/hardware/renderscript/1.0/types.h>
 
 #include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
 #include <gtest/gtest.h>
 
 using ::android::hardware::renderscript::V1_0::Allocation;
@@ -99,4 +100,16 @@
     sp<IDevice>    device;
 };
 
+// Test environment for RENDERSCRIPT HIDL HAL.
+class RenderscriptHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+   public:
+    // get the test environment singleton
+    static RenderscriptHidlEnvironment* Instance() {
+        static RenderscriptHidlEnvironment* instance = new RenderscriptHidlEnvironment;
+        return instance;
+    }
+
+    virtual void registerTestServices() override { registerTestService<IDevice>(); }
+};
+
 #endif // VTS_HAL_RENDERSCRIPT_V1_0_TARGET_TESTS_H
diff --git a/usb/1.0/vts/functional/VtsHalUsbV1_0TargetTest.cpp b/usb/1.0/vts/functional/VtsHalUsbV1_0TargetTest.cpp
index b77398f..e01b974 100644
--- a/usb/1.0/vts/functional/VtsHalUsbV1_0TargetTest.cpp
+++ b/usb/1.0/vts/functional/VtsHalUsbV1_0TargetTest.cpp
@@ -160,7 +160,7 @@
   // and the callback thread.
   std::mutex usb_mtx;
   std::condition_variable usb_cv;
-  int usb_count;
+  int usb_count = 0;
 };
 
 /*
diff --git a/wifi/1.0/vts/functional/wifi_sta_iface_hidl_test.cpp b/wifi/1.0/vts/functional/wifi_sta_iface_hidl_test.cpp
index 30235cf..a341028 100644
--- a/wifi/1.0/vts/functional/wifi_sta_iface_hidl_test.cpp
+++ b/wifi/1.0/vts/functional/wifi_sta_iface_hidl_test.cpp
@@ -234,6 +234,11 @@
  * status code.
  */
 TEST_F(WifiStaIfaceHidlTest, EnableNDOffload) {
+   if (!isCapabilitySupported(
+           IWifiStaIface::StaIfaceCapabilityMask::ND_OFFLOAD)) {
+        // No-op if nd offload is not supported.
+        return;
+    }
     EXPECT_EQ(WifiStatusCode::SUCCESS,
               HIDL_INVOKE(wifi_sta_iface_, enableNdOffload, true).code);
 }
@@ -256,6 +261,11 @@
  * packets will return a success status code.
  */
 TEST_F(WifiStaIfaceHidlTest, PacketFateMonitoring) {
+   if (!isCapabilitySupported(
+           IWifiStaIface::StaIfaceCapabilityMask::DEBUG_PACKET_FATE)) {
+        // No-op if packet fate monitor is not supported.
+        return;
+    }
     // Start packet fate monitoring.
     EXPECT_EQ(
         WifiStatusCode::SUCCESS,