From fe19f87c6075674a022d464a6110b1dac18776f5 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 23 Apr 2019 17:24:13 +0900 Subject: [PATCH] Support on-demand launch Change-Id: Id8c87ed0a84ed9f172a4ec101d67c7b22dd9d6cb Signed-off-by: Jihoon Kim --- org.tizen.autofilld.xml | 2 +- src/autofill-daemon.c | 27 ++++++++++++++++++++------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/org.tizen.autofilld.xml b/org.tizen.autofilld.xml index 04976f3..70983fe 100644 --- a/org.tizen.autofilld.xml +++ b/org.tizen.autofilld.xml @@ -3,7 +3,7 @@ Jihoon Kim autofilld - + diff --git a/src/autofill-daemon.c b/src/autofill-daemon.c index f22e99d..328ac2d 100644 --- a/src/autofill-daemon.c +++ b/src/autofill-daemon.c @@ -48,6 +48,7 @@ static Ecore_Timer *g_connect_timer = NULL; static bool g_connected = false; static bool connect_service(); +static void terminate_autofill_service(); static autofill_client_s * get_autofill_client(const char *app_id, int context_id) @@ -173,6 +174,13 @@ static void __remove_client(rpc_port_stub_AutofillAppPort_context_h context) __client_list = g_list_remove(__client_list, client); __destroy_client(client); + + if (g_list_length(__client_list) == 0) { + terminate_autofill_service(); + + LOGI("terminate autofill daemon"); + service_app_exit(); + } } static void __message_create(rpc_port_stub_AutofillAppPort_context_h context, @@ -738,15 +746,10 @@ static void __on_rejected(rpc_port_proxy_AutofillSvcPort_h h, void *user_data) } //LCOV_EXCL_STOP -static bool __manager_set_autofill_service_cb(rpc_port_stub_AutofillManagerPort_context_h context, const char *app_id, void *user_data) +static void terminate_autofill_service() { - LOGD("autofill service app id: '%s'", app_id); - - if (app_id) - autofill_config_set_autofill_service_app_id(app_id); - if (svc_rpc_h) { - LOGD("send terminate"); + LOGI("Send terminate message to autofill service"); // terminate service rpc_port_proxy_AutofillSvcPort_invoke_request_terminate(svc_rpc_h); @@ -762,6 +765,16 @@ static bool __manager_set_autofill_service_cb(rpc_port_stub_AutofillManagerPort_ } svc_rpc_h = NULL; +} + +static bool __manager_set_autofill_service_cb(rpc_port_stub_AutofillManagerPort_context_h context, const char *app_id, void *user_data) +{ + LOGD("autofill service app id: '%s'", app_id); + + if (app_id) + autofill_config_set_autofill_service_app_id(app_id); + + terminate_autofill_service(); connect_service(); -- 2.7.4