+++ /dev/null
-/*
- * Copyright (c) 2000 - 2016 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 __NOTIFICATION_PERMISSION_H__
-#define __NOTIFICATION_PERMISSION_H__
-
-#ifndef EXPORT_API
-#define EXPORT_API __attribute__ ((visibility("default")))
-#endif
-
-int notification_check_permission();
-
-#endif /* __NOTIFICATION_PERMISSION_H__ */
-
char buf_key[32] = { 0, };
char *ret_val = NULL;
- /* Check noti and image_path are valid data */
if (noti == NULL || image_path == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Check image type is valid type */
if (type <= NOTIFICATION_IMAGE_TYPE_NONE
|| type >= NOTIFICATION_IMAGE_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Check image path bundle is exist */
if (noti->b_image_path) {
- /* If image path bundle is exist, store local bundle value */
b = noti->b_image_path;
- /* Set image type to key as char string type */
snprintf(buf_key, sizeof(buf_key), "%d", type);
- /* Get value using key */
bundle_get_str(b, buf_key, &ret_val);
if (ret_val != NULL)
- /* If key is exist, remove this value to store new image path */
bundle_del(b, buf_key);
- /* Add new image path with type key */
bundle_add_str(b, buf_key, image_path);
} else {
- /* If image path bundle is not exist, create new one */
b = bundle_create();
- /* Set image type to key as char string type */
snprintf(buf_key, sizeof(buf_key), "%d", type);
- /* Add new image path with type key */
bundle_add_str(b, buf_key, image_path);
- /* Save to image path bundle */
noti->b_image_path = b;
}
char buf_key[32] = { 0, };
char *ret_val = NULL;
- /* Check noti and image_path is valid data */
if (noti == NULL || image_path == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Check image type is valid data */
if (type <= NOTIFICATION_IMAGE_TYPE_NONE
|| type >= NOTIFICATION_IMAGE_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Check image path bundle exist */
if (noti->b_image_path) {
- /* If image path bundle exist, store local bundle data */
b = noti->b_image_path;
- /* Set image type to key as char string type */
snprintf(buf_key, sizeof(buf_key), "%d", type);
- /* Get value of key */
bundle_get_str(b, buf_key, &ret_val);
*image_path = ret_val;
/* If image path is NULL and type is ICON, icon path set from AIL */
/* order : user icon -> launch_pkgname icon -> caller_pkgname icon -> service app icon */
if (*image_path == NULL && type == NOTIFICATION_IMAGE_TYPE_ICON) {
- /* Check App icon path is already set */
if (noti->app_icon_path != NULL)
- /* image path will be app icon path */
*image_path = noti->app_icon_path;
else
*image_path = NULL;
EXPORT_API int notification_set_time(notification_h noti, time_t input_time)
{
- /* Check noti is valid data */
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
if (input_time == 0)
- /* If input time is 0, set current time */
noti->time = time(NULL);
else
- /* save input time */
noti->time = input_time;
return NOTIFICATION_ERROR_NONE;
EXPORT_API int notification_get_time(notification_h noti, time_t *ret_time)
{
- /* Check noti and time is valid data */
if (noti == NULL || ret_time == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Set time infomation */
*ret_time = noti->time;
return NOTIFICATION_ERROR_NONE;
EXPORT_API int notification_get_insert_time(notification_h noti,
time_t *ret_time)
{
- /* Check noti and ret_time is valid data */
if (noti == NULL || ret_time == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Set insert time information */
*ret_time = noti->insert_time;
return NOTIFICATION_ERROR_NONE;
notification_count_pos_type_e var_value_count =
NOTIFICATION_COUNT_POS_NONE;
- /* Check noti is valid data */
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Check text type is valid type */
if (type <= NOTIFICATION_TEXT_TYPE_NONE
|| type >= NOTIFICATION_TEXT_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Check text bundle exist */
if (text != NULL) {
if (noti->b_text != NULL) {
- /* If text bundle exist, store local bundle data */
b = noti->b_text;
- /* Make type to key as char string */
snprintf(buf_key, sizeof(buf_key), "%d", type);
- /* Get value using type key */
bundle_get_str(b, buf_key, &ret_val);
if (ret_val != NULL)
- /* If value exist, remove this to add new value */
bundle_del(b, buf_key);
snprintf(buf_val, sizeof(buf_val), "%s", text);
- /* Add new text value */
bundle_add_str(b, buf_key, buf_val);
} else {
- /* If text bundle does not exist, create new one */
b = bundle_create();
- /* Make type to key as char string */
snprintf(buf_key, sizeof(buf_key), "%d", type);
-
snprintf(buf_val, sizeof(buf_val), "%s", text);
- /* Add new text value */
bundle_add_str(b, buf_key, buf_val);
- /* Save text bundle */
noti->b_text = b;
}
} else {
- /* Reset if text is NULL */
if (noti->b_text != NULL) {
- /* If text bundle exist, store local bundle data */
b = noti->b_text;
- /* Make type to key as char string */
snprintf(buf_key, sizeof(buf_key), "%d", type);
- /* Get value using type key */
bundle_get_str(b, buf_key, &ret_val);
if (ret_val != NULL)
- /* If value exist, remove this */
bundle_del(b, buf_key);
}
}
- /* Save key if key is valid data */
if (key != NULL) {
- /* Check key bundle exist */
if (noti->b_key != NULL) {
- /* If key bundle exist, store local bundle data */
b = noti->b_key;
- /* Make type to key as char string */
snprintf(buf_key, sizeof(buf_key), "%d", type);
- /* Get value using type key */
bundle_get_str(b, buf_key, &ret_val);
if (ret_val != NULL)
- /* If value exist, remove this to add new value */
bundle_del(b, buf_key);
snprintf(buf_val, sizeof(buf_val), "%s", key);
- /* Add new key value */
bundle_add_str(b, buf_key, buf_val);
} else {
- /* If key bundle does not exist, create new one */
b = bundle_create();
- /* Make type to key as char string */
snprintf(buf_key, sizeof(buf_key), "%d", type);
snprintf(buf_val, sizeof(buf_val), "%s", key);
- /* Add new key value */
bundle_add_str(b, buf_key, buf_val);
- /* Save key bundle */
noti->b_key = b;
}
} else {
- /* Reset if key is NULL */
if (noti->b_key != NULL) {
- /* If key bundle exist, store local bundle data */
b = noti->b_key;
- /* Make type to key as char string */
snprintf(buf_key, sizeof(buf_key), "%d", type);
- /* Get value using type key */
bundle_get_str(b, buf_key, &ret_val);
if (ret_val != NULL)
- /* If value exist, remove this */
bundle_del(b, buf_key);
}
}
char *ret_val = NULL;
char *get_str = NULL;
notification_text_type_e check_type = NOTIFICATION_TEXT_TYPE_NONE;
- /* int display_option_flag = 0; */
char *temp_str = NULL;
char *translated_str = NULL;
int src_len = 0;
int max_len = 0;
- /* Check noti is valid data */
if (noti == NULL || text == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Check text type is valid type */
if (type <= NOTIFICATION_TEXT_TYPE_NONE
|| type >= NOTIFICATION_TEXT_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Check key */
if (noti->b_key != NULL) {
b = noti->b_key;
if (get_str == NULL && noti->b_text != NULL) {
b = noti->b_text;
- /* Get basic text */
+
snprintf(buf_key, sizeof(buf_key), "%d", type);
bundle_get_str(b, buf_key, &get_str);
const char *domain,
const char *dir)
{
- /* check noti and domain is valid data */
if (noti == NULL || domain == NULL || dir == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Check domain */
if (noti->domain)
- /* Remove previous domain */
free(noti->domain);
- /* Copy domain */
noti->domain = strdup(domain);
- /* Check locale dir */
if (noti->dir)
- /* Remove previous locale dir */
free(noti->dir);
- /* Copy locale dir */
noti->dir = strdup(dir);
return NOTIFICATION_ERROR_NONE;
char **domain,
char **dir)
{
- /* Check noti is valid data */
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Get domain */
if (domain != NULL && noti->domain != NULL)
*domain = noti->domain;
- /* Get locale dir */
if (dir != NULL && noti->dir != NULL)
*dir = noti->dir;
notification_sound_type_e type,
const char *path)
{
- /* Check noti is valid data */
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
-
- /* Check type is valid */
if (type < NOTIFICATION_SOUND_TYPE_NONE
|| type >= NOTIFICATION_SOUND_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Save sound type */
noti->sound_type = type;
/* Save sound path if user data type */
notification_sound_type_e *type,
const char **path)
{
- /* check noti and type is valid data */
if (noti == NULL || type == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Set sound type */
*type = noti->sound_type;
/* Set sound path if user data type */
notification_vibration_type_e type,
const char *path)
{
- /* Check noti is valid data */
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Check type is valid */
if (type < NOTIFICATION_VIBRATION_TYPE_NONE
|| type >= NOTIFICATION_VIBRATION_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Save vibration type */
noti->vibration_type = type;
/* Save sound path if user data type */
notification_vibration_type_e *type,
const char **path)
{
- /* check noti and type is valid data */
if (noti == NULL || type == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Set vibration type */
*type = noti->vibration_type;
/* Set sound path if user data type */
notification_led_op_e operation,
int led_argb)
{
- /* Check noti is valid data */
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Check operation is valid */
if (operation < NOTIFICATION_LED_OP_OFF
|| operation >= NOTIFICATION_LED_OP_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Save led operation */
noti->led_operation = operation;
/* Save led argb if operation is turning on LED with custom color */
notification_led_op_e *operation,
int *led_argb)
{
- /* check noti and operation is valid data */
if (noti == NULL || operation == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Set led operation */
*operation = noti->led_operation;
/* Save led argb if operation is turning on LED with custom color */
EXPORT_API int notification_set_led_time_period(notification_h noti,
int on_ms, int off_ms)
{
- /* Check noti is valid data */
if (noti == NULL || on_ms < 0 || off_ms < 0)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Save led operation */
noti->led_on_ms = on_ms;
noti->led_off_ms = off_ms;
EXPORT_API int notification_get_led_time_period(notification_h noti,
int *on_ms, int *off_ms)
{
- /* check noti and operation is valid data */
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER");
goto out;
}
+
if (event_handler == NULL) {
err = NOTIFICATION_ERROR_INVALID_PARAMETER;
NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER");
goto out;
}
+
if (event_type < NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1
|| event_type > NOTIFICATION_EVENT_TYPE_CLICK_ON_THUMBNAIL) {
NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER");
}
b = noti->b_event_handler[event_type];
-
if (b == NULL) {
NOTIFICATION_DBG("No event handler\n");
err = NOTIFICATION_ERROR_NOT_EXIST_ID;
EXPORT_API int notification_set_property(notification_h noti,
int flags)
{
- /* Check noti is valid data */
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Set flags */
noti->flags_for_property = flags;
return NOTIFICATION_ERROR_NONE;
EXPORT_API int notification_get_property(notification_h noti,
int *flags)
{
- /* Check noti and flags are valid data */
if (noti == NULL || flags == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Set flags */
*flags = noti->flags_for_property;
return NOTIFICATION_ERROR_NONE;
EXPORT_API int notification_set_display_applist(notification_h noti,
int applist)
{
- /* Check noti is valid data */
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
-
- /* Set app list */
if (applist == 0xffffffff) /* 0xffffffff means old NOTIFICATION_DISPLAY_APP_ALL */
applist = NOTIFICATION_DISPLAY_APP_ALL;
EXPORT_API int notification_get_display_applist(notification_h noti,
int *applist)
{
- /* Check noti and applist are valid data */
if (noti == NULL || applist == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Set app list */
*applist = noti->display_applist;
return NOTIFICATION_ERROR_NONE;
EXPORT_API int notification_set_size(notification_h noti,
double size)
{
- /* Check noti is valid data */
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Save progress size */
noti->progress_size = size;
return NOTIFICATION_ERROR_NONE;
EXPORT_API int notification_get_size(notification_h noti,
double *size)
{
- /* Check noti and size is valid data */
if (noti == NULL || size == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Set progress size */
*size = noti->progress_size;
return NOTIFICATION_ERROR_NONE;
EXPORT_API int notification_set_progress(notification_h noti,
double percentage)
{
- /* Check noti is valid data */
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Save progress percentage */
noti->progress_percentage = percentage;
return NOTIFICATION_ERROR_NONE;
EXPORT_API int notification_get_progress(notification_h noti,
double *percentage)
{
- /* Check noti and percentage are valid data */
if (noti == NULL || percentage == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Set progress percentage */
*percentage = noti->progress_percentage;
return NOTIFICATION_ERROR_NONE;
EXPORT_API int notification_get_pkgname(notification_h noti,
char **pkgname)
{
- /* Check noti and pkgname are valid data */
if (noti == NULL || pkgname == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Get caller pkgname */
if (noti->caller_pkgname)
*pkgname = noti->caller_pkgname;
else
EXPORT_API int notification_set_layout(notification_h noti,
notification_ly_type_e layout)
{
- /* check noti and pkgname are valid data */
if (noti == NULL || (layout < NOTIFICATION_LY_NONE || layout >= NOTIFICATION_LY_MAX))
return NOTIFICATION_ERROR_INVALID_PARAMETER;
EXPORT_API int notification_get_layout(notification_h noti,
notification_ly_type_e *layout)
{
- /* Check noti and pkgname are valid data */
if (noti == NULL || layout == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
EXPORT_API int notification_get_type(notification_h noti,
notification_type_e *type)
{
- /* Check noti and type is valid data */
if (noti == NULL || type == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Set noti type */
*type = noti->type;
return NOTIFICATION_ERROR_NONE;
EXPORT_API int notification_set_tag(notification_h noti, const char *tag)
{
- /* Check noti is valid data */
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
if (tag != NULL) {
- /* save input TAG */
if (noti->tag != NULL)
free(noti->tag);
EXPORT_API int notification_get_tag(notification_h noti, const char **tag)
{
- /* Check noti is valid data */
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
int ret = 0;
int result = NOTIFICATION_ERROR_NONE;
- /* Open DB */
db = notification_db_open(DBPATH);
if (!db)
return get_last_result();
- /* Check pkgname & group_id */
ret = _notification_group_check_data_inserted(pkgname, group_id, db);
- /* Make query */
if (ret == NOTIFICATION_ERROR_NONE) {
/* Insert if does not exist */
snprintf(query, sizeof(query), "insert into noti_group_data ("
if (stmt)
sqlite3_finalize(stmt);
- /* Close DB */
if (db)
notification_db_close(&db);
int ret = 0;
int col = 0;
- /* Open DB */
db = notification_db_open(DBPATH);
if (!db)
return get_last_result();
- /* Make query */
if (group_id == NOTIFICATION_GROUP_ID_NONE) {
- /* Check Group id None is exist */
ret = _notification_group_check_data_inserted(pkgname, group_id, db);
-
if (ret == NOTIFICATION_ERROR_NONE)
/* Get all of pkgname count if none group id is not exist */
snprintf(query, sizeof(query),
"from noti_group_data "
"where caller_pkgname = '%s' and group_id = %d",
pkgname, group_id);
-
} else {
snprintf(query, sizeof(query),
"select badge "
sqlite3_finalize(stmt);
- /* db close */
if (db)
notification_db_close(&db);
EXPORT_API int notification_set_icon(notification_h noti,
const char *icon_path)
{
- int ret_err = NOTIFICATION_ERROR_NONE;
-
- ret_err =
- notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
- icon_path);
-
- return ret_err;
+ return notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, icon_path);
}
/* LCOV_EXCL_STOP */
int ret_err = NOTIFICATION_ERROR_NONE;
char *ret_image_path = NULL;
- ret_err =
- notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
+ ret_err = notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON,
&ret_image_path);
if (ret_err == NOTIFICATION_ERROR_NONE && icon_path != NULL)
const char *title,
const char *loc_title)
{
- int noti_err = NOTIFICATION_ERROR_NONE;
-
- noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
- title, loc_title,
- NOTIFICATION_VARIABLE_TYPE_NONE);
-
- return noti_err;
+ return notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
+ title, loc_title,
+ NOTIFICATION_VARIABLE_TYPE_NONE);;
}
/* LCOV_EXCL_STOP */
int noti_err = NOTIFICATION_ERROR_NONE;
char *ret_text = NULL;
- noti_err =
- notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
+ noti_err = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
&ret_text);
if (title != NULL)
const char *content,
const char *loc_content)
{
- int noti_err = NOTIFICATION_ERROR_NONE;
-
- noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
- content, loc_content,
- NOTIFICATION_VARIABLE_TYPE_NONE);
-
- return noti_err;
+ return notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
+ content, loc_content,
+ NOTIFICATION_VARIABLE_TYPE_NONE);
}
/* LCOV_EXCL_STOP */
int noti_err = NOTIFICATION_ERROR_NONE;
char *ret_text = NULL;
- noti_err =
- notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
+ noti_err = notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
&ret_text);
if (content != NULL)
*loc_content = NULL;
return noti_err;
-
-#if 0
- ret =
- vconf_get_bool
- (VCONFKEY_SETAPPL_STATE_TICKER_NOTI_DISPLAY_CONTENT_BOOL, &boolval);
-
- if (ret == -1 || boolval == 0) {
- if (content != NULL && noti->default_content != NULL)
- *content = noti->default_content;
-
- if (loc_content != NULL && noti->loc_default_content != NULL)
- *loc_content = noti->loc_default_content;
- }
-#endif
}
/* LCOV_EXCL_STOP */
int notification_clear_for_uid(notification_type_e type, uid_t uid)
{
- int ret = 0;
-
if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- ret = notification_ipc_request_delete_multiple(type, NULL, uid);
-
- return ret;
+ return notification_ipc_request_delete_multiple(type, NULL, uid);
}
/* LCOV_EXCL_STOP */
EXPORT_API int notification_set_pkgname(notification_h noti,
const char *pkgname)
{
- /* check noti and pkgname are valid data */
if (noti == NULL || pkgname == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
|| type >= NOTIFICATION_EXECUTE_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Create execute option bundle if does not exist */
if (noti->b_execute_option == NULL)
noti->b_execute_option = bundle_create();
b = noti->b_execute_option;
- /* Save text */
if (text != NULL) {
- /* Make text key */
snprintf(buf_key, sizeof(buf_key), "text%d", type);
- /* Check text key exist */
bundle_get_str(b, buf_key, &ret_val);
if (ret_val != NULL)
- /* Remove previous data */
bundle_del(b, buf_key);
- /* Add text data */
bundle_add_str(b, buf_key, text);
}
- /* Save key */
if (key != NULL) {
- /* Make key key */
snprintf(buf_key, sizeof(buf_key), "key%d", type);
- /* Check key key exist */
bundle_get_str(b, buf_key, &ret_val);
if (ret_val != NULL)
- /* Remove previous data */
bundle_del(b, buf_key);
- /* Add text data */
bundle_add_str(b, buf_key, key);
}
switch ((int)type) {
case NOTIFICATION_EXECUTE_TYPE_RESPONDING:
- /* Remove previous data if exist */
if (noti->b_service_responding != NULL) {
bundle_free(noti->b_service_responding);
noti->b_service_responding = NULL;
}
- /* Save service handle */
if (service_handle != NULL)
noti->b_service_responding = bundle_dup(service_handle);
break;
case NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH:
- /* Remove previous data if exist */
if (noti->b_service_single_launch != NULL) {
bundle_free(noti->b_service_single_launch);
noti->b_service_single_launch = NULL;
}
- /* Save service handle */
if (service_handle != NULL)
noti->b_service_single_launch =
bundle_dup(service_handle);
break;
case NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH:
- /* Remove previous data if exist */
if (noti->b_service_multi_launch != NULL) {
bundle_free(noti->b_service_multi_launch);
noti->b_service_multi_launch = NULL;
}
- /* Save service handle */
if (service_handle != NULL)
noti->b_service_multi_launch =
bundle_dup(service_handle);
EXPORT_API int notification_get_id(notification_h noti,
int *group_id, int *priv_id)
{
- /* check noti is valid data */
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Check group_id is valid data */
if (group_id) {
- /* Set group id */
if (noti->group_id < NOTIFICATION_GROUP_ID_NONE)
*group_id = NOTIFICATION_GROUP_ID_NONE;
else
*group_id = noti->group_id;
}
- /* Check priv_id is valid data */
if (priv_id)
- /* Set priv_id */
*priv_id = noti->priv_id;
return NOTIFICATION_ERROR_NONE;
}
if (b != NULL) {
- /* Return text */
if (text != NULL) {
- /* Get text domain and dir */
if (noti->domain == NULL || noti->dir == NULL)
_notification_get_text_domain(noti);
- /* Make key */
snprintf(buf_key, sizeof(buf_key), "key%d", type);
- /* Check key key exist */
bundle_get_str(b, buf_key, &ret_val);
if (ret_val != NULL && noti->domain != NULL
&& noti->dir != NULL) {
- /* Get application string */
bindtextdomain(noti->domain, noti->dir);
get_str = dgettext(noti->domain, ret_val);
*text = get_str;
} else if (ret_val != NULL) {
- /* Get system string */
get_str = dgettext("sys_string", ret_val);
*text = get_str;
} else {
- /* Get basic text */
snprintf(buf_key, sizeof(buf_key), "text%d",
type);
int ret = 0;
int id = 0;
- /* Check noti is vaild data */
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Check noti type is valid type */
if (noti->type <= NOTIFICATION_TYPE_NONE
|| noti->type >= NOTIFICATION_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
noti->uid = uid;
- /* Save insert time */
noti->insert_time = time(NULL);
+
ret = notification_ipc_request_insert(noti, &id);
if (ret != NOTIFICATION_ERROR_NONE)
return ret;
EXPORT_API int notification_update_async_for_uid(notification_h noti,
void (*result_cb)(int priv_id, int result, void *data), void *user_data, uid_t uid)
{
- int ret = 0;
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
noti->uid = uid;
/* Update insert time ? */
noti->insert_time = time(NULL);
- ret = notification_ipc_request_update_async(noti, result_cb, user_data);
- return ret;
+ return notification_ipc_request_update_async(noti, result_cb, user_data);
}
EXPORT_API int notification_update_async(notification_h noti,
int ret = 0;
int id = 0;
- /* Check noti is vaild data */
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Check noti type is valid type */
if (noti->type <= NOTIFICATION_TYPE_NONE
|| noti->type >= NOTIFICATION_TYPE_MAX)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
EXPORT_API int notification_update_for_uid(notification_h noti, uid_t uid)
{
- int ret;
-
- /* Check noti is valid data */
- if (noti != NULL) {
- noti->uid = uid;
- /* Update insert time ? */
- noti->insert_time = time(NULL);
- ret = notification_ipc_request_update(noti);
- } else {
+ if (noti == NULL) {
notification_ipc_request_refresh(uid);
return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
- return ret;
+ noti->uid = uid;
+ /* Update insert time ? */
+ noti->insert_time = time(NULL);
+
+ return notification_ipc_request_update(noti);
}
EXPORT_API int notification_delete_for_uid(notification_h noti, uid_t uid)
{
- int ret = 0;
if (noti == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- ret = notification_ipc_request_delete_single(NOTIFICATION_TYPE_NONE, noti->caller_pkgname, noti->priv_id, uid);
-
- return ret;
+ return notification_ipc_request_delete_single(NOTIFICATION_TYPE_NONE,
+ noti->caller_pkgname, noti->priv_id, uid);
}
EXPORT_API int notification_delete_all_for_uid(notification_type_e type, uid_t uid)
task_list *list;
task_list *list_new;
- list_new =
- (task_list *) malloc(sizeof(task_list));
-
+ list_new = (task_list *) malloc(sizeof(task_list));
if (list_new == NULL)
return NOTIFICATION_ERROR_OUT_OF_MEMORY;
list->next = list_new;
list_new->prev = list;
}
+
return NOTIFICATION_ERROR_NONE;
}
return NULL;
op_list = (notification_op *)malloc(sizeof(notification_op) * num_op);
-
if (op_list == NULL) {
NOTIFICATION_ERR("malloc failed");
return NULL;
char *ret;
char err_buf[ERR_BUFFER_SIZE];
- if (string == NULL)
- return NULL;
- if (string[0] == '\0')
+ if (string == NULL || string[0] == '\0')
return NULL;
ret = strdup(string);
static inline bundle *_create_bundle_from_bundle_raw(bundle_raw *string)
{
- if (string == NULL)
- return NULL;
- if (string[0] == '\0')
+ if (string == NULL || string[0] == '\0')
return NULL;
return bundle_decode(string, strlen((char *)string));
NOTIFICATION_ERR("failed to create a notification");
return;
}
+
g_variant_get(parameters, "(v)", &body);
notification_ipc_make_noti_from_gvariant(noti, body);
_print_noti(noti);
notification_call_changed_cb_for_uid(noti_op, 1, uid);
free(noti_op);
}
+
g_variant_unref(body);
notification_free(noti);
}
NOTIFICATION_DBG("data num deleted:%d", idx);
noti_op = _ipc_create_op(NOTIFICATION_OP_DELETE, idx, buf, idx, NULL);
-
if (noti_op == NULL) {
NOTIFICATION_ERR("_ipc_create_op failed");
return;
}
+
notification_call_changed_cb_for_uid(noti_op, idx, uid);
free(noti_op);
}
ret = NOTIFICATION_ERROR_NONE;
}
}
+
return ret;
}
g_error_free(err);
return ret;
}
+
NOTIFICATION_DBG("_send_sync_noti done !!");
return NOTIFICATION_ERROR_NONE;
-
}
static void _send_message_with_reply_async_cb(GDBusConnection *connection,
if (cb_item->result_cb)
cb_item->result_cb(priv_id, result, cb_item->data);
-
} else {
if (cb_item->result_cb)
cb_item->result_cb(NOTIFICATION_PRIV_ID_NONE, result, cb_item->data);
static int _send_service_register(uid_t uid)
{
- NOTIFICATION_DBG("service register");
GDBusMessage *reply = NULL;
int result;
notification_op *noti_op = NULL;
static int _ipc_monitor_register(uid_t uid)
{
- NOTIFICATION_DBG("register a service\n");
-
return _send_service_register(uid);
}
gpointer user_data)
{
int uid = GPOINTER_TO_INT(user_data);
+
NOTIFICATION_DBG("name appeared [%d] : %s", uid, name);
is_master_started = 1;
_ipc_monitor_register(uid);
gpointer user_data)
{
int uid = GPOINTER_TO_INT(user_data);
+
NOTIFICATION_DBG("name vanished [%d] : %s", uid, name);
is_master_started = 0;
}
return NOTIFICATION_ERROR_FROM_DB;
}
- ret =
- sqlite3_bind_text(stmt, index, NOTIFICATION_CHECK_STR(str), -1,
+ ret = sqlite3_bind_text(stmt, index, NOTIFICATION_CHECK_STR(str), -1,
SQLITE_STATIC);
if (ret != SQLITE_OK) {
NOTIFICATION_ERR("Insert text : %s",
if (noti->flags_for_property & NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE)
flag_simmode = 1;
- /* Make query */
*query = sqlite3_mprintf("INSERT INTO noti_list ("
"type, "
"layout, "
if (noti->flags_for_property & NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE)
flag_simmode = 1;
- /* Make query */
*query = sqlite3_mprintf("UPDATE noti_list SET "
"type = %d, "
"layout = %d, "
if (stmt == NULL || noti == NULL)
return ;
-
noti->type = sqlite3_column_int(stmt, col++);
noti->layout = sqlite3_column_int(stmt, col++);
__free_and_set((void **)&(noti->caller_pkgname), notification_db_column_text(stmt, col++));
char *query = NULL;
if (db == NULL) {
- ret = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto err;
+ NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
query = sqlite3_mprintf("UPDATE noti_list SET "
if (app_id == NULL || package_id == NULL) {
NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
if ((retval = pkgmgrinfo_appinfo_get_appinfo(app_id, &pkgmgrinfo_appinfo)) != PMINFO_R_OK) {
notification_setting_h setting = NULL;
notification_system_setting_h system_setting = NULL;
-
if (noti == NULL) {
NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER");
return NOTIFICATION_ERROR_INVALID_PARAMETER;
NOTIFICATION_WARN("_handle_do_not_disturb_option failed");
- /* Open DB */
db = notification_db_open(DBPATH);
if (!db)
return get_last_result();
noti->group_id = NOTIFICATION_GROUP_ID_NONE;
noti->internal_group_id = NOTIFICATION_GROUP_ID_NONE;
- /* make query */
ret = _insertion_query_create(noti, &query);
if (ret != NOTIFICATION_ERROR_NONE)
goto err;
if (stmt)
sqlite3_finalize(stmt);
- /* Close DB */
if (db)
notification_db_close(&db);
goto err;
}
- /* Open DB */
db = notification_db_open(DBPATH);
if (!db)
return get_last_result();
if (stmt)
sqlite3_finalize(stmt);
- /* Close DB */
if (db != NULL)
notification_db_close(&db);
sqlite3_stmt *stmt = NULL;
if (tag == NULL || noti == NULL) {
- ret = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto err;
+ NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
- /* Open DB */
db = notification_db_open(DBPATH);
if (!db)
return get_last_result();
if (stmt)
sqlite3_finalize(stmt);
- /* Close DB */
if (db != NULL)
notification_db_close(&db);
sqlite3_stmt *stmt = NULL;
char *query = NULL;
- /* Open DB */
db = notification_db_open(DBPATH);
if (!db)
return get_last_result();
if (stmt)
sqlite3_finalize(stmt);
- /* Close DB */
if (db)
notification_db_close(&db);
char query_where[NOTIFICATION_QUERY_MAX] = { 0, };
char err_buf[ERR_BUFFER_SIZE];
- /* Open DB */
db = notification_db_open(DBPATH);
if (!db)
return get_last_result();
snprintf(query_where, sizeof(query_where),
"where caller_pkgname = '%s' and type = %d and uid = %d",
pkgname, type, uid);
-
}
if (num_deleted != NULL)
if (stmt)
sqlite3_finalize(stmt);
- /* Close DB */
if (db)
notification_db_close(&db);
char query[NOTIFICATION_QUERY_MAX] = { 0, };
int ret;
- /* Check pkgname is valid */
if (pkgname == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Open DB */
db = notification_db_open(DBPATH);
if (!db)
return get_last_result();
- /* Make query */
snprintf(query, sizeof(query), "delete from noti_list "
"where caller_pkgname = '%s' and priv_id = %d", pkgname,
priv_id);
- /* execute DB */
ret = notification_db_exec(db, query, NULL);
- /* Close DB */
if (db)
notification_db_close(&db);
char query[NOTIFICATION_QUERY_MAX] = {0, };
int ret;
- /* Check pkgname is valid */
if (pkgname == NULL || strlen(pkgname) == 0)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
- /* Open DB */
db = notification_db_open(DBPATH);
if (!db)
return get_last_result();
- /* Make query */
snprintf(query, sizeof(query), "delete from noti_list "
"where caller_pkgname = '%s' and priv_id = %d and uid = %d", pkgname,
priv_id, uid);
NOTIFICATION_DBG("%s", query);
- /* execute DB */
ret = notification_db_exec(db, query, num_changes);
if (num_changes != NULL)
NOTIFICATION_DBG("deleted num:%d", *num_changes);
- /* Close DB */
if (db)
notification_db_close(&db);
int flag_where_more = 0;
int ret_vconf = 0;
- /* Open DB */
db = notification_db_open(DBPATH);
if (!db)
return get_last_result();
/* Check current sim status */
ret_vconf = vconf_get_int(VCONFKEY_TELEPHONY_SIM_SLOT, &status);
- /* Make query */
snprintf(query_base, sizeof(query_base),
"select count(*) from noti_list ");
sqlite3_finalize(stmt);
- /* Close DB */
if (db)
notification_db_close(&db);
int internal_count = 0;
int status;
- /* Open DB */
db = notification_db_open(DBPATH);
if (!db)
return get_last_result();
/* Check current sim status */
ret = vconf_get_int(VCONFKEY_TELEPHONY_SIM_SLOT, &status);
- /* Make query */
snprintf(query_base, sizeof(query_base), "select "
"type, layout, caller_pkgname, launch_pkgname, image_path, group_id, priv_id, "
"tag, b_text, b_key, b_format_args, num_format_args, "
if (stmt)
sqlite3_finalize(stmt);
- /* Close DB */
if (db)
notification_db_close(&db);
if (get_list != NULL)
*list = notification_list_get_head(get_list);
+
return ret;
}
int internal_group_id = 0;
int status = 0; /* If the vconf_get_int failed, the status will be the garbage value */
- /* Open DB */
db = notification_db_open(DBPATH);
if (!db)
return get_last_result();
/* Check current sim status */
ret = vconf_get_int(VCONFKEY_TELEPHONY_SIM_SLOT, &status);
- /* Make query */
snprintf(query_base, sizeof(query_base), "select "
"type, layout, caller_pkgname, launch_pkgname, image_path, group_id, priv_id, "
"tag, b_text, b_key, b_format_args, num_format_args, "
if (stmt)
sqlite3_finalize(stmt);
- /* Close DB */
if (db)
notification_db_close(&db);
if (noti->tag == NULL)
return NOTIFICATION_ERROR_NOT_EXIST_ID;
- /* Open DB */
db = notification_db_open(DBPATH);
if (!db)
return get_last_result();
+++ /dev/null
-/*
- * Copyright (c) 2000 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <db-util.h>
-
-#include <notification.h>
-#include <notification_db.h>
-#include <notification_noti.h>
-#include <notification_debug.h>
-#include <notification_ipc.h>
-#include <notification_private.h>
-#include <notification_permission.h>
-#include <cynara-client.h>
-
-#define NOTIFICATION_DB_ACCESS_READ 0
-#define NOTIFICATION_DB_ACCESS_WRITE 1
-#define SMACK_LABEL_LEN 255
-
-int notification_check_permission()
-{
- cynara *p_cynara;
-
- int fd = 0;
- int ret = 0;
- char subject_label[SMACK_LABEL_LEN + 1] = "";
- char uid[10] = {0,};
- char *client_session = "";
-
- static bool checked_privilege = FALSE;
-
- if (checked_privilege)
- return NOTIFICATION_ERROR_NONE;
-
- ret = cynara_initialize(&p_cynara, NULL);
- if (ret != CYNARA_API_SUCCESS) {
- LOGE("cannot init cynara [%d] failed!", ret);
- ret = NOTIFICATION_ERROR_IO_ERROR;
- goto out;
- }
-
- fd = open("/proc/self/attr/current", O_RDONLY);
- if (fd < 0) {
- LOGE("open [%d] failed!", errno);
- ret = NOTIFICATION_ERROR_IO_ERROR;
- goto out;
- }
-
- ret = read(fd, subject_label, SMACK_LABEL_LEN);
- if (ret < 0) {
- LOGE("read [%d] failed!", errno);
- close(fd);
- ret = NOTIFICATION_ERROR_IO_ERROR;
- goto out;
- }
- close(fd);
-
- snprintf(uid, 10, "%d", getuid());
- ret = cynara_check(p_cynara, subject_label, client_session, uid,
- "http://tizen.org/privilege/notification");
- if (ret != CYNARA_API_ACCESS_ALLOWED) {
- LOGE("cynara access check [%d] failed!", ret);
- ret = NOTIFICATION_ERROR_PERMISSION_DENIED;
- goto out;
- }
- ret = NOTIFICATION_ERROR_NONE;
- checked_privilege = TRUE;
-out:
-
- if (p_cynara)
- cynara_finish(p_cynara);
-
- return ret;
-}
-
EXPORT_API int notification_setting_get_setting_array_for_uid(notification_setting_h *setting_array, int *count, uid_t uid)
{
- int ret = NOTIFICATION_ERROR_NONE;
if (setting_array == NULL || count == NULL) {
NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER");
return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
- ret = notification_ipc_request_get_setting_array(setting_array, count, uid);
- return ret;
+
+ return notification_ipc_request_get_setting_array(setting_array, count, uid);
}
EXPORT_API int notification_setting_get_setting_array(notification_setting_h *setting_array, int *count)
EXPORT_API int notification_setting_get_setting_by_package_name_for_uid(const char *package_name, notification_setting_h *setting, uid_t uid)
{
- int ret = NOTIFICATION_ERROR_NONE;
if (package_name == NULL || setting == NULL) {
NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER");
return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
- ret = notification_ipc_request_get_setting_by_package_name(package_name, setting, uid);
- return ret;
+
+ return notification_ipc_request_get_setting_by_package_name(package_name, setting, uid);
}
/* LCOV_EXCL_START */
EXPORT_API int notification_setting_get_package_name(notification_setting_h setting, char **value)
{
- int err = NOTIFICATION_ERROR_NONE;
if (setting == NULL || value == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
if (setting->package_name == NULL) {
- NOTIFICATION_ERR("setting->package_name is null\n");
- err = NOTIFICATION_ERROR_NOT_EXIST_ID;
- goto out;
+ NOTIFICATION_ERR("setting->package_name is null");
+ return NOTIFICATION_ERROR_NOT_EXIST_ID;
}
*value = SAFE_STRDUP(setting->package_name);
-out:
-
- return err;
+ return NOTIFICATION_ERROR_NONE;
}
EXPORT_API int notification_setting_set_package_name(notification_setting_h setting, char *value)
{
- int err = NOTIFICATION_ERROR_NONE;
if (setting == NULL || value == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
if (setting->package_name != NULL)
setting->package_name = SAFE_STRDUP(value);
-out:
-
- return err;
+ return NOTIFICATION_ERROR_NONE;
}
EXPORT_API int notification_setting_get_allow_to_notify(notification_setting_h setting, bool *value)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (setting == NULL || value == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
*value = setting->allow_to_notify;
-out:
-
- return err;
+ return NOTIFICATION_ERROR_NONE;
}
EXPORT_API int notification_setting_set_allow_to_notify(notification_setting_h setting, bool value)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (setting == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
setting->allow_to_notify = value;
-out:
-
- return err;
+ return NOTIFICATION_ERROR_NONE;
}
EXPORT_API int notification_setting_get_do_not_disturb_except(notification_setting_h setting, bool *value)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (setting == NULL || value == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
*value = setting->do_not_disturb_except;
-out:
-
- return err;
+ return NOTIFICATION_ERROR_NONE;
}
EXPORT_API int notification_setting_set_do_not_disturb_except(notification_setting_h setting, bool value)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (setting == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
setting->do_not_disturb_except = value;
-out:
-
- return err;
+ return NOTIFICATION_ERROR_NONE;
}
EXPORT_API int notification_setting_get_visibility_class(notification_setting_h setting, int *value)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (setting == NULL || value == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
*value = setting->visibility_class;
-out:
-
- return err;
+ return NOTIFICATION_ERROR_NONE;
}
EXPORT_API int notification_setting_set_visibility_class(notification_setting_h setting, int value)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (setting == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
setting->visibility_class = value;
-out:
-
- return err;
+ return NOTIFICATION_ERROR_NONE;
}
EXPORT_API int notification_setting_update_setting_for_uid(notification_setting_h setting, uid_t uid)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (setting == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
- }
-
- err = notification_ipc_update_setting(setting, uid);
- if (err != NOTIFICATION_ERROR_NONE) {
- NOTIFICATION_ERR("notification_setting_update_setting returns[%d]\n", err);
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
-out:
- return err;
+ return notification_ipc_update_setting(setting, uid);
}
EXPORT_API int notification_setting_update_setting(notification_setting_h setting)
EXPORT_API int notification_setting_free_notification(notification_setting_h setting)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (setting == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
- }
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
SAFE_FREE(setting->package_name);
/* add codes to free all properties */
SAFE_FREE(setting);
-out:
- return err;
+ return NOTIFICATION_ERROR_NONE;
}
static bool _is_package_in_setting_table(sqlite3 *db, const char *package_name, uid_t uid)
if (db_statement)
sqlite3_finalize(db_statement);
- NOTIFICATION_INFO("foreach_package_info_callback returns[%d]", err);
return err;
}
pkgmgrinfo_pkginfo_filter_h filter;
setting_local_info info;
- NOTIFICATION_ERR("refresh seeting table [%d]", uid);
+ NOTIFICATION_INFO("refresh seeting table [%d]", uid);
sqlite3_ret = sqlite3_open_v2(DBPATH, &db, SQLITE_OPEN_READWRITE, NULL);
if (sqlite3_ret != SQLITE_OK || db == NULL) {
NOTIFICATION_ERR("db_util_open failed [%s][%d]", DBPATH, sqlite3_ret);
pkgmgrinfo_pkginfo_filter_destroy(filter);
-
out:
if (db) {
NOTIFICATION_WARN("fail to db_util_close - [%d]", sqlite3_ret);
}
- NOTIFICATION_INFO("notification_setting_refresh_setting_table returns [%08X]", err);
-
return err;
}
EXPORT_API int notification_setting_insert_package_for_uid(const char *package_id, uid_t uid)
{
- int err = NOTIFICATION_ERROR_NONE;
- err = _notification_setting_alter_package_list(OPERATION_TYPE_INSERT_RECORD, package_id, uid);
-
- return err;
+ return _notification_setting_alter_package_list(OPERATION_TYPE_INSERT_RECORD, package_id, uid);
}
EXPORT_API int notification_setting_delete_package_for_uid(const char *package_id, uid_t uid)
EXPORT_API int notification_system_setting_load_system_setting_for_uid(notification_system_setting_h *system_setting, uid_t uid)
{
- int ret = NOTIFICATION_ERROR_NONE;
if (system_setting == NULL) {
NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER");
return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
- ret = notification_ipc_request_load_system_setting(system_setting, uid);
- return ret;
+ return notification_ipc_request_load_system_setting(system_setting, uid);
}
EXPORT_API int notification_system_setting_load_system_setting(notification_system_setting_h *system_setting)
EXPORT_API int notification_system_setting_update_system_setting_for_uid(notification_system_setting_h system_setting, uid_t uid)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (system_setting == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
- }
-
- err = notification_ipc_update_system_setting(system_setting, uid);
- if (err != NOTIFICATION_ERROR_NONE) {
- NOTIFICATION_ERR("notification_ipc_update_system_setting returns[%d]\n", err);
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
-out:
- return err;
+ return notification_ipc_update_system_setting(system_setting, uid);
}
EXPORT_API int notification_system_setting_update_system_setting(notification_system_setting_h system_setting)
EXPORT_API int notification_system_setting_free_system_setting(notification_system_setting_h system_setting)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (system_setting == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
- }
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
/* add codes to free all properties */
SAFE_FREE(system_setting);
-out:
-
- return err;
+ return NOTIFICATION_ERROR_NONE;
}
EXPORT_API int notification_system_setting_get_do_not_disturb(notification_system_setting_h system_setting, bool *value)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (system_setting == NULL || value == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
*value = system_setting->do_not_disturb;
-out:
-
- return err;
+ return NOTIFICATION_ERROR_NONE;
}
EXPORT_API int notification_system_setting_set_do_not_disturb(notification_system_setting_h system_setting, bool value)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (system_setting == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
system_setting->do_not_disturb = value;
-out:
-
- return err;
+ return NOTIFICATION_ERROR_NONE;
}
EXPORT_API int notification_system_setting_get_visibility_class(notification_system_setting_h system_setting, int *value)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (system_setting == NULL || value == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
*value = system_setting->visibility_class;
-out:
-
- return err;
+ return NOTIFICATION_ERROR_NONE;
}
EXPORT_API int notification_system_setting_set_visibility_class(notification_system_setting_h system_setting, int value)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (system_setting == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
system_setting->visibility_class = value;
-out:
-
- return err;
+ return NOTIFICATION_ERROR_NONE;
}
EXPORT_API int notification_system_setting_dnd_schedule_get_enabled(notification_system_setting_h system_setting, bool *enabled)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (system_setting == NULL || enabled == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
*enabled = system_setting->dnd_schedule_enabled;
-out:
- return err;
+
+ return NOTIFICATION_ERROR_NONE;
}
EXPORT_API int notification_system_setting_dnd_schedule_set_enabled(notification_system_setting_h system_setting, bool enabled)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (system_setting == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
system_setting->dnd_schedule_enabled = enabled;
-out:
- return err;
+ return NOTIFICATION_ERROR_NONE;
}
EXPORT_API int notification_system_setting_dnd_schedule_get_day(notification_system_setting_h system_setting, int *day)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (system_setting == NULL || day == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
*day = system_setting->dnd_schedule_day;
-out:
- return err;
+ return NOTIFICATION_ERROR_NONE;
}
EXPORT_API int notification_system_setting_dnd_schedule_set_day(notification_system_setting_h system_setting, int day)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (system_setting == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
system_setting->dnd_schedule_day = day;
-out:
- return err;
+ return NOTIFICATION_ERROR_NONE;
}
EXPORT_API int notification_system_setting_dnd_schedule_get_start_time(notification_system_setting_h system_setting, int *hour, int *min)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (system_setting == NULL || hour == NULL || min == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
*hour = system_setting->dnd_start_hour;
*min = system_setting->dnd_start_min;
-out:
- return err;
+ return NOTIFICATION_ERROR_NONE;
}
EXPORT_API int notification_system_setting_dnd_schedule_set_start_time(notification_system_setting_h system_setting, int hour, int min)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (system_setting == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
system_setting->dnd_start_hour = hour;
system_setting->dnd_start_min = min;
-out:
- return err;
+ return NOTIFICATION_ERROR_NONE;
}
EXPORT_API int notification_system_setting_dnd_schedule_get_end_time(notification_system_setting_h system_setting, int *hour, int *min)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (system_setting == NULL || hour == NULL || min == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
*hour = system_setting->dnd_end_hour;
*min = system_setting->dnd_end_min;
-out:
- return err;
+ return NOTIFICATION_ERROR_NONE;
}
EXPORT_API int notification_system_setting_dnd_schedule_set_end_time(notification_system_setting_h system_setting, int hour, int min)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (system_setting == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
system_setting->dnd_end_hour = hour;
system_setting->dnd_end_min = min;
-out:
- return err;
+ return NOTIFICATION_ERROR_NONE;
}
EXPORT_API int notification_system_setting_get_lock_screen_content(notification_system_setting_h system_setting, lock_screen_content_level_e *level)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (system_setting == NULL || level == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
*level = system_setting->lock_screen_content_level;
-out:
- return err;
+ return NOTIFICATION_ERROR_NONE;
}
EXPORT_API int notification_system_setting_set_lock_screen_content(notification_system_setting_h system_setting, lock_screen_content_level_e level)
{
- int err = NOTIFICATION_ERROR_NONE;
-
if (system_setting == NULL) {
- NOTIFICATION_ERR("Invalid parameter\n");
- err = NOTIFICATION_ERROR_INVALID_PARAMETER;
- goto out;
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
system_setting->lock_screen_content_level = level;
-out:
- return err;
+ return NOTIFICATION_ERROR_NONE;
}