From 496dd0d68c095849c84927cdf90989354439d835 Mon Sep 17 00:00:00 2001 From: SukhyungKang Date: Mon, 29 Apr 2024 15:35:36 +0900 Subject: [PATCH] [ACR-1842] Deprecate shortcut api Change-Id: Ie5abccd20d14beba3eb703efecb6bfacb98c03dc Signed-off-by: SukhyungKang --- doc/shortcut_doc.h | 2 +- lib/include/shortcut.h | 68 ----------------------------------------- lib/include/shortcut_error.h | 1 + lib/include/shortcut_internal.h | 11 +++++++ lib/include/shortcut_manager.h | 30 +++++++++++++----- lib/src/shortcut_manager.cc | 11 +++++++ 6 files changed, 46 insertions(+), 77 deletions(-) diff --git a/doc/shortcut_doc.h b/doc/shortcut_doc.h index 1684d64..1c5c1db 100755 --- a/doc/shortcut_doc.h +++ b/doc/shortcut_doc.h @@ -22,7 +22,7 @@ /** * @ingroup CAPI_APPLICATION_FRAMEWORK - * @defgroup SHORTCUT_MODULE Shortcut + * @defgroup SHORTCUT_MODULE Shortcut (Deprecated) * @brief To enhance the Add to home feature. * - The other for the application developers who should implement the Add to home feature. * @section SHORTCUT_MODULE_HEADER Required Header diff --git a/lib/include/shortcut.h b/lib/include/shortcut.h index 68e7d4c..0d3aa12 100644 --- a/lib/include/shortcut.h +++ b/lib/include/shortcut.h @@ -38,74 +38,6 @@ extern "C" { */ /** - * @brief Called to receive the result of add_to_home_shortcut(). - * @since_tizen 2.3 - * @param[in] ret The result value, it could be @c 0 if it succeeds to add a shortcut, - * otherwise it returns an errno - * @param[in] pid The process ID of who handle this add_to_home request - * @param[in] user_data The user data passed from the registration function - * @return int @c 0 if there is no error, otherwise errno - * @see add_to_home_shortcut() - */ -typedef int (*result_internal_cb)(int ret, int pid, void *user_data); - -/** - * @brief Enumeration for shortcut types. - * @details Basically, three types of shortcuts are defined. - * Every homescreen developer should support these types of shortcuts. - * Or return a proper errno to figure out why the application failed to add a shortcut. - * #LAUNCH_BY_PACKAGE is used for adding a package itself as a shortcut. - * #LAUNCH_BY_URI is used for adding a shortcut for "uri" data. - * @since_tizen 2.3 - */ -enum shortcut_internal_type { - /**< Deprecated type */ - SHORTCUT_PACKAGE = 0x00000000, /**< Launch the package using the given package name */ - SHORTCUT_DATA = 0x00000001, /**< Launch the related package with the given data(content_info) */ - SHORTCUT_FILE = 0x00000002, /**< Launch the related package with the given filename(content_info) */ - - LAUNCH_BY_PACKAGE = 0x00000000, - - SHORTCUT_REMOVE = 0x40000000, /**< Remove a shortcut */ - DYNAMICBOX_REMOVE = 0x80000000, /**< Remove a widget */ - - DYNAMICBOX_TYPE_DEFAULT = 0x10000000, /**< Type mask for the default widget */ - DYNAMICBOX_TYPE_EASY_DEFAULT = 0x30000000, /**< Type mask for the easy mode widget */ - DYNAMICBOX_TYPE_1x1 = 0x10010000, /**< 1x1 */ - DYNAMICBOX_TYPE_2x1 = 0x10020000, /**< 2x1 */ - DYNAMICBOX_TYPE_2x2 = 0x10040000, /**< 2x2 */ - DYNAMICBOX_TYPE_4x1 = 0x10080000, /**< 4x1 */ - DYNAMICBOX_TYPE_4x2 = 0x10100000, /**< 4x2 */ - DYNAMICBOX_TYPE_4x3 = 0x10200000, /**< 4x3 */ - DYNAMICBOX_TYPE_4x4 = 0x10400000, /**< 4x4 */ - DYNAMICBOX_TYPE_4x5 = 0x11000000, /**< 4x5 */ - DYNAMICBOX_TYPE_4x6 = 0x12000000, /**< 4x6 */ - DYNAMICBOX_TYPE_EASY_1x1 = 0x30010000, /**< Easy mode 1x1 */ - DYNAMICBOX_TYPE_EASY_3x1 = 0x30020000, /**< Easy mode 3x2 */ - DYNAMICBOX_TYPE_EASY_3x3 = 0x30040000, /**< Easy mode 3x3 */ - DYNAMICBOX_TYPE_UNKNOWN = 0x1FFF0000, /**< Error */ -}; - -#define SHORTCUT_ERROR (shortcut_error_quark()) -GQuark shortcut_error_quark(void); - - -/** - * @brief Definition for a macro to check type. - * @since_tizen 2.3 - * @param[in] type The type of box - * @return bool - * @retval true(1) If it is a dynamicbox - * @retval false(0) If it is not a dynamicbox - * @see shortcut_type - */ -#define ADD_TO_HOME_IS_DYNAMICBOX(type) (!!((type) & 0x10000000)) - -/* DEPRECATED API */ -int add_to_home_shortcut(const char *appid, const char *name, int type, const char *content_info, const char *icon, int allow_duplicate, result_internal_cb result_cb, void *data) __attribute__((deprecated)); -int add_to_home_dynamicbox(const char *appid, const char *name, int type, const char *content, const char *icon, double period, int allow_duplicate, result_internal_cb result_cb, void *data) __attribute__((deprecated)); - -/** * @} */ diff --git a/lib/include/shortcut_error.h b/lib/include/shortcut_error.h index bb91924..ec4ca52 100644 --- a/lib/include/shortcut_error.h +++ b/lib/include/shortcut_error.h @@ -34,6 +34,7 @@ extern "C" { */ /** + * @deprecated Deprecated since 9.0 * @brief Enumeration for values of shortcut response types. * @since_tizen 2.3 */ diff --git a/lib/include/shortcut_internal.h b/lib/include/shortcut_internal.h index 9d760f3..a739803 100644 --- a/lib/include/shortcut_internal.h +++ b/lib/include/shortcut_internal.h @@ -41,6 +41,17 @@ int shortcut_add_to_home_widget_sync(const char *name, int shortcut_remove_from_home_sync(const char *name); /** + * @brief Definition for a macro to check type. + * @since_tizen 2.3 + * @param[in] type The type of box + * @return bool + * @retval true(1) If it is a dynamicbox + * @retval false(0) If it is not a dynamicbox + * @see shortcut_type + */ +#define ADD_TO_HOME_IS_DYNAMICBOX(type) (!!((type) & 0x10000000)) + +/** * @} */ diff --git a/lib/include/shortcut_manager.h b/lib/include/shortcut_manager.h index 0b6fcf3..2a47b89 100644 --- a/lib/include/shortcut_manager.h +++ b/lib/include/shortcut_manager.h @@ -37,6 +37,7 @@ extern "C" { /** + * @deprecated Deprecated since 9.0 * @brief Enumeration for shortcut types. * @details Basically, two types of shortcuts are defined. * Every homescreen developer should support these types of shortcuts. @@ -51,6 +52,7 @@ typedef enum _shortcut_type { } shortcut_type; /** + * @deprecated Deprecated since 9.0 * @brief Enumeration for sizes of shortcut widget. * @since_tizen 2.4 */ @@ -73,6 +75,7 @@ typedef enum shortcut_widget_size { /** + * @deprecated Deprecated since 9.0 * @brief Called to receive the result of shortcut_add_to_home(). * @since_tizen 2.3 * @param[in] ret The result value, it could be @c 0 if it succeeds to add a shortcut, @@ -86,6 +89,7 @@ typedef int (*result_cb)(int ret, void *user_data); /** + * @deprecated Deprecated since 9.0 * @brief Adds a shortcut to home, asynchronously. * @since_tizen 2.3 * @privlevel public @@ -147,10 +151,11 @@ static int app_create(void *data) } * @endcode */ -int shortcut_add_to_home(const char *name, shortcut_type type, const char *uri, const char *icon, int allow_duplicate, result_cb cb, void *data); +int shortcut_add_to_home(const char *name, shortcut_type type, const char *uri, const char *icon, int allow_duplicate, result_cb cb, void *data) TIZEN_DEPRECATED_API; /** + * @deprecated Deprecated since 9.0 * @brief Adds a widget to home, asynchronously. * @since_tizen 2.4 * @privlevel public @@ -214,10 +219,11 @@ static int app_create(void *data) } * @endcode */ -int shortcut_add_to_home_widget(const char *name, shortcut_widget_size_e size, const char *widget_id, const char *icon, double period, int allow_duplicate, result_cb cb, void *data); +int shortcut_add_to_home_widget(const char *name, shortcut_widget_size_e size, const char *widget_id, const char *icon, double period, int allow_duplicate, result_cb cb, void *data) TIZEN_DEPRECATED_API; /** + * @deprecated Deprecated since 9.0 * @brief Removes a shortcut from home, asynchronously. * @details If the callback function registered for a widget, the shortcut deletion is possible. * @since_tizen 3.0 @@ -261,10 +267,11 @@ int _result_cb(int ret, void *data) * @endcode */ -int shortcut_remove_from_home(const char *name, result_cb cb, void *user_data); +int shortcut_remove_from_home(const char *name, result_cb cb, void *user_data) TIZEN_DEPRECATED_API; /** + * @deprecated Deprecated since 9.0 * @brief Called to receive the result of shortcut_get_list(). * @since_tizen 2.4 * @param[in] package_name The name of package @@ -280,6 +287,7 @@ typedef int (*shortcut_list_cb)(const char *package_name, const char *icon, cons /** + * @deprecated Deprecated since 9.0 * @brief Gets the preset list of shortcut template from the installed package, synchronously. * @since_tizen 2.4 * @privlevel public @@ -304,10 +312,11 @@ typedef int (*shortcut_list_cb)(const char *package_name, const char *icon, cons * @post You have to check the return status from the callback function which is passed by the argument. * */ -int shortcut_get_list(const char *package_name, shortcut_list_cb list_cb, void *data); +int shortcut_get_list(const char *package_name, shortcut_list_cb list_cb, void *data) TIZEN_DEPRECATED_API; /** + * @deprecated Deprecated since 9.0 * @brief Called to the add_to_home request. * @details The homescreen should define a callback as this type and implement the service code * for adding a new application shortcut. @@ -331,6 +340,7 @@ typedef int (*shortcut_request_cb)(const char *package_name, const char *name, i /** + * @deprecated Deprecated since 9.0 * @brief Called to the shortcut_remove_from_home() request. * @since_tizen 3.0 * @param[in] package_name The name of package @@ -346,6 +356,7 @@ typedef int (*shortcut_remove_cb)(const char *package_name, const char *name, in /** + * @deprecated Deprecated since 9.0 * @brief Sets a callback function to listen requests from applications. * @since_tizen 2.4 * @privlevel public @@ -368,9 +379,10 @@ typedef int (*shortcut_remove_cb)(const char *package_name, const char *name, in * @see shortcut_request_cb() * @see shortcut_error_e */ -int shortcut_set_request_cb(shortcut_request_cb request_cb, void *data); +int shortcut_set_request_cb(shortcut_request_cb request_cb, void *data) TIZEN_DEPRECATED_API; /** + * @deprecated Deprecated since 9.0 * @brief Unsets a callback for the shortcut request. * @since_tizen 3.0 * @privlevel public @@ -383,10 +395,11 @@ int shortcut_set_request_cb(shortcut_request_cb request_cb, void *data); * @see shortcut_set_request_cb() * @see get_last_result() */ -void shortcut_unset_request_cb(void); +void shortcut_unset_request_cb(void) TIZEN_DEPRECATED_API; /** + * @deprecated Deprecated since 9.0 * @brief Sets the callback function to listen the remove requests from applications. * @since_tizen 3.0 * @privlevel public @@ -409,10 +422,11 @@ void shortcut_unset_request_cb(void); * @see shortcut_remove_cb() * @see shortcut_error_e */ -int shortcut_set_remove_cb(shortcut_remove_cb remove_cb, void *data); +int shortcut_set_remove_cb(shortcut_remove_cb remove_cb, void *data) TIZEN_DEPRECATED_API; /** + * @deprecated Deprecated since 9.0 * @brief Unsets a callback for the shortcut remove. * @since_tizen 3.0 * @privlevel public @@ -425,7 +439,7 @@ int shortcut_set_remove_cb(shortcut_remove_cb remove_cb, void *data); * @see shortcut_set_remove_cb() * @see get_last_result() */ -void shortcut_unset_remove_cb(void); +void shortcut_unset_remove_cb(void) TIZEN_DEPRECATED_API; /** diff --git a/lib/src/shortcut_manager.cc b/lib/src/shortcut_manager.cc index 69ffd66..689e75e 100644 --- a/lib/src/shortcut_manager.cc +++ b/lib/src/shortcut_manager.cc @@ -169,6 +169,7 @@ void Connect() { } // namespace EAPI int shortcut_set_request_cb(shortcut_request_cb request_cb, void* data) { + LOGW("DEPRECATION WARNING: shortcut_set_request_cb() is deprecated and will be removed from next release"); CHECK_SHORTCUT_FEATURE(); if (request_cb == nullptr) return SHORTCUT_ERROR_INVALID_PARAMETER; @@ -192,6 +193,7 @@ EAPI int shortcut_set_request_cb(shortcut_request_cb request_cb, void* data) { } EAPI void shortcut_unset_request_cb() { + LOGW("DEPRECATION WARNING: shortcut_unset_request_cb() is deprecated and will be removed from next release"); CHECK_SHORTCUT_FEATURE_RET_LAST_RESULT(); try { @@ -210,6 +212,7 @@ EAPI void shortcut_unset_request_cb() { } EAPI int shortcut_set_remove_cb(shortcut_remove_cb remove_cb, void* data) { + LOGW("DEPRECATION WARNING: shortcut_set_remove_cb() is deprecated and will be removed from next release"); CHECK_SHORTCUT_FEATURE(); if (remove_cb == nullptr) @@ -231,6 +234,7 @@ EAPI int shortcut_set_remove_cb(shortcut_remove_cb remove_cb, void* data) { } EAPI void shortcut_unset_remove_cb() { + LOGW("DEPRECATION WARNING: shortcut_unset_remove_cb() is deprecated and will be removed from next release"); CHECK_SHORTCUT_FEATURE_RET_LAST_RESULT(); try { ::Connect(); @@ -249,6 +253,7 @@ EAPI void shortcut_unset_remove_cb() { EAPI int shortcut_add_to_home(const char* name, shortcut_type type, const char* uri, const char* icon, int allow_duplicate, result_cb cb, void* data) { + LOGW("DEPRECATION WARNING: shortcut_add_to_home() is deprecated and will be removed from next release"); CHECK_SHORTCUT_FEATURE(); if (ADD_TO_HOME_IS_DYNAMICBOX(type)) { _E("Invalid type used for adding a shortcut"); @@ -283,6 +288,7 @@ EAPI int shortcut_add_to_home(const char* name, shortcut_type type, EAPI int shortcut_add_to_home_widget(const char* name, shortcut_widget_size_e size, const char* widget_id, const char* icon, double period, int allow_duplicate, result_cb cb, void* data) { + LOGW("DEPRECATION WARNING: shortcut_add_to_home_widget() is deprecated and will be removed from next release"); CHECK_SHORTCUT_FEATURE(); if (name == nullptr) { @@ -323,6 +329,7 @@ EAPI int shortcut_add_to_home_widget(const char* name, EAPI int shortcut_remove_from_home(const char* name, result_cb cb, void* user_data) { + LOGW("DEPRECATION WARNING: shortcut_remove_from_home() is deprecated and will be removed from next release"); CHECK_SHORTCUT_FEATURE(); if (name == nullptr) { _E("name is NULL."); @@ -354,6 +361,7 @@ EAPI int shortcut_get_list(const char* package_name, shortcut_list_cb list_cb, void* data) { int ret = SHORTCUT_ERROR_NONE; + LOGW("DEPRECATION WARNING: shortcut_get_list() is deprecated and will be removed from next release"); CHECK_SHORTCUT_FEATURE(); if (list_cb == nullptr) return SHORTCUT_ERROR_INVALID_PARAMETER; @@ -379,6 +387,7 @@ EAPI int shortcut_get_list(const char* package_name, shortcut_list_cb list_cb, EAPI int shortcut_add_to_home_sync(const char* name, shortcut_type type, const char* uri, const char* icon, int allow_duplicate) { + LOGW("DEPRECATION WARNING: shortcut_add_to_home_sync() is deprecated and will be removed from next release"); CHECK_SHORTCUT_FEATURE(); if (ADD_TO_HOME_IS_DYNAMICBOX(type)) { @@ -414,6 +423,7 @@ EAPI int shortcut_add_to_home_sync(const char* name, shortcut_type type, EAPI int shortcut_add_to_home_widget_sync(const char *name, shortcut_widget_size_e size, const char *widget_id, const char *icon, double period, int allow_duplicate) { + LOGW("DEPRECATION WARNING: shortcut_add_to_home_widget_sync() is deprecated and will be removed from next release"); CHECK_SHORTCUT_FEATURE(); if (name == NULL) { @@ -452,6 +462,7 @@ EAPI int shortcut_add_to_home_widget_sync(const char *name, } EAPI int shortcut_remove_from_home_sync(const char *name) { + LOGW("DEPRECATION WARNING: shortcut_remove_from_home_sync() is deprecated and will be removed from next release"); CHECK_SHORTCUT_FEATURE(); if (name == NULL) { -- 2.7.4