Support on-demand launch 55/204355/6
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 23 Apr 2019 08:24:13 +0000 (17:24 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 28 May 2019 07:29:03 +0000 (16:29 +0900)
Change-Id: Id8c87ed0a84ed9f172a4ec101d67c7b22dd9d6cb
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
org.tizen.autofilld.xml
src/autofill-daemon.c

index 04976f3..70983fe 100644 (file)
@@ -3,7 +3,7 @@
        <label>autofilld</label>
        <author email="jihoon48.kim@samsung.com" href="www.samsung.com">Jihoon Kim</author>
        <description>autofilld</description>
-       <service-application appid="org.tizen.autofilld" auto-restart="true" exec="autofilld" multiple="false" nodisplay="true" on-boot="true" taskmanage="false" type="capp">
+       <service-application appid="org.tizen.autofilld" exec="autofilld" multiple="false" nodisplay="true" taskmanage="false" type="capp">
                <label>autofill daemon</label>
                <metadata key="http://tizen.org/rpc-port/privilege-check-bypass" value="AutofillAppPort|AutofillManagerPort"/>
                <background-category value="system"/>
index f22e99d..328ac2d 100644 (file)
@@ -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();