Fix hidl p2p network register & notifyStaApAuth

Added a 'registerNetwork' call to the persistent_group_added
notification within supplicant (and unregister to group removed).
Changed notifyApStaAuthorized to now send p2pCallbacks from the parent
interface theyre received on, instead of the dynamic GO child iface.

Bug: 37286961
Test: Manual + CTS Verifier
Change-Id: Ifba98ae39023063629a244c0678a191d91bc693c
diff --git a/wpa_supplicant/hidl/hidl_manager.cpp b/wpa_supplicant/hidl/hidl_manager.cpp
index 727af57..15f4111 100644
--- a/wpa_supplicant/hidl/hidl_manager.cpp
+++ b/wpa_supplicant/hidl/hidl_manager.cpp
@@ -1323,15 +1323,14 @@
 void HidlManager::notifyApStaAuthorized(
     struct wpa_supplicant *wpa_s, const u8 *sta, const u8 *p2p_dev_addr)
 {
-	if (!wpa_s || !sta || !p2p_dev_addr)
+	if (!wpa_s || !wpa_s->parent || !sta || !p2p_dev_addr)
 		return;
-
-	if (p2p_iface_object_map_.find(wpa_s->ifname) ==
+	if (p2p_iface_object_map_.find(wpa_s->parent->ifname) ==
 	    p2p_iface_object_map_.end())
 		return;
 
 	callWithEachP2pIfaceCallback(
-	    wpa_s->ifname, std::bind(
+	    wpa_s->parent->ifname, std::bind(
 			       &ISupplicantP2pIfaceCallback::onStaAuthorized,
 			       std::placeholders::_1, sta, p2p_dev_addr));
 }
@@ -1339,15 +1338,14 @@
 void HidlManager::notifyApStaDeauthorized(
     struct wpa_supplicant *wpa_s, const u8 *sta, const u8 *p2p_dev_addr)
 {
-	if (!wpa_s || !sta || !p2p_dev_addr)
+	if (!wpa_s || !wpa_s->parent || !sta || !p2p_dev_addr)
 		return;
-
-	if (p2p_iface_object_map_.find(wpa_s->ifname) ==
+	if (p2p_iface_object_map_.find(wpa_s->parent->ifname) ==
 	    p2p_iface_object_map_.end())
 		return;
 
 	callWithEachP2pIfaceCallback(
-	    wpa_s->ifname, std::bind(
+	    wpa_s->parent->ifname, std::bind(
 			       &ISupplicantP2pIfaceCallback::onStaDeauthorized,
 			       std::placeholders::_1, sta, p2p_dev_addr));
 }
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index faf71d5..c720c32 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -364,6 +364,7 @@
 {
 #ifdef CONFIG_P2P
 	wpas_dbus_register_persistent_group(wpa_s, ssid);
+	wpas_hidl_register_network(wpa_s, ssid);
 #endif /* CONFIG_P2P */
 }
 
@@ -373,6 +374,7 @@
 {
 #ifdef CONFIG_P2P
 	wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
+	wpas_hidl_unregister_network(wpa_s, ssid);
 #endif /* CONFIG_P2P */
 }