From: Jihoon Kim Date: Thu, 14 Mar 2019 00:56:29 +0000 (+0900) Subject: API to send autofill error X-Git-Tag: submit/tizen/20190314.013833~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F13%2F201413%2F1;p=platform%2Fcore%2Fuifw%2Fautofill-daemon.git API to send autofill error Change-Id: Id7ed03b3465761660a328ee56136ff76e8681ac5 Signed-off-by: Jihoon Kim --- diff --git a/src/autofill-daemon.c b/src/autofill-daemon.c index 804cad4..7466701 100644 --- a/src/autofill-daemon.c +++ b/src/autofill-daemon.c @@ -31,6 +31,7 @@ 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(); @@ -40,6 +41,7 @@ typedef struct { 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; @@ -72,7 +74,8 @@ get_autofill_client(const char *app_id, int context_id) 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; @@ -110,6 +113,14 @@ static autofill_client_s *__create_client(const char *app_id, int context_id, 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; } @@ -131,6 +142,11 @@ static void __destroy_client(gpointer data) 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; @@ -184,7 +200,12 @@ static void __message_terminate(rpc_port_stub_AutofillAppPort_context_h context, __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; @@ -196,7 +217,7 @@ static int __message_register(rpc_port_stub_AutofillAppPort_context_h context, i 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) @@ -585,6 +606,36 @@ static void __auth_info_recv_cb(void *user_data, int context_id, rpc_port_autofi 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"); @@ -597,10 +648,15 @@ static void __on_connected(rpc_port_proxy_AutofillSvcPort_h h, void *user_data) 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"); } @@ -621,6 +677,11 @@ static void __on_disconnected(rpc_port_proxy_AutofillSvcPort_h h, void *user_dat 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) diff --git a/tidl/autofill.tidl b/tidl/autofill.tidl index 6f4ccac..c44c301 100644 --- a/tidl/autofill.tidl +++ b/tidl/autofill.tidl @@ -51,10 +51,17 @@ struct autofill_fill_response { list response_groups; } +struct autofill_error_info { + string app_id; + int error_code; + string error_message; +} + interface AutofillAppPort { void autofill_auth_info_received_cb(autofill_auth_info auth_info) delegate; void autofill_fill_response_received_cb(autofill_fill_response response) delegate; - int Register(int context_id, autofill_auth_info_received_cb auth_info_cb, autofill_fill_response_received_cb fill_response_cb); + void autofill_error_info_received_cb(autofill_error_info error_info) delegate; + int Register(int context_id, autofill_auth_info_received_cb auth_info_cb, autofill_fill_response_received_cb fill_response_cb, autofill_error_info_received_cb error_info_cb); void Unregister(int context_id) async; int request_auth_info(int context_id, autofill_view_info vi); diff --git a/tidl/autofill_service.tidl b/tidl/autofill_service.tidl index 311a411..bd89003 100644 --- a/tidl/autofill_service.tidl +++ b/tidl/autofill_service.tidl @@ -53,10 +53,17 @@ struct autofill_svc_fill_response { list response_groups; } +struct autofill_svc_error_info { + string app_id; + int error_code; + string error_message; +} + interface AutofillSvcPort { void autofill_svc_auth_info_cb(int context_id, autofill_svc_auth_info auth_info) delegate; void autofill_svc_fill_response_cb(int context_id, autofill_svc_fill_response response) delegate; - int Register(autofill_svc_auth_info_cb auth_info_cb, autofill_svc_fill_response_cb fill_response_cb); + void autofill_svc_send_error_cb(int context_id, autofill_svc_error_info error_info) delegate; + int Register(autofill_svc_auth_info_cb auth_info_cb, autofill_svc_fill_response_cb fill_response_cb, autofill_svc_send_error_cb send_error_cb); void Unregister() async; void request_auth_info(int context_id, autofill_svc_view_info vi) async;