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.h b/hostapd/hidl/1.3/hostapd.h
index 059e24a..79354d3 100644
--- a/hostapd/hidl/1.3/hostapd.h
+++ b/hostapd/hidl/1.3/hostapd.h
@@ -20,12 +20,26 @@
extern "C"
{
#include "utils/common.h"
+#include "utils/eloop.h"
#include "utils/includes.h"
#include "utils/wpa_debug.h"
#include "ap/hostapd.h"
#include "ap/sta_info.h"
}
+class DeathNotifier : public android::hardware::hidl_death_recipient
+{
+public:
+ void serviceDied(
+ uint64_t /*cookie*/,
+ const android::wp<android::hidl::base::V1_0::IBase>
+ & /* who */) override
+ {
+ wpa_printf(MSG_ERROR, "Client died. Terminating...");
+ eloop_terminate();
+ }
+};
+
namespace android {
namespace hardware {
namespace wifi {
@@ -104,6 +118,8 @@
struct hapd_interfaces* interfaces_;
// Callbacks registered.
std::vector<sp<V1_3::IHostapdCallback>> callbacks_;
+ // Death notifier.
+ android::sp<DeathNotifier> death_notifier_;
DISALLOW_COPY_AND_ASSIGN(Hostapd);
};
} // namespace implementation