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
diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp
index 6f43e06..541de16 100644
--- a/wifi/aidl/default/wifi_chip.cpp
+++ b/wifi/aidl/default/wifi_chip.cpp
@@ -1146,8 +1146,7 @@
<< legacyErrorToString(legacy_status);
return {nullptr, createWifiStatusFromLegacyError(legacy_status)};
}
- std::shared_ptr<WifiStaIface> iface =
- ndk::SharedRefBase::make<WifiStaIface>(ifname, legacy_hal_, iface_util_);
+ std::shared_ptr<WifiStaIface> 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()) {