From: Jihoon Kim Date: Tue, 19 Mar 2019 07:31:38 +0000 (+0900) Subject: Remove error message API in error info X-Git-Tag: submit/tizen/20190319.101836~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F57%2F201757%2F3;p=platform%2Fcore%2Fuifw%2Fautofill.git Remove error message API in error info Change-Id: I672aa58e0f81d25166ae72e1ea64b8f71af49706 Signed-off-by: Jihoon Kim --- diff --git a/client/autofill.c b/client/autofill.c index e132663..768392b 100644 --- a/client/autofill.c +++ b/client/autofill.c @@ -188,26 +188,20 @@ static void __error_info_recv_cb(void *user_data, rpc_port_autofill_error_info_h int error_code = 0; char *app_id = NULL; - char *error_message = NULL; autofill_error_info_create(&eih); rpc_port_autofill_error_info_get_app_id(error_info_h, &app_id); rpc_port_autofill_error_info_get_error_code(error_info_h, &error_code); - rpc_port_autofill_error_info_get_error_message(error_info_h, &error_message); autofill_error_info_set_app_id(eih, app_id); autofill_error_info_set_error_code(eih, error_code); - autofill_error_info_set_error_message(eih, error_message); - LOGD("error code : %d, message : %s", error_code, error_message); + LOGD("error code : %x", error_code); if (app_id) free(app_id); - if (error_message) - free(error_message); - if (ah) { if (ah->autofill_error_info_received_cb) ah->autofill_error_info_received_cb(ah, eih, ah->autofill_error_info_data); diff --git a/common/autofill_error_info.c b/common/autofill_error_info.c new file mode 100644 index 0000000..cc74991 --- /dev/null +++ b/common/autofill_error_info.c @@ -0,0 +1,109 @@ +/* + * 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 +#include +#include +#include +#include + +#include "autofill_private.h" +#include + +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "AUTOFILL" + +struct autofill_error_info_s { + char *app_id; + autofill_error_e error_code; +}; + +EXPORT_API int autofill_error_info_create(autofill_error_info_h *ei) +{ + if (!ei) + return AUTOFILL_ERROR_INVALID_PARAMETER; + + struct autofill_error_info_s *eis = (autofill_error_info_h)calloc(1, sizeof(struct autofill_error_info_s)); + if (!eis) + return AUTOFILL_ERROR_OUT_OF_MEMORY; + + *ei = (autofill_error_info_h)eis; + + return AUTOFILL_ERROR_NONE; +} + +EXPORT_API int autofill_error_info_destroy(autofill_error_info_h ei) +{ + if (!ei) + return AUTOFILL_ERROR_INVALID_PARAMETER; + + if (ei->app_id) { + free(ei->app_id); + ei->app_id = NULL; + } + + free(ei); + + return AUTOFILL_ERROR_NONE; +} + +EXPORT_API int autofill_error_info_set_error_code(autofill_error_info_h ei, autofill_error_e error_code) +{ + if (!ei) + return AUTOFILL_ERROR_INVALID_PARAMETER; + + ei->error_code = error_code; + + return AUTOFILL_ERROR_NONE; +} + +EXPORT_API int autofill_error_info_get_error_code(autofill_error_info_h ei, autofill_error_e *error_code) +{ + if (!ei || !error_code) + return AUTOFILL_ERROR_INVALID_PARAMETER; + + *error_code = ei->error_code; + + return AUTOFILL_ERROR_NONE; +} + +EXPORT_API int autofill_error_info_set_app_id(autofill_error_info_h ei, const char *app_id) +{ + if (!ei || !app_id) + return AUTOFILL_ERROR_INVALID_PARAMETER; + + if (ei->app_id) + free(ei->app_id); + + ei->app_id = strdup(app_id); + + return AUTOFILL_ERROR_NONE; +} + +EXPORT_API int autofill_error_info_get_app_id(autofill_error_info_h ei, char **app_id) +{ + if (!ei || !app_id) + return AUTOFILL_ERROR_INVALID_PARAMETER; + + if (!ei->app_id) + return AUTOFILL_ERROR_OPERATION_FAILED; + + *app_id = strdup(ei->app_id); + + return AUTOFILL_ERROR_NONE; +} diff --git a/include/autofill_common.h b/include/autofill_common.h index fb57863..8ab7ed6 100644 --- a/include/autofill_common.h +++ b/include/autofill_common.h @@ -1173,30 +1173,6 @@ int autofill_error_info_set_error_code(autofill_error_info_h ei, autofill_error_ */ int autofill_error_info_get_error_code(autofill_error_info_h ei, autofill_error_e *error_code); -/** - * @brief Sets the error message in autofill error information. - * @since_tizen 5.5 - * @param[in] ei The autofill error information handle - * @param[in] error_message The autofill error message - * @return 0 on success, otherwise a negative error value - * @retval #AUTOFILL_ERROR_NONE No error - * @retval #AUTOFILL_ERROR_INVALID_PARAMETER Invalid parameter - */ -int autofill_error_info_set_error_message(autofill_error_info_h ei, const char *error_message); - -/** - * @brief Gets the error message in autofill error information. - * @since_tizen 5.5 - * @remarks @a error_message must be released using free(). - * @param[in] ei The autofill error information handle - * @param[out] error_message The autofill error message - * @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 - */ -int autofill_error_info_get_error_message(autofill_error_info_h ei, char **error_message); - /** * @} */ diff --git a/include/autofill_error.h b/include/autofill_error.h index 676ed5e..0132094 100644 --- a/include/autofill_error.h +++ b/include/autofill_error.h @@ -46,6 +46,10 @@ typedef enum { AUTOFILL_ERROR_AUTHENTICATION_FAILED = TIZEN_ERROR_AUTOFILL | 0x0003, /**< Authentication failed */ AUTOFILL_ERROR_COMMIT_FAILED = TIZEN_ERROR_AUTOFILL | 0x0004, /**< Failed to save autofill data */ AUTOFILL_ERROR_FILL_RESPONSE_FAILED = TIZEN_ERROR_AUTOFILL | 0x0005, /**< Failed to response fill request */ + AUTOFILL_ERROR_SERVICE_NOT_CONNECTED = TIZEN_ERROR_AUTOFILL | 0x0006, /**< Unable to connect to Autofill Service */ + AUTOFILL_ERROR_SERVICE_NOT_ALLOWED = TIZEN_ERROR_AUTOFILL | 0x0007, /**< Autofill Service is not allowed */ + AUTOFILL_ERROR_SERVICE_NOT_ACTIVATED = TIZEN_ERROR_AUTOFILL | 0x0008, /**< Autofill Service is not activated */ + AUTOFILL_ERROR_SAVED_VALUES_NOT_FOUND = TIZEN_ERROR_AUTOFILL | 0x0009, /**< Could not find saved values */ } autofill_error_e; /** diff --git a/service_lib/autofill_service.c b/service_lib/autofill_service.c index c8631bc..4c7654d 100644 --- a/service_lib/autofill_service.c +++ b/service_lib/autofill_service.c @@ -695,7 +695,6 @@ EXPORT_API int autofill_service_unset_terminate_received_cb(void) EXPORT_API int autofill_service_send_error_info(int context_id, autofill_error_info_h h) { char *app_id = NULL; - char *error_message = NULL; autofill_error_e error_code; rpc_port_autofill_svc_error_info_h error_info_h = NULL; @@ -706,23 +705,18 @@ EXPORT_API int autofill_service_send_error_info(int context_id, autofill_error_i autofill_error_info_get_app_id(h, &app_id); autofill_error_info_get_error_code(h, &error_code); - autofill_error_info_get_error_message(h, &error_message); /* create error info */ rpc_port_autofill_svc_error_info_create(&error_info_h); rpc_port_autofill_svc_error_info_set_app_id(error_info_h, app_id); rpc_port_autofill_svc_error_info_set_error_code(error_info_h, error_code); - rpc_port_autofill_svc_error_info_set_error_message(error_info_h, error_message); int ret = rpc_port_AutofillSvcPort_autofill_svc_send_error_cb_invoke(g_send_error_cb, context_id, error_info_h); if (app_id) free(app_id); - if (error_message) - free(error_message); - rpc_port_autofill_svc_error_info_destroy(error_info_h); return ret; -} \ No newline at end of file +} diff --git a/tidl/autofill.tidl b/tidl/autofill.tidl index c44c301..fbf53b4 100644 --- a/tidl/autofill.tidl +++ b/tidl/autofill.tidl @@ -54,7 +54,6 @@ struct autofill_fill_response { struct autofill_error_info { string app_id; int error_code; - string error_message; } interface AutofillAppPort { diff --git a/tidl/autofill_service.tidl b/tidl/autofill_service.tidl index bd89003..31a4809 100644 --- a/tidl/autofill_service.tidl +++ b/tidl/autofill_service.tidl @@ -56,7 +56,6 @@ struct autofill_svc_fill_response { struct autofill_svc_error_info { string app_id; int error_code; - string error_message; } interface AutofillSvcPort {