dbus-glib-1
vconf
capi-appfw-package-manager
+ capi-system-info
db-util
libtzplatform-config
pkgmgr-info
*
* @section BADGE_MODULE_OVERVIEW Overview
* It provides functions for creating and inserting and updating badge.
+ *
+ * @section CAPI_BADGE_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ * - http://tizen.org/feature/badge\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>
*/
* @retval BADGE_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
* @retval BADGE_ERROR_IO_ERROR Error from I/O
* @retval BADGE_ERROR_SERVICE_NOT_READY Service is not ready
+ * @retval BADGE_ERROR_NOT_SUPPORTED Not supported
* @see #badge_error_e
* @par Sample code:
* @code
* @retval #BADGE_ERROR_IO_ERROR Error from I/O
* @retval #BADGE_ERROR_SERVICE_NOT_READY Service is not ready
* @retval #BADGE_ERROR_INVALID_PACKAGE The caller application is not signed with the certificate of the badge_app_id
+ * @retval BADGE_ERROR_NOT_SUPPORTED Not supported
* @see #badge_error_e
* @par Sample code:
* @code
* @retval BADGE_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
* @retval BADGE_ERROR_IO_ERROR Error from I/O
* @retval BADGE_ERROR_SERVICE_NOT_READY Service is not ready
+ * @retval BADGE_ERROR_NOT_SUPPORTED Not supported
* @see #badge_error_e
* @par Sample code:
* @code
* @retval BADGE_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
* @retval BADGE_ERROR_IO_ERROR Error from I/O
* @retval BADGE_ERROR_SERVICE_NOT_READY Service is not ready
+ * @retval BADGE_ERROR_NOT_SUPPORTED Not supported
* @see #badge_error_e
* @see badge_new()
* @par Sample code:
* @retval BADGE_ERROR_FROM_DB Error from DB
* @retval BADGE_ERROR_ALREADY_EXIST Already exist
* @retval BADGE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval BADGE_ERROR_NOT_SUPPORTED Not supported
* @see #badge_error_e
* @see badge_new()
* @see badge_set_count()
* @retval BADGE_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
* @retval BADGE_ERROR_IO_ERROR Error from I/O
* @retval BADGE_ERROR_SERVICE_NOT_READY Service is not ready
+ * @retval BADGE_ERROR_NOT_SUPPORTED Not supported
* @see #badge_error_e
* @see badge_new()
* @par Sample code:
* @retval BADGE_ERROR_NOT_EXIST Not exist
* @retval BADGE_ERROR_SERVICE_NOT_READY Service is not ready
* @retval BADGE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval BADGE_ERROR_NOT_SUPPORTED Not supported
* @see #badge_error_e
* @see badge_new()
* @see badge_set_count()
* @retval BADGE_ERROR_FROM_DB Error form DB
* @retval BADGE_ERROR_OUT_OF_MEMORY Out of memory
* @retval BADGE_ERROR_NOT_EXIST Not exist
+ * @retval BADGE_ERROR_NOT_SUPPORTED Not supported
* @see #badge_error_e
* @see badge_foreach_cb()
*/
* @retval BADGE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval BADGE_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
* @retval BADGE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval BADGE_ERROR_NOT_SUPPORTED Not supported
* @see #badge_error_e
* @see badge_new()
* @see badge_remove()
* @retval BADGE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval BADGE_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
* @retval BADGE_ERROR_NOT_EXIST Not exist
+ * @retval BADGE_ERROR_NOT_SUPPORTED Not supported
* @see #badge_error_e
* @see badge_register_changed_cb()
*/
BADGE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
BADGE_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
BADGE_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< Error from I/O */
+ BADGE_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported (Since 4.0) */
BADGE_ERROR_FROM_DB = TIZEN_ERROR_BADGE | 0x01, /**< Error from DB */
BADGE_ERROR_ALREADY_EXIST = TIZEN_ERROR_BADGE | 0x02, /**< Already exist */
BADGE_ERROR_FROM_DBUS = TIZEN_ERROR_BADGE | 0x03, /**< Error from DBus */
* @privilege %http://tizen.org/privilege/notification
* @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
* @return 1 if badge service is ready, other value if badge service isn't ready
- * @exception BADGE_ERROR_NONE Success
- * @exception BADGE_ERROR_SERVICE_NOT_READY Service is not ready
+ * @retval BADGE_ERROR_NONE Success
+ * @retval BADGE_ERROR_SERVICE_NOT_READY Service is not ready
+ * @retval BADGE_ERROR_NOT_SUPPORTED Not supported
*/
int badge_is_service_ready(void);
* @retval BADGE_ERROR_NONE Success
* @retval BADGE_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
* @retval BADGE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval BADGE_ERROR_NOT_SUPPORTED Not supported
* @see #badge_error_e
* @see badge_is_service_ready()
*/
* @retval BADGE_ERROR_NONE Success
* @retval BADGE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval BADGE_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method
+ * @retval BADGE_ERROR_NOT_SUPPORTED Not supported
* @see #badge_error_e
* @see badge_is_service_ready()
*/
* @retval BADGE_ERROR_OUT_OF_MEMORY Out of memory
* @retval BADGE_ERROR_NOT_EXIST Not exist
* @retval BADGE_ERROR_SERVICE_NOT_READY Service is not ready
+ * @retval BADGE_ERROR_NOT_SUPPORTED Not supported
* @see #badge_error_e
* @see badge_new()
* @see badge_remove()
* @param[in] pkgname The name of the designated package
* @param[in] writable_pkg The name of package which is authorized to change the badge
* @return #BADGE_ERROR_NONE if success, other value if failure
+ * @retval BADGE_ERROR_NOT_SUPPORTED Not supported
* @see #badge_error_e
* @par Sample code:
* @code
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __BADGE_PRIVATE_H__
+#define __BADGE_PRIVATE_H__
+
+#include <system_info.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define BADGE_FEATURE "http://tizen.org/feature/badge"
+#define CHECK_BADGE_FEATURE() \
+ do { \
+ bool is_supported = false; \
+ if (!system_info_get_platform_bool(BADGE_FEATURE, &is_supported)) { \
+ if (is_supported == false) { \
+ LOGE("[%s] feature is disabled", BADGE_FEATURE); \
+ return BADGE_ERROR_NOT_SUPPORTED; \
+ } \
+ } \
+ } while (0)
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __BADGE_PRIVATE_H__ */
BuildRequires: pkgconfig(libtzplatform-config)
BuildRequires: pkgconfig(pkgmgr-info)
BuildRequires: pkgconfig(libsmack)
+BuildRequires: pkgconfig(capi-system-info)
BuildRequires: cmake
Requires(post): /sbin/ldconfig
requires(postun): /sbin/ldconfig
#include "badge_error.h"
#include "badge_internal.h"
#include "badge_ipc.h"
+#include "badge_private.h"
EXPORT_API
int badge_new(const char *writable_app_id)
{
dlog_print(DLOG_WARN, LOG_TAG, "DEPRECATION WARNING: badge_new() is deprecated and will be removed from next release. Use badge_add() instead.");
+ CHECK_BADGE_FEATURE();
if (writable_app_id == NULL)
return BADGE_ERROR_INVALID_PARAMETER;
EXPORT_API
int badge_add(const char *badge_app_id)
{
+ CHECK_BADGE_FEATURE();
return badge_add_for_uid(badge_app_id, getuid());
}
EXPORT_API
int badge_remove(const char *app_id)
{
+ CHECK_BADGE_FEATURE();
if (app_id == NULL)
return BADGE_ERROR_INVALID_PARAMETER;
EXPORT_API
int badge_foreach(badge_foreach_cb callback, void *user_data)
{
+ CHECK_BADGE_FEATURE();
if (callback == NULL)
return BADGE_ERROR_INVALID_PARAMETER;
EXPORT_API
int badge_set_count(const char *app_id, unsigned int count)
{
+ CHECK_BADGE_FEATURE();
if (app_id == NULL)
return BADGE_ERROR_INVALID_PARAMETER;
EXPORT_API
int badge_get_count(const char *app_id, unsigned int *count)
{
+ CHECK_BADGE_FEATURE();
if (app_id == NULL || count == NULL)
return BADGE_ERROR_INVALID_PARAMETER;
EXPORT_API
int badge_set_display(const char *app_id, unsigned int is_display)
{
+ CHECK_BADGE_FEATURE();
if (app_id == NULL)
return BADGE_ERROR_INVALID_PARAMETER;
EXPORT_API
int badge_get_display(const char *app_id, unsigned int *is_display)
{
+ CHECK_BADGE_FEATURE();
if (app_id == NULL || is_display == NULL)
return BADGE_ERROR_INVALID_PARAMETER;
EXPORT_API
int badge_register_changed_cb(badge_change_cb callback, void *data)
{
+ CHECK_BADGE_FEATURE();
if (callback == NULL)
return BADGE_ERROR_INVALID_PARAMETER;
EXPORT_API
int badge_unregister_changed_cb(badge_change_cb callback)
{
+ CHECK_BADGE_FEATURE();
if (callback == NULL)
return BADGE_ERROR_INVALID_PARAMETER;
#include "badge_internal.h"
#include "badge_ipc.h"
#include "badge_db.h"
+#include "badge_private.h"
#define BADGE_PKGNAME_LEN 512
#define BADGE_TABLE_NAME "badge_data"
EXPORT_API
int badge_create_for_uid(const char *pkgname, const char *writable_pkg, uid_t uid)
{
+ CHECK_BADGE_FEATURE();
char *caller = NULL;
int err = BADGE_ERROR_NONE;
EXPORT_API
int badge_new_for_uid(const char *writable_app_id, uid_t uid)
{
+ CHECK_BADGE_FEATURE();
char *caller = NULL;
int err = BADGE_ERROR_NONE;
EXPORT_API
int badge_add_for_uid(const char *badge_app_id, uid_t uid)
{
+ CHECK_BADGE_FEATURE();
char *caller = NULL;
int err = BADGE_ERROR_NONE;
EXPORT_API
int badge_remove_for_uid(const char *app_id, uid_t uid)
{
+ CHECK_BADGE_FEATURE();
char *caller = NULL;
int result = BADGE_ERROR_NONE;
EXPORT_API
int badge_is_existing_for_uid(const char *app_id, bool *existing, uid_t uid)
{
+ CHECK_BADGE_FEATURE();
return badge_ipc_request_is_existing(app_id, existing, uid);
}
EXPORT_API
int badge_foreach_for_uid(badge_foreach_cb callback, void *user_data, uid_t uid)
{
+ CHECK_BADGE_FEATURE();
int result = BADGE_ERROR_NONE;
result = badge_ipc_request_get_list(callback, user_data, uid);
if (result == BADGE_ERROR_IO_ERROR)
EXPORT_API
int badge_set_count_for_uid(const char *app_id, unsigned int count, uid_t uid)
{
+ CHECK_BADGE_FEATURE();
char *caller = NULL;
int result = BADGE_ERROR_NONE;
EXPORT_API
int badge_get_count_for_uid(const char *app_id, unsigned int *count, uid_t uid)
{
+ CHECK_BADGE_FEATURE();
int result = BADGE_ERROR_NONE;
result = badge_ipc_request_get_count(app_id, count, uid);
EXPORT_API
int badge_set_display_for_uid(const char *app_id, unsigned int is_display, uid_t uid)
{
+ CHECK_BADGE_FEATURE();
char *caller = NULL;
int result = BADGE_ERROR_NONE;
EXPORT_API
int badge_get_display_for_uid(const char *app_id, unsigned int *is_display, uid_t uid)
{
+ CHECK_BADGE_FEATURE();
int result = BADGE_ERROR_NONE;
result = badge_ipc_request_get_display(app_id, is_display, uid);
EXPORT_API
int badge_register_changed_cb_for_uid(badge_change_cb callback, void *data, uid_t uid)
{
+ CHECK_BADGE_FEATURE();
struct _badge_cb_data *bd = NULL;
GList *badge_cb_list = NULL;
GList *badge_found_list = NULL;
EXPORT_API
int badge_unregister_changed_cb_for_uid(badge_change_cb callback, uid_t uid)
{
+ CHECK_BADGE_FEATURE();
GList *badge_cb_list = NULL;
GList *badge_delete_list = NULL;
struct _badge_cb_data *bd = NULL;
EXPORT_API
int badge_is_service_ready(void)
{
+ CHECK_BADGE_FEATURE();
return badge_ipc_is_master_ready();
}
int badge_add_deferred_task(
void (*badge_add_deferred_task)(void *data), void *user_data)
{
+ CHECK_BADGE_FEATURE();
return badge_ipc_add_deferred_task(badge_add_deferred_task, user_data);
}
int badge_del_deferred_task(
void (*badge_add_deferred_task)(void *data))
{
+ CHECK_BADGE_FEATURE();
return badge_ipc_del_deferred_task(badge_add_deferred_task);
}
EXPORT_API
int badge_is_existing(const char *app_id, bool *existing)
{
+ CHECK_BADGE_FEATURE();
if (app_id == NULL || existing == NULL)
return BADGE_ERROR_INVALID_PARAMETER;
EXPORT_API
int badge_create(const char *pkgname, const char *writable_pkg)
{
+ CHECK_BADGE_FEATURE();
if (pkgname == NULL)
return BADGE_ERROR_INVALID_PARAMETER;