* \#include <shortcut_manager.h>
*
* @section SHORTCUT_MODULE_OVERVIEW Overview
- It provides function of creating shortcut.
- Developers can use the "shortcut_add_to_home" API to create their shortcut to a home screen.
+ * It provides function of creating shortcut.
+ * Developers can use the "shortcut_add_to_home" API to create their shortcut to a home screen.
+
+ * @section CAPI_SHORTCUT_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ * - http://tizen.org/feature/shortcut\n
+ * 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
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tizen-studio/native-tools/configuring-your-app/manifest-text-editor#feature"><b>Feature Element</b>.</a>
*/
vconf
capi-base-common
aul
+ capi-system-info
)
FOREACH(flag ${svc_pkgs_CFLAGS})
* @retval #SHORTCUT_ERROR_IO_ERROR I/O Error
* @retval #SHORTCUT_ERROR_PERMISSION_DENIED Permission denied
* @retval #SHORTCUT_ERROR_COMM Connection not established or communication problem
+ * @retval #SHORTCUT_ERROR_NOT_SUPPORTED Not supported
* @pre You have to prepare the callback function.
* @post You have to check the return status from the callback function which is passed by the argument.
* @see result_cb_t
* @retval #SHORTCUT_ERROR_PERMISSION_DENIED Permission denied
* @retval #SHORTCUT_ERROR_FAULT Unrecoverable error
* @retval #SHORTCUT_ERROR_COMM Connection not established or communication problem
+ * @retval #SHORTCUT_ERROR_NOT_SUPPORTED Not supported
* @pre You have to prepare the callback function.
* @post You have to check the return status from the callback function which is passed by the argument.
*
* @retval #SHORTCUT_ERROR_IO_ERROR I/O Error
* @retval #SHORTCUT_ERROR_PERMISSION_DENIED Permission denied
* @retval #SHORTCUT_ERROR_COMM Connection not established or communication problem
+ * @retval #SHORTCUT_ERROR_NOT_SUPPORTED Not supported
* @pre You have to prepare a callback function.
* @post If a request is sent from the application, the registered callback will be invoked.
* @see request_cb_t
/**
* @brief Unregisters a callback for the shortcut request.
* @since_tizen 3.0
+ * @remarks The specific error code can be obtained using the gat_last_result() method. Error codes are described in Exception section.
* @privlevel public
* @privilege %http://tizen.org/privilege/shortcut
+ * @return None
+ * @exception #SHORTCUT_ERROR_NONE Successful
+ * @exception #SHORTCUT_ERROR_NOT_SUPPORTED Not supported
+ * @exception #SHORTCUT_ERROR_PERMISSION_DENIED Permission denied
* @see shortcut_set_request_cb
+ * @see get_last_result()
*/
void shortcut_unset_request_cb(void);
* @retval #SHORTCUT_ERROR_IO_ERROR I/O Error
* @retval #SHORTCUT_ERROR_PERMISSION_DENIED Permission denied
* @retval #SHORTCUT_ERROR_COMM Connection not established or communication problem
+ * @retval #SHORTCUT_ERROR_NOT_SUPPORTED Not supported
* @pre You have to prepare a callback function.
* @post If a request is sent from the application, the registered callback will be invoked.
* @see remove_cb_t
/**
* @brief Unregisters a callback for the shortcut remove.
* @since_tizen 3.0
+ * @remarks The specific error code can be obtained using the gat_last_result() method. Error codes are described in Exception section.
* @privlevel public
* @privilege %http://tizen.org/privilege/shortcut
+ * @return None
+ * @exception #SHORTCUT_ERROR_NONE Successful
+ * @exception #SHORTCUT_ERROR_NOT_SUPPORTED Not supported
+ * @exception #SHORTCUT_ERROR_PERMISSION_DENIED Permission denied
* @see shortcut_set_remove_cb
+ * @see get_last_result()
*/
void shortcut_unset_remove_cb(void);
*
*/
+#ifndef __SHORTCUT_PRIVATE_H__
+#define __SHORTCUT_PRIVATE_H__
+
+#include <system_info.h>
+
#if !defined(FLOG)
#define SHORTCUT_DBG(format, arg...) SECURE_LOGD(format, ##arg)
#define SHORTCUT_ERR(format, arg...) SECURE_LOGE(format, ##arg)
#define EAPI __attribute__((visibility("default")))
#endif
-
#define DEFAULT_ICON_LAYOUT ""
#define DEFAULT_ICON_GROUP ""
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define SHORTCUT_FEATURE "http://tizen.org/feature/shortcut"
+#define CHECK_SHORTCUT_FEATURE() \
+ do { \
+ bool is_supported = false; \
+ if (!system_info_get_platform_bool(SHORTCUT_FEATURE, &is_supported)) { \
+ if (is_supported == false) { \
+ LOGE("[%s] feature is disabled", SHORTCUT_FEATURE); \
+ return SHORTCUT_ERROR_NOT_SUPPORTED; \
+ } \
+ } \
+ } while (0)
+
+#define CHECK_SHORTCUT_FEATURE_RET_LAST_RESULT() \
+ do { \
+ bool is_supported = false; \
+ if (!system_info_get_platform_bool(SHORTCUT_FEATURE, &is_supported)) { \
+ if (is_supported == false) { \
+ LOGE("[%s] feature is disabled", SHORTCUT_FEATURE); \
+ set_last_result(SHORTCUT_ERROR_NOT_SUPPORTED); \
+ return; \
+ } \
+ } \
+ } while (0)
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __SHORTCUT_PRIVATE_H__ */
+
/* End of a file */
{
int ret;
+ CHECK_SHORTCUT_FEATURE();
if (request_cb == NULL)
return SHORTCUT_ERROR_INVALID_PARAMETER; /* LCOV_EXCL_LINE */
EAPI void shortcut_unset_request_cb(void)
{
+ int ret;
+
+ CHECK_SHORTCUT_FEATURE_RET_LAST_RESULT();
+
+ ret = _check_privilege();
+ if (ret == SHORTCUT_ERROR_PERMISSION_DENIED) {
+ set_last_result(SHORTCUT_ERROR_PERMISSION_DENIED);
+ return;
+ }
+
_unset_request_cb();
+ set_last_result(SHORTCUT_ERROR_NONE);
}
EAPI int shortcut_set_remove_cb(shortcut_remove_cb remove_cb, void *data)
{
int ret;
+ CHECK_SHORTCUT_FEATURE();
if (remove_cb == NULL)
return SHORTCUT_ERROR_INVALID_PARAMETER;
EAPI void shortcut_unset_remove_cb(void)
{
+ int ret;
+
+ CHECK_SHORTCUT_FEATURE_RET_LAST_RESULT();
+
+ ret = _check_privilege();
+ if (ret == SHORTCUT_ERROR_PERMISSION_DENIED) {
+ set_last_result(SHORTCUT_ERROR_PERMISSION_DENIED);
+ return;
+ }
+
_unset_remove_cb();
+ set_last_result(SHORTCUT_ERROR_NONE);
}
static char *_make_request_id()
GVariant *body;
char *request_id = NULL;
+ CHECK_SHORTCUT_FEATURE();
+
if (ADD_TO_HOME_IS_DYNAMICBOX(type)) {
/* LCOV_EXCL_START */
SHORTCUT_ERR("Invalid type used for adding a shortcut\n");
GVariant *body;
char *request_id = NULL;
+ CHECK_SHORTCUT_FEATURE();
+
if (name == NULL) {
SHORTCUT_ERR("AppID is null\n");
return SHORTCUT_ERROR_INVALID_PARAMETER;
GVariant *body;
char *request_id = NULL;
+ CHECK_SHORTCUT_FEATURE();
+
if (name == NULL) {
SHORTCUT_ERR("name is NULL.");
return SHORTCUT_ERROR_INVALID_PARAMETER;
GVariantBuilder *b;
shortcut_info_s shortcut;
+ CHECK_SHORTCUT_FEATURE();
+
if (list_cb == NULL)
return SHORTCUT_ERROR_INVALID_PARAMETER;
EAPI int add_to_home_shortcut(const char *appid, const char *name, int type, const char *content,
const char *icon, int allow_duplicate, result_internal_cb_t result_cb, void *data)
{
+ CHECK_SHORTCUT_FEATURE();
/*Deprecated API */
return SHORTCUT_ERROR_NONE;
}
/* LCOV_EXCL_START */
EAPI 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_t result_cb, void *data)
{
+ CHECK_SHORTCUT_FEATURE();
/*Deprecated API */
return SHORTCUT_ERROR_NONE;
}
BuildRequires: pkgconfig(capi-base-common)
BuildRequires: pkgconfig(aul)
BuildRequires: pkgconfig(libtzplatform-config)
+BuildRequires: pkgconfig(capi-system-info)
%define upgrade_script_path /usr/share/upgrade/scripts