From d16ac0723cb9c949aacc33baa713d46533c87ac3 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 14 Mar 2019 09:56:29 +0900 Subject: [PATCH 01/16] API to send autofill error Change-Id: Id7ed03b3465761660a328ee56136ff76e8681ac5 Signed-off-by: Jihoon Kim --- src/autofill-daemon.c | 69 +++++++++++++++++++++++++++++++++++++++++++--- tidl/autofill.tidl | 9 +++++- tidl/autofill_service.tidl | 9 +++++- 3 files changed, 81 insertions(+), 6 deletions(-) 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; -- 2.7.4 From 8482ef0569981d4221a7271fb286a19eddcea449 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 14 Mar 2019 10:37:21 +0900 Subject: [PATCH 02/16] Update package version to 1.0.10 Change-Id: I4267d559a1ee3d2a0f314da71daa527de96bde95 Signed-off-by: Jihoon Kim --- org.tizen.autofilld.xml | 2 +- packaging/org.tizen.autofilld.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.autofilld.xml b/org.tizen.autofilld.xml index 4bad5f9..f5b8b20 100644 --- a/org.tizen.autofilld.xml +++ b/org.tizen.autofilld.xml @@ -1,5 +1,5 @@ - + Jihoon Kim autofilld diff --git a/packaging/org.tizen.autofilld.spec b/packaging/org.tizen.autofilld.spec index b7aa945..b7320b6 100644 --- a/packaging/org.tizen.autofilld.spec +++ b/packaging/org.tizen.autofilld.spec @@ -1,6 +1,6 @@ Name: org.tizen.autofilld Summary: Autofill Daemon -Version: 1.0.9 +Version: 1.0.10 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From 37863ced603ecd8273ad326937b7931b9a78fe06 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 14 Mar 2019 11:02:30 +0900 Subject: [PATCH 03/16] Change API version Change-Id: I657f3fab476e54e15cb4f8bef64ccd27acce7503 Signed-off-by: Jihoon Kim --- org.tizen.autofilld.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.tizen.autofilld.xml b/org.tizen.autofilld.xml index f5b8b20..451cef8 100644 --- a/org.tizen.autofilld.xml +++ b/org.tizen.autofilld.xml @@ -1,5 +1,5 @@ - + Jihoon Kim autofilld -- 2.7.4 From 1a447d2616943a169a79f56b42454b11507994f9 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 18 Mar 2019 10:25:58 +0900 Subject: [PATCH 04/16] Fix memory leak issue Dynamic memory referenced by 'handle->auth_info_cb' was allocated at autofill_stub.c:3925 by calling function 'rpc_port_AutofillAppPort_autofill_auth_info_received_cb_clone' at autofill-daemon.c:98 and lost at autofill-daemon.c:121. Change-Id: Ie3bbba42a1dab3688c3d409b6f3374a35335d9f7 Signed-off-by: Jihoon Kim --- src/autofill-daemon.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/autofill-daemon.c b/src/autofill-daemon.c index 7466701..34b78a5 100644 --- a/src/autofill-daemon.c +++ b/src/autofill-daemon.c @@ -117,6 +117,8 @@ static autofill_client_s *__create_client(const char *app_id, int context_id, if (!handle->error_info_cb) { LOGE("Out of memory"); free(handle->app_id); + rpc_port_AutofillAppPort_autofill_auth_info_received_cb_destroy(handle->auth_info_cb); + rpc_port_AutofillAppPort_autofill_fill_response_received_cb_destroy(handle->fill_response_received_cb); free(handle); return NULL; } -- 2.7.4 From f5be04e9b04887a298fd5fa079db3a5dc239f2da Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 18 Mar 2019 10:45:01 +0900 Subject: [PATCH 05/16] Update package version to 1.0.11 Change-Id: I85a7549427e1efa53658435b03edb581e5a0cd6e Signed-off-by: Jihoon Kim --- org.tizen.autofilld.xml | 2 +- packaging/org.tizen.autofilld.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.autofilld.xml b/org.tizen.autofilld.xml index 451cef8..a82cf85 100644 --- a/org.tizen.autofilld.xml +++ b/org.tizen.autofilld.xml @@ -1,5 +1,5 @@ - + Jihoon Kim autofilld diff --git a/packaging/org.tizen.autofilld.spec b/packaging/org.tizen.autofilld.spec index b7320b6..ce9db40 100644 --- a/packaging/org.tizen.autofilld.spec +++ b/packaging/org.tizen.autofilld.spec @@ -1,6 +1,6 @@ Name: org.tizen.autofilld Summary: Autofill Daemon -Version: 1.0.10 +Version: 1.0.11 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From cf071fb4e7acc451fe67c40258252f8adaef107f Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 19 Mar 2019 16:51:42 +0900 Subject: [PATCH 06/16] Remove code to support error message Change-Id: I0e90b481ae256b6fd052d39822b101d7b1f6ccd3 Signed-off-by: Jihoon Kim --- src/autofill-daemon.c | 8 +------- tidl/autofill.tidl | 1 - tidl/autofill_service.tidl | 1 - 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/autofill-daemon.c b/src/autofill-daemon.c index 34b78a5..e1f1047 100644 --- a/src/autofill-daemon.c +++ b/src/autofill-daemon.c @@ -611,31 +611,25 @@ static void __auth_info_recv_cb(void *user_data, int context_id, rpc_port_autofi 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); + LOGD("error code : %x", error_code); 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) diff --git a/tidl/autofill.tidl b/tidl/autofill.tidl index c44c301..fbf53b4 100644 --- a/tidl/autofill.tidl +++ b/tidl/autofill.tidl @@ -54,7 +54,6 @@ struct autofill_fill_response { struct autofill_error_info { string app_id; int error_code; - string error_message; } interface AutofillAppPort { diff --git a/tidl/autofill_service.tidl b/tidl/autofill_service.tidl index bd89003..31a4809 100644 --- a/tidl/autofill_service.tidl +++ b/tidl/autofill_service.tidl @@ -56,7 +56,6 @@ struct autofill_svc_fill_response { struct autofill_svc_error_info { string app_id; int error_code; - string error_message; } interface AutofillSvcPort { -- 2.7.4 From 136d8e737863944f262f2a99421ca73104976ace Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 19 Mar 2019 19:07:13 +0900 Subject: [PATCH 07/16] Update package version to 1.0.12 Change-Id: Ib63a59b3c625ee4fac47118f32c339300ea17dec Signed-off-by: Jihoon Kim --- org.tizen.autofilld.xml | 2 +- packaging/org.tizen.autofilld.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.autofilld.xml b/org.tizen.autofilld.xml index a82cf85..004d1d6 100644 --- a/org.tizen.autofilld.xml +++ b/org.tizen.autofilld.xml @@ -1,5 +1,5 @@ - + Jihoon Kim autofilld diff --git a/packaging/org.tizen.autofilld.spec b/packaging/org.tizen.autofilld.spec index ce9db40..8d009c6 100644 --- a/packaging/org.tizen.autofilld.spec +++ b/packaging/org.tizen.autofilld.spec @@ -1,6 +1,6 @@ Name: org.tizen.autofilld Summary: Autofill Daemon -Version: 1.0.11 +Version: 1.0.12 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From ffb7748d62ccce9006a995eb0f35d59e5039ed56 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 5 Apr 2019 20:10:46 +0900 Subject: [PATCH 08/16] Make no sleep as daemon Change-Id: Ie2191eb59d059270f65882e570837ba1cfba34da Signed-off-by: Jihoon Kim --- org.tizen.autofilld.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/org.tizen.autofilld.xml b/org.tizen.autofilld.xml index 004d1d6..9b12481 100644 --- a/org.tizen.autofilld.xml +++ b/org.tizen.autofilld.xml @@ -6,6 +6,7 @@ + http://tizen.org/privilege/appmanager.launch -- 2.7.4 From 2a8c0acd3064b280f2299361d17d7d50e2074818 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 5 Apr 2019 20:14:17 +0900 Subject: [PATCH 09/16] Change the method to show error code Change-Id: Iafd993fc231974afd350222d888067a4ce4bdacb Signed-off-by: Jihoon Kim --- src/autofill-daemon.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/autofill-daemon.c b/src/autofill-daemon.c index e1f1047..9abe0e5 100644 --- a/src/autofill-daemon.c +++ b/src/autofill-daemon.c @@ -626,7 +626,7 @@ static void __error_info_recv_cb(void *user_data, int context_id, rpc_port_autof if (sender_client) rpc_port_AutofillAppPort_autofill_error_info_received_cb_invoke(sender_client->error_info_cb, error_info_h); - LOGD("error code : %x", error_code); + LOGD("error code : %#x, message : '%s'", error_code, get_error_message(error_code)); if (app_id) free(app_id); @@ -634,7 +634,7 @@ static void __error_info_recv_cb(void *user_data, int context_id, rpc_port_autof static void __on_connected(rpc_port_proxy_AutofillSvcPort_h h, void *user_data) { - LOGI("[__RPC_PORT__] connected"); + LOGI("Autofill service connected"); if (fill_response_received_cb_h) { free(fill_response_received_cb_h); @@ -699,7 +699,7 @@ static bool __manager_set_autofill_service_cb(rpc_port_stub_AutofillManagerPort_ rpc_port_proxy_AutofillSvcPort_invoke_request_terminate(svc_rpc_h); int ret = rpc_port_proxy_AutofillSvcPort_destroy(svc_rpc_h); - LOGD("ret : %d", ret); + LOGD("ret : %#x", ret); } svc_rpc_h = NULL; @@ -731,7 +731,7 @@ bool add_autofill_service_cb(app_info_h app_info, void *user_data) int ret = app_info_get_app_id(app_info, &app_id); if (ret != APP_MANAGER_ERROR_NONE) { - LOGW("app_info_get_app_id failed (%d)", ret); + LOGW("app_info_get_app_id failed (%#x)", ret); return true; } @@ -754,14 +754,14 @@ static bool __manager_get_autofill_service_list_cb(rpc_port_stub_AutofillManager // Get the Autofill service list ret = app_info_metadata_filter_create(&handle); if (ret != APP_MANAGER_ERROR_NONE) { - LOGW("app_info_metadata_filter_create failed (%d)", ret); + LOGW("app_info_metadata_filter_create failed (%#x)", ret); app_info_metadata_filter_destroy(handle); return false; } ret = app_info_metadata_filter_add(handle, "autofill-service", "true"); if (ret != APP_MANAGER_ERROR_NONE) { - LOGW("app_info_metadata_filter_add failed (%d)", ret); + LOGW("app_info_metadata_filter_add failed (%#x)", ret); app_info_metadata_filter_destroy(handle); return false; } @@ -771,7 +771,7 @@ static bool __manager_get_autofill_service_list_cb(rpc_port_stub_AutofillManager ret = app_info_metadata_filter_foreach(handle, add_autofill_service_cb, app_id_list_h); if (ret != APP_MANAGER_ERROR_NONE) { - LOGW("app_info_metadata_filter_foreach failed (%d)", ret); + LOGW("app_info_metadata_filter_foreach failed (%#x)", ret); } *service_info_list = app_id_list_h; @@ -800,7 +800,7 @@ static int connect_service() char *active_autofill_service_id = NULL; bool sys_config = false; autofill_config_get_autofill_service_app_id(&active_autofill_service_id, &sys_config); - LOGD("autofill service : '%s'", active_autofill_service_id); + LOGD("active autofill service app id: '%s'", active_autofill_service_id); if (!active_autofill_service_id) { active_autofill_service_id = strdup(AUTOFILL_SERVICE_APP_ID); @@ -823,14 +823,14 @@ static int connect_service() } if (ret != RPC_PORT_ERROR_NONE) { - LOGW("Failed to create rpc port. err = %d", ret); + LOGW("Failed to create rpc port. err = %#x", ret); return false; } } ret = rpc_port_proxy_AutofillSvcPort_connect(svc_rpc_h); if (ret != RPC_PORT_ERROR_NONE) { - LOGW("Failed to connect. err = %d", ret); + LOGW("Failed to connect. err = %#x", ret); return false; } -- 2.7.4 From 3c4047851cd5a66cb55a81cee37c96114f00f7d1 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 5 Apr 2019 20:30:39 +0900 Subject: [PATCH 10/16] Retry to connect when autofill service is disconnected Change-Id: I03feac914d8510cf36ed0def365a6c505fb145df Signed-off-by: Jihoon Kim --- CMakeLists.txt | 1 + packaging/org.tizen.autofilld.spec | 1 + src/autofill-daemon.c | 82 +++++++++++++++++++++++++++----------- 3 files changed, 60 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7eca8bf..a7613bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,7 @@ pkg_check_modules(pkgs_test REQUIRED rpc-port glib-2.0 eina + ecore capi-appfw-service-application capi-appfw-app-manager capi-appfw-preference diff --git a/packaging/org.tizen.autofilld.spec b/packaging/org.tizen.autofilld.spec index 8d009c6..ffe4aab 100644 --- a/packaging/org.tizen.autofilld.spec +++ b/packaging/org.tizen.autofilld.spec @@ -12,6 +12,7 @@ BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(efl) BuildRequires: pkgconfig(eina) +BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(rpc-port) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(capi-appfw-service-application) diff --git a/src/autofill-daemon.c b/src/autofill-daemon.c index 9abe0e5..097c86b 100644 --- a/src/autofill-daemon.c +++ b/src/autofill-daemon.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "autofill_daemon_dlog.h" #include "autofill_stub.h" @@ -33,8 +34,6 @@ static rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_h fill_response_re 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(); - typedef struct { char *app_id; int context_id; @@ -45,6 +44,9 @@ typedef struct { } autofill_client_s; static GList *__client_list = NULL; +static Ecore_Timer *g_connect_timer = NULL; + +static bool connect_service(); static autofill_client_s * get_autofill_client(const char *app_id, int context_id) @@ -636,6 +638,11 @@ static void __on_connected(rpc_port_proxy_AutofillSvcPort_h h, void *user_data) { LOGI("Autofill service connected"); + if (g_connect_timer) { + ecore_timer_del(g_connect_timer); + g_connect_timer = NULL; + } + if (fill_response_received_cb_h) { free(fill_response_received_cb_h); } @@ -657,10 +664,20 @@ static void __on_connected(rpc_port_proxy_AutofillSvcPort_h h, void *user_data) LOGD("Failed to invoke Register"); } +static Eina_Bool connect_timer_cb(void *data) +{ + if (connect_service()) { + g_connect_timer = NULL; + return ECORE_CALLBACK_CANCEL; + } + + return ECORE_CALLBACK_RENEW; +} + //LCOV_EXCL_START static void __on_disconnected(rpc_port_proxy_AutofillSvcPort_h h, void *user_data) { - LOGD("disconnected"); + LOGW("Autofill service is disconnected"); svc_rpc_h = NULL; @@ -678,6 +695,14 @@ static void __on_disconnected(rpc_port_proxy_AutofillSvcPort_h h, void *user_dat free(error_info_cb_h); error_info_cb_h = NULL; } + + // try to connect again + if (!connect_service()) { + if (g_connect_timer) + ecore_timer_del(g_connect_timer); + + g_connect_timer = ecore_timer_add(1.0, connect_timer_cb, NULL); + } } static void __on_rejected(rpc_port_proxy_AutofillSvcPort_h h, void *user_data) @@ -781,10 +806,12 @@ static bool __manager_get_autofill_service_list_cb(rpc_port_stub_AutofillManager return true; } -static int connect_service() +static bool connect_service() { int ret; size_t service_id_len = 0; + char *active_autofill_service_id = NULL; + bool sys_config = false; rpc_port_proxy_AutofillSvcPort_callback_s rpc_callback = { .connected = __on_connected, @@ -794,11 +821,10 @@ static int connect_service() if (svc_rpc_h) { LOGI("already connected\n"); - return RPC_PORT_ERROR_NONE; + return true; } - char *active_autofill_service_id = NULL; - bool sys_config = false; + LOGD("get autofill service app id..."); autofill_config_get_autofill_service_app_id(&active_autofill_service_id, &sys_config); LOGD("active autofill service app id: '%s'", active_autofill_service_id); @@ -806,35 +832,38 @@ static int connect_service() active_autofill_service_id = strdup(AUTOFILL_SERVICE_APP_ID); } - if (active_autofill_service_id) { - if (!sys_config) - autofill_config_set_autofill_service_app_id(active_autofill_service_id); + if (!active_autofill_service_id) + return false; - service_id_len = strlen(active_autofill_service_id); + if (!sys_config) + autofill_config_set_autofill_service_app_id(active_autofill_service_id); - if (service_id_len > 0) { - ret = rpc_port_proxy_AutofillSvcPort_create(active_autofill_service_id, &rpc_callback, NULL, &svc_rpc_h); - } - free(active_autofill_service_id); + service_id_len = strlen(active_autofill_service_id); - if (service_id_len == 0) { - LOGD("No Autofill service to connect"); - return false; - } + if (service_id_len > 0) { + ret = rpc_port_proxy_AutofillSvcPort_create(active_autofill_service_id, &rpc_callback, NULL, &svc_rpc_h); + } + else if (service_id_len == 0) { + LOGD("No Autofill service to connect"); + free(active_autofill_service_id); + return false; + } - if (ret != RPC_PORT_ERROR_NONE) { - LOGW("Failed to create rpc port. err = %#x", ret); - return false; - } + if (ret != RPC_PORT_ERROR_NONE) { + LOGW("Failed to create rpc port. err = %#x", ret); + free(active_autofill_service_id); + return false; } + LOGD("Connect to autofill service: '%s'", active_autofill_service_id); + free(active_autofill_service_id); ret = rpc_port_proxy_AutofillSvcPort_connect(svc_rpc_h); if (ret != RPC_PORT_ERROR_NONE) { LOGW("Failed to connect. err = %#x", ret); return false; } - return ret; + return true; } bool service_app_create(void *data) @@ -890,6 +919,11 @@ void service_app_terminate(void *data) __client_list = NULL; } + if (g_connect_timer) { + ecore_timer_del(g_connect_timer); + g_connect_timer = NULL; + } + rpc_port_stub_AutofillAppPort_unregister(); return; -- 2.7.4 From 6d9d2f180d32d61e16f5e4d5818c233eb48f1daa Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 8 Apr 2019 14:46:13 +0900 Subject: [PATCH 11/16] Update package version to 1.0.13 Change-Id: I46b267662cbbd84339c1871b893913497a8d1fc9 Signed-off-by: Jihoon Kim --- org.tizen.autofilld.xml | 2 +- packaging/org.tizen.autofilld.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.autofilld.xml b/org.tizen.autofilld.xml index 9b12481..29f1026 100644 --- a/org.tizen.autofilld.xml +++ b/org.tizen.autofilld.xml @@ -1,5 +1,5 @@ - + Jihoon Kim autofilld diff --git a/packaging/org.tizen.autofilld.spec b/packaging/org.tizen.autofilld.spec index ffe4aab..696105e 100644 --- a/packaging/org.tizen.autofilld.spec +++ b/packaging/org.tizen.autofilld.spec @@ -1,6 +1,6 @@ Name: org.tizen.autofilld Summary: Autofill Daemon -Version: 1.0.12 +Version: 1.0.13 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From 2a16e325d4887c56ded90dbe24edae894e5450a9 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 8 Apr 2019 20:31:48 +0900 Subject: [PATCH 12/16] Fix wrong error message Change-Id: I3b9a55002c59ca1a44e15a153b896c2014009d98 Signed-off-by: Jihoon Kim --- src/autofill-daemon.c | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/autofill-daemon.c b/src/autofill-daemon.c index 097c86b..a480f29 100644 --- a/src/autofill-daemon.c +++ b/src/autofill-daemon.c @@ -45,6 +45,7 @@ typedef struct { static GList *__client_list = NULL; static Ecore_Timer *g_connect_timer = NULL; +static bool g_connected = false; static bool connect_service(); @@ -351,8 +352,13 @@ static int __auth_info_request_cb(rpc_port_stub_AutofillAppPort_context_h contex { char *sender = NULL; + if (!g_connected) { + LOGW("Not connected to autofill service"); + return 0; + } + if (!svc_rpc_h) { - LOGW("Not initialized"); + LOGW("RPC port for autofill service is not created"); return 0; } @@ -394,8 +400,13 @@ static int __autofill_fill_request_cb(rpc_port_stub_AutofillAppPort_context_h co char *sender = NULL; char *view_id = NULL; + if (!g_connected) { + LOGW("Not connected to autofill service"); + return 0; + } + if (!svc_rpc_h) { - LOGW("Not initialized"); + LOGW("RPC port for autofill service is not created"); return 0; } @@ -433,8 +444,13 @@ static int __commit_cb(rpc_port_stub_AutofillAppPort_context_h context, int cont char *sender = NULL; char *view_id = NULL; + if (!g_connected) { + LOGW("Not connected to autofill service"); + return 0; + } + if (!svc_rpc_h) { - LOGW("Not initialized"); + LOGW("RPC port for autofill service is not created"); return 0; } @@ -662,6 +678,8 @@ static void __on_connected(rpc_port_proxy_AutofillSvcPort_h h, void *user_data) 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"); + + g_connected = true; } static Eina_Bool connect_timer_cb(void *data) @@ -696,6 +714,8 @@ static void __on_disconnected(rpc_port_proxy_AutofillSvcPort_h h, void *user_dat error_info_cb_h = NULL; } + g_connected = false; + // try to connect again if (!connect_service()) { if (g_connect_timer) @@ -820,6 +840,11 @@ static bool connect_service() }; if (svc_rpc_h) { + LOGI("connecting..\n"); + return true; + } + + if (g_connected) { LOGI("already connected\n"); return true; } @@ -850,7 +875,7 @@ static bool connect_service() } if (ret != RPC_PORT_ERROR_NONE) { - LOGW("Failed to create rpc port. err = %#x", ret); + LOGW("Failed to create rpc port. error code: %#x, message: %s", ret, get_error_message(ret)); free(active_autofill_service_id); return false; } @@ -859,7 +884,7 @@ static bool connect_service() free(active_autofill_service_id); ret = rpc_port_proxy_AutofillSvcPort_connect(svc_rpc_h); if (ret != RPC_PORT_ERROR_NONE) { - LOGW("Failed to connect. err = %#x", ret); + LOGW("Failed to connect. error code: %#x, message: %s", ret, get_error_message(ret)); return false; } -- 2.7.4 From d49e687810c250b81f61a9afb0f9be200b9e53fb Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 9 Apr 2019 15:14:38 +0900 Subject: [PATCH 13/16] Fix bug not to connect after failing to connect Change-Id: If91be5c8babe3c7dfebc9664a689c3ca298c77d0 Signed-off-by: Jihoon Kim --- src/autofill-daemon.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/autofill-daemon.c b/src/autofill-daemon.c index a480f29..238fb4e 100644 --- a/src/autofill-daemon.c +++ b/src/autofill-daemon.c @@ -885,6 +885,8 @@ static bool connect_service() ret = rpc_port_proxy_AutofillSvcPort_connect(svc_rpc_h); if (ret != RPC_PORT_ERROR_NONE) { LOGW("Failed to connect. error code: %#x, message: %s", ret, get_error_message(ret)); + rpc_port_proxy_AutofillSvcPort_destroy(svc_rpc_h); + svc_rpc_h = NULL; return false; } -- 2.7.4 From ea9014a9a387dbd7ab72f6288f27b7158fc9a08e Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 9 Apr 2019 15:35:27 +0900 Subject: [PATCH 14/16] Update package version to 1.0.14 Change-Id: I5514d29b09dac9ad9ed3e822640fffe5044d7a2e Signed-off-by: Jihoon Kim --- org.tizen.autofilld.xml | 2 +- packaging/org.tizen.autofilld.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.autofilld.xml b/org.tizen.autofilld.xml index 29f1026..df069f6 100644 --- a/org.tizen.autofilld.xml +++ b/org.tizen.autofilld.xml @@ -1,5 +1,5 @@ - + Jihoon Kim autofilld diff --git a/packaging/org.tizen.autofilld.spec b/packaging/org.tizen.autofilld.spec index 696105e..e58021a 100644 --- a/packaging/org.tizen.autofilld.spec +++ b/packaging/org.tizen.autofilld.spec @@ -1,6 +1,6 @@ Name: org.tizen.autofilld Summary: Autofill Daemon -Version: 1.0.13 +Version: 1.0.14 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From 7211bcfb21916cf8037221fc62db016ae261e7ef Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 15 Apr 2019 17:35:34 +0900 Subject: [PATCH 15/16] Change as appropriate log level Change-Id: Ie53b321666e70bcd2e661cd16453edcbe1359659 Signed-off-by: Jihoon Kim --- src/autofill-daemon.c | 14 +++++++------- src/autofill_config.c | 8 +++++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/autofill-daemon.c b/src/autofill-daemon.c index 238fb4e..cfa2de5 100644 --- a/src/autofill-daemon.c +++ b/src/autofill-daemon.c @@ -644,7 +644,7 @@ static void __error_info_recv_cb(void *user_data, int context_id, rpc_port_autof if (sender_client) rpc_port_AutofillAppPort_autofill_error_info_received_cb_invoke(sender_client->error_info_cb, error_info_h); - LOGD("error code : %#x, message : '%s'", error_code, get_error_message(error_code)); + LOGI("error code : %#x, message : '%s'", error_code, get_error_message(error_code)); if (app_id) free(app_id); @@ -677,7 +677,7 @@ static void __on_connected(rpc_port_proxy_AutofillSvcPort_h h, void *user_data) 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"); + LOGW("Failed to invoke Register"); g_connected = true; } @@ -727,7 +727,7 @@ static void __on_disconnected(rpc_port_proxy_AutofillSvcPort_h h, void *user_dat static void __on_rejected(rpc_port_proxy_AutofillSvcPort_h h, void *user_data) { - LOGD("rejected"); + LOGI("rejected"); } //LCOV_EXCL_STOP @@ -849,9 +849,9 @@ static bool connect_service() return true; } - LOGD("get autofill service app id..."); + LOGD("get autofill service app id"); autofill_config_get_autofill_service_app_id(&active_autofill_service_id, &sys_config); - LOGD("active autofill service app id: '%s'", active_autofill_service_id); + LOGI("active autofill service app id: '%s'", active_autofill_service_id); if (!active_autofill_service_id) { active_autofill_service_id = strdup(AUTOFILL_SERVICE_APP_ID); @@ -869,7 +869,7 @@ static bool connect_service() ret = rpc_port_proxy_AutofillSvcPort_create(active_autofill_service_id, &rpc_callback, NULL, &svc_rpc_h); } else if (service_id_len == 0) { - LOGD("No Autofill service to connect"); + LOGW("No Autofill service to connect"); free(active_autofill_service_id); return false; } @@ -880,7 +880,7 @@ static bool connect_service() return false; } - LOGD("Connect to autofill service: '%s'", active_autofill_service_id); + LOGI("Connect to autofill service: '%s'", active_autofill_service_id); free(active_autofill_service_id); ret = rpc_port_proxy_AutofillSvcPort_connect(svc_rpc_h); if (ret != RPC_PORT_ERROR_NONE) { diff --git a/src/autofill_config.c b/src/autofill_config.c index 778d826..a9587ed 100644 --- a/src/autofill_config.c +++ b/src/autofill_config.c @@ -40,16 +40,18 @@ bool autofill_config_get_autofill_service_app_id(char **app_id, bool *sys_config *sys_config = false; if (preference_get_string(SETTING_ACTIVE_AUTOFILL_SERVICE, &active_autofill_service_id) == PREFERENCE_ERROR_NONE) { - LOGD("preference active autofill service : %s", active_autofill_service_id); + LOGI("preference active autofill service : %s", active_autofill_service_id); *app_id = active_autofill_service_id; return true; } - LOGD("Read from config"); + LOGI("Read from config"); pFile = fopen(AUTOFILL_SYSTEM_CONFIG_FILE, "r"); - if (pFile == NULL) + if (pFile == NULL) { + LOGW("Failed to open system config file"); return false; + } while (fgets(strTemp, sizeof(strTemp), pFile) != NULL) { -- 2.7.4 From 03913278bf73f128726838dd2871edf5414dcc7e Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 18 Apr 2019 17:24:57 +0900 Subject: [PATCH 16/16] Update package version to 1.0.15 Change-Id: Icc4d0be9b584fa6f421afbc80ec160ea94415978 Signed-off-by: Jihoon Kim --- org.tizen.autofilld.xml | 2 +- packaging/org.tizen.autofilld.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.autofilld.xml b/org.tizen.autofilld.xml index df069f6..e7008b6 100644 --- a/org.tizen.autofilld.xml +++ b/org.tizen.autofilld.xml @@ -1,5 +1,5 @@ - + Jihoon Kim autofilld diff --git a/packaging/org.tizen.autofilld.spec b/packaging/org.tizen.autofilld.spec index e58021a..411c0de 100644 --- a/packaging/org.tizen.autofilld.spec +++ b/packaging/org.tizen.autofilld.spec @@ -1,6 +1,6 @@ Name: org.tizen.autofilld Summary: Autofill Daemon -Version: 1.0.14 +Version: 1.0.15 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4