Deliver commit request received before autofill service app is connected 65/246065/2
authorJihoon Kim <jihoon48.kim@samsung.com>
Fri, 23 Oct 2020 02:43:15 +0000 (11:43 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Fri, 23 Oct 2020 02:43:30 +0000 (11:43 +0900)
Commit request received before autofill service application was connected was dropped.

Change-Id: Ie78a780a90f799d64f1e72696b1e67a42ba87766
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/autofill-daemon.c
src/autofill_request_item.h
src/autofill_request_list.c

index 2967374f3b5c7ea693f99f5be0931faa5beaa58d..c9befaecfa10fcab0fc1467cadf3c6212167826f 100644 (file)
@@ -395,12 +395,10 @@ static int __commit_cb(rpc_port_stub_AutofillAppPort_context_h context, int cont
 
     if (!g_autofill_service_connected) {
         LOGW("Not connected to autofill service");
-        return 0;
     }
 
     if (!svc_rpc_h) {
         LOGW("RPC port for autofill service is not created");
-        return 0;
     }
 
     rpc_port_autofill_svc_save_view_info_h svi = NULL;
@@ -425,15 +423,23 @@ static int __commit_cb(rpc_port_stub_AutofillAppPort_context_h context, int cont
 
     rpc_port_autofill_save_view_info_foreach_items(vi, __save_item_cb, svi);
 
-    rpc_port_proxy_AutofillSvcPort_invoke_commit(svc_rpc_h, context_id, svi);
-
-    if (view_id)
+    if (view_id) {
         free(view_id);
+        view_id = NULL;
+    }
 
-    if (view_title)
+    if (view_title) {
         free(view_title);
+        view_title = NULL;
+    }
 
-    rpc_port_autofill_svc_save_view_info_destroy(svi);
+    if (g_autofill_service_connected && svc_rpc_h) {
+        rpc_port_proxy_AutofillSvcPort_invoke_commit(svc_rpc_h, context_id, svi);
+        rpc_port_autofill_svc_save_view_info_destroy(svi);
+    }
+    else {
+        add_request_item(COMMIT, context_id, svi);
+    }
 
     return 0;
 }
index eb121b471ca87fcc57854af1f02c1e9d84f64dd1..277471d671eff146988fdc3c327deb2c35210dd7 100644 (file)
@@ -21,6 +21,7 @@ typedef enum {
     AUTH_INFO_REQUEST,
     FILL_REQUEST,
     CANCEL_FILL_REQUEST,
+    COMMIT
 } autofill_request_type;
 
 typedef struct {
index 8cc6c434c84412c2f87d3a5d8b227de40d0e59a2..270080878f8e9102f7152fa89ca22204c58ea3f2 100644 (file)
@@ -35,6 +35,7 @@ static void __destroy_pending_request(gpointer data)
         return;
 
     rpc_port_autofill_svc_view_info_h svi = handle->req_data;
+    rpc_port_autofill_svc_save_view_info_h save_view_info_h;
 
     switch (handle->req_type) {
         case AUTH_INFO_REQUEST:
@@ -42,6 +43,9 @@ static void __destroy_pending_request(gpointer data)
         case CANCEL_FILL_REQUEST:
             rpc_port_autofill_svc_view_info_destroy(svi);
             break;
+        case COMMIT:
+            save_view_info_h = handle->req_data;
+            rpc_port_autofill_svc_save_view_info_destroy(save_view_info_h);
         default:
             break;
     }
@@ -74,7 +78,11 @@ void process_pending_request(rpc_port_proxy_AutofillSvcPort_h svc_rpc_h)
     autofill_request_item_s *req_item;
     GList *iter;
 
-    LOGI("");
+    rpc_port_autofill_svc_save_view_info_h save_view_info_h;
+    rpc_port_autofill_svc_view_info_h svi;
+
+    if (!__pending_request_item_list)
+        LOGI("No pending request");
 
     iter = __pending_request_item_list;
     while (iter) {
@@ -89,21 +97,26 @@ void process_pending_request(rpc_port_proxy_AutofillSvcPort_h svc_rpc_h)
 
         LOGI("request type : %d", req_item->req_type);
 
-        rpc_port_autofill_svc_view_info_h svi = req_item->req_data;
+        svi = req_item->req_data;
 
         switch (req_item->req_type) {
             case AUTH_INFO_REQUEST:
-                LOGI("auth info request. context id : %d", req_item->context_id);
+                LOGI("auth info request. context id(%d)", req_item->context_id);
                 rpc_port_proxy_AutofillSvcPort_invoke_request_auth_info(svc_rpc_h, req_item->context_id, svi);
                 break;
             case FILL_REQUEST:
-                LOGI("fill request. context id : %d", req_item->context_id);
+                LOGI("fill request. context id(%d)", req_item->context_id);
                 rpc_port_proxy_AutofillSvcPort_invoke_send_fill_request(svc_rpc_h, req_item->context_id, svi);
                 break;
             case CANCEL_FILL_REQUEST:
-                LOGI("cancel fill request. context id : %d", req_item->context_id);
+                LOGI("cancel fill request. context id(%d)", req_item->context_id);
                 rpc_port_proxy_AutofillSvcPort_invoke_cancel_fill_request(svc_rpc_h, req_item->context_id, svi);
                 break;
+            case COMMIT:
+                LOGI("commit. context id(%d)", req_item->context_id);
+                save_view_info_h = req_item->req_data;
+                rpc_port_proxy_AutofillSvcPort_invoke_commit(svc_rpc_h, req_item->context_id, save_view_info_h);
+                break;
             default:
                 break;
         }