binder: Add parcelable for iface params
Replace the |CreateInterface| method params from dictionary
to parcelable type.
BUG: 30066497
TEST: Ran the integration tests under |wificond|.
Change-Id: Iea0dbce3ce55df0735afa3de532fa25fe6802aa3
diff --git a/wpa_supplicant/binder/supplicant.cpp b/wpa_supplicant/binder/supplicant.cpp
index fccf9ca..38b7e44 100644
--- a/wpa_supplicant/binder/supplicant.cpp
+++ b/wpa_supplicant/binder/supplicant.cpp
@@ -15,28 +15,21 @@
Supplicant::Supplicant(struct wpa_global *global) : wpa_global_(global) {}
android::binder::Status Supplicant::CreateInterface(
- const android::os::PersistableBundle ¶ms,
+ const fi::w1::wpa_supplicant::ParcelableIfaceParams ¶ms,
android::sp<fi::w1::wpa_supplicant::IIface> *iface_object_out)
{
- android::String16 driver, ifname, confname, bridge_ifname;
-
/* Check if required Ifname argument is missing */
- if (!params.getString(android::String16("Ifname"), &ifname)) {
+ if (params.ifname_.isEmpty()) {
return android::binder::Status::fromExceptionCode(
android::binder::Status::EX_ILLEGAL_ARGUMENT,
"Ifname missing in params.");
}
- /* Retrieve the remaining params from the dictionary */
- params.getString(android::String16("Driver"), &driver);
- params.getString(android::String16("ConfigFile"), &confname);
- params.getString(android::String16("BridgeIfname"), &bridge_ifname);
-
/*
* Try to get the wpa_supplicant record for this iface, return
* an error if we already control it.
*/
- if (wpa_supplicant_get_iface(
- wpa_global_, android::String8(ifname).string()) != NULL) {
+ if (wpa_supplicant_get_iface(wpa_global_, params.ifname_.string()) !=
+ NULL) {
return android::binder::Status::fromServiceSpecificError(
ERROR_IFACE_EXISTS,
"wpa_supplicant already controls this interface.");
@@ -47,11 +40,10 @@
struct wpa_interface iface;
os_memset(&iface, 0, sizeof(iface));
- iface.driver = os_strdup(android::String8(driver).string());
- iface.ifname = os_strdup(android::String8(ifname).string());
- iface.confname = os_strdup(android::String8(confname).string());
- iface.bridge_ifname =
- os_strdup(android::String8(bridge_ifname).string());
+ iface.driver = os_strdup(params.driver_.string());
+ iface.ifname = os_strdup(params.ifname_.string());
+ iface.confname = os_strdup(params.config_file_.string());
+ iface.bridge_ifname = os_strdup(params.bridge_ifname_.string());
/* Otherwise, have wpa_supplicant attach to it. */
wpa_s = wpa_supplicant_add_iface(wpa_global_, &iface, NULL);
/* The supplicant core creates a corresponding binder object via