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
This commit is contained in:
Gabriel Biren
2023-01-31 01:07:38 +00:00
parent e45012e469
commit 2f7bec812a

View File

@@ -1146,8 +1146,7 @@ std::pair<std::shared_ptr<IWifiStaIface>, ndk::ScopedAStatus> WifiChip::createSt
<< 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()) {