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
This commit is contained in:
Kyounghan Lee
2020-01-29 14:56:15 +09:00
committed by Roshan Pius
parent 43f65e0f60
commit 4c1b6780b4

View File

@@ -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;
}