diff --git a/wpa_supplicant/Android.mk b/wpa_supplicant/Android.mk
index 5a3cd29..1a25d08 100644
--- a/wpa_supplicant/Android.mk
+++ b/wpa_supplicant/Android.mk
@@ -1669,8 +1669,10 @@
 LOCAL_SRC_FILES := \
     hidl/hidl.cpp \
     hidl/hidl_manager.cpp \
-    hidl/iface.cpp \
-    hidl/network.cpp \
+    hidl/p2p_iface.cpp \
+    hidl/p2p_network.cpp \
+    hidl/sta_iface.cpp \
+    hidl/sta_network.cpp \
     hidl/supplicant.cpp
 LOCAL_SHARED_LIBRARIES := \
     android.hardware.wifi.supplicant@1.0 \
diff --git a/wpa_supplicant/hidl/hidl_manager.cpp b/wpa_supplicant/hidl/hidl_manager.cpp
index 372b221..c5705d1 100644
--- a/wpa_supplicant/hidl/hidl_manager.cpp
+++ b/wpa_supplicant/hidl/hidl_manager.cpp
@@ -11,11 +11,282 @@
 
 #include "hidl_manager.h"
 
-extern "C" {
-#include "utils/common.h"
-#include "utils/includes.h"
+namespace {
+/**
+ * Check if the provided |wpa_supplicant| structure represents a P2P iface or
+ * not.
+ */
+constexpr bool isP2pIface(const struct wpa_supplicant *wpa_s)
+{
+	return (wpa_s->global->p2p_init_wpa_s == wpa_s);
 }
 
+/**
+ * Creates a unique key for the network using the provided |ifname| and
+ * |network_id| to be used in the internal map of |ISupplicantNetwork| objects.
+ * This is of the form |ifname|_|network_id|. For ex: "wlan0_1".
+ *
+ * @param ifname Name of the corresponding interface.
+ * @param network_id ID of the corresponding network.
+ */
+const std::string getNetworkObjectMapKey(
+    const std::string &ifname, int network_id)
+{
+	return ifname + "_" + std::to_string(network_id);
+}
+
+/**
+ * Add callback to the corresponding list after linking to death on the
+ * corresponding hidl object reference.
+ */
+template <class CallbackType>
+int registerForDeathAndAddCallbackHidlObjectToList(
+    const android::sp<CallbackType> &callback,
+    const std::function<void(const android::sp<CallbackType> &)>
+	&on_hidl_died_fctor,
+    std::vector<android::sp<CallbackType>> &callback_list)
+{
+#if 0   // TODO(b/31632518): HIDL object death notifications.
+	auto death_notifier = new CallbackObjectDeathNotifier<CallbackType>(
+	    callback, on_hidl_died_fctor);
+	// Use the |callback.get()| as cookie so that we don't need to
+	// store a reference to this |CallbackObjectDeathNotifier| instance
+	// to use in |unlinkToDeath| later.
+	// NOTE: This may cause an immediate callback if the object is already
+	// dead, so add it to the list before we register for callback!
+	if (android::hardware::IInterface::asBinder(callback)->linkToDeath(
+		death_notifier, callback.get()) != android::OK) {
+		wpa_printf(
+		    MSG_ERROR,
+		    "Error registering for death notification for "
+		    "supplicant callback object");
+		callback_list.erase(
+		    std::remove(
+			callback_list.begin(), callback_list.end(), callback),
+		    callback_list.end());
+		return 1;
+	}
+#endif  // TODO(b/31632518): HIDL object death notifications.
+	callback_list.push_back(callback);
+	return 0;
+}
+
+template <class ObjectType>
+int addHidlObjectToMap(
+    const std::string &key, const android::sp<ObjectType> object,
+    std::map<const std::string, android::sp<ObjectType>> &object_map)
+{
+	// Return failure if we already have an object for that |key|.
+	if (object_map.find(key) != object_map.end())
+		return 1;
+	object_map[key] = object;
+	if (!object_map[key].get())
+		return 1;
+	return 0;
+}
+
+template <class ObjectType>
+int removeHidlObjectFromMap(
+    const std::string &key,
+    std::map<const std::string, android::sp<ObjectType>> &object_map)
+{
+	// Return failure if we dont have an object for that |key|.
+	if (object_map.find(key) == object_map.end())
+		return 1;
+	object_map.erase(key);
+	return 0;
+}
+
+template <class CallbackType>
+int addIfaceCallbackHidlObjectToMap(
+    const std::string &ifname, const android::sp<CallbackType> &callback,
+    const std::function<void(const android::sp<CallbackType> &)>
+	&on_hidl_died_fctor,
+    std::map<const std::string, std::vector<android::sp<CallbackType>>>
+	&callbacks_map)
+{
+	if (ifname.empty())
+		return 1;
+
+	auto iface_callback_map_iter = callbacks_map.find(ifname);
+	if (iface_callback_map_iter == callbacks_map.end())
+		return 1;
+	auto &iface_callback_list = iface_callback_map_iter->second;
+
+	// Register for death notification before we add it to our list.
+	return registerForDeathAndAddCallbackHidlObjectToList<CallbackType>(
+	    callback, on_hidl_died_fctor, iface_callback_list);
+}
+
+template <class CallbackType>
+int addNetworkCallbackHidlObjectToMap(
+    const std::string &ifname, int network_id,
+    const android::sp<CallbackType> &callback,
+    const std::function<void(const android::sp<CallbackType> &)>
+	&on_hidl_died_fctor,
+    std::map<const std::string, std::vector<android::sp<CallbackType>>>
+	&callbacks_map)
+{
+	if (ifname.empty() || network_id < 0)
+		return 1;
+
+	// Generate the key to be used to lookup the network.
+	const std::string network_key =
+	    getNetworkObjectMapKey(ifname, network_id);
+	auto network_callback_map_iter = callbacks_map.find(network_key);
+	if (network_callback_map_iter == callbacks_map.end())
+		return 1;
+	auto &network_callback_list = network_callback_map_iter->second;
+
+	// Register for death notification before we add it to our list.
+	return registerForDeathAndAddCallbackHidlObjectToList<CallbackType>(
+	    callback, on_hidl_died_fctor, network_callback_list);
+}
+
+template <class CallbackType>
+int removeAllIfaceCallbackHidlObjectsFromMap(
+    const std::string &ifname,
+    std::map<const std::string, std::vector<android::sp<CallbackType>>>
+	&callbacks_map)
+{
+	auto iface_callback_map_iter = callbacks_map.find(ifname);
+	if (iface_callback_map_iter == callbacks_map.end())
+		return 1;
+#if 0   // TODO(b/31632518): HIDL object death notifications.
+	const auto &iface_callback_list = iface_callback_map_iter->second;
+	for (const auto &callback : iface_callback_list) {
+		if (android::hardware::IInterface::asBinder(callback)
+			->unlinkToDeath(nullptr, callback.get()) !=
+		    android::OK) {
+			wpa_printf(
+			    MSG_ERROR,
+			    "Error deregistering for death notification for "
+			    "iface callback object");
+		}
+	}
+#endif  // TODO(b/31632518): HIDL object death notifications.
+	callbacks_map.erase(iface_callback_map_iter);
+	return 0;
+}
+
+template <class CallbackType>
+int removeAllNetworkCallbackHidlObjectsFromMap(
+    const std::string &network_key,
+    std::map<const std::string, std::vector<android::sp<CallbackType>>>
+	&callbacks_map)
+{
+	auto network_callback_map_iter = callbacks_map.find(network_key);
+	if (network_callback_map_iter == callbacks_map.end())
+		return 1;
+#if 0   // TODO(b/31632518): HIDL object death notifications.
+	const auto &network_callback_list = network_callback_map_iter->second;
+	for (const auto &callback : network_callback_list) {
+		if (android::hardware::IInterface::asBinder(callback)
+			->unlinkToDeath(nullptr, callback.get()) !=
+		    android::OK) {
+			wpa_printf(
+			    MSG_ERROR,
+			    "Error deregistering for death "
+			    "notification for "
+			    "network callback object");
+		}
+	}
+#endif  // TODO(b/31632518): HIDL object death notifications.
+	callbacks_map.erase(network_callback_map_iter);
+	return 0;
+}
+
+template <class CallbackType>
+void removeIfaceCallbackHidlObjectFromMap(
+    const std::string &ifname, const android::sp<CallbackType> &callback,
+    std::map<const std::string, std::vector<android::sp<CallbackType>>>
+	&callbacks_map)
+{
+	if (ifname.empty())
+		return;
+
+	auto iface_callback_map_iter = callbacks_map.find(ifname);
+	if (iface_callback_map_iter == callbacks_map.end())
+		return;
+
+	auto &iface_callback_list = iface_callback_map_iter->second;
+	iface_callback_list.erase(
+	    std::remove(
+		iface_callback_list.begin(), iface_callback_list.end(),
+		callback),
+	    iface_callback_list.end());
+}
+
+template <class CallbackType>
+void removeNetworkCallbackHidlObjectFromMap(
+    const std::string &ifname, int network_id,
+    const android::sp<CallbackType> &callback,
+    std::map<const std::string, std::vector<android::sp<CallbackType>>>
+	&callbacks_map)
+{
+	if (ifname.empty() || network_id < 0)
+		return;
+
+	// Generate the key to be used to lookup the network.
+	const std::string network_key =
+	    getNetworkObjectMapKey(ifname, network_id);
+
+	auto network_callback_map_iter = callbacks_map.find(network_key);
+	if (network_callback_map_iter == callbacks_map.end())
+		return;
+
+	auto &network_callback_list = network_callback_map_iter->second;
+	network_callback_list.erase(
+	    std::remove(
+		network_callback_list.begin(), network_callback_list.end(),
+		callback),
+	    network_callback_list.end());
+}
+
+template <class CallbackType>
+void callWithEachIfaceCallback(
+    const std::string &ifname,
+    const std::function<
+	android::hardware::Return<void>(android::sp<CallbackType>)> &method,
+    const std::map<const std::string, std::vector<android::sp<CallbackType>>>
+	&callbacks_map)
+{
+	if (ifname.empty())
+		return;
+
+	auto iface_callback_map_iter = callbacks_map.find(ifname);
+	if (iface_callback_map_iter == callbacks_map.end())
+		return;
+	const auto &iface_callback_list = iface_callback_map_iter->second;
+	for (const auto &callback : iface_callback_list) {
+		method(callback);
+	}
+}
+
+template <class CallbackType>
+void callWithEachNetworkCallback(
+    const std::string &ifname, int network_id,
+    const std::function<
+	android::hardware::Return<void>(android::sp<CallbackType>)> &method,
+    const std::map<const std::string, std::vector<android::sp<CallbackType>>>
+	&callbacks_map)
+{
+	if (ifname.empty() || network_id < 0)
+		return;
+
+	// Generate the key to be used to lookup the network.
+	const std::string network_key =
+	    getNetworkObjectMapKey(ifname, network_id);
+	auto network_callback_map_iter = callbacks_map.find(network_key);
+	if (network_callback_map_iter == callbacks_map.end())
+		return;
+	const auto &network_callback_list = network_callback_map_iter->second;
+	for (const auto &callback : network_callback_list) {
+		method(callback);
+	}
+}
+}  // namespace
+
 namespace android {
 namespace hardware {
 namespace wifi {
@@ -66,17 +337,21 @@
 	// Using the corresponding ifname as key to our object map.
 	const std::string ifname(wpa_s->ifname);
 
-	// Return failure if we already have an object for that |ifname|.
-	if (iface_object_map_.find(ifname) != iface_object_map_.end())
-		return 1;
-
-	iface_object_map_[ifname] = new Iface(wpa_s->global, wpa_s->ifname);
-	if (!iface_object_map_[ifname].get())
-		return 1;
-
-	// Initialize the vector of callbacks for this object.
-	iface_callbacks_map_[ifname] =
-	    std::vector<android::sp<ISupplicantIfaceCallback>>();
+	if (isP2pIface(wpa_s)) {
+		if (addHidlObjectToMap<P2pIface>(
+			ifname, new P2pIface(wpa_s->global, wpa_s->ifname),
+			p2p_iface_object_map_))
+			return 1;
+		p2p_iface_callbacks_map_[ifname] =
+		    std::vector<android::sp<ISupplicantP2pIfaceCallback>>();
+	} else {
+		if (addHidlObjectToMap<StaIface>(
+			ifname, new StaIface(wpa_s->global, wpa_s->ifname),
+			sta_iface_object_map_))
+			return 1;
+		sta_iface_callbacks_map_[ifname] =
+		    std::vector<android::sp<ISupplicantStaIfaceCallback>>();
+	}
 
 	// Invoke the |onInterfaceCreated| method on all registered callbacks.
 	callWithEachSupplicantCallback(std::bind(
@@ -99,30 +374,21 @@
 
 	const std::string ifname(wpa_s->ifname);
 
-	if (iface_object_map_.find(ifname) == iface_object_map_.end())
-		return 1;
-
-	// Delete the corresponding iface object from our map.
-	iface_object_map_.erase(ifname);
-
-	// Delete all callbacks registered for this object.
-	auto iface_callback_map_iter = iface_callbacks_map_.find(ifname);
-	if (iface_callback_map_iter == iface_callbacks_map_.end())
-		return 1;
-	const auto &iface_callback_list = iface_callback_map_iter->second;
-#if 0   // TODO(b/31632518): HIDL object death notifications.
-	for (const auto &callback : iface_callback_list) {
-		if (android::hardware::IInterface::asBinder(callback)
-			->unlinkToDeath(nullptr, callback.get()) !=
-		    android::OK) {
-			wpa_printf(
-			    MSG_ERROR,
-			    "Error deregistering for death notification for "
-			    "iface callback object");
+	if (isP2pIface(wpa_s)) {
+		if (removeHidlObjectFromMap(ifname, p2p_iface_object_map_))
+			return 1;
+		if (removeAllIfaceCallbackHidlObjectsFromMap(
+			ifname, p2p_iface_callbacks_map_)) {
+			return 1;
+		}
+	} else {
+		if (removeHidlObjectFromMap(ifname, sta_iface_object_map_))
+			return 1;
+		if (removeAllIfaceCallbackHidlObjectsFromMap(
+			ifname, sta_iface_callbacks_map_)) {
+			return 1;
 		}
 	}
-#endif  // TODO(b/31632518): HIDL object death notifications.
-	iface_callbacks_map_.erase(iface_callback_map_iter);
 
 	// Invoke the |onInterfaceRemoved| method on all registered callbacks.
 	callWithEachSupplicantCallback(std::bind(
@@ -150,23 +416,37 @@
 	const std::string network_key =
 	    getNetworkObjectMapKey(wpa_s->ifname, ssid->id);
 
-	if (network_object_map_.find(network_key) != network_object_map_.end())
-		return 1;
-
-	network_object_map_[network_key] =
-	    new Network(wpa_s->global, wpa_s->ifname, ssid->id);
-	if (!network_object_map_[network_key].get())
-		return 1;
-
-	// Initialize the vector of callbacks for this object.
-	network_callbacks_map_[network_key] =
-	    std::vector<android::sp<ISupplicantNetworkCallback>>();
-
-	// Invoke the |onNetworkAdded| method on all registered callbacks.
-	callWithEachIfaceCallback(
-	    wpa_s->ifname, std::bind(
-			       &ISupplicantIfaceCallback::onNetworkAdded,
-			       std::placeholders::_1, ssid->id));
+	if (isP2pIface(wpa_s)) {
+		if (addHidlObjectToMap<P2pNetwork>(
+			network_key,
+			new P2pNetwork(wpa_s->global, wpa_s->ifname, ssid->id),
+			p2p_network_object_map_))
+			return 1;
+		p2p_network_callbacks_map_[network_key] =
+		    std::vector<android::sp<ISupplicantP2pNetworkCallback>>();
+		// Invoke the |onNetworkAdded| method on all registered
+		// callbacks.
+		callWithEachP2pIfaceCallback(
+		    wpa_s->ifname,
+		    std::bind(
+			&ISupplicantP2pIfaceCallback::onNetworkAdded,
+			std::placeholders::_1, ssid->id));
+	} else {
+		if (addHidlObjectToMap<StaNetwork>(
+			network_key,
+			new StaNetwork(wpa_s->global, wpa_s->ifname, ssid->id),
+			sta_network_object_map_))
+			return 1;
+		sta_network_callbacks_map_[network_key] =
+		    std::vector<android::sp<ISupplicantStaNetworkCallback>>();
+		// Invoke the |onNetworkAdded| method on all registered
+		// callbacks.
+		callWithEachStaIfaceCallback(
+		    wpa_s->ifname,
+		    std::bind(
+			&ISupplicantStaIfaceCallback::onNetworkAdded,
+			std::placeholders::_1, ssid->id));
+	}
 	return 0;
 }
 
@@ -189,38 +469,35 @@
 	const std::string network_key =
 	    getNetworkObjectMapKey(wpa_s->ifname, ssid->id);
 
-	if (network_object_map_.find(network_key) == network_object_map_.end())
-		return 1;
+	if (isP2pIface(wpa_s)) {
+		if (removeHidlObjectFromMap(network_key, p2p_iface_object_map_))
+			return 1;
+		if (removeAllNetworkCallbackHidlObjectsFromMap(
+			network_key, p2p_network_callbacks_map_))
+			return 1;
 
-	// Delete the corresponding network object from our map.
-	network_object_map_.erase(network_key);
+		// Invoke the |onNetworkRemoved| method on all registered
+		// callbacks.
+		callWithEachP2pIfaceCallback(
+		    wpa_s->ifname,
+		    std::bind(
+			&ISupplicantP2pIfaceCallback::onNetworkRemoved,
+			std::placeholders::_1, ssid->id));
+	} else {
+		if (removeHidlObjectFromMap(network_key, sta_iface_object_map_))
+			return 1;
+		if (removeAllNetworkCallbackHidlObjectsFromMap(
+			network_key, sta_network_callbacks_map_))
+			return 1;
 
-	// Delete all callbacks registered for this object.
-	auto network_callback_map_iter =
-	    network_callbacks_map_.find(network_key);
-	if (network_callback_map_iter == network_callbacks_map_.end())
-		return 1;
-	const auto &network_callback_list = network_callback_map_iter->second;
-#if 0   // TODO(b/31632518): HIDL object death notifications.
-	for (const auto &callback : network_callback_list) {
-		if (android::hardware::IInterface::asBinder(callback)
-			->unlinkToDeath(nullptr, callback.get()) !=
-		    android::OK) {
-			wpa_printf(
-			    MSG_ERROR,
-			    "Error deregistering for death "
-			    "notification for "
-			    "network callback object");
-		}
+		// Invoke the |onNetworkRemoved| method on all registered
+		// callbacks.
+		callWithEachStaIfaceCallback(
+		    wpa_s->ifname,
+		    std::bind(
+			&ISupplicantStaIfaceCallback::onNetworkRemoved,
+			std::placeholders::_1, ssid->id));
 	}
-#endif  // TODO(b/31632518): HIDL object death notifications.
-	network_callbacks_map_.erase(network_callback_map_iter);
-
-	// Invoke the |onNetworkRemoved| method on all registered callbacks.
-	callWithEachIfaceCallback(
-	    wpa_s->ifname, std::bind(
-			       &ISupplicantIfaceCallback::onNetworkRemoved,
-			       std::placeholders::_1, ssid->id));
 	return 0;
 }
 
@@ -236,12 +513,12 @@
 		return 1;
 
 	const std::string ifname(wpa_s->ifname);
-	if (iface_object_map_.find(ifname) == iface_object_map_.end())
+	if (sta_iface_object_map_.find(ifname) == sta_iface_object_map_.end())
 		return 1;
 
 	// Invoke the |onStateChanged| method on all registered callbacks.
-	ISupplicantIfaceCallback::State hidl_state =
-	    static_cast<ISupplicantIfaceCallback::State>(wpa_s->wpa_state);
+	ISupplicantStaIfaceCallback::State hidl_state =
+	    static_cast<ISupplicantStaIfaceCallback::State>(wpa_s->wpa_state);
 	hidl_array<uint8_t, 6> hidl_bssid;
 	os_memcpy(hidl_bssid.data(), wpa_s->bssid, ETH_ALEN);
 	uint32_t hidl_network_id = UINT32_MAX;
@@ -252,9 +529,9 @@
 		    wpa_s->current_ssid->ssid,
 		    wpa_s->current_ssid->ssid + wpa_s->current_ssid->ssid_len);
 	}
-	callWithEachIfaceCallback(
+	callWithEachStaIfaceCallback(
 	    wpa_s->ifname, std::bind(
-			       &ISupplicantIfaceCallback::onStateChanged,
+			       &ISupplicantStaIfaceCallback::onStateChanged,
 			       std::placeholders::_1, hidl_state, hidl_bssid,
 			       hidl_network_id, hidl_ssid));
 	return 0;
@@ -278,7 +555,8 @@
 
 	const std::string network_key =
 	    getNetworkObjectMapKey(wpa_s->ifname, ssid->id);
-	if (network_object_map_.find(network_key) == network_object_map_.end())
+	if (sta_network_object_map_.find(network_key) ==
+	    sta_network_object_map_.end())
 		return 1;
 
 	// TODO(b/31646740): Parse the param string to find the appropriate
@@ -287,7 +565,7 @@
 }
 
 /**
- * Retrieve the |ISupplicantIface| hidl object reference using the provided
+ * Retrieve the |ISupplicantP2pIface| hidl object reference using the provided
  * ifname.
  *
  * @param ifname Name of the corresponding interface.
@@ -295,14 +573,14 @@
  *
  * @return 0 on success, 1 on failure.
  */
-int HidlManager::getIfaceHidlObjectByIfname(
-    const std::string &ifname, android::sp<ISupplicantIface> *iface_object)
+int HidlManager::getP2pIfaceHidlObjectByIfname(
+    const std::string &ifname, android::sp<ISupplicantP2pIface> *iface_object)
 {
 	if (ifname.empty() || !iface_object)
 		return 1;
 
-	auto iface_object_iter = iface_object_map_.find(ifname);
-	if (iface_object_iter == iface_object_map_.end())
+	auto iface_object_iter = p2p_iface_object_map_.find(ifname);
+	if (iface_object_iter == p2p_iface_object_map_.end())
 		return 1;
 
 	*iface_object = iface_object_iter->second;
@@ -310,7 +588,30 @@
 }
 
 /**
- * Retrieve the |ISupplicantNetwork| hidl object reference using the provided
+ * Retrieve the |ISupplicantStaIface| hidl object reference using the provided
+ * ifname.
+ *
+ * @param ifname Name of the corresponding interface.
+ * @param iface_object Hidl reference corresponding to the iface.
+ *
+ * @return 0 on success, 1 on failure.
+ */
+int HidlManager::getStaIfaceHidlObjectByIfname(
+    const std::string &ifname, android::sp<ISupplicantStaIface> *iface_object)
+{
+	if (ifname.empty() || !iface_object)
+		return 1;
+
+	auto iface_object_iter = sta_iface_object_map_.find(ifname);
+	if (iface_object_iter == sta_iface_object_map_.end())
+		return 1;
+
+	*iface_object = iface_object_iter->second;
+	return 0;
+}
+
+/**
+ * Retrieve the |ISupplicantP2pNetwork| hidl object reference using the provided
  * ifname and network_id.
  *
  * @param ifname Name of the corresponding interface.
@@ -319,9 +620,9 @@
  *
  * @return 0 on success, 1 on failure.
  */
-int HidlManager::getNetworkHidlObjectByIfnameAndNetworkId(
+int HidlManager::getP2pNetworkHidlObjectByIfnameAndNetworkId(
     const std::string &ifname, int network_id,
-    android::sp<ISupplicantNetwork> *network_object)
+    android::sp<ISupplicantP2pNetwork> *network_object)
 {
 	if (ifname.empty() || network_id < 0 || !network_object)
 		return 1;
@@ -330,8 +631,37 @@
 	const std::string network_key =
 	    getNetworkObjectMapKey(ifname, network_id);
 
-	auto network_object_iter = network_object_map_.find(network_key);
-	if (network_object_iter == network_object_map_.end())
+	auto network_object_iter = p2p_network_object_map_.find(network_key);
+	if (network_object_iter == p2p_network_object_map_.end())
+		return 1;
+
+	*network_object = network_object_iter->second;
+	return 0;
+}
+
+/**
+ * Retrieve the |ISupplicantStaNetwork| hidl object reference using the provided
+ * ifname and network_id.
+ *
+ * @param ifname Name of the corresponding interface.
+ * @param network_id ID of the corresponding network.
+ * @param network_object Hidl reference corresponding to the network.
+ *
+ * @return 0 on success, 1 on failure.
+ */
+int HidlManager::getStaNetworkHidlObjectByIfnameAndNetworkId(
+    const std::string &ifname, int network_id,
+    android::sp<ISupplicantStaNetwork> *network_object)
+{
+	if (ifname.empty() || network_id < 0 || !network_object)
+		return 1;
+
+	// Generate the key to be used to lookup the network.
+	const std::string network_key =
+	    getNetworkObjectMapKey(ifname, network_id);
+
+	auto network_object_iter = sta_network_object_map_.find(network_key);
+	if (network_object_iter == sta_network_object_map_.end())
 		return 1;
 
 	*network_object = network_object_iter->second;
@@ -357,83 +687,97 @@
 	    ISupplicantCallback>(
 	    callback, on_hidl_died_fctor, supplicant_callbacks_);
 }
+
 /**
- * Add a new |ISupplicantIfaceCallback| hidl object reference to our
+ * Add a new iface callback hidl object reference to our
  * interface callback list.
  *
  * @param ifname Name of the corresponding interface.
- * @param callback Hidl reference of the |ISupplicantIfaceCallback| object.
+ * @param callback Hidl reference of the callback object.
  *
  * @return 0 on success, 1 on failure.
  */
-int HidlManager::addIfaceCallbackHidlObject(
+int HidlManager::addP2pIfaceCallbackHidlObject(
     const std::string &ifname,
-    const android::sp<ISupplicantIfaceCallback> &callback)
+    const android::sp<ISupplicantP2pIfaceCallback> &callback)
 {
-	if (ifname.empty())
-		return 1;
-
-	auto iface_callback_map_iter = iface_callbacks_map_.find(ifname);
-	if (iface_callback_map_iter == iface_callbacks_map_.end())
-		return 1;
-	auto &iface_callback_list = iface_callback_map_iter->second;
-
-	// Register for death notification before we add it to our list.
-	auto on_hidl_died_fctor = std::bind(
-	    &HidlManager::removeIfaceCallbackHidlObject, this, ifname,
-	    std::placeholders::_1);
-	return registerForDeathAndAddCallbackHidlObjectToList<
-	    ISupplicantIfaceCallback>(
-	    callback, on_hidl_died_fctor, iface_callback_list);
+	const std::function<void(
+	    const android::sp<ISupplicantP2pIfaceCallback> &)>
+	    on_hidl_died_fctor = std::bind(
+		&HidlManager::removeP2pIfaceCallbackHidlObject, this, ifname,
+		std::placeholders::_1);
+	return addIfaceCallbackHidlObjectToMap(
+	    ifname, callback, on_hidl_died_fctor, p2p_iface_callbacks_map_);
 }
 
 /**
- * Add a new |ISupplicantNetworkCallback| hidl object reference to our
- * network callback list.
+ * Add a new iface callback hidl object reference to our
+ * interface callback list.
  *
  * @param ifname Name of the corresponding interface.
- * @param network_id ID of the corresponding network.
- * @param callback Hidl reference of the |ISupplicantNetworkCallback| object.
+ * @param callback Hidl reference of the callback object.
  *
  * @return 0 on success, 1 on failure.
  */
-int HidlManager::addNetworkCallbackHidlObject(
-    const std::string &ifname, int network_id,
-    const android::sp<ISupplicantNetworkCallback> &callback)
+int HidlManager::addStaIfaceCallbackHidlObject(
+    const std::string &ifname,
+    const android::sp<ISupplicantStaIfaceCallback> &callback)
 {
-	if (ifname.empty() || network_id < 0)
-		return 1;
-
-	// Generate the key to be used to lookup the network.
-	const std::string network_key =
-	    getNetworkObjectMapKey(ifname, network_id);
-	auto network_callback_map_iter =
-	    network_callbacks_map_.find(network_key);
-	if (network_callback_map_iter == network_callbacks_map_.end())
-		return 1;
-	auto &network_callback_list = network_callback_map_iter->second;
-
-	// Register for death notification before we add it to our list.
-	auto on_hidl_died_fctor = std::bind(
-	    &HidlManager::removeNetworkCallbackHidlObject, this, ifname,
-	    network_id, std::placeholders::_1);
-	return registerForDeathAndAddCallbackHidlObjectToList<
-	    ISupplicantNetworkCallback>(
-	    callback, on_hidl_died_fctor, network_callback_list);
+	const std::function<void(
+	    const android::sp<ISupplicantStaIfaceCallback> &)>
+	    on_hidl_died_fctor = std::bind(
+		&HidlManager::removeStaIfaceCallbackHidlObject, this, ifname,
+		std::placeholders::_1);
+	return addIfaceCallbackHidlObjectToMap(
+	    ifname, callback, on_hidl_died_fctor, sta_iface_callbacks_map_);
 }
 
 /**
- * Creates a unique key for the network using the provided |ifname| and
- * |network_id| to be used in the internal map of |ISupplicantNetwork| objects.
- * This is of the form |ifname|_|network_id|. For ex: "wlan0_1".
+ * Add a new network callback hidl object reference to our network callback
+ * list.
  *
  * @param ifname Name of the corresponding interface.
  * @param network_id ID of the corresponding network.
+ * @param callback Hidl reference of the callback object.
+ *
+ * @return 0 on success, 1 on failure.
  */
-const std::string HidlManager::getNetworkObjectMapKey(
-    const std::string &ifname, int network_id)
+int HidlManager::addP2pNetworkCallbackHidlObject(
+    const std::string &ifname, int network_id,
+    const android::sp<ISupplicantP2pNetworkCallback> &callback)
 {
-	return ifname + "_" + std::to_string(network_id);
+	const std::function<void(
+	    const android::sp<ISupplicantP2pNetworkCallback> &)>
+	    on_hidl_died_fctor = std::bind(
+		&HidlManager::removeP2pNetworkCallbackHidlObject, this, ifname,
+		network_id, std::placeholders::_1);
+	return addNetworkCallbackHidlObjectToMap(
+	    ifname, network_id, callback, on_hidl_died_fctor,
+	    p2p_network_callbacks_map_);
+}
+
+/**
+ * Add a new network callback hidl object reference to our network callback
+ * list.
+ *
+ * @param ifname Name of the corresponding interface.
+ * @param network_id ID of the corresponding network.
+ * @param callback Hidl reference of the callback object.
+ *
+ * @return 0 on success, 1 on failure.
+ */
+int HidlManager::addStaNetworkCallbackHidlObject(
+    const std::string &ifname, int network_id,
+    const android::sp<ISupplicantStaNetworkCallback> &callback)
+{
+	const std::function<void(
+	    const android::sp<ISupplicantStaNetworkCallback> &)>
+	    on_hidl_died_fctor = std::bind(
+		&HidlManager::removeStaNetworkCallbackHidlObject, this, ifname,
+		network_id, std::placeholders::_1);
+	return addNetworkCallbackHidlObjectToMap(
+	    ifname, network_id, callback, on_hidl_died_fctor,
+	    sta_network_callbacks_map_);
 }
 
 /**
@@ -453,101 +797,65 @@
 }
 
 /**
- * Removes the provided |ISupplicantIfaceCallback| hidl object reference from
+ * Removes the provided iface callback hidl object reference from
  * our interface callback list.
  *
  * @param ifname Name of the corresponding interface.
- * @param callback Hidl reference of the |ISupplicantIfaceCallback| object.
+ * @param callback Hidl reference of the callback object.
  */
-void HidlManager::removeIfaceCallbackHidlObject(
+void HidlManager::removeP2pIfaceCallbackHidlObject(
     const std::string &ifname,
-    const android::sp<ISupplicantIfaceCallback> &callback)
+    const android::sp<ISupplicantP2pIfaceCallback> &callback)
 {
-	if (ifname.empty())
-		return;
-
-	auto iface_callback_map_iter = iface_callbacks_map_.find(ifname);
-	if (iface_callback_map_iter == iface_callbacks_map_.end())
-		return;
-
-	auto &iface_callback_list = iface_callback_map_iter->second;
-	iface_callback_list.erase(
-	    std::remove(
-		iface_callback_list.begin(), iface_callback_list.end(),
-		callback),
-	    iface_callback_list.end());
+	return removeIfaceCallbackHidlObjectFromMap(
+	    ifname, callback, p2p_iface_callbacks_map_);
 }
 
 /**
- * Removes the provided |ISupplicantNetworkCallback| hidl object reference from
+ * Removes the provided iface callback hidl object reference from
+ * our interface callback list.
+ *
+ * @param ifname Name of the corresponding interface.
+ * @param callback Hidl reference of the callback object.
+ */
+void HidlManager::removeStaIfaceCallbackHidlObject(
+    const std::string &ifname,
+    const android::sp<ISupplicantStaIfaceCallback> &callback)
+{
+	return removeIfaceCallbackHidlObjectFromMap(
+	    ifname, callback, sta_iface_callbacks_map_);
+}
+
+/**
+ * Removes the provided network callback hidl object reference from
  * our network callback list.
  *
  * @param ifname Name of the corresponding interface.
  * @param network_id ID of the corresponding network.
- * @param callback Hidl reference of the |ISupplicantNetworkCallback| object.
+ * @param callback Hidl reference of the callback object.
  */
-void HidlManager::removeNetworkCallbackHidlObject(
+void HidlManager::removeP2pNetworkCallbackHidlObject(
     const std::string &ifname, int network_id,
-    const android::sp<ISupplicantNetworkCallback> &callback)
+    const android::sp<ISupplicantP2pNetworkCallback> &callback)
 {
-	if (ifname.empty() || network_id < 0)
-		return;
-
-	// Generate the key to be used to lookup the network.
-	const std::string network_key =
-	    getNetworkObjectMapKey(ifname, network_id);
-
-	auto network_callback_map_iter =
-	    network_callbacks_map_.find(network_key);
-	if (network_callback_map_iter == network_callbacks_map_.end())
-		return;
-
-	auto &network_callback_list = network_callback_map_iter->second;
-	network_callback_list.erase(
-	    std::remove(
-		network_callback_list.begin(), network_callback_list.end(),
-		callback),
-	    network_callback_list.end());
+	return removeNetworkCallbackHidlObjectFromMap(
+	    ifname, network_id, callback, p2p_network_callbacks_map_);
 }
 
 /**
- * Add callback to the corresponding list after linking to death on the
- * corresponding hidl object reference.
+ * Removes the provided network callback hidl object reference from
+ * our network callback list.
  *
- * @param callback Hidl reference of the |ISupplicantNetworkCallback| object.
- *
- * @return 0 on success, 1 on failure.
+ * @param ifname Name of the corresponding interface.
+ * @param network_id ID of the corresponding network.
+ * @param callback Hidl reference of the callback object.
  */
-template <class CallbackType>
-int HidlManager::registerForDeathAndAddCallbackHidlObjectToList(
-    const android::sp<CallbackType> &callback,
-    const std::function<void(const android::sp<CallbackType> &)>
-	&on_hidl_died_fctor,
-    std::vector<android::sp<CallbackType>> &callback_list)
+void HidlManager::removeStaNetworkCallbackHidlObject(
+    const std::string &ifname, int network_id,
+    const android::sp<ISupplicantStaNetworkCallback> &callback)
 {
-	auto death_notifier = new CallbackObjectDeathNotifier<CallbackType>(
-	    callback, on_hidl_died_fctor);
-	// Use the |callback.get()| as cookie so that we don't need to
-	// store a reference to this |CallbackObjectDeathNotifier| instance
-	// to use in |unlinkToDeath| later.
-	// NOTE: This may cause an immediate callback if the object is already
-	// dead, so add it to the list before we register for callback!
-	callback_list.push_back(callback);
-#if 0   // TODO(b/31632518): HIDL object death notifications.
-	if (android::hardware::IInterface::asBinder(callback)->linkToDeath(
-		death_notifier, callback.get()) != android::OK) {
-		wpa_printf(
-		    MSG_ERROR,
-		    "Error registering for death notification for "
-		    "supplicant callback object");
-		callback_list.erase(
-		    std::remove(
-			callback_list.begin(), callback_list.end(), callback),
-		    callback_list.end());
-		return 1;
-	}
-#endif  // TODO(b/31632518): HIDL object death notifications.
-	return 0;
+	return removeNetworkCallbackHidlObjectFromMap(
+	    ifname, network_id, callback, sta_network_callbacks_map_);
 }
 
 /**
@@ -567,62 +875,75 @@
 
 /**
  * Helper fucntion to invoke the provided callback method on all the
- * registered |ISupplicantIfaceCallback| callback hidl objects for the specified
+ * registered iface callback hidl objects for the specified
  * |ifname|.
  *
  * @param ifname Name of the corresponding interface.
  * @param method Pointer to the required hidl method from
  * |ISupplicantIfaceCallback|.
  */
-void HidlManager::callWithEachIfaceCallback(
+void HidlManager::callWithEachP2pIfaceCallback(
     const std::string &ifname,
-    const std::function<Return<void>(android::sp<ISupplicantIfaceCallback>)>
+    const std::function<Return<void>(android::sp<ISupplicantP2pIfaceCallback>)>
 	&method)
 {
-	if (ifname.empty())
-		return;
+	callWithEachIfaceCallback(ifname, method, p2p_iface_callbacks_map_);
+}
 
-	auto iface_callback_map_iter = iface_callbacks_map_.find(ifname);
-	if (iface_callback_map_iter == iface_callbacks_map_.end())
-		return;
-	const auto &iface_callback_list = iface_callback_map_iter->second;
-	for (const auto &callback : iface_callback_list) {
-		method(callback);
-	}
+/**
+ * Helper fucntion to invoke the provided callback method on all the
+ * registered iface callback hidl objects for the specified
+ * |ifname|.
+ *
+ * @param ifname Name of the corresponding interface.
+ * @param method Pointer to the required hidl method from
+ * |ISupplicantIfaceCallback|.
+ */
+void HidlManager::callWithEachStaIfaceCallback(
+    const std::string &ifname,
+    const std::function<Return<void>(android::sp<ISupplicantStaIfaceCallback>)>
+	&method)
+{
+	callWithEachIfaceCallback(ifname, method, sta_iface_callbacks_map_);
 }
 
 /**
  * Helper function to invoke the provided callback method on all the
- * registered |ISupplicantNetworkCallback| callback hidl objects for the
- * specified
+ * registered network callback hidl objects for the specified
  * |ifname| & |network_id|.
  *
  * @param ifname Name of the corresponding interface.
  * @param network_id ID of the corresponding network.
  * @param method Pointer to the required hidl method from
- * |ISupplicantNetworkCallback|.
+ * |ISupplicantP2pNetworkCallback| or |ISupplicantStaNetworkCallback| .
  */
-void HidlManager::callWithEachNetworkCallback(
+void HidlManager::callWithEachP2pNetworkCallback(
     const std::string &ifname, int network_id,
-    const std::function<Return<void>(android::sp<ISupplicantNetworkCallback>)>
-	&method)
+    const std::function<
+	Return<void>(android::sp<ISupplicantP2pNetworkCallback>)> &method)
 {
-	if (ifname.empty() || network_id < 0)
-		return;
-
-	// Generate the key to be used to lookup the network.
-	const std::string network_key =
-	    getNetworkObjectMapKey(ifname, network_id);
-	auto network_callback_map_iter =
-	    network_callbacks_map_.find(network_key);
-	if (network_callback_map_iter == network_callbacks_map_.end())
-		return;
-	const auto &network_callback_list = network_callback_map_iter->second;
-	for (const auto &callback : network_callback_list) {
-		method(callback);
-	}
+	callWithEachNetworkCallback(
+	    ifname, network_id, method, p2p_network_callbacks_map_);
 }
 
+/**
+ * Helper function to invoke the provided callback method on all the
+ * registered network callback hidl objects for the specified
+ * |ifname| & |network_id|.
+ *
+ * @param ifname Name of the corresponding interface.
+ * @param network_id ID of the corresponding network.
+ * @param method Pointer to the required hidl method from
+ * |ISupplicantP2pNetworkCallback| or |ISupplicantStaNetworkCallback| .
+ */
+void HidlManager::callWithEachStaNetworkCallback(
+    const std::string &ifname, int network_id,
+    const std::function<
+	Return<void>(android::sp<ISupplicantStaNetworkCallback>)> &method)
+{
+	callWithEachNetworkCallback(
+	    ifname, network_id, method, sta_network_callbacks_map_);
+}
 }  // namespace implementation
 }  // namespace V1_0
 }  // namespace wifi
diff --git a/wpa_supplicant/hidl/hidl_manager.h b/wpa_supplicant/hidl/hidl_manager.h
index f226d2d..0678b10 100644
--- a/wpa_supplicant/hidl/hidl_manager.h
+++ b/wpa_supplicant/hidl/hidl_manager.h
@@ -14,15 +14,23 @@
 #include <string>
 
 #include <android/hardware/wifi/supplicant/1.0/ISupplicantCallback.h>
-#include <android/hardware/wifi/supplicant/1.0/ISupplicantIfaceCallback.h>
-#include <android/hardware/wifi/supplicant/1.0/ISupplicantNetworkCallback.h>
+#include <android/hardware/wifi/supplicant/1.0/ISupplicantP2pIfaceCallback.h>
+#include <android/hardware/wifi/supplicant/1.0/ISupplicantP2pNetworkCallback.h>
+#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.h>
+#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaNetworkCallback.h>
 
-#include "iface.h"
-#include "network.h"
+#include "p2p_iface.h"
+#include "p2p_network.h"
+#include "sta_iface.h"
+#include "sta_network.h"
 #include "supplicant.h"
 
-struct wpa_global;
-struct wpa_supplicant;
+extern "C" {
+#include "utils/common.h"
+#include "utils/includes.h"
+#include "wpa_supplicant_i.h"
+#include "driver_i.h"
+}
 
 namespace android {
 namespace hardware {
@@ -57,28 +65,32 @@
 	    const char *param);
 
 	// Methods called from hidl objects.
-	int getIfaceHidlObjectByIfname(
+	int getP2pIfaceHidlObjectByIfname(
 	    const std::string &ifname,
-	    android::sp<
-		android::hardware::wifi::supplicant::V1_0::ISupplicantIface>
-		*iface_object);
-	int getNetworkHidlObjectByIfnameAndNetworkId(
+	    android::sp<ISupplicantP2pIface> *iface_object);
+	int getStaIfaceHidlObjectByIfname(
+	    const std::string &ifname,
+	    android::sp<ISupplicantStaIface> *iface_object);
+	int getP2pNetworkHidlObjectByIfnameAndNetworkId(
 	    const std::string &ifname, int network_id,
-	    android::sp<
-		android::hardware::wifi::supplicant::V1_0::ISupplicantNetwork>
-		*network_object);
+	    android::sp<ISupplicantP2pNetwork> *network_object);
+	int getStaNetworkHidlObjectByIfnameAndNetworkId(
+	    const std::string &ifname, int network_id,
+	    android::sp<ISupplicantStaNetwork> *network_object);
 	int addSupplicantCallbackHidlObject(
-	    const android::sp<
-		android::hardware::wifi::supplicant::V1_0::ISupplicantCallback>
-		&callback);
-	int addIfaceCallbackHidlObject(
+	    const android::sp<ISupplicantCallback> &callback);
+	int addP2pIfaceCallbackHidlObject(
 	    const std::string &ifname,
-	    const android::sp<android::hardware::wifi::supplicant::V1_0::
-				  ISupplicantIfaceCallback> &callback);
-	int addNetworkCallbackHidlObject(
+	    const android::sp<ISupplicantP2pIfaceCallback> &callback);
+	int addStaIfaceCallbackHidlObject(
+	    const std::string &ifname,
+	    const android::sp<ISupplicantStaIfaceCallback> &callback);
+	int addP2pNetworkCallbackHidlObject(
 	    const std::string &ifname, int network_id,
-	    const android::sp<android::hardware::wifi::supplicant::V1_0::
-				  ISupplicantNetworkCallback> &callback);
+	    const android::sp<ISupplicantP2pNetworkCallback> &callback);
+	int addStaNetworkCallbackHidlObject(
+	    const std::string &ifname, int network_id,
+	    const android::sp<ISupplicantStaNetworkCallback> &callback);
 
 private:
 	HidlManager() = default;
@@ -86,42 +98,40 @@
 	HidlManager(const HidlManager &) = default;
 	HidlManager &operator=(const HidlManager &) = default;
 
-	const std::string getNetworkObjectMapKey(
-	    const std::string &ifname, int network_id);
-
 	void removeSupplicantCallbackHidlObject(
-	    const android::sp<
-		android::hardware::wifi::supplicant::V1_0::ISupplicantCallback>
-		&callback);
-	void removeIfaceCallbackHidlObject(
+	    const android::sp<ISupplicantCallback> &callback);
+	void removeP2pIfaceCallbackHidlObject(
 	    const std::string &ifname,
-	    const android::sp<android::hardware::wifi::supplicant::V1_0::
-				  ISupplicantIfaceCallback> &callback);
-	void removeNetworkCallbackHidlObject(
+	    const android::sp<ISupplicantP2pIfaceCallback> &callback);
+	void removeStaIfaceCallbackHidlObject(
+	    const std::string &ifname,
+	    const android::sp<ISupplicantStaIfaceCallback> &callback);
+	void removeP2pNetworkCallbackHidlObject(
 	    const std::string &ifname, int network_id,
-	    const android::sp<android::hardware::wifi::supplicant::V1_0::
-				  ISupplicantNetworkCallback> &callback);
-	template <class CallbackType>
-	int registerForDeathAndAddCallbackHidlObjectToList(
-	    const android::sp<CallbackType> &callback,
-	    const std::function<void(const android::sp<CallbackType> &)>
-		&on_hidl_died_fctor,
-	    std::vector<android::sp<CallbackType>> &callback_list);
+	    const android::sp<ISupplicantP2pNetworkCallback> &callback);
+	void removeStaNetworkCallbackHidlObject(
+	    const std::string &ifname, int network_id,
+	    const android::sp<ISupplicantStaNetworkCallback> &callback);
 
 	void callWithEachSupplicantCallback(
 	    const std::function<android::hardware::Return<void>(
-		android::sp<android::hardware::wifi::supplicant::V1_0::
-				ISupplicantCallback>)> &method);
-	void callWithEachIfaceCallback(
+		android::sp<ISupplicantCallback>)> &method);
+	void callWithEachP2pIfaceCallback(
 	    const std::string &ifname,
 	    const std::function<android::hardware::Return<void>(
-		android::sp<android::hardware::wifi::supplicant::V1_0::
-				ISupplicantIfaceCallback>)> &method);
-	void callWithEachNetworkCallback(
+		android::sp<ISupplicantP2pIfaceCallback>)> &method);
+	void callWithEachStaIfaceCallback(
+	    const std::string &ifname,
+	    const std::function<android::hardware::Return<void>(
+		android::sp<ISupplicantStaIfaceCallback>)> &method);
+	void callWithEachP2pNetworkCallback(
 	    const std::string &ifname, int network_id,
 	    const std::function<android::hardware::Return<void>(
-		android::sp<android::hardware::wifi::supplicant::V1_0::
-				ISupplicantNetworkCallback>)> &method);
+		android::sp<ISupplicantP2pNetworkCallback>)> &method);
+	void callWithEachStaNetworkCallback(
+	    const std::string &ifname, int network_id,
+	    const std::function<android::hardware::Return<void>(
+		android::sp<ISupplicantStaNetworkCallback>)> &method);
 
 	// HIDL Service name.
 	static const char kServiceName[];
@@ -129,35 +139,57 @@
 	static HidlManager *instance_;
 	// The main hidl service object.
 	android::sp<Supplicant> supplicant_object_;
-	// Map of all the interface specific hidl objects controlled by
+	// Map of all the P2P interface specific hidl objects controlled by
 	// wpa_supplicant. This map is keyed in by the corresponding
 	// |ifname|.
-	std::map<const std::string, android::sp<Iface>> iface_object_map_;
-	// Map of all the network specific hidl objects controlled by
+	std::map<const std::string, android::sp<P2pIface>>
+	    p2p_iface_object_map_;
+	// Map of all the STA interface specific hidl objects controlled by
+	// wpa_supplicant. This map is keyed in by the corresponding
+	// |ifname|.
+	std::map<const std::string, android::sp<StaIface>>
+	    sta_iface_object_map_;
+	// Map of all the P2P network specific hidl objects controlled by
 	// wpa_supplicant. This map is keyed in by the corresponding
 	// |ifname| & |network_id|.
-	std::map<const std::string, android::sp<Network>> network_object_map_;
+	std::map<const std::string, android::sp<P2pNetwork>>
+	    p2p_network_object_map_;
+	// Map of all the STA network specific hidl objects controlled by
+	// wpa_supplicant. This map is keyed in by the corresponding
+	// |ifname| & |network_id|.
+	std::map<const std::string, android::sp<StaNetwork>>
+	    sta_network_object_map_;
 
 	// Callback registered for the main hidl service object.
-	std::vector<android::sp<
-	    android::hardware::wifi::supplicant::V1_0::ISupplicantCallback>>
-	    supplicant_callbacks_;
-	// Map of all the callbacks registered for interface specific
+	std::vector<android::sp<ISupplicantCallback>> supplicant_callbacks_;
+	// Map of all the callbacks registered for P2P interface specific
 	// hidl objects controlled by wpa_supplicant.  This map is keyed in by
 	// the corresponding |ifname|.
 	std::map<
 	    const std::string,
-	    std::vector<android::sp<android::hardware::wifi::supplicant::V1_0::
-					ISupplicantIfaceCallback>>>
-	    iface_callbacks_map_;
-	// Map of all the callbacks registered for network specific
+	    std::vector<android::sp<ISupplicantP2pIfaceCallback>>>
+	    p2p_iface_callbacks_map_;
+	// Map of all the callbacks registered for STA interface specific
+	// hidl objects controlled by wpa_supplicant.  This map is keyed in by
+	// the corresponding |ifname|.
+	std::map<
+	    const std::string,
+	    std::vector<android::sp<ISupplicantStaIfaceCallback>>>
+	    sta_iface_callbacks_map_;
+	// Map of all the callbacks registered for P2P network specific
 	// hidl objects controlled by wpa_supplicant.  This map is keyed in by
 	// the corresponding |ifname| & |network_id|.
 	std::map<
 	    const std::string,
-	    std::vector<android::sp<android::hardware::wifi::supplicant::V1_0::
-					ISupplicantNetworkCallback>>>
-	    network_callbacks_map_;
+	    std::vector<android::sp<ISupplicantP2pNetworkCallback>>>
+	    p2p_network_callbacks_map_;
+	// Map of all the callbacks registered for STA network specific
+	// hidl objects controlled by wpa_supplicant.  This map is keyed in by
+	// the corresponding |ifname| & |network_id|.
+	std::map<
+	    const std::string,
+	    std::vector<android::sp<ISupplicantStaNetworkCallback>>>
+	    sta_network_callbacks_map_;
 
 	/**
 	 * Helper class used to deregister the callback object reference from
@@ -196,109 +228,87 @@
 // avoid nasty runtime conversion functions. So, adding compile time asserts
 // to guard against any internal changes breaking the hidl interface.
 static_assert(
-    static_cast<uint32_t>(android::hardware::wifi::supplicant::V1_0::
-			      ISupplicant::DebugLevel::EXCESSIVE) ==
-	MSG_EXCESSIVE,
+    static_cast<uint32_t>(ISupplicant::DebugLevel::EXCESSIVE) == MSG_EXCESSIVE,
     "Debug level value mismatch");
 static_assert(
-    static_cast<uint32_t>(android::hardware::wifi::supplicant::V1_0::
-			      ISupplicant::DebugLevel::ERROR) == MSG_ERROR,
+    static_cast<uint32_t>(ISupplicant::DebugLevel::ERROR) == MSG_ERROR,
     "Debug level value mismatch");
 
 static_assert(
-    static_cast<uint32_t>(android::hardware::wifi::supplicant::V1_0::
-			      ISupplicantNetwork::KeyMgmtMask::NONE) ==
+    static_cast<uint32_t>(ISupplicantStaNetwork::KeyMgmtMask::NONE) ==
 	WPA_KEY_MGMT_NONE,
     "KeyMgmt value mismatch");
 static_assert(
-    static_cast<uint32_t>(android::hardware::wifi::supplicant::V1_0::
-			      ISupplicantNetwork::KeyMgmtMask::WPA_PSK) ==
+    static_cast<uint32_t>(ISupplicantStaNetwork::KeyMgmtMask::WPA_PSK) ==
 	WPA_KEY_MGMT_PSK,
     "KeyMgmt value mismatch");
 static_assert(
-    static_cast<uint32_t>(android::hardware::wifi::supplicant::V1_0::
-			      ISupplicantNetwork::KeyMgmtMask::WPA_EAP) ==
+    static_cast<uint32_t>(ISupplicantStaNetwork::KeyMgmtMask::WPA_EAP) ==
 	WPA_KEY_MGMT_IEEE8021X,
     "KeyMgmt value mismatch");
 static_assert(
-    static_cast<uint32_t>(android::hardware::wifi::supplicant::V1_0::
-			      ISupplicantNetwork::KeyMgmtMask::IEEE8021X) ==
+    static_cast<uint32_t>(ISupplicantStaNetwork::KeyMgmtMask::IEEE8021X) ==
 	WPA_KEY_MGMT_IEEE8021X_NO_WPA,
     "KeyMgmt value mismatch");
 static_assert(
-    static_cast<uint32_t>(android::hardware::wifi::supplicant::V1_0::
-			      ISupplicantNetwork::ProtoMask::WPA) ==
+    static_cast<uint32_t>(ISupplicantStaNetwork::ProtoMask::WPA) ==
 	WPA_PROTO_WPA,
     "Proto value mismatch");
 static_assert(
-    static_cast<uint32_t>(android::hardware::wifi::supplicant::V1_0::
-			      ISupplicantNetwork::ProtoMask::RSN) ==
+    static_cast<uint32_t>(ISupplicantStaNetwork::ProtoMask::RSN) ==
 	WPA_PROTO_RSN,
     "Proto value mismatch");
 static_assert(
-    static_cast<uint32_t>(android::hardware::wifi::supplicant::V1_0::
-			      ISupplicantNetwork::ProtoMask::OSEN) ==
+    static_cast<uint32_t>(ISupplicantStaNetwork::ProtoMask::OSEN) ==
 	WPA_PROTO_OSEN,
     "Proto value mismatch");
 static_assert(
-    static_cast<uint32_t>(android::hardware::wifi::supplicant::V1_0::
-			      ISupplicantNetwork::AuthAlgMask::OPEN) ==
+    static_cast<uint32_t>(ISupplicantStaNetwork::AuthAlgMask::OPEN) ==
 	WPA_AUTH_ALG_OPEN,
     "AuthAlg value mismatch");
 static_assert(
-    static_cast<uint32_t>(android::hardware::wifi::supplicant::V1_0::
-			      ISupplicantNetwork::AuthAlgMask::SHARED) ==
+    static_cast<uint32_t>(ISupplicantStaNetwork::AuthAlgMask::SHARED) ==
 	WPA_AUTH_ALG_SHARED,
     "AuthAlg value mismatch");
 static_assert(
-    static_cast<uint32_t>(android::hardware::wifi::supplicant::V1_0::
-			      ISupplicantNetwork::AuthAlgMask::LEAP) ==
+    static_cast<uint32_t>(ISupplicantStaNetwork::AuthAlgMask::LEAP) ==
 	WPA_AUTH_ALG_LEAP,
     "AuthAlg value mismatch");
 static_assert(
-    static_cast<uint32_t>(android::hardware::wifi::supplicant::V1_0::
-			      ISupplicantNetwork::GroupCipherMask::WEP40) ==
+    static_cast<uint32_t>(ISupplicantStaNetwork::GroupCipherMask::WEP40) ==
 	WPA_CIPHER_WEP40,
     "GroupCipher value mismatch");
 static_assert(
-    static_cast<uint32_t>(android::hardware::wifi::supplicant::V1_0::
-			      ISupplicantNetwork::GroupCipherMask::WEP104) ==
+    static_cast<uint32_t>(ISupplicantStaNetwork::GroupCipherMask::WEP104) ==
 	WPA_CIPHER_WEP104,
     "GroupCipher value mismatch");
 static_assert(
-    static_cast<uint32_t>(android::hardware::wifi::supplicant::V1_0::
-			      ISupplicantNetwork::GroupCipherMask::TKIP) ==
+    static_cast<uint32_t>(ISupplicantStaNetwork::GroupCipherMask::TKIP) ==
 	WPA_CIPHER_TKIP,
     "GroupCipher value mismatch");
 static_assert(
-    static_cast<uint32_t>(android::hardware::wifi::supplicant::V1_0::
-			      ISupplicantNetwork::GroupCipherMask::CCMP) ==
+    static_cast<uint32_t>(ISupplicantStaNetwork::GroupCipherMask::CCMP) ==
 	WPA_CIPHER_CCMP,
     "GroupCipher value mismatch");
 static_assert(
-    static_cast<uint32_t>(android::hardware::wifi::supplicant::V1_0::
-			      ISupplicantNetwork::PairwiseCipherMask::NONE) ==
+    static_cast<uint32_t>(ISupplicantStaNetwork::PairwiseCipherMask::NONE) ==
 	WPA_CIPHER_NONE,
     "PairwiseCipher value mismatch");
 static_assert(
-    static_cast<uint32_t>(android::hardware::wifi::supplicant::V1_0::
-			      ISupplicantNetwork::PairwiseCipherMask::TKIP) ==
+    static_cast<uint32_t>(ISupplicantStaNetwork::PairwiseCipherMask::TKIP) ==
 	WPA_CIPHER_TKIP,
     "PairwiseCipher value mismatch");
 static_assert(
-    static_cast<uint32_t>(android::hardware::wifi::supplicant::V1_0::
-			      ISupplicantNetwork::PairwiseCipherMask::CCMP) ==
+    static_cast<uint32_t>(ISupplicantStaNetwork::PairwiseCipherMask::CCMP) ==
 	WPA_CIPHER_CCMP,
     "PairwiseCipher value mismatch");
 
 static_assert(
-    static_cast<uint32_t>(android::hardware::wifi::supplicant::V1_0::
-			      ISupplicantIfaceCallback::State::DISCONNECTED) ==
+    static_cast<uint32_t>(ISupplicantStaIfaceCallback::State::DISCONNECTED) ==
 	WPA_DISCONNECTED,
     "State value mismatch");
 static_assert(
-    static_cast<uint32_t>(android::hardware::wifi::supplicant::V1_0::
-			      ISupplicantIfaceCallback::State::COMPLETED) ==
+    static_cast<uint32_t>(ISupplicantStaIfaceCallback::State::COMPLETED) ==
 	WPA_COMPLETED,
     "State value mismatch");
 
diff --git a/wpa_supplicant/hidl/p2p_iface.cpp b/wpa_supplicant/hidl/p2p_iface.cpp
new file mode 100644
index 0000000..e9ee986
--- /dev/null
+++ b/wpa_supplicant/hidl/p2p_iface.cpp
@@ -0,0 +1,170 @@
+/*
+ * hidl interface for wpa_supplicant daemon
+ * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+#include "hidl_manager.h"
+#include "hidl_return_macros.h"
+#include "p2p_iface.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace supplicant {
+namespace V1_0 {
+namespace implementation {
+
+P2pIface::P2pIface(struct wpa_global *wpa_global, const char ifname[])
+    : wpa_global_(wpa_global), ifname_(ifname)
+{
+}
+
+Return<void> P2pIface::getName(getName_cb _hidl_cb)
+{
+	struct wpa_supplicant *wpa_s = retrieveP2pIfacePtr();
+	if (!wpa_s) {
+		HIDL_RETURN(
+		    SupplicantStatusCode::FAILURE_IFACE_INVALID, ifname_);
+	}
+
+	HIDL_RETURN(SupplicantStatusCode::SUCCESS, ifname_);
+}
+
+Return<void> P2pIface::getType(getType_cb _hidl_cb)
+{
+	struct wpa_supplicant *wpa_s = retrieveP2pIfacePtr();
+	if (!wpa_s) {
+		HIDL_RETURN(
+		    SupplicantStatusCode::FAILURE_IFACE_INVALID,
+		    IfaceType::STA);
+	}
+
+	HIDL_RETURN(SupplicantStatusCode::SUCCESS, IfaceType::STA);
+}
+
+Return<void> P2pIface::addNetwork(addNetwork_cb _hidl_cb)
+{
+	android::sp<ISupplicantP2pNetwork> network;
+	struct wpa_supplicant *wpa_s = retrieveP2pIfacePtr();
+	if (!wpa_s) {
+		HIDL_RETURN(
+		    SupplicantStatusCode::FAILURE_IFACE_INVALID, network);
+	}
+
+	struct wpa_ssid *ssid = wpa_supplicant_add_network(wpa_s);
+	if (!ssid) {
+		HIDL_RETURN(SupplicantStatusCode::FAILURE_UNKNOWN, network);
+	}
+
+	HidlManager *hidl_manager = HidlManager::getInstance();
+	if (!hidl_manager ||
+	    hidl_manager->getP2pNetworkHidlObjectByIfnameAndNetworkId(
+		wpa_s->ifname, ssid->id, &network)) {
+		HIDL_RETURN(SupplicantStatusCode::FAILURE_UNKNOWN, network);
+	}
+
+	HIDL_RETURN(SupplicantStatusCode::SUCCESS, network);
+}
+
+Return<void> P2pIface::removeNetwork(uint32_t id, removeNetwork_cb _hidl_cb)
+{
+	struct wpa_supplicant *wpa_s = retrieveP2pIfacePtr();
+	if (!wpa_s) {
+		HIDL_RETURN(SupplicantStatusCode::FAILURE_IFACE_INVALID);
+	}
+
+	int result = wpa_supplicant_remove_network(wpa_s, id);
+	if (result == -1) {
+		HIDL_RETURN(SupplicantStatusCode::FAILURE_NETWORK_UNKNOWN);
+	}
+
+	if (result != 0) {
+		HIDL_RETURN(SupplicantStatusCode::FAILURE_UNKNOWN);
+	}
+
+	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
+}
+
+Return<void> P2pIface::getNetwork(uint32_t id, getNetwork_cb _hidl_cb)
+{
+	android::sp<ISupplicantP2pNetwork> network;
+	struct wpa_supplicant *wpa_s = retrieveP2pIfacePtr();
+	if (!wpa_s) {
+		HIDL_RETURN(
+		    SupplicantStatusCode::FAILURE_IFACE_INVALID, network);
+	}
+
+	struct wpa_ssid *ssid = wpa_config_get_network(wpa_s->conf, id);
+	if (!ssid) {
+		HIDL_RETURN(
+		    SupplicantStatusCode::FAILURE_NETWORK_UNKNOWN, network);
+	}
+
+	HidlManager *hidl_manager = HidlManager::getInstance();
+	if (!hidl_manager ||
+	    hidl_manager->getP2pNetworkHidlObjectByIfnameAndNetworkId(
+		wpa_s->ifname, ssid->id, &network)) {
+		HIDL_RETURN(SupplicantStatusCode::FAILURE_UNKNOWN, network);
+	}
+
+	HIDL_RETURN(SupplicantStatusCode::SUCCESS, network);
+}
+
+Return<void> P2pIface::listNetworks(listNetworks_cb _hidl_cb)
+{
+	std::vector<uint32_t> network_ids;
+
+	struct wpa_supplicant *wpa_s = retrieveP2pIfacePtr();
+	if (!wpa_s) {
+		HIDL_RETURN(
+		    SupplicantStatusCode::FAILURE_IFACE_INVALID, network_ids);
+	}
+
+	for (struct wpa_ssid *wpa_ssid = wpa_s->conf->ssid; wpa_ssid;
+	     wpa_ssid = wpa_ssid->next) {
+		network_ids.emplace_back(wpa_ssid->id);
+	}
+
+	HIDL_RETURN(SupplicantStatusCode::SUCCESS, network_ids);
+}
+
+Return<void> P2pIface::registerCallback(
+    const sp<ISupplicantP2pIfaceCallback> &callback,
+    registerCallback_cb _hidl_cb)
+{
+	struct wpa_supplicant *wpa_s = retrieveP2pIfacePtr();
+	if (!wpa_s) {
+		HIDL_RETURN(SupplicantStatusCode::FAILURE_IFACE_INVALID);
+	}
+
+	HidlManager *hidl_manager = HidlManager::getInstance();
+	if (!hidl_manager ||
+	    hidl_manager->addP2pIfaceCallbackHidlObject(ifname_, callback)) {
+		HIDL_RETURN(SupplicantStatusCode::FAILURE_UNKNOWN);
+	}
+
+	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
+}
+
+/**
+ * Retrieve the underlying |wpa_supplicant| struct
+ * pointer for this iface.
+ * If the underlying iface is removed, then all RPC method calls on this object
+ * will return failure.
+ */
+wpa_supplicant *P2pIface::retrieveP2pIfacePtr()
+{
+	return wpa_supplicant_get_iface(
+	    (struct wpa_global *)wpa_global_, ifname_.c_str());
+}
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace wifi
+}  // namespace supplicant
+}  // namespace hardware
+}  // namespace android
diff --git a/wpa_supplicant/hidl/p2p_iface.h b/wpa_supplicant/hidl/p2p_iface.h
new file mode 100644
index 0000000..a003cf5
--- /dev/null
+++ b/wpa_supplicant/hidl/p2p_iface.h
@@ -0,0 +1,77 @@
+/*
+ * hidl interface for wpa_supplicant daemon
+ * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+#ifndef WPA_SUPPLICANT_HIDL_P2P_IFACE_H
+#define WPA_SUPPLICANT_HIDL_P2P_IFACE_H
+
+#include <android-base/macros.h>
+
+#include <android/hardware/wifi/supplicant/1.0/ISupplicantP2pIface.h>
+#include <android/hardware/wifi/supplicant/1.0/ISupplicantP2pIfaceCallback.h>
+#include <android/hardware/wifi/supplicant/1.0/ISupplicantP2pNetwork.h>
+
+extern "C" {
+#include "utils/common.h"
+#include "utils/includes.h"
+#include "wpa_supplicant_i.h"
+#include "config.h"
+#include "driver_i.h"
+}
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace supplicant {
+namespace V1_0 {
+namespace implementation {
+
+/**
+ * Implementation of P2pIface hidl object. Each unique hidl
+ * object is used for control operations on a specific interface
+ * controlled by wpa_supplicant.
+ */
+class P2pIface
+    : public android::hardware::wifi::supplicant::V1_0::ISupplicantP2pIface
+{
+public:
+	P2pIface(struct wpa_global* wpa_global, const char ifname[]);
+	~P2pIface() override = default;
+
+	// Hidl methods exposed.
+	Return<void> getName(getName_cb _hidl_cb) override;
+	Return<void> getType(getType_cb _hidl_cb) override;
+	Return<void> addNetwork(addNetwork_cb _hidl_cb) override;
+	Return<void> removeNetwork(
+	    uint32_t id, removeNetwork_cb _hidl_cb) override;
+	Return<void> getNetwork(uint32_t id, getNetwork_cb _hidl_cb) override;
+	Return<void> listNetworks(listNetworks_cb _hidl_cb) override;
+	Return<void> registerCallback(
+	    const sp<ISupplicantP2pIfaceCallback>& callback,
+	    registerCallback_cb _hidl_cb) override;
+
+private:
+	struct wpa_supplicant* retrieveP2pIfacePtr();
+
+	// Reference to the global wpa_struct. This is assumed to be valid for
+	// the lifetime of the process.
+	const struct wpa_global* wpa_global_;
+	// Name of the iface this hidl object controls
+	const std::string ifname_;
+
+	DISALLOW_COPY_AND_ASSIGN(P2pIface);
+};
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace wifi
+}  // namespace supplicant
+}  // namespace hardware
+}  // namespace android
+
+#endif  // WPA_SUPPLICANT_HIDL_P2P_IFACE_H
diff --git a/wpa_supplicant/hidl/p2p_network.cpp b/wpa_supplicant/hidl/p2p_network.cpp
new file mode 100644
index 0000000..7de950e
--- /dev/null
+++ b/wpa_supplicant/hidl/p2p_network.cpp
@@ -0,0 +1,110 @@
+/*
+ * hidl interface for wpa_supplicant daemon
+ * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+#include "hidl_manager.h"
+#include "hidl_return_macros.h"
+#include "p2p_network.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace supplicant {
+namespace V1_0 {
+namespace implementation {
+
+P2pNetwork::P2pNetwork(
+    struct wpa_global *wpa_global, const char ifname[], int network_id)
+    : wpa_global_(wpa_global), ifname_(ifname), network_id_(network_id)
+{
+}
+
+Return<void> P2pNetwork::getId(getId_cb _hidl_cb)
+{
+	uint32_t id = UINT32_MAX;
+	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
+	if (!wpa_ssid) {
+		HIDL_RETURN(SupplicantStatusCode::FAILURE_NETWORK_INVALID, id);
+	}
+
+	id = network_id_;
+	HIDL_RETURN(SupplicantStatusCode::SUCCESS, id);
+}
+
+Return<void> P2pNetwork::getInterfaceName(getInterfaceName_cb _hidl_cb)
+{
+	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
+	if (!wpa_ssid) {
+		HIDL_RETURN(
+		    SupplicantStatusCode::FAILURE_NETWORK_INVALID, ifname_);
+	}
+
+	HIDL_RETURN(SupplicantStatusCode::SUCCESS, ifname_);
+}
+
+Return<void> P2pNetwork::getType(getType_cb _hidl_cb)
+{
+	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
+	if (!wpa_ssid) {
+		HIDL_RETURN(
+		    SupplicantStatusCode::FAILURE_IFACE_INVALID,
+		    IfaceType::P2P);
+	}
+
+	HIDL_RETURN(SupplicantStatusCode::SUCCESS, IfaceType::P2P);
+}
+
+Return<void> P2pNetwork::registerCallback(
+    const sp<ISupplicantP2pNetworkCallback> &callback,
+    registerCallback_cb _hidl_cb)
+{
+	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
+	if (!wpa_ssid) {
+		HIDL_RETURN(SupplicantStatusCode::FAILURE_NETWORK_INVALID);
+	}
+
+	HidlManager *hidl_manager = HidlManager::getInstance();
+	if (!hidl_manager ||
+	    hidl_manager->addP2pNetworkCallbackHidlObject(
+		ifname_, network_id_, callback)) {
+		HIDL_RETURN(SupplicantStatusCode::FAILURE_UNKNOWN);
+	}
+
+	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
+}
+
+/**
+ * Retrieve the underlying |wpa_ssid| struct pointer for
+ * this network.
+ * If the underlying network is removed or the interface
+ * this network belong to is removed, all RPC method calls
+ * on this object will return failure.
+ */
+struct wpa_ssid *P2pNetwork::retrieveNetworkPtr()
+{
+	wpa_supplicant *wpa_s = retrieveIfacePtr();
+	if (!wpa_s)
+		return nullptr;
+	return wpa_config_get_network(wpa_s->conf, network_id_);
+}
+
+/**
+ * Retrieve the underlying |wpa_supplicant| struct
+ * pointer for this network.
+ */
+struct wpa_supplicant *P2pNetwork::retrieveIfacePtr()
+{
+	return wpa_supplicant_get_iface(
+	    (struct wpa_global *)wpa_global_, ifname_.c_str());
+}
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace wifi
+}  // namespace supplicant
+}  // namespace hardware
+}  // namespace android
diff --git a/wpa_supplicant/hidl/p2p_network.h b/wpa_supplicant/hidl/p2p_network.h
new file mode 100644
index 0000000..92eddd2
--- /dev/null
+++ b/wpa_supplicant/hidl/p2p_network.h
@@ -0,0 +1,78 @@
+/*
+ * hidl interface for wpa_supplicant daemon
+ * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+#ifndef WPA_SUPPLICANT_HIDL_P2P_NETWORK_H
+#define WPA_SUPPLICANT_HIDL_P2P_NETWORK_H
+
+#include <android-base/macros.h>
+
+#include <android/hardware/wifi/supplicant/1.0/ISupplicantP2pNetwork.h>
+#include <android/hardware/wifi/supplicant/1.0/ISupplicantP2pNetworkCallback.h>
+
+extern "C" {
+#include "utils/common.h"
+#include "utils/includes.h"
+#include "config.h"
+#include "wpa_supplicant_i.h"
+#include "notify.h"
+#include "eapol_supp/eapol_supp_sm.h"
+#include "eap_peer/eap.h"
+#include "rsn_supp/wpa.h"
+}
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace supplicant {
+namespace V1_0 {
+namespace implementation {
+
+/**
+ * Implementation of P2pNetwork hidl object. Each unique hidl
+ * object is used for control operations on a specific network
+ * controlled by wpa_supplicant.
+ */
+class P2pNetwork : public ISupplicantP2pNetwork
+{
+public:
+	P2pNetwork(
+	    struct wpa_global* wpa_global, const char ifname[], int network_id);
+	~P2pNetwork() override = default;
+
+	// Hidl methods exposed.
+	Return<void> getId(getId_cb _hidl_cb) override;
+	Return<void> getInterfaceName(getInterfaceName_cb _hidl_cb) override;
+	Return<void> getType(getType_cb _hidl_cb) override;
+	Return<void> registerCallback(
+	    const sp<ISupplicantP2pNetworkCallback>& callback,
+	    registerCallback_cb _hidl_cb) override;
+
+private:
+	struct wpa_ssid* retrieveNetworkPtr();
+	struct wpa_supplicant* retrieveIfacePtr();
+
+	// Reference to the global wpa_struct. This is assumed to be valid
+	// for the lifetime of the process.
+	const struct wpa_global* wpa_global_;
+	// Name of the iface this network belongs to.
+	const std::string ifname_;
+	// Id of the network this hidl object controls.
+	const int network_id_;
+
+	DISALLOW_COPY_AND_ASSIGN(P2pNetwork);
+};
+
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace wifi
+}  // namespace supplicant
+}  // namespace hardware
+}  // namespace android
+
+#endif  // WPA_SUPPLICANT_HIDL_P2P_NETWORK_H
diff --git a/wpa_supplicant/hidl/iface.cpp b/wpa_supplicant/hidl/sta_iface.cpp
similarity index 81%
rename from wpa_supplicant/hidl/iface.cpp
rename to wpa_supplicant/hidl/sta_iface.cpp
index 6b94aa1..e3a384b 100644
--- a/wpa_supplicant/hidl/iface.cpp
+++ b/wpa_supplicant/hidl/sta_iface.cpp
@@ -9,7 +9,7 @@
 
 #include "hidl_manager.h"
 #include "hidl_return_macros.h"
-#include "iface.h"
+#include "sta_iface.h"
 
 namespace android {
 namespace hardware {
@@ -18,12 +18,12 @@
 namespace V1_0 {
 namespace implementation {
 
-Iface::Iface(struct wpa_global *wpa_global, const char ifname[])
+StaIface::StaIface(struct wpa_global *wpa_global, const char ifname[])
     : wpa_global_(wpa_global), ifname_(ifname)
 {
 }
 
-Return<void> Iface::getName(getName_cb _hidl_cb)
+Return<void> StaIface::getName(getName_cb _hidl_cb)
 {
 	struct wpa_supplicant *wpa_s = retrieveIfacePtr();
 	if (!wpa_s) {
@@ -34,9 +34,21 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS, ifname_);
 }
 
-Return<void> Iface::addNetwork(addNetwork_cb _hidl_cb)
+Return<void> StaIface::getType(getType_cb _hidl_cb)
 {
-	android::sp<ISupplicantNetwork> network;
+	struct wpa_supplicant *wpa_s = retrieveIfacePtr();
+	if (!wpa_s) {
+		HIDL_RETURN(
+		    SupplicantStatusCode::FAILURE_IFACE_INVALID,
+		    IfaceType::STA);
+	}
+
+	HIDL_RETURN(SupplicantStatusCode::SUCCESS, IfaceType::STA);
+}
+
+Return<void> StaIface::addNetwork(addNetwork_cb _hidl_cb)
+{
+	android::sp<ISupplicantStaNetwork> network;
 	struct wpa_supplicant *wpa_s = retrieveIfacePtr();
 	if (!wpa_s) {
 		HIDL_RETURN(
@@ -50,7 +62,7 @@
 
 	HidlManager *hidl_manager = HidlManager::getInstance();
 	if (!hidl_manager ||
-	    hidl_manager->getNetworkHidlObjectByIfnameAndNetworkId(
+	    hidl_manager->getStaNetworkHidlObjectByIfnameAndNetworkId(
 		wpa_s->ifname, ssid->id, &network)) {
 		HIDL_RETURN(SupplicantStatusCode::FAILURE_UNKNOWN, network);
 	}
@@ -58,7 +70,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS, network);
 }
 
-Return<void> Iface::removeNetwork(uint32_t id, removeNetwork_cb _hidl_cb)
+Return<void> StaIface::removeNetwork(uint32_t id, removeNetwork_cb _hidl_cb)
 {
 	struct wpa_supplicant *wpa_s = retrieveIfacePtr();
 	if (!wpa_s) {
@@ -77,9 +89,9 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Iface::getNetwork(uint32_t id, getNetwork_cb _hidl_cb)
+Return<void> StaIface::getNetwork(uint32_t id, getNetwork_cb _hidl_cb)
 {
-	android::sp<ISupplicantNetwork> network;
+	android::sp<ISupplicantStaNetwork> network;
 	struct wpa_supplicant *wpa_s = retrieveIfacePtr();
 	if (!wpa_s) {
 		HIDL_RETURN(
@@ -94,7 +106,7 @@
 
 	HidlManager *hidl_manager = HidlManager::getInstance();
 	if (!hidl_manager ||
-	    hidl_manager->getNetworkHidlObjectByIfnameAndNetworkId(
+	    hidl_manager->getStaNetworkHidlObjectByIfnameAndNetworkId(
 		wpa_s->ifname, ssid->id, &network)) {
 		HIDL_RETURN(SupplicantStatusCode::FAILURE_UNKNOWN, network);
 	}
@@ -102,7 +114,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS, network);
 }
 
-Return<void> Iface::listNetworks(listNetworks_cb _hidl_cb)
+Return<void> StaIface::listNetworks(listNetworks_cb _hidl_cb)
 {
 	std::vector<uint32_t> network_ids;
 
@@ -120,8 +132,9 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS, network_ids);
 }
 
-Return<void> Iface::registerCallback(
-    const sp<ISupplicantIfaceCallback> &callback, registerCallback_cb _hidl_cb)
+Return<void> StaIface::registerCallback(
+    const sp<ISupplicantStaIfaceCallback> &callback,
+    registerCallback_cb _hidl_cb)
 {
 	struct wpa_supplicant *wpa_s = retrieveIfacePtr();
 	if (!wpa_s) {
@@ -130,14 +143,14 @@
 
 	HidlManager *hidl_manager = HidlManager::getInstance();
 	if (!hidl_manager ||
-	    hidl_manager->addIfaceCallbackHidlObject(ifname_, callback)) {
+	    hidl_manager->addStaIfaceCallbackHidlObject(ifname_, callback)) {
 		HIDL_RETURN(SupplicantStatusCode::FAILURE_UNKNOWN);
 	}
 
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Iface::reassociate(reassociate_cb _hidl_cb)
+Return<void> StaIface::reassociate(reassociate_cb _hidl_cb)
 {
 	struct wpa_supplicant *wpa_s = retrieveIfacePtr();
 	if (!wpa_s) {
@@ -151,7 +164,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Iface::reconnect(reconnect_cb _hidl_cb)
+Return<void> StaIface::reconnect(reconnect_cb _hidl_cb)
 {
 	struct wpa_supplicant *wpa_s = retrieveIfacePtr();
 	if (!wpa_s) {
@@ -171,7 +184,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Iface::disconnect(disconnect_cb _hidl_cb)
+Return<void> StaIface::disconnect(disconnect_cb _hidl_cb)
 {
 	struct wpa_supplicant *wpa_s = retrieveIfacePtr();
 	if (!wpa_s) {
@@ -187,7 +200,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Iface::setPowerSave(bool enable, setPowerSave_cb _hidl_cb)
+Return<void> StaIface::setPowerSave(bool enable, setPowerSave_cb _hidl_cb)
 {
 	struct wpa_supplicant *wpa_s = retrieveIfacePtr();
 	if (!wpa_s) {
@@ -201,7 +214,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Iface::initiateTdlsDiscover(
+Return<void> StaIface::initiateTdlsDiscover(
     const hidl_array<uint8_t, 6 /* 6 */> &mac_address,
     initiateTdlsDiscover_cb _hidl_cb)
 {
@@ -228,7 +241,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Iface::initiateTdlsSetup(
+Return<void> StaIface::initiateTdlsSetup(
     const hidl_array<uint8_t, 6 /* 6 */> &mac_address,
     initiateTdlsSetup_cb _hidl_cb)
 {
@@ -257,7 +270,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Iface::initiateTdlsTeardown(
+Return<void> StaIface::initiateTdlsTeardown(
     const hidl_array<uint8_t, 6 /* 6 */> &mac_address,
     initiateTdlsTeardown_cb _hidl_cb)
 {
@@ -293,7 +306,7 @@
  * If the underlying iface is removed, then all RPC method calls on this object
  * will return failure.
  */
-wpa_supplicant *Iface::retrieveIfacePtr()
+wpa_supplicant *StaIface::retrieveIfacePtr()
 {
 	return wpa_supplicant_get_iface(
 	    (struct wpa_global *)wpa_global_, ifname_.c_str());
diff --git a/wpa_supplicant/hidl/iface.h b/wpa_supplicant/hidl/sta_iface.h
similarity index 74%
rename from wpa_supplicant/hidl/iface.h
rename to wpa_supplicant/hidl/sta_iface.h
index 3be2675..f246bbc 100644
--- a/wpa_supplicant/hidl/iface.h
+++ b/wpa_supplicant/hidl/sta_iface.h
@@ -7,20 +7,22 @@
  * See README for more details.
  */
 
-#ifndef WPA_SUPPLICANT_HIDL_IFACE_H
-#define WPA_SUPPLICANT_HIDL_IFACE_H
+#ifndef WPA_SUPPLICANT_HIDL_STA_IFACE_H
+#define WPA_SUPPLICANT_HIDL_STA_IFACE_H
 
 #include <android-base/macros.h>
 
-#include <android/hardware/wifi/supplicant/1.0/ISupplicantIface.h>
-#include <android/hardware/wifi/supplicant/1.0/ISupplicantIfaceCallback.h>
-#include <android/hardware/wifi/supplicant/1.0/ISupplicantNetwork.h>
+#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaIface.h>
+#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.h>
+#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaNetwork.h>
 
 extern "C" {
 #include "utils/common.h"
 #include "utils/includes.h"
 #include "wpa_supplicant_i.h"
+#include "config.h"
 #include "driver_i.h"
+#include "wpa.h"
 }
 
 namespace android {
@@ -31,25 +33,27 @@
 namespace implementation {
 
 /**
- * Implementation of Iface hidl object. Each unique hidl
+ * Implementation of StaIface hidl object. Each unique hidl
  * object is used for control operations on a specific interface
  * controlled by wpa_supplicant.
  */
-class Iface : public android::hardware::wifi::supplicant::V1_0::ISupplicantIface
+class StaIface
+    : public android::hardware::wifi::supplicant::V1_0::ISupplicantStaIface
 {
 public:
-	Iface(struct wpa_global* wpa_global, const char ifname[]);
-	~Iface() override = default;
+	StaIface(struct wpa_global* wpa_global, const char ifname[]);
+	~StaIface() override = default;
 
 	// Hidl methods exposed.
 	Return<void> getName(getName_cb _hidl_cb) override;
+	Return<void> getType(getType_cb _hidl_cb) override;
 	Return<void> addNetwork(addNetwork_cb _hidl_cb) override;
 	Return<void> removeNetwork(
 	    uint32_t id, removeNetwork_cb _hidl_cb) override;
 	Return<void> getNetwork(uint32_t id, getNetwork_cb _hidl_cb) override;
 	Return<void> listNetworks(listNetworks_cb _hidl_cb) override;
 	Return<void> registerCallback(
-	    const sp<ISupplicantIfaceCallback>& callback,
+	    const sp<ISupplicantStaIfaceCallback>& callback,
 	    registerCallback_cb _hidl_cb) override;
 	Return<void> reassociate(reassociate_cb _hidl_cb) override;
 	Return<void> reconnect(reconnect_cb _hidl_cb) override;
@@ -75,7 +79,7 @@
 	// Name of the iface this hidl object controls
 	const std::string ifname_;
 
-	DISALLOW_COPY_AND_ASSIGN(Iface);
+	DISALLOW_COPY_AND_ASSIGN(StaIface);
 };
 
 }  // namespace implementation
@@ -85,4 +89,4 @@
 }  // namespace hardware
 }  // namespace android
 
-#endif  // WPA_SUPPLICANT_HIDL_IFACE_H
+#endif  // WPA_SUPPLICANT_HIDL_STA_IFACE_H
diff --git a/wpa_supplicant/hidl/network.cpp b/wpa_supplicant/hidl/sta_network.cpp
similarity index 84%
rename from wpa_supplicant/hidl/network.cpp
rename to wpa_supplicant/hidl/sta_network.cpp
index a7824fe..c782101 100644
--- a/wpa_supplicant/hidl/network.cpp
+++ b/wpa_supplicant/hidl/sta_network.cpp
@@ -9,43 +9,43 @@
 
 #include "hidl_manager.h"
 #include "hidl_return_macros.h"
-#include "network.h"
+#include "sta_network.h"
 
 namespace {
-using android::hardware::wifi::supplicant::V1_0::ISupplicantNetwork;
+using android::hardware::wifi::supplicant::V1_0::ISupplicantStaNetwork;
 using android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
 
 constexpr uint8_t kZeroBssid[6] = {0, 0, 0, 0, 0, 0};
 
 constexpr uint32_t kAllowedKeyMgmtMask =
-    (static_cast<uint32_t>(ISupplicantNetwork::KeyMgmtMask::NONE) |
-     static_cast<uint32_t>(ISupplicantNetwork::KeyMgmtMask::WPA_PSK) |
-     static_cast<uint32_t>(ISupplicantNetwork::KeyMgmtMask::WPA_EAP) |
-     static_cast<uint32_t>(ISupplicantNetwork::KeyMgmtMask::IEEE8021X));
+    (static_cast<uint32_t>(ISupplicantStaNetwork::KeyMgmtMask::NONE) |
+     static_cast<uint32_t>(ISupplicantStaNetwork::KeyMgmtMask::WPA_PSK) |
+     static_cast<uint32_t>(ISupplicantStaNetwork::KeyMgmtMask::WPA_EAP) |
+     static_cast<uint32_t>(ISupplicantStaNetwork::KeyMgmtMask::IEEE8021X));
 constexpr uint32_t kAllowedproto_mask =
-    (static_cast<uint32_t>(ISupplicantNetwork::ProtoMask::WPA) |
-     static_cast<uint32_t>(ISupplicantNetwork::ProtoMask::RSN) |
-     static_cast<uint32_t>(ISupplicantNetwork::ProtoMask::OSEN));
+    (static_cast<uint32_t>(ISupplicantStaNetwork::ProtoMask::WPA) |
+     static_cast<uint32_t>(ISupplicantStaNetwork::ProtoMask::RSN) |
+     static_cast<uint32_t>(ISupplicantStaNetwork::ProtoMask::OSEN));
 constexpr uint32_t kAllowedauth_alg_mask =
-    (static_cast<uint32_t>(ISupplicantNetwork::AuthAlgMask::OPEN) |
-     static_cast<uint32_t>(ISupplicantNetwork::AuthAlgMask::SHARED) |
-     static_cast<uint32_t>(ISupplicantNetwork::AuthAlgMask::LEAP));
+    (static_cast<uint32_t>(ISupplicantStaNetwork::AuthAlgMask::OPEN) |
+     static_cast<uint32_t>(ISupplicantStaNetwork::AuthAlgMask::SHARED) |
+     static_cast<uint32_t>(ISupplicantStaNetwork::AuthAlgMask::LEAP));
 constexpr uint32_t kAllowedgroup_cipher_mask =
-    (static_cast<uint32_t>(ISupplicantNetwork::GroupCipherMask::WEP40) |
-     static_cast<uint32_t>(ISupplicantNetwork::GroupCipherMask::WEP104) |
-     static_cast<uint32_t>(ISupplicantNetwork::GroupCipherMask::TKIP) |
-     static_cast<uint32_t>(ISupplicantNetwork::GroupCipherMask::CCMP));
+    (static_cast<uint32_t>(ISupplicantStaNetwork::GroupCipherMask::WEP40) |
+     static_cast<uint32_t>(ISupplicantStaNetwork::GroupCipherMask::WEP104) |
+     static_cast<uint32_t>(ISupplicantStaNetwork::GroupCipherMask::TKIP) |
+     static_cast<uint32_t>(ISupplicantStaNetwork::GroupCipherMask::CCMP));
 constexpr uint32_t kAllowedpairwise_cipher_mask =
-    (static_cast<uint32_t>(ISupplicantNetwork::PairwiseCipherMask::NONE) |
-     static_cast<uint32_t>(ISupplicantNetwork::PairwiseCipherMask::TKIP) |
-     static_cast<uint32_t>(ISupplicantNetwork::PairwiseCipherMask::CCMP));
+    (static_cast<uint32_t>(ISupplicantStaNetwork::PairwiseCipherMask::NONE) |
+     static_cast<uint32_t>(ISupplicantStaNetwork::PairwiseCipherMask::TKIP) |
+     static_cast<uint32_t>(ISupplicantStaNetwork::PairwiseCipherMask::CCMP));
 
 constexpr uint32_t kEapMethodMax =
-    static_cast<uint32_t>(ISupplicantNetwork::EapMethod::WFA_UNAUTH_TLS) + 1;
+    static_cast<uint32_t>(ISupplicantStaNetwork::EapMethod::WFA_UNAUTH_TLS) + 1;
 constexpr char const *kEapMethodStrings[kEapMethodMax] = {
     "PEAP", "TLS", "TTLS", "PWD", "SIM", "AKA", "AKA'", "WFA-UNAUTH-TLS"};
 constexpr uint32_t kEapPhase2MethodMax =
-    static_cast<uint32_t>(ISupplicantNetwork::EapPhase2Method::GTC) + 1;
+    static_cast<uint32_t>(ISupplicantStaNetwork::EapPhase2Method::GTC) + 1;
 constexpr char const *kEapPhase2MethodStrings[kEapPhase2MethodMax] = {
     "NULL", "PAP", "MSCHAP", "MSCHAPV2", "GTC"};
 }  // namespace
@@ -57,13 +57,13 @@
 namespace V1_0 {
 namespace implementation {
 
-Network::Network(
+StaNetwork::StaNetwork(
     struct wpa_global *wpa_global, const char ifname[], int network_id)
     : wpa_global_(wpa_global), ifname_(ifname), network_id_(network_id)
 {
 }
 
-Return<void> Network::getId(getId_cb _hidl_cb)
+Return<void> StaNetwork::getId(getId_cb _hidl_cb)
 {
 	uint32_t id = UINT32_MAX;
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -75,7 +75,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS, id);
 }
 
-Return<void> Network::getInterfaceName(getInterfaceName_cb _hidl_cb)
+Return<void> StaNetwork::getInterfaceName(getInterfaceName_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	if (!wpa_ssid) {
@@ -86,8 +86,20 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS, ifname_);
 }
 
-Return<void> Network::registerCallback(
-    const sp<ISupplicantNetworkCallback> &callback,
+Return<void> StaNetwork::getType(getType_cb _hidl_cb)
+{
+	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
+	if (!wpa_ssid) {
+		HIDL_RETURN(
+		    SupplicantStatusCode::FAILURE_IFACE_INVALID,
+		    IfaceType::STA);
+	}
+
+	HIDL_RETURN(SupplicantStatusCode::SUCCESS, IfaceType::STA);
+}
+
+Return<void> StaNetwork::registerCallback(
+    const sp<ISupplicantStaNetworkCallback> &callback,
     registerCallback_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -97,7 +109,7 @@
 
 	HidlManager *hidl_manager = HidlManager::getInstance();
 	if (!hidl_manager ||
-	    hidl_manager->addNetworkCallbackHidlObject(
+	    hidl_manager->addStaNetworkCallbackHidlObject(
 		ifname_, network_id_, callback)) {
 		HIDL_RETURN(SupplicantStatusCode::FAILURE_UNKNOWN);
 	}
@@ -105,7 +117,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setSsid(
+Return<void> StaNetwork::setSsid(
     const hidl_vec<uint8_t> &ssid, setSsid_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -115,7 +127,7 @@
 
 	if (ssid.size() == 0 ||
 	    ssid.size() >
-		static_cast<uint32_t>(ISupplicantNetwork::ParamSizeLimits::
+		static_cast<uint32_t>(ISupplicantStaNetwork::ParamSizeLimits::
 					  SSID_MAX_LEN_IN_BYTES)) {
 		HIDL_RETURN(SupplicantStatusCode::FAILURE_ARGS_INVALID);
 	}
@@ -132,7 +144,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setBssid(
+Return<void> StaNetwork::setBssid(
     const hidl_array<uint8_t, 6 /* 6 */> &bssid, setBssid_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -165,7 +177,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setScanSsid(bool enable, setScanSsid_cb _hidl_cb)
+Return<void> StaNetwork::setScanSsid(bool enable, setScanSsid_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	if (!wpa_ssid) {
@@ -178,7 +190,8 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setKeyMgmt(uint32_t key_mgmt_mask, setKeyMgmt_cb _hidl_cb)
+Return<void> StaNetwork::setKeyMgmt(
+    uint32_t key_mgmt_mask, setKeyMgmt_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	if (!wpa_ssid) {
@@ -195,7 +208,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setProto(uint32_t proto_mask, setProto_cb _hidl_cb)
+Return<void> StaNetwork::setProto(uint32_t proto_mask, setProto_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	if (!wpa_ssid) {
@@ -212,7 +225,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setAuthAlg(
+Return<void> StaNetwork::setAuthAlg(
     uint32_t auth_alg_mask,
     std::function<void(const SupplicantStatus &status)> _hidl_cb)
 {
@@ -231,7 +244,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setGroupCipher(
+Return<void> StaNetwork::setGroupCipher(
     uint32_t group_cipher_mask, setGroupCipher_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -249,7 +262,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setPairwiseCipher(
+Return<void> StaNetwork::setPairwiseCipher(
     uint32_t pairwise_cipher_mask, setPairwiseCipher_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -268,7 +281,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setPskPassphrase(
+Return<void> StaNetwork::setPskPassphrase(
     const hidl_string &psk, setPskPassphrase_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -298,7 +311,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setWepKey(
+Return<void> StaNetwork::setWepKey(
     uint32_t key_idx, const hidl_vec<uint8_t> &wep_key, setWepKey_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -308,14 +321,14 @@
 
 	if (key_idx >=
 	    static_cast<uint32_t>(
-		ISupplicantNetwork::ParamSizeLimits::WEP_KEYS_MAX_NUM)) {
+		ISupplicantStaNetwork::ParamSizeLimits::WEP_KEYS_MAX_NUM)) {
 		HIDL_RETURN(SupplicantStatusCode::FAILURE_ARGS_INVALID);
 	}
 	if (wep_key.size() !=
-		static_cast<uint32_t>(ISupplicantNetwork::ParamSizeLimits::
+		static_cast<uint32_t>(ISupplicantStaNetwork::ParamSizeLimits::
 					  WEP40_KEY_LEN_IN_BYTES) &&
 	    wep_key.size() !=
-		static_cast<uint32_t>(ISupplicantNetwork::ParamSizeLimits::
+		static_cast<uint32_t>(ISupplicantStaNetwork::ParamSizeLimits::
 					  WEP104_KEY_LEN_IN_BYTES)) {
 		HIDL_RETURN(SupplicantStatusCode::FAILURE_ARGS_INVALID);
 	}
@@ -330,7 +343,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setWepTxKeyIdx(
+Return<void> StaNetwork::setWepTxKeyIdx(
     uint32_t key_idx, setWepTxKeyIdx_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -340,7 +353,7 @@
 
 	if (key_idx >=
 	    static_cast<uint32_t>(
-		ISupplicantNetwork::ParamSizeLimits::WEP_KEYS_MAX_NUM)) {
+		ISupplicantStaNetwork::ParamSizeLimits::WEP_KEYS_MAX_NUM)) {
 		HIDL_RETURN(SupplicantStatusCode::FAILURE_ARGS_INVALID);
 	}
 	wpa_ssid->wep_tx_keyidx = key_idx;
@@ -349,7 +362,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setRequirePmf(bool enable, setRequirePmf_cb _hidl_cb)
+Return<void> StaNetwork::setRequirePmf(bool enable, setRequirePmf_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	if (!wpa_ssid) {
@@ -363,8 +376,8 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setEapMethod(
-    ISupplicantNetwork::EapMethod method, setEapMethod_cb _hidl_cb)
+Return<void> StaNetwork::setEapMethod(
+    ISupplicantStaNetwork::EapMethod method, setEapMethod_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	if (!wpa_ssid) {
@@ -417,8 +430,9 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setEapPhase2Method(
-    ISupplicantNetwork::EapPhase2Method method, setEapPhase2Method_cb _hidl_cb)
+Return<void> StaNetwork::setEapPhase2Method(
+    ISupplicantStaNetwork::EapPhase2Method method,
+    setEapPhase2Method_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	if (!wpa_ssid) {
@@ -434,7 +448,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setEapIdentity(
+Return<void> StaNetwork::setEapIdentity(
     const hidl_vec<uint8_t> &identity, setEapIdentity_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -451,7 +465,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setEapAnonymousIdentity(
+Return<void> StaNetwork::setEapAnonymousIdentity(
     const hidl_vec<uint8_t> &identity, setEapAnonymousIdentity_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -470,7 +484,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setEapPassword(
+Return<void> StaNetwork::setEapPassword(
     const hidl_vec<uint8_t> &password, setEapPassword_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -489,7 +503,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setEapCACert(
+Return<void> StaNetwork::setEapCACert(
     const hidl_string &path, setEapCACert_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -505,7 +519,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setEapCAPath(
+Return<void> StaNetwork::setEapCAPath(
     const hidl_string &path, setEapCAPath_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -521,7 +535,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setEapClientCert(
+Return<void> StaNetwork::setEapClientCert(
     const hidl_string &path, setEapClientCert_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -538,7 +552,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setEapPrivateKey(
+Return<void> StaNetwork::setEapPrivateKey(
     const hidl_string &path, setEapPrivateKey_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -555,7 +569,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setEapSubjectMatch(
+Return<void> StaNetwork::setEapSubjectMatch(
     const hidl_string &match, setEapSubjectMatch_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -572,7 +586,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setEapAltSubjectMatch(
+Return<void> StaNetwork::setEapAltSubjectMatch(
     const hidl_string &match, setEapAltSubjectMatch_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -589,7 +603,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setEapEngine(bool enable, setEapEngine_cb _hidl_cb)
+Return<void> StaNetwork::setEapEngine(bool enable, setEapEngine_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	if (!wpa_ssid) {
@@ -601,7 +615,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setEapEngineID(
+Return<void> StaNetwork::setEapEngineID(
     const hidl_string &id, setEapEngineID_cb _hidl_cb)
 
 {
@@ -618,7 +632,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::setEapDomainSuffixMatch(
+Return<void> StaNetwork::setEapDomainSuffixMatch(
     const hidl_string &match, setEapDomainSuffixMatch_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -635,7 +649,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::getSsid(getSsid_cb _hidl_cb)
+Return<void> StaNetwork::getSsid(getSsid_cb _hidl_cb)
 {
 	std::vector<uint8_t> ssid;
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -649,7 +663,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS, ssid);
 }
 
-Return<void> Network::getBssid(getBssid_cb _hidl_cb)
+Return<void> StaNetwork::getBssid(getBssid_cb _hidl_cb)
 {
 	hidl_array<uint8_t, 6> bssid;
 	os_memcpy(bssid.data(), kZeroBssid, ETH_ALEN);
@@ -666,7 +680,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS, bssid);
 }
 
-Return<void> Network::getScanSsid(getScanSsid_cb _hidl_cb)
+Return<void> StaNetwork::getScanSsid(getScanSsid_cb _hidl_cb)
 {
 	bool enabled = false;
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -680,7 +694,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS, enabled);
 }
 
-Return<void> Network::getKeyMgmt(getKeyMgmt_cb _hidl_cb)
+Return<void> StaNetwork::getKeyMgmt(getKeyMgmt_cb _hidl_cb)
 {
 	uint32_t key_mgmt_mask = 0;
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -695,7 +709,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS, key_mgmt_mask);
 }
 
-Return<void> Network::getProto(getProto_cb _hidl_cb)
+Return<void> StaNetwork::getProto(getProto_cb _hidl_cb)
 {
 	uint32_t proto_mask = 0;
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -709,7 +723,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS, proto_mask);
 }
 
-Return<void> Network::getAuthAlg(getAuthAlg_cb _hidl_cb)
+Return<void> StaNetwork::getAuthAlg(getAuthAlg_cb _hidl_cb)
 {
 	uint32_t auth_alg_mask = 0;
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -724,7 +738,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS, auth_alg_mask);
 }
 
-Return<void> Network::getGroupCipher(getGroupCipher_cb _hidl_cb)
+Return<void> StaNetwork::getGroupCipher(getGroupCipher_cb _hidl_cb)
 {
 	uint32_t group_cipher_mask = 0;
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -739,7 +753,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS, group_cipher_mask);
 }
 
-Return<void> Network::getPairwiseCipher(getPairwiseCipher_cb _hidl_cb)
+Return<void> StaNetwork::getPairwiseCipher(getPairwiseCipher_cb _hidl_cb)
 {
 	uint32_t pairwise_cipher_mask = 0;
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -754,7 +768,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS, pairwise_cipher_mask);
 }
 
-Return<void> Network::getPskPassphrase(getPskPassphrase_cb _hidl_cb)
+Return<void> StaNetwork::getPskPassphrase(getPskPassphrase_cb _hidl_cb)
 {
 	hidl_string psk;
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -769,7 +783,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS, psk);
 }
 
-Return<void> Network::getWepKey(uint32_t key_idx, getWepKey_cb _hidl_cb)
+Return<void> StaNetwork::getWepKey(uint32_t key_idx, getWepKey_cb _hidl_cb)
 {
 	std::vector<uint8_t> wep_key;
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -781,7 +795,7 @@
 
 	if (key_idx >=
 	    static_cast<uint32_t>(
-		ISupplicantNetwork::ParamSizeLimits::WEP_KEYS_MAX_NUM)) {
+		ISupplicantStaNetwork::ParamSizeLimits::WEP_KEYS_MAX_NUM)) {
 		HIDL_RETURN(
 		    SupplicantStatusCode::FAILURE_ARGS_INVALID, wep_key);
 	}
@@ -793,7 +807,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS, wep_key);
 }
 
-Return<void> Network::getWepTxKeyIdx(getWepTxKeyIdx_cb _hidl_cb)
+Return<void> StaNetwork::getWepTxKeyIdx(getWepTxKeyIdx_cb _hidl_cb)
 {
 	uint32_t wep_tx_key_idx = UINT32_MAX;
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -808,7 +822,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS, wep_tx_key_idx);
 }
 
-Return<void> Network::getRequirePmf(getRequirePmf_cb _hidl_cb)
+Return<void> StaNetwork::getRequirePmf(getRequirePmf_cb _hidl_cb)
 {
 	bool enabled = false;
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -822,7 +836,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS, enabled);
 }
 
-Return<void> Network::enable(bool no_connect, enable_cb _hidl_cb)
+Return<void> StaNetwork::enable(bool no_connect, enable_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	if (!wpa_ssid) {
@@ -845,7 +859,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::disable(disable_cb _hidl_cb)
+Return<void> StaNetwork::disable(disable_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	if (!wpa_ssid) {
@@ -862,7 +876,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::select(select_cb _hidl_cb)
+Return<void> StaNetwork::select(select_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	if (!wpa_ssid) {
@@ -881,8 +895,8 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::sendNetworkEapSimGsmAuthResponse(
-    const ISupplicantNetwork::NetworkResponseEapSimGsmAuthParams &params,
+Return<void> StaNetwork::sendNetworkEapSimGsmAuthResponse(
+    const ISupplicantStaNetwork::NetworkResponseEapSimGsmAuthParams &params,
     sendNetworkEapSimGsmAuthResponse_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -923,8 +937,8 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::sendNetworkEapSimUmtsAuthResponse(
-    const ISupplicantNetwork::NetworkResponseEapSimUmtsAuthParams &params,
+Return<void> StaNetwork::sendNetworkEapSimUmtsAuthResponse(
+    const ISupplicantStaNetwork::NetworkResponseEapSimUmtsAuthParams &params,
     sendNetworkEapSimUmtsAuthResponse_cb _hidl_cb)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -971,7 +985,7 @@
 	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
 }
 
-Return<void> Network::sendNetworkEapIdentityResponse(
+Return<void> StaNetwork::sendNetworkEapIdentityResponse(
     const hidl_vec<uint8_t> &identity,
     sendNetworkEapIdentityResponse_cb _hidl_cb)
 {
@@ -1014,7 +1028,7 @@
  * is removed, all RPC method calls on this object will
  * return failure.
  */
-struct wpa_ssid *Network::retrieveNetworkPtr()
+struct wpa_ssid *StaNetwork::retrieveNetworkPtr()
 {
 	wpa_supplicant *wpa_s = retrieveIfacePtr();
 	if (!wpa_s)
@@ -1027,7 +1041,7 @@
  * pointer for
  * this network.
  */
-struct wpa_supplicant *Network::retrieveIfacePtr()
+struct wpa_supplicant *StaNetwork::retrieveIfacePtr()
 {
 	return wpa_supplicant_get_iface(
 	    (struct wpa_global *)wpa_global_, ifname_.c_str());
@@ -1038,13 +1052,13 @@
  *
  * Returns 0 if valid, 1 otherwise.
  */
-int Network::isPskPassphraseValid(const hidl_string &psk)
+int StaNetwork::isPskPassphraseValid(const hidl_string &psk)
 {
 	if (psk.size() <
-		static_cast<uint32_t>(ISupplicantNetwork::ParamSizeLimits::
+		static_cast<uint32_t>(ISupplicantStaNetwork::ParamSizeLimits::
 					  PSK_PASSPHRASE_MIN_LEN_IN_BYTES) ||
 	    psk.size() >
-		static_cast<uint32_t>(ISupplicantNetwork::ParamSizeLimits::
+		static_cast<uint32_t>(ISupplicantStaNetwork::ParamSizeLimits::
 					  PSK_PASSPHRASE_MAX_LEN_IN_BYTES)) {
 		return 1;
 	}
@@ -1059,7 +1073,7 @@
  * after params update (except
  * bssid).
  */
-void Network::resetInternalStateAfterParamsUpdate()
+void StaNetwork::resetInternalStateAfterParamsUpdate()
 {
 	struct wpa_supplicant *wpa_s = retrieveIfacePtr();
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -1082,7 +1096,7 @@
  * instance for this network.
  * This function frees any existing data in these fields.
  */
-int Network::setStringFieldAndResetState(
+int StaNetwork::setStringFieldAndResetState(
     const char *value, uint8_t **to_update_field, const char *hexdump_prefix)
 {
 	return setStringFieldAndResetState(
@@ -1094,7 +1108,7 @@
  * instance for this network.
  * This function frees any existing data in these fields.
  */
-int Network::setStringFieldAndResetState(
+int StaNetwork::setStringFieldAndResetState(
     const char *value, char **to_update_field, const char *hexdump_prefix)
 {
 	int value_len = strlen(value);
@@ -1116,7 +1130,7 @@
  * instance for this network.
  * This function frees any existing data in these fields.
  */
-int Network::setStringKeyFieldAndResetState(
+int StaNetwork::setStringKeyFieldAndResetState(
     const char *value, char **to_update_field, const char *hexdump_prefix)
 {
 	int value_len = strlen(value);
@@ -1138,7 +1152,7 @@
  * field in |wpa_ssid| structue instance for this network.
  * This function frees any existing data in these fields.
  */
-int Network::setByteArrayFieldAndResetState(
+int StaNetwork::setByteArrayFieldAndResetState(
     const uint8_t *value, const size_t value_len, uint8_t **to_update_field,
     size_t *to_update_field_len, const char *hexdump_prefix)
 {
@@ -1164,7 +1178,7 @@
  * length field in |wpa_ssid| structue instance for this network.
  * This function frees any existing data in these fields.
  */
-int Network::setByteArrayKeyFieldAndResetState(
+int StaNetwork::setByteArrayKeyFieldAndResetState(
     const uint8_t *value, const size_t value_len, uint8_t **to_update_field,
     size_t *to_update_field_len, const char *hexdump_prefix)
 {
diff --git a/wpa_supplicant/hidl/network.h b/wpa_supplicant/hidl/sta_network.h
similarity index 88%
rename from wpa_supplicant/hidl/network.h
rename to wpa_supplicant/hidl/sta_network.h
index 614513f..a2055c3 100644
--- a/wpa_supplicant/hidl/network.h
+++ b/wpa_supplicant/hidl/sta_network.h
@@ -7,13 +7,13 @@
  * See README for more details.
  */
 
-#ifndef WPA_SUPPLICANT_HIDL_NETWORK_H
-#define WPA_SUPPLICANT_HIDL_NETWORK_H
+#ifndef WPA_SUPPLICANT_HIDL_STA_NETWORK_H
+#define WPA_SUPPLICANT_HIDL_STA_NETWORK_H
 
 #include <android-base/macros.h>
 
-#include <android/hardware/wifi/supplicant/1.0/ISupplicantNetwork.h>
-#include <android/hardware/wifi/supplicant/1.0/ISupplicantNetworkCallback.h>
+#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaNetwork.h>
+#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaNetworkCallback.h>
 
 extern "C" {
 #include "utils/common.h"
@@ -34,22 +34,23 @@
 namespace implementation {
 
 /**
- * Implementation of Network hidl object. Each unique hidl
+ * Implementation of StaNetwork hidl object. Each unique hidl
  * object is used for control operations on a specific network
  * controlled by wpa_supplicant.
  */
-class Network : public ISupplicantNetwork
+class StaNetwork : public ISupplicantStaNetwork
 {
 public:
-	Network(
+	StaNetwork(
 	    struct wpa_global* wpa_global, const char ifname[], int network_id);
-	~Network() override = default;
+	~StaNetwork() override = default;
 
 	// Hidl methods exposed.
 	Return<void> getId(getId_cb _hidl_cb) override;
 	Return<void> getInterfaceName(getInterfaceName_cb _hidl_cb) override;
+	Return<void> getType(getType_cb _hidl_cb) override;
 	Return<void> registerCallback(
-	    const sp<ISupplicantNetworkCallback>& callback,
+	    const sp<ISupplicantStaNetworkCallback>& callback,
 	    registerCallback_cb _hidl_cb) override;
 	Return<void> setSsid(
 	    const hidl_vec<uint8_t>& ssid, setSsid_cb _hidl_cb) override;
@@ -78,10 +79,10 @@
 	Return<void> setRequirePmf(
 	    bool enable, setRequirePmf_cb _hidl_cb) override;
 	Return<void> setEapMethod(
-	    ISupplicantNetwork::EapMethod method,
+	    ISupplicantStaNetwork::EapMethod method,
 	    setEapMethod_cb _hidl_cb) override;
 	Return<void> setEapPhase2Method(
-	    ISupplicantNetwork::EapPhase2Method method,
+	    ISupplicantStaNetwork::EapPhase2Method method,
 	    setEapPhase2Method_cb _hidl_cb) override;
 	Return<void> setEapIdentity(
 	    const hidl_vec<uint8_t>& identity,
@@ -129,11 +130,11 @@
 	Return<void> disable(disable_cb _hidl_cb) override;
 	Return<void> select(select_cb _hidl_cb) override;
 	Return<void> sendNetworkEapSimGsmAuthResponse(
-	    const ISupplicantNetwork::NetworkResponseEapSimGsmAuthParams&
+	    const ISupplicantStaNetwork::NetworkResponseEapSimGsmAuthParams&
 		params,
 	    sendNetworkEapSimGsmAuthResponse_cb _hidl_cb) override;
 	Return<void> sendNetworkEapSimUmtsAuthResponse(
-	    const ISupplicantNetwork::NetworkResponseEapSimUmtsAuthParams&
+	    const ISupplicantStaNetwork::NetworkResponseEapSimUmtsAuthParams&
 		params,
 	    sendNetworkEapSimUmtsAuthResponse_cb _hidl_cb) override;
 	Return<void> sendNetworkEapIdentityResponse(
@@ -171,7 +172,7 @@
 	// Id of the network this hidl object controls.
 	const int network_id_;
 
-	DISALLOW_COPY_AND_ASSIGN(Network);
+	DISALLOW_COPY_AND_ASSIGN(StaNetwork);
 };
 
 }  // namespace implementation
@@ -181,4 +182,4 @@
 }  // namespace hardware
 }  // namespace android
 
-#endif  // WPA_SUPPLICANT_HIDL_NETWORK_H
+#endif  // WPA_SUPPLICANT_HIDL_STA_NETWORK_H
diff --git a/wpa_supplicant/hidl/supplicant.cpp b/wpa_supplicant/hidl/supplicant.cpp
index b9f6ce2..f32ceb9 100644
--- a/wpa_supplicant/hidl/supplicant.cpp
+++ b/wpa_supplicant/hidl/supplicant.cpp
@@ -24,88 +24,53 @@
     "/data/misc/wifi/wpa_supplicant.conf";
 
 Supplicant::Supplicant(struct wpa_global* global) : wpa_global_(global) {}
-Return<void> Supplicant::createInterface(
-    const hidl_string& ifname, createInterface_cb _hidl_cb)
-{
-	android::sp<ISupplicantIface> iface;
-
-	// Check if required |ifname| argument is empty.
-	if (ifname.size() == 0) {
-		HIDL_RETURN(SupplicantStatusCode::FAILURE_ARGS_INVALID, iface);
-	}
-	// Try to get the wpa_supplicant record for this iface, return
-	// an error if we already control it.
-	if (wpa_supplicant_get_iface(wpa_global_, ifname.c_str()) != NULL) {
-		HIDL_RETURN(SupplicantStatusCode::FAILURE_IFACE_EXISTS, iface);
-	}
-
-	// Otherwise, have wpa_supplicant attach to it.
-	struct wpa_supplicant* wpa_s = NULL;
-	struct wpa_interface iface_params;
-	os_memset(&iface_params, 0, sizeof(iface));
-	iface_params.ifname = ifname.c_str();
-	iface_params.confname = kConfigFilePath;
-	iface_params.driver = kDriverName;
-	wpa_s = wpa_supplicant_add_iface(wpa_global_, &iface_params, NULL);
-	if (!wpa_s) {
-		HIDL_RETURN(SupplicantStatusCode::FAILURE_UNKNOWN, iface);
-	}
-	// The supplicant core creates a corresponding hidl object via
-	// HidlManager when |wpa_supplicant_add_iface| is called.
-	HidlManager* hidl_manager = HidlManager::getInstance();
-	if (!hidl_manager ||
-	    hidl_manager->getIfaceHidlObjectByIfname(wpa_s->ifname, &iface)) {
-		HIDL_RETURN(SupplicantStatusCode::FAILURE_UNKNOWN, iface);
-	}
-
-	HIDL_RETURN(SupplicantStatusCode::SUCCESS, iface);
-}
-
-Return<void> Supplicant::removeInterface(
-    const hidl_string& ifname, removeInterface_cb _hidl_cb)
-{
-	struct wpa_supplicant* wpa_s;
-
-	wpa_s = wpa_supplicant_get_iface(wpa_global_, ifname.c_str());
-	if (!wpa_s) {
-		HIDL_RETURN(SupplicantStatusCode::FAILURE_IFACE_UNKNOWN);
-	}
-	if (wpa_supplicant_remove_iface(wpa_global_, wpa_s, 0)) {
-		HIDL_RETURN(SupplicantStatusCode::FAILURE_UNKNOWN);
-	}
-
-	HIDL_RETURN(SupplicantStatusCode::SUCCESS);
-}
-
 Return<void> Supplicant::getInterface(
-    const hidl_string& ifname, getInterface_cb _hidl_cb)
+    const IfaceInfo& iface_info, getInterface_cb _hidl_cb)
 {
-	android::sp<ISupplicantIface> iface;
-
 	struct wpa_supplicant* wpa_s =
-	    wpa_supplicant_get_iface(wpa_global_, ifname.c_str());
+	    wpa_supplicant_get_iface(wpa_global_, iface_info.name.c_str());
 	if (!wpa_s) {
-		HIDL_RETURN(SupplicantStatusCode::FAILURE_IFACE_UNKNOWN, iface);
+		HIDL_RETURN(
+		    SupplicantStatusCode::FAILURE_IFACE_UNKNOWN, nullptr);
 	}
 
 	HidlManager* hidl_manager = HidlManager::getInstance();
-	if (!hidl_manager ||
-	    hidl_manager->getIfaceHidlObjectByIfname(wpa_s->ifname, &iface)) {
-		HIDL_RETURN(SupplicantStatusCode::FAILURE_UNKNOWN, iface);
-	}
+	if (iface_info.type == IfaceType::P2P) {
+		android::sp<ISupplicantP2pIface> iface;
+		if (!hidl_manager ||
+		    hidl_manager->getP2pIfaceHidlObjectByIfname(
+			wpa_s->ifname, &iface)) {
+			HIDL_RETURN(
+			    SupplicantStatusCode::FAILURE_UNKNOWN, iface);
+		}
 
-	HIDL_RETURN(SupplicantStatusCode::SUCCESS, iface);
+		HIDL_RETURN(SupplicantStatusCode::SUCCESS, iface);
+	} else {
+		android::sp<ISupplicantStaIface> iface;
+		if (!hidl_manager ||
+		    hidl_manager->getStaIfaceHidlObjectByIfname(
+			wpa_s->ifname, &iface)) {
+			HIDL_RETURN(
+			    SupplicantStatusCode::FAILURE_UNKNOWN, iface);
+		}
+
+		HIDL_RETURN(SupplicantStatusCode::SUCCESS, iface);
+	}
 }
 
 Return<void> Supplicant::listInterfaces(listInterfaces_cb _hidl_cb)
 {
-	std::vector<hidl_string> ifnames;
+	std::vector<ISupplicant::IfaceInfo> ifaces;
 	for (struct wpa_supplicant* wpa_s = wpa_global_->ifaces; wpa_s;
 	     wpa_s = wpa_s->next) {
-		ifnames.emplace_back(wpa_s->ifname);
+		if (wpa_s->global->p2p_init_wpa_s == wpa_s) {
+			ifaces.emplace_back({IfaceType::P2P, wpa_s->ifname});
+		} else {
+			ifaces.emplace_back({IfaceType::STA, wpa_s->ifname});
+		}
 	}
 
-	HIDL_RETURN(SupplicantStatusCode::SUCCESS, ifnames);
+	HIDL_RETURN(SupplicantStatusCode::SUCCESS, ifaces);
 }
 
 Return<void> Supplicant::registerCallback(
diff --git a/wpa_supplicant/hidl/supplicant.h b/wpa_supplicant/hidl/supplicant.h
index cad4052..f4a77d9 100644
--- a/wpa_supplicant/hidl/supplicant.h
+++ b/wpa_supplicant/hidl/supplicant.h
@@ -41,12 +41,8 @@
 	~Supplicant() override = default;
 
 	// Hidl methods exposed.
-	Return<void> createInterface(
-	    const hidl_string& ifname, createInterface_cb _hidl_cb) override;
-	Return<void> removeInterface(
-	    const hidl_string& ifname, removeInterface_cb _hidl_cb) override;
 	Return<void> getInterface(
-	    const hidl_string& ifname, getInterface_cb _hidl_cb) override;
+	    const IfaceInfo& iface_info, getInterface_cb _hidl_cb) override;
 	Return<void> listInterfaces(listInterfaces_cb _hidl_cb) override;
 	Return<void> registerCallback(
 	    const sp<ISupplicantCallback>& callback,
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index c76b82d..6627b90 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -61,15 +61,15 @@
 
 int wpas_notify_iface_added(struct wpa_supplicant *wpa_s)
 {
-	if (wpa_s->p2p_mgmt)
-		return 0;
+	if (!wpa_s->p2p_mgmt) {
+		if (wpas_dbus_register_iface(wpa_s))
+			return -1;
 
-	if (wpas_dbus_register_iface(wpa_s))
-		return -1;
+		if (wpas_dbus_register_interface(wpa_s))
+			return -1;
+	}
 
-	if (wpas_dbus_register_interface(wpa_s))
-		return -1;
-
+	/* HIDL interface wants to keep track of the P2P mgmt iface. */
 	if (wpas_hidl_register_interface(wpa_s))
 		return -1;
 
@@ -79,15 +79,15 @@
 
 void wpas_notify_iface_removed(struct wpa_supplicant *wpa_s)
 {
-	if (wpa_s->p2p_mgmt)
-		return;
+	if (!wpa_s->p2p_mgmt) {
+		/* unregister interface in old DBus ctrl iface */
+		wpas_dbus_unregister_iface(wpa_s);
 
-	/* unregister interface in old DBus ctrl iface */
-	wpas_dbus_unregister_iface(wpa_s);
+		/* unregister interface in new DBus ctrl iface */
+		wpas_dbus_unregister_interface(wpa_s);
+	}
 
-	/* unregister interface in new DBus ctrl iface */
-	wpas_dbus_unregister_interface(wpa_s);
-
+	/* HIDL interface wants to keep track of the P2P mgmt iface. */
 	wpas_hidl_unregister_interface(wpa_s);
 }
 
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 25ec502..8cfb488 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -5225,13 +5225,15 @@
 		return NULL;
 	}
 
-	if (iface->p2p_mgmt == 0) {
-		/* Notify the control interfaces about new iface */
-		if (wpas_notify_iface_added(wpa_s)) {
-			wpa_supplicant_deinit_iface(wpa_s, 1, 0);
-			return NULL;
-		}
+	/* Notify the control interfaces about new iface */
+	if (wpas_notify_iface_added(wpa_s)) {
+		wpa_supplicant_deinit_iface(wpa_s, 1, 0);
+		return NULL;
+	}
 
+	/* Notify the control interfaces about new networks for non p2p mgmt
+	 * ifaces. */
+	if (iface->p2p_mgmt == 0) {
 		for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next)
 			wpas_notify_network_added(wpa_s, ssid);
 	}
