wpa: Terminate on callback client death
supplicant/hostapd are single client HAL's. So, the daemon should
terminate when the client is dead.
Also, removed a bunch of TODO's/#ifdef guarding death notification
handling in supplicant.
Bug: 169651797
Test: Manual
i) adb shell stop
ii) Ensure wpa_supplicant is killed (via ps-ef & lshal)
Change-Id: I0d32f2a91cbe807145fe0c544460467ff24fa2cc
diff --git a/hostapd/hidl/1.3/hostapd.cpp b/hostapd/hidl/1.3/hostapd.cpp
index 17dd7f5..668d8f4 100644
--- a/hostapd/hidl/1.3/hostapd.cpp
+++ b/hostapd/hidl/1.3/hostapd.cpp
@@ -20,7 +20,6 @@
extern "C"
{
#include "common/wpa_ctrl.h"
-#include "utils/eloop.h"
}
// The HIDL implementation for hostapd creates a hostapd.conf dynamically for
@@ -550,7 +549,8 @@
using hidl_return_util::call;
using namespace android::hardware::wifi::hostapd::V1_0;
-Hostapd::Hostapd(struct hapd_interfaces* interfaces) : interfaces_(interfaces)
+Hostapd::Hostapd(struct hapd_interfaces* interfaces)
+ : interfaces_(interfaces), death_notifier_(sp<DeathNotifier>::make())
{}
Return<void> Hostapd::addAccessPoint(
@@ -779,6 +779,13 @@
V1_2::HostapdStatus Hostapd::registerCallbackInternal_1_3(
const sp<V1_3::IHostapdCallback>& callback)
{
+ if (!callback->linkToDeath(death_notifier_, 0)) {
+ wpa_printf(
+ MSG_ERROR,
+ "Error registering for death notification for "
+ "hostapd callback object");
+ return {V1_2::HostapdStatusCode::FAILURE_UNKNOWN, ""};
+ }
callbacks_.push_back(callback);
return {V1_2::HostapdStatusCode::SUCCESS, ""};
}