From 4c1b6780b4fd2111a23ee47e9aab0a6ec7aa8b82 Mon Sep 17 00:00:00 2001 From: Kyounghan Lee Date: Wed, 29 Jan 2020 14:56:15 +0900 Subject: [PATCH] wifi(implementation): Clear wifi event callback objects while stopping This fixes a deadlock between WifiNative and HalDeviceManager because it removes about 30 times callbacks of IWifiEventCallback#onFailure() or onStop(). Such excessive callbacks within a short period tend to make high probabilities of the deadlock. Note: This is a side effect of how the framework is registering multiple callbacks. But, unfortunately there is no HAL API to unregister callback. So, this is somewhat of a workaround fix. Bug: 144137870 Test: Verified that the HAL no longer accumulates callbacks from framework. Test: Device boots up and connects to wifi networks. Change-Id: I441e2f815a0a49c3936615f06a65a6ed5366a628 Merged-In: I441e2f815a0a49c3936615f06a65a6ed5366a628 --- wifi/1.3/default/wifi.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wifi/1.3/default/wifi.cpp b/wifi/1.3/default/wifi.cpp index 2f21819dbc..4229d352d5 100644 --- a/wifi/1.3/default/wifi.cpp +++ b/wifi/1.3/default/wifi.cpp @@ -124,6 +124,8 @@ WifiStatus Wifi::startInternal() { } } LOG(ERROR) << "Wifi HAL start failed"; + // Clear the event callback objects since the HAL start failed. + event_cb_handler_.invalidate(); } return wifi_status; } @@ -158,6 +160,8 @@ WifiStatus Wifi::stopInternal( } LOG(ERROR) << "Wifi HAL stop failed"; } + // Clear the event callback objects since the HAL is now stopped. + event_cb_handler_.invalidate(); return wifi_status; }