Merge "wpa_supplicant(hidl): Fixed network resp handling"
diff --git a/hostapd/hostapd.android.rc b/hostapd/hostapd.android.rc
index eee4b53..0ae27ca 100644
--- a/hostapd/hostapd.android.rc
+++ b/hostapd/hostapd.android.rc
@@ -14,7 +14,7 @@
         /data/misc/wifi/hostapd.conf
     class main
     user wifi
-    group wifi net_raw
+    group wifi
     writepid /data/misc/wifi/hostapd.pid
     disabled
     oneshot
diff --git a/wpa_supplicant/hidl/hidl.cpp b/wpa_supplicant/hidl/hidl.cpp
index 09f09ce..b7c1345 100644
--- a/wpa_supplicant/hidl/hidl.cpp
+++ b/wpa_supplicant/hidl/hidl.cpp
@@ -8,8 +8,8 @@
  */
 
 #include <hwbinder/IPCThreadState.h>
-#include <hwbinder/ProcessState.h>
 
+#include <hidl/HidlTransportSupport.h>
 #include "hidl_manager.h"
 
 extern "C" {
@@ -20,15 +20,13 @@
 #include "utils/includes.h"
 }
 
-using android::hardware::ProcessState;
+using android::hardware::configureRpcThreadpool;
 using android::hardware::IPCThreadState;
 using android::hardware::wifi::supplicant::V1_0::implementation::HidlManager;
 
 void wpas_hidl_sock_handler(
-    int /* sock */, void * /* eloop_ctx */, void *sock_ctx)
+    int /* sock */, void * /* eloop_ctx */, void * /* sock_ctx */)
 {
-	struct wpas_hidl_priv *priv = (wpas_hidl_priv *)sock_ctx;
-	wpa_printf(MSG_DEBUG, "Processing hidl events on FD %d", priv->hidl_fd);
 	IPCThreadState::self()->handlePolledCommands();
 }
 
@@ -44,7 +42,7 @@
 
 	wpa_printf(MSG_DEBUG, "Initing hidl control");
 
-	ProcessState::self()->setThreadPoolMaxThreadCount(0);
+	configureRpcThreadpool(1, true /* callerWillJoin */);
 	IPCThreadState::self()->disableBackgroundScheduling(true);
 	IPCThreadState::self()->setupPolling(&priv->hidl_fd);
 	if (priv->hidl_fd < 0)
diff --git a/wpa_supplicant/hidl/p2p_iface.cpp b/wpa_supplicant/hidl/p2p_iface.cpp
index 6251339..857fe1a 100644
--- a/wpa_supplicant/hidl/p2p_iface.cpp
+++ b/wpa_supplicant/hidl/p2p_iface.cpp
@@ -237,13 +237,13 @@
 }
 
 Return<void> P2pIface::configureExtListen(
-    bool enable, uint32_t period_in_millis, uint32_t interval_in_millis,
+    uint32_t period_in_millis, uint32_t interval_in_millis,
     configureExtListen_cb _hidl_cb)
 {
 	return validateAndCall(
 	    this, SupplicantStatusCode::FAILURE_IFACE_INVALID,
-	    &P2pIface::configureExtListenInternal, _hidl_cb, enable,
-	    period_in_millis, interval_in_millis);
+	    &P2pIface::configureExtListenInternal, _hidl_cb, period_in_millis,
+	    interval_in_millis);
 }
 
 Return<void> P2pIface::setListenChannel(
@@ -315,13 +315,11 @@
 	    service_name);
 }
 
-Return<void> P2pIface::flushServices(
-    uint32_t version, const hidl_string& service_name,
-    flushServices_cb _hidl_cb)
+Return<void> P2pIface::flushServices(flushServices_cb _hidl_cb)
 {
 	return validateAndCall(
 	    this, SupplicantStatusCode::FAILURE_IFACE_INVALID,
-	    &P2pIface::flushServicesInternal, _hidl_cb, version, service_name);
+	    &P2pIface::flushServicesInternal, _hidl_cb);
 }
 
 Return<void> P2pIface::requestServiceDiscovery(
@@ -682,7 +680,7 @@
 }
 
 SupplicantStatus P2pIface::configureExtListenInternal(
-    bool enable, uint32_t period_in_millis, uint32_t interval_in_millis)
+    uint32_t period_in_millis, uint32_t interval_in_millis)
 {
 	struct wpa_supplicant* wpa_s = retrieveIfacePtr();
 	if (wpas_p2p_ext_listen(wpa_s, period_in_millis, interval_in_millis)) {
@@ -825,8 +823,7 @@
 	return {SupplicantStatusCode::SUCCESS, ""};
 }
 
-SupplicantStatus P2pIface::flushServicesInternal(
-    uint32_t version, const std::string& service_name)
+SupplicantStatus P2pIface::flushServicesInternal()
 {
 	struct wpa_supplicant* wpa_s = retrieveIfacePtr();
 	wpas_p2p_service_flush(wpa_s);
diff --git a/wpa_supplicant/hidl/p2p_iface.h b/wpa_supplicant/hidl/p2p_iface.h
index c83f43b..5c814ae 100644
--- a/wpa_supplicant/hidl/p2p_iface.h
+++ b/wpa_supplicant/hidl/p2p_iface.h
@@ -104,7 +104,7 @@
 	    const hidl_array<uint8_t, 6>& peer_address,
 	    reinvoke_cb _hidl_cb) override;
 	Return<void> configureExtListen(
-	    bool enable, uint32_t period_in_millis, uint32_t interval_in_millis,
+	    uint32_t period_in_millis, uint32_t interval_in_millis,
 	    configureExtListen_cb _hidl_cb) override;
 	Return<void> setListenChannel(
 	    uint32_t channel, uint32_t operating_class,
@@ -130,9 +130,7 @@
 	Return<void> removeUpnpService(
 	    uint32_t version, const hidl_string& service_name,
 	    removeUpnpService_cb _hidl_cb) override;
-	Return<void> flushServices(
-	    uint32_t version, const hidl_string& service_name,
-	    flushServices_cb _hidl_cb) override;
+	Return<void> flushServices(flushServices_cb _hidl_cb) override;
 	Return<void> requestServiceDiscovery(
 	    const hidl_array<uint8_t, 6>& peer_address,
 	    const hidl_vec<uint8_t>& query,
@@ -189,8 +187,7 @@
 	    SupplicantNetworkId persistent_network_id,
 	    const std::array<uint8_t, 6>& peer_address);
 	SupplicantStatus configureExtListenInternal(
-	    bool enable, uint32_t period_in_millis,
-	    uint32_t interval_in_millis);
+	    uint32_t period_in_millis, uint32_t interval_in_millis);
 	SupplicantStatus setListenChannelInternal(
 	    uint32_t channel, uint32_t operating_class);
 	SupplicantStatus setDisallowedFrequenciesInternal(
@@ -208,8 +205,7 @@
 	    uint32_t version, const std::string& service_name);
 	SupplicantStatus removeUpnpServiceInternal(
 	    uint32_t version, const std::string& service_name);
-	SupplicantStatus flushServicesInternal(
-	    uint32_t version, const std::string& service_name);
+	SupplicantStatus flushServicesInternal();
 	std::pair<SupplicantStatus, uint64_t> requestServiceDiscoveryInternal(
 	    const std::array<uint8_t, 6>& peer_address,
 	    const std::vector<uint8_t>& query);