wpa_supplicant: HIDL implementation (1/2)

Renamed all file and variable names to "HIDL" from "Binder"/"AIDL".

Commands run:
rename 's/binder/hidl/' *
find . -type f -exec sed -i "s/binder/hidl/g" {} \;
find . -type f -exec sed -i "s/Binder/Hidl/g" {} \;
find . -type f -exec sed -i "s/BINDER/HIDL/g" {} \;

Bug: 31365276
Test: None
Change-Id: I435f91540027d55143eebc03afdbf463b5b092f7
diff --git a/wpa_supplicant/Android.mk b/wpa_supplicant/Android.mk
index e232e10..1c69a9f 100644
--- a/wpa_supplicant/Android.mk
+++ b/wpa_supplicant/Android.mk
@@ -49,7 +49,7 @@
 L_CFLAGS += -mabi=aapcs-linux
 endif
 
-# C++ flags for binder interface
+# C++ flags for hidl interface
 L_CPPFLAGS := -std=c++11 -Wall -Werror
 # TODO: Remove these allowed warnings later.
 L_CPPFLAGS += -Wno-unused-variable -Wno-unused-parameter
@@ -1355,9 +1355,9 @@
 OBJS += $(DBUS_OBJS)
 L_CFLAGS += $(DBUS_CFLAGS)
 
-ifdef CONFIG_CTRL_IFACE_BINDER
-WPA_SUPPLICANT_USE_BINDER=y
-L_CFLAGS += -DCONFIG_BINDER -DCONFIG_CTRL_IFACE_BINDER
+ifdef CONFIG_CTRL_IFACE_HIDL
+WPA_SUPPLICANT_USE_HIDL=y
+L_CFLAGS += -DCONFIG_HIDL -DCONFIG_CTRL_IFACE_HIDL
 endif
 
 ifdef CONFIG_READLINE
@@ -1597,9 +1597,10 @@
 ifeq ($(DBUS), y)
 LOCAL_SHARED_LIBRARIES += libdbus
 endif
-ifeq ($(WPA_SUPPLICANT_USE_BINDER), y)
-LOCAL_SHARED_LIBRARIES += libbinder libutils
-LOCAL_STATIC_LIBRARIES += libwpa_binder libwpa_binder_interface
+ifeq ($(WPA_SUPPLICANT_USE_HIDL), y)
+LOCAL_SHARED_LIBRARIES += android.hardware.wifi@1.0
+LOCAL_SHARED_LIBRARIES += libhidl libhwbinder libutils
+LOCAL_STATIC_LIBRARIES += libwpa_hidl
 endif
 include $(BUILD_EXECUTABLE)
 
@@ -1641,50 +1642,24 @@
 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/wpa_client_include
 include $(BUILD_SHARED_LIBRARY)
 
-ifeq ($(WPA_SUPPLICANT_USE_BINDER), y)
-### Binder interface library ###
+ifeq ($(WPA_SUPPLICANT_USE_HIDL), y)
+### Hidl service library ###
 ########################
-
 include $(CLEAR_VARS)
-LOCAL_MODULE := libwpa_binder_interface
-LOCAL_AIDL_INCLUDES := \
-    $(LOCAL_PATH)/binder \
-    frameworks/native/aidl/binder
-LOCAL_CPPFLAGS := $(L_CPPFLAGS)
-LOCAL_C_INCLUDES = \
-    $(LOCAL_PATH)/binder/include
-LOCAL_SRC_FILES := \
-    binder/binder_constants.cpp \
-    binder/parcelable_iface_params.cpp \
-    binder/fi/w1/wpa_supplicant/IIface.aidl \
-    binder/fi/w1/wpa_supplicant/IIfaceCallback.aidl \
-    binder/fi/w1/wpa_supplicant/INetwork.aidl \
-    binder/fi/w1/wpa_supplicant/INetworkCallback.aidl \
-    binder/fi/w1/wpa_supplicant/ISupplicant.aidl \
-    binder/fi/w1/wpa_supplicant/ISupplicantCallback.aidl
-LOCAL_SHARED_LIBRARIES := libbinder
-LOCAL_EXPORT_C_INCLUDE_DIRS := \
-    $(LOCAL_PATH)/binder/include
-include $(BUILD_STATIC_LIBRARY)
-
-### Binder service library ###
-########################
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := libwpa_binder
+LOCAL_MODULE := libwpa_hidl
 LOCAL_CPPFLAGS := $(L_CPPFLAGS)
 LOCAL_CFLAGS := $(L_CFLAGS)
 LOCAL_C_INCLUDES := $(INCLUDES)
 LOCAL_SRC_FILES := \
-    binder/binder.cpp \
-    binder/binder_manager.cpp \
-    binder/iface.cpp \
-    binder/network.cpp \
-    binder/supplicant.cpp
+    hidl/hidl.cpp \
+    hidl/hidl_manager.cpp \
+    hidl/iface.cpp \
+    hidl/network.cpp \
+    hidl/supplicant.cpp
 LOCAL_SHARED_LIBRARIES := \
-    libbinder \
+    android.hardware.wifi@1.0 \
+    libhidl \
+    libhwbinder \
     libutils
-LOCAL_STATIC_LIBRARIES := libwpa_binder_interface
 include $(BUILD_STATIC_LIBRARY)
-
-endif # BINDER == y
+endif # WPA_SUPPLICANT_USE_HIDL == y
diff --git a/wpa_supplicant/android.config b/wpa_supplicant/android.config
index 50c1958..2a5c810 100644
--- a/wpa_supplicant/android.config
+++ b/wpa_supplicant/android.config
@@ -324,9 +324,9 @@
 # Add introspection support for new DBus control interface
 #CONFIG_CTRL_IFACE_DBUS_INTRO=y
 
-# Add support for Binder control interface
+# Add support for Hidl control interface
 # Only applicable for Android platforms.
-CONFIG_CTRL_IFACE_BINDER=y
+CONFIG_CTRL_IFACE_HIDL=y
 
 # Add support for loading EAP methods dynamically as shared libraries.
 # When this option is enabled, each EAP method can be either included
diff --git a/wpa_supplicant/binder/binder.cpp b/wpa_supplicant/binder/binder.cpp
deleted file mode 100644
index 6a45754..0000000
--- a/wpa_supplicant/binder/binder.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * binder interface for wpa_supplicant daemon
- * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
- * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#include <binder/IPCThreadState.h>
-#include <binder/IServiceManager.h>
-#include <binder/ProcessState.h>
-
-#include "binder_manager.h"
-
-extern "C" {
-#include "binder.h"
-#include "binder_i.h"
-#include "utils/common.h"
-#include "utils/eloop.h"
-#include "utils/includes.h"
-}
-
-void wpas_binder_sock_handler(
-    int /* sock */, void * /* eloop_ctx */, void *sock_ctx)
-{
-	struct wpas_binder_priv *priv = (wpas_binder_priv *)sock_ctx;
-	wpa_printf(
-	    MSG_DEBUG, "Processing binder events on FD %d", priv->binder_fd);
-	android::IPCThreadState::self()->handlePolledCommands();
-}
-
-struct wpas_binder_priv *wpas_binder_init(struct wpa_global *global)
-{
-	struct wpas_binder_priv *priv;
-	wpa_supplicant_binder::BinderManager *binder_manager;
-
-	priv = (wpas_binder_priv *)os_zalloc(sizeof(*priv));
-	if (!priv)
-		return NULL;
-	priv->global = global;
-
-	wpa_printf(MSG_DEBUG, "Initing binder control");
-
-	android::ProcessState::self()->setThreadPoolMaxThreadCount(0);
-	android::IPCThreadState::self()->disableBackgroundScheduling(true);
-	android::IPCThreadState::self()->setupPolling(&priv->binder_fd);
-	if (priv->binder_fd < 0)
-		goto err;
-
-	wpa_printf(
-	    MSG_INFO, "Processing binder events on FD %d", priv->binder_fd);
-	/* Look for read events from the binder socket in the eloop. */
-	if (eloop_register_read_sock(
-		priv->binder_fd, wpas_binder_sock_handler, global, priv) < 0)
-		goto err;
-
-	binder_manager = wpa_supplicant_binder::BinderManager::getInstance();
-	if (!binder_manager)
-		goto err;
-	binder_manager->registerBinderService(global);
-	/* We may not need to store this binder manager reference in the
-	 * global data strucure because we've made it a singleton class. */
-	priv->binder_manager = (void *)binder_manager;
-
-	return priv;
-err:
-	wpas_binder_deinit(priv);
-	return NULL;
-}
-
-void wpas_binder_deinit(struct wpas_binder_priv *priv)
-{
-	if (!priv)
-		return;
-
-	wpa_printf(MSG_DEBUG, "Deiniting binder control");
-
-	wpa_supplicant_binder::BinderManager::destroyInstance();
-	eloop_unregister_read_sock(priv->binder_fd);
-	android::IPCThreadState::shutdown();
-	os_free(priv);
-}
-
-int wpas_binder_register_interface(struct wpa_supplicant *wpa_s)
-{
-	if (!wpa_s || !wpa_s->global->binder)
-		return 1;
-
-	wpa_printf(
-	    MSG_DEBUG, "Registering interface to binder control: %s",
-	    wpa_s->ifname);
-
-	wpa_supplicant_binder::BinderManager *binder_manager =
-	    wpa_supplicant_binder::BinderManager::getInstance();
-	if (!binder_manager)
-		return 1;
-
-	return binder_manager->registerInterface(wpa_s);
-}
-
-int wpas_binder_unregister_interface(struct wpa_supplicant *wpa_s)
-{
-	if (!wpa_s || !wpa_s->global->binder)
-		return 1;
-
-	wpa_printf(
-	    MSG_DEBUG, "Deregistering interface from binder control: %s",
-	    wpa_s->ifname);
-
-	wpa_supplicant_binder::BinderManager *binder_manager =
-	    wpa_supplicant_binder::BinderManager::getInstance();
-	if (!binder_manager)
-		return 1;
-
-	return binder_manager->unregisterInterface(wpa_s);
-}
-
-int wpas_binder_register_network(
-    struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
-{
-	if (!wpa_s || !wpa_s->global->binder || !ssid)
-		return 1;
-
-	wpa_printf(
-	    MSG_DEBUG, "Registering network to binder control: %d", ssid->id);
-
-	wpa_supplicant_binder::BinderManager *binder_manager =
-	    wpa_supplicant_binder::BinderManager::getInstance();
-	if (!binder_manager)
-		return 1;
-
-	return binder_manager->registerNetwork(wpa_s, ssid);
-}
-
-int wpas_binder_unregister_network(
-    struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
-{
-	if (!wpa_s || !wpa_s->global->binder || !ssid)
-		return 1;
-
-	wpa_printf(
-	    MSG_DEBUG, "Deregistering network from binder control: %d",
-	    ssid->id);
-
-	wpa_supplicant_binder::BinderManager *binder_manager =
-	    wpa_supplicant_binder::BinderManager::getInstance();
-	if (!binder_manager)
-		return 1;
-
-	return binder_manager->unregisterNetwork(wpa_s, ssid);
-}
-
-int wpas_binder_notify_state_changed(struct wpa_supplicant *wpa_s)
-{
-	if (!wpa_s || !wpa_s->global->binder)
-		return 1;
-
-	wpa_printf(
-	    MSG_DEBUG, "Notifying state change event to binder control: %d",
-	    wpa_s->wpa_state);
-
-	wpa_supplicant_binder::BinderManager *binder_manager =
-	    wpa_supplicant_binder::BinderManager::getInstance();
-	if (!binder_manager)
-		return 1;
-
-	return binder_manager->notifyStateChange(wpa_s);
-}
-
-int wpas_binder_notify_network_request(
-    struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
-    enum wpa_ctrl_req_type rtype, const char *default_txt)
-{
-	if (!wpa_s || !wpa_s->global->binder || !ssid)
-		return 1;
-
-	wpa_printf(
-	    MSG_DEBUG, "Notifying network request to binder control: %d",
-	    ssid->id);
-
-	wpa_supplicant_binder::BinderManager *binder_manager =
-	    wpa_supplicant_binder::BinderManager::getInstance();
-	if (!binder_manager)
-		return 1;
-
-	return binder_manager->notifyNetworkRequest(
-	    wpa_s, ssid, rtype, default_txt);
-}
diff --git a/wpa_supplicant/binder/binder.h b/wpa_supplicant/binder/binder.h
deleted file mode 100644
index 045a4fa..0000000
--- a/wpa_supplicant/binder/binder.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * binder interface for wpa_supplicant daemon
- * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
- * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#ifndef WPA_SUPPLICANT_BINDER_BINDER_H
-#define WPA_SUPPLICANT_BINDER_BINDER_H
-
-#ifdef _cplusplus
-extern "C" {
-#endif /* _cplusplus */
-
-/**
- * This is the binder RPC interface entry point to the wpa_supplicant core.
- * This initializes the binder driver & BinderManager instance and then forwards
- * all the notifcations from the supplicant core to the BinderManager.
- */
-struct wpas_binder_priv;
-struct wpa_global;
-
-struct wpas_binder_priv *wpas_binder_init(struct wpa_global *global);
-void wpas_binder_deinit(struct wpas_binder_priv *priv);
-
-#ifdef CONFIG_CTRL_IFACE_BINDER
-int wpas_binder_register_interface(struct wpa_supplicant *wpa_s);
-int wpas_binder_unregister_interface(struct wpa_supplicant *wpa_s);
-int wpas_binder_register_network(
-    struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
-int wpas_binder_unregister_network(
-    struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
-int wpas_binder_notify_state_changed(struct wpa_supplicant *wpa_s);
-int wpas_binder_notify_network_request(
-    struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
-    enum wpa_ctrl_req_type rtype, const char *default_txt);
-#else  /* CONFIG_CTRL_IFACE_BINDER */
-static inline int wpas_binder_register_interface(struct wpa_supplicant *wpa_s)
-{
-	return 0;
-}
-static inline int wpas_binder_unregister_interface(struct wpa_supplicant *wpa_s)
-{
-	return 0;
-}
-static inline int wpas_binder_register_network(
-    struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
-{
-	return 0;
-}
-static inline int wpas_binder_unregister_network(
-    struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
-{
-	return 0;
-}
-static inline int wpas_binder_notify_state_changed(struct wpa_supplicant *wpa_s)
-{
-	return 0;
-}
-static inline int wpas_binder_notify_network_request(
-    struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
-    enum wpa_ctrl_req_type rtype, const char *default_txt)
-{
-	return 0;
-}
-#endif /* CONFIG_CTRL_IFACE_BINDER */
-
-#ifdef _cplusplus
-}
-#endif /* _cplusplus */
-
-#endif /* WPA_SUPPLICANT_BINDER_BINDER_H */
diff --git a/wpa_supplicant/binder/binder_constants.cpp b/wpa_supplicant/binder/binder_constants.cpp
deleted file mode 100644
index 848c70e..0000000
--- a/wpa_supplicant/binder/binder_constants.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * binder interface for wpa_supplicant daemon
- * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
- * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#include "wpa_supplicant_binder/binder_constants.h"
-
-namespace wpa_supplicant_binder {
-namespace binder_constants {
-
-const char kServiceName[] = "wpa_supplicant";
-
-} /* namespace binder_constants */
-} /* namespace wpa_supplicant_binder */
diff --git a/wpa_supplicant/binder/fi/w1/wpa_supplicant/IIface.aidl b/wpa_supplicant/binder/fi/w1/wpa_supplicant/IIface.aidl
deleted file mode 100644
index 4769419..0000000
--- a/wpa_supplicant/binder/fi/w1/wpa_supplicant/IIface.aidl
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * binder interface for wpa_supplicant daemon
- * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
- * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-package fi.w1.wpa_supplicant;
-
-import fi.w1.wpa_supplicant.IIfaceCallback;
-import fi.w1.wpa_supplicant.INetwork;
-
-/**
- * Interface exposed by wpa_supplicant for each network interface it controls.
- */
-@utf8InCpp
-interface IIface {
-	/* Non-specific error encountered */
-	const int ERROR_GENERIC = 1;
-	/* Iface is no longer valid */
-	const int ERROR_IFACE_INVALID = 2;
-	/* Iface is currently disabled */
-	const int ERROR_IFACE_DISABLED = 3;
-	/* Iface is currently connected */
-	const int ERROR_IFACE_NOT_DISCONNECTED = 4;
-	/* Network being removed/retrieved does not exist */
-	const int ERROR_NETWORK_UNKNOWN = 5;
-
-	/** Length of mac_address param in |InitiateTDLS|* functions. */
-	const int MAC_ADDRESS_LEN = 6;
-
-	/**
-	 * Retrieves the name of the network interface.
-	 *
-	 * @return Name of the network interface, e.g., wlan0
-	 */
-	String GetName();
-
-	/**
-	 * Add a new network to the interface.
-	 *
-	 * @return Binder object representing the new network.
-	 */
-	INetwork AddNetwork();
-
-	/**
-	 * Remove a network from the interface.
-	 *
-	 * Use |INetwork.GetId()| on the corresponding network binder object
-	 * to retrieve the ID.
-	 *
-	 * @param id Network ID allocated to the corresponding network.
-	 */
-	void RemoveNetwork(in int id);
-
-	/**
-	 * Gets a binder object for the network corresponding to the network_id.
-	 *
-	 * Use |INetwork.GetId()| on the corresponding network binder object
-	 * to retrieve the ID.
-	 *
-	 * @param id Network ID allocated to the corresponding network.
-	 *
-	 * @return Binder object representing the network.
-	 */
-	INetwork GetNetwork(in int id);
-
-	/**
-	 * Register for callbacks from this interface.
-	 *
-	 * These callbacks are invoked for events that are specific to this interface.
-	 *
-	 * @param callback Binder object reference to a |IIfaceCallback|
-	 *        instance.
-	 */
-	void RegisterCallback(in IIfaceCallback callback);
-
-	/**
-	 * Reconnect to the currently active network, even if we are already
-	 * connected.
-	 */
-	void Reassociate();
-
-	/**
-	 * Reconnect to the currently active network, if we are currently
-	 * disconnected.
-	 */
-	void Reconnect();
-
-	/**
-	 * Disconnect from the current active network.
-	 */
-	void Disconnect();
-
-	/**
-	 * Turn on/off power save mode for the interface.
-	 *
-	 * @param enable Indicate if power save is to be turned on/off.
-	 */
-	void SetPowerSave(boolean enable);
-
-	/**
-	 * Initiate TDLS discover with the provided peer mac address.
-	 *
-	 * @param mac_address MAC address of the peer.
-	 */
-	void InitiateTDLSDiscover(in byte[] mac_address);
-
-	/**
-	 * Initiate TDLS setup with the provided peer mac address.
-	 *
-	 * @param mac_address MAC address of the peer.
-	 */
-	void InitiateTDLSSetup(in byte[] mac_address);
-
-	/**
-	 * Initiate TDLS teardown with the provided peer mac address.
-	 *
-	 * @param mac_address MAC address of the peer.
-	 */
-	void InitiateTDLSTeardown(in byte[] mac_address);
-}
diff --git a/wpa_supplicant/binder/fi/w1/wpa_supplicant/IIfaceCallback.aidl b/wpa_supplicant/binder/fi/w1/wpa_supplicant/IIfaceCallback.aidl
deleted file mode 100644
index 18ff513..0000000
--- a/wpa_supplicant/binder/fi/w1/wpa_supplicant/IIfaceCallback.aidl
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * binder interface for wpa_supplicant daemon
- * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
- * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-package fi.w1.wpa_supplicant;
-
-/**
- * Callback Interface exposed by the wpa_supplicant service
- * for each interface (IIface).
- *
- * Clients need to host an instance of this binder object and
- * pass a reference of the object to wpa_supplicant via the
- * corresponding |IIface.registerCallback| method.
- */
-@utf8InCpp
-interface IIfaceCallback {
-	/** Used to indicate a non specific network event via |OnStateChanged|.*/
-	const int NETWORK_ID_INVALID = -1;
-
-	/** Various states of the interface reported by |OnStateChanged|.*/
-	/**
-	 * STATE_DISCONNECTED - Disconnected state
-	 *
-	 * This state indicates that client is not associated, but is likely to
-	 * start looking for an access point. This state is entered when a
-	 * connection is lost.
-	 */
-	const int STATE_DISCONNECTED = 0;
-	/**
-	 * STATE_INTERFACE_DISABLED - Interface disabled
-	 *
-	 * This state is entered if the network interface is disabled, e.g.,
-	 * due to rfkill. wpa_supplicant refuses any new operations that would
-	 * use the radio until the interface has been enabled.
-	 */
-	const int STATE_INTERFACE_DISABLED = 1;
-	/**
-	 * STATE_INACTIVE - Inactive state (wpa_supplicant disabled)
-	 *
-	 * This state is entered if there are no enabled networks in the
-	 * configuration. wpa_supplicant is not trying to associate with a new
-	 * network and external interaction (e.g., ctrl_iface call to add or
-	 * enable a network) is needed to start association.
-	 */
-	const int STATE_INACTIVE = 2;
-	/**
-	 * STATE_SCANNING - Scanning for a network
-	 *
-	 * This state is entered when wpa_supplicant starts scanning for a
-	 * network.
-	 */
-	const int STATE_SCANNING = 3;
-	/**
-	 * STATE_AUTHENTICATING - Trying to authenticate with a BSS/SSID
-	 *
-	 * This state is entered when wpa_supplicant has found a suitable BSS
-	 * to authenticate with and the driver is configured to try to
-	 * authenticate with this BSS. This state is used only with drivers
-	 * that use wpa_supplicant as the SME.
-	 */
-	const int STATE_AUTHENTICATING = 4;
-	/**
-	 * STATE_ASSOCIATING - Trying to associate with a BSS/SSID
-	 *
-	 * This state is entered when wpa_supplicant has found a suitable BSS
-	 * to associate with and the driver is configured to try to associate
-	 * with this BSS in ap_scan=1 mode. When using ap_scan=2 mode, this
-	 * state is entered when the driver is configured to try to associate
-	 * with a network using the configured SSID and security policy.
-	 */
-	const int STATE_ASSOCIATING = 5;
-	/**
-	 * STATE_ASSOCIATED - Association completed
-	 *
-	 * This state is entered when the driver reports that association has
-	 * been successfully completed with an AP. If IEEE 802.1X is used
-	 * (with or without WPA/WPA2), wpa_supplicant remains in this state
-	 * until the IEEE 802.1X/EAPOL authentication has been completed.
-	 */
-	const int STATE_ASSOCIATED = 6;
-	/**
-	 * STATE_4WAY_HANDSHAKE - WPA 4-Way Key Handshake in progress
-	 *
-	 * This state is entered when WPA/WPA2 4-Way Handshake is started. In
-	 * case of WPA-PSK, this happens when receiving the first EAPOL-Key
-	 * frame after association. In case of WPA-EAP, this state is entered
-	 * when the IEEE 802.1X/EAPOL authentication has been completed.
-	 */
-	const int STATE_4WAY_HANDSHAKE = 7;
-	/**
-	 * STATE_GROUP_HANDSHAKE - WPA Group Key Handshake in progress
-	 *
-	 * This state is entered when 4-Way Key Handshake has been completed
-	 * (i.e., when the supplicant sends out message 4/4) and when Group
-	 * Key rekeying is started by the AP (i.e., when supplicant receives
-	 * message 1/2).
-	 */
-	const int STATE_GROUP_HANDSHAKE = 8;
-	/**
-	 * STATE_COMPLETED - All authentication completed
-	 *
-	 * This state is entered when the full authentication process is
-	 * completed. In case of WPA2, this happens when the 4-Way Handshake is
-	 * successfully completed. With WPA, this state is entered after the
-	 * Group Key Handshake; with IEEE 802.1X (non-WPA) connection is
-	 * completed after dynamic keys are received (or if not used, after
-	 * the EAP authentication has been completed). With static WEP keys and
-	 * plaintext connections, this state is entered when an association
-	 * has been completed.
-	 *
-	 * This state indicates that the supplicant has completed its
-	 * processing for the association phase and that data connection is
-	 * fully configured.
-	 */
-	const int STATE_COMPLETED = 9;
-
-	/**
-	 * Used to indicate that a new network has been added.
-	 *
-	 * @param id Network ID allocated to the corresponding network.
-	 */
-	oneway void OnNetworkAdded(int id);
-
-	/**
-	 * Used to indicate that a network has been removed.
-	 *
-	 * @param id Network ID allocated to the corresponding network.
-	 */
-	oneway void OnNetworkRemoved(int id);
-
-	/**
-	 * Used to indicate a state change event on this particular iface. This
-	 * event may be triggered by a particular network in which case the
-	 * |network_id|, |ssid|, |bssid| parameters will indicate the parameters
-	 * of the network/AP which cased this state transition.
-	 *
-	 * @param new_state New State of the interface.  This will be one of
-	 *        the |STATE_|* values above.
-	 * @param bssid BSSID of the corresponding AP which caused this state
-	 *        change event. This will be empty if this event is not specific
-	 *        to a particular network.
-	 * @param network_id ID of the corresponding network which caused this
-	 *        state change event. This will be |INVALID_NETWORK_ID| if this
-	 *        event is not specific to a particular network.
-	 * @param ssid SSID of the corresponding network which caused this state
-	 *        change event. This will be empty if this event is not specific
-	 *        to a particular network.
-	 */
-	oneway void OnStateChanged(
-	    int new_state, in byte[] bssid, int network_id, in byte[] ssid);
-}
diff --git a/wpa_supplicant/binder/fi/w1/wpa_supplicant/INetwork.aidl b/wpa_supplicant/binder/fi/w1/wpa_supplicant/INetwork.aidl
deleted file mode 100644
index 154d0a5..0000000
--- a/wpa_supplicant/binder/fi/w1/wpa_supplicant/INetwork.aidl
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
- * binder interface for wpa_supplicant daemon
- * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
- * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-package fi.w1.wpa_supplicant;
-
-import fi.w1.wpa_supplicant.INetworkCallback;
-
-/**
- * Interface exposed by wpa_supplicant for each network configuration it controls.
- * A network is wpa_supplicant's way of representing the configuration parameters of a Wifi
- * service set. Service sets are identified by their service set identitifier (SSID).
- * The parameters for a network includes the credentials, bssid, etc.
- */
-@utf8InCpp
-interface INetwork {
-	/* Non-specific error encountered */
-	const int ERROR_GENERIC = 1;
-	/* Network is no longer valid */
-	const int ERROR_NETWORK_INVALID = 2;
-
-	/**
-	 * Constants used in Set/Get network params.
-	 */
-	/** Max length of SSID param. */
-	const int SSID_MAX_LEN = 32;
-
-	/** Length of BSSID param. */
-	const int BSSID_LEN = 6;
-
-	/** Min length of PSK passphrase param. */
-	const int PSK_PASSPHRASE_MIN_LEN = 8;
-
-	/** Max length of PSK passphrase param. */
-	const int PSK_PASSPHRASE_MAX_LEN = 63;
-
-	/** Max number of WEP keys param. */
-	const int WEP_KEYS_MAX_NUM = 4;
-
-	/** Length of each WEP40 keys param. */
-	const int WEP40_KEY_LEN = 5;
-	/** Length of each WEP104 keys param. */
-	const int WEP104_KEY_LEN = 13;
-
-	/** Possble mask of values for KeyMgmt param. */
-	const int KEY_MGMT_MASK_WPA_EAP = 0x01;
-	const int KEY_MGMT_MASK_WPA_PSK = 0x02;
-	const int KEY_MGMT_MASK_NONE = 0x04;
-	const int KEY_MGMT_MASK_IEEE8021X = 0x08;
-
-	/** Possble mask of values for Proto param. */
-	const int PROTO_MASK_WPA = 0x01;
-	const int PROTO_MASK_RSN = 0x02;
-	const int PROTO_MASK_OSEN = 0x08;
-
-	/** Possble mask of values for AuthAlg param. */
-	const int AUTH_ALG_MASK_OPEN = 0x01;
-	const int AUTH_ALG_MASK_SHARED = 0x02;
-	const int AUTH_ALG_MASK_LEAP = 0x04;
-
-	/** Possble mask of values for GroupCipher param. */
-	const int GROUP_CIPHER_MASK_WEP40 = 0x02;
-	const int GROUP_CIPHER_MASK_WEP104 = 0x04;
-	const int GROUP_CIPHER_MASK_TKIP = 0x08;
-	const int GROUP_CIPHER_MASK_CCMP = 0x10;
-
-	/** Possble mask of values for PairwiseCipher param. */
-	const int PAIRWISE_CIPHER_MASK_NONE = 0x01;
-	const int PAIRWISE_CIPHER_MASK_TKIP = 0x08;
-	const int PAIRWISE_CIPHER_MASK_CCMP = 0x10;
-
-	/** Possble mask of values for EapMethod param. */
-	const int EAP_METHOD_PEAP = 0;
-	const int EAP_METHOD_TLS = 1;
-	const int EAP_METHOD_TTLS = 2;
-	const int EAP_METHOD_PWD = 3;
-	const int EAP_METHOD_SIM = 4;
-	const int EAP_METHOD_AKA = 5;
-	const int EAP_METHOD_AKA_PRIME = 6;
-	const int EAP_METHOD_WFA_UNAUTH_TLS = 7;
-
-	/** Possble mask of values for Phase2Method param. */
-	const int EAP_PHASE2_METHOD_NONE = 0;
-	const int EAP_PHASE2_METHOD_PAP = 1;
-	const int EAP_PHASE2_METHOD_MSPAP = 2;
-	const int EAP_PHASE2_METHOD_MSPAPV2 = 3;
-	const int EAP_PHASE2_METHOD_GTC = 4;
-
-	/**
-	 * Various response types to be sent for the network using
-	 * |SendNetworkResponse|.
-	 */
-	const int NETWORK_RSP_UNKNOWN = 0;
-	const int NETWORK_RSP_EAP_IDENTITY = 1;
-	const int NETWORK_RSP_EAP_PASSWORD = 2;
-	const int NETWORK_RSP_EAP_NEW_PASSWORD = 3;
-	const int NETWORK_RSP_EAP_PIN = 4;
-	const int NETWORK_RSP_EAP_OTP = 5;
-	const int NETWORK_RSP_EAP_PASSPHRASE = 6;
-	const int NETWORK_RSP_SIM = 7;
-	const int NETWORK_RSP_PSK_PASSPHRASE = 8;
-	const int NETWORK_RSP_EXT_CERT_CHECK = 9;
-
-	/**
-	 * Retrieves the ID allocated to this network by wpa_supplicant.
-	 *
-	 * This is not the |SSID| of the network, but an internal identifier for
-	 * this network used by wpa_supplicant.
-	 *
-	 * @return network ID.
-	 */
-	int GetId();
-
-	/**
-	 * Retrieves the name of the interface this network belongs to.
-	 *
-	 * @return Name of the network interface, e.g., wlan0
-	 */
-	String GetInterfaceName();
-
-	/**
-	 * Register for callbacks from this network.
-	 *
-	 * These callbacks are invoked for events that are specific to this network.
-	 *
-	 * @param callback Binder object reference to a |INetworkCallback|
-	 *        instance.
-	 */
-	void RegisterCallback(in INetworkCallback callback);
-
-	/**
-	 * Setters for the various network params.
-	 * These correspond to elements of |wpa_sssid| struct used internally by
-	 * wpa_supplicant to represent each network.
-	 * Sets |{struct wpa_ssid}.ssid|.
-	 */
-	/** Set SSID for this network. Max length of |SSID_MAX_LEN|. */
-	void SetSSID(in byte[] ssid);
-
-	/**
-	 * Set the network to only connect to an AP with provided BSSSID.
-	 * Pass array of size 0 to clear this param.
-	 * Length of the value should be |BSSID_LEN|.
-	 * Sets |{struct wpa_ssid}.bssid|.
-	 */
-	void SetBSSID(in byte[] bssid);
-
-	/**
-	 * Set whether to send Probe Requests for this network (hidden).
-	 * Sets |{struct wpa_ssid}.scan_ssid|.
-	 */
-	void SetScanSSID(boolean enable);
-
-	/**
-	 * Combination of |KEY_MGMT_MASK_*| values above.
-	 * Sets |{struct wpa_ssid}.key_mgmt|.
-	 */
-	void SetKeyMgmt(int key_mgmt_mask);
-
-	/**
-	 * Combination of |PROTO_MASK_*| values above.
-	 * Sets |{struct wpa_ssid}.proto|.
-	 */
-	void SetProto(int proto_mask);
-
-	/**
-	 * Combination of |AUTH_ALG_MASK_*| values above.
-	 * Sets |{struct wpa_ssid}.auth_alg|.
-	 * */
-	void SetAuthAlg(int auth_alg_mask);
-
-	/**
-	 * Combination of |GROUP_CIPHER_MASK_*| values above.
-	 * Sets |{struct wpa_ssid}.group_cipher|.
-	 */
-	void SetGroupCipher(int group_cipher_mask);
-
-	/**
-	 * Combination of |PAIRWISE_CIPHER_MASK_*| values above.
-	 * Sets |{struct wpa_ssid}.pairwise_cipher|.
-	 * */
-	void SetPairwiseCipher(int pairwise_cipher_mask);
-
-	/**
-	 * Set passphrase for WPA_PSK network.
-	 * Min length of value is |PSK_PASSPHRASE_MIN_LEN|.
-	 * Max length of value is |PSK_PASSPHRASE_MAX_LEN|.
-	 * Sets |{struct wpa_ssid}.passphrase|.
-	 */
-	void SetPskPassphrase(String psk);
-
-	/**
-	 * Set WEP key for WEP network.
-	 * Length of each key should be either |WEP40_KEY_LEN| or
-	 * |WEP104_KEY_LEN|.
-	 * Sets |{struct wpa_ssid}.wep_key|.
-	 *
-	 * @param key_idx Index of wep key to be set.
-	 *                Max of |WEP_KEYS_MAX_NUM| keys.
-	 */
-	void SetWepKey(int key_idx, in byte[] wep_key);
-
-	/**
-	 * Set default Tx key index for WEP network.
-	 * Sets |{struct wpa_ssid}.wep_tx_key_idx|.
-	 * */
-	void SetWepTxKeyIdx(int wep_tx_key_idx);
-
-	/**
-	 * Set whether RequirePMF is enabled for this network.
-	 * Sets |{struct wpa_ssid}.ieee80211w|.
-	 * */
-	void SetRequirePMF(boolean enable);
-
-	/**
-	 * Set EAP Method for this network.
-	 * Must be one of |EAP_METHOD_*| values.
-	 * Sets |{struct eap_peer_config}.eap_methods|.
-	 */
-	void SetEapMethod(int method);
-
-	/**
-	 * Set EAP Phase2 Method for this network.
-	 * Must be one of |EAP_PHASE2_METHOD_*| values.
-	 * Sets |{struct eap_peer_config}.phase2|.
-	 */
-	void SetEapPhase2Method(int method);
-
-	/**
-	 * Set EAP Identity for this network.
-	 * Sets |{struct eap_peer_config}.identity|.
-	 */
-	void SetEapIdentity(in byte[] identity);
-
-	/**
-	 * Set EAP Anonymous Identity for this network.
-	 * Sets |{struct eap_peer_config}.anonymous_identity|.
-	 */
-	void SetEapAnonymousIdentity(in byte[] identity);
-
-	/**
-	 * Set EAP Password for this network.
-	 * Sets |{struct eap_peer_config}.password|.
-	 */
-	void SetEapPassword(in byte[] password);
-
-	/**
-	 * Set EAP CA certificate file path for this network.
-	 * Sets |{struct eap_peer_config}.ca_cert|.
-	 */
-	void SetEapCACert(String path);
-
-	/**
-	 * Set EAP CA certificate directory path for this network.
-	 * Sets |{struct eap_peer_config}.ca_path|.
-	 */
-	void SetEapCAPath(String path);
-
-	/**
-	 * Set EAP Client certificate file path for this network.
-	 * Sets |{struct eap_peer_config}.client_cert|.
-	 */
-	void SetEapClientCert(String path);
-
-	/**
-	 * Set EAP private key file path for this network.
-	 * Sets |{struct eap_peer_config}.private_key|.
-	 */
-	void SetEapPrivateKey(String path);
-
-	/**
-	 * Set EAP subject match for this network.
-	 * Sets |{struct eap_peer_config}.subject_match|.
-	 */
-	void SetEapSubjectMatch(String match);
-
-	/**
-	 * Set EAP Altsubject match for this network.
-	 * Sets |{struct eap_peer_config}.altsubject_match|.
-	 */
-	void SetEapAltSubjectMatch(String match);
-
-	/**
-	 * Enable EAP Open SSL Engine for this network.
-	 * Sets |{struct eap_peer_config}.engine|.
-	 */
-	void SetEapEngine(boolean enable);
-
-	/**
-	 * Set EAP Open SSL Engine ID for this network.
-	 * Sets |{struct eap_peer_config}.engine_id|.
-	 */
-	void SetEapEngineID(String id);
-
-	/**
-	 * Set EAP Domain suffix match for this network.
-	 * Sets |{struct eap_peer_config}.domain_suffix_match|.
-	 */
-	void SetEapDomainSuffixMatch(String match);
-
-	/**
-	 * Getters for the various network params.
-	 */
-	/** Get SSID for this network. */
-	byte[] GetSSID();
-
-	/** Get the BSSID set for this network. */
-	byte[] GetBSSID();
-
-	/** Get whether Probe Requests are being sent for this network (hidden). */
-	boolean GetScanSSID();
-
-	/** Combination of |KEY_MGMT_MASK_*| values above. */
-	int GetKeyMgmt();
-
-	/** Combination of |PROTO_MASK_*| values above. */
-	int GetProto();
-
-	/** Combination of |AUTH_ALG_MASK_*| values above. */
-	int GetAuthAlg();
-
-	/** Combination of |GROUP_CIPHER_MASK_*| values above. */
-	int GetGroupCipher();
-
-	/** Combination of |PAIRWISE_CIPHER_MASK_*| values above. */
-	int GetPairwiseCipher();
-
-	/** Get passphrase for WPA_PSK network. */
-	String GetPskPassphrase();
-
-	/**
-	 * Get WEP key for WEP network.
-	 *
-	 * @param key_idx Index of wep key to be fetched.
-	 *                Max of |WEP_KEYS_MAX_NUM| keys.
-	 */
-	byte[] GetWepKey(int key_idx);
-
-	/** Get default Tx key index for WEP network. */
-	int GetWepTxKeyIdx();
-
-	/** Get whether RequirePMF is enabled for this network. */
-	boolean GetRequirePMF();
-
-	/**
-	 * Enable the network for connection purposes.
-	 *
-	 * This may trigger a connection to the network.
-	 *
-	 * @param no_connect Only enable the network, dont trigger a connect.
-	 */
-	void Enable(boolean no_connect);
-
-	/**
-	 * Disable the network for connection purposes.
-	 *
-	 * This may trigger a disconnection from the network, if currently
-	 * connected to this network.
-	 */
-	void Disable();
-
-	/**
-	 * Initiate connection to this network.
-	 */
-	void Select();
-
-	/**
-	 * Used to send a response to the request received on this particular network.
-	 * The type of response is one of the |NETWORK_RSP_| values above and depending on
-	 * the request type may include additional params.
-	 *
-	 * The request for the response must have been triggered via the corresponding
-	 * |INetworkCallback.OnNetworkRequest| call.
-	 *
-	 * @param type Type of response. This will be one of the |NETWORK_RSP_|*
-	 *        values above.
-	 * @param param Additional param associated with the response.
-	 *        For ex: NETWORK_RSP_SIM request type may contain either
-	 *        "GSM-FAIL" or "UMTS-FAIL" param to indicate the failure for
-	 *        external GSM or 3G authentication.
-	 */
-	void SendNetworkResponse(int type, String param);
-}
diff --git a/wpa_supplicant/binder/fi/w1/wpa_supplicant/INetworkCallback.aidl b/wpa_supplicant/binder/fi/w1/wpa_supplicant/INetworkCallback.aidl
deleted file mode 100644
index 444210c..0000000
--- a/wpa_supplicant/binder/fi/w1/wpa_supplicant/INetworkCallback.aidl
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * binder interface for wpa_supplicant daemon
- * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
- * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-package fi.w1.wpa_supplicant;
-
-/**
- * Callback Interface exposed by the wpa_supplicant service
- * for each network (INetwork).
- *
- * Clients need to host an instance of this binder object and
- * pass a reference of the object to wpa_supplicant via the
- * corresponding |INetwork.registerCallback| method.
- */
-@utf8InCpp
-interface INetworkCallback {
-	/** Various request types received for the network from |OnNetworkRequest|.*/
-	const int NETWORK_REQ_UNKNOWN = 0;
-	const int NETWORK_REQ_EAP_IDENTITY = 1;
-	const int NETWORK_REQ_EAP_PASSWORD = 2;
-	const int NETWORK_REQ_EAP_NEW_PASSWORD = 3;
-	const int NETWORK_REQ_EAP_PIN = 4;
-	const int NETWORK_REQ_EAP_OTP = 5;
-	const int NETWORK_REQ_EAP_PASSPHRASE = 6;
-	const int NETWORK_REQ_SIM = 7;
-	const int NETWORK_REQ_PSK_PASSPHRASE = 8;
-	const int NETWORK_REQ_EXT_CERT_CHECK = 9;
-
-	/**
-	 * Used to indicate a request on this particular network. The type of
-	 * request is one of the |NETWORK_REQ_| values above and depending on
-	 * the request type may include additional params.
-	 *
-	 * The response for the request must be sent using the corresponding
-	 * |INetwork.SendNetworkResponse| call.
-	 *
-	 * @param type Type of request. This will be one of the |NETWORK_REQ_|*
-	 *        values above.
-	 * @param param Additional param associated with the request.
-	 *        For ex: NETWORK_REQ_SIM request type may contain either
-	 *        "GSM-AUTH" or "UMTS-AUTH" param to indicate the need for
-	 *        external GSM or 3G authentication.
-	 */
-	oneway void OnNetworkRequest(int type, String param);
-}
diff --git a/wpa_supplicant/binder/fi/w1/wpa_supplicant/ISupplicant.aidl b/wpa_supplicant/binder/fi/w1/wpa_supplicant/ISupplicant.aidl
deleted file mode 100644
index 3445cda..0000000
--- a/wpa_supplicant/binder/fi/w1/wpa_supplicant/ISupplicant.aidl
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * WPA Supplicant - binder interface for wpa_supplicant daemon
- * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
- * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-package fi.w1.wpa_supplicant;
-
-import fi.w1.wpa_supplicant.ParcelableIfaceParams;
-import fi.w1.wpa_supplicant.ISupplicantCallback;
-import fi.w1.wpa_supplicant.IIface;
-
-/**
- * Interface exposed by the wpa_supplicant binder service registered
- * with the service manager with name: wpa_supplicant.
- */
-@utf8InCpp
-interface ISupplicant {
-	/* Non-specific error encountered */
-	const int ERROR_GENERIC = 1;
-	/* Iface being added already exists */
-	const int ERROR_IFACE_EXISTS = 2;
-	/* Iface being removed/retrieved does not exist */
-	const int ERROR_IFACE_UNKNOWN = 3;
-
-	/**
-	 * Debug levels for wpa_supplicant.
-	 * These correspond to levels defined in |wpa_debug.h|.
-	 */
-	const int DEBUG_LEVEL_EXCESSIVE = 1;
-	const int DEBUG_LEVEL_MSGDUMP = 2;
-	const int DEBUG_LEVEL_DEBUG = 3;
-	const int DEBUG_LEVEL_INFO = 4;
-	const int DEBUG_LEVEL_WARNING = 5;
-	const int DEBUG_LEVEL_ERROR = 6;
-
-	/**
-	 * Registers a wireless interface in wpa_supplicant.
-	 *
-	 * @param params Instance of |ParcelableIfaceParams| containing the
-	 *        parameters of the interface.
-	 *
-	 * @return Binder object representing the interface.
-	 */
-	IIface CreateInterface(in ParcelableIfaceParams params);
-
-	/**
-	 * Deregisters a wireless interface from wpa_supplicant.
-	 *
-	 * @param ifname Name of the network interface, e.g., wlan0
-	 */
-	void RemoveInterface(in String ifname);
-
-	/**
-	 * Gets a binder object for the interface corresponding to ifname
-	 * which wpa_supplicant already controls.
-	 *
-	 * @param ifname Name of the network interface, e.g., wlan0
-	 *
-	 * @return Binder object representing the interface.
-	 */
-	IIface GetInterface(in String ifname);
-
-	/**
-	 * Set debug parameters for wpa_supplicant.
-	 *
-	 * @param level Debug logging level for wpa_supplicant.
-	 *        (one of DEBUG_LEVEL_* values).
-	 * @param timestamp Determines whether to show timestamps in logs or
-	 *        not.
-	 * @param show_keys Determines whether to show keys in debug logs or
-	 *        not.
-	 *        CAUTION: Do not set this param in production code!
-	 */
-	void SetDebugParams(
-	    int level, boolean show_timestamp, boolean show_keys);
-
-	/**
-	 * Get the debug level set.
-	 *
-	 * @return one of DEBUG_LEVEL_* values.
-	 */
-	int GetDebugLevel();
-
-	/**
-	 * Get whether the |show_timestamp| parameter has been set ot not.
-	 *
-	 * @return true if set, false otherwise.
-	 */
-	boolean GetDebugShowTimestamp();
-
-	/**
-	 * Get whether the |show_keys| parameter has been set ot not.
-	 *
-	 * @return true if set, false otherwise.
-	 */
-	boolean GetDebugShowKeys();
-
-	/**
-	 * Register for callbacks from the wpa_supplicant service.
-	 *
-	 * These callbacks are invoked for global events that are not specific
-	 * to any interface or network.
-	 *
-	 * @param callback Binder object reference to a |ISupplicantCallback|
-	 *        instance.
-	 */
-	void RegisterCallback(in ISupplicantCallback callback);
-}
diff --git a/wpa_supplicant/binder/fi/w1/wpa_supplicant/ISupplicantCallback.aidl b/wpa_supplicant/binder/fi/w1/wpa_supplicant/ISupplicantCallback.aidl
deleted file mode 100644
index c607f0d..0000000
--- a/wpa_supplicant/binder/fi/w1/wpa_supplicant/ISupplicantCallback.aidl
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * binder interface for wpa_supplicant daemon
- * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
- * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-package fi.w1.wpa_supplicant;
-
-/**
- * Callback Interface exposed by the wpa_supplicant service (ISupplicant).
- *
- * Clients need to host an instance of this binder object and
- * pass a reference of the object to wpa_supplicant via the
- * |ISupplicant.registerCallback| method.
- */
-@utf8InCpp
-interface ISupplicantCallback {
-	/**
-	 * Used to indicate that a new interface has been created.
-	 *
-	 * @param ifname Name of the network interface, e.g., wlan0
-	 */
-	oneway void OnInterfaceCreated(String ifname);
-
-	/**
-	 * Used to indicate that an interface has been removed.
-	 *
-	 * @param ifname Name of the network interface, e.g., wlan0
-	 */
-	oneway void OnInterfaceRemoved(String ifname);
-}
diff --git a/wpa_supplicant/binder/fi/w1/wpa_supplicant/ParcelableIfaceParams.aidl b/wpa_supplicant/binder/fi/w1/wpa_supplicant/ParcelableIfaceParams.aidl
deleted file mode 100644
index 59a9f31..0000000
--- a/wpa_supplicant/binder/fi/w1/wpa_supplicant/ParcelableIfaceParams.aidl
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * binder interface for wpa_supplicant daemon
- * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
- * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-package fi.w1.wpa_supplicant;
-
-parcelable ParcelableIfaceParams cpp_header
-    "wpa_supplicant_binder/parcelable_iface_params.h";
diff --git a/wpa_supplicant/binder/iface.h b/wpa_supplicant/binder/iface.h
deleted file mode 100644
index 96d52ce..0000000
--- a/wpa_supplicant/binder/iface.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * binder interface for wpa_supplicant daemon
- * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
- * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#ifndef WPA_SUPPLICANT_BINDER_IFACE_H
-#define WPA_SUPPLICANT_BINDER_IFACE_H
-
-#include <android-base/macros.h>
-
-#include "fi/w1/wpa_supplicant/BnIface.h"
-#include "fi/w1/wpa_supplicant/INetwork.h"
-
-extern "C" {
-#include "utils/common.h"
-#include "utils/includes.h"
-#include "wpa_supplicant_i.h"
-#include "driver_i.h"
-}
-
-namespace wpa_supplicant_binder {
-
-/**
- * Implementation of Iface binder object. Each unique binder
- * object is used for control operations on a specific interface
- * controlled by wpa_supplicant.
- */
-class Iface : public fi::w1::wpa_supplicant::BnIface
-{
-public:
-	Iface(struct wpa_global *wpa_global, const char ifname[]);
-	~Iface() override = default;
-
-	// Binder methods exposed in aidl.
-	android::binder::Status GetName(std::string *iface_name_out) override;
-	android::binder::Status AddNetwork(
-	    android::sp<fi::w1::wpa_supplicant::INetwork> *network_object_out)
-	    override;
-	android::binder::Status RemoveNetwork(int network_id) override;
-	android::binder::Status GetNetwork(
-	    int network_id,
-	    android::sp<fi::w1::wpa_supplicant::INetwork> *network_object_out)
-	    override;
-	android::binder::Status RegisterCallback(
-	    const android::sp<fi::w1::wpa_supplicant::IIfaceCallback> &callback)
-	    override;
-	android::binder::Status Reassociate() override;
-	android::binder::Status Reconnect() override;
-	android::binder::Status Disconnect() override;
-	android::binder::Status SetPowerSave(bool enable) override;
-	android::binder::Status InitiateTDLSDiscover(
-	    const std::vector<uint8_t> &mac_address) override;
-	android::binder::Status InitiateTDLSSetup(
-	    const std::vector<uint8_t> &mac_address) override;
-	android::binder::Status InitiateTDLSTeardown(
-	    const std::vector<uint8_t> &mac_address) override;
-
-private:
-	struct wpa_supplicant *retrieveIfacePtr();
-
-	// Reference to the global wpa_struct. This is assumed to be valid for
-	// the lifetime of the process.
-	const struct wpa_global *wpa_global_;
-	// Name of the iface this binder object controls
-	const std::string ifname_;
-
-	DISALLOW_COPY_AND_ASSIGN(Iface);
-};
-
-}  // namespace wpa_supplicant_binder
-
-#endif  // WPA_SUPPLICANT_BINDER_IFACE_H
diff --git a/wpa_supplicant/binder/include/wpa_supplicant_binder/binder_constants.h b/wpa_supplicant/binder/include/wpa_supplicant_binder/binder_constants.h
deleted file mode 100644
index a4d9b55..0000000
--- a/wpa_supplicant/binder/include/wpa_supplicant_binder/binder_constants.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * binder interface for wpa_supplicant daemon
- * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
- * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#ifndef WPA_SUPPLICANT_BINDER_BINDER_CONSTANTS_H
-#define WPA_SUPPLICANT_BINDER_BINDER_CONSTANTS_H
-
-namespace wpa_supplicant_binder {
-namespace binder_constants {
-
-extern const char kServiceName[];
-
-} /* namespace binder_constants */
-} /* namespace wpa_supplicant_binder */
-
-#endif /* WPA_SUPPLICANT_BINDER_BINDER_CONSTANTS_H */
diff --git a/wpa_supplicant/binder/include/wpa_supplicant_binder/parcelable_iface_params.h b/wpa_supplicant/binder/include/wpa_supplicant_binder/parcelable_iface_params.h
deleted file mode 100644
index 0fc063c..0000000
--- a/wpa_supplicant/binder/include/wpa_supplicant_binder/parcelable_iface_params.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * binder interface for wpa_supplicant daemon
- * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
- * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#ifndef WPA_SUPPLICANT_BINDER_PARCELABLE_IFACE_PARAMS_H
-#define WPA_SUPPLICANT_BINDER_PARCELABLE_IFACE_PARAMS_H
-
-#include <binder/Parcelable.h>
-#include <utils/String8.h>
-
-namespace fi {
-namespace w1 {
-namespace wpa_supplicant {
-
-// Parcelable object containing the params used for creating a
-// new interface via |ISupplicant.CreateInterface| binder call.
-class ParcelableIfaceParams : public android::Parcelable
-{
-public:
-	ParcelableIfaceParams() = default;
-	virtual ~ParcelableIfaceParams() = default;
-
-	android::status_t writeToParcel(android::Parcel *parcel) const override;
-	android::status_t readFromParcel(const android::Parcel *parcel) override;
-
-	// Name of the network interface to control, e.g., wlan0.
-	android::String8 ifname_;
-	// BridgeIfname(String) Name of the bridge interface to control, e.g.,
-	// br0.
-	android::String8 bridge_ifname_;
-	// Driver name which the interface uses, e.g., nl80211.
-	android::String8 driver_;
-	// Configuration file path.
-	android::String8 config_file_;
-};
-
-} // namespace fi
-} // namespace w1
-} // namespace wpa_supplicant
-
-#endif // WPA_SUPPLICANT_BINDER_PARCELABLE_IFACE_PARAMS_H
diff --git a/wpa_supplicant/binder/network.h b/wpa_supplicant/binder/network.h
deleted file mode 100644
index 34418ec..0000000
--- a/wpa_supplicant/binder/network.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * binder interface for wpa_supplicant daemon
- * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
- * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-
-#ifndef WPA_SUPPLICANT_BINDER_NETWORK_H
-#define WPA_SUPPLICANT_BINDER_NETWORK_H
-
-#include <android-base/macros.h>
-
-#include "fi/w1/wpa_supplicant/BnNetwork.h"
-
-extern "C" {
-#include "utils/common.h"
-#include "utils/includes.h"
-#include "config.h"
-#include "wpa_supplicant_i.h"
-#include "notify.h"
-#include "eapol_supp/eapol_supp_sm.h"
-#include "eap_peer/eap.h"
-#include "rsn_supp/wpa.h"
-}
-
-namespace wpa_supplicant_binder {
-
-/**
- * Implementation of Network binder object. Each unique binder
- * object is used for control operations on a specific network
- * controlled by wpa_supplicant.
- */
-class Network : public fi::w1::wpa_supplicant::BnNetwork
-{
-public:
-	Network(
-	    struct wpa_global *wpa_global, const char ifname[], int network_id);
-	~Network() override = default;
-
-	// Binder methods exposed in aidl.
-	android::binder::Status GetId(int *network_id_out) override;
-	android::binder::Status GetInterfaceName(
-	    std::string *ifname_out) override;
-	android::binder::Status RegisterCallback(
-	    const android::sp<fi::w1::wpa_supplicant::INetworkCallback>
-		&callback) override;
-	android::binder::Status SetSSID(
-	    const std::vector<uint8_t> &ssid) override;
-	android::binder::Status SetBSSID(
-	    const std::vector<uint8_t> &bssid) override;
-	android::binder::Status SetScanSSID(bool enable) override;
-	android::binder::Status SetKeyMgmt(int32_t key_mgmt_mask) override;
-	android::binder::Status SetProto(int32_t proto_mask) override;
-	android::binder::Status SetAuthAlg(int32_t auth_alg_mask) override;
-	android::binder::Status SetGroupCipher(
-	    int32_t group_cipher_mask) override;
-	android::binder::Status SetPairwiseCipher(
-	    int32_t pairwise_cipher_mask) override;
-	android::binder::Status SetPskPassphrase(
-	    const std::string &psk) override;
-	android::binder::Status SetWepKey(
-	    int key_idx, const std::vector<uint8_t> &wep_key) override;
-	android::binder::Status SetWepTxKeyIdx(int32_t wep_tx_key_idx) override;
-	android::binder::Status SetRequirePMF(bool enable) override;
-	android::binder::Status SetEapMethod(int32_t method) override;
-	android::binder::Status SetEapPhase2Method(int32_t method) override;
-	android::binder::Status SetEapIdentity(
-	    const std::vector<uint8_t> &identity) override;
-	android::binder::Status SetEapAnonymousIdentity(
-	    const std::vector<uint8_t> &identity) override;
-	android::binder::Status SetEapPassword(
-	    const std::vector<uint8_t> &password) override;
-	android::binder::Status SetEapCACert(const std::string &path) override;
-	android::binder::Status SetEapCAPath(const std::string &path) override;
-	android::binder::Status SetEapClientCert(
-	    const std::string &path) override;
-	android::binder::Status SetEapPrivateKey(
-	    const std::string &path) override;
-	android::binder::Status SetEapSubjectMatch(
-	    const std::string &match) override;
-	android::binder::Status SetEapAltSubjectMatch(
-	    const std::string &match) override;
-	android::binder::Status SetEapEngine(bool enable) override;
-	android::binder::Status SetEapEngineID(const std::string &id) override;
-	android::binder::Status SetEapDomainSuffixMatch(
-	    const std::string &match) override;
-	android::binder::Status GetSSID(std::vector<uint8_t> *ssid) override;
-	android::binder::Status GetBSSID(std::vector<uint8_t> *bssid) override;
-	android::binder::Status GetScanSSID(bool *enable) override;
-	android::binder::Status GetKeyMgmt(int32_t *key_mgmt_mask) override;
-	android::binder::Status GetProto(int32_t *proto_mask) override;
-	android::binder::Status GetAuthAlg(int32_t *auth_alg_mask) override;
-	android::binder::Status GetGroupCipher(
-	    int32_t *group_cipher_mask) override;
-	android::binder::Status GetPairwiseCipher(
-	    int32_t *pairwise_cipher_mask) override;
-	android::binder::Status GetPskPassphrase(std::string *psk) override;
-	android::binder::Status GetWepKey(
-	    int key_idx, std::vector<uint8_t> *wep_key) override;
-	android::binder::Status GetWepTxKeyIdx(
-	    int32_t *wep_tx_key_idx) override;
-	android::binder::Status GetRequirePMF(bool *enable) override;
-	android::binder::Status Enable(bool no_connect) override;
-	android::binder::Status Disable() override;
-	android::binder::Status Select() override;
-	android::binder::Status SendNetworkResponse(
-	    int type, const std::string &param) override;
-
-private:
-	struct wpa_ssid *retrieveNetworkPtr();
-	struct wpa_supplicant *retrieveIfacePtr();
-	int isPskPassphraseValid(const std::string &psk);
-	void resetInternalStateAfterParamsUpdate();
-	android::binder::Status setStringFieldAndResetState(
-	    const char *value, uint8_t **to_update_field,
-	    const char *hexdump_prefix);
-	android::binder::Status setStringFieldAndResetState(
-	    const char *value, char **to_update_field,
-	    const char *hexdump_prefix);
-	android::binder::Status setStringKeyFieldAndResetState(
-	    const char *value, char **to_update_field,
-	    const char *hexdump_prefix);
-	android::binder::Status setByteArrayFieldAndResetState(
-	    const uint8_t *value, const size_t value_len,
-	    uint8_t **to_update_field, size_t *to_update_field_len,
-	    const char *hexdump_prefix);
-	android::binder::Status setByteArrayKeyFieldAndResetState(
-	    const uint8_t *value, const size_t value_len,
-	    uint8_t **to_update_field, size_t *to_update_field_len,
-	    const char *hexdump_prefix);
-
-	// Reference to the global wpa_struct. This is assumed to be valid for
-	// the lifetime of the process.
-	const struct wpa_global *wpa_global_;
-	// Name of the iface this network belongs to.
-	const std::string ifname_;
-	// Id of the network this binder object controls.
-	const int network_id_;
-
-	DISALLOW_COPY_AND_ASSIGN(Network);
-};
-
-}  // namespace wpa_supplicant_binder
-
-#endif  // WPA_SUPPLICANT_BINDER_NETWORK_H
diff --git a/wpa_supplicant/binder/parcelable_iface_params.cpp b/wpa_supplicant/binder/parcelable_iface_params.cpp
deleted file mode 100644
index 5bf8337..0000000
--- a/wpa_supplicant/binder/parcelable_iface_params.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * binder interface for wpa_supplicant daemon
- * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
- * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
- *
- * This software may be distributed under the terms of the BSD license.
- * See README for more details.
- */
-#include <binder/Parcel.h>
-
-#include "wpa_supplicant_binder/parcelable_iface_params.h"
-
-namespace fi {
-namespace w1 {
-namespace wpa_supplicant {
-
-android::status_t ParcelableIfaceParams::writeToParcel(
-    android::Parcel *parcel) const
-{
-	android::status_t status;
-	status = parcel->writeString8(ifname_);
-	if (status != android::OK) {
-		return status;
-	}
-	status = parcel->writeString8(bridge_ifname_);
-	if (status != android::OK) {
-		return status;
-	}
-	status = parcel->writeString8(driver_);
-	if (status != android::OK) {
-		return status;
-	}
-	return parcel->writeString8(config_file_);
-}
-
-android::status_t ParcelableIfaceParams::readFromParcel(
-    const android::Parcel *parcel)
-{
-	android::status_t status;
-	status = parcel->readString8(&ifname_);
-	if (status != android::OK) {
-		return status;
-	}
-	status = parcel->readString8(&bridge_ifname_);
-	if (status != android::OK) {
-		return status;
-	}
-	status = parcel->readString8(&driver_);
-	if (status != android::OK) {
-		return status;
-	}
-	return parcel->readString8(&config_file_);
-}
-
-}  // namespace fi
-}  // namespace w1
-}  // namespace wpa_supplicant
diff --git a/wpa_supplicant/binder/.clang-format b/wpa_supplicant/hidl/.clang-format
similarity index 100%
rename from wpa_supplicant/binder/.clang-format
rename to wpa_supplicant/hidl/.clang-format
diff --git a/wpa_supplicant/hidl/hidl.cpp b/wpa_supplicant/hidl/hidl.cpp
new file mode 100644
index 0000000..258fa2b
--- /dev/null
+++ b/wpa_supplicant/hidl/hidl.cpp
@@ -0,0 +1,189 @@
+/*
+ * hidl interface for wpa_supplicant daemon
+ * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+#include <hidl/IPCThreadState.h>
+#include <hidl/IServiceManager.h>
+#include <hidl/ProcessState.h>
+
+#include "hidl_manager.h"
+
+extern "C" {
+#include "hidl.h"
+#include "hidl_i.h"
+#include "utils/common.h"
+#include "utils/eloop.h"
+#include "utils/includes.h"
+}
+
+void wpas_hidl_sock_handler(
+    int /* sock */, void * /* eloop_ctx */, void *sock_ctx)
+{
+	struct wpas_hidl_priv *priv = (wpas_hidl_priv *)sock_ctx;
+	wpa_printf(
+	    MSG_DEBUG, "Processing hidl events on FD %d", priv->hidl_fd);
+	android::IPCThreadState::self()->handlePolledCommands();
+}
+
+struct wpas_hidl_priv *wpas_hidl_init(struct wpa_global *global)
+{
+	struct wpas_hidl_priv *priv;
+	wpa_supplicant_hidl::HidlManager *hidl_manager;
+
+	priv = (wpas_hidl_priv *)os_zalloc(sizeof(*priv));
+	if (!priv)
+		return NULL;
+	priv->global = global;
+
+	wpa_printf(MSG_DEBUG, "Initing hidl control");
+
+	android::ProcessState::self()->setThreadPoolMaxThreadCount(0);
+	android::IPCThreadState::self()->disableBackgroundScheduling(true);
+	android::IPCThreadState::self()->setupPolling(&priv->hidl_fd);
+	if (priv->hidl_fd < 0)
+		goto err;
+
+	wpa_printf(
+	    MSG_INFO, "Processing hidl events on FD %d", priv->hidl_fd);
+	/* Look for read events from the hidl socket in the eloop. */
+	if (eloop_register_read_sock(
+		priv->hidl_fd, wpas_hidl_sock_handler, global, priv) < 0)
+		goto err;
+
+	hidl_manager = wpa_supplicant_hidl::HidlManager::getInstance();
+	if (!hidl_manager)
+		goto err;
+	hidl_manager->registerHidlService(global);
+	/* We may not need to store this hidl manager reference in the
+	 * global data strucure because we've made it a singleton class. */
+	priv->hidl_manager = (void *)hidl_manager;
+
+	return priv;
+err:
+	wpas_hidl_deinit(priv);
+	return NULL;
+}
+
+void wpas_hidl_deinit(struct wpas_hidl_priv *priv)
+{
+	if (!priv)
+		return;
+
+	wpa_printf(MSG_DEBUG, "Deiniting hidl control");
+
+	wpa_supplicant_hidl::HidlManager::destroyInstance();
+	eloop_unregister_read_sock(priv->hidl_fd);
+	android::IPCThreadState::shutdown();
+	os_free(priv);
+}
+
+int wpas_hidl_register_interface(struct wpa_supplicant *wpa_s)
+{
+	if (!wpa_s || !wpa_s->global->hidl)
+		return 1;
+
+	wpa_printf(
+	    MSG_DEBUG, "Registering interface to hidl control: %s",
+	    wpa_s->ifname);
+
+	wpa_supplicant_hidl::HidlManager *hidl_manager =
+	    wpa_supplicant_hidl::HidlManager::getInstance();
+	if (!hidl_manager)
+		return 1;
+
+	return hidl_manager->registerInterface(wpa_s);
+}
+
+int wpas_hidl_unregister_interface(struct wpa_supplicant *wpa_s)
+{
+	if (!wpa_s || !wpa_s->global->hidl)
+		return 1;
+
+	wpa_printf(
+	    MSG_DEBUG, "Deregistering interface from hidl control: %s",
+	    wpa_s->ifname);
+
+	wpa_supplicant_hidl::HidlManager *hidl_manager =
+	    wpa_supplicant_hidl::HidlManager::getInstance();
+	if (!hidl_manager)
+		return 1;
+
+	return hidl_manager->unregisterInterface(wpa_s);
+}
+
+int wpas_hidl_register_network(
+    struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
+{
+	if (!wpa_s || !wpa_s->global->hidl || !ssid)
+		return 1;
+
+	wpa_printf(
+	    MSG_DEBUG, "Registering network to hidl control: %d", ssid->id);
+
+	wpa_supplicant_hidl::HidlManager *hidl_manager =
+	    wpa_supplicant_hidl::HidlManager::getInstance();
+	if (!hidl_manager)
+		return 1;
+
+	return hidl_manager->registerNetwork(wpa_s, ssid);
+}
+
+int wpas_hidl_unregister_network(
+    struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
+{
+	if (!wpa_s || !wpa_s->global->hidl || !ssid)
+		return 1;
+
+	wpa_printf(
+	    MSG_DEBUG, "Deregistering network from hidl control: %d",
+	    ssid->id);
+
+	wpa_supplicant_hidl::HidlManager *hidl_manager =
+	    wpa_supplicant_hidl::HidlManager::getInstance();
+	if (!hidl_manager)
+		return 1;
+
+	return hidl_manager->unregisterNetwork(wpa_s, ssid);
+}
+
+int wpas_hidl_notify_state_changed(struct wpa_supplicant *wpa_s)
+{
+	if (!wpa_s || !wpa_s->global->hidl)
+		return 1;
+
+	wpa_printf(
+	    MSG_DEBUG, "Notifying state change event to hidl control: %d",
+	    wpa_s->wpa_state);
+
+	wpa_supplicant_hidl::HidlManager *hidl_manager =
+	    wpa_supplicant_hidl::HidlManager::getInstance();
+	if (!hidl_manager)
+		return 1;
+
+	return hidl_manager->notifyStateChange(wpa_s);
+}
+
+int wpas_hidl_notify_network_request(
+    struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
+    enum wpa_ctrl_req_type rtype, const char *default_txt)
+{
+	if (!wpa_s || !wpa_s->global->hidl || !ssid)
+		return 1;
+
+	wpa_printf(
+	    MSG_DEBUG, "Notifying network request to hidl control: %d",
+	    ssid->id);
+
+	wpa_supplicant_hidl::HidlManager *hidl_manager =
+	    wpa_supplicant_hidl::HidlManager::getInstance();
+	if (!hidl_manager)
+		return 1;
+
+	return hidl_manager->notifyNetworkRequest(
+	    wpa_s, ssid, rtype, default_txt);
+}
diff --git a/wpa_supplicant/hidl/hidl.h b/wpa_supplicant/hidl/hidl.h
new file mode 100644
index 0000000..594098d
--- /dev/null
+++ b/wpa_supplicant/hidl/hidl.h
@@ -0,0 +1,74 @@
+/*
+ * hidl interface for wpa_supplicant daemon
+ * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+#ifndef WPA_SUPPLICANT_HIDL_HIDL_H
+#define WPA_SUPPLICANT_HIDL_HIDL_H
+
+#ifdef _cplusplus
+extern "C" {
+#endif /* _cplusplus */
+
+/**
+ * This is the hidl RPC interface entry point to the wpa_supplicant core.
+ * This initializes the hidl driver & HidlManager instance and then forwards
+ * all the notifcations from the supplicant core to the HidlManager.
+ */
+struct wpas_hidl_priv;
+struct wpa_global;
+
+struct wpas_hidl_priv *wpas_hidl_init(struct wpa_global *global);
+void wpas_hidl_deinit(struct wpas_hidl_priv *priv);
+
+#ifdef CONFIG_CTRL_IFACE_HIDL
+int wpas_hidl_register_interface(struct wpa_supplicant *wpa_s);
+int wpas_hidl_unregister_interface(struct wpa_supplicant *wpa_s);
+int wpas_hidl_register_network(
+    struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
+int wpas_hidl_unregister_network(
+    struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
+int wpas_hidl_notify_state_changed(struct wpa_supplicant *wpa_s);
+int wpas_hidl_notify_network_request(
+    struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
+    enum wpa_ctrl_req_type rtype, const char *default_txt);
+#else  /* CONFIG_CTRL_IFACE_HIDL */
+static inline int wpas_hidl_register_interface(struct wpa_supplicant *wpa_s)
+{
+	return 0;
+}
+static inline int wpas_hidl_unregister_interface(struct wpa_supplicant *wpa_s)
+{
+	return 0;
+}
+static inline int wpas_hidl_register_network(
+    struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
+{
+	return 0;
+}
+static inline int wpas_hidl_unregister_network(
+    struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
+{
+	return 0;
+}
+static inline int wpas_hidl_notify_state_changed(struct wpa_supplicant *wpa_s)
+{
+	return 0;
+}
+static inline int wpas_hidl_notify_network_request(
+    struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
+    enum wpa_ctrl_req_type rtype, const char *default_txt)
+{
+	return 0;
+}
+#endif /* CONFIG_CTRL_IFACE_HIDL */
+
+#ifdef _cplusplus
+}
+#endif /* _cplusplus */
+
+#endif /* WPA_SUPPLICANT_HIDL_HIDL_H */
diff --git a/wpa_supplicant/hidl/hidl_constants.h b/wpa_supplicant/hidl/hidl_constants.h
new file mode 100644
index 0000000..988a590
--- /dev/null
+++ b/wpa_supplicant/hidl/hidl_constants.h
@@ -0,0 +1,21 @@
+/*
+ * hidl interface for wpa_supplicant daemon
+ * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+#ifndef WPA_SUPPLICANT_HIDL_HIDL_CONSTANTS_H
+#define WPA_SUPPLICANT_HIDL_HIDL_CONSTANTS_H
+
+namespace wpa_supplicant_hidl {
+namespace hidl_constants {
+
+extern const char kServiceName[];
+
+} /* namespace hidl_constants */
+} /* namespace wpa_supplicant_hidl */
+
+#endif /* WPA_SUPPLICANT_HIDL_HIDL_CONSTANTS_H */
diff --git a/wpa_supplicant/binder/binder_i.h b/wpa_supplicant/hidl/hidl_i.h
similarity index 67%
rename from wpa_supplicant/binder/binder_i.h
rename to wpa_supplicant/hidl/hidl_i.h
index 65e8a9f..8c0df2e 100644
--- a/wpa_supplicant/binder/binder_i.h
+++ b/wpa_supplicant/hidl/hidl_i.h
@@ -1,5 +1,5 @@
 /*
- * binder interface for wpa_supplicant daemon
+ * hidl interface for wpa_supplicant daemon
  * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
  * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
  *
@@ -7,22 +7,22 @@
  * See README for more details.
  */
 
-#ifndef BINDER_I_H
-#define BINDER_I_H
+#ifndef HIDL_I_H
+#define HIDL_I_H
 
 #ifdef _cplusplus
 extern "C" {
 #endif  // _cplusplus
 
-struct wpas_binder_priv
+struct wpas_hidl_priv
 {
-	int binder_fd;
+	int hidl_fd;
 	struct wpa_global *global;
-	void *binder_manager;
+	void *hidl_manager;
 };
 
 #ifdef _cplusplus
 }
 #endif /* _cplusplus */
 
-#endif /* BINDER_I_H */
+#endif /* HIDL_I_H */
diff --git a/wpa_supplicant/binder/binder_manager.cpp b/wpa_supplicant/hidl/hidl_manager.cpp
similarity index 76%
rename from wpa_supplicant/binder/binder_manager.cpp
rename to wpa_supplicant/hidl/hidl_manager.cpp
index 5d16355..89339c5 100644
--- a/wpa_supplicant/binder/binder_manager.cpp
+++ b/wpa_supplicant/hidl/hidl_manager.cpp
@@ -1,5 +1,5 @@
 /*
- * binder interface for wpa_supplicant daemon
+ * hidl interface for wpa_supplicant daemon
  * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
  * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
  *
@@ -9,54 +9,55 @@
 
 #include <algorithm>
 
-#include <binder/IServiceManager.h>
+#include <hidl/IServiceManager.h>
 
-#include "binder_manager.h"
-#include "wpa_supplicant_binder/binder_constants.h"
+#include "hidl_constants.h"
+#include "hidl_manager.h"
+#include "wpa_supplicant_hidl/hidl_constants.h"
 
 extern "C" {
 #include "utils/common.h"
 #include "utils/includes.h"
 }
 
-namespace wpa_supplicant_binder {
+namespace wpa_supplicant_hidl {
 
-BinderManager *BinderManager::instance_ = NULL;
+HidlManager *HidlManager::instance_ = NULL;
 
-BinderManager *BinderManager::getInstance()
+HidlManager *HidlManager::getInstance()
 {
 	if (!instance_)
-		instance_ = new BinderManager();
+		instance_ = new HidlManager();
 	return instance_;
 }
 
-void BinderManager::destroyInstance()
+void HidlManager::destroyInstance()
 {
 	if (instance_)
 		delete instance_;
 	instance_ = NULL;
 }
 
-int BinderManager::registerBinderService(struct wpa_global *global)
+int HidlManager::registerHidlService(struct wpa_global *global)
 {
-	// Create the main binder service object and register with system
+	// Create the main hidl service object and register with system
 	// ServiceManager.
 	supplicant_object_ = new Supplicant(global);
 
-	android::String16 service_name(binder_constants::kServiceName);
+	android::String16 service_name(hidl_constants::kServiceName);
 	android::defaultServiceManager()->addService(
-	    service_name, android::IInterface::asBinder(supplicant_object_));
+	    service_name, android::IInterface::asHidl(supplicant_object_));
 	return 0;
 }
 
 /**
- * Register an interface to binder manager.
+ * Register an interface to hidl manager.
  *
  * @param wpa_s |wpa_supplicant| struct corresponding to the interface.
  *
  * @return 0 on success, 1 on failure.
  */
-int BinderManager::registerInterface(struct wpa_supplicant *wpa_s)
+int HidlManager::registerInterface(struct wpa_supplicant *wpa_s)
 {
 	if (!wpa_s)
 		return 1;
@@ -84,13 +85,13 @@
 }
 
 /**
- * Unregister an interface from binder manager.
+ * Unregister an interface from hidl manager.
  *
  * @param wpa_s |wpa_supplicant| struct corresponding to the interface.
  *
  * @return 0 on success, 1 on failure.
  */
-int BinderManager::unregisterInterface(struct wpa_supplicant *wpa_s)
+int HidlManager::unregisterInterface(struct wpa_supplicant *wpa_s)
 {
 	if (!wpa_s)
 		return 1;
@@ -109,7 +110,7 @@
 		return 1;
 	const auto &iface_callback_list = iface_callback_map_iter->second;
 	for (const auto &callback : iface_callback_list) {
-		if (android::IInterface::asBinder(callback)->unlinkToDeath(
+		if (android::IInterface::asHidl(callback)->unlinkToDeath(
 			nullptr, callback.get()) != android::OK) {
 			wpa_printf(
 			    MSG_ERROR,
@@ -127,7 +128,7 @@
 }
 
 /**
- * Register a network to binder manager.
+ * Register a network to hidl manager.
  *
  * @param wpa_s |wpa_supplicant| struct corresponding to the interface on which
  * the network is added.
@@ -135,7 +136,7 @@
  *
  * @return 0 on success, 1 on failure.
  */
-int BinderManager::registerNetwork(
+int HidlManager::registerNetwork(
     struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
 {
 	if (!wpa_s || !ssid)
@@ -167,7 +168,7 @@
 }
 
 /**
- * Unregister a network from binder manager.
+ * Unregister a network from hidl manager.
  *
  * @param wpa_s |wpa_supplicant| struct corresponding to the interface on which
  * the network is added.
@@ -175,7 +176,7 @@
  *
  * @return 0 on success, 1 on failure.
  */
-int BinderManager::unregisterNetwork(
+int HidlManager::unregisterNetwork(
     struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
 {
 	if (!wpa_s || !ssid)
@@ -198,7 +199,7 @@
 		return 1;
 	const auto &network_callback_list = network_callback_map_iter->second;
 	for (const auto &callback : network_callback_list) {
-		if (android::IInterface::asBinder(callback)->unlinkToDeath(
+		if (android::IInterface::asHidl(callback)->unlinkToDeath(
 			nullptr, callback.get()) != android::OK) {
 			wpa_printf(
 			    MSG_ERROR,
@@ -224,7 +225,7 @@
  * @param wpa_s |wpa_supplicant| struct corresponding to the interface on which
  * the state change event occured.
  */
-int BinderManager::notifyStateChange(struct wpa_supplicant *wpa_s)
+int HidlManager::notifyStateChange(struct wpa_supplicant *wpa_s)
 {
 	if (!wpa_s)
 		return 1;
@@ -262,7 +263,7 @@
  * @param type type of request.
  * @param param addition params associated with the request.
  */
-int BinderManager::notifyNetworkRequest(
+int HidlManager::notifyNetworkRequest(
     struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, int type,
     const char *param)
 {
@@ -283,15 +284,15 @@
 }
 
 /**
- * Retrieve the |IIface| binder object reference using the provided
+ * Retrieve the |IIface| hidl object reference using the provided
  * ifname.
  *
  * @param ifname Name of the corresponding interface.
- * @param iface_object Binder reference corresponding to the iface.
+ * @param iface_object Hidl reference corresponding to the iface.
  *
  * @return 0 on success, 1 on failure.
  */
-int BinderManager::getIfaceBinderObjectByIfname(
+int HidlManager::getIfaceHidlObjectByIfname(
     const std::string &ifname,
     android::sp<fi::w1::wpa_supplicant::IIface> *iface_object)
 {
@@ -307,16 +308,16 @@
 }
 
 /**
- * Retrieve the |INetwork| binder object reference using the provided
+ * Retrieve the |INetwork| hidl object reference using the provided
  * ifname and network_id.
  *
  * @param ifname Name of the corresponding interface.
  * @param network_id ID of the corresponding network.
- * @param network_object Binder reference corresponding to the network.
+ * @param network_object Hidl reference corresponding to the network.
  *
  * @return 0 on success, 1 on failure.
  */
-int BinderManager::getNetworkBinderObjectByIfnameAndNetworkId(
+int HidlManager::getNetworkHidlObjectByIfnameAndNetworkId(
     const std::string &ifname, int network_id,
     android::sp<fi::w1::wpa_supplicant::INetwork> *network_object)
 {
@@ -336,34 +337,34 @@
 }
 
 /**
- * Add a new |ISupplicantCallback| binder object reference to our
+ * Add a new |ISupplicantCallback| hidl object reference to our
  * global callback list.
  *
- * @param callback Binder reference of the |ISupplicantCallback| object.
+ * @param callback Hidl reference of the |ISupplicantCallback| object.
  *
  * @return 0 on success, 1 on failure.
  */
-int BinderManager::addSupplicantCallbackBinderObject(
+int HidlManager::addSupplicantCallbackHidlObject(
     const android::sp<fi::w1::wpa_supplicant::ISupplicantCallback> &callback)
 {
 	// Register for death notification before we add it to our list.
-	auto on_binder_died_fctor = std::bind(
-	    &BinderManager::removeSupplicantCallbackBinderObject, this,
+	auto on_hidl_died_fctor = std::bind(
+	    &HidlManager::removeSupplicantCallbackHidlObject, this,
 	    std::placeholders::_1);
-	return registerForDeathAndAddCallbackBinderObjectToList<
+	return registerForDeathAndAddCallbackHidlObjectToList<
 	    fi::w1::wpa_supplicant::ISupplicantCallback>(
-	    callback, on_binder_died_fctor, supplicant_callbacks_);
+	    callback, on_hidl_died_fctor, supplicant_callbacks_);
 }
 /**
- * Add a new |IIfaceCallback| binder object reference to our
+ * Add a new |IIfaceCallback| hidl object reference to our
  * interface callback list.
  *
  * @param ifname Name of the corresponding interface.
- * @param callback Binder reference of the |IIfaceCallback| object.
+ * @param callback Hidl reference of the |IIfaceCallback| object.
  *
  * @return 0 on success, 1 on failure.
  */
-int BinderManager::addIfaceCallbackBinderObject(
+int HidlManager::addIfaceCallbackHidlObject(
     const std::string &ifname,
     const android::sp<fi::w1::wpa_supplicant::IIfaceCallback> &callback)
 {
@@ -376,25 +377,25 @@
 	auto &iface_callback_list = iface_callback_map_iter->second;
 
 	// Register for death notification before we add it to our list.
-	auto on_binder_died_fctor = std::bind(
-	    &BinderManager::removeIfaceCallbackBinderObject, this, ifname,
+	auto on_hidl_died_fctor = std::bind(
+	    &HidlManager::removeIfaceCallbackHidlObject, this, ifname,
 	    std::placeholders::_1);
-	return registerForDeathAndAddCallbackBinderObjectToList<
+	return registerForDeathAndAddCallbackHidlObjectToList<
 	    fi::w1::wpa_supplicant::IIfaceCallback>(
-	    callback, on_binder_died_fctor, iface_callback_list);
+	    callback, on_hidl_died_fctor, iface_callback_list);
 }
 
 /**
- * Add a new |INetworkCallback| binder object reference to our
+ * Add a new |INetworkCallback| hidl object reference to our
  * network callback list.
  *
  * @param ifname Name of the corresponding interface.
  * @param network_id ID of the corresponding network.
- * @param callback Binder reference of the |INetworkCallback| object.
+ * @param callback Hidl reference of the |INetworkCallback| object.
  *
  * @return 0 on success, 1 on failure.
  */
-int BinderManager::addNetworkCallbackBinderObject(
+int HidlManager::addNetworkCallbackHidlObject(
     const std::string &ifname, int network_id,
     const android::sp<fi::w1::wpa_supplicant::INetworkCallback> &callback)
 {
@@ -411,12 +412,12 @@
 	auto &network_callback_list = network_callback_map_iter->second;
 
 	// Register for death notification before we add it to our list.
-	auto on_binder_died_fctor = std::bind(
-	    &BinderManager::removeNetworkCallbackBinderObject, this, ifname,
+	auto on_hidl_died_fctor = std::bind(
+	    &HidlManager::removeNetworkCallbackHidlObject, this, ifname,
 	    network_id, std::placeholders::_1);
-	return registerForDeathAndAddCallbackBinderObjectToList<
+	return registerForDeathAndAddCallbackHidlObjectToList<
 	    fi::w1::wpa_supplicant::INetworkCallback>(
-	    callback, on_binder_died_fctor, network_callback_list);
+	    callback, on_hidl_died_fctor, network_callback_list);
 }
 
 /**
@@ -427,19 +428,19 @@
  * @param ifname Name of the corresponding interface.
  * @param network_id ID of the corresponding network.
  */
-const std::string BinderManager::getNetworkObjectMapKey(
+const std::string HidlManager::getNetworkObjectMapKey(
     const std::string &ifname, int network_id)
 {
 	return ifname + "_" + std::to_string(network_id);
 }
 
 /**
- * Removes the provided |ISupplicantCallback| binder object reference
+ * Removes the provided |ISupplicantCallback| hidl object reference
  * from our global callback list.
  *
- * @param callback Binder reference of the |ISupplicantCallback| object.
+ * @param callback Hidl reference of the |ISupplicantCallback| object.
  */
-void BinderManager::removeSupplicantCallbackBinderObject(
+void HidlManager::removeSupplicantCallbackHidlObject(
     const android::sp<fi::w1::wpa_supplicant::ISupplicantCallback> &callback)
 {
 	supplicant_callbacks_.erase(
@@ -450,13 +451,13 @@
 }
 
 /**
- * Removes the provided |IIfaceCallback| binder object reference from
+ * Removes the provided |IIfaceCallback| hidl object reference from
  * our interface callback list.
  *
  * @param ifname Name of the corresponding interface.
- * @param callback Binder reference of the |IIfaceCallback| object.
+ * @param callback Hidl reference of the |IIfaceCallback| object.
  */
-void BinderManager::removeIfaceCallbackBinderObject(
+void HidlManager::removeIfaceCallbackHidlObject(
     const std::string &ifname,
     const android::sp<fi::w1::wpa_supplicant::IIfaceCallback> &callback)
 {
@@ -476,14 +477,14 @@
 }
 
 /**
- * Removes the provided |INetworkCallback| binder object reference from
+ * Removes the provided |INetworkCallback| hidl object reference from
  * our network callback list.
  *
  * @param ifname Name of the corresponding interface.
  * @param network_id ID of the corresponding network.
- * @param callback Binder reference of the |INetworkCallback| object.
+ * @param callback Hidl reference of the |INetworkCallback| object.
  */
-void BinderManager::removeNetworkCallbackBinderObject(
+void HidlManager::removeNetworkCallbackHidlObject(
     const std::string &ifname, int network_id,
     const android::sp<fi::w1::wpa_supplicant::INetworkCallback> &callback)
 {
@@ -509,21 +510,21 @@
 
 /**
  * Add callback to the corresponding list after linking to death on the
- * corresponding binder object reference.
+ * corresponding hidl object reference.
  *
- * @param callback Binder reference of the |INetworkCallback| object.
+ * @param callback Hidl reference of the |INetworkCallback| object.
  *
  * @return 0 on success, 1 on failure.
  */
 template <class CallbackType>
-int BinderManager::registerForDeathAndAddCallbackBinderObjectToList(
+int HidlManager::registerForDeathAndAddCallbackHidlObjectToList(
     const android::sp<CallbackType> &callback,
     const std::function<void(const android::sp<CallbackType> &)>
-	&on_binder_died_fctor,
+	&on_hidl_died_fctor,
     std::vector<android::sp<CallbackType>> &callback_list)
 {
 	auto death_notifier = new CallbackObjectDeathNotifier<CallbackType>(
-	    callback, on_binder_died_fctor);
+	    callback, on_hidl_died_fctor);
 	// Use the |callback.get()| as cookie so that we don't need to
 	// store a reference to this |CallbackObjectDeathNotifier| instance
 	// to use in |unlinkToDeath| later.
@@ -531,7 +532,7 @@
 	// dead,
 	// so add it to the list before we register for callback!
 	callback_list.push_back(callback);
-	if (android::IInterface::asBinder(callback)->linkToDeath(
+	if (android::IInterface::asHidl(callback)->linkToDeath(
 		death_notifier, callback.get()) != android::OK) {
 		wpa_printf(
 		    MSG_ERROR,
@@ -548,13 +549,13 @@
 
 /**
  * Helper function to invoke the provided callback method on all the
- * registered |ISupplicantCallback| callback binder objects.
+ * registered |ISupplicantCallback| callback hidl objects.
  *
- * @param method Pointer to the required binder method from
+ * @param method Pointer to the required hidl method from
  * |ISupplicantCallback|.
  */
-void BinderManager::callWithEachSupplicantCallback(
-    const std::function<android::binder::Status(
+void HidlManager::callWithEachSupplicantCallback(
+    const std::function<android::hidl::Status(
 	android::sp<fi::w1::wpa_supplicant::ISupplicantCallback>)> &method)
 {
 	for (const auto &callback : supplicant_callbacks_) {
@@ -564,15 +565,15 @@
 
 /**
  * Helper fucntion to invoke the provided callback method on all the
- * registered |IIfaceCallback| callback binder objects for the specified
+ * registered |IIfaceCallback| callback hidl objects for the specified
  * |ifname|.
  *
  * @param ifname Name of the corresponding interface.
- * @param method Pointer to the required binder method from |IIfaceCallback|.
+ * @param method Pointer to the required hidl method from |IIfaceCallback|.
  */
-void BinderManager::callWithEachIfaceCallback(
+void HidlManager::callWithEachIfaceCallback(
     const std::string &ifname,
-    const std::function<android::binder::Status(
+    const std::function<android::hidl::Status(
 	android::sp<fi::w1::wpa_supplicant::IIfaceCallback>)> &method)
 {
 	if (ifname.empty())
@@ -589,16 +590,16 @@
 
 /**
  * Helper function to invoke the provided callback method on all the
- * registered |INetworkCallback| callback binder objects for the specified
+ * registered |INetworkCallback| callback hidl objects for the specified
  * |ifname| & |network_id|.
  *
  * @param ifname Name of the corresponding interface.
  * @param network_id ID of the corresponding network.
- * @param method Pointer to the required binder method from |INetworkCallback|.
+ * @param method Pointer to the required hidl method from |INetworkCallback|.
  */
-void BinderManager::callWithEachNetworkCallback(
+void HidlManager::callWithEachNetworkCallback(
     const std::string &ifname, int network_id,
-    const std::function<android::binder::Status(
+    const std::function<android::hidl::Status(
 	android::sp<fi::w1::wpa_supplicant::INetworkCallback>)> &method)
 {
 	if (ifname.empty() || network_id < 0)
@@ -616,4 +617,4 @@
 		method(callback);
 	}
 }
-}  // namespace wpa_supplicant_binder
+}  // namespace wpa_supplicant_hidl
diff --git a/wpa_supplicant/binder/binder_manager.h b/wpa_supplicant/hidl/hidl_manager.h
similarity index 73%
rename from wpa_supplicant/binder/binder_manager.h
rename to wpa_supplicant/hidl/hidl_manager.h
index 0cb4999..f6178a4 100644
--- a/wpa_supplicant/binder/binder_manager.h
+++ b/wpa_supplicant/hidl/hidl_manager.h
@@ -1,5 +1,5 @@
 /*
- * binder interface for wpa_supplicant daemon
+ * hidl interface for wpa_supplicant daemon
  * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
  * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
  *
@@ -7,8 +7,8 @@
  * See README for more details.
  */
 
-#ifndef WPA_SUPPLICANT_BINDER_BINDER_MANAGER_H
-#define WPA_SUPPLICANT_BINDER_BINDER_MANAGER_H
+#ifndef WPA_SUPPLICANT_HIDL_HIDL_MANAGER_H
+#define WPA_SUPPLICANT_HIDL_HIDL_MANAGER_H
 
 #include <map>
 #include <string>
@@ -24,22 +24,22 @@
 struct wpa_global;
 struct wpa_supplicant;
 
-namespace wpa_supplicant_binder {
+namespace wpa_supplicant_hidl {
 
 /**
- * BinderManager is responsible for managing the lifetime of all
- * binder objects created by wpa_supplicant. This is a singleton
+ * HidlManager is responsible for managing the lifetime of all
+ * hidl objects created by wpa_supplicant. This is a singleton
  * class which is created by the supplicant core and can be used
- * to get references to the binder objects.
+ * to get references to the hidl objects.
  */
-class BinderManager
+class HidlManager
 {
 public:
-	static BinderManager *getInstance();
+	static HidlManager *getInstance();
 	static void destroyInstance();
 
 	// Methods called from wpa_supplicant core.
-	int registerBinderService(struct wpa_global *global);
+	int registerHidlService(struct wpa_global *global);
 	int registerInterface(struct wpa_supplicant *wpa_s);
 	int unregisterInterface(struct wpa_supplicant *wpa_s);
 	int registerNetwork(
@@ -51,91 +51,91 @@
 	    struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, int type,
 	    const char *param);
 
-	// Methods called from binder objects.
-	int getIfaceBinderObjectByIfname(
+	// Methods called from hidl objects.
+	int getIfaceHidlObjectByIfname(
 	    const std::string &ifname,
 	    android::sp<fi::w1::wpa_supplicant::IIface> *iface_object);
-	int getNetworkBinderObjectByIfnameAndNetworkId(
+	int getNetworkHidlObjectByIfnameAndNetworkId(
 	    const std::string &ifname, int network_id,
 	    android::sp<fi::w1::wpa_supplicant::INetwork> *network_object);
-	int addSupplicantCallbackBinderObject(
+	int addSupplicantCallbackHidlObject(
 	    const android::sp<fi::w1::wpa_supplicant::ISupplicantCallback>
 		&callback);
-	int addIfaceCallbackBinderObject(
+	int addIfaceCallbackHidlObject(
 	    const std::string &ifname,
 	    const android::sp<fi::w1::wpa_supplicant::IIfaceCallback>
 		&callback);
-	int addNetworkCallbackBinderObject(
+	int addNetworkCallbackHidlObject(
 	    const std::string &ifname, int network_id,
 	    const android::sp<fi::w1::wpa_supplicant::INetworkCallback>
 		&callback);
 
 private:
-	BinderManager() = default;
-	~BinderManager() = default;
-	BinderManager(const BinderManager &) = default;
-	BinderManager &operator=(const BinderManager &) = default;
+	HidlManager() = default;
+	~HidlManager() = default;
+	HidlManager(const HidlManager &) = default;
+	HidlManager &operator=(const HidlManager &) = default;
 
 	const std::string getNetworkObjectMapKey(
 	    const std::string &ifname, int network_id);
 
-	void removeSupplicantCallbackBinderObject(
+	void removeSupplicantCallbackHidlObject(
 	    const android::sp<fi::w1::wpa_supplicant::ISupplicantCallback>
 		&callback);
-	void removeIfaceCallbackBinderObject(
+	void removeIfaceCallbackHidlObject(
 	    const std::string &ifname,
 	    const android::sp<fi::w1::wpa_supplicant::IIfaceCallback>
 		&callback);
-	void removeNetworkCallbackBinderObject(
+	void removeNetworkCallbackHidlObject(
 	    const std::string &ifname, int network_id,
 	    const android::sp<fi::w1::wpa_supplicant::INetworkCallback>
 		&callback);
 	template <class CallbackType>
-	int registerForDeathAndAddCallbackBinderObjectToList(
+	int registerForDeathAndAddCallbackHidlObjectToList(
 	    const android::sp<CallbackType> &callback,
 	    const std::function<void(const android::sp<CallbackType> &)>
-		&on_binder_died_fctor,
+		&on_hidl_died_fctor,
 	    std::vector<android::sp<CallbackType>> &callback_list);
 
 	void callWithEachSupplicantCallback(
-	    const std::function<android::binder::Status(
+	    const std::function<android::hidl::Status(
 		android::sp<fi::w1::wpa_supplicant::ISupplicantCallback>)>
 		&method);
 	void callWithEachIfaceCallback(
 	    const std::string &ifname,
-	    const std::function<android::binder::Status(
+	    const std::function<android::hidl::Status(
 		android::sp<fi::w1::wpa_supplicant::IIfaceCallback>)> &method);
 	void callWithEachNetworkCallback(
 	    const std::string &ifname, int network_id,
-	    const std::function<android::binder::Status(
+	    const std::function<android::hidl::Status(
 		android::sp<fi::w1::wpa_supplicant::INetworkCallback>)>
 		&method);
 
 	// Singleton instance of this class.
-	static BinderManager *instance_;
-	// The main binder service object.
+	static HidlManager *instance_;
+	// The main hidl service object.
 	android::sp<Supplicant> supplicant_object_;
-	// Map of all the interface specific binder objects controlled by
+	// Map of all the interface specific hidl objects controlled by
 	// wpa_supplicant. This map is keyed in by the corresponding
 	// |ifname|.
 	std::map<const std::string, android::sp<Iface>> iface_object_map_;
-	// Map of all the network specific binder objects controlled by
+	// Map of all the network specific hidl objects controlled by
 	// wpa_supplicant. This map is keyed in by the corresponding
 	// |ifname| & |network_id|.
 	std::map<const std::string, android::sp<Network>> network_object_map_;
 
-	// Callback registered for the main binder service object.
+	// Callback registered for the main hidl service object.
 	std::vector<android::sp<fi::w1::wpa_supplicant::ISupplicantCallback>>
 	    supplicant_callbacks_;
 	// Map of all the callbacks registered for interface specific
-	// binder objects controlled by wpa_supplicant.  This map is keyed in by
+	// hidl objects controlled by wpa_supplicant.  This map is keyed in by
 	// the corresponding |ifname|.
 	std::map<
 	    const std::string,
 	    std::vector<android::sp<fi::w1::wpa_supplicant::IIfaceCallback>>>
 	    iface_callbacks_map_;
 	// Map of all the callbacks registered for network specific
-	// binder objects controlled by wpa_supplicant.  This map is keyed in by
+	// hidl objects controlled by wpa_supplicant.  This map is keyed in by
 	// the corresponding |ifname| & |network_id|.
 	std::map<
 	    const std::string,
@@ -145,40 +145,40 @@
 	/**
 	 * Helper class used to deregister the callback object reference from
 	 * our
-	 * callback list on the death of the binder object.
-	 * This class stores a reference of the callback binder object and a
-	 * function to be called to indicate the death of the binder object.
+	 * callback list on the death of the hidl object.
+	 * This class stores a reference of the callback hidl object and a
+	 * function to be called to indicate the death of the hidl object.
 	 */
 	template <class CallbackType>
 	class CallbackObjectDeathNotifier
-	    : public android::IBinder::DeathRecipient
+	    : public android::IHidl::DeathRecipient
 	{
 	public:
 		CallbackObjectDeathNotifier(
 		    const android::sp<CallbackType> &callback,
 		    const std::function<void(const android::sp<CallbackType> &)>
-			&on_binder_died)
-		    : callback_(callback), on_binder_died_(on_binder_died)
+			&on_hidl_died)
+		    : callback_(callback), on_hidl_died_(on_hidl_died)
 		{
 		}
-		void binderDied(
-		    const android::wp<android::IBinder> & /* who */) override
+		void hidlDied(
+		    const android::wp<android::IHidl> & /* who */) override
 		{
-			on_binder_died_(callback_);
+			on_hidl_died_(callback_);
 		}
 
 	private:
-		// The callback binder object reference.
+		// The callback hidl object reference.
 		const android::sp<CallbackType> callback_;
-		// Callback function to be called when the binder dies.
+		// Callback function to be called when the hidl dies.
 		const std::function<void(const android::sp<CallbackType> &)>
-		    on_binder_died_;
+		    on_hidl_died_;
 	};
 };
 
-// The binder interface uses some values which are the same as internal ones to
-// avoid nasty runtime conversion functions.  So, adding compile time asserts
-// to guard against any internal changes breaking the binder interface.
+// The hidl interface uses some values which are the same as internal ones to
+// avoid nasty runtime conversion functions. So, adding compile time asserts
+// to guard against any internal changes breaking the hidl interface.
 static_assert(
     fi::w1::wpa_supplicant::INetwork::KEY_MGMT_MASK_NONE == WPA_KEY_MGMT_NONE,
     "KeyMgmt value mismatch");
@@ -263,5 +263,5 @@
     WPA_CTRL_REQ_EXT_CERT_CHECK ==
 	fi::w1::wpa_supplicant::INetworkCallback::NETWORK_REQ_EXT_CERT_CHECK,
     "Network Req value mismatch");
-}  // namespace wpa_supplicant_binder
-#endif  // WPA_SUPPLICANT_BINDER_BINDER_MANAGER_H
+}  // namespace wpa_supplicant_hidl
+#endif  // WPA_SUPPLICANT_HIDL_HIDL_MANAGER_H
diff --git a/wpa_supplicant/binder/iface.cpp b/wpa_supplicant/hidl/iface.cpp
similarity index 65%
rename from wpa_supplicant/binder/iface.cpp
rename to wpa_supplicant/hidl/iface.cpp
index 624e467..1ba93b7 100644
--- a/wpa_supplicant/binder/iface.cpp
+++ b/wpa_supplicant/hidl/iface.cpp
@@ -1,5 +1,5 @@
 /*
- * binder interface for wpa_supplicant daemon
+ * hidl interface for wpa_supplicant daemon
  * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
  * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
  *
@@ -7,15 +7,15 @@
  * See README for more details.
  */
 
-#include "binder_manager.h"
+#include "hidl_manager.h"
 #include "iface.h"
 
-namespace wpa_supplicant_binder {
+namespace wpa_supplicant_hidl {
 
 #define RETURN_IF_IFACE_INVALID(wpa_s)                                  \
 	{                                                               \
 		if (!wpa_s) {                                           \
-			return android::binder::Status::                \
+			return android::hidl::Status::                \
 			    fromServiceSpecificError(                   \
 				ERROR_IFACE_INVALID,                    \
 				"wpa_supplicant does not control this " \
@@ -28,16 +28,16 @@
 {
 }
 
-android::binder::Status Iface::GetName(std::string *iface_name_out)
+android::hidl::Status Iface::GetName(std::string *iface_name_out)
 {
 	// We could directly return the name we hold, but let's verify
 	// if the underlying iface still exists.
 	RETURN_IF_IFACE_INVALID(retrieveIfacePtr());
 	*iface_name_out = ifname_;
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Iface::AddNetwork(
+android::hidl::Status Iface::AddNetwork(
     android::sp<fi::w1::wpa_supplicant::INetwork> *network_object_out)
 {
 	struct wpa_supplicant *wpa_s = retrieveIfacePtr();
@@ -45,42 +45,42 @@
 
 	struct wpa_ssid *ssid = wpa_supplicant_add_network(wpa_s);
 	if (!ssid) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC, "wpa_supplicant couldn't add this network.");
 	}
 
-	BinderManager *binder_manager = BinderManager::getInstance();
-	if (!binder_manager ||
-	    binder_manager->getNetworkBinderObjectByIfnameAndNetworkId(
+	HidlManager *hidl_manager = HidlManager::getInstance();
+	if (!hidl_manager ||
+	    hidl_manager->getNetworkHidlObjectByIfnameAndNetworkId(
 		wpa_s->ifname, ssid->id, network_object_out)) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC,
-		    "wpa_supplicant encountered a binder error.");
+		    "wpa_supplicant encountered a hidl error.");
 	}
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Iface::RemoveNetwork(int network_id)
+android::hidl::Status Iface::RemoveNetwork(int network_id)
 {
 	struct wpa_supplicant *wpa_s = retrieveIfacePtr();
 	RETURN_IF_IFACE_INVALID(wpa_s);
 
 	int result = wpa_supplicant_remove_network(wpa_s, network_id);
 	if (result == -1) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_NETWORK_UNKNOWN,
 		    "wpa_supplicant does not control this network.");
 	}
 
 	if (result == -2) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC,
 		    "wpa_supplicant couldn't remove this network.");
 	}
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Iface::GetNetwork(
+android::hidl::Status Iface::GetNetwork(
     int network_id,
     android::sp<fi::w1::wpa_supplicant::INetwork> *network_object_out)
 {
@@ -89,95 +89,95 @@
 
 	struct wpa_ssid *ssid = wpa_config_get_network(wpa_s->conf, network_id);
 	if (!ssid) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_NETWORK_UNKNOWN,
 		    "wpa_supplicant does not control this network.");
 	}
 
-	BinderManager *binder_manager = BinderManager::getInstance();
-	if (!binder_manager ||
-	    binder_manager->getNetworkBinderObjectByIfnameAndNetworkId(
+	HidlManager *hidl_manager = HidlManager::getInstance();
+	if (!hidl_manager ||
+	    hidl_manager->getNetworkHidlObjectByIfnameAndNetworkId(
 		wpa_s->ifname, ssid->id, network_object_out)) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC,
-		    "wpa_supplicant encountered a binder error.");
+		    "wpa_supplicant encountered a hidl error.");
 	}
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Iface::RegisterCallback(
+android::hidl::Status Iface::RegisterCallback(
     const android::sp<fi::w1::wpa_supplicant::IIfaceCallback> &callback)
 {
 	struct wpa_supplicant *wpa_s = retrieveIfacePtr();
 	RETURN_IF_IFACE_INVALID(wpa_s);
 
-	BinderManager *binder_manager = BinderManager::getInstance();
-	if (!binder_manager ||
-	    binder_manager->addIfaceCallbackBinderObject(ifname_, callback)) {
-		return android::binder::Status::fromServiceSpecificError(
+	HidlManager *hidl_manager = HidlManager::getInstance();
+	if (!hidl_manager ||
+	    hidl_manager->addIfaceCallbackHidlObject(ifname_, callback)) {
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC,
-		    "wpa_supplicant encountered a binder error.");
+		    "wpa_supplicant encountered a hidl error.");
 	}
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Iface::Reassociate()
+android::hidl::Status Iface::Reassociate()
 {
 	struct wpa_supplicant *wpa_s = retrieveIfacePtr();
 	RETURN_IF_IFACE_INVALID(wpa_s);
 
 	if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_IFACE_DISABLED);
 	}
 	wpas_request_connection(wpa_s);
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Iface::Reconnect()
+android::hidl::Status Iface::Reconnect()
 {
 	struct wpa_supplicant *wpa_s = retrieveIfacePtr();
 	RETURN_IF_IFACE_INVALID(wpa_s);
 
 	if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_IFACE_DISABLED);
 	}
 	if (!wpa_s->disconnected) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_IFACE_NOT_DISCONNECTED);
 	}
 	wpas_request_connection(wpa_s);
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Iface::Disconnect()
+android::hidl::Status Iface::Disconnect()
 {
 	struct wpa_supplicant *wpa_s = retrieveIfacePtr();
 	RETURN_IF_IFACE_INVALID(wpa_s);
 
 	if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_IFACE_DISABLED);
 	}
 	wpas_request_disconnection(wpa_s);
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Iface::SetPowerSave(bool enable)
+android::hidl::Status Iface::SetPowerSave(bool enable)
 {
 	struct wpa_supplicant *wpa_s = retrieveIfacePtr();
 	RETURN_IF_IFACE_INVALID(wpa_s);
 	if (wpa_drv_set_p2p_powersave(wpa_s, enable, -1, -1)) {
 		const std::string error_msg = "Failed setting power save mode" +
 					      std::to_string(enable) + ".";
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC, error_msg.c_str());
 	}
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Iface::InitiateTDLSDiscover(
+android::hidl::Status Iface::InitiateTDLSDiscover(
     const std::vector<uint8_t> &mac_address)
 {
 	struct wpa_supplicant *wpa_s = retrieveIfacePtr();
@@ -187,8 +187,8 @@
 		const std::string error_msg =
 		    "Invalid MAC address value length: " +
 		    std::to_string(mac_address.size()) + ".";
-		return android::binder::Status::fromExceptionCode(
-		    android::binder::Status::EX_ILLEGAL_ARGUMENT,
+		return android::hidl::Status::fromExceptionCode(
+		    android::hidl::Status::EX_ILLEGAL_ARGUMENT,
 		    error_msg.c_str());
 	}
 	int ret;
@@ -199,13 +199,13 @@
 		ret = wpa_drv_tdls_oper(wpa_s, TDLS_DISCOVERY_REQ, peer);
 	}
 	if (ret) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC, "Failed to initiate TDLS Discover.");
 	}
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Iface::InitiateTDLSSetup(
+android::hidl::Status Iface::InitiateTDLSSetup(
     const std::vector<uint8_t> &mac_address)
 {
 	struct wpa_supplicant *wpa_s = retrieveIfacePtr();
@@ -215,8 +215,8 @@
 		const std::string error_msg =
 		    "Invalid MAC address value length: " +
 		    std::to_string(mac_address.size()) + ".";
-		return android::binder::Status::fromExceptionCode(
-		    android::binder::Status::EX_ILLEGAL_ARGUMENT,
+		return android::hidl::Status::fromExceptionCode(
+		    android::hidl::Status::EX_ILLEGAL_ARGUMENT,
 		    error_msg.c_str());
 	}
 	int ret;
@@ -229,13 +229,13 @@
 		ret = wpa_drv_tdls_oper(wpa_s, TDLS_SETUP, peer);
 	}
 	if (ret) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC, "Failed to initiate TDLS Setup.");
 	}
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Iface::InitiateTDLSTeardown(
+android::hidl::Status Iface::InitiateTDLSTeardown(
     const std::vector<uint8_t> &mac_address)
 {
 	struct wpa_supplicant *wpa_s = retrieveIfacePtr();
@@ -245,8 +245,8 @@
 		const std::string error_msg =
 		    "Invalid MAC address value length: " +
 		    std::to_string(mac_address.size()) + ".";
-		return android::binder::Status::fromExceptionCode(
-		    android::binder::Status::EX_ILLEGAL_ARGUMENT,
+		return android::hidl::Status::fromExceptionCode(
+		    android::hidl::Status::EX_ILLEGAL_ARGUMENT,
 		    error_msg.c_str());
 	}
 	int ret;
@@ -259,10 +259,10 @@
 		ret = wpa_drv_tdls_oper(wpa_s, TDLS_TEARDOWN, peer);
 	}
 	if (ret) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC, "Failed to initiate TDLS Teardown.");
 	}
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
 /**
@@ -276,4 +276,4 @@
 	return wpa_supplicant_get_iface(
 	    (struct wpa_global *)wpa_global_, ifname_.c_str());
 }
-}  // namespace wpa_supplicant_binder
+}  // namespace wpa_supplicant_hidl
diff --git a/wpa_supplicant/hidl/iface.h b/wpa_supplicant/hidl/iface.h
new file mode 100644
index 0000000..51d7f39
--- /dev/null
+++ b/wpa_supplicant/hidl/iface.h
@@ -0,0 +1,76 @@
+/*
+ * hidl interface for wpa_supplicant daemon
+ * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+#ifndef WPA_SUPPLICANT_HIDL_IFACE_H
+#define WPA_SUPPLICANT_HIDL_IFACE_H
+
+#include <android-base/macros.h>
+
+#include "fi/w1/wpa_supplicant/BnIface.h"
+#include "fi/w1/wpa_supplicant/INetwork.h"
+
+extern "C" {
+#include "utils/common.h"
+#include "utils/includes.h"
+#include "wpa_supplicant_i.h"
+#include "driver_i.h"
+}
+
+namespace wpa_supplicant_hidl {
+
+/**
+ * Implementation of Iface hidl object. Each unique hidl
+ * object is used for control operations on a specific interface
+ * controlled by wpa_supplicant.
+ */
+class Iface : public fi::w1::wpa_supplicant::BnIface
+{
+public:
+	Iface(struct wpa_global *wpa_global, const char ifname[]);
+	~Iface() override = default;
+
+	// Hidl methods exposed in aidl.
+	android::hidl::Status GetName(std::string *iface_name_out) override;
+	android::hidl::Status AddNetwork(
+	    android::sp<fi::w1::wpa_supplicant::INetwork> *network_object_out)
+	    override;
+	android::hidl::Status RemoveNetwork(int network_id) override;
+	android::hidl::Status GetNetwork(
+	    int network_id,
+	    android::sp<fi::w1::wpa_supplicant::INetwork> *network_object_out)
+	    override;
+	android::hidl::Status RegisterCallback(
+	    const android::sp<fi::w1::wpa_supplicant::IIfaceCallback> &callback)
+	    override;
+	android::hidl::Status Reassociate() override;
+	android::hidl::Status Reconnect() override;
+	android::hidl::Status Disconnect() override;
+	android::hidl::Status SetPowerSave(bool enable) override;
+	android::hidl::Status InitiateTDLSDiscover(
+	    const std::vector<uint8_t> &mac_address) override;
+	android::hidl::Status InitiateTDLSSetup(
+	    const std::vector<uint8_t> &mac_address) override;
+	android::hidl::Status InitiateTDLSTeardown(
+	    const std::vector<uint8_t> &mac_address) override;
+
+private:
+	struct wpa_supplicant *retrieveIfacePtr();
+
+	// Reference to the global wpa_struct. This is assumed to be valid for
+	// the lifetime of the process.
+	const struct wpa_global *wpa_global_;
+	// Name of the iface this hidl object controls
+	const std::string ifname_;
+
+	DISALLOW_COPY_AND_ASSIGN(Iface);
+};
+
+}  // namespace wpa_supplicant_hidl
+
+#endif  // WPA_SUPPLICANT_HIDL_IFACE_H
diff --git a/wpa_supplicant/binder/network.cpp b/wpa_supplicant/hidl/network.cpp
similarity index 75%
rename from wpa_supplicant/binder/network.cpp
rename to wpa_supplicant/hidl/network.cpp
index e4dcbd4..97a7368 100644
--- a/wpa_supplicant/binder/network.cpp
+++ b/wpa_supplicant/hidl/network.cpp
@@ -1,5 +1,5 @@
 /*
- * binder interface for wpa_supplicant daemon
+ * hidl interface for wpa_supplicant daemon
  * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
  * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
  *
@@ -7,7 +7,7 @@
  * See README for more details.
  */
 
-#include "binder_manager.h"
+#include "hidl_manager.h"
 #include "network.h"
 
 namespace {
@@ -48,12 +48,12 @@
     "NULL", "PAP", "MSCHAP", "MSCHAPV2", "GTC"};
 }  // namespace
 
-namespace wpa_supplicant_binder {
+namespace wpa_supplicant_hidl {
 
 #define RETURN_IF_NETWORK_INVALID(wpa_ssid)                             \
 	{                                                               \
 		if (!wpa_ssid) {                                        \
-			return android::binder::Status::                \
+			return android::hidl::Status::                \
 			    fromServiceSpecificError(                   \
 				ERROR_NETWORK_INVALID,                  \
 				"wpa_supplicant does not control this " \
@@ -67,36 +67,36 @@
 {
 }
 
-android::binder::Status Network::GetId(int *network_id_out)
+android::hidl::Status Network::GetId(int *network_id_out)
 {
 	RETURN_IF_NETWORK_INVALID(retrieveNetworkPtr());
 	*network_id_out = network_id_;
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::GetInterfaceName(std::string *ifname_out)
+android::hidl::Status Network::GetInterfaceName(std::string *ifname_out)
 {
 	RETURN_IF_NETWORK_INVALID(retrieveNetworkPtr());
 	*ifname_out = ifname_;
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::RegisterCallback(
+android::hidl::Status Network::RegisterCallback(
     const android::sp<fi::w1::wpa_supplicant::INetworkCallback> &callback)
 {
 	RETURN_IF_NETWORK_INVALID(retrieveNetworkPtr());
-	BinderManager *binder_manager = BinderManager::getInstance();
-	if (!binder_manager ||
-	    binder_manager->addNetworkCallbackBinderObject(
+	HidlManager *hidl_manager = HidlManager::getInstance();
+	if (!hidl_manager ||
+	    hidl_manager->addNetworkCallbackHidlObject(
 		ifname_, network_id_, callback)) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC,
-		    "wpa_supplicant encountered a binder error.");
+		    "wpa_supplicant encountered a hidl error.");
 	}
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::SetSSID(const std::vector<uint8_t> &ssid)
+android::hidl::Status Network::SetSSID(const std::vector<uint8_t> &ssid)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
@@ -104,11 +104,11 @@
 	if (ssid.empty() || ssid.size() > SSID_MAX_LEN) {
 		const std::string error_msg = "Invalid SSID value length: " +
 					      std::to_string(ssid.size()) + ".";
-		return android::binder::Status::fromExceptionCode(
-		    android::binder::Status::EX_ILLEGAL_ARGUMENT,
+		return android::hidl::Status::fromExceptionCode(
+		    android::hidl::Status::EX_ILLEGAL_ARGUMENT,
 		    error_msg.c_str());
 	}
-	android::binder::Status status = setByteArrayFieldAndResetState(
+	android::hidl::Status status = setByteArrayFieldAndResetState(
 	    ssid.data(), ssid.size(), &(wpa_ssid->ssid), &(wpa_ssid->ssid_len),
 	    "ssid");
 	if (status.isOk() && wpa_ssid->passphrase) {
@@ -117,7 +117,7 @@
 	return status;
 }
 
-android::binder::Status Network::SetBSSID(const std::vector<uint8_t> &bssid)
+android::hidl::Status Network::SetBSSID(const std::vector<uint8_t> &bssid)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
@@ -126,8 +126,8 @@
 		const std::string error_msg = "Invalid BSSID value length: " +
 					      std::to_string(bssid.size()) +
 					      ".";
-		return android::binder::Status::fromExceptionCode(
-		    android::binder::Status::EX_ILLEGAL_ARGUMENT,
+		return android::hidl::Status::fromExceptionCode(
+		    android::hidl::Status::EX_ILLEGAL_ARGUMENT,
 		    error_msg.c_str());
 	}
 	int prev_bssid_set = wpa_ssid->bssid_set;
@@ -147,20 +147,20 @@
 	     os_memcmp(wpa_ssid->bssid, prev_bssid, ETH_ALEN) != 0)) {
 		wpas_notify_network_bssid_set_changed(wpa_s, wpa_ssid);
 	}
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::SetScanSSID(bool enable)
+android::hidl::Status Network::SetScanSSID(bool enable)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
 
 	wpa_ssid->scan_ssid = enable ? 1 : 0;
 	resetInternalStateAfterParamsUpdate();
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::SetKeyMgmt(int32_t key_mgmt_mask)
+android::hidl::Status Network::SetKeyMgmt(int32_t key_mgmt_mask)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
@@ -169,17 +169,17 @@
 		const std::string error_msg = "Invalid key_mgmt value: " +
 					      std::to_string(key_mgmt_mask) +
 					      ".";
-		return android::binder::Status::fromExceptionCode(
-		    android::binder::Status::EX_ILLEGAL_ARGUMENT,
+		return android::hidl::Status::fromExceptionCode(
+		    android::hidl::Status::EX_ILLEGAL_ARGUMENT,
 		    error_msg.c_str());
 	}
 	wpa_ssid->key_mgmt = key_mgmt_mask;
 	wpa_printf(MSG_MSGDUMP, "key_mgmt: 0x%x", wpa_ssid->key_mgmt);
 	resetInternalStateAfterParamsUpdate();
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::SetProto(int32_t proto_mask)
+android::hidl::Status Network::SetProto(int32_t proto_mask)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
@@ -187,17 +187,17 @@
 	if (proto_mask & ~kAllowedProtoMask) {
 		const std::string error_msg =
 		    "Invalid proto value: " + std::to_string(proto_mask) + ".";
-		return android::binder::Status::fromExceptionCode(
-		    android::binder::Status::EX_ILLEGAL_ARGUMENT,
+		return android::hidl::Status::fromExceptionCode(
+		    android::hidl::Status::EX_ILLEGAL_ARGUMENT,
 		    error_msg.c_str());
 	}
 	wpa_ssid->proto = proto_mask;
 	wpa_printf(MSG_MSGDUMP, "proto: 0x%x", wpa_ssid->proto);
 	resetInternalStateAfterParamsUpdate();
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::SetAuthAlg(int32_t auth_alg_mask)
+android::hidl::Status Network::SetAuthAlg(int32_t auth_alg_mask)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
@@ -206,17 +206,17 @@
 		const std::string error_msg = "Invalid auth_alg value: " +
 					      std::to_string(auth_alg_mask) +
 					      ".";
-		return android::binder::Status::fromExceptionCode(
-		    android::binder::Status::EX_ILLEGAL_ARGUMENT,
+		return android::hidl::Status::fromExceptionCode(
+		    android::hidl::Status::EX_ILLEGAL_ARGUMENT,
 		    error_msg.c_str());
 	}
 	wpa_ssid->auth_alg = auth_alg_mask;
 	wpa_printf(MSG_MSGDUMP, "auth_alg: 0x%x", wpa_ssid->auth_alg);
 	resetInternalStateAfterParamsUpdate();
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::SetGroupCipher(int32_t group_cipher_mask)
+android::hidl::Status Network::SetGroupCipher(int32_t group_cipher_mask)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
@@ -225,17 +225,17 @@
 		const std::string error_msg =
 		    "Invalid group_cipher value: " +
 		    std::to_string(group_cipher_mask) + ".";
-		return android::binder::Status::fromExceptionCode(
-		    android::binder::Status::EX_ILLEGAL_ARGUMENT,
+		return android::hidl::Status::fromExceptionCode(
+		    android::hidl::Status::EX_ILLEGAL_ARGUMENT,
 		    error_msg.c_str());
 	}
 	wpa_ssid->group_cipher = group_cipher_mask;
 	wpa_printf(MSG_MSGDUMP, "group_cipher: 0x%x", wpa_ssid->group_cipher);
 	resetInternalStateAfterParamsUpdate();
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::SetPairwiseCipher(int32_t pairwise_cipher_mask)
+android::hidl::Status Network::SetPairwiseCipher(int32_t pairwise_cipher_mask)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
@@ -244,36 +244,36 @@
 		const std::string error_msg =
 		    "Invalid pairwise_cipher value: " +
 		    std::to_string(pairwise_cipher_mask) + ".";
-		return android::binder::Status::fromExceptionCode(
-		    android::binder::Status::EX_ILLEGAL_ARGUMENT,
+		return android::hidl::Status::fromExceptionCode(
+		    android::hidl::Status::EX_ILLEGAL_ARGUMENT,
 		    error_msg.c_str());
 	}
 	wpa_ssid->pairwise_cipher = pairwise_cipher_mask;
 	wpa_printf(
 	    MSG_MSGDUMP, "pairwise_cipher: 0x%x", wpa_ssid->pairwise_cipher);
 	resetInternalStateAfterParamsUpdate();
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::SetPskPassphrase(const std::string &psk)
+android::hidl::Status Network::SetPskPassphrase(const std::string &psk)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
 
 	if (isPskPassphraseValid(psk)) {
-		return android::binder::Status::fromExceptionCode(
-		    android::binder::Status::EX_ILLEGAL_ARGUMENT,
+		return android::hidl::Status::fromExceptionCode(
+		    android::hidl::Status::EX_ILLEGAL_ARGUMENT,
 		    "Invalid Psk passphrase value.");
 	}
 	if (wpa_ssid->passphrase &&
 	    os_strlen(wpa_ssid->passphrase) == psk.size() &&
 	    os_memcmp(wpa_ssid->passphrase, psk.c_str(), psk.size()) == 0) {
-		return android::binder::Status::ok();
+		return android::hidl::Status::ok();
 	}
 	// Flag to indicate if raw psk is calculated or not using
 	// |wpa_config_update_psk|. Deferred if ssid not already set.
 	wpa_ssid->psk_set = 0;
-	android::binder::Status status = setStringKeyFieldAndResetState(
+	android::hidl::Status status = setStringKeyFieldAndResetState(
 	    psk.data(), &(wpa_ssid->passphrase), "psk passphrase");
 	if (status.isOk() && wpa_ssid->ssid_len) {
 		wpa_config_update_psk(wpa_ssid);
@@ -281,7 +281,7 @@
 	return status;
 }
 
-android::binder::Status Network::SetWepKey(
+android::hidl::Status Network::SetWepKey(
     int key_idx, const std::vector<uint8_t> &wep_key)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -290,8 +290,8 @@
 	if (key_idx < 0 || key_idx >= WEP_KEYS_MAX_NUM) {
 		const std::string error_msg =
 		    "Invalid Wep Key index: " + std::to_string(key_idx) + ".";
-		return android::binder::Status::fromExceptionCode(
-		    android::binder::Status::EX_ILLEGAL_ARGUMENT,
+		return android::hidl::Status::fromExceptionCode(
+		    android::hidl::Status::EX_ILLEGAL_ARGUMENT,
 		    error_msg.c_str());
 	}
 	if (wep_key.size() != WEP40_KEY_LEN &&
@@ -299,8 +299,8 @@
 		const std::string error_msg = "Invalid Wep Key value length: " +
 					      std::to_string(wep_key.size()) +
 					      ".";
-		return android::binder::Status::fromExceptionCode(
-		    android::binder::Status::EX_ILLEGAL_ARGUMENT,
+		return android::hidl::Status::fromExceptionCode(
+		    android::hidl::Status::EX_ILLEGAL_ARGUMENT,
 		    error_msg.c_str());
 	}
 	os_memcpy(wpa_ssid->wep_key[key_idx], wep_key.data(), wep_key.size());
@@ -310,10 +310,10 @@
 	    MSG_MSGDUMP, msg_dump_title.c_str(), wpa_ssid->wep_key[key_idx],
 	    wpa_ssid->wep_key_len[key_idx]);
 	resetInternalStateAfterParamsUpdate();
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::SetWepTxKeyIdx(int32_t wep_tx_key_idx)
+android::hidl::Status Network::SetWepTxKeyIdx(int32_t wep_tx_key_idx)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
@@ -322,16 +322,16 @@
 		const std::string error_msg = "Invalid Wep Key index: " +
 					      std::to_string(wep_tx_key_idx) +
 					      ".";
-		return android::binder::Status::fromExceptionCode(
-		    android::binder::Status::EX_ILLEGAL_ARGUMENT,
+		return android::hidl::Status::fromExceptionCode(
+		    android::hidl::Status::EX_ILLEGAL_ARGUMENT,
 		    error_msg.c_str());
 	}
 	wpa_ssid->wep_tx_keyidx = wep_tx_key_idx;
 	resetInternalStateAfterParamsUpdate();
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::SetRequirePMF(bool enable)
+android::hidl::Status Network::SetRequirePMF(bool enable)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
@@ -339,10 +339,10 @@
 	wpa_ssid->ieee80211w =
 	    enable ? MGMT_FRAME_PROTECTION_REQUIRED : NO_MGMT_FRAME_PROTECTION;
 	resetInternalStateAfterParamsUpdate();
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::SetEapMethod(int32_t method)
+android::hidl::Status Network::SetEapMethod(int32_t method)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
@@ -351,8 +351,8 @@
 	if (method < kEapMethodMin || method >= kEapMethodMax) {
 		const std::string error_msg =
 		    "Invalid EAP method: " + std::to_string(method) + ".";
-		return android::binder::Status::fromExceptionCode(
-		    android::binder::Status::EX_ILLEGAL_ARGUMENT,
+		return android::hidl::Status::fromExceptionCode(
+		    android::hidl::Status::EX_ILLEGAL_ARGUMENT,
 		    error_msg.c_str());
 	}
 	const char *method_str = kEapMethodStrings[method];
@@ -363,7 +363,7 @@
 	    retrieved_method == EAP_TYPE_NONE) {
 		const std::string error_msg = "Cannot get EAP method type: " +
 					      std::to_string(method) + ".";
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC, error_msg.c_str());
 	}
 
@@ -378,7 +378,7 @@
 	wpa_ssid->eap.eap_methods =
 	    (eap_method_type *)os_malloc(sizeof(eap_method_type) * 2);
 	if (!wpa_ssid->eap.eap_methods) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC, "Memory allocation failed.");
 	}
 	wpa_ssid->eap.eap_methods[0].vendor = retrieved_vendor;
@@ -399,10 +399,10 @@
 	    MSG_MSGDUMP, "eap methods", (u8 *)wpa_ssid->eap.eap_methods,
 	    sizeof(eap_method_type) * 2);
 	resetInternalStateAfterParamsUpdate();
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::SetEapPhase2Method(int32_t method)
+android::hidl::Status Network::SetEapPhase2Method(int32_t method)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
@@ -410,8 +410,8 @@
 	if (method < kEapPhase2MethodMin || method >= kEapMethodMax) {
 		const std::string error_msg = "Invalid EAP Phase2 method: " +
 					      std::to_string(method) + ".";
-		return android::binder::Status::fromExceptionCode(
-		    android::binder::Status::EX_ILLEGAL_ARGUMENT,
+		return android::hidl::Status::fromExceptionCode(
+		    android::hidl::Status::EX_ILLEGAL_ARGUMENT,
 		    error_msg.c_str());
 	}
 	return setStringFieldAndResetState(
@@ -419,7 +419,7 @@
 	    "eap phase2");
 }
 
-android::binder::Status Network::SetEapIdentity(
+android::hidl::Status Network::SetEapIdentity(
     const std::vector<uint8_t> &identity)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -430,7 +430,7 @@
 	    &(wpa_ssid->eap.identity_len), "eap identity");
 }
 
-android::binder::Status Network::SetEapAnonymousIdentity(
+android::hidl::Status Network::SetEapAnonymousIdentity(
     const std::vector<uint8_t> &identity)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -442,13 +442,13 @@
 	    &(wpa_ssid->eap.anonymous_identity_len), "eap anonymous_identity");
 }
 
-android::binder::Status Network::SetEapPassword(
+android::hidl::Status Network::SetEapPassword(
     const std::vector<uint8_t> &password)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
 
-	android::binder::Status status = setByteArrayKeyFieldAndResetState(
+	android::hidl::Status status = setByteArrayKeyFieldAndResetState(
 	    password.data(), password.size(), &(wpa_ssid->eap.password),
 	    &(wpa_ssid->eap.password_len), "eap password");
 	if (status.isOk()) {
@@ -458,7 +458,7 @@
 	return status;
 }
 
-android::binder::Status Network::SetEapCACert(const std::string &path)
+android::hidl::Status Network::SetEapCACert(const std::string &path)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
@@ -467,7 +467,7 @@
 	    path.c_str(), &(wpa_ssid->eap.ca_cert), "eap ca_cert");
 }
 
-android::binder::Status Network::SetEapCAPath(const std::string &path)
+android::hidl::Status Network::SetEapCAPath(const std::string &path)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
@@ -476,7 +476,7 @@
 	    path.c_str(), &(wpa_ssid->eap.ca_path), "eap ca_path");
 }
 
-android::binder::Status Network::SetEapClientCert(const std::string &path)
+android::hidl::Status Network::SetEapClientCert(const std::string &path)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
@@ -485,7 +485,7 @@
 	    path.c_str(), &(wpa_ssid->eap.client_cert), "eap client_cert");
 }
 
-android::binder::Status Network::SetEapPrivateKey(const std::string &path)
+android::hidl::Status Network::SetEapPrivateKey(const std::string &path)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
@@ -494,7 +494,7 @@
 	    path.c_str(), &(wpa_ssid->eap.private_key), "eap private_key");
 }
 
-android::binder::Status Network::SetEapSubjectMatch(const std::string &match)
+android::hidl::Status Network::SetEapSubjectMatch(const std::string &match)
 
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -504,7 +504,7 @@
 	    match.c_str(), &(wpa_ssid->eap.subject_match), "eap subject_match");
 }
 
-android::binder::Status Network::SetEapAltSubjectMatch(const std::string &match)
+android::hidl::Status Network::SetEapAltSubjectMatch(const std::string &match)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
@@ -514,16 +514,16 @@
 	    "eap altsubject_match");
 }
 
-android::binder::Status Network::SetEapEngine(bool enable)
+android::hidl::Status Network::SetEapEngine(bool enable)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
 
 	wpa_ssid->eap.engine = enable ? 1 : 0;
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::SetEapEngineID(const std::string &id)
+android::hidl::Status Network::SetEapEngineID(const std::string &id)
 
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -531,10 +531,10 @@
 
 	return setStringFieldAndResetState(
 	    id.c_str(), &(wpa_ssid->eap.engine_id), "eap engine_id");
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::SetEapDomainSuffixMatch(
+android::hidl::Status Network::SetEapDomainSuffixMatch(
     const std::string &match)
 
 {
@@ -546,16 +546,16 @@
 	    "eap domain_suffix_match");
 }
 
-android::binder::Status Network::GetSSID(std::vector<uint8_t> *ssid)
+android::hidl::Status Network::GetSSID(std::vector<uint8_t> *ssid)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
 
 	ssid->assign(wpa_ssid->ssid, wpa_ssid->ssid + wpa_ssid->ssid_len);
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::GetBSSID(std::vector<uint8_t> *bssid)
+android::hidl::Status Network::GetBSSID(std::vector<uint8_t> *bssid)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
@@ -565,60 +565,60 @@
 	} else {
 		bssid->clear();
 	}
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::GetScanSSID(bool *enable)
+android::hidl::Status Network::GetScanSSID(bool *enable)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
 
 	*enable = (wpa_ssid->scan_ssid == 1);
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::GetKeyMgmt(int32_t *key_mgmt_mask)
+android::hidl::Status Network::GetKeyMgmt(int32_t *key_mgmt_mask)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
 	*key_mgmt_mask = wpa_ssid->key_mgmt;
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::GetProto(int32_t *proto_mask)
+android::hidl::Status Network::GetProto(int32_t *proto_mask)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
 	*proto_mask = wpa_ssid->proto;
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::GetAuthAlg(int32_t *auth_alg_mask)
+android::hidl::Status Network::GetAuthAlg(int32_t *auth_alg_mask)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
 	*auth_alg_mask = wpa_ssid->auth_alg;
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::GetGroupCipher(int32_t *group_cipher_mask)
+android::hidl::Status Network::GetGroupCipher(int32_t *group_cipher_mask)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
 	*group_cipher_mask = wpa_ssid->group_cipher;
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::GetPairwiseCipher(
+android::hidl::Status Network::GetPairwiseCipher(
     int32_t *pairwise_cipher_mask)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
 	*pairwise_cipher_mask = wpa_ssid->pairwise_cipher;
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::GetPskPassphrase(std::string *psk)
+android::hidl::Status Network::GetPskPassphrase(std::string *psk)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
@@ -628,10 +628,10 @@
 	} else {
 		*psk = std::string();
 	}
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::GetWepKey(
+android::hidl::Status Network::GetWepKey(
     int key_idx, std::vector<uint8_t> *wep_key)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -640,41 +640,41 @@
 	if (key_idx < 0 || key_idx >= WEP_KEYS_MAX_NUM) {
 		const std::string error_msg =
 		    "Invalid Wep Key index: " + std::to_string(key_idx) + ".";
-		return android::binder::Status::fromExceptionCode(
-		    android::binder::Status::EX_ILLEGAL_ARGUMENT,
+		return android::hidl::Status::fromExceptionCode(
+		    android::hidl::Status::EX_ILLEGAL_ARGUMENT,
 		    error_msg.c_str());
 	}
 
 	wep_key->assign(
 	    wpa_ssid->wep_key[key_idx],
 	    wpa_ssid->wep_key[key_idx] + wpa_ssid->wep_key_len[key_idx]);
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::GetWepTxKeyIdx(int32_t *wep_tx_key_idx)
+android::hidl::Status Network::GetWepTxKeyIdx(int32_t *wep_tx_key_idx)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
 	*wep_tx_key_idx = wpa_ssid->wep_tx_keyidx;
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::GetRequirePMF(bool *enable)
+android::hidl::Status Network::GetRequirePMF(bool *enable)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
 
 	*enable = (wpa_ssid->ieee80211w == MGMT_FRAME_PROTECTION_REQUIRED);
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::Enable(bool no_connect)
+android::hidl::Status Network::Enable(bool no_connect)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
 
 	if (wpa_ssid->disabled == 2) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC,
 		    "Cannot use Enable with persistent P2P group");
 	}
@@ -687,32 +687,32 @@
 		wpa_s->scan_min_time.usec = 0;
 		wpa_supplicant_enable_network(wpa_s, wpa_ssid);
 	}
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::Disable()
+android::hidl::Status Network::Disable()
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
 
 	if (wpa_ssid->disabled == 2) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC,
 		    "Cannot use Disable with persistent P2P group");
 	}
 
 	struct wpa_supplicant *wpa_s = retrieveIfacePtr();
 	wpa_supplicant_disable_network(wpa_s, wpa_ssid);
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::Select()
+android::hidl::Status Network::Select()
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
 	RETURN_IF_NETWORK_INVALID(wpa_ssid);
 
 	if (wpa_ssid->disabled == 2) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC,
 		    "Cannot use Select with persistent P2P group");
 	}
@@ -721,10 +721,10 @@
 	wpa_s->scan_min_time.sec = 0;
 	wpa_s->scan_min_time.usec = 0;
 	wpa_supplicant_select_network(wpa_s, wpa_ssid);
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Network::SendNetworkResponse(
+android::hidl::Status Network::SendNetworkResponse(
     int type, const std::string &param)
 {
 	struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
@@ -734,8 +734,8 @@
 		const std::string error_msg =
 		    "Invalid network response type: " + std::to_string(type) +
 		    ".";
-		return android::binder::Status::fromExceptionCode(
-		    android::binder::Status::EX_ILLEGAL_ARGUMENT,
+		return android::hidl::Status::fromExceptionCode(
+		    android::hidl::Status::EX_ILLEGAL_ARGUMENT,
 		    error_msg.c_str());
 	}
 
@@ -746,14 +746,14 @@
 		const std::string error_msg =
 		    "Failed handling network response: " +
 		    std::to_string(type) + ".";
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC, error_msg.c_str());
 	}
 	eapol_sm_notify_ctrl_response(wpa_s->eapol);
 	wpa_hexdump_ascii(
 	    MSG_DEBUG, "network response param", (const u8 *)param.c_str(),
 	    param.size());
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
 /**
@@ -822,7 +822,7 @@
  * instance for this network.
  * This function frees any existing data in these fields.
  */
-android::binder::Status Network::setStringFieldAndResetState(
+android::hidl::Status Network::setStringFieldAndResetState(
     const char *value, uint8_t **to_update_field, const char *hexdump_prefix)
 {
 	return setStringFieldAndResetState(
@@ -834,7 +834,7 @@
  * instance for this network.
  * This function frees any existing data in these fields.
  */
-android::binder::Status Network::setStringFieldAndResetState(
+android::hidl::Status Network::setStringFieldAndResetState(
     const char *value, char **to_update_field, const char *hexdump_prefix)
 {
 	int value_len = strlen(value);
@@ -843,13 +843,13 @@
 	}
 	*to_update_field = dup_binstr(value, value_len);
 	if (!(*to_update_field)) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC, "Memory allocation failed.");
 	}
 	wpa_hexdump_ascii(
 	    MSG_MSGDUMP, hexdump_prefix, *to_update_field, value_len);
 	resetInternalStateAfterParamsUpdate();
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
 /**
@@ -857,7 +857,7 @@
  * instance for this network.
  * This function frees any existing data in these fields.
  */
-android::binder::Status Network::setStringKeyFieldAndResetState(
+android::hidl::Status Network::setStringKeyFieldAndResetState(
     const char *value, char **to_update_field, const char *hexdump_prefix)
 {
 	int value_len = strlen(value);
@@ -866,13 +866,13 @@
 	}
 	*to_update_field = dup_binstr(value, value_len);
 	if (!(*to_update_field)) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC, "Memory allocation failed.");
 	}
 	wpa_hexdump_ascii_key(
 	    MSG_MSGDUMP, hexdump_prefix, *to_update_field, value_len);
 	resetInternalStateAfterParamsUpdate();
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
 /**
@@ -880,7 +880,7 @@
  * field in |wpa_ssid| structue instance for this network.
  * This function frees any existing data in these fields.
  */
-android::binder::Status Network::setByteArrayFieldAndResetState(
+android::hidl::Status Network::setByteArrayFieldAndResetState(
     const uint8_t *value, const size_t value_len, uint8_t **to_update_field,
     size_t *to_update_field_len, const char *hexdump_prefix)
 {
@@ -889,7 +889,7 @@
 	}
 	*to_update_field = (uint8_t *)os_malloc(value_len);
 	if (!(*to_update_field)) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC, "Memory allocation failed.");
 	}
 	os_memcpy(*to_update_field, value, value_len);
@@ -899,7 +899,7 @@
 	    MSG_MSGDUMP, hexdump_prefix, *to_update_field,
 	    *to_update_field_len);
 	resetInternalStateAfterParamsUpdate();
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
 /**
@@ -907,7 +907,7 @@
  * length field in |wpa_ssid| structue instance for this network.
  * This function frees any existing data in these fields.
  */
-android::binder::Status Network::setByteArrayKeyFieldAndResetState(
+android::hidl::Status Network::setByteArrayKeyFieldAndResetState(
     const uint8_t *value, const size_t value_len, uint8_t **to_update_field,
     size_t *to_update_field_len, const char *hexdump_prefix)
 {
@@ -916,7 +916,7 @@
 	}
 	*to_update_field = (uint8_t *)os_malloc(value_len);
 	if (!(*to_update_field)) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC, "Memory allocation failed.");
 	}
 	os_memcpy(*to_update_field, value, value_len);
@@ -926,7 +926,7 @@
 	    MSG_MSGDUMP, hexdump_prefix, *to_update_field,
 	    *to_update_field_len);
 	resetInternalStateAfterParamsUpdate();
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-}  // namespace wpa_supplicant_binder
+}  // namespace wpa_supplicant_hidl
diff --git a/wpa_supplicant/hidl/network.h b/wpa_supplicant/hidl/network.h
new file mode 100644
index 0000000..331e85a
--- /dev/null
+++ b/wpa_supplicant/hidl/network.h
@@ -0,0 +1,147 @@
+/*
+ * hidl interface for wpa_supplicant daemon
+ * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+#ifndef WPA_SUPPLICANT_HIDL_NETWORK_H
+#define WPA_SUPPLICANT_HIDL_NETWORK_H
+
+#include <android-base/macros.h>
+
+#include "fi/w1/wpa_supplicant/BnNetwork.h"
+
+extern "C" {
+#include "utils/common.h"
+#include "utils/includes.h"
+#include "config.h"
+#include "wpa_supplicant_i.h"
+#include "notify.h"
+#include "eapol_supp/eapol_supp_sm.h"
+#include "eap_peer/eap.h"
+#include "rsn_supp/wpa.h"
+}
+
+namespace wpa_supplicant_hidl {
+
+/**
+ * Implementation of Network hidl object. Each unique hidl
+ * object is used for control operations on a specific network
+ * controlled by wpa_supplicant.
+ */
+class Network : public fi::w1::wpa_supplicant::BnNetwork
+{
+public:
+	Network(
+	    struct wpa_global *wpa_global, const char ifname[], int network_id);
+	~Network() override = default;
+
+	// Hidl methods exposed in aidl.
+	android::hidl::Status GetId(int *network_id_out) override;
+	android::hidl::Status GetInterfaceName(
+	    std::string *ifname_out) override;
+	android::hidl::Status RegisterCallback(
+	    const android::sp<fi::w1::wpa_supplicant::INetworkCallback>
+		&callback) override;
+	android::hidl::Status SetSSID(
+	    const std::vector<uint8_t> &ssid) override;
+	android::hidl::Status SetBSSID(
+	    const std::vector<uint8_t> &bssid) override;
+	android::hidl::Status SetScanSSID(bool enable) override;
+	android::hidl::Status SetKeyMgmt(int32_t key_mgmt_mask) override;
+	android::hidl::Status SetProto(int32_t proto_mask) override;
+	android::hidl::Status SetAuthAlg(int32_t auth_alg_mask) override;
+	android::hidl::Status SetGroupCipher(
+	    int32_t group_cipher_mask) override;
+	android::hidl::Status SetPairwiseCipher(
+	    int32_t pairwise_cipher_mask) override;
+	android::hidl::Status SetPskPassphrase(
+	    const std::string &psk) override;
+	android::hidl::Status SetWepKey(
+	    int key_idx, const std::vector<uint8_t> &wep_key) override;
+	android::hidl::Status SetWepTxKeyIdx(int32_t wep_tx_key_idx) override;
+	android::hidl::Status SetRequirePMF(bool enable) override;
+	android::hidl::Status SetEapMethod(int32_t method) override;
+	android::hidl::Status SetEapPhase2Method(int32_t method) override;
+	android::hidl::Status SetEapIdentity(
+	    const std::vector<uint8_t> &identity) override;
+	android::hidl::Status SetEapAnonymousIdentity(
+	    const std::vector<uint8_t> &identity) override;
+	android::hidl::Status SetEapPassword(
+	    const std::vector<uint8_t> &password) override;
+	android::hidl::Status SetEapCACert(const std::string &path) override;
+	android::hidl::Status SetEapCAPath(const std::string &path) override;
+	android::hidl::Status SetEapClientCert(
+	    const std::string &path) override;
+	android::hidl::Status SetEapPrivateKey(
+	    const std::string &path) override;
+	android::hidl::Status SetEapSubjectMatch(
+	    const std::string &match) override;
+	android::hidl::Status SetEapAltSubjectMatch(
+	    const std::string &match) override;
+	android::hidl::Status SetEapEngine(bool enable) override;
+	android::hidl::Status SetEapEngineID(const std::string &id) override;
+	android::hidl::Status SetEapDomainSuffixMatch(
+	    const std::string &match) override;
+	android::hidl::Status GetSSID(std::vector<uint8_t> *ssid) override;
+	android::hidl::Status GetBSSID(std::vector<uint8_t> *bssid) override;
+	android::hidl::Status GetScanSSID(bool *enable) override;
+	android::hidl::Status GetKeyMgmt(int32_t *key_mgmt_mask) override;
+	android::hidl::Status GetProto(int32_t *proto_mask) override;
+	android::hidl::Status GetAuthAlg(int32_t *auth_alg_mask) override;
+	android::hidl::Status GetGroupCipher(
+	    int32_t *group_cipher_mask) override;
+	android::hidl::Status GetPairwiseCipher(
+	    int32_t *pairwise_cipher_mask) override;
+	android::hidl::Status GetPskPassphrase(std::string *psk) override;
+	android::hidl::Status GetWepKey(
+	    int key_idx, std::vector<uint8_t> *wep_key) override;
+	android::hidl::Status GetWepTxKeyIdx(
+	    int32_t *wep_tx_key_idx) override;
+	android::hidl::Status GetRequirePMF(bool *enable) override;
+	android::hidl::Status Enable(bool no_connect) override;
+	android::hidl::Status Disable() override;
+	android::hidl::Status Select() override;
+	android::hidl::Status SendNetworkResponse(
+	    int type, const std::string &param) override;
+
+private:
+	struct wpa_ssid *retrieveNetworkPtr();
+	struct wpa_supplicant *retrieveIfacePtr();
+	int isPskPassphraseValid(const std::string &psk);
+	void resetInternalStateAfterParamsUpdate();
+	android::hidl::Status setStringFieldAndResetState(
+	    const char *value, uint8_t **to_update_field,
+	    const char *hexdump_prefix);
+	android::hidl::Status setStringFieldAndResetState(
+	    const char *value, char **to_update_field,
+	    const char *hexdump_prefix);
+	android::hidl::Status setStringKeyFieldAndResetState(
+	    const char *value, char **to_update_field,
+	    const char *hexdump_prefix);
+	android::hidl::Status setByteArrayFieldAndResetState(
+	    const uint8_t *value, const size_t value_len,
+	    uint8_t **to_update_field, size_t *to_update_field_len,
+	    const char *hexdump_prefix);
+	android::hidl::Status setByteArrayKeyFieldAndResetState(
+	    const uint8_t *value, const size_t value_len,
+	    uint8_t **to_update_field, size_t *to_update_field_len,
+	    const char *hexdump_prefix);
+
+	// Reference to the global wpa_struct. This is assumed to be valid for
+	// the lifetime of the process.
+	const struct wpa_global *wpa_global_;
+	// Name of the iface this network belongs to.
+	const std::string ifname_;
+	// Id of the network this hidl object controls.
+	const int network_id_;
+
+	DISALLOW_COPY_AND_ASSIGN(Network);
+};
+
+}  // namespace wpa_supplicant_hidl
+
+#endif  // WPA_SUPPLICANT_HIDL_NETWORK_H
diff --git a/wpa_supplicant/binder/supplicant.cpp b/wpa_supplicant/hidl/supplicant.cpp
similarity index 62%
rename from wpa_supplicant/binder/supplicant.cpp
rename to wpa_supplicant/hidl/supplicant.cpp
index c35e91f..3ff514e 100644
--- a/wpa_supplicant/binder/supplicant.cpp
+++ b/wpa_supplicant/hidl/supplicant.cpp
@@ -1,5 +1,5 @@
 /*
- * binder interface for wpa_supplicant daemon
+ * hidl interface for wpa_supplicant daemon
  * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
  * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
  *
@@ -7,20 +7,21 @@
  * See README for more details.
  */
 
-#include "binder_manager.h"
 #include "supplicant.h"
+#include "hidl_manager.h"
+#include "../src/utils/wpa_debug.h"
 
-namespace wpa_supplicant_binder {
+namespace wpa_supplicant_hidl {
 
 Supplicant::Supplicant(struct wpa_global *global) : wpa_global_(global) {}
-android::binder::Status Supplicant::CreateInterface(
+android::hidl::Status Supplicant::CreateInterface(
     const fi::w1::wpa_supplicant::ParcelableIfaceParams &params,
     android::sp<fi::w1::wpa_supplicant::IIface> *iface_object_out)
 {
 	/* Check if required Ifname argument is missing */
 	if (params.ifname_.isEmpty()) {
-		return android::binder::Status::fromExceptionCode(
-		    android::binder::Status::EX_ILLEGAL_ARGUMENT,
+		return android::hidl::Status::fromExceptionCode(
+		    android::hidl::Status::EX_ILLEGAL_ARGUMENT,
 		    "Ifname missing in params.");
 	}
 	/*
@@ -29,12 +30,12 @@
 	 */
 	if (wpa_supplicant_get_iface(wpa_global_, params.ifname_.string()) !=
 	    NULL) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_IFACE_EXISTS,
 		    "wpa_supplicant already controls this interface.");
 	}
 
-	android::binder::Status status;
+	android::hidl::Status status;
 	struct wpa_supplicant *wpa_s = NULL;
 	struct wpa_interface iface;
 
@@ -45,24 +46,24 @@
 	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
-	 * BinderManager when |wpa_supplicant_add_iface| is called. */
+	/* The supplicant core creates a corresponding hidl object via
+	 * HidlManager when |wpa_supplicant_add_iface| is called. */
 	if (!wpa_s) {
-		status = android::binder::Status::fromServiceSpecificError(
+		status = android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC,
 		    "wpa_supplicant couldn't grab this interface.");
 	} else {
-		BinderManager *binder_manager = BinderManager::getInstance();
+		HidlManager *hidl_manager = HidlManager::getInstance();
 
-		if (!binder_manager ||
-		    binder_manager->getIfaceBinderObjectByIfname(
+		if (!hidl_manager ||
+		    hidl_manager->getIfaceHidlObjectByIfname(
 			wpa_s->ifname, iface_object_out)) {
 			status =
-			    android::binder::Status::fromServiceSpecificError(
+			    android::hidl::Status::fromServiceSpecificError(
 				ERROR_GENERIC,
-				"wpa_supplicant encountered a binder error.");
+				"wpa_supplicant encountered a hidl error.");
 		} else {
-			status = android::binder::Status::ok();
+			status = android::hidl::Status::ok();
 		}
 	}
 	os_free((void *)iface.driver);
@@ -72,25 +73,25 @@
 	return status;
 }
 
-android::binder::Status Supplicant::RemoveInterface(const std::string &ifname)
+android::hidl::Status Supplicant::RemoveInterface(const std::string &ifname)
 {
 	struct wpa_supplicant *wpa_s;
 
 	wpa_s = wpa_supplicant_get_iface(wpa_global_, ifname.c_str());
 	if (!wpa_s) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_IFACE_UNKNOWN,
 		    "wpa_supplicant does not control this interface.");
 	}
 	if (wpa_supplicant_remove_iface(wpa_global_, wpa_s, 0)) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC,
 		    "wpa_supplicant couldn't remove this interface.");
 	}
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Supplicant::GetInterface(
+android::hidl::Status Supplicant::GetInterface(
     const std::string &ifname,
     android::sp<fi::w1::wpa_supplicant::IIface> *iface_object_out)
 {
@@ -98,45 +99,51 @@
 
 	wpa_s = wpa_supplicant_get_iface(wpa_global_, ifname.c_str());
 	if (!wpa_s) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_IFACE_UNKNOWN,
 		    "wpa_supplicant does not control this interface.");
 	}
 
-	BinderManager *binder_manager = BinderManager::getInstance();
-	if (!binder_manager ||
-	    binder_manager->getIfaceBinderObjectByIfname(
+	HidlManager *hidl_manager = HidlManager::getInstance();
+	if (!hidl_manager ||
+	    hidl_manager->getIfaceHidlObjectByIfname(
 		wpa_s->ifname, iface_object_out)) {
-		return android::binder::Status::fromServiceSpecificError(
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC,
-		    "wpa_supplicant encountered a binder error.");
+		    "wpa_supplicant encountered a hidl error.");
 	}
 
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Supplicant::SetDebugParams(
+android::hidl::Status Supplicant::SetDebugParams(
     int level, bool show_timestamp, bool show_keys)
 {
 	int internal_level;
 	if (convertDebugLevelToInternalLevel(level, &internal_level)) {
 		const std::string error_msg =
 		    "invalid debug level: " + std::to_string(level);
-		return android::binder::Status::fromExceptionCode(
-		    android::binder::Status::EX_ILLEGAL_ARGUMENT,
+		return android::hidl::Status::fromExceptionCode(
+		    android::hidl::Status::EX_ILLEGAL_ARGUMENT,
 		    error_msg.c_str());
 	}
 	if (wpa_supplicant_set_debug_params(
+<<<<<<< 390ba2881ef621db480848b7e50b93d61542206a:wpa_supplicant/binder/supplicant.cpp
 		wpa_global_, internal_level, show_timestamp, show_keys)) {
 		return android::binder::Status::fromServiceSpecificError(
+=======
+		wpa_global_, level, show_timestamp, show_keys)) {
+		return android::hidl::Status::fromServiceSpecificError(
+>>>>>>> wpa_supplicant: HIDL implementation (1/2):wpa_supplicant/hidl/supplicant.cpp
 		    ERROR_GENERIC,
 		    "wpa_supplicant could not set debug params.");
 	}
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Supplicant::GetDebugLevel(int *level_out)
+android::hidl::Status Supplicant::GetDebugLevel(int *level_out)
 {
+<<<<<<< 390ba2881ef621db480848b7e50b93d61542206a:wpa_supplicant/binder/supplicant.cpp
 	if (convertDebugLevelToExternalLevel(wpa_debug_level, level_out)) {
 		const std::string error_msg =
 		    "invalid debug level: " + std::to_string(wpa_debug_level);
@@ -145,33 +152,38 @@
 		    error_msg.c_str());
 	}
 	return android::binder::Status::ok();
+=======
+	*level_out = wpa_debug_level;
+	return android::hidl::Status::ok();
+>>>>>>> wpa_supplicant: HIDL implementation (1/2):wpa_supplicant/hidl/supplicant.cpp
 }
 
-android::binder::Status Supplicant::GetDebugShowTimestamp(
+android::hidl::Status Supplicant::GetDebugShowTimestamp(
     bool *show_timestamp_out)
 {
 	*show_timestamp_out = wpa_debug_timestamp ? true : false;
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Supplicant::GetDebugShowKeys(bool *show_keys_out)
+android::hidl::Status Supplicant::GetDebugShowKeys(bool *show_keys_out)
 {
 	*show_keys_out = wpa_debug_show_keys ? true : false;
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
 
-android::binder::Status Supplicant::RegisterCallback(
+android::hidl::Status Supplicant::RegisterCallback(
     const android::sp<fi::w1::wpa_supplicant::ISupplicantCallback> &callback)
 {
-	BinderManager *binder_manager = BinderManager::getInstance();
-	if (!binder_manager ||
-	    binder_manager->addSupplicantCallbackBinderObject(callback)) {
-		return android::binder::Status::fromServiceSpecificError(
+	HidlManager *hidl_manager = HidlManager::getInstance();
+	if (!hidl_manager ||
+	    hidl_manager->addSupplicantCallbackHidlObject(callback)) {
+		return android::hidl::Status::fromServiceSpecificError(
 		    ERROR_GENERIC,
-		    "wpa_supplicant encountered a binder error.");
+		    "wpa_supplicant encountered a hidl error.");
 	}
-	return android::binder::Status::ok();
+	return android::hidl::Status::ok();
 }
+<<<<<<< 390ba2881ef621db480848b7e50b93d61542206a:wpa_supplicant/binder/supplicant.cpp
 
 /**
  * Helper function to convert the debug level parameter from the binder
@@ -241,3 +253,6 @@
 	}
 }
 } /* namespace wpa_supplicant_binder */
+=======
+} /* namespace wpa_supplicant_hidl */
+>>>>>>> wpa_supplicant: HIDL implementation (1/2):wpa_supplicant/hidl/supplicant.cpp
diff --git a/wpa_supplicant/binder/supplicant.h b/wpa_supplicant/hidl/supplicant.h
similarity index 69%
rename from wpa_supplicant/binder/supplicant.h
rename to wpa_supplicant/hidl/supplicant.h
index 2eef988..9805289 100644
--- a/wpa_supplicant/binder/supplicant.h
+++ b/wpa_supplicant/hidl/supplicant.h
@@ -1,5 +1,5 @@
 /*
- * binder interface for wpa_supplicant daemon
+ * hidl interface for wpa_supplicant daemon
  * Copyright (c) 2004-2016, Jouni Malinen <j@w1.fi>
  * Copyright (c) 2004-2016, Roshan Pius <rpius@google.com>
  *
@@ -7,8 +7,8 @@
  * See README for more details.
  */
 
-#ifndef WPA_SUPPLICANT_BINDER_SUPPLICANT_H
-#define WPA_SUPPLICANT_BINDER_SUPPLICANT_H
+#ifndef WPA_SUPPLICANT_HIDL_SUPPLICANT_H
+#define WPA_SUPPLICANT_HIDL_SUPPLICANT_H
 
 #include <android-base/macros.h>
 
@@ -22,10 +22,10 @@
 #include "../wpa_supplicant_i.h"
 }
 
-namespace wpa_supplicant_binder {
+namespace wpa_supplicant_hidl {
 
 /**
- * Implementation of the supplicant binder object. This binder
+ * Implementation of the supplicant hidl object. This hidl
  * object is used core for global control operations on
  * wpa_supplicant.
  */
@@ -35,24 +35,24 @@
 	Supplicant(struct wpa_global *global);
 	~Supplicant() override = default;
 
-	// Binder methods exposed in aidl.
-	android::binder::Status CreateInterface(
+	// Hidl methods exposed in aidl.
+	android::hidl::Status CreateInterface(
 	    const fi::w1::wpa_supplicant::ParcelableIfaceParams &params,
 	    android::sp<fi::w1::wpa_supplicant::IIface> *iface_object_out)
 	    override;
-	android::binder::Status RemoveInterface(
+	android::hidl::Status RemoveInterface(
 	    const std::string &ifname) override;
-	android::binder::Status GetInterface(
+	android::hidl::Status GetInterface(
 	    const std::string &ifname,
 	    android::sp<fi::w1::wpa_supplicant::IIface> *iface_object_out)
 	    override;
-	android::binder::Status SetDebugParams(
+	android::hidl::Status SetDebugParams(
 	    int level, bool show_timestamp, bool show_keys) override;
-	android::binder::Status GetDebugLevel(int *level_out) override;
-	android::binder::Status GetDebugShowTimestamp(
+	android::hidl::Status GetDebugLevel(int *level_out) override;
+	android::hidl::Status GetDebugShowTimestamp(
 	    bool *show_timestamp_out) override;
-	android::binder::Status GetDebugShowKeys(bool *show_keys_out) override;
-	android::binder::Status RegisterCallback(
+	android::hidl::Status GetDebugShowKeys(bool *show_keys_out) override;
+	android::hidl::Status RegisterCallback(
 	    const android::sp<fi::w1::wpa_supplicant::ISupplicantCallback>
 		&callback) override;
 
@@ -71,6 +71,6 @@
 	DISALLOW_COPY_AND_ASSIGN(Supplicant);
 };
 
-} /* namespace wpa_supplicant_binder */
+} /* namespace wpa_supplicant_hidl */
 
-#endif /* WPA_SUPPLICANT_BINDER_SUPPLICANT_H */
+#endif /* WPA_SUPPLICANT_HIDL_SUPPLICANT_H */
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index 393d7d6..c76b82d 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -13,7 +13,7 @@
 #include "config.h"
 #include "wpa_supplicant_i.h"
 #include "wps_supplicant.h"
-#include "binder/binder.h"
+#include "hidl/hidl.h"
 #include "dbus/dbus_common.h"
 #include "dbus/dbus_old.h"
 #include "dbus/dbus_new.h"
@@ -35,11 +35,11 @@
 	}
 #endif /* CONFIG_DBUS */
 
-#ifdef CONFIG_BINDER
-	global->binder = wpas_binder_init(global);
-	if (!global->binder)
+#ifdef CONFIG_HIDL
+	global->hidl = wpas_hidl_init(global);
+	if (!global->hidl)
 		return -1;
-#endif /* CONFIG_BINDER */
+#endif /* CONFIG_HIDL */
 
 	return 0;
 }
@@ -52,10 +52,10 @@
 		wpas_dbus_deinit(global->dbus);
 #endif /* CONFIG_DBUS */
 
-#ifdef CONFIG_BINDER
-	if (global->binder)
-		wpas_binder_deinit(global->binder);
-#endif /* CONFIG_BINDER */
+#ifdef CONFIG_HIDL
+	if (global->hidl)
+		wpas_hidl_deinit(global->hidl);
+#endif /* CONFIG_HIDL */
 }
 
 
@@ -70,7 +70,7 @@
 	if (wpas_dbus_register_interface(wpa_s))
 		return -1;
 
-	if (wpas_binder_register_interface(wpa_s))
+	if (wpas_hidl_register_interface(wpa_s))
 		return -1;
 
 	return 0;
@@ -88,7 +88,7 @@
 	/* unregister interface in new DBus ctrl iface */
 	wpas_dbus_unregister_interface(wpa_s);
 
-	wpas_binder_unregister_interface(wpa_s);
+	wpas_hidl_unregister_interface(wpa_s);
 }
 
 
@@ -134,7 +134,7 @@
 				  wpa_s->current_ssid->ssid_len) : "");
 #endif /* ANDROID */
 
-	wpas_binder_notify_state_changed(wpa_s);
+	wpas_hidl_notify_state_changed(wpa_s);
 }
 
 
@@ -222,7 +222,7 @@
 
 	wpas_dbus_signal_network_request(wpa_s, ssid, rtype, default_txt);
 
-	wpas_binder_notify_network_request(wpa_s, ssid, rtype, default_txt);
+	wpas_hidl_notify_network_request(wpa_s, ssid, rtype, default_txt);
 }
 
 
@@ -334,7 +334,7 @@
 	 */
 	if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s) {
 		wpas_dbus_register_network(wpa_s, ssid);
-		wpas_binder_register_network(wpa_s, ssid);
+		wpas_hidl_register_network(wpa_s, ssid);
 	}
 }
 
@@ -367,7 +367,7 @@
 	if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s &&
 	    !wpa_s->p2p_mgmt) {
 		wpas_dbus_unregister_network(wpa_s, ssid->id);
-		wpas_binder_unregister_network(wpa_s, ssid);
+		wpas_hidl_unregister_network(wpa_s, ssid);
 	}
 	if (network_is_persistent_group(ssid))
 		wpas_notify_persistent_group_removed(wpa_s, ssid);
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index ce54bf2..c801ccf 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -5902,7 +5902,7 @@
 }
 
 
-#if defined(CONFIG_CTRL_IFACE) || defined(CONFIG_CTRL_IFACE_DBUS_NEW) || defined (CONFIG_CTRL_IFACE_BINDER)
+#if defined(CONFIG_CTRL_IFACE) || defined(CONFIG_CTRL_IFACE_DBUS_NEW) || defined (CONFIG_CTRL_IFACE_HIDL)
 int wpa_supplicant_ctrl_iface_ctrl_rsp_handle(struct wpa_supplicant *wpa_s,
 					      struct wpa_ssid *ssid,
 					      const char *field,
@@ -6012,7 +6012,7 @@
 	return -1;
 #endif /* IEEE8021X_EAPOL */
 }
-#endif /* CONFIG_CTRL_IFACE || CONFIG_CTRL_IFACE_DBUS_NEW || CONFIG_CTRL_IFACE_BINDER */
+#endif /* CONFIG_CTRL_IFACE || CONFIG_CTRL_IFACE_DBUS_NEW || CONFIG_CTRL_IFACE_HIDL */
 
 
 int wpas_network_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 8437d1d..4f5d41b 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -44,7 +44,7 @@
 struct ctrl_iface_priv;
 struct ctrl_iface_global_priv;
 struct wpas_dbus_priv;
-struct wpas_binder_priv;
+struct wpas_hidl_priv;
 
 /**
  * struct wpa_interface - Parameters for wpa_supplicant_add_iface()
@@ -265,7 +265,7 @@
 	struct wpa_params params;
 	struct ctrl_iface_global_priv *ctrl_iface;
 	struct wpas_dbus_priv *dbus;
-	struct wpas_binder_priv *binder;
+	struct wpas_hidl_priv *hidl;
 	void **drv_priv;
 	size_t drv_count;
 	struct os_time suspend_time;
@@ -479,9 +479,9 @@
 	char *preq_notify_peer;
 #endif /* CONFIG_AP */
 #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
-#ifdef CONFIG_CTRL_IFACE_BINDER
-	const void *binder_object_key;
-#endif /* CONFIG_CTRL_IFACE_BINDER */
+#ifdef CONFIG_CTRL_IFACE_HIDL
+	const void *hidl_object_key;
+#endif /* CONFIG_CTRL_IFACE_HIDL */
 	char bridge_ifname[16];
 
 	char *confname;