[WiFi] Fix Vendor HAL wifi_get_link_stats

Emulator has its own implementation of wifi_get_link_stats which
reports link layer stats received from kernel.
There are 2 bugs in its implementation which caused the CTS test case
to fail.

1, FindAttribute function doesn't correctly parse nlmsg received from
kernel. Therefore, we use the API from libnl instead.

2, Based on the wifi_legacy_hal implementation in framework,
wifi_get_link_stats should be blocking and must invoke the
wifi_stats_result_handler within the function itself. Otherwise,
the result handler might never be called again because
wifi_legacy_hal set it to nullptr after calling wifi_get_link_stats.
Therefore, we make the API to wait until onLinkStatsReply is called
in order to avoid the race condition.

BUG: 158503396
TEST: run cts -m CtsWifiTestCases -t
android.net.wifi.cts.WifiManagerTest#testTrafficStateCallback

Signed-off-by: Weilun Du <wdu@google.com>
Change-Id: If50d6bbccd142b0d05c0e7e4ed1eecc3be2b3c5d
(cherry picked from commit 08c3e77e9bb5416c876f7169769c9aa744a66f23)
4 files changed