summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPurushottam Kushwaha <quic_pkushwah@quicinc.com>2023-09-25 18:14:46 +0530
committerSunil Ravi <sunilravi@google.com>2023-09-29 20:22:49 +0000
commit563d85f4a58cbf4b317b2944d81dcc88ecc1a3db (patch)
treecbf2c028552a8dbed25e609ef77e0bcc24b38831
parent132d4aac62d4caf4f2c68ee6027338f9996c0311 (diff)
downloadwificond-563d85f4a58cbf4b317b2944d81dcc88ecc1a3db.tar.gz
Update country code immediately on registerWificondEventCallback().
Reg domain change event may not be sent to userspace when new country is same as old country code in host driver. Thus, userspace parameters would not get updated with current driver country code. Since wificond may have knowledge of last country code, on register for registerWificondEventCallback() callbacks, trigger country code update event OnRegDomainChanged() to announce the last known driver country code. Bug: 296552605 Test: Manual - start Wifi and Softap in 5GHz and trigger framework restart (adb shell stop && adb shell start). start SoftAp in 5GHz. Observe country code notification from wificond is received and SoftAp is able to start without delay. Change-Id: I14aa53570cc6c4ea81e5e8b307a6653612e47fe8 Signed-off-by: Purushottam Kushwaha <quic_pkushwah@quicinc.com>
-rw-r--r--server.cpp21
-rw-r--r--server.h4
2 files changed, 15 insertions, 10 deletions
diff --git a/server.cpp b/server.cpp
index 9b6bc38..a1fbefa 100644
--- a/server.cpp
+++ b/server.cpp
@@ -77,6 +77,11 @@ Status Server::registerWificondEventCallback(const sp<IWificondEventCallback>& c
}
LOG(INFO) << "New wificond event callback registered";
wificond_event_callbacks_.push_back(callback);
+
+ // Inform immediately about current country code
+ if (!current_country_code_.empty())
+ callback->OnRegDomainChanged(current_country_code_);
+
return Status::ok();
}
@@ -514,19 +519,18 @@ void Server::handleCountryCodeChanged() {
}
void Server::OnRegDomainChanged(uint32_t wiphy_index, std::string& country_code) {
- string current_country_code;
if (country_code.empty()) {
LOG(DEBUG) << "Regulatory domain changed with empty country code (world mode?)";
- if (!netlink_utils_->GetCountryCode(&current_country_code)) {
+ if (!netlink_utils_->GetCountryCode(&current_country_code_)) {
LOG(ERROR) << "Fail to get country code on wiphy_index:" << wiphy_index;
}
} else {
- current_country_code = country_code;
+ current_country_code_ = country_code;
}
- if (!current_country_code.empty()) {
- LOG(INFO) << "Regulatory domain changed to country: " << current_country_code
+ if (!current_country_code_.empty()) {
+ LOG(INFO) << "Regulatory domain changed to country: " << current_country_code_
<< " on wiphy_index: " << wiphy_index;
- BroadcastRegDomainChanged(current_country_code);
+ BroadcastRegDomainChanged();
}
// Sometimes lower layer sends stale wiphy index when there are no
// interfaces. So update band - wiphy index mapping only if an
@@ -610,10 +614,9 @@ void Server::BroadcastApInterfaceTornDown(
}
}
-void Server::BroadcastRegDomainChanged(
- std::string country_code) {
+void Server::BroadcastRegDomainChanged() {
for (const auto& it : wificond_event_callbacks_) {
- it->OnRegDomainChanged(country_code);
+ it->OnRegDomainChanged(current_country_code_);
}
}
diff --git a/server.h b/server.h
index df0968c..35f214a 100644
--- a/server.h
+++ b/server.h
@@ -130,7 +130,7 @@ class Server : public android::net::wifi::nl80211::BnWificond {
android::sp<android::net::wifi::nl80211::IClientInterface> network_interface);
void BroadcastApInterfaceTornDown(
android::sp<android::net::wifi::nl80211::IApInterface> network_interface);
- void BroadcastRegDomainChanged(std::string country_code);
+ void BroadcastRegDomainChanged();
void MarkDownAllInterfaces();
int FindWiphyIndex(const std::string& iface_name);
bool GetBandInfo(int wiphy_index, BandInfo* band_info);
@@ -156,6 +156,8 @@ class Server : public android::net::wifi::nl80211::BnWificond {
// Cached interface list from kernel for dumping.
std::vector<InterfaceInfo> debug_interfaces_;
+ std::string current_country_code_;
+
DISALLOW_COPY_AND_ASSIGN(Server);
};