wifi: implement the API for setting roaming consortium selection
Bug: 210879633
Test: atest VtsHalWifiSupplicantStaNetworkTargetTest
Change-Id: Ie4725bad8f466ff975667aadccecb8a7cae79dfe
diff --git a/wpa_supplicant/aidl/sta_network.cpp b/wpa_supplicant/aidl/sta_network.cpp
index b59d103..c195190 100644
--- a/wpa_supplicant/aidl/sta_network.cpp
+++ b/wpa_supplicant/aidl/sta_network.cpp
@@ -855,6 +855,14 @@
&StaNetwork::enableSaePkOnlyModeInternal, in_enable);
}
+::ndk::ScopedAStatus StaNetwork::setRoamingConsortiumSelection(
+ const std::vector<uint8_t>& in_selectedRcoi)
+{
+ return validateAndCall(
+ this, SupplicantStatusCode::FAILURE_NETWORK_INVALID,
+ &StaNetwork::setRoamingConsortiumSelectionInternal, in_selectedRcoi);
+}
+
std::pair<uint32_t, ndk::ScopedAStatus> StaNetwork::getIdInternal()
{
return {network_id_, ndk::ScopedAStatus::ok()};
@@ -2185,6 +2193,26 @@
ndk::ScopedAStatus::ok()};
}
+ndk::ScopedAStatus StaNetwork::setRoamingConsortiumSelectionInternal(
+ const std::vector<uint8_t> &selectedRcoi)
+{
+ struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
+ if (wpa_ssid == NULL) {
+ return createStatus(SupplicantStatusCode::FAILURE_NETWORK_INVALID);
+ }
+
+ if (setByteArrayFieldAndResetState(
+ selectedRcoi.data(), selectedRcoi.size(),
+ &(wpa_ssid->roaming_consortium_selection),
+ &(wpa_ssid->roaming_consortium_selection_len),
+ "roaming_consortium_selection")) {
+ return createStatus(SupplicantStatusCode::FAILURE_UNKNOWN);
+ }
+
+ resetInternalStateAfterParamsUpdate();
+ return ndk::ScopedAStatus::ok();
+}
+
/**
* Retrieve the underlying |wpa_ssid| struct pointer for
* this network.
diff --git a/wpa_supplicant/aidl/sta_network.h b/wpa_supplicant/aidl/sta_network.h
index f1ef1ad..704ce2e 100644
--- a/wpa_supplicant/aidl/sta_network.h
+++ b/wpa_supplicant/aidl/sta_network.h
@@ -169,6 +169,8 @@
::ndk::ScopedAStatus setEapErp(bool in_enable) override;
::ndk::ScopedAStatus setSaeH2eMode(SaeH2eMode in_mode) override;
::ndk::ScopedAStatus enableSaePkOnlyMode(bool in_enable) override;
+ ::ndk::ScopedAStatus setRoamingConsortiumSelection(
+ const std::vector<uint8_t>& in_selectedRcoi) override;
private:
// Corresponding worker functions for the AIDL methods.
@@ -295,6 +297,8 @@
std::pair<std::vector<uint8_t>, ndk::ScopedAStatus> getWapiPskInternal();
ndk::ScopedAStatus setSaeH2eModeInternal(SaeH2eMode mode);
ndk::ScopedAStatus enableSaePkOnlyModeInternal(bool enable);
+ ndk::ScopedAStatus setRoamingConsortiumSelectionInternal(
+ const std::vector<uint8_t>& selectedRcoi);
struct wpa_ssid* retrieveNetworkPtr();
struct wpa_supplicant* retrieveIfacePtr();