diff --git a/bluetooth/1.0/default/vendor_interface.cc b/bluetooth/1.0/default/vendor_interface.cc
index 26f52f7..e6575b0 100644
--- a/bluetooth/1.0/default/vendor_interface.cc
+++ b/bluetooth/1.0/default/vendor_interface.cc
@@ -248,10 +248,9 @@
         new hci::MctProtocol(fd_list, intercept_events, acl_cb);
     fd_watcher_.WatchFdForNonBlockingReads(
         fd_list[CH_EVT], [mct_hci](int fd) { mct_hci->OnEventDataReady(fd); });
-    if (fd_count >= CH_ACL_IN)
-      fd_watcher_.WatchFdForNonBlockingReads(
-          fd_list[CH_ACL_IN],
-          [mct_hci](int fd) { mct_hci->OnAclDataReady(fd); });
+    fd_watcher_.WatchFdForNonBlockingReads(
+        fd_list[CH_ACL_IN],
+        [mct_hci](int fd) { mct_hci->OnAclDataReady(fd); });
     hci_ = mct_hci;
   }
 
diff --git a/graphics/Android.bp b/graphics/Android.bp
index eaa47ae..f4f7db4 100644
--- a/graphics/Android.bp
+++ b/graphics/Android.bp
@@ -3,6 +3,7 @@
     "allocator/2.0",
     "allocator/2.0/default",
     "allocator/2.0/vts/functional",
+    "bufferqueue/1.0",
     "common/1.0",
     "composer/2.1",
     "composer/2.1/default",
diff --git a/graphics/bufferqueue/1.0/Android.bp b/graphics/bufferqueue/1.0/Android.bp
new file mode 100644
index 0000000..4ba764f
--- /dev/null
+++ b/graphics/bufferqueue/1.0/Android.bp
@@ -0,0 +1,70 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+filegroup {
+    name: "android.hardware.graphics.bufferqueue@1.0_hal",
+    srcs: [
+        "IGraphicBufferProducer.hal",
+        "IProducerListener.hal",
+    ],
+}
+
+genrule {
+    name: "android.hardware.graphics.bufferqueue@1.0_genc++",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.graphics.bufferqueue@1.0",
+    srcs: [
+        ":android.hardware.graphics.bufferqueue@1.0_hal",
+    ],
+    out: [
+        "android/hardware/graphics/bufferqueue/1.0/GraphicBufferProducerAll.cpp",
+        "android/hardware/graphics/bufferqueue/1.0/ProducerListenerAll.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.graphics.bufferqueue@1.0_genc++_headers",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.graphics.bufferqueue@1.0",
+    srcs: [
+        ":android.hardware.graphics.bufferqueue@1.0_hal",
+    ],
+    out: [
+        "android/hardware/graphics/bufferqueue/1.0/IGraphicBufferProducer.h",
+        "android/hardware/graphics/bufferqueue/1.0/IHwGraphicBufferProducer.h",
+        "android/hardware/graphics/bufferqueue/1.0/BnHwGraphicBufferProducer.h",
+        "android/hardware/graphics/bufferqueue/1.0/BpHwGraphicBufferProducer.h",
+        "android/hardware/graphics/bufferqueue/1.0/BsGraphicBufferProducer.h",
+        "android/hardware/graphics/bufferqueue/1.0/IProducerListener.h",
+        "android/hardware/graphics/bufferqueue/1.0/IHwProducerListener.h",
+        "android/hardware/graphics/bufferqueue/1.0/BnHwProducerListener.h",
+        "android/hardware/graphics/bufferqueue/1.0/BpHwProducerListener.h",
+        "android/hardware/graphics/bufferqueue/1.0/BsProducerListener.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.graphics.bufferqueue@1.0",
+    generated_sources: ["android.hardware.graphics.bufferqueue@1.0_genc++"],
+    generated_headers: ["android.hardware.graphics.bufferqueue@1.0_genc++_headers"],
+    export_generated_headers: ["android.hardware.graphics.bufferqueue@1.0_genc++_headers"],
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+        "libcutils",
+        "android.hardware.graphics.common@1.0",
+        "android.hardware.media@1.0",
+        "android.hidl.base@1.0",
+    ],
+    export_shared_lib_headers: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libutils",
+        "android.hardware.graphics.common@1.0",
+        "android.hardware.media@1.0",
+        "android.hidl.base@1.0",
+    ],
+}
diff --git a/media/omx/1.0/IOmxBufferProducer.hal b/graphics/bufferqueue/1.0/IGraphicBufferProducer.hal
similarity index 95%
rename from media/omx/1.0/IOmxBufferProducer.hal
rename to graphics/bufferqueue/1.0/IGraphicBufferProducer.hal
index 7e2172b..c59a16c 100644
--- a/media/omx/1.0/IOmxBufferProducer.hal
+++ b/graphics/bufferqueue/1.0/IGraphicBufferProducer.hal
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 The Android Open Source Project
+ * 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.
@@ -14,20 +14,29 @@
  * limitations under the License.
  */
 
-package android.hardware.media.omx@1.0;
+package android.hardware.graphics.bufferqueue@1.0;
+
+import android.hardware.media@1.0::Fence;
+import android.hardware.media@1.0::AnwBuffer;
+import android.hardware.media@1.0::Rect;
+import android.hardware.media@1.0::Region;
 
 import android.hardware.graphics.common@1.0::Dataspace;
 import android.hardware.graphics.common@1.0::PixelFormat;
 
-import android.hardware.media@1.0::types;
-import IOmxProducerListener;
+import IProducerListener;
 
 /**
  * Ref: frameworks/native/include/gui/IGraphicBufferProducer.h:
  *      IGraphicBufferProducer
  * This is a wrapper/wrapped HAL interface for the actual binder interface.
  */
-interface IOmxBufferProducer {
+interface IGraphicBufferProducer {
+
+    /**
+     * Type for return values of functions in IGraphicBufferProducer.
+     */
+    typedef int32_t Status;
 
     /**
      * Ref: frameworks/native/include/ui/FenceTime.h: FenceTime::Snapshot
@@ -142,7 +151,7 @@
 
     /**
      * requestBuffer requests a new buffer for the given index. The server (i.e.
-     * the IOmxBufferProducer implementation) assigns the newly created
+     * the IProducerListener implementation) assigns the newly created
      * buffer to the given slot index, and the client is expected to mirror the
      * slot->buffer mapping so that it's not necessary to transfer an
      * AnwBuffer for every dequeue operation.
@@ -466,12 +475,12 @@
         );
 
     /**
-     * connect attempts to connect a client API to the IOmxBufferProducer.
-     * This must be called before any other IOmxBufferProducer methods are
+     * connect attempts to connect a client API to the IGraphicBufferProducer.
+     * This must be called before any other IGraphicBufferProducer methods are
      * called except for getAllocator. A consumer must be already connected.
      *
      * This method will fail if the connect was previously called on the
-     * IOmxBufferProducer and no corresponding disconnect call was made.
+     * IGraphicBufferProducer and no corresponding disconnect call was made.
      *
      * The listener is an optional binder callback object that can be used if
      * the producer wants to be notified when the consumer releases a buffer
@@ -506,7 +515,7 @@
      * should be treated as opaque fatal unrecoverable errors.
      */
     connect(
-            IOmxProducerListener listener,
+            IProducerListener listener,
             int32_t api,
             bool producerControlledByApp
         ) generates (
@@ -516,8 +525,8 @@
 
     /**
      * disconnect attempts to disconnect a client API from the
-     * IOmxBufferProducer.  Calling this method will cause any subsequent
-     * calls to other IOmxBufferProducer methods to fail except for
+     * IGraphicBufferProducer.  Calling this method will cause any subsequent
+     * calls to other IGraphicBufferProducer methods to fail except for
      * getAllocator and connect.  Successfully calling connect after this will
      * allow the other methods to succeed again.
      *
@@ -526,7 +535,7 @@
      * Alternatively if mode is AllLocal, then the API value is ignored, and any API
      * connected from the same PID calling disconnect will be disconnected.
      *
-     * Disconnecting from an abandoned IOmxBufferProducer is legal and
+     * Disconnecting from an abandoned IGraphicBufferProducer is legal and
      * is considered a no-op.
      *
      * Return of a value other than NO_ERROR means an error has occurred:
@@ -543,7 +552,7 @@
         );
 
     /**
-     * Attaches a sideband buffer stream to the IOmxBufferProducer.
+     * Attaches a sideband buffer stream to the IGraphicBufferProducer.
      *
      * A sideband stream is a device-specific mechanism for passing buffers
      * from the producer to the consumer without using dequeueBuffer/
diff --git a/media/omx/1.0/IOmxProducerListener.hal b/graphics/bufferqueue/1.0/IProducerListener.hal
similarity index 91%
rename from media/omx/1.0/IOmxProducerListener.hal
rename to graphics/bufferqueue/1.0/IProducerListener.hal
index 7fde93b..206a500 100644
--- a/media/omx/1.0/IOmxProducerListener.hal
+++ b/graphics/bufferqueue/1.0/IProducerListener.hal
@@ -14,13 +14,13 @@
  * limitations under the License.
  */
 
-package android.hardware.media.omx@1.0;
+package android.hardware.graphics.bufferqueue@1.0;
 
 /**
  * Ref: frameworks/native/include/gui/IProducerListener.h: IProducerListener
  * This is a wrapper/wrapped HAL interface for the actual binder interface.
  */
-interface IOmxProducerListener {
+interface IProducerListener {
     oneway onBufferReleased();
     needsReleaseNotify() generates (bool result);
 };
diff --git a/media/omx/1.0/Android.bp b/media/omx/1.0/Android.bp
index 85d15ae..81dd617 100644
--- a/media/omx/1.0/Android.bp
+++ b/media/omx/1.0/Android.bp
@@ -6,11 +6,9 @@
         "types.hal",
         "IGraphicBufferSource.hal",
         "IOmx.hal",
-        "IOmxBufferProducer.hal",
         "IOmxBufferSource.hal",
         "IOmxNode.hal",
         "IOmxObserver.hal",
-        "IOmxProducerListener.hal",
     ],
 }
 
@@ -25,11 +23,9 @@
         "android/hardware/media/omx/1.0/types.cpp",
         "android/hardware/media/omx/1.0/GraphicBufferSourceAll.cpp",
         "android/hardware/media/omx/1.0/OmxAll.cpp",
-        "android/hardware/media/omx/1.0/OmxBufferProducerAll.cpp",
         "android/hardware/media/omx/1.0/OmxBufferSourceAll.cpp",
         "android/hardware/media/omx/1.0/OmxNodeAll.cpp",
         "android/hardware/media/omx/1.0/OmxObserverAll.cpp",
-        "android/hardware/media/omx/1.0/OmxProducerListenerAll.cpp",
     ],
 }
 
@@ -52,11 +48,6 @@
         "android/hardware/media/omx/1.0/BnHwOmx.h",
         "android/hardware/media/omx/1.0/BpHwOmx.h",
         "android/hardware/media/omx/1.0/BsOmx.h",
-        "android/hardware/media/omx/1.0/IOmxBufferProducer.h",
-        "android/hardware/media/omx/1.0/IHwOmxBufferProducer.h",
-        "android/hardware/media/omx/1.0/BnHwOmxBufferProducer.h",
-        "android/hardware/media/omx/1.0/BpHwOmxBufferProducer.h",
-        "android/hardware/media/omx/1.0/BsOmxBufferProducer.h",
         "android/hardware/media/omx/1.0/IOmxBufferSource.h",
         "android/hardware/media/omx/1.0/IHwOmxBufferSource.h",
         "android/hardware/media/omx/1.0/BnHwOmxBufferSource.h",
@@ -72,11 +63,6 @@
         "android/hardware/media/omx/1.0/BnHwOmxObserver.h",
         "android/hardware/media/omx/1.0/BpHwOmxObserver.h",
         "android/hardware/media/omx/1.0/BsOmxObserver.h",
-        "android/hardware/media/omx/1.0/IOmxProducerListener.h",
-        "android/hardware/media/omx/1.0/IHwOmxProducerListener.h",
-        "android/hardware/media/omx/1.0/BnHwOmxProducerListener.h",
-        "android/hardware/media/omx/1.0/BpHwOmxProducerListener.h",
-        "android/hardware/media/omx/1.0/BsOmxProducerListener.h",
     ],
 }
 
@@ -92,6 +78,7 @@
         "liblog",
         "libutils",
         "libcutils",
+        "android.hardware.graphics.bufferqueue@1.0",
         "android.hardware.graphics.common@1.0",
         "android.hardware.media@1.0",
         "android.hidl.base@1.0",
@@ -101,6 +88,7 @@
         "libhidltransport",
         "libhwbinder",
         "libutils",
+        "android.hardware.graphics.bufferqueue@1.0",
         "android.hardware.graphics.common@1.0",
         "android.hardware.media@1.0",
         "android.hidl.base@1.0",
diff --git a/media/omx/1.0/IOmx.hal b/media/omx/1.0/IOmx.hal
index acb1aae..78d4b32 100644
--- a/media/omx/1.0/IOmx.hal
+++ b/media/omx/1.0/IOmx.hal
@@ -16,11 +16,11 @@
 
 package android.hardware.media.omx@1.0;
 
+import android.hardware.graphics.bufferqueue@1.0::IGraphicBufferProducer;
 import android.hardware.media@1.0::types;
 
 import IOmxNode;
 import IOmxObserver;
-import IOmxBufferProducer;
 import IGraphicBufferSource;
 
 /**
@@ -76,7 +76,7 @@
     createInputSurface(
         ) generates (
             Status status,
-            IOmxBufferProducer producer,
+            IGraphicBufferProducer producer,
             IGraphicBufferSource source
         );
 };
diff --git a/radio/1.0/IRadio.hal b/radio/1.0/IRadio.hal
index b3e3e98..0b1bf40 100644
--- a/radio/1.0/IRadio.hal
+++ b/radio/1.0/IRadio.hal
@@ -630,7 +630,6 @@
 
     /*
      * Scans for available networks
-     * This request must not respond until the new operator is selected and registered.
      *
      * @param serial Serial number of request.
      *
diff --git a/radio/1.0/IRadioResponse.hal b/radio/1.0/IRadioResponse.hal
index cd0899a..bf50792 100644
--- a/radio/1.0/IRadioResponse.hal
+++ b/radio/1.0/IRadioResponse.hal
@@ -787,10 +787,13 @@
      *
      * Valid errors returned:
      *   RadioError:NONE
-     *   RadioError:INVALID_ARGUMENTS
      *   RadioError:RADIO_NOT_AVAILABLE
      *   RadioError:OPERATION_NOT_ALLOWED
-     *   RadioError:GENERIC_FAILURE
+     *   RadioError:ABORTED
+     *   RadioError:DEVICE_IN_USE
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:MODEM_ERR
      */
     oneway getAvailableNetworksResponse(RadioResponseInfo info,
             vec<OperatorInfo> networkInfos);
diff --git a/radio/1.0/types.hal b/radio/1.0/types.hal
index 7c1d143..9b904a5 100644
--- a/radio/1.0/types.hal
+++ b/radio/1.0/types.hal
@@ -86,9 +86,11 @@
     SS_MODIFIED_TO_SS = 27,               // SS request modified to different SS request
     LCE_NOT_SUPPORTED = 36,               // LCE service not supported(36 in RILConstants.java)
     NO_MEMORY = 37,                       // Not sufficient memory to process the request
-    INTERNAL_ERR = 38,                    // Hit unexpected vendor internal error scenario
+    INTERNAL_ERR = 38,                    // Modem hit unexpected error scenario while handling
+                                          // this request
     SYSTEM_ERR = 39,                      // Hit platform or system error
-    MODEM_ERR = 40,                       // Hit unexpected modem error
+    MODEM_ERR = 40,                       // Vendor RIL got unexpected or incorrect response
+                                          // from modem for this request
     INVALID_STATE = 41,                   // Unexpected request for the current state
     NO_RESOURCES = 42,                    // Not sufficient resource to process the request
     SIM_ERR = 43,                         // Received error from SIM card
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test.cpp
index ab1b6a3..c6ac03c 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test.cpp
@@ -18,8 +18,33 @@
 
 #include <VtsHalHidlTargetTestBase.h>
 
+#include <android/hardware/wifi/supplicant/1.0/ISupplicant.h>
+
 #include "supplicant_hidl_test_utils.h"
 
+using ::android::sp;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::wifi::supplicant::V1_0::ISupplicant;
+using ::android::hardware::wifi::supplicant::V1_0::ISupplicantIface;
+using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
+using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
+using ::android::hardware::wifi::supplicant::V1_0::IfaceType;
+
+class SupplicantHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+   public:
+    virtual void SetUp() override {
+        startSupplicantAndWaitForHidlService();
+        supplicant_ = getSupplicant();
+        ASSERT_NE(supplicant_.get(), nullptr);
+    }
+
+    virtual void TearDown() override { stopSupplicant(); }
+
+   protected:
+    // ISupplicant object used for all tests in this fixture.
+    sp<ISupplicant> supplicant_;
+};
+
 /*
  * Create:
  * Ensures that an instance of the ISupplicant proxy object is
@@ -30,3 +55,131 @@
     EXPECT_NE(nullptr, getSupplicant().get());
     stopSupplicant();
 }
+
+/*
+ * ListInterfaces
+ */
+TEST_F(SupplicantHidlTest, ListInterfaces) {
+    std::vector<ISupplicant::IfaceInfo> ifaces;
+    supplicant_->listInterfaces(
+        [&](const SupplicantStatus& status,
+            const hidl_vec<ISupplicant::IfaceInfo>& hidl_ifaces) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+            ifaces = hidl_ifaces;
+        });
+
+    EXPECT_NE(ifaces.end(),
+              std::find_if(ifaces.begin(), ifaces.end(), [](const auto& iface) {
+                  return iface.type == IfaceType::STA;
+              }));
+    EXPECT_NE(ifaces.end(),
+              std::find_if(ifaces.begin(), ifaces.end(), [](const auto& iface) {
+                  return iface.type == IfaceType::P2P;
+              }));
+}
+
+/*
+ * GetInterface
+ */
+TEST_F(SupplicantHidlTest, GetInterface) {
+    std::vector<ISupplicant::IfaceInfo> ifaces;
+    supplicant_->listInterfaces(
+        [&](const SupplicantStatus& status,
+            const hidl_vec<ISupplicant::IfaceInfo>& hidl_ifaces) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+            ifaces = hidl_ifaces;
+        });
+
+    ASSERT_NE(0u, ifaces.size());
+    supplicant_->getInterface(
+        ifaces[0],
+        [&](const SupplicantStatus& status, const sp<ISupplicantIface>& iface) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+            EXPECT_NE(nullptr, iface.get());
+        });
+}
+
+/*
+ * SetDebugParams
+ */
+TEST_F(SupplicantHidlTest, SetDebugParams) {
+    bool show_timestamp = true;
+    bool show_keys = true;
+    ISupplicant::DebugLevel level = ISupplicant::DebugLevel::EXCESSIVE;
+
+    supplicant_->setDebugParams(level,
+                                show_timestamp,  // show timestamps
+                                show_keys,       // show keys
+                                [](const SupplicantStatus& status) {
+                                    EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+                                              status.code);
+                                });
+}
+
+/*
+ * GetDebugLevel
+ */
+TEST_F(SupplicantHidlTest, GetDebugLevel) {
+    bool show_timestamp = true;
+    bool show_keys = true;
+    ISupplicant::DebugLevel level = ISupplicant::DebugLevel::EXCESSIVE;
+
+    supplicant_->setDebugParams(level,
+                                show_timestamp,  // show timestamps
+                                show_keys,       // show keys
+                                [](const SupplicantStatus& status) {
+                                    EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+                                              status.code);
+                                });
+    EXPECT_EQ(level, supplicant_->getDebugLevel());
+}
+
+/*
+ * IsDebugShowTimestampEnabled
+ */
+TEST_F(SupplicantHidlTest, IsDebugShowTimestampEnabled) {
+    bool show_timestamp = true;
+    bool show_keys = true;
+    ISupplicant::DebugLevel level = ISupplicant::DebugLevel::EXCESSIVE;
+
+    supplicant_->setDebugParams(level,
+                                show_timestamp,  // show timestamps
+                                show_keys,       // show keys
+                                [](const SupplicantStatus& status) {
+                                    EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+                                              status.code);
+                                });
+    EXPECT_EQ(show_timestamp, supplicant_->isDebugShowTimestampEnabled());
+}
+
+/*
+ * IsDebugShowKeysEnabled
+ */
+TEST_F(SupplicantHidlTest, IsDebugShowKeysEnabled) {
+    bool show_timestamp = true;
+    bool show_keys = true;
+    ISupplicant::DebugLevel level = ISupplicant::DebugLevel::EXCESSIVE;
+
+    supplicant_->setDebugParams(level,
+                                show_timestamp,  // show timestamps
+                                show_keys,       // show keys
+                                [](const SupplicantStatus& status) {
+                                    EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+                                              status.code);
+                                });
+    EXPECT_EQ(show_keys, supplicant_->isDebugShowKeysEnabled());
+}
+
+/*
+ * SetConcurrenyPriority
+ */
+TEST_F(SupplicantHidlTest, SetConcurrencyPriority) {
+    supplicant_->setConcurrencyPriority(
+        IfaceType::STA, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    supplicant_->setConcurrencyPriority(
+        IfaceType::P2P, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+}
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
index fdee0c6..1fcfc8c 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
@@ -17,9 +17,9 @@
 #include <android-base/logging.h>
 #include <VtsHalHidlTargetTestBase.h>
 
-#include <hidl/HidlTransportSupport.h>
 #include <android/hidl/manager/1.0/IServiceManager.h>
 #include <android/hidl/manager/1.0/IServiceNotification.h>
+#include <hidl/HidlTransportSupport.h>
 
 #include <wifi_hal/driver_tool.h>
 #include <wifi_system/interface_tool.h>
@@ -174,7 +174,7 @@
 }
 
 sp<ISupplicant> getSupplicant() {
-    return getService<ISupplicant>(kSupplicantServiceName);
+    return ::testing::VtsHalHidlTargetTestBase::getService<ISupplicant>();
 }
 
 sp<ISupplicantStaIface> getSupplicantStaIface() {
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_p2p_iface_hidl_test.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_p2p_iface_hidl_test.cpp
index 332b57b..c6cf01f 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_p2p_iface_hidl_test.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_p2p_iface_hidl_test.cpp
@@ -18,8 +18,144 @@
 
 #include <VtsHalHidlTargetTestBase.h>
 
+#include <android/hardware/wifi/supplicant/1.0/ISupplicantP2pIface.h>
+
 #include "supplicant_hidl_test_utils.h"
 
+using ::android::sp;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::wifi::supplicant::V1_0::ISupplicantP2pIface;
+using ::android::hardware::wifi::supplicant::V1_0::ISupplicantP2pIfaceCallback;
+using ::android::hardware::wifi::supplicant::V1_0::SupplicantNetworkId;
+using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
+using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
+
+namespace {
+constexpr uint8_t kTestSsidPostfix[] = {'t', 'e', 's', 't'};
+constexpr uint8_t kTestMacAddr[] = {0x56, 0x67, 0x67, 0xf4, 0x56, 0x92};
+constexpr uint8_t kTestPeerMacAddr[] = {0x56, 0x67, 0x55, 0xf4, 0x56, 0x92};
+constexpr char kTestConnectPin[] = "34556665";
+constexpr char kTestGroupIfName[] = "TestGroup";
+constexpr uint32_t kTestConnectGoIntent = 6;
+constexpr uint32_t kTestFindTimeout = 5;
+constexpr SupplicantNetworkId kTestNetworkId = 5;
+constexpr uint32_t kTestChannel = 1;
+constexpr uint32_t kTestOperatingClass = 81;
+constexpr uint32_t kTestFreqRange[] = {2412, 2432};
+constexpr uint32_t kTestExtListenPeriod = 400;
+constexpr uint32_t kTestExtListenInterval = 400;
+}  // namespace
+
+class SupplicantP2pIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+   public:
+    virtual void SetUp() override {
+        startSupplicantAndWaitForHidlService();
+        EXPECT_TRUE(turnOnExcessiveLogging());
+        p2p_iface_ = getSupplicantP2pIface();
+        ASSERT_NE(p2p_iface_.get(), nullptr);
+
+        memcpy(mac_addr_.data(), kTestMacAddr, mac_addr_.size());
+        memcpy(peer_mac_addr_.data(), kTestPeerMacAddr, peer_mac_addr_.size());
+    }
+
+    virtual void TearDown() override { stopSupplicant(); }
+
+   protected:
+    // ISupplicantP2pIface object used for all tests in this fixture.
+    sp<ISupplicantP2pIface> p2p_iface_;
+    // MAC address to use for various tests.
+    std::array<uint8_t, 6> mac_addr_;
+    std::array<uint8_t, 6> peer_mac_addr_;
+};
+
+class IfaceCallback : public ISupplicantP2pIfaceCallback {
+    Return<void> onNetworkAdded(uint32_t /* id */) override { return Void(); }
+    Return<void> onNetworkRemoved(uint32_t /* id */) override { return Void(); }
+    Return<void> onDeviceFound(
+        const hidl_array<uint8_t, 6>& /* srcAddress */,
+        const hidl_array<uint8_t, 6>& /* p2pDeviceAddress */,
+        const hidl_array<uint8_t, 8>& /* primaryDeviceType */,
+        const hidl_string& /* deviceName */, uint16_t /* configMethods */,
+        uint8_t /* deviceCapabilities */, uint32_t /* groupCapabilities */,
+        const hidl_array<uint8_t, 8>& /* wfdDeviceInfo */) override {
+        return Void();
+    }
+    Return<void> onDeviceLost(
+        const hidl_array<uint8_t, 6>& /* p2pDeviceAddress */) override {
+        return Void();
+    }
+    Return<void> onFindStopped() override { return Void(); }
+    Return<void> onGoNegotiationRequest(
+        const hidl_array<uint8_t, 6>& /* srcAddress */,
+        ISupplicantP2pIfaceCallback::WpsDevPasswordId /* passwordId */)
+        override {
+        return Void();
+    }
+    Return<void> onGoNegotiationCompleted(
+        ISupplicantP2pIfaceCallback::P2pStatusCode /* status */) override {
+        return Void();
+    }
+    Return<void> onGroupFormationSuccess() override { return Void(); }
+    Return<void> onGroupFormationFailure(
+        const hidl_string& /* failureReason */) override {
+        return Void();
+    }
+    Return<void> onGroupStarted(
+        const hidl_string& /* groupIfname */, bool /* isGo */,
+        const hidl_vec<uint8_t>& /* ssid */, uint32_t /* frequency */,
+        const hidl_array<uint8_t, 32>& /* psk */,
+        const hidl_string& /* passphrase */,
+        const hidl_array<uint8_t, 6>& /* goDeviceAddress */,
+        bool /* isPersistent */) override {
+        return Void();
+    }
+    Return<void> onGroupRemoved(const hidl_string& /* groupIfname */,
+                                bool /* isGo */) override {
+        return Void();
+    }
+    Return<void> onInvitationReceived(
+        const hidl_array<uint8_t, 6>& /* srcAddress */,
+        const hidl_array<uint8_t, 6>& /* goDeviceAddress */,
+        const hidl_array<uint8_t, 6>& /* bssid */,
+        uint32_t /* persistentNetworkId */,
+        uint32_t /* operatingFrequency */) override {
+        return Void();
+    }
+    Return<void> onInvitationResult(
+        const hidl_array<uint8_t, 6>& /* bssid */,
+        ISupplicantP2pIfaceCallback::P2pStatusCode /* status */) override {
+        return Void();
+    }
+    Return<void> onProvisionDiscoveryCompleted(
+        const hidl_array<uint8_t, 6>& /* p2pDeviceAddress */,
+        bool /* isRequest */,
+        ISupplicantP2pIfaceCallback::P2pProvDiscStatusCode /* status */,
+        uint16_t /* configMethods */,
+        const hidl_string& /* generatedPin */) override {
+        return Void();
+    }
+    Return<void> onServiceDiscoveryResponse(
+        const hidl_array<uint8_t, 6>& /* srcAddress */,
+        uint16_t /* updateIndicator */,
+        const hidl_vec<uint8_t>& /* tlvs */) override {
+        return Void();
+    }
+    Return<void> onStaAuthorized(
+        const hidl_array<uint8_t, 6>& /* srcAddress */,
+        const hidl_array<uint8_t, 6>& /* p2pDeviceAddress */) override {
+        return Void();
+    }
+    Return<void> onStaDeauthorized(
+        const hidl_array<uint8_t, 6>& /* srcAddress */,
+        const hidl_array<uint8_t, 6>& /* p2pDeviceAddress */) override {
+        return Void();
+    }
+};
+
 /*
  * Create:
  * Ensures that an instance of the ISupplicantP2pIface proxy object is
@@ -30,3 +166,248 @@
     EXPECT_NE(nullptr, getSupplicantP2pIface().get());
     stopSupplicant();
 }
+
+/*
+ * RegisterCallback
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, RegisterCallback) {
+    p2p_iface_->registerCallback(
+        new IfaceCallback(), [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+}
+
+/*
+ * GetDeviceAddress
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, GetDeviceAddress) {
+    p2p_iface_->getDeviceAddress(
+        [](const SupplicantStatus& status,
+           const hidl_array<uint8_t, 6>& /* mac_addr */) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+}
+
+/*
+ * SetSsidPostfix
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, SetSsidPostfix) {
+    std::vector<uint8_t> ssid(kTestSsidPostfix,
+                              kTestSsidPostfix + sizeof(kTestSsidPostfix));
+    p2p_iface_->setSsidPostfix(ssid, [](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+}
+
+/*
+ * Find
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, Find) {
+    p2p_iface_->find(kTestFindTimeout, [](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+}
+
+/*
+ * StopFind
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, StopFind) {
+    p2p_iface_->find(kTestFindTimeout, [](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+
+    p2p_iface_->stopFind([](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+
+    p2p_iface_->stopFind([](const SupplicantStatus& status) {
+        EXPECT_NE(SupplicantStatusCode::SUCCESS, status.code);
+    });
+}
+
+/*
+ * Flush
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, Flush) {
+    p2p_iface_->flush([](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+}
+
+/*
+ * Connect
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, Connect) {
+    p2p_iface_->connect(
+        mac_addr_, ISupplicantP2pIface::WpsProvisionMethod::PBC,
+        kTestConnectPin, false, false, kTestConnectGoIntent,
+        [](const SupplicantStatus& status, const hidl_string& /* pin */) {
+            // This is not going to work with fake values.
+            EXPECT_EQ(SupplicantStatusCode::FAILURE_UNKNOWN, status.code);
+        });
+}
+
+/*
+ * CancelConnect
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, CancelConnect) {
+    p2p_iface_->connect(
+        mac_addr_, ISupplicantP2pIface::WpsProvisionMethod::PBC,
+        kTestConnectPin, false, false, kTestConnectGoIntent,
+        [](const SupplicantStatus& status, const hidl_string& /* pin */) {
+            // This is not going to work with fake values.
+            EXPECT_EQ(SupplicantStatusCode::FAILURE_UNKNOWN, status.code);
+        });
+
+    p2p_iface_->cancelConnect([](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::FAILURE_UNKNOWN, status.code);
+    });
+}
+
+/*
+ * ProvisionDiscovery
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, ProvisionDiscovery) {
+    p2p_iface_->provisionDiscovery(
+        mac_addr_, ISupplicantP2pIface::WpsProvisionMethod::PBC,
+        [](const SupplicantStatus& status) {
+            // This is not going to work with fake values.
+            EXPECT_EQ(SupplicantStatusCode::FAILURE_UNKNOWN, status.code);
+        });
+}
+
+/*
+ * AddGroup
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, AddGroup) {
+    p2p_iface_->addGroup(false, kTestNetworkId,
+                         [](const SupplicantStatus& /* status */) {
+                             // TODO: Figure out the initialization sequence for
+                             // this to work.
+                             // EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+                             // status.code);
+                         });
+}
+
+/*
+ * Reject
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, Reject) {
+    p2p_iface_->reject(mac_addr_, [](const SupplicantStatus& status) {
+        // This is not going to work with fake values.
+        EXPECT_EQ(SupplicantStatusCode::FAILURE_UNKNOWN, status.code);
+    });
+}
+
+/*
+ * Invite
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, Invite) {
+    p2p_iface_->invite(kTestGroupIfName, mac_addr_, peer_mac_addr_,
+                       [](const SupplicantStatus& status) {
+                           // This is not going to work with fake values.
+                           EXPECT_EQ(SupplicantStatusCode::FAILURE_UNKNOWN,
+                                     status.code);
+                       });
+}
+
+/*
+ * Reinvoke
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, Reinvoke) {
+    p2p_iface_->reinvoke(
+        kTestNetworkId, mac_addr_, [](const SupplicantStatus& status) {
+            // This is not going to work with fake values.
+            EXPECT_EQ(SupplicantStatusCode::FAILURE_NETWORK_UNKNOWN,
+                      status.code);
+        });
+}
+
+/*
+ * ConfigureExtListen
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, ConfigureExtListen) {
+    p2p_iface_->configureExtListen(kTestExtListenPeriod, kTestExtListenInterval,
+                                   [](const SupplicantStatus& status) {
+                                       EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+                                                 status.code);
+                                   });
+}
+
+/*
+ * SetListenChannel
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, SetListenChannel) {
+    p2p_iface_->setListenChannel(
+        kTestChannel, kTestOperatingClass, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+}
+
+/*
+ * SetDisallowedFrequencies
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, SetDisallowedFrequencies) {
+    std::vector<ISupplicantP2pIface::FreqRange> ranges = {
+        {kTestFreqRange[0], kTestFreqRange[1]}};
+    p2p_iface_->setDisallowedFrequencies(
+        ranges, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+}
+
+/*
+ * GetSsid
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, GetSsid) {
+    std::array<uint8_t, 6> mac_addr;
+    memcpy(mac_addr.data(), kTestMacAddr, mac_addr.size());
+    p2p_iface_->getSsid(mac_addr, [](const SupplicantStatus& status,
+                                     const hidl_vec<uint8_t>& /* ssid */) {
+        // This is not going to work with fake values.
+        EXPECT_EQ(SupplicantStatusCode::FAILURE_UNKNOWN, status.code);
+    });
+}
+
+/*
+ * GetGroupCapability
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, GetGroupCapability) {
+    std::array<uint8_t, 6> mac_addr;
+    memcpy(mac_addr.data(), kTestMacAddr, mac_addr.size());
+    p2p_iface_->getGroupCapability(
+        mac_addr, [](const SupplicantStatus& status, uint32_t /* caps */) {
+            // This is not going to work with fake values.
+            EXPECT_EQ(SupplicantStatusCode::FAILURE_UNKNOWN, status.code);
+        });
+}
+
+/*
+ * FlushServices
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, FlushServices) {
+    p2p_iface_->flushServices([](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+}
+
+/*
+ * SetMiracastMode
+ */
+TEST_F(SupplicantP2pIfaceHidlTest, SetMiracastMode) {
+    p2p_iface_->setMiracastMode(ISupplicantP2pIface::MiracastMode::DISABLED,
+                                [](const SupplicantStatus& status) {
+                                    EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+                                              status.code);
+                                });
+    p2p_iface_->setMiracastMode(ISupplicantP2pIface::MiracastMode::SOURCE,
+                                [](const SupplicantStatus& status) {
+                                    EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+                                              status.code);
+                                });
+    p2p_iface_->setMiracastMode(ISupplicantP2pIface::MiracastMode::SINK,
+                                [](const SupplicantStatus& status) {
+                                    EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+                                              status.code);
+                                });
+}
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp
index c50539b..c2a58b6 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp
@@ -18,8 +18,122 @@
 
 #include <VtsHalHidlTargetTestBase.h>
 
+#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaIface.h>
+
 #include "supplicant_hidl_test_utils.h"
 
+using ::android::sp;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaIface;
+using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaIfaceCallback;
+using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaNetwork;
+using ::android::hardware::wifi::supplicant::V1_0::SupplicantNetworkId;
+using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
+using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
+
+namespace {
+constexpr uint8_t kTestMacAddr[] = {0x56, 0x67, 0x67, 0xf4, 0x56, 0x92};
+constexpr ISupplicantStaIface::AnqpInfoId kTestAnqpInfoIds[] = {
+    ISupplicantStaIface::AnqpInfoId::VENUE_NAME,
+    ISupplicantStaIface::AnqpInfoId::NAI_REALM,
+    ISupplicantStaIface::AnqpInfoId::DOMAIN_NAME};
+constexpr ISupplicantStaIface::Hs20AnqpSubtypes kTestHs20Types[] = {
+    ISupplicantStaIface::Hs20AnqpSubtypes::WAN_METRICS,
+    ISupplicantStaIface::Hs20AnqpSubtypes::OPERATOR_FRIENDLY_NAME};
+constexpr char kTestHs20IconFile[] = "TestFile";
+constexpr int8_t kTestCountryCode[] = {'U', 'S'};
+}  // namespace
+
+class SupplicantStaIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+   public:
+    virtual void SetUp() override {
+        startSupplicantAndWaitForHidlService();
+        EXPECT_TRUE(turnOnExcessiveLogging());
+        sta_iface_ = getSupplicantStaIface();
+        ASSERT_NE(sta_iface_.get(), nullptr);
+
+        memcpy(mac_addr_.data(), kTestMacAddr, mac_addr_.size());
+    }
+
+    virtual void TearDown() override { stopSupplicant(); }
+
+   protected:
+    // ISupplicantStaIface object used for all tests in this fixture.
+    sp<ISupplicantStaIface> sta_iface_;
+    // MAC address to use for various tests.
+    std::array<uint8_t, 6> mac_addr_;
+};
+
+class IfaceCallback : public ISupplicantStaIfaceCallback {
+    Return<void> onNetworkAdded(uint32_t /* id */) override { return Void(); }
+    Return<void> onNetworkRemoved(uint32_t /* id */) override { return Void(); }
+    Return<void> onStateChanged(
+        ISupplicantStaIfaceCallback::State /* newState */,
+        const hidl_array<uint8_t, 6>& /*bssid */, uint32_t /* id */,
+        const hidl_vec<uint8_t>& /* ssid */) override {
+        return Void();
+    }
+    Return<void> onAnqpQueryDone(
+        const hidl_array<uint8_t, 6>& /* bssid */,
+        const ISupplicantStaIfaceCallback::AnqpData& /* data */,
+        const ISupplicantStaIfaceCallback::Hs20AnqpData& /* hs20Data */)
+        override {
+        return Void();
+    }
+    virtual Return<void> onHs20IconQueryDone(
+        const hidl_array<uint8_t, 6>& /* bssid */,
+        const hidl_string& /* fileName */,
+        const hidl_vec<uint8_t>& /* data */) override {
+        return Void();
+    }
+    virtual Return<void> onHs20SubscriptionRemediation(
+        const hidl_array<uint8_t, 6>& /* bssid */,
+        ISupplicantStaIfaceCallback::OsuMethod /* osuMethod */,
+        const hidl_string& /* url*/) override {
+        return Void();
+    }
+    Return<void> onHs20DeauthImminentNotice(
+        const hidl_array<uint8_t, 6>& /* bssid */, uint32_t /* reasonCode */,
+        uint32_t /* reAuthDelayInSec */,
+        const hidl_string& /* url */) override {
+        return Void();
+    }
+    Return<void> onDisconnected(const hidl_array<uint8_t, 6>& /* bssid */,
+                                bool /* locallyGenerated */,
+                                uint32_t /* reasonCode */) override {
+        return Void();
+    }
+    Return<void> onAssociationRejected(
+        const hidl_array<uint8_t, 6>& /* bssid */, uint32_t /* statusCode */,
+        bool /*timedOut */) override {
+        return Void();
+    }
+    Return<void> onAuthenticationTimeout(
+        const hidl_array<uint8_t, 6>& /* bssid */) override {
+        return Void();
+    }
+    Return<void> onEapFailure() override { return Void(); }
+    Return<void> onWpsEventSuccess() override { return Void(); }
+    Return<void> onWpsEventFail(
+        const hidl_array<uint8_t, 6>& /* bssid */,
+        ISupplicantStaIfaceCallback::WpsConfigError /* configError */,
+        ISupplicantStaIfaceCallback::WpsErrorIndication /* errorInd */)
+        override {
+        return Void();
+    }
+    Return<void> onWpsEventPbcOverlap() override { return Void(); }
+    Return<void> onExtRadioWorkStart(uint32_t /* id */) override {
+        return Void();
+    }
+    Return<void> onExtRadioWorkTimeout(uint32_t /* id*/) override {
+        return Void();
+    }
+};
+
 /*
  * Create:
  * Ensures that an instance of the ISupplicantStaIface proxy object is
@@ -30,3 +144,257 @@
     EXPECT_NE(nullptr, getSupplicantStaIface().get());
     stopSupplicant();
 }
+
+/*
+ * RegisterCallback
+ */
+TEST_F(SupplicantStaIfaceHidlTest, RegisterCallback) {
+    sta_iface_->registerCallback(
+        new IfaceCallback(), [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+}
+
+/*
+ * listNetworks.
+ */
+TEST_F(SupplicantStaIfaceHidlTest, listNetworks) {
+    sta_iface_->listNetworks([](const SupplicantStatus& status,
+                                const hidl_vec<SupplicantNetworkId>& ids) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        EXPECT_EQ(0u, ids.size());
+    });
+
+    sp<ISupplicantStaNetwork> sta_network = createSupplicantStaNetwork();
+    EXPECT_NE(nullptr, sta_network.get());
+
+    sta_iface_->listNetworks([](const SupplicantStatus& status,
+                                const hidl_vec<SupplicantNetworkId>& ids) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        EXPECT_LT(0u, ids.size());
+    });
+}
+
+/*
+ * Reassociate.
+ */
+TEST_F(SupplicantStaIfaceHidlTest, Reassociate) {
+    sta_iface_->reassociate([](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+}
+
+/*
+ * Reconnect.
+ */
+TEST_F(SupplicantStaIfaceHidlTest, Reconnect) {
+    sta_iface_->reconnect([](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::FAILURE_IFACE_NOT_DISCONNECTED,
+                  status.code);
+    });
+}
+
+/*
+ * Disconnect.
+ */
+TEST_F(SupplicantStaIfaceHidlTest, Disconnect) {
+    sta_iface_->disconnect([](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+}
+
+/*
+ * SetPowerSave.
+ */
+TEST_F(SupplicantStaIfaceHidlTest, SetPowerSave) {
+    sta_iface_->setPowerSave(true, [](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+    sta_iface_->setPowerSave(false, [](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+}
+
+/*
+ * InitiateTdlsDiscover.
+ */
+TEST_F(SupplicantStaIfaceHidlTest, InitiateTdlsDiscover) {
+    sta_iface_->initiateTdlsDiscover(
+        mac_addr_, [](const SupplicantStatus& status) {
+            // These requests will fail unless the MAC address mentioned is
+            // actually around.
+            EXPECT_EQ(SupplicantStatusCode::FAILURE_UNKNOWN, status.code);
+        });
+}
+
+/*
+ * InitiateTdlsSetup.
+ */
+TEST_F(SupplicantStaIfaceHidlTest, InitiateTdlsSetup) {
+    sta_iface_->initiateTdlsSetup(
+        mac_addr_, [](const SupplicantStatus& status) {
+            // These requests will fail unless the MAC address mentioned is
+            // actually around.
+            EXPECT_EQ(SupplicantStatusCode::FAILURE_UNKNOWN, status.code);
+        });
+}
+
+/*
+ * InitiateTdlsTeardown.
+ */
+TEST_F(SupplicantStaIfaceHidlTest, InitiateTdlsTeardown) {
+    sta_iface_->initiateTdlsTeardown(
+        mac_addr_, [](const SupplicantStatus& status) {
+            // These requests will fail unless the MAC address mentioned is
+            // actually around.
+            EXPECT_EQ(SupplicantStatusCode::FAILURE_UNKNOWN, status.code);
+        });
+}
+
+/*
+ * InitiateAnqpQuery.
+ */
+TEST_F(SupplicantStaIfaceHidlTest, InitiateAnqpQuery) {
+    std::vector<ISupplicantStaIface::AnqpInfoId> anqp_ids(
+        kTestAnqpInfoIds, kTestAnqpInfoIds + sizeof(kTestAnqpInfoIds));
+    std::vector<ISupplicantStaIface::Hs20AnqpSubtypes> hs_types(
+        kTestHs20Types, kTestHs20Types + sizeof(kTestHs20Types));
+    sta_iface_->initiateAnqpQuery(
+        mac_addr_, anqp_ids, hs_types, [](const SupplicantStatus& status) {
+            // These requests will fail unless the BSSID mentioned is actually
+            // present in scan results.
+            EXPECT_EQ(SupplicantStatusCode::FAILURE_UNKNOWN, status.code);
+        });
+}
+
+/*
+ * InitiateHs20IconQuery.
+ */
+TEST_F(SupplicantStaIfaceHidlTest, InitiateHs20IconQuery) {
+    sta_iface_->initiateHs20IconQuery(
+        mac_addr_, kTestHs20IconFile, [](const SupplicantStatus& status) {
+            // These requests will fail unless the BSSID mentioned is actually
+            // present in scan results.
+            EXPECT_EQ(SupplicantStatusCode::FAILURE_UNKNOWN, status.code);
+        });
+}
+
+/*
+ * GetMacAddress.
+ */
+TEST_F(SupplicantStaIfaceHidlTest, GetMacAddress) {
+    sta_iface_->getMacAddress([](const SupplicantStatus& status,
+                                 const hidl_array<uint8_t, 6>& mac_addr) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        std::array<uint8_t, 6> std_mac_addr(mac_addr);
+        EXPECT_GT(6, std::count(std_mac_addr.begin(), std_mac_addr.end(), 0));
+    });
+}
+
+/*
+ * StartRxFilter.
+ */
+TEST_F(SupplicantStaIfaceHidlTest, StartRxFilter) {
+    sta_iface_->startRxFilter([](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+}
+
+/*
+ * StopRxFilter.
+ */
+TEST_F(SupplicantStaIfaceHidlTest, StopRxFilter) {
+    sta_iface_->stopRxFilter([](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+}
+
+/*
+ * AddRxFilter.
+ */
+TEST_F(SupplicantStaIfaceHidlTest, AddRxFilter) {
+    sta_iface_->addRxFilter(ISupplicantStaIface::RxFilterType::V4_MULTICAST,
+                            [](const SupplicantStatus& status) {
+                                EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+                                          status.code);
+                            });
+    sta_iface_->addRxFilter(ISupplicantStaIface::RxFilterType::V6_MULTICAST,
+                            [](const SupplicantStatus& status) {
+                                EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+                                          status.code);
+                            });
+}
+
+/*
+ * RemoveRxFilter.
+ */
+TEST_F(SupplicantStaIfaceHidlTest, RemoveRxFilter) {
+    sta_iface_->removeRxFilter(ISupplicantStaIface::RxFilterType::V4_MULTICAST,
+                               [](const SupplicantStatus& status) {
+                                   EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+                                             status.code);
+                               });
+    sta_iface_->removeRxFilter(ISupplicantStaIface::RxFilterType::V6_MULTICAST,
+                               [](const SupplicantStatus& status) {
+                                   EXPECT_EQ(SupplicantStatusCode::SUCCESS,
+                                             status.code);
+                               });
+}
+
+/*
+ * SetBtCoexistenceMode.
+ */
+TEST_F(SupplicantStaIfaceHidlTest, SetBtCoexistenceMode) {
+    sta_iface_->setBtCoexistenceMode(
+        ISupplicantStaIface::BtCoexistenceMode::ENABLED,
+        [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_iface_->setBtCoexistenceMode(
+        ISupplicantStaIface::BtCoexistenceMode::DISABLED,
+        [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_iface_->setBtCoexistenceMode(
+        ISupplicantStaIface::BtCoexistenceMode::SENSE,
+        [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+}
+
+/*
+ * SetBtCoexistenceScanModeEnabled.
+ */
+TEST_F(SupplicantStaIfaceHidlTest, SetBtCoexistenceScanModeEnabled) {
+    sta_iface_->setBtCoexistenceScanModeEnabled(
+        true, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_iface_->setBtCoexistenceScanModeEnabled(
+        false, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+}
+
+/*
+ * SetSuspendModeEnabled.
+ */
+TEST_F(SupplicantStaIfaceHidlTest, SetSuspendModeEnabled) {
+    sta_iface_->setSuspendModeEnabled(true, [](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+    sta_iface_->setSuspendModeEnabled(
+        false, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+}
+
+/*
+ * SetCountryCode.
+ */
+TEST_F(SupplicantStaIfaceHidlTest, SetCountryCode) {
+    sta_iface_->setCountryCode(
+        kTestCountryCode, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+}
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_sta_network_hidl_test.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_sta_network_hidl_test.cpp
index cde75fa..aa84e9a 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_sta_network_hidl_test.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_sta_network_hidl_test.cpp
@@ -18,8 +18,104 @@
 
 #include <VtsHalHidlTargetTestBase.h>
 
+#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaNetwork.h>
+
+#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaNetwork.h>
+
 #include "supplicant_hidl_test_utils.h"
 
+using ::android::sp;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaIface;
+using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaNetwork;
+using ::android::hardware::wifi::supplicant::V1_0::
+    ISupplicantStaNetworkCallback;
+using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
+using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
+
+namespace {
+constexpr char kTestSsidStr[] = "TestSsid1234";
+constexpr char kTestPsk[] = "TestPsk123";
+constexpr char kTestIdStr[] = "TestIdstr";
+constexpr char kTestEapPasswdStr[] = "TestEapPasswd1234";
+constexpr char kTestEapCert[] = "keystore://CERT";
+constexpr char kTestEapPrivateKeyId[] = "key_id";
+constexpr char kTestEapMatch[] = "match";
+constexpr char kTestEapEngineID[] = "engine_id";
+constexpr uint8_t kTestBssid[] = {0x56, 0x67, 0x67, 0xf4, 0x56, 0x92};
+constexpr uint8_t kTestWepKey[] = {0x56, 0x67, 0x67, 0xf4, 0x56};
+constexpr uint8_t kTestKc[] = {0x56, 0x67, 0x67, 0xf4, 0x76, 0x87, 0x98, 0x12};
+constexpr uint8_t kTestSres[] = {0x56, 0x67, 0x67, 0xf4};
+constexpr uint8_t kTestRes[] = {0x56, 0x67, 0x67, 0xf4, 0x67};
+constexpr uint8_t kTestIk[] = {[0 ... 15] = 0x65};
+constexpr uint8_t kTestCk[] = {[0 ... 15] = 0x45};
+constexpr uint8_t kTestIdentity[] = {0x45, 0x67, 0x98, 0x67, 0x56};
+constexpr uint32_t kTestWepTxKeyIdx = 2;
+constexpr uint32_t kTestKeyMgmt = (ISupplicantStaNetwork::KeyMgmtMask::WPA_PSK |
+                                   ISupplicantStaNetwork::KeyMgmtMask::WPA_EAP);
+constexpr uint32_t kTestProto = (ISupplicantStaNetwork::ProtoMask::OSEN |
+                                 ISupplicantStaNetwork::ProtoMask::RSN);
+constexpr uint32_t kTestAuthAlg = (ISupplicantStaNetwork::AuthAlgMask::OPEN |
+                                   ISupplicantStaNetwork::AuthAlgMask::SHARED);
+constexpr uint32_t kTestGroupCipher =
+    (ISupplicantStaNetwork::GroupCipherMask::CCMP |
+     ISupplicantStaNetwork::GroupCipherMask::WEP104);
+constexpr uint32_t kTestPairwiseCipher =
+    (ISupplicantStaNetwork::PairwiseCipherMask::CCMP |
+     ISupplicantStaNetwork::PairwiseCipherMask::TKIP);
+}  // namespace
+
+class SupplicantStaNetworkHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+   public:
+    virtual void SetUp() override {
+        startSupplicantAndWaitForHidlService();
+        EXPECT_TRUE(turnOnExcessiveLogging());
+        sta_network_ = createSupplicantStaNetwork();
+        ASSERT_NE(sta_network_.get(), nullptr);
+
+        ssid_.assign(kTestSsidStr, kTestSsidStr + strlen(kTestSsidStr));
+    }
+
+    virtual void TearDown() override { stopSupplicant(); }
+
+   protected:
+    void removeNetwork() {
+      sp<ISupplicantStaIface> sta_iface = getSupplicantStaIface();
+      ASSERT_NE(nullptr, sta_iface.get());
+      uint32_t net_id;
+      sta_network_->getId([&](const SupplicantStatus& status, int network_id) {
+              ASSERT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+              net_id = network_id;
+          });
+      sta_iface->removeNetwork(net_id, [](const SupplicantStatus& status) {
+              ASSERT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+          });
+    }
+
+    // ISupplicantStaNetwork object used for all tests in this fixture.
+    sp<ISupplicantStaNetwork> sta_network_;
+    // SSID to use for various tests.
+    std::vector<uint8_t> ssid_;
+};
+
+class NetworkCallback : public ISupplicantStaNetworkCallback {
+    Return<void> onNetworkEapSimGsmAuthRequest(
+        const ISupplicantStaNetworkCallback::NetworkRequestEapSimGsmAuthParams&
+        /* params */) override {
+        return Void();
+    }
+    Return<void> onNetworkEapSimUmtsAuthRequest(
+        const ISupplicantStaNetworkCallback::NetworkRequestEapSimUmtsAuthParams&
+        /* params */) override {
+        return Void();
+    }
+    Return<void> onNetworkEapIdentityRequest() override { return Void(); }
+};
+
 /*
  * Create:
  * Ensures that an instance of the ISupplicantStaNetwork proxy object is
@@ -30,3 +126,535 @@
     EXPECT_NE(nullptr, createSupplicantStaNetwork().get());
     stopSupplicant();
 }
+
+/*
+ * RegisterCallback
+ */
+TEST_F(SupplicantStaNetworkHidlTest, RegisterCallback) {
+    sta_network_->registerCallback(
+        new NetworkCallback(), [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+}
+
+/* Tests out the various setter/getter methods. */
+/*
+ * SetGetSsid
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetSsid) {
+    sta_network_->setSsid(ssid_, [](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+    sta_network_->getSsid(
+        [&](const SupplicantStatus& status, const hidl_vec<uint8_t>& get_ssid) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+            EXPECT_EQ(ssid_, std::vector<uint8_t>(get_ssid));
+        });
+}
+
+/*
+ * SetGetBssid
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetBssid) {
+    std::array<uint8_t, 6> set_bssid;
+    memcpy(set_bssid.data(), kTestBssid, set_bssid.size());
+    sta_network_->setBssid(set_bssid, [](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+    sta_network_->getBssid([&](const SupplicantStatus& status,
+                               const hidl_array<uint8_t, 6>& get_bssid_hidl) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        std::array<uint8_t, 6> get_bssid;
+        memcpy(get_bssid.data(), get_bssid_hidl.data(), get_bssid.size());
+        EXPECT_EQ(set_bssid, get_bssid);
+    });
+}
+
+/*
+ * SetGetKeyMgmt
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetKeyMgmt) {
+    sta_network_->setKeyMgmt(kTestKeyMgmt, [](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+    sta_network_->getKeyMgmt(
+        [&](const SupplicantStatus& status, uint32_t key_mgmt) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+            EXPECT_EQ(key_mgmt, kTestKeyMgmt);
+        });
+}
+
+/*
+ * SetGetProto
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetProto) {
+    sta_network_->setProto(kTestProto, [](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+    sta_network_->getProto([&](const SupplicantStatus& status, uint32_t proto) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        EXPECT_EQ(proto, kTestProto);
+    });
+}
+
+/*
+ * SetGetKeyAuthAlg
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetAuthAlg) {
+    sta_network_->setAuthAlg(kTestAuthAlg, [](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+    sta_network_->getAuthAlg(
+        [&](const SupplicantStatus& status, uint32_t auth_alg) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+            EXPECT_EQ(auth_alg, kTestAuthAlg);
+        });
+}
+
+/*
+ * SetGetGroupCipher
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetGroupCipher) {
+    sta_network_->setGroupCipher(
+        kTestGroupCipher, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_network_->getGroupCipher(
+        [&](const SupplicantStatus& status, uint32_t group_cipher) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+            EXPECT_EQ(group_cipher, kTestGroupCipher);
+        });
+}
+
+/*
+ * SetGetPairwiseCipher
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetPairwiseCipher) {
+    sta_network_->setPairwiseCipher(
+        kTestPairwiseCipher, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_network_->getPairwiseCipher(
+        [&](const SupplicantStatus& status, uint32_t pairwise_cipher) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+            EXPECT_EQ(pairwise_cipher, kTestPairwiseCipher);
+        });
+}
+
+/*
+ * SetGetPskPassphrase
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetPskPassphrase) {
+    sta_network_->setPskPassphrase(
+        kTestPsk, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_network_->getPskPassphrase(
+        [&](const SupplicantStatus& status, const hidl_string& psk) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+            EXPECT_EQ(kTestPsk, std::string(psk.c_str()));
+        });
+}
+
+/*
+ * SetGetWepKeys
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetWepTxKeyIdx) {
+    sta_network_->setWepTxKeyIdx(
+        kTestWepTxKeyIdx, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_network_->getWepTxKeyIdx(
+        [&](const SupplicantStatus& status, uint32_t key_idx) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+            EXPECT_EQ(kTestWepTxKeyIdx, key_idx);
+        });
+}
+
+/*
+ * SetGetWepKeys
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetWepKeys) {
+    for (uint32_t i = 0;
+         i < static_cast<uint32_t>(
+                 ISupplicantStaNetwork::ParamSizeLimits::WEP_KEYS_MAX_NUM);
+         i++) {
+        std::vector<uint8_t> set_wep_key(std::begin(kTestWepKey),
+                                         std::end(kTestWepKey));
+        sta_network_->setWepKey(
+            i, set_wep_key, [](const SupplicantStatus& status) {
+                EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+            });
+        sta_network_->getWepKey(i, [&](const SupplicantStatus& status,
+                                       const hidl_vec<uint8_t>& get_wep_key) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+            EXPECT_EQ(set_wep_key, std::vector<uint8_t>(get_wep_key));
+        });
+    }
+}
+
+/*
+ * SetGetScanSsid
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetScanSsid) {
+    sta_network_->setScanSsid(
+        true, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_network_->getScanSsid(
+        [&](const SupplicantStatus& status, bool scan_ssid) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+            EXPECT_EQ(true, scan_ssid);
+        });
+}
+
+/*
+ * SetGetRequirePmf
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetRequirePmf) {
+    sta_network_->setRequirePmf(
+        true, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_network_->getRequirePmf(
+        [&](const SupplicantStatus& status, bool require_pmf) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+            EXPECT_EQ(true, require_pmf);
+        });
+}
+
+/*
+ * SetGetIdStr
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetIdStr) {
+    sta_network_->setIdStr(
+        kTestIdStr, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_network_->getIdStr(
+        [&](const SupplicantStatus& status, const hidl_string& id_str) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+            EXPECT_EQ(kTestIdStr, std::string(id_str.c_str()));
+        });
+}
+
+
+/*
+ * SetGetEapMethod
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetEapMethod) {
+    ISupplicantStaNetwork::EapMethod set_eap_method =
+        ISupplicantStaNetwork::EapMethod::PEAP;
+    sta_network_->setEapMethod(
+        set_eap_method, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_network_->getEapMethod(
+        [&](const SupplicantStatus& status,
+            ISupplicantStaNetwork::EapMethod eap_method) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+            EXPECT_EQ(set_eap_method, eap_method);
+        });
+}
+
+/*
+ * SetGetEapPhase2Method
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetEapPhase2Method) {
+    ISupplicantStaNetwork::EapPhase2Method set_eap_phase2_method =
+        ISupplicantStaNetwork::EapPhase2Method::NONE;
+    sta_network_->setEapPhase2Method(
+        set_eap_phase2_method, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_network_->getEapPhase2Method(
+        [&](const SupplicantStatus& status,
+            ISupplicantStaNetwork::EapPhase2Method eap_phase2_method) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+            EXPECT_EQ(set_eap_phase2_method, eap_phase2_method);
+        });
+}
+
+/*
+ * SetGetEapIdentity
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetEapIdentity) {
+    std::vector<uint8_t> set_identity(kTestIdentity, kTestIdentity + sizeof(kTestIdentity));
+    sta_network_->setEapIdentity(
+        set_identity, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_network_->getEapIdentity(
+        [&](const SupplicantStatus& status, const std::vector<uint8_t>& identity) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+            EXPECT_EQ(set_identity, identity);
+        });
+}
+
+/*
+ * SetGetEapAnonymousIdentity
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetEapAnonymousIdentity) {
+    std::vector<uint8_t> set_identity(kTestIdentity, kTestIdentity + sizeof(kTestIdentity));
+    sta_network_->setEapAnonymousIdentity(
+        set_identity, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_network_->getEapAnonymousIdentity(
+        [&](const SupplicantStatus& status, const std::vector<uint8_t>& identity) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+            EXPECT_EQ(set_identity, identity);
+        });
+}
+
+/*
+ * SetGetEapPassword
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetEapPassword) {
+    std::vector<uint8_t> set_eap_passwd(
+        kTestEapPasswdStr, kTestEapPasswdStr + strlen(kTestEapPasswdStr));
+    sta_network_->setEapPassword(
+        set_eap_passwd, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_network_->getEapPassword([&](const SupplicantStatus& status,
+                                     const hidl_vec<uint8_t>& eap_passwd) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        EXPECT_EQ(set_eap_passwd, std::vector<uint8_t>(eap_passwd));
+    });
+}
+
+/*
+ * SetGetEapCACert
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetEapCACert) {
+    sta_network_->setEapCACert(
+        kTestEapCert, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_network_->getEapCACert([&](const SupplicantStatus& status,
+                                   const hidl_string& eap_cert) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        EXPECT_EQ(kTestEapCert, std::string(eap_cert.c_str()));
+    });
+}
+
+/*
+ * SetGetEapCAPath
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetEapCAPath) {
+    sta_network_->setEapCAPath(
+        kTestEapCert, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_network_->getEapCAPath([&](const SupplicantStatus& status,
+                                   const hidl_string& eap_cert) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        EXPECT_EQ(kTestEapCert, std::string(eap_cert.c_str()));
+    });
+}
+
+/*
+ * SetGetEapClientCert
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetEapClientCert) {
+    sta_network_->setEapClientCert(
+        kTestEapCert, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_network_->getEapClientCert([&](const SupplicantStatus& status,
+                                       const hidl_string& eap_cert) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        EXPECT_EQ(kTestEapCert, std::string(eap_cert.c_str()));
+    });
+}
+
+/*
+ * SetGetEapPrivateKeyId
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetEapPrivateKeyId) {
+    sta_network_->setEapPrivateKeyId(
+        kTestEapPrivateKeyId, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_network_->getEapPrivateKeyId([&](const SupplicantStatus& status,
+                                         const hidl_string& key_id) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        EXPECT_EQ(kTestEapPrivateKeyId, std::string(key_id.c_str()));
+    });
+}
+
+/*
+ * SetGetEapAltSubjectMatch
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetEapAltSubjectMatch) {
+    sta_network_->setEapAltSubjectMatch(
+        kTestEapMatch, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_network_->getEapAltSubjectMatch([&](const SupplicantStatus& status,
+                                            const hidl_string& match) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        EXPECT_EQ(kTestEapMatch, std::string(match.c_str()));
+    });
+}
+
+/*
+ * SetGetEapDomainSuffixMatch
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetEapDomainSuffixMatch) {
+    sta_network_->setEapDomainSuffixMatch(
+        kTestEapMatch, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_network_->getEapDomainSuffixMatch([&](const SupplicantStatus& status,
+                                              const hidl_string& match) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        EXPECT_EQ(kTestEapMatch, std::string(match.c_str()));
+    });
+}
+
+/*
+ * SetGetEapEngine
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetEapEngine) {
+    sta_network_->setEapEngine(
+        true, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_network_->getEapEngine([&](const SupplicantStatus& status,
+                                   bool enable) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        EXPECT_EQ(true, enable);
+    });
+}
+
+/*
+ * SetGetEapEngineID
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SetGetEapEngineID) {
+    sta_network_->setEapEngineID(
+        kTestEapEngineID, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+    sta_network_->getEapEngineID([&](const SupplicantStatus& status,
+                                     const hidl_string& id) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        EXPECT_EQ(kTestEapEngineID, std::string(id.c_str()));
+    });
+}
+
+/*
+ * Enable
+ */
+TEST_F(SupplicantStaNetworkHidlTest, Enable) {
+    // wpa_supplicant doesn't perform any connection initiation
+    // unless atleast the Ssid and Ket mgmt params are set.
+    sta_network_->setSsid(ssid_, [](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+    sta_network_->setKeyMgmt(kTestKeyMgmt, [](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+
+    sta_network_->enable(false, [](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+    sta_network_->enable(true, [](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+
+    // Now remove the network and ensure that the calls fail.
+    removeNetwork();
+    sta_network_->enable(true, [](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::FAILURE_NETWORK_INVALID, status.code);
+    });
+}
+
+/*
+ * Disable
+ */
+TEST_F(SupplicantStaNetworkHidlTest, Disable) {
+    // wpa_supplicant doesn't perform any connection initiation
+    // unless atleast the Ssid and Ket mgmt params are set.
+    sta_network_->setSsid(ssid_, [](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+    sta_network_->setKeyMgmt(kTestKeyMgmt, [](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+
+    sta_network_->disable([](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+    // Now remove the network and ensure that the calls fail.
+    removeNetwork();
+    sta_network_->disable([](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::FAILURE_NETWORK_INVALID, status.code);
+    });
+}
+
+/*
+ * Select.
+ */
+TEST_F(SupplicantStaNetworkHidlTest, Select) {
+    // wpa_supplicant doesn't perform any connection initiation
+    // unless atleast the Ssid and Ket mgmt params are set.
+    sta_network_->setSsid(ssid_, [](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+    sta_network_->setKeyMgmt(kTestKeyMgmt, [](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+
+    sta_network_->select([](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+    });
+    // Now remove the network and ensure that the calls fail.
+    removeNetwork();
+    sta_network_->select([](const SupplicantStatus& status) {
+        EXPECT_EQ(SupplicantStatusCode::FAILURE_NETWORK_INVALID, status.code);
+    });
+}
+
+/*
+ * SendNetworkEapSimGsmAuthResponse
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SendNetworkEapSimGsmAuthResponse) {
+    std::vector<ISupplicantStaNetwork::NetworkResponseEapSimGsmAuthParams>
+        params;
+    ISupplicantStaNetwork::NetworkResponseEapSimGsmAuthParams param;
+    memcpy(param.kc.data(), kTestKc, param.kc.size());
+    memcpy(param.sres.data(), kTestSres, param.sres.size());
+    params.push_back(param);
+    sta_network_->sendNetworkEapSimGsmAuthResponse(
+        params, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+}
+
+/*
+ * SendNetworkEapSimUmtsAuthResponse
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SendNetworkEapSimUmtsAuthResponse) {
+    ISupplicantStaNetwork::NetworkResponseEapSimUmtsAuthParams params;
+    params.res = std::vector<uint8_t>(kTestRes, kTestRes + sizeof(kTestRes));
+    memcpy(params.ik.data(), kTestIk, params.ik.size());
+    memcpy(params.ck.data(), kTestCk, params.ck.size());
+    sta_network_->sendNetworkEapSimUmtsAuthResponse(
+        params, [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+}
+
+/*
+ * SendNetworkEapIdentityResponse
+ */
+TEST_F(SupplicantStaNetworkHidlTest, SendNetworkEapIdentityResponse) {
+    sta_network_->sendNetworkEapIdentityResponse(
+        std::vector<uint8_t>(kTestIdentity,
+                             kTestIdentity + sizeof(kTestIdentity)),
+        [](const SupplicantStatus& status) {
+            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+        });
+}
