From 82da49e06767bbc8481b4d4455b153a9cd87233b Mon Sep 17 00:00:00 2001 From: InHong Han Date: Mon, 16 Sep 2019 14:40:15 +0900 Subject: [PATCH 01/16] Add missing conditions for checking invalid parameter Change-Id: I3605222ad2d641b0f7ae6cf512e36bc5a3275f99 --- provider/sticker_provider.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/provider/sticker_provider.c b/provider/sticker_provider.c index b8c82aa..474c6a9 100644 --- a/provider/sticker_provider.c +++ b/provider/sticker_provider.c @@ -242,7 +242,7 @@ EXPORT_API int sticker_provider_delete_data(sticker_provider_h provider_handle, CHECK_STICKER_FEATURE(); int ret; - if (!provider_handle || (data_handle->sticker_info_id <= 0)) + if (!provider_handle || !data_handle || (data_handle->sticker_info_id <= 0)) return STICKER_ERROR_INVALID_PARAMETER; ret = sticker_dbus_delete_sticker_info(provider_handle->gdbus_connection, data_handle->sticker_info_id); @@ -261,7 +261,7 @@ EXPORT_API int sticker_provider_get_sticker_count(sticker_provider_h provider_ha int ret; char *app_id = NULL; - if (!provider_handle) + if (!provider_handle || !count) return STICKER_ERROR_INVALID_PARAMETER; ret = app_get_id(&app_id); -- 2.7.4 From ab7bce4635faea30ebbf9849ebd99ab649bb0e21 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Wed, 25 Sep 2019 16:42:19 +0900 Subject: [PATCH 02/16] Changed the API description by API review Change-Id: I8a704031017f0ca26775a953a151941f1e611797 --- doc/sticker_doc.h | 2 +- include/sticker_consumer.h | 18 +++++++++--------- include/sticker_data.h | 32 ++++++++++++++++---------------- include/sticker_error.h | 4 ++-- include/sticker_provider.h | 22 +++++++++++----------- 5 files changed, 39 insertions(+), 39 deletions(-) diff --git a/doc/sticker_doc.h b/doc/sticker_doc.h index f791a09..9c7b385 100644 --- a/doc/sticker_doc.h +++ b/doc/sticker_doc.h @@ -28,7 +28,7 @@ * * @section CAPI_UIX_STICKER_MODULE_FEATURE Related Feature * This API is related with the following feature:\n - * - http://tizen.org/feature/ui_service.sticker + * - %http://tizen.org/feature/ui_service.sticker * * It is recommended to design feature related codes in your application for reliability.\n * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n diff --git a/include/sticker_consumer.h b/include/sticker_consumer.h index 08050a8..5b55d7d 100644 --- a/include/sticker_consumer.h +++ b/include/sticker_consumer.h @@ -93,11 +93,11 @@ typedef void (*sticker_consumer_keyword_list_foreach_cb)(const char *keyword, vo * @param[out] consumer_handle The sticker consumer handle * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful - * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_PERMISSION_DENIED Permission denied + * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_consumer_destroy() */ int sticker_consumer_create(sticker_consumer_h *consumer_handle); @@ -108,9 +108,9 @@ int sticker_consumer_create(sticker_consumer_h *consumer_handle); * @param[in] consumer_handle The sticker consumer handle * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_consumer_create() */ int sticker_consumer_destroy(sticker_consumer_h consumer_handle); @@ -128,10 +128,10 @@ int sticker_consumer_destroy(sticker_consumer_h consumer_handle); * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @post This function invokes sticker_consumer_data_foreach_cb() repeatedly for getting data. * @see sticker_consumer_data_foreach_cb() */ @@ -151,10 +151,10 @@ int sticker_consumer_data_foreach_all(sticker_consumer_h consumer_handle, int of * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @post This function invokes sticker_consumer_data_foreach_cb() repeatedly for getting data. * @see sticker_consumer_data_foreach_cb() */ @@ -174,10 +174,10 @@ int sticker_consumer_data_foreach_by_keyword(sticker_consumer_h consumer_handle, * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @post This function invokes sticker_consumer_data_foreach_cb() repeatedly for getting data. * @see sticker_consumer_data_foreach_cb() */ @@ -197,10 +197,10 @@ int sticker_consumer_data_foreach_by_group(sticker_consumer_h consumer_handle, i * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @post This function invokes sticker_consumer_data_foreach_cb() repeatedly for getting data. * @see sticker_consumer_data_foreach_cb() */ @@ -214,9 +214,9 @@ int sticker_consumer_data_foreach_by_type(sticker_consumer_h consumer_handle, in * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @post This function invokes sticker_consumer_group_list_foreach_cb() repeatedly for getting data. * @see sticker_consumer_group_list_foreach_cb() */ @@ -230,9 +230,9 @@ int sticker_consumer_group_list_foreach_all(sticker_consumer_h consumer_handle, * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @post This function invokes sticker_consumer_keyword_list_foreach_cb() repeatedly for getting data. * @see sticker_consumer_keyword_list_foreach_cb() */ diff --git a/include/sticker_data.h b/include/sticker_data.h index ff72553..16c8753 100644 --- a/include/sticker_data.h +++ b/include/sticker_data.h @@ -68,10 +68,10 @@ typedef void (*sticker_data_keyword_foreach_cb)(const char *keyword, void *user_ * @param[out] data_handle The sticker data handle * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_data_destroy() */ int sticker_data_create(sticker_data_h *data_handle); @@ -82,8 +82,8 @@ int sticker_data_create(sticker_data_h *data_handle); * @param[in] data_handle The sticker data handle * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful - * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported + * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @see sticker_data_create() */ int sticker_data_destroy(sticker_data_h data_handle); @@ -96,9 +96,9 @@ int sticker_data_destroy(sticker_data_h data_handle); * @param[out] target_handle The sticker data handle to be cloned * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_data_destroy() */ int sticker_data_clone(sticker_data_h origin_handle, sticker_data_h *target_handle); @@ -111,9 +111,9 @@ int sticker_data_clone(sticker_data_h origin_handle, sticker_data_h *target_hand * @param[out] app_id The name of the application that provides sticker information * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported */ int sticker_data_get_app_id(sticker_data_h data_handle, char **app_id); @@ -127,9 +127,9 @@ int sticker_data_get_app_id(sticker_data_h data_handle, char **app_id); * @param[in] uri The URI to be saved * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_data_get_uri() */ int sticker_data_set_uri(sticker_data_h data_handle, sticker_data_uri_type_e type, const char *uri); @@ -143,9 +143,9 @@ int sticker_data_set_uri(sticker_data_h data_handle, sticker_data_uri_type_e typ * @param[out] uri The URI * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_data_set_uri() */ int sticker_data_get_uri(sticker_data_h data_handle, sticker_data_uri_type_e *type, char **uri); @@ -158,9 +158,9 @@ int sticker_data_get_uri(sticker_data_h data_handle, sticker_data_uri_type_e *ty * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @post This function invokes sticker_data_keyword_foreach_cb() repeatedly for getting keywords. * @see sticker_data_keyword_foreach_cb() * @see sticker_data_add_keyword() @@ -176,8 +176,8 @@ int sticker_data_foreach_keyword(sticker_data_h data_handle, sticker_data_keywor * @param[in] keyword The keyword to be saved * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful - * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported + * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @see sticker_data_keyword_foreach_cb() * @see sticker_data_foreach_keyword() * @see sticker_data_remove_keyword() @@ -192,8 +192,8 @@ int sticker_data_add_keyword(sticker_data_h data_handle, const char *keyword); * @param[in] keyword The keyword to be removed * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful - * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported + * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @see sticker_data_keyword_foreach_cb() * @see sticker_data_foreach_keyword() * @see sticker_data_add_keyword() @@ -208,8 +208,8 @@ int sticker_data_remove_keyword(sticker_data_h data_handle, const char *keyword) * @param[in] group The group name to be saved * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful - * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported + * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @see sticker_data_get_group() */ int sticker_data_set_group_name(sticker_data_h data_handle, const char *group); @@ -222,9 +222,9 @@ int sticker_data_set_group_name(sticker_data_h data_handle, const char *group); * @param[out] group The group name * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_data_set_group() */ int sticker_data_get_group_name(sticker_data_h data_handle, char **group); @@ -238,8 +238,8 @@ int sticker_data_get_group_name(sticker_data_h data_handle, char **group); * @param[in] thumbnail The thumbnail path to be saved * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful - * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported + * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @see sticker_data_get_thumbnail() */ int sticker_data_set_thumbnail(sticker_data_h data_handle, const char *thumbnail); @@ -253,8 +253,8 @@ int sticker_data_set_thumbnail(sticker_data_h data_handle, const char *thumbnail * @param[out] thumbnail The thumbnail path * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful - * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported + * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @see sticker_data_set_thumbnail() */ int sticker_data_get_thumbnail(sticker_data_h data_handle, char **thumbnail); @@ -267,8 +267,8 @@ int sticker_data_get_thumbnail(sticker_data_h data_handle, char **thumbnail); * @param[in] description The description to be saved * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful - * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported + * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @see sticker_data_get_description() */ int sticker_data_set_description(sticker_data_h data_handle, const char *description); @@ -282,8 +282,8 @@ int sticker_data_set_description(sticker_data_h data_handle, const char *descrip * @param[out] description The description of the sticker * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful - * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported + * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @see sticker_data_set_description() */ int sticker_data_get_description(sticker_data_h data_handle, char **description); @@ -297,9 +297,9 @@ int sticker_data_get_description(sticker_data_h data_handle, char **description) * @param[out] date The last updated date * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported */ int sticker_data_get_date(sticker_data_h data_handle, char **date); diff --git a/include/sticker_error.h b/include/sticker_error.h index a3abd3b..a38b9c6 100644 --- a/include/sticker_error.h +++ b/include/sticker_error.h @@ -40,10 +40,10 @@ extern "C" { */ typedef enum { STICKER_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ - STICKER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ + STICKER_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */ STICKER_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ + STICKER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ STICKER_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ - STICKER_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */ STICKER_ERROR_OPERATION_FAILED = TIZEN_ERROR_STICKER | 0x0001, /**< Operation failed */ } sticker_error_e; diff --git a/include/sticker_provider.h b/include/sticker_provider.h index a369716..8ab7758 100644 --- a/include/sticker_provider.h +++ b/include/sticker_provider.h @@ -73,10 +73,10 @@ typedef void (*sticker_provider_insert_finished_cb)(sticker_error_e error, void * @param[out] provider_handle The sticker provider handle * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_provider_destroy() */ int sticker_provider_create(sticker_provider_h *provider_handle); @@ -87,9 +87,9 @@ int sticker_provider_create(sticker_provider_h *provider_handle); * @param[in] provider_handle The sticker provider handle * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_provider_create() */ int sticker_provider_destroy(sticker_provider_h provider_handle); @@ -98,15 +98,15 @@ int sticker_provider_destroy(sticker_provider_h provider_handle); * @brief Inserts a sticker data to the sticker database. * @since_tizen 5.5 * @remarks All data except thumbnail and description must be set in the @a data_handle to insert the sticker data. - * If the uri type is @a STICKER_DATA_URI_LOCAL_PATH, the sticker file is copied to a sticker directory. + * If the uri type is #STICKER_DATA_URI_LOCAL_PATH, the sticker file is copied to a sticker directory. * It is recommended to delete your sticker file after inserting a sticker data. * @param[in] provider_handle The sticker provider handle * @param[in] data_handle The sticker data handle to be saved * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_provider_update_data() * @see sticker_provider_delete_data() */ @@ -118,7 +118,7 @@ int sticker_provider_insert_data(sticker_provider_h provider_handle, sticker_dat * @since_tizen 5.5 * @remarks All data except thumbnail and description must be set in the json file to insert the sticker data. * @a json_path must have a non-null value and must be an existing file. If not, the error as invalid parameter will be returned. - * If the uri type is @a STICKER_DATA_URI_LOCAL_PATH, the sticker file is copied to a sticker directory. + * If the uri type is #STICKER_DATA_URI_LOCAL_PATH, the sticker file is copied to a sticker directory. * It is recommended to delete your sticker files after inserting a sticker data. * @param[in] provider_handle The sticker provider handle * @param[in] json_path The path of json file containing sticker information to be saved @@ -126,9 +126,9 @@ int sticker_provider_insert_data(sticker_provider_h provider_handle, sticker_dat * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @post This function invokes sticker_provider_insert_finished_cb(). * @see sticker_provider_insert_finished_cb() * @@ -170,9 +170,9 @@ int sticker_provider_insert_data_by_json_file(sticker_provider_h provider_handle * @param[in] data_handle The sticker data handle to be updated * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_provider_insert_data() * @see sticker_provider_delete_data() */ @@ -181,14 +181,14 @@ int sticker_provider_update_data(sticker_provider_h provider_handle, sticker_dat /** * @brief Deletes a sticker data in the sticker database. * @since_tizen 5.5 - * @remarks The @a sticker_id must be the ID of the sticker stored in the sticker database. + * @remarks The @a data_handle must be the handle of the sticker stored in the sticker database. * @param[in] provider_handle The sticker provider handle * @param[in] data_handle The sticker data handle to be deleted * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_provider_insert_data() * @see sticker_provider_update_data() */ @@ -201,9 +201,9 @@ int sticker_provider_delete_data(sticker_provider_h provider_handle, sticker_dat * @param[out] count The number of stickers * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported */ int sticker_provider_get_sticker_count(sticker_provider_h provider_handle, int *count); @@ -220,10 +220,10 @@ int sticker_provider_get_sticker_count(sticker_provider_h provider_handle, int * * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @post This function invokes sticker_provider_data_foreach_cb() repeatedly for getting data. * @see sticker_provider_data_foreach_cb() */ -- 2.7.4 From cbde5a86fe5975a7f7438daaf0e20bfad9875461 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Wed, 25 Sep 2019 16:42:19 +0900 Subject: [PATCH 03/16] Changed the API description by API review Change-Id: I8a704031017f0ca26775a953a151941f1e611797 --- doc/sticker_doc.h | 2 +- include/sticker_consumer.h | 18 +++++++++--------- include/sticker_data.h | 32 ++++++++++++++++---------------- include/sticker_error.h | 4 ++-- include/sticker_provider.h | 22 +++++++++++----------- 5 files changed, 39 insertions(+), 39 deletions(-) diff --git a/doc/sticker_doc.h b/doc/sticker_doc.h index f791a09..9c7b385 100644 --- a/doc/sticker_doc.h +++ b/doc/sticker_doc.h @@ -28,7 +28,7 @@ * * @section CAPI_UIX_STICKER_MODULE_FEATURE Related Feature * This API is related with the following feature:\n - * - http://tizen.org/feature/ui_service.sticker + * - %http://tizen.org/feature/ui_service.sticker * * It is recommended to design feature related codes in your application for reliability.\n * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n diff --git a/include/sticker_consumer.h b/include/sticker_consumer.h index 08050a8..5b55d7d 100644 --- a/include/sticker_consumer.h +++ b/include/sticker_consumer.h @@ -93,11 +93,11 @@ typedef void (*sticker_consumer_keyword_list_foreach_cb)(const char *keyword, vo * @param[out] consumer_handle The sticker consumer handle * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful - * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_PERMISSION_DENIED Permission denied + * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_consumer_destroy() */ int sticker_consumer_create(sticker_consumer_h *consumer_handle); @@ -108,9 +108,9 @@ int sticker_consumer_create(sticker_consumer_h *consumer_handle); * @param[in] consumer_handle The sticker consumer handle * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_consumer_create() */ int sticker_consumer_destroy(sticker_consumer_h consumer_handle); @@ -128,10 +128,10 @@ int sticker_consumer_destroy(sticker_consumer_h consumer_handle); * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @post This function invokes sticker_consumer_data_foreach_cb() repeatedly for getting data. * @see sticker_consumer_data_foreach_cb() */ @@ -151,10 +151,10 @@ int sticker_consumer_data_foreach_all(sticker_consumer_h consumer_handle, int of * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @post This function invokes sticker_consumer_data_foreach_cb() repeatedly for getting data. * @see sticker_consumer_data_foreach_cb() */ @@ -174,10 +174,10 @@ int sticker_consumer_data_foreach_by_keyword(sticker_consumer_h consumer_handle, * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @post This function invokes sticker_consumer_data_foreach_cb() repeatedly for getting data. * @see sticker_consumer_data_foreach_cb() */ @@ -197,10 +197,10 @@ int sticker_consumer_data_foreach_by_group(sticker_consumer_h consumer_handle, i * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @post This function invokes sticker_consumer_data_foreach_cb() repeatedly for getting data. * @see sticker_consumer_data_foreach_cb() */ @@ -214,9 +214,9 @@ int sticker_consumer_data_foreach_by_type(sticker_consumer_h consumer_handle, in * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @post This function invokes sticker_consumer_group_list_foreach_cb() repeatedly for getting data. * @see sticker_consumer_group_list_foreach_cb() */ @@ -230,9 +230,9 @@ int sticker_consumer_group_list_foreach_all(sticker_consumer_h consumer_handle, * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @post This function invokes sticker_consumer_keyword_list_foreach_cb() repeatedly for getting data. * @see sticker_consumer_keyword_list_foreach_cb() */ diff --git a/include/sticker_data.h b/include/sticker_data.h index ff72553..16c8753 100644 --- a/include/sticker_data.h +++ b/include/sticker_data.h @@ -68,10 +68,10 @@ typedef void (*sticker_data_keyword_foreach_cb)(const char *keyword, void *user_ * @param[out] data_handle The sticker data handle * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_data_destroy() */ int sticker_data_create(sticker_data_h *data_handle); @@ -82,8 +82,8 @@ int sticker_data_create(sticker_data_h *data_handle); * @param[in] data_handle The sticker data handle * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful - * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported + * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @see sticker_data_create() */ int sticker_data_destroy(sticker_data_h data_handle); @@ -96,9 +96,9 @@ int sticker_data_destroy(sticker_data_h data_handle); * @param[out] target_handle The sticker data handle to be cloned * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_data_destroy() */ int sticker_data_clone(sticker_data_h origin_handle, sticker_data_h *target_handle); @@ -111,9 +111,9 @@ int sticker_data_clone(sticker_data_h origin_handle, sticker_data_h *target_hand * @param[out] app_id The name of the application that provides sticker information * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported */ int sticker_data_get_app_id(sticker_data_h data_handle, char **app_id); @@ -127,9 +127,9 @@ int sticker_data_get_app_id(sticker_data_h data_handle, char **app_id); * @param[in] uri The URI to be saved * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_data_get_uri() */ int sticker_data_set_uri(sticker_data_h data_handle, sticker_data_uri_type_e type, const char *uri); @@ -143,9 +143,9 @@ int sticker_data_set_uri(sticker_data_h data_handle, sticker_data_uri_type_e typ * @param[out] uri The URI * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_data_set_uri() */ int sticker_data_get_uri(sticker_data_h data_handle, sticker_data_uri_type_e *type, char **uri); @@ -158,9 +158,9 @@ int sticker_data_get_uri(sticker_data_h data_handle, sticker_data_uri_type_e *ty * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @post This function invokes sticker_data_keyword_foreach_cb() repeatedly for getting keywords. * @see sticker_data_keyword_foreach_cb() * @see sticker_data_add_keyword() @@ -176,8 +176,8 @@ int sticker_data_foreach_keyword(sticker_data_h data_handle, sticker_data_keywor * @param[in] keyword The keyword to be saved * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful - * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported + * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @see sticker_data_keyword_foreach_cb() * @see sticker_data_foreach_keyword() * @see sticker_data_remove_keyword() @@ -192,8 +192,8 @@ int sticker_data_add_keyword(sticker_data_h data_handle, const char *keyword); * @param[in] keyword The keyword to be removed * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful - * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported + * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @see sticker_data_keyword_foreach_cb() * @see sticker_data_foreach_keyword() * @see sticker_data_add_keyword() @@ -208,8 +208,8 @@ int sticker_data_remove_keyword(sticker_data_h data_handle, const char *keyword) * @param[in] group The group name to be saved * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful - * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported + * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @see sticker_data_get_group() */ int sticker_data_set_group_name(sticker_data_h data_handle, const char *group); @@ -222,9 +222,9 @@ int sticker_data_set_group_name(sticker_data_h data_handle, const char *group); * @param[out] group The group name * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_data_set_group() */ int sticker_data_get_group_name(sticker_data_h data_handle, char **group); @@ -238,8 +238,8 @@ int sticker_data_get_group_name(sticker_data_h data_handle, char **group); * @param[in] thumbnail The thumbnail path to be saved * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful - * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported + * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @see sticker_data_get_thumbnail() */ int sticker_data_set_thumbnail(sticker_data_h data_handle, const char *thumbnail); @@ -253,8 +253,8 @@ int sticker_data_set_thumbnail(sticker_data_h data_handle, const char *thumbnail * @param[out] thumbnail The thumbnail path * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful - * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported + * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @see sticker_data_set_thumbnail() */ int sticker_data_get_thumbnail(sticker_data_h data_handle, char **thumbnail); @@ -267,8 +267,8 @@ int sticker_data_get_thumbnail(sticker_data_h data_handle, char **thumbnail); * @param[in] description The description to be saved * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful - * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported + * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @see sticker_data_get_description() */ int sticker_data_set_description(sticker_data_h data_handle, const char *description); @@ -282,8 +282,8 @@ int sticker_data_set_description(sticker_data_h data_handle, const char *descrip * @param[out] description The description of the sticker * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful - * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported + * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @see sticker_data_set_description() */ int sticker_data_get_description(sticker_data_h data_handle, char **description); @@ -297,9 +297,9 @@ int sticker_data_get_description(sticker_data_h data_handle, char **description) * @param[out] date The last updated date * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported */ int sticker_data_get_date(sticker_data_h data_handle, char **date); diff --git a/include/sticker_error.h b/include/sticker_error.h index a3abd3b..a38b9c6 100644 --- a/include/sticker_error.h +++ b/include/sticker_error.h @@ -40,10 +40,10 @@ extern "C" { */ typedef enum { STICKER_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ - STICKER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ + STICKER_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */ STICKER_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ + STICKER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ STICKER_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ - STICKER_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */ STICKER_ERROR_OPERATION_FAILED = TIZEN_ERROR_STICKER | 0x0001, /**< Operation failed */ } sticker_error_e; diff --git a/include/sticker_provider.h b/include/sticker_provider.h index a369716..8ab7758 100644 --- a/include/sticker_provider.h +++ b/include/sticker_provider.h @@ -73,10 +73,10 @@ typedef void (*sticker_provider_insert_finished_cb)(sticker_error_e error, void * @param[out] provider_handle The sticker provider handle * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_provider_destroy() */ int sticker_provider_create(sticker_provider_h *provider_handle); @@ -87,9 +87,9 @@ int sticker_provider_create(sticker_provider_h *provider_handle); * @param[in] provider_handle The sticker provider handle * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_provider_create() */ int sticker_provider_destroy(sticker_provider_h provider_handle); @@ -98,15 +98,15 @@ int sticker_provider_destroy(sticker_provider_h provider_handle); * @brief Inserts a sticker data to the sticker database. * @since_tizen 5.5 * @remarks All data except thumbnail and description must be set in the @a data_handle to insert the sticker data. - * If the uri type is @a STICKER_DATA_URI_LOCAL_PATH, the sticker file is copied to a sticker directory. + * If the uri type is #STICKER_DATA_URI_LOCAL_PATH, the sticker file is copied to a sticker directory. * It is recommended to delete your sticker file after inserting a sticker data. * @param[in] provider_handle The sticker provider handle * @param[in] data_handle The sticker data handle to be saved * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_provider_update_data() * @see sticker_provider_delete_data() */ @@ -118,7 +118,7 @@ int sticker_provider_insert_data(sticker_provider_h provider_handle, sticker_dat * @since_tizen 5.5 * @remarks All data except thumbnail and description must be set in the json file to insert the sticker data. * @a json_path must have a non-null value and must be an existing file. If not, the error as invalid parameter will be returned. - * If the uri type is @a STICKER_DATA_URI_LOCAL_PATH, the sticker file is copied to a sticker directory. + * If the uri type is #STICKER_DATA_URI_LOCAL_PATH, the sticker file is copied to a sticker directory. * It is recommended to delete your sticker files after inserting a sticker data. * @param[in] provider_handle The sticker provider handle * @param[in] json_path The path of json file containing sticker information to be saved @@ -126,9 +126,9 @@ int sticker_provider_insert_data(sticker_provider_h provider_handle, sticker_dat * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @post This function invokes sticker_provider_insert_finished_cb(). * @see sticker_provider_insert_finished_cb() * @@ -170,9 +170,9 @@ int sticker_provider_insert_data_by_json_file(sticker_provider_h provider_handle * @param[in] data_handle The sticker data handle to be updated * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_provider_insert_data() * @see sticker_provider_delete_data() */ @@ -181,14 +181,14 @@ int sticker_provider_update_data(sticker_provider_h provider_handle, sticker_dat /** * @brief Deletes a sticker data in the sticker database. * @since_tizen 5.5 - * @remarks The @a sticker_id must be the ID of the sticker stored in the sticker database. + * @remarks The @a data_handle must be the handle of the sticker stored in the sticker database. * @param[in] provider_handle The sticker provider handle * @param[in] data_handle The sticker data handle to be deleted * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @see sticker_provider_insert_data() * @see sticker_provider_update_data() */ @@ -201,9 +201,9 @@ int sticker_provider_delete_data(sticker_provider_h provider_handle, sticker_dat * @param[out] count The number of stickers * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported */ int sticker_provider_get_sticker_count(sticker_provider_h provider_handle, int *count); @@ -220,10 +220,10 @@ int sticker_provider_get_sticker_count(sticker_provider_h provider_handle, int * * @param[in] user_data The user data to be passed to the callback function * @return 0 on success, otherwise a negative error value * @retval #STICKER_ERROR_NONE Successful + * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed - * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported * @post This function invokes sticker_provider_data_foreach_cb() repeatedly for getting data. * @see sticker_provider_data_foreach_cb() */ -- 2.7.4 From 16eddec676cc2cf514bb9c9a686ce354214688d6 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Thu, 26 Sep 2019 16:48:59 +0900 Subject: [PATCH 04/16] Fix wrong dbus policy Change-Id: Id8d01a7d60e103da71325c5fc0b32c425269bba0 --- packaging/capi-ui-sticker.conf | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packaging/capi-ui-sticker.conf b/packaging/capi-ui-sticker.conf index 9d90095..84113c9 100644 --- a/packaging/capi-ui-sticker.conf +++ b/packaging/capi-ui-sticker.conf @@ -3,12 +3,14 @@ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> - + - - - + + + + + \ No newline at end of file -- 2.7.4 From 45a051d02db10bb344de74ed1ee1984321fb892f Mon Sep 17 00:00:00 2001 From: InHong Han Date: Thu, 26 Sep 2019 17:29:16 +0900 Subject: [PATCH 05/16] Update package version to 0.1.1 Change-Id: I769d9103e80c8751088b870d1a96552d2aa3c7c4 --- packaging/capi-ui-sticker.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index 1a94b61..b0b7a4f 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.0 +Version: 0.1.1 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 @@ -100,4 +100,4 @@ chsmack -a "System::Shared" %{TZ_SYS_SHARE}/sticker-data %{_includedir}/sticker_error.h %{_includedir}/sticker_data.h %{_includedir}/sticker_consumer.h -%{_includedir}/sticker_provider.h \ No newline at end of file +%{_includedir}/sticker_provider.h -- 2.7.4 From 1912bd83181233f748cbbe81dd77f3e1f82bcb74 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 27 Sep 2019 16:16:30 +0900 Subject: [PATCH 06/16] Apply ASLR in daemon Change-Id: I73350cc6b0c8a44441f41bf5020e6cf7e98c3e59 Signed-off-by: Jihoon Kim --- server/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 1c15da7..655ed42 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -10,10 +10,11 @@ FOREACH(flag ${pkgs_CFLAGS}) ENDFOREACH(flag) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE") +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie") ## Executable ## ADD_EXECUTABLE(sticker-server ${SRCS}) TARGET_LINK_LIBRARIES(sticker-server ${pkgs_LDFLAGS}) ## Install library files ## -INSTALL(TARGETS sticker-server DESTINATION bin) \ No newline at end of file +INSTALL(TARGETS sticker-server DESTINATION bin) -- 2.7.4 From fbd50f9eaa03104257e87c1ae0f15ceaaacb2b12 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 27 Sep 2019 16:30:05 +0900 Subject: [PATCH 07/16] Change install destination of daemon Change-Id: Ibd790f2f32ae7320d2497693748ab3e5cd7beeee Signed-off-by: Jihoon Kim --- server/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 655ed42..0b7fe18 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -16,5 +16,5 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie") ADD_EXECUTABLE(sticker-server ${SRCS}) TARGET_LINK_LIBRARIES(sticker-server ${pkgs_LDFLAGS}) -## Install library files ## -INSTALL(TARGETS sticker-server DESTINATION bin) +## Install daemon file ## +INSTALL(TARGETS sticker-server DESTINATION /usr/bin) -- 2.7.4 From 28da3a63a4185ace0cd45ec70853b97a84622b45 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 30 Sep 2019 15:18:34 +0900 Subject: [PATCH 08/16] Update package version to 0.1.2 Change-Id: Ia7ff4cef75083dffb1e048e33f0209ff3a343bed Signed-off-by: Jihoon Kim --- packaging/capi-ui-sticker.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index b0b7a4f..32b94b0 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.1 +Version: 0.1.2 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From 016c4f21c479dec9f7272536a2333ce779b6154c Mon Sep 17 00:00:00 2001 From: InHong Han Date: Mon, 30 Sep 2019 15:26:51 +0900 Subject: [PATCH 09/16] Modified user and group id of sticker daemon to ui_fw Change-Id: I98e2afcb0fd5432bbf7ee0ab4d9f286c9a270b09 --- packaging/capi-ui-sticker.spec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index 32b94b0..caa2293 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -80,9 +80,8 @@ chsmack -a "System::Shared" %{TZ_SYS_SHARE}/sticker-data %files %manifest %{name}.manifest %license LICENSE -%defattr(-,root,root,-) %{_libdir}/lib*.so -%attr(0755,root,root) %{_bindir}/sticker-server +%attr(0755,ui_fw,ui_fw) %{_bindir}/sticker-server %attr(0644,root,root) %{_unitdir}/capi-ui-sticker.service %attr(0644,root,root) %{_unitdir}/multi-user.target.wants/capi-ui-sticker.service %attr(0644,root,root) %{_datadir}/dbus-1/system-services/org.tizen.sticker.server.service -- 2.7.4 From 5050e0ce1e47fe4c6f606476ad09c921d5409d0c Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 8 Oct 2019 10:59:53 +0900 Subject: [PATCH 10/16] Fix memory leak detected by static analysis tool Change-Id: I6d2e34c696e47177f2ff67cbdb4784812e05bfba Signed-off-by: Jihoon Kim --- provider/sticker_provider.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/provider/sticker_provider.c b/provider/sticker_provider.c index 474c6a9..3761d6a 100644 --- a/provider/sticker_provider.c +++ b/provider/sticker_provider.c @@ -198,7 +198,8 @@ EXPORT_API int sticker_provider_insert_data_by_json_file(sticker_provider_h prov ret = sticker_dbus_insert_sticker_info_by_json(provider_handle->gdbus_connection, app_id, file_path); if (ret != STICKER_ERROR_NONE) { LOGE("Failed to load json file : %d", ret); - return STICKER_ERROR_OPERATION_FAILED; + ret = STICKER_ERROR_OPERATION_FAILED; + goto cleanup; } provider_handle->insert_finished_cb = callback; -- 2.7.4 From c0d907c5534b7e1a580555af02e874ad4e76a098 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Tue, 8 Oct 2019 15:18:03 +0900 Subject: [PATCH 11/16] Fix memory leak Change-Id: Ie57fdd246e3381c19bf7a886899a8ffb26b855c8 Signed-off-by: InHong Han --- client/sticker_dbus.c | 2 +- server/stickerd_data_manager.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/sticker_dbus.c b/client/sticker_dbus.c index a3e2377..847283a 100644 --- a/client/sticker_dbus.c +++ b/client/sticker_dbus.c @@ -558,7 +558,7 @@ static void _set_keyword_builder(char *keyword, GVariantBuilder *keyword_builder return; } - g_variant_builder_add(keyword_builder, "(s)", strdup((const char *)keyword)); + g_variant_builder_add(keyword_builder, "(s)", (const char *)keyword); } int sticker_dbus_insert_sticker_info(GDBusConnection *gdbus_connection, sticker_data_h sticker_data) diff --git a/server/stickerd_data_manager.c b/server/stickerd_data_manager.c index a3e235d..b0922da 100644 --- a/server/stickerd_data_manager.c +++ b/server/stickerd_data_manager.c @@ -902,7 +902,7 @@ static void _set_keyword_builder(char *keyword, GVariantBuilder *keyword_builder return; } - g_variant_builder_add(keyword_builder, "(s)", strdup((const char *)keyword)); + g_variant_builder_add(keyword_builder, "(s)", (const char *)keyword); } int stickerd_get_sticker_info(GVariant *parameters, GVariant **reply_body) -- 2.7.4 From c37c613fc0656e20d61e50916f2a6aae9457f622 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Tue, 8 Oct 2019 15:20:33 +0900 Subject: [PATCH 12/16] Update package version to 0.1.3 Change-Id: Ie333498a2f455f08c4fbc200b40fc9194de39754 --- packaging/capi-ui-sticker.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index caa2293..9bc90ad 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.2 +Version: 0.1.3 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From c25dd19263570ca8b5dac175c1514cc78fa729a5 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 18 Oct 2019 19:44:56 +0900 Subject: [PATCH 13/16] Support to generate gcov package Change-Id: I060934c1a13e9447aa2b370cdf1236f362a31e1c Signed-off-by: Jihoon Kim --- packaging/capi-ui-sticker.spec | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index 9bc90ad..57ba2cb 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -39,20 +39,39 @@ Requires: %{name} = %{version}-%{release} %description devel Sticker client library and daemon (Development) +%if 0%{?gcov:1} +%package gcov +Summary: Sticker client library and daemon (gcov) +Group: Graphics & UI Framework/Input +%description gcov +Sticker client library and daemon (gcov) +%endif + %prep %setup -q -n %{name}-%{version} cp %{SOURCE2} . %build +%if 0%{?gcov:1} +export CFLAGS+=" -fprofile-arcs -ftest-coverage" +export CXXFLAGS+=" -fprofile-arcs -ftest-coverage" +export FFLAGS+=" -fprofile-arcs -ftest-coverage" +export LDFLAGS+=" -lgcov" +%endif export CFLAGS+=" -DTIZEN_DEBUG_ENABLE -fvisibility=hidden -Werror" export CXXFLAGS+=" -DTIZEN_DEBUG_ENABLE -fvisibility=hidden -Werror" export FFLAGS+=" -DTIZEN_DEBUG_ENABLE -fvisibility=hidden" -cmake . -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%{_libdir} -DBINDIR=%{_bindir} -DINCLUDEDIR=%{_includedir} \ - -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE -DTZ_SYS_BIN=%TZ_SYS_BIN -DTZ_SYS_SHARE=%TZ_SYS_SHARE +%cmake . -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%{_libdir} -DBINDIR=%{_bindir} -DINCLUDEDIR=%{_includedir} \ + -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE -DTZ_SYS_BIN=%TZ_SYS_BIN -DTZ_SYS_SHARE=%TZ_SYS_SHARE make %{?jobs:-j%jobs} +%if 0%{?gcov:1} +mkdir -p gcov-obj +find . -name '*.gcno' -exec cp '{}' gcov-obj ';' +%endif + %install rm -rf %{buildroot} %make_install @@ -67,6 +86,11 @@ install -m 0644 %SOURCE2 %{buildroot}%{_datadir}/dbus-1/system-services/org.tize mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d install -m 0644 %SOURCE3 %{buildroot}%{_sysconfdir}/dbus-1/system.d/capi-ui-sticker.conf +%if 0%{?gcov:1} +mkdir -p %{buildroot}%{_datadir}/gcov/obj +install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj +%endif + %post /sbin/ldconfig @@ -100,3 +124,8 @@ chsmack -a "System::Shared" %{TZ_SYS_SHARE}/sticker-data %{_includedir}/sticker_data.h %{_includedir}/sticker_consumer.h %{_includedir}/sticker_provider.h + +%if 0%{?gcov:1} +%files gcov +%{_datadir}/gcov/obj/* +%endif -- 2.7.4 From 78cccd3e56fdc5277edd7f26ce5f822f96cb6aea Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 18 Oct 2019 19:53:03 +0900 Subject: [PATCH 14/16] Add exclude section of coverage Change-Id: Idb6ff03963afc7afcdbe639c90fe10ee62f9d14e Signed-off-by: Jihoon Kim --- client/sticker_dbus.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/sticker_dbus.c b/client/sticker_dbus.c index 847283a..12b6722 100644 --- a/client/sticker_dbus.c +++ b/client/sticker_dbus.c @@ -30,10 +30,12 @@ static void _server_appeared_cb(GDBusConnection *connection, const gchar *name, LOGD("name : %s, name_owner : %s", name, name_owner); } +//LCOV_EXCL_START static void _server_vanished_cb(GDBusConnection *connection, const gchar *name, gpointer user_data) { LOGD("name : %s", name); } +//LCOV_EXCL_STOP static int _dbus_init(GDBusConnection **gdbus_connection, guint *server_watcher_id) { @@ -178,6 +180,7 @@ static void _call_insert_finished_cb(sticker_provider_h provider_handle, GVarian } } +//LCOV_EXCL_START static void _handle_sticker_consumer_cb(GDBusConnection *connection, const gchar *sender_name, const gchar *object_path, @@ -244,6 +247,7 @@ static void _handle_sticker_consumer_cb(GDBusConnection *connection, _free_sticker_data(sticker_data); #endif } +//LCOV_EXCL_STOP static void _handle_sticker_provider_cb(GDBusConnection *connection, const gchar *sender_name, @@ -486,12 +490,14 @@ static void _on_name_appeared(GDBusConnection *connection, _monitor_register(connection); } +//LCOV_EXCL_START static void _on_name_vanished(GDBusConnection *connection, const gchar *name, gpointer user_data) { is_server_started = 0; } +//LCOV_EXCL_STOP int sticker_dbus_init(GDBusConnection **gdbus_connection, guint *server_watcher_id, int *monitor_id, int *server_monitor_id, CLIENT_LIB lib, void *data) -- 2.7.4 From c4286a559c95f9d9bef09d028a435c210f99e6fb Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 18 Oct 2019 19:53:43 +0900 Subject: [PATCH 15/16] Update package version to 0.1.4 Change-Id: I1c75f17b4a964d815805671a5fbd291a41f983b6 Signed-off-by: Jihoon Kim --- packaging/capi-ui-sticker.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index 57ba2cb..50c55df 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.3 +Version: 0.1.4 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From b2c90860c6edd7f79225faf89b05470ac6503fee Mon Sep 17 00:00:00 2001 From: InHong Han Date: Thu, 7 Nov 2019 14:03:04 +0900 Subject: [PATCH 16/16] Support on-demand launch Change-Id: I58af3046adb9eef35e85d6466b286b345adfae6e (cherry picked from commit ec53be564d596116ed261e6150a8cf98a4e376f9) --- client/sticker_dbus.c | 112 +++++++++++++++++----------------- client/sticker_dbus.h | 4 +- consumer/sticker_consumer.c | 3 +- consumer/sticker_consumer_main.h | 2 +- packaging/capi-ui-sticker.spec | 4 +- provider/sticker_provider.c | 3 +- provider/sticker_provider_main.h | 2 +- server/stickerd_data_manager.c | 35 +++++++++-- server/stickerd_dbus.c | 127 +++++++++++++++++++++++---------------- server/stickerd_dbus.h | 3 +- server/stickerd_main.c | 2 +- 11 files changed, 175 insertions(+), 122 deletions(-) diff --git a/client/sticker_dbus.c b/client/sticker_dbus.c index 12b6722..627fe46 100644 --- a/client/sticker_dbus.c +++ b/client/sticker_dbus.c @@ -37,9 +37,10 @@ static void _server_vanished_cb(GDBusConnection *connection, const gchar *name, } //LCOV_EXCL_STOP -static int _dbus_init(GDBusConnection **gdbus_connection, guint *server_watcher_id) +static int _dbus_init(GDBusConnection **gdbus_connection) { GError *error = NULL; + int watch_id = 0; if (*gdbus_connection == NULL) { GDBusConnection *conn = NULL; @@ -55,17 +56,15 @@ static int _dbus_init(GDBusConnection **gdbus_connection, guint *server_watcher_ } LOGD("Connected bus name : %s", g_dbus_connection_get_unique_name(*gdbus_connection)); - if (*server_watcher_id == 0) { - *server_watcher_id = g_bus_watch_name(G_BUS_TYPE_SYSTEM, - STICKER_DBUS_NAME, - G_BUS_NAME_WATCHER_FLAGS_NONE, - _server_appeared_cb, - _server_vanished_cb, - NULL, NULL); - } + watch_id = g_bus_watch_name(G_BUS_TYPE_SYSTEM, + STICKER_DBUS_NAME, + G_BUS_NAME_WATCHER_FLAGS_NONE, + _server_appeared_cb, + _server_vanished_cb, + NULL, NULL); - LOGD("server_watcher_id : %d", *server_watcher_id); - if (*server_watcher_id == 0) { + LOGD("watch_id : %d", watch_id); + if (watch_id == 0) { LOGE("Failed to get identifier"); return STICKER_CLIENT_ERROR_IO_ERROR; } @@ -413,70 +412,54 @@ static int _send_sync_message(GDBusConnection *gdbus_connection, GVariant *body, return ret; } -static void _gdbus_reply_message_async_cb(GDBusConnection *connection, GAsyncResult *res, gpointer user_data) -{ - GDBusMessage *reply = NULL; - GError *err = NULL; - - reply = g_dbus_connection_send_message_with_reply_finish(connection, res, &err); - - if (reply) { - if (g_dbus_message_to_gerror(reply, &err)) { - LOGE("error message = %s, code = %d", err->message, err->code); - g_error_free(err); - return; - } - } else { - LOGE("There is no reply"); - return; - } - - if (reply) - g_object_unref(reply); - - LOGD("Reply message was received"); - return; -} - static int _send_async_message(GDBusConnection *gdbus_connection, GVariant *body, char *cmd) { int ret = STICKER_CLIENT_ERROR_NONE; GDBusMessage *msg = NULL; + GError *err = NULL; msg = _get_gbus_message(body, cmd); if (msg == NULL) return STICKER_CLIENT_ERROR_IO_ERROR; - g_dbus_connection_send_message_with_reply( - gdbus_connection, - msg, - G_DBUS_SEND_MESSAGE_FLAGS_NONE, - -1, - NULL, - NULL, - (GAsyncReadyCallback)_gdbus_reply_message_async_cb, - NULL); + g_dbus_connection_send_message(gdbus_connection, msg, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, &err); if (msg) g_object_unref(msg); + if (err != NULL) { + ret = STICKER_CLIENT_ERROR_SERVICE_NOT_READY; + LOGE("Error occurred when sending message(%s) : %s", cmd, err->message); + + if (err->code == G_DBUS_ERROR_ACCESS_DENIED) + ret = STICKER_CLIENT_ERROR_PERMISSION_DENIED; + + g_error_free(err); + return ret; + } + return ret; } -static int _monitor_register(GDBusConnection *gdbus_connection) +static int _monitor_register(GDBusConnection *gdbus_connection, int *server_watcher_id) { int ret; GDBusMessage *reply = NULL; + GVariant *reply_body = NULL; ret = _send_sync_message(gdbus_connection, g_variant_new("()"), &reply, "sticker_service_register"); - if (reply) - g_object_unref(reply); if (ret != STICKER_CLIENT_ERROR_NONE) { LOGE("_send_sync_message() failed : %d", ret); return ret; } + reply_body = g_dbus_message_get_body(reply); + g_variant_get(reply_body, "(i)", server_watcher_id); + + if (reply) + g_object_unref(reply); + is_server_started = 1; return ret; } @@ -486,8 +469,10 @@ static void _on_name_appeared(GDBusConnection *connection, const gchar *name_owner, gpointer user_data) { - if (is_server_started == 0) - _monitor_register(connection); + if (is_server_started == 0) { + int *watcher_id = (int *)user_data; + _monitor_register(connection, watcher_id); + } } //LCOV_EXCL_START @@ -499,12 +484,12 @@ static void _on_name_vanished(GDBusConnection *connection, } //LCOV_EXCL_STOP -int sticker_dbus_init(GDBusConnection **gdbus_connection, guint *server_watcher_id, +int sticker_dbus_init(GDBusConnection **gdbus_connection, int *server_watcher_id, int *monitor_id, int *server_monitor_id, CLIENT_LIB lib, void *data) { int ret; - ret = _dbus_init(gdbus_connection, server_watcher_id); + ret = _dbus_init(gdbus_connection); if (ret != STICKER_CLIENT_ERROR_NONE) { LOGE("_dbus_init() failed : %d", ret); return ret; @@ -516,7 +501,7 @@ int sticker_dbus_init(GDBusConnection **gdbus_connection, guint *server_watcher_ return ret; } - ret = _monitor_register(*gdbus_connection); + ret = _monitor_register(*gdbus_connection, server_watcher_id); if (ret != STICKER_CLIENT_ERROR_NONE) { LOGE("_monitor_register() failed : %d", ret); return ret; @@ -529,7 +514,7 @@ int sticker_dbus_init(GDBusConnection **gdbus_connection, guint *server_watcher_ G_BUS_NAME_WATCHER_FLAGS_NONE, _on_name_appeared, _on_name_vanished, - NULL, + server_watcher_id, NULL); if (*server_monitor_id == 0) { g_dbus_connection_signal_unsubscribe(*gdbus_connection, *monitor_id); @@ -542,8 +527,22 @@ int sticker_dbus_init(GDBusConnection **gdbus_connection, guint *server_watcher_ return STICKER_CLIENT_ERROR_NONE; } -int sticker_dbus_shutdown(GDBusConnection *gdbus_connection, int *server_monitor_id, int *monitor_id) +int sticker_dbus_shutdown(GDBusConnection *gdbus_connection, int *server_watcher_id, int *server_monitor_id, int *monitor_id) { + int ret; + GVariant *body = NULL; + + if (server_watcher_id) { + body = g_variant_new("(i)", *server_watcher_id); + ret = _send_async_message(gdbus_connection, body, "sticker_service_unregister"); + if (ret != STICKER_CLIENT_ERROR_NONE) { + LOGE("Failed to unregister sticker service"); + return ret; + } + + *server_watcher_id = 0; + } + if (*server_monitor_id) { g_bus_unwatch_name(*server_monitor_id); *server_monitor_id = 0; @@ -554,6 +553,9 @@ int sticker_dbus_shutdown(GDBusConnection *gdbus_connection, int *server_monitor *monitor_id = 0; } + if (body) + g_variant_unref(body); + return STICKER_CLIENT_ERROR_NONE; } diff --git a/client/sticker_dbus.h b/client/sticker_dbus.h index d8fcbcd..44d2309 100644 --- a/client/sticker_dbus.h +++ b/client/sticker_dbus.h @@ -42,9 +42,9 @@ enum sticker_client_error { STICKER_CLIENT_ERROR_IO_ERROR, }; -int sticker_dbus_init(GDBusConnection **gdbus_connection, guint *server_watcher_id, +int sticker_dbus_init(GDBusConnection **gdbus_connection, int *server_watcher_id, int *monitor_id, int *server_monitor_id, CLIENT_LIB lib, void *data); -int sticker_dbus_shutdown(GDBusConnection *gdbus_connection, int *server_monitor_id, int *monitor_id); +int sticker_dbus_shutdown(GDBusConnection *gdbus_connection, int *server_watcher_id, int *server_monitor_id, int *monitor_id); int sticker_dbus_insert_sticker_info(GDBusConnection *gdbus_connection, sticker_data_h sticker_data); int sticker_dbus_insert_sticker_info_by_json(GDBusConnection *gdbus_connection, const char *app_id, const char *json_path); int sticker_dbus_delete_sticker_info(GDBusConnection *gdbus_connection, int record_id); diff --git a/consumer/sticker_consumer.c b/consumer/sticker_consumer.c index 7b5d544..8602652 100644 --- a/consumer/sticker_consumer.c +++ b/consumer/sticker_consumer.c @@ -180,7 +180,8 @@ EXPORT_API int sticker_consumer_destroy(sticker_consumer_h consumer_handle) return STICKER_ERROR_INVALID_PARAMETER; LOGD("consumer_handle : %p", consumer_handle); - ret = sticker_dbus_shutdown(consumer_handle->gdbus_connection, &consumer_handle->server_monitor_id, &consumer_handle->monitor_id); + ret = sticker_dbus_shutdown(consumer_handle->gdbus_connection, &consumer_handle->server_watcher_id, + &consumer_handle->server_monitor_id, &consumer_handle->monitor_id); if (ret != STICKER_ERROR_NONE) { LOGE("Failed to finalize dbus : %d", ret); free(consumer_handle); diff --git a/consumer/sticker_consumer_main.h b/consumer/sticker_consumer_main.h index ba7f90d..7a08ad2 100644 --- a/consumer/sticker_consumer_main.h +++ b/consumer/sticker_consumer_main.h @@ -28,7 +28,7 @@ extern "C" struct sticker_consumer_s { GDBusConnection *gdbus_connection; - guint server_watcher_id; + int server_watcher_id; int monitor_id; int server_monitor_id; }; diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index 50c55df..9ded0a6 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -76,9 +76,8 @@ find . -name '*.gcno' -exec cp '{}' gcov-obj ';' rm -rf %{buildroot} %make_install -mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants +mkdir -p %{buildroot}%{_prefix}/lib/systemd/system install -m 0644 %SOURCE1 %{buildroot}%{_unitdir}/capi-ui-sticker.service -%install_service multi-user.target.wants capi-ui-sticker.service mkdir -p %{buildroot}%{_datadir}/dbus-1/system-services install -m 0644 %SOURCE2 %{buildroot}%{_datadir}/dbus-1/system-services/org.tizen.sticker.server.service @@ -107,7 +106,6 @@ chsmack -a "System::Shared" %{TZ_SYS_SHARE}/sticker-data %{_libdir}/lib*.so %attr(0755,ui_fw,ui_fw) %{_bindir}/sticker-server %attr(0644,root,root) %{_unitdir}/capi-ui-sticker.service -%attr(0644,root,root) %{_unitdir}/multi-user.target.wants/capi-ui-sticker.service %attr(0644,root,root) %{_datadir}/dbus-1/system-services/org.tizen.sticker.server.service %config %{_sysconfdir}/dbus-1/system.d/capi-ui-sticker.conf %{TZ_SYS_RO_SHARE}/parser-plugins/capi-ui-sticker.info diff --git a/provider/sticker_provider.c b/provider/sticker_provider.c index 3761d6a..a271ca6 100644 --- a/provider/sticker_provider.c +++ b/provider/sticker_provider.c @@ -106,7 +106,8 @@ EXPORT_API int sticker_provider_destroy(sticker_provider_h provider_handle) return STICKER_ERROR_INVALID_PARAMETER; LOGD("provider_handle : %p", provider_handle); - ret = sticker_dbus_shutdown(provider_handle->gdbus_connection, &provider_handle->server_monitor_id, &provider_handle->monitor_id); + ret = sticker_dbus_shutdown(provider_handle->gdbus_connection, &provider_handle->server_watcher_id, + &provider_handle->server_monitor_id, &provider_handle->monitor_id); if (ret != STICKER_ERROR_NONE) { LOGE("Failed to finalize dbus : %d", ret); free(provider_handle); diff --git a/provider/sticker_provider_main.h b/provider/sticker_provider_main.h index 6280801..4f1c9dd 100644 --- a/provider/sticker_provider_main.h +++ b/provider/sticker_provider_main.h @@ -28,7 +28,7 @@ extern "C" struct sticker_provider_s { GDBusConnection *gdbus_connection; - guint server_watcher_id; + int server_watcher_id; int monitor_id; int server_monitor_id; sticker_provider_insert_finished_cb insert_finished_cb; diff --git a/server/stickerd_data_manager.c b/server/stickerd_data_manager.c index b0922da..f7a1e7b 100644 --- a/server/stickerd_data_manager.c +++ b/server/stickerd_data_manager.c @@ -42,8 +42,19 @@ #define STICKER_DIRECTORY tzplatform_mkpath(TZ_SYS_SHARE, "sticker-data") #define MAX_ERROR_BUFFER 256 -static GHashTable *_monitoring_hash; +static GHashTable *_monitoring_hash = NULL; static char error_buffer[MAX_ERROR_BUFFER]; +extern GMainLoop *main_loop; + +static void _check_watcher_exist() +{ + if (_monitoring_hash != NULL && g_hash_table_size(_monitoring_hash) == 0) { + LOGD("Terminate sticker daemon"); + g_hash_table_destroy(_monitoring_hash); + _monitoring_hash = NULL; + g_main_loop_quit(main_loop); + } +} static void _on_name_appeared(GDBusConnection *connection, const gchar *name, @@ -60,15 +71,19 @@ static void _on_name_vanished(GDBusConnection *connection, monitoring_info_s *info = (monitoring_info_s *)user_data; if (info) { - LOGD("name: %s", name); - g_bus_unwatch_name(info->watcher_id); - delete_monitoring_list(&_monitoring_hash, info->bus_name, info->uid); + if (_monitoring_hash != NULL && g_hash_table_lookup(_monitoring_hash, GUINT_TO_POINTER(info->watcher_id)) != NULL) { + LOGD("name: %s", name); + g_bus_unwatch_name(info->watcher_id); + delete_monitoring_list(&_monitoring_hash, info->bus_name, info->watcher_id); + } if (info->bus_name) free(info->bus_name); free(info); info = NULL; } + + _check_watcher_exist(); } static void _stickerd_client_dbus_method_call_handler(GDBusConnection *conn, const gchar *sender, const gchar *object_path, @@ -77,12 +92,17 @@ static void _stickerd_client_dbus_method_call_handler(GDBusConnection *conn, con { LOGD("stickerd method_name: %s, sender: %s", method_name, sender); + if (_monitoring_hash == NULL) + _monitoring_hash = g_hash_table_new(g_direct_hash, g_direct_equal); + GVariant *reply_body = NULL; int ret = STICKERD_SERVER_ERROR_OPERATION_FAILED; if (g_strcmp0(method_name, "sticker_service_register") == 0) { ret = stickerd_server_register(parameters, &reply_body, sender, _on_name_appeared, _on_name_vanished, &_monitoring_hash); + } else if (g_strcmp0(method_name, "sticker_service_unregister") == 0) { + ret = stickerd_server_unregister(parameters, &reply_body, sender, &_monitoring_hash); } else if (g_strcmp0(method_name, "insert_sticker_info") == 0) { ret = stickerd_insert_sticker_info(parameters, &reply_body); } else if (g_strcmp0(method_name, "update_sticker_info_by_json") == 0) { @@ -131,6 +151,8 @@ static void _stickerd_client_dbus_method_call_handler(GDBusConnection *conn, con if (reply_body) g_variant_unref(reply_body); + + _check_watcher_exist(); } static const GDBusInterfaceVTable _sticker_interface_vtable = { @@ -145,6 +167,11 @@ int stickerd_register_dbus_interface(void) " " " " " " + " " + " " + + " " + " " " " " " diff --git a/server/stickerd_dbus.c b/server/stickerd_dbus.c index 4ff175a..6184033 100644 --- a/server/stickerd_dbus.c +++ b/server/stickerd_dbus.c @@ -29,67 +29,92 @@ #define LOG_TAG "STICKERD_DBUS" static GDBusConnection *_gdbus_connection; +extern GMainLoop *main_loop; int stickerd_server_register(GVariant *parameters, GVariant **reply_body, const gchar *sender, GBusNameAppearedCallback name_appeared_handler, GBusNameVanishedCallback name_vanished_handler, GHashTable **monitoring_hash) { - GList *sender_list = NULL; - const char *bus_name = sender; + int ret = STICKERD_SERVER_ERROR_NONE; + char *m_info_bus_name = NULL; + char *list_bus_name = NULL; monitoring_info_s *m_info = NULL; - uid_t request_uid = 0; GList *monitoring_list = NULL; - if (bus_name == NULL) - return STICKERD_SERVER_ERROR_IO_ERROR; - - g_variant_get(parameters, "(i)", &request_uid); - monitoring_list = (GList *)g_hash_table_lookup(*monitoring_hash, GUINT_TO_POINTER(request_uid)); - sender_list = g_list_find_custom(monitoring_list, bus_name, (GCompareFunc) strcmp); + if (reply_body == NULL) + return STICKERD_SERVER_ERROR_INVALID_PARAMETER; - if (sender_list == NULL) { - LOGD("Add a new sender"); - m_info = (monitoring_info_s *)calloc(1, sizeof(monitoring_info_s)); - if (m_info == NULL) { - LOGE("Failed to alloc memory"); - return STICKERD_SERVER_ERROR_IO_ERROR; - } + m_info_bus_name = strdup(sender); + list_bus_name = strdup(sender); + if (m_info_bus_name == NULL || list_bus_name == NULL) { + ret = STICKERD_SERVER_ERROR_IO_ERROR; + goto cleanup; + } - m_info->bus_name = strdup(bus_name); - m_info->uid = request_uid; - m_info->watcher_id = g_bus_watch_name_on_connection( - _gdbus_connection, - bus_name, - G_BUS_NAME_WATCHER_FLAGS_NONE, - name_appeared_handler, - name_vanished_handler, - m_info, - NULL); - if (m_info->watcher_id == 0) { - LOGE("Failed to get identifier"); - free(m_info->bus_name); - free(m_info); - return STICKERD_SERVER_ERROR_IO_ERROR; - } + LOGD("Add a new sender"); + m_info = (monitoring_info_s *)calloc(1, sizeof(monitoring_info_s)); + if (m_info == NULL) { + LOGE("Failed to alloc memory"); + ret = STICKERD_SERVER_ERROR_OUT_OF_MEMORY; + goto cleanup; + } - monitoring_list = g_list_append(monitoring_list, strdup(bus_name)); - LOGD("sender: %s, len: %d", sender, g_list_length(monitoring_list)); - if (g_hash_table_lookup(*monitoring_hash, GUINT_TO_POINTER(request_uid)) == NULL) - g_hash_table_insert(*monitoring_hash, GUINT_TO_POINTER(request_uid), monitoring_list); - } else { - LOGW("Sender(%s) already exist", sender); + m_info->bus_name = m_info_bus_name; + m_info->watcher_id = g_bus_watch_name_on_connection( + _gdbus_connection, + m_info_bus_name, + G_BUS_NAME_WATCHER_FLAGS_NONE, + name_appeared_handler, + name_vanished_handler, + m_info, + NULL); + if (m_info->watcher_id == 0) { + LOGE("Failed to get identifier"); + ret = STICKERD_SERVER_ERROR_OPERATION_FAILED; + goto cleanup; } - *reply_body = g_variant_new("()"); + *reply_body = g_variant_new("(i)", m_info->watcher_id); if (*reply_body == NULL) { - if (m_info) { - if (m_info->bus_name) - free(m_info->bus_name); - free(m_info); - } - monitoring_list = g_list_remove(monitoring_list, bus_name); LOGE("Failed to make reply"); - return STICKERD_SERVER_ERROR_OUT_OF_MEMORY; + ret = STICKERD_SERVER_ERROR_OUT_OF_MEMORY; + goto cleanup; } + + LOGD("sender: %s, watcher: %d", sender, m_info->watcher_id); + monitoring_list = g_list_append(monitoring_list, list_bus_name); + if (g_hash_table_lookup(*monitoring_hash, GUINT_TO_POINTER(m_info->watcher_id)) == NULL) + g_hash_table_insert(*monitoring_hash, GUINT_TO_POINTER(m_info->watcher_id), monitoring_list); + else + LOGW("Sender(%s) already exist", sender); + + return STICKERD_SERVER_ERROR_NONE; + +cleanup: + if (m_info_bus_name) + free(m_info_bus_name); + + if (list_bus_name) + free(list_bus_name); + + if (m_info) { + free(m_info); + m_info = NULL; + } + + return ret; +} + +int stickerd_server_unregister(GVariant *parameters, GVariant **reply_body, const gchar *sender, GHashTable **monitoring_hash) +{ + int watcher_id = 0; + + g_variant_get(parameters, "(i)", &watcher_id); + + if (g_hash_table_lookup(*monitoring_hash, GUINT_TO_POINTER(watcher_id)) != NULL) { + g_bus_unwatch_name(watcher_id); + delete_monitoring_list(monitoring_hash, sender, watcher_id); + } + return STICKERD_SERVER_ERROR_NONE; } @@ -156,15 +181,15 @@ cleanup: return result; } -int delete_monitoring_list(GHashTable **monitoring_hash, const char *sender, uid_t uid) +int delete_monitoring_list(GHashTable **monitoring_hash, const char *sender, int watcher_id) { GList *monitoring_list = NULL; GList *del_list = NULL; char *bus_name; - monitoring_list = (GList *)g_hash_table_lookup(*monitoring_hash, GUINT_TO_POINTER(uid)); + monitoring_list = (GList *)g_hash_table_lookup(*monitoring_hash, GUINT_TO_POINTER(watcher_id)); if (monitoring_list == NULL) { - LOGE("The key(%d) is not found", uid); + LOGE("The key(%d) is not found", watcher_id); return STICKERD_SERVER_ERROR_IO_ERROR; } @@ -179,10 +204,10 @@ int delete_monitoring_list(GHashTable **monitoring_hash, const char *sender, uid monitoring_list = g_list_delete_link(monitoring_list, del_list); if (monitoring_list == NULL) { - g_hash_table_steal(*monitoring_hash, GUINT_TO_POINTER(uid)); + g_hash_table_steal(*monitoring_hash, GUINT_TO_POINTER(watcher_id)); } else { monitoring_list = g_list_first(monitoring_list); - g_hash_table_replace(*monitoring_hash, GUINT_TO_POINTER(uid), monitoring_list); + g_hash_table_replace(*monitoring_hash, GUINT_TO_POINTER(watcher_id), monitoring_list); } } return STICKERD_SERVER_ERROR_NONE; diff --git a/server/stickerd_dbus.h b/server/stickerd_dbus.h index 0197793..e8ad143 100644 --- a/server/stickerd_dbus.h +++ b/server/stickerd_dbus.h @@ -28,14 +28,13 @@ extern "C" { typedef struct monitoring_info { int watcher_id; char *bus_name; - uid_t uid; } monitoring_info_s; int stickerd_server_register(GVariant *parameters, GVariant **reply_body, const gchar *sender, GBusNameAppearedCallback name_appeared_handler, GBusNameVanishedCallback name_vanished_handler, GHashTable **monitoring_hash); int stickerd_server_unregister(GVariant *parameters, GVariant **reply_body, const gchar *sender, GHashTable **monitoring_hash); int stickerd_server_register_dbus_interface(char *introspection_xml, GDBusInterfaceVTable interface_vtable); -int delete_monitoring_list(GHashTable **monitoring_hash, const char *sender, uid_t uid); +int delete_monitoring_list(GHashTable **monitoring_hash, const char *sender, int monitoring_id); int stickerd_send_dbus_message(GVariant *body, const char *dest, char *cmd, CLIENT_LIB lib); #ifdef __cplusplus diff --git a/server/stickerd_main.c b/server/stickerd_main.c index 1650437..38d92f9 100644 --- a/server/stickerd_main.c +++ b/server/stickerd_main.c @@ -33,7 +33,7 @@ #define MAX_ERROR_BUFFER 256 -static GMainLoop *main_loop; +GMainLoop *main_loop = NULL; static GIOChannel *channel = NULL; static guint source = 0; -- 2.7.4