Send frequency changed event to framework

When supplicant receives the channel change event
(NL80211_CMD_CH_SWITCH_NOTIFY) from driver, send
the new operating frequency information to framework.

Bug: 202758240
Test: Manually triggered channel switch through hostapd command
    and verified the new frequency in p2p group info logs
Change-Id: I05f10077ac497b934eb2c0560e179cdf4ed1497f
This commit is contained in:
Sunil Ravi
2021-12-08 19:01:44 -08:00
parent 658bbdfa1a
commit 23087aade7
5 changed files with 44 additions and 0 deletions

View File

@@ -921,3 +921,18 @@ void wpas_aidl_notify_network_not_found(struct wpa_supplicant *wpa_s)
aidl_manager->notifyNetworkNotFound(wpa_s);
}
void wpas_aidl_notify_bss_freq_changed(struct wpa_supplicant *wpa_s)
{
if (!wpa_s)
return;
AidlManager *aidl_manager = AidlManager::getInstance();
if (!aidl_manager)
return;
wpa_printf(MSG_DEBUG, "Notify %s frequency changed to %d",
wpa_s->ifname, wpa_s->assoc_freq);
aidl_manager->notifyBssFreqChanged(wpa_s);
}

View File

@@ -126,6 +126,7 @@ extern "C"
void wpas_aidl_notify_transition_disable(
struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, u8 bitmap);
void wpas_aidl_notify_network_not_found(struct wpa_supplicant *wpa_s);
void wpas_aidl_notify_bss_freq_changed(struct wpa_supplicant *wpa_s);
#else // CONFIG_CTRL_IFACE_AIDL
static inline int wpas_aidl_register_interface(struct wpa_supplicant *wpa_s)
{
@@ -277,6 +278,8 @@ static void wpas_aidl_notify_transition_disable(struct wpa_supplicant *wpa_s,
{}
static void wpas_aidl_notify_network_not_found(struct wpa_supplicant *wpa_s)
{}
void wpas_aidl_notify_bss_freq_changed(struct wpa_supplicant *wpa_s)
{}
#endif // CONFIG_CTRL_IFACE_AIDL
#ifdef _cplusplus

View File

@@ -1892,6 +1892,29 @@ void AidlManager::notifyNetworkNotFound(struct wpa_supplicant *wpa_s)
callWithEachStaIfaceCallback(misc_utils::charBufToString(wpa_s->ifname), func);
}
void AidlManager::notifyBssFreqChanged(struct wpa_supplicant *wpa_group_s)
{
if (!wpa_group_s || !wpa_group_s->parent)
return;
// For group notifications, need to use the parent iface for callbacks.
struct wpa_supplicant *wpa_s = getTargetP2pIfaceForGroup(wpa_group_s);
if (!wpa_s) {
wpa_printf(MSG_INFO, "Drop BSS frequency changed event");
return;
}
uint32_t aidl_freq = wpa_group_s->current_bss
? wpa_group_s->current_bss->freq
: wpa_group_s->assoc_freq;
const std::function<
ndk::ScopedAStatus(std::shared_ptr<ISupplicantP2pIfaceCallback>)>
func = std::bind(&ISupplicantP2pIfaceCallback::onGroupFrequencyChanged,
std::placeholders::_1, misc_utils::charBufToString(wpa_group_s->ifname), aidl_freq);
callWithEachP2pIfaceCallback(misc_utils::charBufToString(wpa_s->ifname), func);
}
/**
* Retrieve the |ISupplicantP2pIface| aidl object reference using the provided
* ifname.

View File

@@ -143,6 +143,7 @@ public:
struct wpa_ssid *ssid,
u8 bitmap);
void notifyNetworkNotFound(struct wpa_supplicant *wpa_s);
void notifyBssFreqChanged(struct wpa_supplicant *wpa_s);
// Methods called from aidl objects.
void notifyExtRadioWorkStart(struct wpa_supplicant *wpa_s, uint32_t id);

View File

@@ -467,6 +467,8 @@ void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s,
return;
wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id);
wpas_aidl_notify_bss_freq_changed(wpa_s);
}