SET(SRCS
src/autofill-daemon.c
src/autofill_config.c
+ src/autofill_request_list.c
src/autofill_stub.c
src/autofill_manager_stub.c
src/autofill_service_proxy.c
#include "autofill_service_proxy.h"
#include "autofill_manager_stub.h"
#include "autofill_config.h"
+#include "autofill_request_item.h"
+#include "autofill_request_list.h"
#define RECONNECT_PERIOD 1.0
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_stub_AutofillAppPort_context_get_sender(context, &sender);
rpc_port_autofill_view_info_foreach_items(vi, __view_info_item_cb, svi);
- rpc_port_proxy_AutofillSvcPort_invoke_request_auth_info(svc_rpc_h, context_id, svi);
-
- rpc_port_autofill_svc_view_info_destroy(svi);
+ if (g_autofill_service_connected && svc_rpc_h) {
+ rpc_port_proxy_AutofillSvcPort_invoke_request_auth_info(svc_rpc_h, context_id, svi);
+ rpc_port_autofill_svc_view_info_destroy(svi);
+ }
+ else {
+ LOGI("Add auth info request in pending list");
+ add_request_item(AUTH_INFO_REQUEST, context_id, svi);
+ }
end:
if (sender) {
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_stub_AutofillAppPort_context_get_sender(context, &sender);
rpc_port_autofill_view_info_foreach_items(vi, __view_info_item_cb, svi);
- rpc_port_proxy_AutofillSvcPort_invoke_send_fill_request(svc_rpc_h, context_id, svi);
+ if (g_autofill_service_connected && svc_rpc_h) {
+ rpc_port_proxy_AutofillSvcPort_invoke_send_fill_request(svc_rpc_h, context_id, svi);
- rpc_port_autofill_svc_view_info_destroy(svi);
+ rpc_port_autofill_svc_view_info_destroy(svi);
+ }
+ else {
+ LOGI("Add fill request in pending list");
+ add_request_item(FILL_REQUEST, context_id, svi);
+ }
end:
if (sender)
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_stub_AutofillAppPort_context_get_sender(context, &sender);
rpc_port_autofill_view_info_foreach_items(vi, __view_info_item_cb, svi);
- rpc_port_proxy_AutofillSvcPort_invoke_cancel_fill_request(svc_rpc_h, context_id, svi);
+ if (g_autofill_service_connected && svc_rpc_h) {
+ rpc_port_proxy_AutofillSvcPort_invoke_cancel_fill_request(svc_rpc_h, context_id, svi);
- rpc_port_autofill_svc_view_info_destroy(svi);
+ rpc_port_autofill_svc_view_info_destroy(svi);
+ }
+ else {
+ LOGI("Add cancel fill request in pending list");
+ add_request_item(CANCEL_FILL_REQUEST, context_id, svi);
+ }
end:
if (sender)
LOGW("Failed to invoke Register");
g_autofill_service_connected = true;
+
+ process_pending_request(svc_rpc_h);
}
static Eina_Bool connect_timer_cb(void *data)
__client_list = NULL;
}
+ remove_all_pending_request_item_list();
+
if (g_connect_timer) {
ecore_timer_del(g_connect_timer);
g_connect_timer = NULL;
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#include <tizen.h>
#include <stdlib.h>
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __AUTOFILL_REQUEST_ITEM_H__
+#define __AUTOFILL_REQUEST_ITEM_H__
+
+typedef enum {
+ AUTH_INFO_REQUEST,
+ FILL_REQUEST,
+ CANCEL_FILL_REQUEST,
+} autofill_request_type;
+
+typedef struct {
+ autofill_request_type req_type;
+ int context_id;
+ void *req_data;
+} autofill_request_item_s;
+
+#endif /* __AUTOFILL_REQUEST_ITEM_H__ */
--- /dev/null
+ /*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <tizen.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <glib.h>
+#include <dlog.h>
+
+#include "autofill_daemon_dlog.h"
+#include "autofill_request_item.h"
+#include "autofill_service_proxy.h"
+
+static GList *__pending_request_item_list = NULL;
+
+static void __destroy_pending_request(gpointer data)
+{
+ LOGD("");
+ autofill_request_item_s *handle = data;
+
+ if (!handle)
+ return;
+
+ rpc_port_autofill_svc_view_info_h svi = handle->req_data;
+
+ switch (handle->req_type) {
+ case AUTH_INFO_REQUEST:
+ case FILL_REQUEST:
+ case CANCEL_FILL_REQUEST:
+ rpc_port_autofill_svc_view_info_destroy(svi);
+ break;
+ default:
+ break;
+ }
+
+ free(handle);
+}
+
+void add_request_item(autofill_request_type type, int context_id, void *req_data)
+{
+ autofill_request_item_s* request_item_h = calloc(1, sizeof(autofill_request_item_s));
+ request_item_h->req_type = type;
+ request_item_h->req_data = (void *)req_data;
+ request_item_h->context_id = context_id;
+
+ __pending_request_item_list = g_list_append(__pending_request_item_list, request_item_h);
+}
+
+void remove_all_pending_request_item_list()
+{
+ if (__pending_request_item_list) {
+ g_list_free_full(__pending_request_item_list, __destroy_pending_request);
+ __pending_request_item_list = NULL;
+ }
+}
+
+void process_pending_request(rpc_port_proxy_AutofillSvcPort_h svc_rpc_h)
+{
+ autofill_request_item_s *req_item;
+ GList *iter;
+
+ LOGD("");
+
+ iter = __pending_request_item_list;
+ while (iter) {
+ req_item = iter->data;
+
+ iter = g_list_next(iter);
+
+ if (!req_item) {
+ LOGW("Warning: value is NULL");
+ continue;
+ }
+
+ LOGD("type : %d", req_item->req_type);
+
+ rpc_port_autofill_svc_view_info_h svi = req_item->req_data;
+
+ switch (req_item->req_type) {
+ case AUTH_INFO_REQUEST:
+ LOGD("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:
+ LOGD("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:
+ LOGD("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;
+ default:
+ break;
+ }
+ }
+
+ remove_all_pending_request_item_list();
+}
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __AUTOFILL_REQUEST_LIST_H__
+#define __AUTOFILL_REQUEST_LIST_H__
+
+#include "autofill_request_item.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void add_request_item(autofill_request_type type, int context_id, void *req_data);
+void remove_all_pending_request_item_list();
+void process_pending_request(rpc_port_proxy_AutofillSvcPort_h svc_rpc_h);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AUTOFILL_REQUEST_LIST_H__ */