binder: Callback registration for interfaces
Add callback registration for each binder interface type:
ISupplicant, IIface, INetwork.
BUG: 30093041
Change-Id: I9043d9a033bcfbee5a80f61cf58e564249edf3a7
diff --git a/wpa_supplicant/binder/supplicant.cpp b/wpa_supplicant/binder/supplicant.cpp
index 38b7e44..9588f40 100644
--- a/wpa_supplicant/binder/supplicant.cpp
+++ b/wpa_supplicant/binder/supplicant.cpp
@@ -7,8 +7,8 @@
* See README for more details.
*/
-#include "supplicant.h"
#include "binder_manager.h"
+#include "supplicant.h"
namespace wpa_supplicant_binder {
@@ -161,6 +161,19 @@
return android::binder::Status::ok();
}
+android::binder::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(
+ ERROR_GENERIC,
+ "wpa_supplicant encountered a binder error.");
+ }
+ return android::binder::Status::ok();
+}
+
/**
* Helper function to convert the debug level parameter from the binder
* interface values to internal values.