static rpc_port_proxy_AutofillSvcPort_h svc_rpc_h = NULL;
static rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h fill_response_received_cb_h = NULL;
static rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_h auth_info_cb_h = NULL;
+static rpc_port_AutofillSvcPort_autofill_svc_send_error_cb_h error_info_cb_h = NULL;
static int connect_service();
rpc_port_AutofillAppPort_autofill_auth_info_received_cb_h auth_info_cb;
rpc_port_AutofillAppPort_autofill_fill_response_received_cb_h fill_response_received_cb;
+ rpc_port_AutofillAppPort_autofill_error_info_received_cb_h error_info_cb;
} autofill_client_s;
static GList *__client_list = NULL;
static autofill_client_s *__create_client(const char *app_id, int context_id,
rpc_port_AutofillAppPort_autofill_auth_info_received_cb_h auth_info_cb,
- rpc_port_AutofillAppPort_autofill_fill_response_received_cb_h fill_response_received_cb)
+ rpc_port_AutofillAppPort_autofill_fill_response_received_cb_h fill_response_received_cb,
+ rpc_port_AutofillAppPort_autofill_error_info_received_cb_h error_info_cb)
{
LOGD("");
autofill_client_s *handle;
return NULL;
}
+ rpc_port_AutofillAppPort_autofill_error_info_received_cb_clone(error_info_cb, &handle->error_info_cb);
+ if (!handle->error_info_cb) {
+ LOGE("Out of memory");
+ free(handle->app_id);
+ free(handle);
+ return NULL;
+ }
+
return handle;
}
handle->fill_response_received_cb = NULL;
}
+ if (handle->error_info_cb) {
+ rpc_port_AutofillAppPort_autofill_error_info_received_cb_destroy(handle->error_info_cb);
+ handle->error_info_cb = NULL;
+ }
+
if (handle->app_id) {
free(handle->app_id);
handle->app_id = NULL;
__remove_client(context);
}
-static int __message_register(rpc_port_stub_AutofillAppPort_context_h context, int context_id, rpc_port_AutofillAppPort_autofill_auth_info_received_cb_h auth_info_cb, rpc_port_AutofillAppPort_autofill_fill_response_received_cb_h fill_response_received_cb, void *user_data)
+static int __message_register(rpc_port_stub_AutofillAppPort_context_h context,
+ int context_id,
+ rpc_port_AutofillAppPort_autofill_auth_info_received_cb_h auth_info_cb,
+ rpc_port_AutofillAppPort_autofill_fill_response_received_cb_h fill_response_received_cb,
+ rpc_port_AutofillAppPort_autofill_error_info_received_cb_h error_info_cb,
+ void *user_data)
{
LOGD("");
char *sender = NULL;
LOGD("sender(%s)", sender);
- client = __create_client(sender, context_id, auth_info_cb, fill_response_received_cb);
+ client = __create_client(sender, context_id, auth_info_cb, fill_response_received_cb, error_info_cb);
free(sender);
if (!client)
free(service_message);
}
+static void __error_info_recv_cb(void *user_data, int context_id, rpc_port_autofill_svc_error_info_h svc_error_info_h)
+{
+ char *app_id = NULL;
+ char *error_message = NULL;
+ int error_code = 0;
+
+ rpc_port_autofill_svc_error_info_get_app_id(svc_error_info_h, &app_id);
+ rpc_port_autofill_svc_error_info_get_error_code(svc_error_info_h, &error_code);
+ rpc_port_autofill_svc_error_info_get_error_message(svc_error_info_h, &error_message);
+
+ /* transfer error info */
+ rpc_port_autofill_error_info_h error_info_h = NULL;
+ rpc_port_autofill_error_info_create(&error_info_h);
+ rpc_port_autofill_error_info_set_app_id(error_info_h, app_id);
+ rpc_port_autofill_error_info_set_error_code(error_info_h, error_code);
+ rpc_port_autofill_error_info_set_error_message(error_info_h, error_message);
+
+ autofill_client_s *sender_client = get_autofill_client(app_id, context_id);
+ if (sender_client)
+ rpc_port_AutofillAppPort_autofill_error_info_received_cb_invoke(sender_client->error_info_cb, error_info_h);
+
+ LOGD("error code : %d, message : %s", error_code, error_message);
+
+ if (app_id)
+ free(app_id);
+
+ if (error_message)
+ free(error_message);
+}
+
static void __on_connected(rpc_port_proxy_AutofillSvcPort_h h, void *user_data)
{
LOGI("[__RPC_PORT__] connected");
free(auth_info_cb_h);
}
+ if (error_info_cb_h) {
+ free(error_info_cb_h);
+ }
+
fill_response_received_cb_h = rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_create(__fill_response_recv_cb, false, NULL);
auth_info_cb_h = rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_create(__auth_info_recv_cb, false, NULL);
+ error_info_cb_h = rpc_port_AutofillSvcPort_autofill_svc_send_error_cb_create(__error_info_recv_cb, false, NULL);
- int r = rpc_port_proxy_AutofillSvcPort_invoke_Register(h, auth_info_cb_h, fill_response_received_cb_h);
+ int r = rpc_port_proxy_AutofillSvcPort_invoke_Register(h, auth_info_cb_h, fill_response_received_cb_h, error_info_cb_h);
if (r != 0)
LOGD("Failed to invoke Register");
}
free(auth_info_cb_h);
auth_info_cb_h = NULL;
}
+
+ if (error_info_cb_h) {
+ free(error_info_cb_h);
+ error_info_cb_h = NULL;
+ }
}
static void __on_rejected(rpc_port_proxy_AutofillSvcPort_h h, void *user_data)