agm: always allow client cb registration
Previously, when there's one client registered
client cb handle, then the comming regitration
can be rejected, even though the request may
come from a different client.
Change the logic to allow multiple registration
happen, but still with same cb object.
Change-Id: Ie91f98bebd6cf893e19b1c269683db5e8878baa5
diff --git a/ipc/HwBinders/agm_ipc_client/src/agm_client_wrapper.cpp b/ipc/HwBinders/agm_ipc_client/src/agm_client_wrapper.cpp
index f7b7df1..eececa5 100644
--- a/ipc/HwBinders/agm_ipc_client/src/agm_client_wrapper.cpp
+++ b/ipc/HwBinders/agm_ipc_client/src/agm_client_wrapper.cpp
@@ -88,7 +88,7 @@
static pthread_mutex_t agmclient_init_lock = PTHREAD_MUTEX_INITIALIZER;
static android::sp<IAGM> agm_client = NULL;
static sp<server_death_notifier> Server_death_notifier = NULL;
-static bool is_cb_registered = false;
+sp<IAGMCallback> ClbkBinder = NULL;
static list_declare(client_clbk_data_list);
static pthread_mutex_t clbk_data_list_lock = PTHREAD_MUTEX_INITIALIZER;
@@ -689,18 +689,15 @@
session_id, evt_type, client_data);
int32_t ret = 0;
if (!agm_server_died) {
- sp<IAGMCallback> ClbkBinder = NULL;
ClntClbk *cl_clbk_data = NULL;
uint64_t cl_clbk_data_add = 0;
android::sp<IAGM> agm_client = get_agm_server();
- if (!is_cb_registered) {
+ if (!ClbkBinder)
ClbkBinder = new AGMCallback();
- ret = agm_client->ipc_agm_client_register_callback(ClbkBinder);
- if (ret) {
- ALOGE("Client callback registration failed");
- return ret;
- }
- is_cb_registered = true;
+ ret = agm_client->ipc_agm_client_register_callback(ClbkBinder);
+ if (ret) {
+ ALOGE("Client callback registration failed");
+ return ret;
}
if (cb != NULL) {
cl_clbk_data = new ClntClbk(session_id, cb, evt_type, client_data);