summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMyungki Lee <mk5004.lee@samsung.com>2016-07-08 16:44:57 +0900
committerMyungKi Lee <mk5004.lee@samsung.com>2016-07-11 05:43:52 -0700
commit8d92dbfccb885d26408e3cc457c6c09b797e9edd (patch)
tree2a205a204ff0e06e5890456189fa185856a2407c
parent80c5e233e490cf900fd5bb6f43409d437d77e5fe (diff)
downloadnotification-8d92dbfccb885d26408e3cc457c6c09b797e9edd.tar.gz
notification-8d92dbfccb885d26408e3cc457c6c09b797e9edd.tar.bz2
notification-8d92dbfccb885d26408e3cc457c6c09b797e9edd.zip
Delete the unused files, codes, comments
- Permission check is performed by dbus - Delete unnessary comments - Modify the inefficient codes Change-Id: Idb3e2bb93b28d5694bae00062292be523b598944 Signed-off-by: Myungki Lee <mk5004.lee@samsung.com>
-rw-r--r--include/notification_permission.h27
-rwxr-xr-xsrc/notification.c125
-rwxr-xr-xsrc/notification_group.c10
-rwxr-xr-xsrc/notification_internal.c119
-rwxr-xr-xsrc/notification_ipc.c27
-rwxr-xr-xsrc/notification_noti.c51
-rwxr-xr-xsrc/notification_permission.c90
-rwxr-xr-xsrc/notification_setting.c318
8 files changed, 132 insertions, 635 deletions
diff --git a/include/notification_permission.h b/include/notification_permission.h
deleted file mode 100644
index da92a58..0000000
--- a/include/notification_permission.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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__ */
-
diff --git a/src/notification.c b/src/notification.c
index 2f6f00a..7063a80 100755
--- a/src/notification.c
+++ b/src/notification.c
@@ -100,42 +100,30 @@ EXPORT_API int notification_set_image(notification_h noti,
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;
}
@@ -150,24 +138,18 @@ EXPORT_API int notification_get_image(notification_h noti,
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;
@@ -179,9 +161,7 @@ EXPORT_API int notification_get_image(notification_h noti,
/* 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;
@@ -192,15 +172,12 @@ EXPORT_API int notification_get_image(notification_h noti,
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;
@@ -208,11 +185,9 @@ EXPORT_API int notification_set_time(notification_h noti, time_t input_time)
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;
@@ -221,11 +196,9 @@ EXPORT_API int notification_get_time(notification_h noti, time_t *ret_time)
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;
@@ -249,115 +222,81 @@ EXPORT_API int notification_set_text(notification_h noti,
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);
}
}
@@ -488,7 +427,6 @@ EXPORT_API int notification_get_text(notification_h noti,
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;
@@ -501,17 +439,14 @@ EXPORT_API int notification_get_text(notification_h noti,
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;
@@ -541,7 +476,7 @@ EXPORT_API int notification_get_text(notification_h noti,
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);
@@ -874,24 +809,17 @@ EXPORT_API int notification_set_text_domain(notification_h noti,
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;
@@ -901,15 +829,12 @@ EXPORT_API int notification_get_text_domain(notification_h noti,
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;
@@ -982,17 +907,13 @@ EXPORT_API int notification_set_sound(notification_h noti,
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 */
@@ -1019,11 +940,9 @@ EXPORT_API int notification_get_sound(notification_h noti,
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 */
@@ -1038,16 +957,13 @@ EXPORT_API int notification_set_vibration(notification_h noti,
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 */
@@ -1075,11 +991,9 @@ EXPORT_API int notification_get_vibration(notification_h noti,
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 */
@@ -1094,16 +1008,13 @@ EXPORT_API int notification_set_led(notification_h noti,
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 */
@@ -1117,11 +1028,9 @@ EXPORT_API int notification_get_led(notification_h noti,
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 */
@@ -1135,11 +1044,9 @@ EXPORT_API int notification_get_led(notification_h noti,
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;
@@ -1149,7 +1056,6 @@ EXPORT_API int notification_set_led_time_period(notification_h noti,
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;
@@ -1277,11 +1183,13 @@ EXPORT_API int notification_get_event_handler(notification_h noti, notification_
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");
@@ -1290,7 +1198,6 @@ EXPORT_API int notification_get_event_handler(notification_h noti, notification_
}
b = noti->b_event_handler[event_type];
-
if (b == NULL) {
NOTIFICATION_DBG("No event handler\n");
err = NOTIFICATION_ERROR_NOT_EXIST_ID;
@@ -1329,11 +1236,9 @@ out:
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;
@@ -1342,11 +1247,9 @@ EXPORT_API int notification_set_property(notification_h noti,
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;
@@ -1355,12 +1258,9 @@ EXPORT_API int notification_get_property(notification_h noti,
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;
@@ -1372,11 +1272,9 @@ EXPORT_API int notification_set_display_applist(notification_h noti,
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;
@@ -1385,11 +1283,9 @@ EXPORT_API int notification_get_display_applist(notification_h noti,
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;
@@ -1398,11 +1294,9 @@ EXPORT_API int notification_set_size(notification_h noti,
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;
@@ -1411,11 +1305,9 @@ EXPORT_API int notification_get_size(notification_h noti,
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;
@@ -1424,11 +1316,9 @@ EXPORT_API int notification_set_progress(notification_h noti,
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;
@@ -1437,11 +1327,9 @@ EXPORT_API int notification_get_progress(notification_h noti,
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
@@ -1453,7 +1341,6 @@ EXPORT_API int notification_get_pkgname(notification_h noti,
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;
@@ -1465,7 +1352,6 @@ EXPORT_API int notification_set_layout(notification_h noti,
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;
@@ -1479,11 +1365,9 @@ EXPORT_API int notification_get_layout(notification_h noti,
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;
@@ -1843,12 +1727,10 @@ EXPORT_API int notification_free(notification_h noti)
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);
@@ -1861,7 +1743,6 @@ EXPORT_API int notification_set_tag(notification_h noti, const char *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;
diff --git a/src/notification_group.c b/src/notification_group.c
index f5e5c38..edd2c22 100755
--- a/src/notification_group.c
+++ b/src/notification_group.c
@@ -70,15 +70,12 @@ int notification_group_set_badge(const char *pkgname,
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 ("
@@ -116,7 +113,6 @@ int notification_group_set_badge(const char *pkgname,
if (stmt)
sqlite3_finalize(stmt);
- /* Close DB */
if (db)
notification_db_close(&db);
@@ -134,16 +130,12 @@ int notification_group_get_badge(const char *pkgname,
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),
@@ -157,7 +149,6 @@ int notification_group_get_badge(const char *pkgname,
"from noti_group_data "
"where caller_pkgname = '%s' and group_id = %d",
pkgname, group_id);
-
} else {
snprintf(query, sizeof(query),
"select badge "
@@ -185,7 +176,6 @@ int notification_group_get_badge(const char *pkgname,
sqlite3_finalize(stmt);
- /* db close */
if (db)
notification_db_close(&db);
diff --git a/src/notification_internal.c b/src/notification_internal.c
index 26cbbc5..4fbe665 100755
--- a/src/notification_internal.c
+++ b/src/notification_internal.c
@@ -332,13 +332,7 @@ EXPORT_API int notification_update_content(notification_h noti,
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 */
@@ -350,8 +344,7 @@ EXPORT_API int notification_get_icon(notification_h noti,
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)
@@ -406,13 +399,9 @@ EXPORT_API int notification_set_title(notification_h noti,
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 */
@@ -424,8 +413,7 @@ EXPORT_API int notification_get_title(notification_h noti,
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)
@@ -443,13 +431,9 @@ EXPORT_API int notification_set_content(notification_h noti,
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 */
@@ -461,8 +445,7 @@ EXPORT_API int notification_get_content(notification_h noti,
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)
@@ -472,20 +455,6 @@ EXPORT_API int notification_get_content(notification_h noti,
*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 */
@@ -686,14 +655,10 @@ EXPORT_API int notification_get_count(notification_type_e type,
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 */
@@ -738,7 +703,6 @@ EXPORT_API int notification_op_get_data(notification_op *noti_op, notification_o
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;
@@ -835,76 +799,59 @@ EXPORT_API int notification_set_execute_option(notification_h noti,
|| 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);
@@ -920,22 +867,17 @@ EXPORT_API int notification_set_execute_option(notification_h noti,
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;
@@ -1019,32 +961,25 @@ EXPORT_API int notification_get_execute_option(notification_h noti,
}
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);
@@ -1068,18 +1003,16 @@ EXPORT_API int notification_insert_for_uid(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;
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;
@@ -1103,16 +1036,14 @@ EXPORT_API int notification_insert(notification_h noti,
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,
@@ -1244,11 +1175,9 @@ EXPORT_API int notification_post_for_uid(notification_h noti, uid_t uid)
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;
@@ -1269,32 +1198,26 @@ EXPORT_API int notification_post_for_uid(notification_h noti, uid_t uid)
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)
diff --git a/src/notification_ipc.c b/src/notification_ipc.c
index 1afb44e..9bc45e7 100755
--- a/src/notification_ipc.c
+++ b/src/notification_ipc.c
@@ -192,9 +192,7 @@ int notification_ipc_add_deffered_task(
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;
@@ -215,6 +213,7 @@ int notification_ipc_add_deffered_task(
list->next = list_new;
list_new->prev = list;
}
+
return NOTIFICATION_ERROR_NONE;
}
@@ -299,7 +298,6 @@ static notification_op *_ipc_create_op(notification_op_type_e type,
return NULL;
op_list = (notification_op *)malloc(sizeof(notification_op) * num_op);
-
if (op_list == NULL) {
NOTIFICATION_ERR("malloc failed");
return NULL;
@@ -326,9 +324,7 @@ static inline char *_dup_string(const char *string)
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);
@@ -340,9 +336,7 @@ static inline char *_dup_string(const char *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));
@@ -398,6 +392,7 @@ static void _update_noti_notify(GVariant *parameters)
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);
@@ -408,6 +403,7 @@ static void _update_noti_notify(GVariant *parameters)
notification_call_changed_cb_for_uid(noti_op, 1, uid);
free(noti_op);
}
+
g_variant_unref(body);
notification_free(noti);
}
@@ -465,11 +461,11 @@ static void _delete_multiple_notify(GVariant *parameters)
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);
}
@@ -528,6 +524,7 @@ static int _dbus_signal_init()
ret = NOTIFICATION_ERROR_NONE;
}
}
+
return ret;
}
@@ -588,9 +585,9 @@ static int _send_sync_noti(GVariant *body, GDBusMessage **reply, char *cmd)
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,
@@ -643,7 +640,6 @@ 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);
@@ -1803,7 +1799,6 @@ EXPORT_API int notification_ipc_make_setting_from_gvariant(struct notification_s
static int _send_service_register(uid_t uid)
{
- NOTIFICATION_DBG("service register");
GDBusMessage *reply = NULL;
int result;
notification_op *noti_op = NULL;
@@ -1825,8 +1820,6 @@ static int _send_service_register(uid_t uid)
static int _ipc_monitor_register(uid_t uid)
{
- NOTIFICATION_DBG("register a service\n");
-
return _send_service_register(uid);
}
@@ -1837,6 +1830,7 @@ static void _on_name_appeared(GDBusConnection *connection,
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);
@@ -1852,6 +1846,7 @@ static void _on_name_vanished(GDBusConnection *connection,
gpointer user_data)
{
int uid = GPOINTER_TO_INT(user_data);
+
NOTIFICATION_DBG("name vanished [%d] : %s", uid, name);
is_master_started = 0;
}
diff --git a/src/notification_noti.c b/src/notification_noti.c
index dae576a..1b6b854 100755
--- a/src/notification_noti.c
+++ b/src/notification_noti.c
@@ -58,8 +58,7 @@ static int _notification_noti_bind_query_text(sqlite3_stmt *stmt, const char *na
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",
@@ -244,7 +243,6 @@ static int _insertion_query_create(notification_h noti, char **query)
if (noti->flags_for_property & NOTIFICATION_PROP_DISPLAY_ONLY_SIMMODE)
flag_simmode = 1;
- /* Make query */
*query = sqlite3_mprintf("INSERT INTO noti_list ("
"type, "
"layout, "
@@ -423,7 +421,6 @@ static int _update_query_create(notification_h noti, char **query)
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, "
@@ -533,7 +530,6 @@ static void _notification_noti_populate_from_stmt(sqlite3_stmt *stmt, notificati
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++));
@@ -665,8 +661,8 @@ static int _notification_noti_update_priv_id(sqlite3 *db, int rowid)
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 "
@@ -697,8 +693,7 @@ static int _get_package_id_by_app_id(const char *app_id, char **package_id)
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) {
@@ -782,7 +777,6 @@ static int _handle_do_not_disturb_option(notification_h noti)
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;
@@ -878,7 +872,6 @@ EXPORT_API int notification_noti_insert(notification_h noti)
NOTIFICATION_WARN("_handle_do_not_disturb_option failed");
- /* Open DB */
db = notification_db_open(DBPATH);
if (!db)
return get_last_result();
@@ -887,7 +880,6 @@ EXPORT_API int notification_noti_insert(notification_h noti)
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;
@@ -957,7 +949,6 @@ err:
if (stmt)
sqlite3_finalize(stmt);
- /* Close DB */
if (db)
notification_db_close(&db);
@@ -980,7 +971,6 @@ EXPORT_API int notification_noti_get_by_priv_id(notification_h noti, char *pkgna
goto err;
}
- /* Open DB */
db = notification_db_open(DBPATH);
if (!db)
return get_last_result();
@@ -1032,7 +1022,6 @@ err:
if (stmt)
sqlite3_finalize(stmt);
- /* Close DB */
if (db != NULL)
notification_db_close(&db);
@@ -1047,11 +1036,10 @@ EXPORT_API int notification_noti_get_by_tag(notification_h noti, char *pkgname,
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();
@@ -1134,7 +1122,6 @@ err:
if (stmt)
sqlite3_finalize(stmt);
- /* Close DB */
if (db != NULL)
notification_db_close(&db);
@@ -1148,7 +1135,6 @@ EXPORT_API int notification_noti_update(notification_h noti)
sqlite3_stmt *stmt = NULL;
char *query = NULL;
- /* Open DB */
db = notification_db_open(DBPATH);
if (!db)
return get_last_result();
@@ -1210,7 +1196,6 @@ err:
if (stmt)
sqlite3_finalize(stmt);
- /* Close DB */
if (db)
notification_db_close(&db);
@@ -1233,7 +1218,6 @@ EXPORT_API int notification_noti_delete_all(notification_type_e type, const char
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();
@@ -1251,7 +1235,6 @@ EXPORT_API int notification_noti_delete_all(notification_type_e type, const char
snprintf(query_where, sizeof(query_where),
"where caller_pkgname = '%s' and type = %d and uid = %d",
pkgname, type, uid);
-
}
if (num_deleted != NULL)
@@ -1345,7 +1328,6 @@ err:
if (stmt)
sqlite3_finalize(stmt);
- /* Close DB */
if (db)
notification_db_close(&db);
@@ -1359,24 +1341,19 @@ EXPORT_API int notification_noti_delete_by_priv_id(const char *pkgname, int priv
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);
@@ -1390,28 +1367,23 @@ EXPORT_API int notification_noti_delete_by_priv_id_get_changes(const char *pkgna
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);
@@ -1437,7 +1409,6 @@ EXPORT_API int notification_noti_get_count(notification_type_e type,
int flag_where_more = 0;
int ret_vconf = 0;
- /* Open DB */
db = notification_db_open(DBPATH);
if (!db)
return get_last_result();
@@ -1445,7 +1416,6 @@ EXPORT_API int notification_noti_get_count(notification_type_e type,
/* 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 ");
@@ -1528,7 +1498,6 @@ err:
sqlite3_finalize(stmt);
- /* Close DB */
if (db)
notification_db_close(&db);
@@ -1556,7 +1525,6 @@ EXPORT_API int notification_noti_get_grouping_list(notification_type_e type,
int internal_count = 0;
int status;
- /* Open DB */
db = notification_db_open(DBPATH);
if (!db)
return get_last_result();
@@ -1564,7 +1532,6 @@ EXPORT_API int notification_noti_get_grouping_list(notification_type_e type,
/* 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, "
@@ -1631,12 +1598,12 @@ err:
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;
}
@@ -1659,7 +1626,6 @@ EXPORT_API int notification_noti_get_detail_list(const char *pkgname,
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();
@@ -1667,7 +1633,6 @@ EXPORT_API int notification_noti_get_detail_list(const char *pkgname,
/* 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, "
@@ -1740,7 +1705,6 @@ err:
if (stmt)
sqlite3_finalize(stmt);
- /* Close DB */
if (db)
notification_db_close(&db);
@@ -1760,7 +1724,6 @@ EXPORT_API int notification_noti_check_tag(notification_h noti)
if (noti->tag == NULL)
return NOTIFICATION_ERROR_NOT_EXIST_ID;
- /* Open DB */
db = notification_db_open(DBPATH);
if (!db)
return get_last_result();
diff --git a/src/notification_permission.c b/src/notification_permission.c
deleted file mode 100755
index 73d2d8b..0000000
--- a/src/notification_permission.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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;
-}
-
diff --git a/src/notification_setting.c b/src/notification_setting.c
index 67818bc..e7acafb 100755
--- a/src/notification_setting.c
+++ b/src/notification_setting.c
@@ -42,13 +42,12 @@ typedef struct {
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)
@@ -58,13 +57,12 @@ EXPORT_API int notification_setting_get_setting_array(notification_setting_h *se
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 */
@@ -95,35 +93,28 @@ EXPORT_API int notification_setting_get_setting(notification_setting_h *setting)
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)
@@ -131,131 +122,89 @@ EXPORT_API int notification_setting_set_package_name(notification_setting_h sett
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)
@@ -265,22 +214,18 @@ EXPORT_API int notification_setting_update_setting(notification_setting_h settin
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)
@@ -368,7 +313,6 @@ out:
if (db_statement)
sqlite3_finalize(db_statement);
- NOTIFICATION_INFO("foreach_package_info_callback returns[%d]", err);
return err;
}
@@ -381,7 +325,7 @@ EXPORT_API int notification_setting_refresh_setting_table(uid_t uid)
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);
@@ -416,7 +360,6 @@ EXPORT_API int notification_setting_refresh_setting_table(uid_t uid)
pkgmgrinfo_pkginfo_filter_destroy(filter);
-
out:
if (db) {
@@ -429,8 +372,6 @@ out:
NOTIFICATION_WARN("fail to db_util_close - [%d]", sqlite3_ret);
}
- NOTIFICATION_INFO("notification_setting_refresh_setting_table returns [%08X]", err);
-
return err;
}
@@ -520,10 +461,7 @@ out:
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)
@@ -533,14 +471,12 @@ EXPORT_API int notification_setting_delete_package_for_uid(const char *package_i
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)
@@ -550,22 +486,12 @@ EXPORT_API int notification_system_setting_load_system_setting(notification_syst
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)
@@ -575,250 +501,186 @@ EXPORT_API int notification_system_setting_update_system_setting(notification_sy
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;
}