return AUTOFILL_ERROR_NONE;
}
+EXPORT_API int autofill_cancel_fill_request(autofill_h ah, autofill_view_info_h vi)
+{
+ int ret = AUTOFILL_ERROR_NONE;
+ rpc_port_autofill_view_info_h vih = NULL;
+ char *id = NULL;
+ char *label = NULL;
+ autofill_hint_e autofill_hint;
+ bool sensitive_data = false;
+ Eina_List *l = NULL;
+ autofill_item_h it = NULL;
+
+ if (!ah || !vi) {
+ LOGW("[ERROR] Invalid parameter");
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!ah->rpc_h) {
+ return AUTOFILL_ERROR_OPERATION_FAILED;
+ }
+
+ if (!ah->connected) {
+ LOGW("[ERROR] Not connected");
+ return AUTOFILL_ERROR_OPERATION_FAILED;
+ }
+
+ rpc_port_autofill_view_info_create(&vih);
+ rpc_port_autofill_view_info_set_view_id(vih, vi->view_id);
+
+ EINA_LIST_FOREACH(vi->autofill_item_list, l, it)
+ {
+ autofill_item_get_id(it, &id);
+ autofill_item_get_label(it, &label);
+ autofill_item_get_autofill_hint(it, &autofill_hint);
+ autofill_item_get_sensitive_data(it, &sensitive_data);
+
+ LOGD("it : %p, id : %s, label : %s, hint : %d, sensitive : %d", it, id, label, autofill_hint, sensitive_data);
+
+ rpc_port_autofill_item_h aih;
+ rpc_port_autofill_item_create(&aih);
+ rpc_port_autofill_item_set_id(aih, id);
+ rpc_port_autofill_item_set_label(aih, label);
+ rpc_port_autofill_item_set_autofill_hint(aih, (int)autofill_hint);
+ rpc_port_autofill_item_set_is_sensitive_data(aih, sensitive_data);
+
+ rpc_port_autofill_view_info_add_items(vih, aih);
+
+ if (id) {
+ free(id);
+ id = NULL;
+ }
+
+ if (label) {
+ free(label);
+ label = NULL;
+ }
+
+ rpc_port_autofill_item_destroy(aih);
+ }
+
+ 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_cancel_fill_request(ah->rpc_h, ah->context_id, vih);
+
+ rpc_port_autofill_view_info_destroy(vih);
+
+ if (ret != RPC_PORT_ERROR_NONE) {
+ LOGW("[ERROR] Failed to cancel fill request. rpc err = %d", ret);
+ return AUTOFILL_ERROR_OPERATION_FAILED;
+ }
+ else
+ return AUTOFILL_ERROR_NONE;
+}
+
EXPORT_API int autofill_fill_response_set_received_cb(autofill_h ah, autofill_fill_response_received_cb callback, void *user_data)
{
if (!ah || !callback) {
ah->autofill_fill_response_data = NULL;
return AUTOFILL_ERROR_NONE;
-}
+}
\ No newline at end of file
* @retval #AUTOFILL_ERROR_NONE No error
* @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #AUTOFILL_ERROR_OPERATION_FAILED Operation failure
+ * @see autofill_cancel_fill_request()
*/
int autofill_fill_request(autofill_h ah, autofill_view_info_h vi);
/**
+ * @brief Cancels 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_OPERATION_FAILED Operation failure
+ * @see autofill_fill_request()
+ */
+int autofill_cancel_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
typedef void (*autofill_service_fill_requested_cb)(int context_id, autofill_view_info_h vi, void *user_data);
/**
+ * @brief Called when receiving the cancellation of 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_cancel_fill_requested_cb()
+ */
+typedef void (*autofill_service_cancel_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.
int autofill_service_unset_fill_requested_cb(void);
/**
+ * @brief Sets the callback to receive the cancellation of fill request.
+ * @since_tizen 5.5
+ * @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
+ */
+int autofill_service_set_cancel_fill_requested_cb(autofill_service_cancel_fill_requested_cb callback, void *user_data);
+
+/**
+ * @brief Unsets the callback to receive the cancellation of fill request.
+ * @since_tizen 5.5
+ * @return 0 on success, otherwise a negative error value
+ * @retval #AUTOFILL_ERROR_NONE No error
+ */
+int autofill_service_unset_cancel_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
static autofill_service_fill_requested_cb g_autofill_service_fill_requested_cb = NULL;
static void *g_autofill_service_fill_request_data = NULL;
+static autofill_service_cancel_fill_requested_cb g_autofill_service_cancel_fill_requested_cb = NULL;
+static void *g_autofill_service_cancel_fill_request_data = NULL;
+
static autofill_service_auth_info_requested_cb g_autofill_service_auth_info_requested_cb = NULL;
static void *g_autofill_service_auth_info_request_data = NULL;
free(view_id);
}
+static void __autofill_cancel_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;
+
+ rpc_port_autofill_svc_view_info_get_app_id(vi, &app_id);
+ rpc_port_autofill_svc_view_info_get_view_id(vi, &view_id);
+
+ LOGD("app id : %s, view id : %s", app_id, view_id);
+
+ autofill_view_info_h view_info;
+ autofill_view_info_create(&view_info);
+ autofill_view_info_set_app_id(view_info, app_id);
+ autofill_view_info_set_view_id(view_info, view_id);
+
+ rpc_port_autofill_svc_view_info_foreach_items(vi, __autofill_item_cb, view_info);
+
+ if (g_autofill_service_cancel_fill_requested_cb)
+ g_autofill_service_cancel_fill_requested_cb(context_id, view_info, g_autofill_service_cancel_fill_request_data);
+
+ autofill_view_info_destroy(view_info);
+
+ if (app_id)
+ free(app_id);
+
+ if (view_id)
+ free(view_id);
+}
+
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 *app_id = NULL;
__auth_info_request_cb,
__autofill_fill_request_cb,
__autofill_commit_cb,
- __terminate_received_cb
+ __terminate_received_cb,
+ __autofill_cancel_fill_request_cb,
};
ret = rpc_port_stub_AutofillSvcPort_register(&callback, NULL);
return AUTOFILL_ERROR_NONE;
}
+// cancel fill request
+EXPORT_API int autofill_service_set_cancel_fill_requested_cb(autofill_service_cancel_fill_requested_cb callback, void *user_data)
+{
+ if (!callback) {
+ LOGW("[ERROR] Invalid parameter");
+ return AUTOFILL_ERROR_INVALID_PARAMETER;
+ }
+
+ g_autofill_service_cancel_fill_requested_cb = callback;
+ g_autofill_service_cancel_fill_request_data = user_data;
+
+ return AUTOFILL_ERROR_NONE;
+}
+
+EXPORT_API int autofill_service_unset_cancel_fill_requested_cb()
+{
+ g_autofill_service_cancel_fill_requested_cb = NULL;
+ g_autofill_service_cancel_fill_request_data = NULL;
+
+ return AUTOFILL_ERROR_NONE;
+}
+
bool __fill_response_item_cb(autofill_fill_response_item_h it, void * user_data)
{
char *id = NULL;
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);
+ int cancel_fill_request(int context_id, autofill_view_info vi);
}
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;
+ void cancel_fill_request(int context_id, autofill_svc_view_info vi) async;
}