From 9f1b87a74fb3faecb946ff1432bd758b52439cb4 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 4 Dec 2018 15:58:21 +0900 Subject: [PATCH] Support multi autofill instance Change-Id: Id185b2f831d9b04f17591a26156d7412e8d602f1 Signed-off-by: Jihoon Kim --- client/autofill.c | 151 ++++++++++++++++++++++------------------- client/autofill_auth.c | 41 ++++++----- client/autofill_fill_request.c | 41 ++++++----- include/autofill.h | 68 +++++++++++++------ include/autofill_private.h | 19 +++++- include/autofill_service.h | 15 ++-- server/main.c | 66 +++++++++--------- service_lib/autofill_service.c | 38 ++++++----- tidl/autofill.tidl | 10 +-- tidl/autofill_service.tidl | 10 +-- 10 files changed, 264 insertions(+), 195 deletions(-) diff --git a/client/autofill.c b/client/autofill.c index f0964bb..3255989 100644 --- a/client/autofill.c +++ b/client/autofill.c @@ -32,16 +32,7 @@ #endif #define LOG_TAG "AUTOFILL" -rpc_port_proxy_AutofillAppPort_h rpc_h = NULL; - -static autofill_connection_status_changed_cb connection_callback = NULL; -static void *connection_userdata = NULL; - -extern autofill_fill_response_received_cb g_autofill_fill_response_received_cb; -extern void *g_autofill_fill_response_data; - -extern autofill_auth_info_received_cb g_autofill_auth_info_received_cb; -extern void *g_autofill_auth_info_data; +static int _autofill_context_count = 0; static bool fill_response_item_cb(rpc_port_autofill_response_item_h response_items, void *user_data) { @@ -103,6 +94,7 @@ static bool fill_response_group_cb(rpc_port_autofill_response_group_h response_g static void __fill_response_recv_cb(void *user_data, rpc_port_autofill_fill_response_h response_h) { char *view_id = NULL; + autofill_h ah = user_data; autofill_fill_response_h rh; autofill_fill_response_create(&rh); @@ -118,16 +110,18 @@ static void __fill_response_recv_cb(void *user_data, rpc_port_autofill_fill_resp rpc_port_autofill_fill_response_foreach_response_groups(response_h, fill_response_group_cb, rh); - if (g_autofill_fill_response_received_cb) - g_autofill_fill_response_received_cb(rh, g_autofill_fill_response_data); + if (ah->autofill_fill_response_received_cb) + ah->autofill_fill_response_received_cb(ah, rh, ah->autofill_fill_response_data); autofill_fill_response_destroy(rh); } static void __auth_info_recv_cb(void *user_data, rpc_port_autofill_auth_info_h auth_info_h) { - autofill_auth_info_h ah; - autofill_auth_info_create(&ah); + autofill_auth_info_h aih; + autofill_h ah = user_data; + + autofill_auth_info_create(&aih); bool autofill_data_present = false; bool authentication_needed = false; @@ -145,12 +139,12 @@ static void __auth_info_recv_cb(void *user_data, rpc_port_autofill_auth_info_h a LOGD("service name : %s", service_name); - autofill_auth_info_set_view_id(ah, view_id); - autofill_auth_info_set_autofill_data_present(ah, autofill_data_present); - autofill_auth_info_set_authentication_needed(ah, authentication_needed); - autofill_auth_info_set_service_name(ah, service_name); - autofill_auth_info_set_service_logo_image_path(ah, service_logo_image_path); - autofill_auth_info_set_service_message(ah, service_message); + autofill_auth_info_set_view_id(aih, view_id); + autofill_auth_info_set_autofill_data_present(aih, autofill_data_present); + autofill_auth_info_set_authentication_needed(aih, authentication_needed); + autofill_auth_info_set_service_name(aih, service_name); + autofill_auth_info_set_service_logo_image_path(aih, service_logo_image_path); + autofill_auth_info_set_service_message(aih, service_message); if (view_id) free(view_id); @@ -164,24 +158,35 @@ static void __auth_info_recv_cb(void *user_data, rpc_port_autofill_auth_info_h a if (service_message) free(service_message); - if (g_autofill_auth_info_received_cb) - g_autofill_auth_info_received_cb(ah, g_autofill_fill_response_data); + if (ah) { + if (ah->autofill_auth_info_received_cb) + ah->autofill_auth_info_received_cb(ah, aih, ah->autofill_fill_response_data); + } + else { + LOGW("no user data"); + } - autofill_auth_info_destroy(ah); + autofill_auth_info_destroy(aih); } static void __on_connected(rpc_port_proxy_AutofillAppPort_h h, void *user_data) { - LOGI("[__RPC_PORT__] connected"); - rpc_port_AutofillAppPort_autofill_fill_response_received_cb_h fill_response_received_cb = rpc_port_AutofillAppPort_autofill_fill_response_received_cb_create(__fill_response_recv_cb, false, NULL); - rpc_port_AutofillAppPort_autofill_auth_info_received_cb_h auth_info_received_cb = rpc_port_AutofillAppPort_autofill_auth_info_received_cb_create(__auth_info_recv_cb, false, NULL); + autofill_h ah = user_data; + if (!ah) { + LOGW("no user data"); + return; + } + + LOGI("connected"); + rpc_port_AutofillAppPort_autofill_fill_response_received_cb_h fill_response_received_cb = rpc_port_AutofillAppPort_autofill_fill_response_received_cb_create(__fill_response_recv_cb, false, ah); + rpc_port_AutofillAppPort_autofill_auth_info_received_cb_h auth_info_received_cb = rpc_port_AutofillAppPort_autofill_auth_info_received_cb_create(__auth_info_recv_cb, false, ah); - int r = rpc_port_proxy_AutofillAppPort_invoke_Register(h, auth_info_received_cb, fill_response_received_cb); + int r = rpc_port_proxy_AutofillAppPort_invoke_Register(h, ah->context_id, auth_info_received_cb, fill_response_received_cb); if (r != 0) LOGD("Failed to invoke Register"); - if (connection_callback) - connection_callback(AUTOFILL_CONNECTION_STATUS_CONNECTED, connection_userdata); + if (ah->connection_callback) + ah->connection_callback(ah, AUTOFILL_CONNECTION_STATUS_CONNECTED, ah->connection_userdata); } //LCOV_EXCL_START @@ -189,31 +194,32 @@ static void __on_disconnected(rpc_port_proxy_AutofillAppPort_h h, void *user_dat { LOGD("disconnected"); - if (connection_callback) - connection_callback(AUTOFILL_CONNECTION_STATUS_DISCONNECTED, connection_userdata); + autofill_h ah = user_data; + if (ah) { + if (ah && ah->connection_callback) + ah->connection_callback(ah, AUTOFILL_CONNECTION_STATUS_DISCONNECTED, ah->connection_userdata); - rpc_h = NULL; + ah->rpc_h = NULL; + } } static void __on_rejected(rpc_port_proxy_AutofillAppPort_h h, void *user_data) { LOGD("rejected"); - if (connection_callback) - connection_callback(AUTOFILL_CONNECTION_STATUS_REJECTED, connection_userdata); + autofill_h ah = user_data; + + if (ah && ah->connection_callback) + ah->connection_callback(ah, AUTOFILL_CONNECTION_STATUS_REJECTED, ah->connection_userdata); } //LCOV_EXCL_STOP -EXPORT_API int autofill_initialize(void) +EXPORT_API int autofill_create(autofill_h *ah) { - LOGD("autofill initialize"); - int ret; - if (rpc_h) { - LOGI("already initialized\n"); - return AUTOFILL_ERROR_NONE; - } + if (!ah) + return AUTOFILL_ERROR_INVALID_PARAMETER; rpc_port_proxy_AutofillAppPort_callback_s rpc_callback = { .connected = __on_connected, @@ -221,53 +227,59 @@ EXPORT_API int autofill_initialize(void) .rejected = __on_rejected }; - ret = rpc_port_proxy_AutofillAppPort_create(AUTOFILL_DAEMON_APP_ID, &rpc_callback, NULL, &rpc_h); + struct autofill_s *as = (autofill_h)calloc(1, sizeof(struct autofill_s)); + if (!as) + return AUTOFILL_ERROR_OUT_OF_MEMORY; + + ret = rpc_port_proxy_AutofillAppPort_create(AUTOFILL_DAEMON_APP_ID, &rpc_callback, as, &as->rpc_h); if (ret != RPC_PORT_ERROR_NONE) { LOGW("Failed to create rpc port. err = %d", ret); + free(as); return AUTOFILL_ERROR_OUT_OF_MEMORY; } - return ret; + as->context_id = _autofill_context_count++; + *ah = as; + + return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_deinitialize(void) +EXPORT_API int autofill_destroy(autofill_h ah) { - LOGD("autofill deinitialize"); + if (!ah) + return AUTOFILL_ERROR_INVALID_PARAMETER; - connection_callback = NULL; - g_autofill_fill_response_received_cb = NULL; - g_autofill_auth_info_received_cb = NULL; + ah->connection_callback = NULL; + ah->autofill_fill_response_received_cb = NULL; + ah->autofill_auth_info_received_cb = NULL; - if (rpc_h) { - rpc_port_proxy_AutofillAppPort_destroy(rpc_h); - rpc_h = NULL; + if (ah->rpc_h) { + rpc_port_proxy_AutofillAppPort_destroy(ah->rpc_h); + ah->rpc_h = NULL; } - else - return AUTOFILL_ERROR_NOT_INITIALIZED; return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_connect(autofill_connection_status_changed_cb callback, void *user_data) +EXPORT_API int autofill_connect(autofill_h ah, autofill_connection_status_changed_cb callback, void *user_data) { - LOGD("autofill connect"); + LOGD("autofill connect. handle : %p", ah); int ret; - if (!callback) { - LOGW("parameter is NULL\n"); + if (!ah || !callback) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; } - if (!rpc_h) { - LOGW("Not initialized\n"); - return AUTOFILL_ERROR_NOT_INITIALIZED; + if (!ah->rpc_h) { + return AUTOFILL_ERROR_OPERATION_FAILED; } - connection_callback = callback; - connection_userdata = user_data; + ah->connection_callback = callback; + ah->connection_userdata = user_data; - ret = rpc_port_proxy_AutofillAppPort_connect(rpc_h); + ret = rpc_port_proxy_AutofillAppPort_connect(ah->rpc_h); if (ret != RPC_PORT_ERROR_NONE) { LOGW("Failed to connect rpc port. err = %d", ret); return AUTOFILL_ERROR_OPERATION_FAILED; @@ -277,7 +289,7 @@ EXPORT_API int autofill_connect(autofill_connection_status_changed_cb callback, } } -EXPORT_API int autofill_commit(autofill_save_view_info_h vi) +EXPORT_API int autofill_commit(autofill_h ah, autofill_save_view_info_h vi) { rpc_port_autofill_save_view_info_h vih; char *id; @@ -286,14 +298,13 @@ EXPORT_API int autofill_commit(autofill_save_view_info_h vi) autofill_hint_e autofill_hint; bool sensitive_data; - if (!vi) { - LOGW("parameter is NULL"); + if (!ah || !vi) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; } - if (!rpc_h) { - LOGW("Not initialized\n"); - return AUTOFILL_ERROR_NOT_INITIALIZED; + if (!ah->rpc_h) { + return AUTOFILL_ERROR_OPERATION_FAILED; } rpc_port_autofill_save_view_info_create(&vih); @@ -340,7 +351,7 @@ EXPORT_API int autofill_commit(autofill_save_view_info_h vi) LOGD("app id : %s, view id : %s", vi->app_id, vi->view_id); - int ret = rpc_port_proxy_AutofillAppPort_invoke_commit(rpc_h, vih); + int ret = rpc_port_proxy_AutofillAppPort_invoke_commit(ah->rpc_h, ah->context_id, vih); rpc_port_autofill_save_view_info_destroy(vih); diff --git a/client/autofill_auth.c b/client/autofill_auth.c index 1d0e204..2585e64 100644 --- a/client/autofill_auth.c +++ b/client/autofill_auth.c @@ -25,18 +25,13 @@ #include "autofill_private.h" #include "autofill_proxy.h" -extern rpc_port_proxy_AutofillAppPort_h rpc_h; - #ifdef LOG_TAG #undef LOG_TAG #endif #define LOG_TAG "AUTOFILL" -autofill_auth_info_received_cb g_autofill_auth_info_received_cb = NULL; -void *g_autofill_auth_info_data = NULL; - // Request autofill auth info -EXPORT_API int autofill_auth_info_request(autofill_view_info_h vi) +EXPORT_API int autofill_auth_info_request(autofill_h ah, autofill_view_info_h vi) { int ret = AUTOFILL_ERROR_NONE; rpc_port_autofill_view_info_h vih; @@ -45,14 +40,13 @@ EXPORT_API int autofill_auth_info_request(autofill_view_info_h vi) autofill_hint_e autofill_hint; bool sensitive_data; - if (!vi) { - LOGW("parameter is NULL"); + if (!ah || !vi) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; } - if (!rpc_h) { - LOGW("Not initialized"); - return AUTOFILL_ERROR_NOT_INITIALIZED; + if (!ah->rpc_h) { + return AUTOFILL_ERROR_OPERATION_FAILED; } LOGD("app id : %s, view id : %s", vi->app_id, vi->view_id); @@ -93,9 +87,9 @@ EXPORT_API int autofill_auth_info_request(autofill_view_info_h vi) rpc_port_autofill_item_destroy(aih); } - LOGD("rpc_h : %p", rpc_h); + LOGD("rpc_h : %p, context id : %d", ah->rpc_h, ah->context_id); - ret = rpc_port_proxy_AutofillAppPort_invoke_request_auth_info(rpc_h, vih); + ret = rpc_port_proxy_AutofillAppPort_invoke_request_auth_info(ah->rpc_h, ah->context_id, vih); rpc_port_autofill_view_info_destroy(vih); @@ -107,23 +101,28 @@ EXPORT_API int autofill_auth_info_request(autofill_view_info_h vi) return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_auth_info_set_received_cb(autofill_auth_info_received_cb callback, void *user_data) +EXPORT_API int autofill_auth_info_set_received_cb(autofill_h ah, autofill_auth_info_received_cb callback, void *user_data) { - if (!callback) { - LOGW("parameter is NULL"); + if (!ah || !callback) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; } - g_autofill_auth_info_received_cb = callback; - g_autofill_auth_info_data = user_data; + ah->autofill_auth_info_received_cb = callback; + ah->autofill_auth_info_data = user_data; return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_auth_info_unset_received_cb(void) +EXPORT_API int autofill_auth_info_unset_received_cb(autofill_h ah) { - g_autofill_auth_info_received_cb = NULL; - g_autofill_auth_info_data = NULL; + if (!ah) { + LOGW("[ERROR] Invalid parameter"); + return AUTOFILL_ERROR_INVALID_PARAMETER; + } + + ah->autofill_auth_info_received_cb = NULL; + ah->autofill_auth_info_data = NULL; return AUTOFILL_ERROR_NONE; } diff --git a/client/autofill_fill_request.c b/client/autofill_fill_request.c index e340679..50ca370 100644 --- a/client/autofill_fill_request.c +++ b/client/autofill_fill_request.c @@ -29,12 +29,7 @@ #endif #define LOG_TAG "AUTOFILL" -extern rpc_port_proxy_AutofillAppPort_h rpc_h; - -autofill_fill_response_received_cb g_autofill_fill_response_received_cb = NULL; -void *g_autofill_fill_response_data = NULL; - -EXPORT_API int autofill_fill_request(autofill_view_info_h vi) +EXPORT_API int autofill_fill_request(autofill_h ah, autofill_view_info_h vi) { int ret = AUTOFILL_ERROR_NONE; rpc_port_autofill_view_info_h vih; @@ -43,14 +38,13 @@ EXPORT_API int autofill_fill_request(autofill_view_info_h vi) autofill_hint_e autofill_hint; bool sensitive_data; - if (!vi) { - LOGW("parameter is NULL"); + if (!ah || !vi) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; } - if (!rpc_h) { - LOGW("Not initialized"); - return AUTOFILL_ERROR_NOT_INITIALIZED; + if (!ah->rpc_h) { + return AUTOFILL_ERROR_OPERATION_FAILED; } Eina_List *l; @@ -89,9 +83,9 @@ EXPORT_API int autofill_fill_request(autofill_view_info_h vi) rpc_port_autofill_item_destroy(aih); } - LOGD("app id : %s, view id : %s", vi->app_id, vi->view_id); + LOGD("app id : %s, view id : %s, context id : %d", vi->app_id, vi->view_id, ah->context_id); - ret = rpc_port_proxy_AutofillAppPort_invoke_send_fill_request(rpc_h, vih); + ret = rpc_port_proxy_AutofillAppPort_invoke_send_fill_request(ah->rpc_h, ah->context_id, vih); rpc_port_autofill_view_info_destroy(vih); @@ -103,23 +97,28 @@ EXPORT_API int autofill_fill_request(autofill_view_info_h vi) return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_fill_response_set_received_cb(autofill_fill_response_received_cb callback, void *user_data) +EXPORT_API int autofill_fill_response_set_received_cb(autofill_h ah, autofill_fill_response_received_cb callback, void *user_data) { - if (!callback) { - LOGW("parameter is NULL"); + if (!ah || !callback) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; } - g_autofill_fill_response_received_cb = callback; - g_autofill_fill_response_data = user_data; + ah->autofill_fill_response_received_cb = callback; + ah->autofill_fill_response_data = user_data; return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_fill_response_unset_received_cb(void) +EXPORT_API int autofill_fill_response_unset_received_cb(autofill_h ah) { - g_autofill_fill_response_received_cb = NULL; - g_autofill_fill_response_data = NULL; + if (!ah) { + LOGW("[ERROR] Invalid parameter"); + return AUTOFILL_ERROR_INVALID_PARAMETER; + } + + ah->autofill_fill_response_received_cb = NULL; + ah->autofill_fill_response_data = NULL; return AUTOFILL_ERROR_NONE; } diff --git a/include/autofill.h b/include/autofill.h index abfd656..c57a74b 100644 --- a/include/autofill.h +++ b/include/autofill.h @@ -44,137 +44,165 @@ typedef enum { } autofill_connection_status_e; /** + * @brief The autofill handle. + * @since_tizen 5.5 + */ +typedef struct autofill_s *autofill_h; + +/** * @brief Called when the connection status is changed. * @since_tizen 5.5 + * @remarks @a ah should not be freed and can be used only in the callback. + * @param[in] ah The autofill handle * @param[in] status The connection status * @param[in] user_data The user data passed from the callback function * @see autofill_connect() */ -typedef void(*autofill_connection_status_changed_cb)(autofill_connection_status_e status, void* user_data); +typedef void (*autofill_connection_status_changed_cb)(autofill_h ah, autofill_connection_status_e status, void* user_data); /** * @brief Called when receiving autofill fill response data. * @since_tizen 5.5 + * @remarks @a ah should not be freed and can be used only in the callback. * @remarks @a fill_response_h should not be freed and can be used only in the callback. + * @param[in] ah The autofill handle * @param[in] fill_response_h The autofill fill response handle * @param[in] user_data The user data to be passed to the callback function * @see autofill_fill_response_set_received_cb() */ -typedef void (*autofill_fill_response_received_cb)(autofill_fill_response_h fill_response_h, void *user_data); +typedef void (*autofill_fill_response_received_cb)(autofill_h ah, autofill_fill_response_h fill_response_h, void *user_data); /** * @brief Called when receiving the authentication information. * @since_tizen 5.5 + * @remarks @a ah should not be freed and can be used only in the callback. * @remarks @a auth_info should not be freed and can be used only in the callback. + * @param[in] ah The autofill handle * @param[in] auth_info The autofill authentication information handle * @param[in] user_data The user data passed from the callback function * @see autofill_fill_response_set_received_cb() */ -typedef void (*autofill_auth_info_received_cb)(autofill_auth_info_h auth_info, void *user_data); +typedef void (*autofill_auth_info_received_cb)(autofill_h ah, autofill_auth_info_h auth_info, void *user_data); /** - * @brief Initializes autofill. + * @brief Creates a handle for autofill. * @since_tizen 5.5 + * @remarks If the function succeeds, @a ah handle must be released with autofill_destroy(). + * @param[out] ah The autofill handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #AUTOFILL_ERROR_OUT_OF_MEMORY Out of memory + * @see autofill_destroy() */ -int autofill_initialize(void); +int autofill_create(autofill_h *ah); /** - * @brief Deinitializes autofill. + * @brief Destroys an autofill. * @since_tizen 5.5 + * @param[in] ah The autofill handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error - * @retval #AUTOFILL_ERROR_NOT_INITIALIZED Not initialized + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter + * @see autofill_create() */ -int autofill_deinitialize(void); +int autofill_destroy(autofill_h ah); /** * @brief Connects to autofill daemon. * @since_tizen 5.5 + * @param[in] ah The autofill handle * @param[in] callback The callback function to register * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #AUTOFILL_ERROR_NOT_INITIALIZED Not initialized * @retval #AUTOFILL_ERROR_OPERATION_FAILED Operation failure */ -int autofill_connect(autofill_connection_status_changed_cb callback, void *user_data); +int autofill_connect(autofill_h ah, autofill_connection_status_changed_cb callback, void *user_data); /** * @brief Requests of authentication information. * @since_tizen 5.5 + * @param[in] ah The autofill handle * @param[in] vi The autofill view info handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #AUTOFILL_ERROR_NOT_INITIALIZED Not initialized * @retval #AUTOFILL_ERROR_OPERATION_FAILED Operation failure */ -int autofill_auth_info_request(autofill_view_info_h vi); +int autofill_auth_info_request(autofill_h ah, autofill_view_info_h vi); /** * @brief Sets the callback to receive the authentication information. * @since_tizen 5.5 + * @param[in] ah The autofill handle * @param[in] callback The callback function to register * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter + * @see autofill_auth_info_unset_received_cb() */ -int autofill_auth_info_set_received_cb(autofill_auth_info_received_cb callback, void *user_data); +int autofill_auth_info_set_received_cb(autofill_h ah, autofill_auth_info_received_cb callback, void *user_data); /** * @brief Unsets the callback to receive the authentication information. * @since_tizen 5.5 + * @param[in] ah The autofill handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter + * @see autofill_auth_info_set_received_cb() */ -int autofill_auth_info_unset_received_cb(void); +int autofill_auth_info_unset_received_cb(autofill_h ah); /** * @brief Sends fill request to fill out each input form. * @since_tizen 5.5 + * @param[in] ah The autofill handle * @param[in] vi The autofill view info handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #AUTOFILL_ERROR_NOT_INITIALIZED Not initialized * @retval #AUTOFILL_ERROR_OPERATION_FAILED Operation failure */ -int autofill_fill_request(autofill_view_info_h vi); +int autofill_fill_request(autofill_h ah, autofill_view_info_h vi); /** * @brief Sets the callback to receive autofill fill response. * @since_tizen 5.5 + * @param[in] ah The autofill handle * @param[in] callback The callback function to register * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter + * @see autofill_fill_response_unset_received_cb() */ -int autofill_fill_response_set_received_cb(autofill_fill_response_received_cb callback, void *user_data); +int autofill_fill_response_set_received_cb(autofill_h ah, autofill_fill_response_received_cb callback, void *user_data); /** * @brief Unsets the callback to receive autofill fill response. * @since_tizen 5.5 + * @param[in] ah The autofill handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error + * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ -int autofill_fill_response_unset_received_cb(void); +int autofill_fill_response_unset_received_cb(autofill_h ah); /** * @brief Sends the autofill save view info. * @since_tizen 5.5 + * @param[in] ah The autofill handle * @param[in] vi The autofill save view info handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #AUTOFILL_ERROR_NOT_INITIALIZED Not initialized * @retval #AUTOFILL_ERROR_OPERATION_FAILED Operation failure */ -int autofill_commit(autofill_save_view_info_h vi); +int autofill_commit(autofill_h ah, autofill_save_view_info_h vi); /** * @} diff --git a/include/autofill_private.h b/include/autofill_private.h index 435092a..3ca6f28 100644 --- a/include/autofill_private.h +++ b/include/autofill_private.h @@ -18,6 +18,23 @@ #define __TIZEN_UIX_AUTOFILL_PRIVATE_H__ #include +#include "autofill.h" +#include "../client/autofill_proxy.h" + +struct autofill_s { + rpc_port_proxy_AutofillAppPort_h rpc_h; + + unsigned int context_id; + + autofill_connection_status_changed_cb connection_callback; + void *connection_userdata; + + autofill_fill_response_received_cb autofill_fill_response_received_cb; + void *autofill_fill_response_data; + + autofill_auth_info_received_cb autofill_auth_info_received_cb; + void *autofill_auth_info_data; +}; struct autofill_view_info_s { char *app_id; // app ID @@ -41,4 +58,4 @@ struct autofill_fill_response_group_s { Eina_List *autofill_fill_response_item_list; // autofill_fill_response_item_h list }; -#endif /* __TIZEN_UIX_AUTOFILL_PRIVATE_H__ */ +#endif /* __TIZEN_UIX_AUTOFILL_PRIVATE_H__ */ \ No newline at end of file diff --git a/include/autofill_service.h b/include/autofill_service.h index e6f103a..8bcdcac 100644 --- a/include/autofill_service.h +++ b/include/autofill_service.h @@ -37,31 +37,34 @@ extern "C" { * @brief Called when receiving authentication information request. * @since_tizen 5.5 * @remarks @a vi should not be freed and can be used only in the callback. + * @param[in] context_id The autofill context identification value of an associated autofill client handle * @param[in] vi The autofill view info handle * @param[in] user_data The user data passed from the callback function * @see autofill_service_set_auth_info_requested_cb() */ -typedef void (*autofill_service_auth_info_requested_cb)(autofill_view_info_h vi, void *user_data); +typedef void (*autofill_service_auth_info_requested_cb)(int context_id, autofill_view_info_h vi, void *user_data); /** * @brief Called when receiving fill request. * @since_tizen 5.5 * @remarks @a vi should not be freed and can be used only in the callback. + * @param[in] context_id The autofill context identification value of an associated autofill client handle * @param[in] vi The autofill view info handle * @param[in] user_data The user data passed from the callback function * @see autofill_service_set_auth_info_requested_cb() */ -typedef void (*autofill_service_fill_requested_cb)(autofill_view_info_h vi, void *user_data); +typedef void (*autofill_service_fill_requested_cb)(int context_id, autofill_view_info_h vi, void *user_data); /** * @brief Called when receiving commit request. * @since_tizen 5.5 * @remarks @a vi should not be freed and can be used only in the callback. + * @param[in] context_id The autofill context identification value of an associated autofill client handle * @param[in] vi The autofill save view info handle * @param[in] user_data The user data passed from the callback function * @see autofill_service_set_commited_cb() */ -typedef void (*autofill_service_commited_cb)(autofill_save_view_info_h vi, void *user_data); +typedef void (*autofill_service_commited_cb)(int context_id, autofill_save_view_info_h vi, void *user_data); /** * @brief Called when receiving terminate request. @@ -109,12 +112,13 @@ int autofill_service_unset_auth_info_requested_cb(void); /** * @brief Sends the authentication information. * @since_tizen 5.5 + * @param[in] context_id The autofill context identification value of an associated autofill client handle * @param[in] h The autofill authentication info handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ -int autofill_service_send_auth_info(autofill_auth_info_h h); +int autofill_service_send_auth_info(int context_id, autofill_auth_info_h h); /** * @brief Sets the callback to receive the fill request. @@ -138,12 +142,13 @@ int autofill_service_unset_fill_requested_cb(void); /** * @brief Sends the fill response. * @since_tizen 5.5 + * @param[in] context_id The autofill context identification value of an associated autofill client handle * @param[in] h The autofill fill response handle * @return 0 on success, otherwise a negative error value * @retval #AUTOFILL_ERROR_NONE No error * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter */ -int autofill_service_send_fill_response(autofill_fill_response_h h); +int autofill_service_send_fill_response(int context_id, autofill_fill_response_h h); /** * @brief Sets the callback to receive the commit request. diff --git a/server/main.c b/server/main.c index 57792b6..dd03fc0 100644 --- a/server/main.c +++ b/server/main.c @@ -33,12 +33,13 @@ #define LOG_TAG "AUTOFILL_DAEMON" -static rpc_port_proxy_AutofillSvcPort_h rpc_h = NULL; +static rpc_port_proxy_AutofillSvcPort_h svc_rpc_h = NULL; static int connect_service(); typedef struct { 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; @@ -47,7 +48,7 @@ typedef struct { static GList *__client_list = NULL; static autofill_client_s * -get_autofill_client(const char *app_id) +get_autofill_client(const char *app_id, int context_id) { GList *iter; autofill_client_s *client; @@ -63,7 +64,8 @@ get_autofill_client(const char *app_id) continue; } - if (client->app_id && strcmp(client->app_id, app_id) == 0) { + if ((client->context_id == context_id) && + client->app_id && strcmp(client->app_id, app_id) == 0) { return client; } } @@ -71,7 +73,7 @@ get_autofill_client(const char *app_id) return NULL; } -static autofill_client_s *__create_client(const char *app_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) { @@ -91,6 +93,8 @@ static autofill_client_s *__create_client(const char *app_id, return NULL; } + handle->context_id = context_id; + rpc_port_AutofillAppPort_autofill_auth_info_received_cb_clone(auth_info_cb, &handle->auth_info_cb); if (!handle->auth_info_cb) { LOGE("Out of memory"); @@ -163,7 +167,7 @@ static void __message_create(rpc_port_stub_AutofillAppPort_context_h context, if (!sender) return; - LOGD("[__RPC_PORT__] sender(%s)", sender); + LOGD("sender(%s)", sender); free(sender); } @@ -183,7 +187,7 @@ 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, 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, void *user_data) { LOGD(""); char *sender = NULL; @@ -195,7 +199,7 @@ static int __message_register(rpc_port_stub_AutofillAppPort_context_h context, r LOGD("sender(%s)", sender); - client = __create_client(sender, auth_info_cb, fill_response_received_cb); + client = __create_client(sender, context_id, auth_info_cb, fill_response_received_cb); free(sender); if (!client) @@ -208,7 +212,7 @@ static int __message_register(rpc_port_stub_AutofillAppPort_context_h context, r return 0; } -static void __message_unregister(rpc_port_stub_AutofillAppPort_context_h context, void *user_data) +static void __message_unregister(rpc_port_stub_AutofillAppPort_context_h context, int context_id, void *user_data) { __remove_client(context); } @@ -325,12 +329,12 @@ bool __save_item_cb(rpc_port_autofill_save_item_h items, void *user_data) return true; } -static int __auth_info_request_cb(rpc_port_stub_AutofillAppPort_context_h context, rpc_port_autofill_view_info_h vi, void *user_data) +static int __auth_info_request_cb(rpc_port_stub_AutofillAppPort_context_h context, int context_id, rpc_port_autofill_view_info_h vi, void *user_data) { char *sender = NULL; autofill_client_s *sender_client; - if (!rpc_h) { + if (!svc_rpc_h) { LOGW("Not initialized"); return -1; } @@ -351,7 +355,7 @@ static int __auth_info_request_cb(rpc_port_stub_AutofillAppPort_context_h contex rpc_port_autofill_view_info_foreach_items(vi, __view_info_item_cb, svi); - rpc_port_proxy_AutofillSvcPort_invoke_request_auth_info(rpc_h, svi); + rpc_port_proxy_AutofillSvcPort_invoke_request_auth_info(svc_rpc_h, context_id, svi); if (sender) { free(sender); @@ -366,12 +370,12 @@ static int __auth_info_request_cb(rpc_port_stub_AutofillAppPort_context_h contex return 0; } -static int __autofill_fill_request_cb(rpc_port_stub_AutofillAppPort_context_h context, rpc_port_autofill_view_info_h vi, void *user_data) +static int __autofill_fill_request_cb(rpc_port_stub_AutofillAppPort_context_h context, int context_id, rpc_port_autofill_view_info_h vi, void *user_data) { char *sender = NULL; char *view_id = NULL; - if (!rpc_h) { + if (!svc_rpc_h) { LOGW("Not initialized"); return -1; } @@ -379,7 +383,7 @@ static int __autofill_fill_request_cb(rpc_port_stub_AutofillAppPort_context_h co rpc_port_stub_AutofillAppPort_context_get_sender(context, &sender); rpc_port_autofill_view_info_get_view_id(vi, &view_id); - LOGD("app id : %s, view id : %s", sender, view_id); + LOGD("app id : %s, view id : %s, context id : %d", sender, view_id, context_id); rpc_port_autofill_svc_view_info_h svi; rpc_port_autofill_svc_view_info_create(&svi); @@ -388,7 +392,7 @@ static int __autofill_fill_request_cb(rpc_port_stub_AutofillAppPort_context_h co rpc_port_autofill_view_info_foreach_items(vi, __view_info_item_cb, svi); - rpc_port_proxy_AutofillSvcPort_invoke_send_fill_request(rpc_h, svi); + rpc_port_proxy_AutofillSvcPort_invoke_send_fill_request(svc_rpc_h, context_id, svi); if (sender) free(sender); @@ -401,12 +405,12 @@ static int __autofill_fill_request_cb(rpc_port_stub_AutofillAppPort_context_h co return 0; } -static int __commit_cb(rpc_port_stub_AutofillAppPort_context_h context, rpc_port_autofill_save_view_info_h vi, void *user_data) +static int __commit_cb(rpc_port_stub_AutofillAppPort_context_h context, int context_id, rpc_port_autofill_save_view_info_h vi, void *user_data) { char *sender = NULL; autofill_client_s *sender_client; - if (!rpc_h) { + if (!svc_rpc_h) { LOGW("Not initialized"); return -1; } @@ -430,7 +434,7 @@ static int __commit_cb(rpc_port_stub_AutofillAppPort_context_h context, rpc_port rpc_port_stub_AutofillAppPort_context_get_tag(context, (void *)&sender_client); rpc_port_autofill_save_view_info_foreach_items(vi, __save_item_cb, svi); - rpc_port_proxy_AutofillSvcPort_invoke_commit(rpc_h, svi); + rpc_port_proxy_AutofillSvcPort_invoke_commit(svc_rpc_h, context_id, svi); if (view_id) free(view_id); @@ -495,7 +499,7 @@ bool fill_response_group_cb(rpc_port_autofill_svc_response_group_h response_grou return true; } -static void __fill_response_recv_cb(void *user_data, rpc_port_autofill_svc_fill_response_h response_h) +static void __fill_response_recv_cb(void *user_data, int context_id, rpc_port_autofill_svc_fill_response_h response_h) { // recv fill response from service char *view_id = NULL; @@ -512,7 +516,7 @@ static void __fill_response_recv_cb(void *user_data, rpc_port_autofill_svc_fill_ rpc_port_autofill_svc_fill_response_foreach_response_groups(response_h, fill_response_group_cb, fill_response_h); - autofill_client_s *sender_client = get_autofill_client(app_id); + autofill_client_s *sender_client = get_autofill_client(app_id, context_id); if (sender_client) rpc_port_AutofillAppPort_autofill_fill_response_received_cb_invoke(sender_client->fill_response_received_cb, fill_response_h); @@ -525,7 +529,7 @@ static void __fill_response_recv_cb(void *user_data, rpc_port_autofill_svc_fill_ free(view_id); } -static void __auth_info_recv_cb(void *user_data, rpc_port_autofill_svc_auth_info_h svc_auth_info_h) +static void __auth_info_recv_cb(void *user_data, int context_id, rpc_port_autofill_svc_auth_info_h svc_auth_info_h) { bool exist_autofill_data; bool need_authentication; @@ -555,7 +559,7 @@ static void __auth_info_recv_cb(void *user_data, rpc_port_autofill_svc_auth_info rpc_port_autofill_auth_info_set_service_message(auth_info_h, service_message); rpc_port_autofill_auth_info_set_service_logo_image_path(auth_info_h, service_logo_image_path); - autofill_client_s *sender_client = get_autofill_client(app_id); + autofill_client_s *sender_client = get_autofill_client(app_id, context_id); if (sender_client) rpc_port_AutofillAppPort_autofill_auth_info_received_cb_invoke(sender_client->auth_info_cb, auth_info_h); @@ -594,7 +598,7 @@ static void __on_disconnected(rpc_port_proxy_AutofillSvcPort_h h, void *user_dat { LOGD("disconnected"); - rpc_h = NULL; + svc_rpc_h = NULL; } static void __on_rejected(rpc_port_proxy_AutofillSvcPort_h h, void *user_data) @@ -610,16 +614,16 @@ static bool __manager_set_autofill_service_cb(rpc_port_stub_AutofillManagerPort_ if (app_id) autofill_config_set_autofill_service_app_id(app_id); - if (rpc_h) { + if (svc_rpc_h) { LOGD("send terminate"); // terminate service - rpc_port_proxy_AutofillSvcPort_invoke_request_terminate(rpc_h); + rpc_port_proxy_AutofillSvcPort_invoke_request_terminate(svc_rpc_h); - int ret = rpc_port_proxy_AutofillSvcPort_destroy(rpc_h); + int ret = rpc_port_proxy_AutofillSvcPort_destroy(svc_rpc_h); LOGD("ret : %d", ret); } - rpc_h = NULL; + svc_rpc_h = NULL; connect_service(); @@ -628,7 +632,7 @@ static bool __manager_set_autofill_service_cb(rpc_port_stub_AutofillManagerPort_ static char * __manager_get_autofill_service_cb(rpc_port_stub_AutofillManagerPort_context_h context, void *user_data) { - if (!rpc_h) { + if (!svc_rpc_h) { LOGW("Not initialized"); return false; } @@ -709,7 +713,7 @@ static int connect_service() .rejected = __on_rejected }; - if (rpc_h) { + if (svc_rpc_h) { LOGI("already connected\n"); return RPC_PORT_ERROR_NONE; } @@ -727,7 +731,7 @@ static int connect_service() service_id_len = strlen(active_autofill_service_id); if (service_id_len > 0) { - ret = rpc_port_proxy_AutofillSvcPort_create(active_autofill_service_id, &rpc_callback, NULL, &rpc_h); + ret = rpc_port_proxy_AutofillSvcPort_create(active_autofill_service_id, &rpc_callback, NULL, &svc_rpc_h); } free(active_autofill_service_id); @@ -742,7 +746,7 @@ static int connect_service() } } - ret = rpc_port_proxy_AutofillSvcPort_connect(rpc_h); + ret = rpc_port_proxy_AutofillSvcPort_connect(svc_rpc_h); if (ret != RPC_PORT_ERROR_NONE) { LOGW("Failed to connect. err = %d", ret); return false; diff --git a/service_lib/autofill_service.c b/service_lib/autofill_service.c index 6bee76f..f81e778 100644 --- a/service_lib/autofill_service.c +++ b/service_lib/autofill_service.c @@ -154,7 +154,7 @@ bool __save_item_cb(rpc_port_autofill_svc_save_item_h items, void *user_data) return true; } -static void __auth_info_request_cb(rpc_port_stub_AutofillSvcPort_context_h context, rpc_port_autofill_svc_view_info_h vi, void *user_data) +static void __auth_info_request_cb(rpc_port_stub_AutofillSvcPort_context_h context, int context_id, rpc_port_autofill_svc_view_info_h vi, void *user_data) { char *sender = NULL; @@ -178,7 +178,7 @@ static void __auth_info_request_cb(rpc_port_stub_AutofillSvcPort_context_h conte rpc_port_autofill_svc_view_info_foreach_items(vi, __autofill_item_cb, view_info); if (g_autofill_service_auth_info_requested_cb) - g_autofill_service_auth_info_requested_cb(view_info, g_autofill_service_auth_info_request_data); + g_autofill_service_auth_info_requested_cb(context_id, view_info, g_autofill_service_auth_info_request_data); autofill_view_info_destroy(view_info); @@ -189,7 +189,7 @@ static void __auth_info_request_cb(rpc_port_stub_AutofillSvcPort_context_h conte free(app_id); } -static void __autofill_fill_request_cb(rpc_port_stub_AutofillSvcPort_context_h context, rpc_port_autofill_svc_view_info_h vi, void *user_data) +static void __autofill_fill_request_cb(rpc_port_stub_AutofillSvcPort_context_h context, int context_id, rpc_port_autofill_svc_view_info_h vi, void *user_data) { char *app_id = NULL; char *view_id = NULL; @@ -207,7 +207,7 @@ static void __autofill_fill_request_cb(rpc_port_stub_AutofillSvcPort_context_h c rpc_port_autofill_svc_view_info_foreach_items(vi, __autofill_item_cb, view_info); if (g_autofill_service_fill_requested_cb) - g_autofill_service_fill_requested_cb(view_info, g_autofill_service_auth_info_request_data); + g_autofill_service_fill_requested_cb(context_id, view_info, g_autofill_service_auth_info_request_data); autofill_view_info_destroy(view_info); @@ -218,7 +218,7 @@ static void __autofill_fill_request_cb(rpc_port_stub_AutofillSvcPort_context_h c free(view_id); } -static void __autofill_commit_cb(rpc_port_stub_AutofillSvcPort_context_h context, rpc_port_autofill_svc_save_view_info_h vi, void *user_data) +static void __autofill_commit_cb(rpc_port_stub_AutofillSvcPort_context_h context, int context_id, rpc_port_autofill_svc_save_view_info_h vi, void *user_data) { char *view_id = NULL; rpc_port_autofill_svc_save_view_info_get_view_id(vi, &view_id); @@ -233,7 +233,7 @@ static void __autofill_commit_cb(rpc_port_stub_AutofillSvcPort_context_h context rpc_port_autofill_svc_save_view_info_foreach_items(vi, __save_item_cb, view_info); if (g_autofill_service_commited_cb) - g_autofill_service_commited_cb(view_info, g_autofill_service_commit_data); + g_autofill_service_commited_cb(context_id, view_info, g_autofill_service_commit_data); autofill_save_view_info_destroy(view_info); @@ -428,8 +428,10 @@ EXPORT_API int autofill_service_deinitialize(void) EXPORT_API int autofill_service_set_auth_info_requested_cb(autofill_service_auth_info_requested_cb callback, void *user_data) { - if (!callback) + if (!callback) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } g_autofill_service_auth_info_requested_cb = callback; g_autofill_service_auth_info_request_data = user_data; @@ -445,7 +447,7 @@ EXPORT_API int autofill_service_unset_auth_info_requested_cb() return AUTOFILL_ERROR_NONE; } -EXPORT_API int autofill_service_send_auth_info(autofill_auth_info_h h) +EXPORT_API int autofill_service_send_auth_info(int context_id, autofill_auth_info_h h) { bool autofill_data_present = false; bool authentication_needed = false; @@ -457,7 +459,7 @@ EXPORT_API int autofill_service_send_auth_info(autofill_auth_info_h h) int ret = AUTOFILL_ERROR_NONE; if (!h) { - LOGW("parameter is NULL"); + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; } @@ -482,7 +484,7 @@ EXPORT_API int autofill_service_send_auth_info(autofill_auth_info_h h) rpc_port_autofill_svc_auth_info_set_service_message(auth_info_h, service_message); rpc_port_autofill_svc_auth_info_set_service_logo_image_path(auth_info_h, service_logo_image_path); - ret = rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_invoke(g_auth_info_cb, auth_info_h); + ret = rpc_port_AutofillSvcPort_autofill_svc_auth_info_cb_invoke(g_auth_info_cb, context_id, auth_info_h); if (app_id) free(app_id); @@ -507,8 +509,10 @@ EXPORT_API int autofill_service_send_auth_info(autofill_auth_info_h h) // fill request EXPORT_API int autofill_service_set_fill_requested_cb(autofill_service_fill_requested_cb callback, void *user_data) { - if (!callback) - return AUTOFILL_ERROR_INVALID_PARAMETER; + if (!callback) { + LOGW("[ERROR] Invalid parameter"); + return AUTOFILL_ERROR_INVALID_PARAMETER; + } g_autofill_service_fill_requested_cb = callback; g_autofill_service_fill_request_data = user_data; @@ -567,7 +571,7 @@ bool __fill_response_item_cb(autofill_fill_response_item_h it, void * user_data) return true; } -EXPORT_API int autofill_service_send_fill_response(autofill_fill_response_h h) +EXPORT_API int autofill_service_send_fill_response(int context_id, autofill_fill_response_h h) { /* create autofill response */ rpc_port_autofill_svc_fill_response_h fill_response_h; @@ -577,7 +581,7 @@ EXPORT_API int autofill_service_send_fill_response(autofill_fill_response_h h) autofill_fill_response_group_h it; if (!h) { - LOGW("parameter is NULL"); + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; } @@ -602,7 +606,7 @@ EXPORT_API int autofill_service_send_fill_response(autofill_fill_response_h h) rpc_port_autofill_svc_response_group_destroy(res_group_h); } - ret = rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_invoke(g_fill_response_received_cb, fill_response_h); + ret = rpc_port_AutofillSvcPort_autofill_svc_fill_response_cb_invoke(g_fill_response_received_cb, context_id, fill_response_h); rpc_port_autofill_svc_fill_response_destroy(fill_response_h); @@ -611,8 +615,10 @@ EXPORT_API int autofill_service_send_fill_response(autofill_fill_response_h h) EXPORT_API int autofill_service_set_commited_cb(autofill_service_commited_cb callback, void *user_data) { - if (!callback) + if (!callback) { + LOGW("[ERROR] Invalid parameter"); return AUTOFILL_ERROR_INVALID_PARAMETER; + } g_autofill_service_commited_cb = callback; g_autofill_service_commit_data = user_data; diff --git a/tidl/autofill.tidl b/tidl/autofill.tidl index 536c7f4..8c3d185 100644 --- a/tidl/autofill.tidl +++ b/tidl/autofill.tidl @@ -52,10 +52,10 @@ struct autofill_fill_response { 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(autofill_auth_info_received_cb auth_info_cb, autofill_fill_response_received_cb fill_response_cb); - void Unregister() async; + int Register(int context_id, autofill_auth_info_received_cb auth_info_cb, autofill_fill_response_received_cb fill_response_cb); + void Unregister(int context_id) async; - int request_auth_info(autofill_view_info vi); - int send_fill_request(autofill_view_info vi); - int commit(autofill_save_view_info vi); + int request_auth_info(int context_id, autofill_view_info vi); + int send_fill_request(int context_id, autofill_view_info vi); + int commit(int context_id, autofill_save_view_info vi); } diff --git a/tidl/autofill_service.tidl b/tidl/autofill_service.tidl index f1423fd..43b9d9f 100644 --- a/tidl/autofill_service.tidl +++ b/tidl/autofill_service.tidl @@ -53,13 +53,13 @@ struct autofill_svc_fill_response { } interface AutofillSvcPort { - void autofill_svc_auth_info_cb(autofill_svc_auth_info auth_info) delegate; - void autofill_svc_fill_response_cb(autofill_svc_fill_response response) delegate; + 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 Unregister() async; - void request_auth_info(autofill_svc_view_info vi) async; - void send_fill_request(autofill_svc_view_info vi) async; - void commit(autofill_svc_save_view_info si) async; + void request_auth_info(int context_id, autofill_svc_view_info vi) async; + void send_fill_request(int context_id, autofill_svc_view_info vi) async; + void commit(int context_id, autofill_svc_save_view_info si) async; void request_terminate() async; } -- 2.7.4