wifi: Update active iface when bridged AP instance down

The active interface need to be updated when any of interface changecd.

Also fix the local cache bridged_ap_instances value incorrect
when erasing.

Bug: 191625124
Test: Manual check property "wifi.active.interface" after wlan2 down
Test: Manual test with command "halutil -sar enable 0" after wlan2 down
Change-Id: I40150c231313505ca355228e711c2448088f41ad
This commit is contained in:
Les Lee
2021-06-21 21:25:20 +08:00
parent 251c0a79fb
commit 03d642f6d9

View File

@@ -1059,7 +1059,8 @@ WifiStatus WifiChip::removeIfaceInstanceFromBridgedApIfaceInternal(
// Requires to remove one of the instance in bridge mode
for (auto const& it : br_ifaces_ap_instances_) {
if (it.first == ifname) {
for (auto const& iface : it.second) {
std::vector<std::string> ap_instances = it.second;
for (auto const& iface : ap_instances) {
if (iface == ifInstanceName) {
if (!iface_util_->removeIfaceFromBridge(it.first, iface)) {
LOG(ERROR)
@@ -1075,13 +1076,20 @@ WifiStatus WifiChip::removeIfaceInstanceFromBridgedApIfaceInternal(
<< " " << legacyErrorToString(legacy_status);
return createWifiStatusFromLegacyError(legacy_status);
}
ap_instances.erase(
std::remove(ap_instances.begin(), ap_instances.end(),
ifInstanceName),
ap_instances.end());
br_ifaces_ap_instances_[ifname] = ap_instances;
break;
}
}
break;
}
}
br_ifaces_ap_instances_.erase(ifInstanceName);
iface->removeInstance(ifInstanceName);
setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName());
return createWifiStatus(WifiStatusCode::SUCCESS);
}