From 2f7bec812a0ae72ec6266b268d3ff650afede314 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Tue, 31 Jan 2023 01:07:38 +0000 Subject: [PATCH] Make WifiStaIfaces using the create() method. Unlike the default constructor, create() populates the weak_ptr_this_ variable, which is needed for callbacks from the legacy hal. Bug: 265857332 Test: Manual test - connect to an AP and walk away from it. Check that the RSSI callback is triggered in the framework. Change-Id: I1a10a75c07ea59a3e01b9bb68d9d393bbd20d29d --- wifi/aidl/default/wifi_chip.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp index 6f43e0669d..541de166ce 100644 --- a/wifi/aidl/default/wifi_chip.cpp +++ b/wifi/aidl/default/wifi_chip.cpp @@ -1146,8 +1146,7 @@ std::pair, ndk::ScopedAStatus> WifiChip::createSt << legacyErrorToString(legacy_status); return {nullptr, createWifiStatusFromLegacyError(legacy_status)}; } - std::shared_ptr iface = - ndk::SharedRefBase::make(ifname, legacy_hal_, iface_util_); + std::shared_ptr iface = WifiStaIface::create(ifname, legacy_hal_, iface_util_); sta_ifaces_.push_back(iface); for (const auto& callback : event_cb_handler_.getCallbacks()) { if (!callback->onIfaceAdded(IfaceType::STA, ifname).isOk()) {