From 063acb359db531270d0f031dd760752697ccf989 Mon Sep 17 00:00:00 2001 From: Seungha Son Date: Mon, 31 Jul 2017 20:03:27 +0900 Subject: [PATCH] Reduce log string and format - Remove duplicate data from output - Remove special characters - Remove unnecessary information output - Remove repeated information from log Signed-off-by: Seungha Son Change-Id: I00358453072d41ddc0469972bc02d1bb02f2b658 --- src/notification.c | 48 ++++----- src/notification_db.c | 10 +- src/notification_group.c | 16 ++- src/notification_init.c | 6 +- src/notification_internal.c | 19 ++-- src/notification_ipc.c | 210 ++++++++++++++++++------------------- src/notification_list.c | 12 +-- src/notification_noti.c | 89 ++++++++-------- src/notification_ongoing.c | 21 ++-- src/notification_setting.c | 59 ++++++----- src/notification_setting_service.c | 64 +++++------ src/notification_shared_file.c | 47 +++++---- src/notification_status.c | 15 +-- src/notification_viewer.c | 8 +- 14 files changed, 310 insertions(+), 314 deletions(-) diff --git a/src/notification.c b/src/notification.c index 4074582..2df7b21 100755 --- a/src/notification.c +++ b/src/notification.c @@ -82,7 +82,7 @@ char *notification_get_app_id_by_pid(int pid) dup_app_id = strdup(app_id); if (!dup_app_id) - NOTIFICATION_ERR("Heap: %d\n", errno); + NOTIFICATION_ERR("Failed to strdup, errno[%d]", errno); return dup_app_id; } @@ -401,7 +401,7 @@ EXPORT_API int notification_set_text(notification_h noti, break; default: - NOTIFICATION_ERR("Error. invalid variable type. : %d", + NOTIFICATION_ERR("Invalid variable type. : %d", var_type); noti_err = NOTIFICATION_ERROR_INVALID_PARAMETER; break; @@ -1115,7 +1115,7 @@ EXPORT_API int notification_set_launch_option(notification_h noti, } if ((ret = app_control_export_as_bundle(app_control, &b)) != APP_CONTROL_ERROR_NONE) { - NOTIFICATION_ERR("Failed to convert appcontrol to bundle:%d", ret); + NOTIFICATION_ERR("Failed to convert appcontrol to bundle[%d]", ret); err = NOTIFICATION_ERROR_INVALID_PARAMETER; goto out; } @@ -1155,15 +1155,15 @@ EXPORT_API int notification_get_launch_option(notification_h noti, *app_control = app_control_new; } else { app_control_destroy(app_control_new); - NOTIFICATION_ERR("Failed to import app control from bundle:%d", ret); + NOTIFICATION_ERR("Failed to import app control from bundle[%d]", ret); return NOTIFICATION_ERROR_IO_ERROR; } } else { - NOTIFICATION_ERR("Failed to create app control:%d", ret); + NOTIFICATION_ERR("Failed to create app control[%d]", ret); return NOTIFICATION_ERROR_IO_ERROR; } } else { - NOTIFICATION_ERR("Failed to get execute option:%d", ret); + NOTIFICATION_ERR("Failed to get execute option[%d]", ret); return ret; } @@ -1177,19 +1177,19 @@ EXPORT_API int notification_set_event_handler(notification_h noti, notification_ if (noti == NULL) { err = NOTIFICATION_ERROR_INVALID_PARAMETER; - NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); + NOTIFICATION_ERR("Invalid notification handle"); goto out; } if (event_type < NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1 || event_type > NOTIFICATION_EVENT_TYPE_MAX) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); + NOTIFICATION_ERR("Invalid event type"); err = NOTIFICATION_ERROR_INVALID_PARAMETER; goto out; } if ((err = app_control_export_as_bundle(event_handler, &app_control_bundle)) != APP_CONTROL_ERROR_NONE) { - NOTIFICATION_ERR("app_control_to_bundle failed [%d]", err); + NOTIFICATION_ERR("Failed to export app_control to bundle[%d]", err); goto out; } @@ -1210,27 +1210,27 @@ EXPORT_API int notification_get_event_handler(notification_h noti, notification_ if (noti == NULL || event_handler == NULL) { err = NOTIFICATION_ERROR_INVALID_PARAMETER; - NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); + NOTIFICATION_ERR("Invalid handle"); goto out; } if (event_type < NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1 || event_type > NOTIFICATION_EVENT_TYPE_MAX) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); + NOTIFICATION_ERR("Invalid event type"); err = NOTIFICATION_ERROR_INVALID_PARAMETER; goto out; } b = noti->b_event_handler[event_type]; if (b == NULL) { - NOTIFICATION_DBG("No event handler\n"); + NOTIFICATION_ERR("No event handler"); err = NOTIFICATION_ERROR_NOT_EXIST_ID; goto out; } err = app_control_create(&app_control_new); if (err != APP_CONTROL_ERROR_NONE || app_control_new == NULL) { - NOTIFICATION_ERR("app_control_create failed [%d]", err); + NOTIFICATION_ERR("Failted to create app_control[%d]", err); err = NOTIFICATION_ERROR_IO_ERROR; goto out; } @@ -1241,7 +1241,7 @@ EXPORT_API int notification_get_event_handler(notification_h noti, notification_ } else { app_control_destroy(app_control_new); app_control_new = NULL; - NOTIFICATION_ERR("Failed to import app control from bundle [%d]", err); + NOTIFICATION_ERR("Failed to import app control from bundle[%d]", err); err = NOTIFICATION_ERROR_IO_ERROR; goto out; } @@ -1444,14 +1444,14 @@ static notification_h _notification_create(notification_type_e type) int err; if (type <= NOTIFICATION_TYPE_NONE || type > NOTIFICATION_TYPE_MAX) { - NOTIFICATION_ERR("INVALID TYPE : %d", type); + NOTIFICATION_ERR("Invalid notification type[%d]", type); set_last_result(NOTIFICATION_ERROR_INVALID_PARAMETER); return NULL; } noti = (notification_h)calloc(1, sizeof(struct _notification)); if (noti == NULL) { - NOTIFICATION_ERR("NO MEMORY : noti == NULL"); + NOTIFICATION_ERR("Failed to alloc memory"); set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY); return NULL; } @@ -1474,7 +1474,7 @@ static notification_h _notification_create(notification_type_e type) noti->auto_remove = true; noti->caller_app_id = notification_get_app_id_by_pid(getpid()); if (noti->caller_app_id == NULL) { - NOTIFICATION_ERR("get_app_id_by_pid is failed"); + NOTIFICATION_ERR("Failed to get caller_app_id"); goto out; } @@ -1489,21 +1489,21 @@ static notification_h _notification_create(notification_type_e type) err = _notification_get_app_name(pkg_id, &domain_name); if (err != 0 || domain_name == NULL) { - NOTIFICATION_WARN("_notification_get_app_name failed err[%d] domain_name[%p]", + NOTIFICATION_WARN("Failed to get app name domain_name[%p]", err, domain_name); goto out; } err = package_info_create(pkg_id, &package_info); if (err != PACKAGE_MANAGER_ERROR_NONE || package_info == NULL) { - NOTIFICATION_WARN("package_info_create failed err[%d] package_info[%p] pkg_id[%s]", - err, package_info, pkg_id); + NOTIFICATION_WARN("Failted to create package_info err[%d] pkg_id[%s]", + err, pkg_id); goto out; } err = package_info_get_root_path(package_info, &app_root_path); if (err != PACKAGE_MANAGER_ERROR_NONE || app_root_path == NULL) { - NOTIFICATION_WARN("package_info_get_root_path failed err[%d] app_root_path[%p]", + NOTIFICATION_WARN("Failed to get root path err[%d] path[%p]", err, app_root_path); goto out; } @@ -1548,13 +1548,13 @@ EXPORT_API int notification_clone(notification_h noti, notification_h *clone) notification_h new_noti = NULL; if (noti == NULL || clone == NULL) { - NOTIFICATION_ERR("INVALID PARAMETER."); + NOTIFICATION_ERR("Invalid handle"); return NOTIFICATION_ERROR_INVALID_PARAMETER; } new_noti = (notification_h) calloc(1, sizeof(struct _notification)); if (new_noti == NULL) { - NOTIFICATION_ERR("NO MEMORY : noti == NULL"); + NOTIFICATION_ERR("Failed to alloc memory"); return NOTIFICATION_ERROR_OUT_OF_MEMORY; } @@ -1875,7 +1875,7 @@ EXPORT_API notification_h notification_create_from_template(const char *template noti = (notification_h)calloc(1, sizeof(struct _notification)); if (noti == NULL) { - NOTIFICATION_ERR("Failed to alloc a new notification"); + NOTIFICATION_ERR("Failed to alloc memory"); set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY); return NULL; } diff --git a/src/notification_db.c b/src/notification_db.c index bd02d53..fdc20ed 100755 --- a/src/notification_db.c +++ b/src/notification_db.c @@ -37,7 +37,7 @@ EXPORT_API int notification_db_init() SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE, NULL); if (ret != SQLITE_OK) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("fail to open notification db %d", ret); + NOTIFICATION_ERR("Failed to open db[%d]", ret); ret = NOTIFICATION_ERROR_FROM_DB; goto out; /* LCOV_EXCL_STOP */ @@ -46,7 +46,7 @@ EXPORT_API int notification_db_init() ret = sqlite3_exec(db, CREATE_NOTIFICATION_TABLE, NULL, NULL, &errmsg); if (ret != SQLITE_OK) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("sqlite3_exec error(%d)(%s)", ret, errmsg); + NOTIFICATION_ERR("Failed to exec sqlite[%d][%s]", ret, errmsg); ret = NOTIFICATION_ERROR_FROM_DB; goto out; /* LCOV_EXCL_STOP */ @@ -100,7 +100,7 @@ int notification_db_close(sqlite3 **db) ret = sqlite3_close(*db); if (ret != SQLITE_OK) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("DB close error(%d)", ret); + NOTIFICATION_ERR("Failed to close db[%d]", ret); return NOTIFICATION_ERROR_FROM_DB; /* LCOV_EXCL_STOP */ } @@ -121,7 +121,7 @@ int notification_db_exec(sqlite3 *db, const char *query, int *num_changes) ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL); if (ret != SQLITE_OK) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("DB err(%d) : %s", ret, sqlite3_errmsg(db)); + NOTIFICATION_ERR("Sqlite3 err[%d][%s]", ret, sqlite3_errmsg(db)); return NOTIFICATION_ERROR_FROM_DB; /* LCOV_EXCL_STOP */ } @@ -134,7 +134,7 @@ int notification_db_exec(sqlite3 *db, const char *query, int *num_changes) ret = NOTIFICATION_ERROR_NONE; } else { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("DB err(%d) : %s", ret, + NOTIFICATION_ERR("Sqlite err[%d][%s]", ret, sqlite3_errmsg(db)); ret = NOTIFICATION_ERROR_FROM_DB; /* LCOV_EXCL_STOP */ diff --git a/src/notification_group.c b/src/notification_group.c index f129bac..e9c50af 100755 --- a/src/notification_group.c +++ b/src/notification_group.c @@ -49,14 +49,14 @@ static int _notification_group_check_data_inserted(const char *app_id, result = 0; - NOTIFICATION_INFO("Check Data Inserted : query[%s], result : [%d]", - query, result); - sqlite3_finalize(stmt); if (result > 0) return NOTIFICATION_ERROR_ALREADY_EXIST_ID; + NOTIFICATION_INFO("Check Data Inserted appid[%s] group_id[%d] result[%d]", + app_id, group_id, result); + return NOTIFICATION_ERROR_NONE; } /* LCOV_EXCL_STOP */ @@ -93,9 +93,8 @@ int notification_group_set_badge(const char *app_id, ret = sqlite3_prepare_v2(db, query, -1, &stmt, NULL); if (ret != SQLITE_OK) { - NOTIFICATION_ERR("Insert Query : %s", query); - NOTIFICATION_ERR("Insert DB error(%d) : %s", ret, - sqlite3_errmsg(db)); + NOTIFICATION_ERR("Failed to insert data app_id[%s] err[%d][%s]", + app_id, ret, sqlite3_errmsg(db)); if (stmt) sqlite3_finalize(stmt); @@ -162,9 +161,8 @@ int notification_group_get_badge(const char *app_id, ret = sqlite3_prepare(db, query, strlen(query), &stmt, NULL); if (ret != SQLITE_OK) { - NOTIFICATION_ERR("Select Query : %s", query); - NOTIFICATION_ERR("Select DB error(%d) : %s", ret, - sqlite3_errmsg(db)); + NOTIFICATION_ERR("Failed to insert data app_id[%s] err[%d][%s]", + app_id, ret, sqlite3_errmsg(db)); if (db) notification_db_close(&db); diff --git a/src/notification_init.c b/src/notification_init.c index 0a47979..2696c41 100644 --- a/src/notification_init.c +++ b/src/notification_init.c @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) uid_t uid = 0; if (!_is_authorized()) { - _E("You are not an authorized user!"); + _E("Not an authorized user"); return -1; } @@ -66,13 +66,13 @@ int main(int argc, char *argv[]) ret = notification_setting_refresh_setting_table(uid); if (ret != NOTIFICATION_ERROR_NONE) { - _E("notification setting table refresh fail."); + _E("Failed to refresh setting table"); return ret; } ret = notification_system_setting_init_system_setting_table(uid); if (ret != NOTIFICATION_ERROR_NONE) { - _E("notification system setting table init fail."); + _E("Failed to init system setting table"); return ret; } diff --git a/src/notification_internal.c b/src/notification_internal.c index e8db042..3c6ddc8 100755 --- a/src/notification_internal.c +++ b/src/notification_internal.c @@ -104,7 +104,7 @@ void notification_call_changed_cb_for_uid(notification_op *op_list, int op_num, return; if (op_list == NULL) { - NOTIFICATION_ERR("invalid data"); + NOTIFICATION_ERR("Invalid parameter"); return; } @@ -224,7 +224,7 @@ EXPORT_API int notification_resister_changed_cb_for_uid( noti_cb_info_new = (notification_cb_info_s *)malloc(sizeof(notification_cb_info_s)); if (noti_cb_info_new == NULL) { - NOTIFICATION_ERR("malloc failed"); + NOTIFICATION_ERR("Failed to alloc memory"); return NOTIFICATION_ERROR_OUT_OF_MEMORY; } @@ -1007,7 +1007,7 @@ notification_h notification_load_for_uid(char *app_id, noti = (notification_h)calloc(1, sizeof(struct _notification)); if (noti == NULL) { - NOTIFICATION_ERR("NO MEMORY : noti == NULL"); + NOTIFICATION_ERR("Failed to alloc memory"); return NULL; } @@ -1131,7 +1131,6 @@ EXPORT_API int notification_insert_for_uid(notification_h noti, return ret; noti->priv_id = id; - NOTIFICATION_DBG("from master:%d", id); /* If priv_id is valid data, set priv_id */ if (priv_id != NULL) @@ -1183,7 +1182,7 @@ EXPORT_API int notification_register_detailed_changed_cb_for_uid( noti_cb_info_new = (notification_cb_info_s *)malloc(sizeof(notification_cb_info_s)); if (noti_cb_info_new == NULL) { - NOTIFICATION_ERR("malloc failed"); + NOTIFICATION_ERR("Failed to alloc memory"); return NOTIFICATION_ERROR_OUT_OF_MEMORY; } @@ -1389,7 +1388,7 @@ EXPORT_API int notification_post_for_uid(notification_h noti, uid_t uid) ret = notification_ipc_request_insert(noti, &id); if (ret == NOTIFICATION_ERROR_NONE) { noti->priv_id = id; - NOTIFICATION_DBG("from master:%d", id); + NOTIFICATION_INFO("Posted notification id[%d]", id); } else { g_list_foreach(file_list, __remove_private_file, NULL); } @@ -1448,7 +1447,7 @@ EXPORT_API notification_h notification_load_by_tag_for_uid(const char *tag, uid_ char *caller_app_id; if (tag == NULL) { - NOTIFICATION_ERR("Invalid parameter"); + NOTIFICATION_ERR("Invalid tag"); set_last_result(NOTIFICATION_ERROR_INVALID_PARAMETER); return NULL; } @@ -1498,7 +1497,7 @@ EXPORT_API notification_h notification_create_from_package_template(const char * noti = (notification_h)calloc(1, sizeof(struct _notification)); if (noti == NULL) { - NOTIFICATION_ERR("Failed to alloc a new notification"); + NOTIFICATION_ERR("Failed to alloc memory"); set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY); return NULL; } @@ -1669,7 +1668,7 @@ EXPORT_API int notification_post_with_event_cb_for_uid(notification_h noti, even } else { info = (notification_event_cb_info_s *)malloc(sizeof(notification_cb_info_s)); if (info == NULL) { - NOTIFICATION_ERR("malloc failed"); + NOTIFICATION_ERR("Failed to alloc memory"); return NOTIFICATION_ERROR_OUT_OF_MEMORY; } info->priv_id = priv_id; @@ -1750,7 +1749,7 @@ EXPORT_API int notification_check_event_receiver_available(notification_h noti, ret = notification_get_id(noti, NULL, &priv_id); if (ret != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("failed notification_get_id"); + NOTIFICATION_ERR("Failed to get priv id"); return ret; } diff --git a/src/notification_ipc.c b/src/notification_ipc.c index 605b3af..026310d 100755 --- a/src/notification_ipc.c +++ b/src/notification_ipc.c @@ -75,21 +75,14 @@ static void _print_noti(notification_h noti) char *text = NULL; char *content = NULL; const char *tag = NULL; - notification_vibration_type_e vib_type = NOTIFICATION_VIBRATION_TYPE_NONE; notification_get_pkgname(noti, &app_id); notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, &text); notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, &content); notification_get_tag(noti, &tag); - notification_get_vibration(noti, &vib_type, NULL); - NOTIFICATION_DBG("client print_noti app_id = %s ", app_id); - NOTIFICATION_DBG("client print_noti title = %s ", text); - NOTIFICATION_DBG("client print_noti content = %s ", content); - NOTIFICATION_DBG("client print_noti tag = %s ", tag); - NOTIFICATION_DBG("client print_noti priv_id = %d ", noti->priv_id); - NOTIFICATION_DBG("client print_noti vibration_path = %s ", noti->vibration_path); - NOTIFICATION_DBG("client print_noti vibration_type = %d ", vib_type); + NOTIFICATION_DBG("Noti-info : app_id[%s] title[%s] content[%s] tag[%s] priv_id[%d]", + app_id, text, content, tag, noti->priv_id); } static inline char *_string_get(char *string) @@ -108,7 +101,7 @@ static void __provider_appeared_cb(GDBusConnection *connection, const gchar *name_owner, gpointer user_data) { - NOTIFICATION_DBG("provider_appeared_cb name : %s, name_owner : %s", name, name_owner); + NOTIFICATION_INFO("name [%s] name_owner[%s]", name, name_owner); notification_reset_event_handler_list(); } @@ -116,7 +109,7 @@ static void __provider_vanished_cb(GDBusConnection *connection, const gchar *name, gpointer user_data) { - NOTIFICATION_DBG("provider_vanished_cb name : %s", name); + NOTIFICATION_INFO("name [%s]", name); } static int _dbus_init() @@ -128,13 +121,14 @@ static int _dbus_init() if (_gdbus_conn == NULL) { if (error != NULL) { - NOTIFICATION_ERR("Failed to get dbus [%s]", error->message); + NOTIFICATION_ERR("Failed to get dbus[%s]", + error->message); g_error_free(error); } return NOTIFICATION_ERROR_IO_ERROR; } _bus_name = g_dbus_connection_get_unique_name(_gdbus_conn); - NOTIFICATION_DBG("bus name : %s", _bus_name); + NOTIFICATION_INFO("Connected bus name[%s]", _bus_name); notification_error_quark(); } @@ -147,7 +141,7 @@ static int _dbus_init() __provider_vanished_cb, NULL, NULL); - NOTIFICATION_DBG("Watching data-provider-master is %s, watcher_id : %d", + NOTIFICATION_DBG("Watching data-provider-master is [%s] watcher_id [%d]", provider_watcher_id ? "success" : "fail", provider_watcher_id); } @@ -164,7 +158,7 @@ int notification_ipc_is_master_ready(void) ret = _dbus_init(); if (ret != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("Can't init dbus %d", ret); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", ret); is_master_started = 0; return is_master_started; } @@ -184,20 +178,19 @@ int notification_ipc_is_master_ready(void) if (err || (result == NULL)) { if (err) { - NOTIFICATION_ERR("No reply. error = %s", err->message); + NOTIFICATION_ERR("No reply[%s]", err->message); g_error_free(err); } - NOTIFICATION_ERR("is master ready fail"); + NOTIFICATION_ERR("Failed to ready master"); is_master_started = 0; } else { g_variant_get(result, "(b)", &name_exist); if (!name_exist) { - NOTIFICATION_ERR("Name not exist %s", PROVIDER_BUS_NAME); - NOTIFICATION_ERR("the master has been stopped"); + NOTIFICATION_ERR("The master has been stopped, Not exsited name[%s]", PROVIDER_BUS_NAME); is_master_started = 0; } else { - NOTIFICATION_DBG("the master has been started"); + NOTIFICATION_DBG("The master has been started"); is_master_started = 1; } } @@ -327,7 +320,7 @@ static notification_op *_ipc_create_op(notification_op_type_e type, op_list = (notification_op *)malloc(sizeof(notification_op) * num_op); if (op_list == NULL) { - NOTIFICATION_ERR("malloc failed"); + NOTIFICATION_ERR("Failed to alloc memory"); return NULL; } @@ -357,7 +350,8 @@ static inline char *_dup_string(const char *string) ret = strdup(string); if (!ret) - NOTIFICATION_ERR("Error: %s\n", strerror_r(errno, err_buf, sizeof(err_buf))); + NOTIFICATION_ERR("Failed to strdup[%s]", + strerror_r(errno, err_buf, sizeof(err_buf))); return ret; } @@ -382,7 +376,7 @@ static void _add_noti_notify(GVariant *parameters) NOTIFICATION_DBG("add noti notify"); noti = notification_create(NOTIFICATION_TYPE_NOTI); if (!noti) { - NOTIFICATION_ERR("failed to create a notification"); + NOTIFICATION_ERR("Failed to create notification handle"); return; } @@ -390,7 +384,7 @@ static void _add_noti_notify(GVariant *parameters) notification_ipc_make_noti_from_gvariant(noti, body); _print_noti(noti); if (noti->flags_for_property & NOTIFICATION_PROP_DISABLE_UPDATE_ON_INSERT) { - NOTIFICATION_ERR("disable changed callback %d", noti->flags_for_property); + NOTIFICATION_ERR("Disable changed callback[%d]", noti->flags_for_property); /* Disable changed cb */ } else { /* Enable changed cb */ @@ -417,7 +411,7 @@ static void _update_noti_notify(GVariant *parameters) noti = notification_create(NOTIFICATION_TYPE_NOTI); if (!noti) { - NOTIFICATION_ERR("failed to create a notification"); + NOTIFICATION_ERR("Failed to create notification handle"); return; } @@ -482,15 +476,15 @@ static void _delete_multiple_notify(GVariant *parameters) g_variant_get(parameters, "(a(i)i)", &iter, &uid); while (g_variant_iter_loop(iter, "(i)", &buf[idx])) { - NOTIFICATION_DBG("delete_noti_multiple priv_id : %d", buf[idx]); + NOTIFICATION_DBG("priv id[%d]", buf[idx]); idx++; } g_variant_iter_free(iter); - NOTIFICATION_DBG("data num deleted:%d", idx); + NOTIFICATION_DBG("Deleted count[%d]", idx); noti_op = _ipc_create_op(NOTIFICATION_OP_DELETE, idx, buf, idx, NULL); if (noti_op == NULL) { - NOTIFICATION_ERR("_ipc_create_op failed"); + NOTIFICATION_ERR("Failed to create op"); return; } @@ -522,7 +516,8 @@ static void _handle_noti_notify(GDBusConnection *connection, gpointer user_data) { NOTIFICATION_DBG("own_name : %s signal_name: %s", - g_dbus_connection_get_unique_name(connection), signal_name); + g_dbus_connection_get_unique_name(connection), + signal_name); if (g_strcmp0(signal_name, "add_noti_notify") == 0) _add_noti_notify(parameters); @@ -549,7 +544,7 @@ static void _send_event(GVariant *parameters) noti = notification_create(NOTIFICATION_TYPE_NOTI); if (noti == NULL) { - NOTIFICATION_ERR("failed to create a notification"); + NOTIFICATION_ERR("Failed to create notification handle"); return; } @@ -560,7 +555,7 @@ static void _send_event(GVariant *parameters) g_variant_unref(coupled_body); g_variant_unref(body); if (ret != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("failed to make notification handle from gvariant"); + NOTIFICATION_ERR("Failed to make notification handle from gvariant"); notification_free(noti); return; } @@ -611,10 +606,10 @@ static int _dbus_event_handler_signal_init(void) NULL, NULL); - NOTIFICATION_DBG("subscribe id : %d", id); + NOTIFICATION_DBG("subscribe id[%d]", id); if (id == 0) { ret = NOTIFICATION_ERROR_IO_ERROR; - NOTIFICATION_ERR("Failed to subscribe _dbus_event_handler_signal"); + NOTIFICATION_ERR("Failed to subscribe connection signal"); } else { event_monitor_id = id; } @@ -644,7 +639,7 @@ static int _dbus_signal_init() if (id == 0) { /* LCOV_EXCL_START */ ret = NOTIFICATION_ERROR_IO_ERROR; - NOTIFICATION_ERR("Failed to _register_noti_dbus_interface"); + NOTIFICATION_ERR("Failed to register dbus_interface"); /* LCOV_EXCL_STOP */ } else { monitor_id = id; @@ -668,7 +663,7 @@ static int _send_sync_noti(GVariant *body, GDBusMessage **reply, char *cmd) cmd); if (!msg) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("Can't allocate new method call"); + NOTIFICATION_ERR("Failed to alloc new method call"); if (body) g_variant_unref(body); return NOTIFICATION_ERROR_OUT_OF_MEMORY; @@ -693,7 +688,7 @@ static int _send_sync_noti(GVariant *body, GDBusMessage **reply, char *cmd) /* LCOV_EXCL_START */ ret = NOTIFICATION_ERROR_SERVICE_NOT_READY; if (err != NULL) { - NOTIFICATION_ERR("No reply. cmd = %s, error = %s", cmd, err->message); + NOTIFICATION_ERR("No reply. cmd[%s] err[%s]", cmd, err->message); if (err->code == G_DBUS_ERROR_ACCESS_DENIED) ret = NOTIFICATION_ERROR_PERMISSION_DENIED; g_error_free(err); @@ -708,12 +703,12 @@ static int _send_sync_noti(GVariant *body, GDBusMessage **reply, char *cmd) else ret = err->code; - NOTIFICATION_ERR("_send_sync_noti cmd = %s, err code = %d", cmd, ret); + NOTIFICATION_ERR("Failed to send message[%s] err[%d]", cmd, ret); g_error_free(err); return ret; } - NOTIFICATION_DBG("_send_sync_noti done !!"); + NOTIFICATION_DBG("Success to send sync message"); return NOTIFICATION_ERROR_NONE; } @@ -741,7 +736,7 @@ static void _send_message_with_reply_async_cb(GDBusConnection *connection, if (!reply) { /* LCOV_EXCL_START */ if (err != NULL) { - NOTIFICATION_ERR("No reply. error = %s", err->message); + NOTIFICATION_ERR("No reply[%s]", err->message); g_error_free(err); } result = NOTIFICATION_ERROR_SERVICE_NOT_READY; @@ -754,13 +749,12 @@ static void _send_message_with_reply_async_cb(GDBusConnection *connection, else result = err->code; - NOTIFICATION_ERR("_send_async_noti error %s", err->message); + NOTIFICATION_ERR("Failed to send message[%s]", err->message); g_error_free(err); /* LCOV_EXCL_STOP */ } - NOTIFICATION_DBG("_send_async_noti done !![%d]", result); - + NOTIFICATION_INFO("Async message callback result[%d]", result); if (result == NOTIFICATION_ERROR_NONE) { body = g_dbus_message_get_body(reply); g_variant_get(body, "(i)", &priv_id); @@ -788,7 +782,7 @@ static int _send_async_noti(GVariant *body, result_cb_item *cb_item, char *cmd) cmd); if (!msg) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("Can't allocate new method call"); + NOTIFICATION_ERR("Failed to alloc new method call"); return NOTIFICATION_ERROR_OUT_OF_MEMORY; /* LCOV_EXCL_STOP */ } @@ -812,7 +806,7 @@ static int _send_async_noti(GVariant *body, result_cb_item *cb_item, char *cmd) if (msg) g_object_unref(msg); - NOTIFICATION_DBG("_send_async_noti done !!"); + NOTIFICATION_DBG("Success to send async message"); return NOTIFICATION_ERROR_NONE; } @@ -827,7 +821,7 @@ int notification_ipc_request_insert(notification_h noti, int *priv_id) result = _dbus_init(); if (result != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("Can't init dbus %d", result); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", result); return result; } @@ -849,7 +843,7 @@ int notification_ipc_request_insert(notification_h noti, int *priv_id) body = notification_ipc_make_gvariant_from_noti(noti, false); if (body == NULL) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("cannot make gvariant"); + NOTIFICATION_ERR("Failed to make gvariant from notification handle"); return NOTIFICATION_ERROR_OUT_OF_MEMORY; /* LCOV_EXCL_STOP */ } @@ -868,7 +862,7 @@ int notification_ipc_request_insert(notification_h noti, int *priv_id) if (reply) g_object_unref(reply); - NOTIFICATION_DBG("notification_ipc_request_insert done [priv_id : %d, result: %d]", id, result); + NOTIFICATION_DBG("priv_id[%d] result[%d]", id, result); return result; } @@ -884,7 +878,7 @@ int notification_ipc_request_update(notification_h noti) result = _dbus_init(); if (result != NOTIFICATION_ERROR_NONE) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("Can't init dbus %d", result); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", result); return result; /* LCOV_EXCL_STOP */ } @@ -906,7 +900,7 @@ int notification_ipc_request_update(notification_h noti) if (reply) g_object_unref(reply); - NOTIFICATION_DBG("notification_ipc_request_update done [result: %d, priv_id :%d]", result, priv_id); + NOTIFICATION_DBG("priv_id[%d] result[%d]", priv_id, result); return result; } @@ -920,7 +914,7 @@ int notification_ipc_request_update_async(notification_h noti, result = _dbus_init(); if (result != NOTIFICATION_ERROR_NONE) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("Can't init dbus %d", result); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", result); return result; /* LCOV_EXCL_STOP */ } @@ -935,14 +929,14 @@ int notification_ipc_request_update_async(notification_h noti, body = notification_ipc_make_gvariant_from_noti(noti, false); if (body == NULL) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("cannot make gvariant"); + NOTIFICATION_ERR("Failed to make gvariant from notification handle"); free(cb_item); return NOTIFICATION_ERROR_OUT_OF_MEMORY; /* LCOV_EXCL_STOP */ } result = _send_async_noti(body, cb_item, "update_noti"); - NOTIFICATION_DBG("notification_ipc_request_update_async done [result: %d]", result); + NOTIFICATION_DBG("Update async result[%d]", result); if (result != NOTIFICATION_ERROR_NONE) { /* LCOV_EXCL_START */ @@ -964,7 +958,7 @@ int notification_ipc_request_refresh(uid_t uid) result = _dbus_init(); if (result != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("Can't init dbus %d", result); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", result); return result; } @@ -974,7 +968,7 @@ int notification_ipc_request_refresh(uid_t uid) if (reply) g_object_unref(reply); - NOTIFICATION_ERR("notification_ipc_request_refresh done [result: %d]", result); + NOTIFICATION_DBG("result[%d]", result); return result; } @@ -988,7 +982,7 @@ int notification_ipc_request_delete_single(notification_type_e type, char *app_i result = _dbus_init(); if (result != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("Can't init dbus %d", result); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", result); return result; } @@ -1003,7 +997,7 @@ int notification_ipc_request_delete_single(notification_type_e type, char *app_i if (reply) g_object_unref(reply); - NOTIFICATION_DBG("notification_ipc_request_delete_single done [result: %d]", result); + NOTIFICATION_DBG("result[%d]", result); return result; } @@ -1017,7 +1011,7 @@ int notification_ipc_request_delete_multiple(notification_type_e type, char *app result = _dbus_init(); if (result != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("Can't init dbus %d", result); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", result); return result; } @@ -1030,12 +1024,13 @@ int notification_ipc_request_delete_multiple(notification_type_e type, char *app if (result == NOTIFICATION_ERROR_NONE) { reply_body = g_dbus_message_get_body(reply); g_variant_get(reply_body, "(i)", &num_deleted); - NOTIFICATION_DBG("num deleted:%d", num_deleted); + NOTIFICATION_DBG("Deleted count[%d]", num_deleted); } if (reply) g_object_unref(reply); + NOTIFICATION_DBG("result[%d]", result); return result; } @@ -1049,7 +1044,7 @@ int notification_ipc_request_load_noti_by_tag(notification_h noti, const char *a result = _dbus_init(); if (result != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("Can't init dbus %d", result); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", result); return result; } @@ -1069,7 +1064,7 @@ int notification_ipc_request_load_noti_by_tag(notification_h noti, const char *a if (reply) g_object_unref(reply); - NOTIFICATION_DBG("notification_ipc_request_load_noti_by_tag done [result: %d]", result); + NOTIFICATION_DBG("tag[%s] result[%d]", tag, result); return result; } @@ -1084,7 +1079,7 @@ int notification_ipc_request_load_noti_by_priv_id(notification_h noti, const cha result = _dbus_init(); if (result != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("Can't init dbus %d", result); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", result); return result; } @@ -1106,7 +1101,7 @@ int notification_ipc_request_load_noti_by_priv_id(notification_h noti, const cha if (reply) g_object_unref(reply); - NOTIFICATION_DBG("notification_ipc_request_load_noti_by_priv_id done [result: %d]", result); + NOTIFICATION_DBG("priv id[%d], result[%d]", priv_id, result); return result; } /* LCOV_EXCL_STOP */ @@ -1123,7 +1118,7 @@ int notification_ipc_request_get_count(notification_type_e type, result = _dbus_init(); if (result != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("Can't init dbus %d", result); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", result); return result; } @@ -1135,13 +1130,13 @@ int notification_ipc_request_get_count(notification_type_e type, g_variant_get(reply_body, "(i)", &re_count); *count = re_count; - NOTIFICATION_DBG("noti count [%d]", re_count); + NOTIFICATION_DBG("notification count[%d]", re_count); } if (reply) g_object_unref(reply); - NOTIFICATION_DBG("notification_ipc_request_get_count done [result: %d]", result); + NOTIFICATION_DBG("Count notification result[%d]", result); return result; } /* LCOV_EXCL_STOP */ @@ -1160,7 +1155,7 @@ int notification_ipc_request_load_noti_grouping_list(notification_type_e type, i result = _dbus_init(); if (result != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("Can't init dbus %d", result); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", result); return result; } @@ -1190,7 +1185,7 @@ int notification_ipc_request_load_noti_grouping_list(notification_type_e type, i if (reply) g_object_unref(reply); - NOTIFICATION_DBG("notification_ipc_request_load_noti_grouping_list done [result: %d]", result); + NOTIFICATION_DBG("result[%d]", result); return result; } @@ -1212,7 +1207,7 @@ int notification_ipc_request_load_noti_detail_list(const char *app_id, result = _dbus_init(); if (result != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("Can't init dbus %d", result); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", result); return result; } @@ -1242,7 +1237,7 @@ int notification_ipc_request_load_noti_detail_list(const char *app_id, if (reply) g_object_unref(reply); - NOTIFICATION_DBG("notification_ipc_request_load_noti_detail_list done [result: %d]", result); + NOTIFICATION_DBG("result[%d]", result); return result; } @@ -1263,7 +1258,7 @@ int notification_ipc_request_get_setting_array( result = _dbus_init(); if (result != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("Can't init dbus %d", result); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", result); return result; } @@ -1297,7 +1292,7 @@ int notification_ipc_request_get_setting_array( if (reply) g_object_unref(reply); - NOTIFICATION_DBG("notification_ipc_request_get_setting_array done [result: %d]", result); + NOTIFICATION_DBG("result[%d]", result); return result; } @@ -1313,7 +1308,7 @@ int notification_ipc_request_get_setting_by_app_id( result = _dbus_init(); if (result != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("Can't init dbus %d", result); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", result); return result; } @@ -1340,7 +1335,7 @@ int notification_ipc_request_get_setting_by_app_id( if (reply) g_object_unref(reply); - NOTIFICATION_DBG("notification_ipc_request_get_setting_by_app_id done [result: %d]", result); + NOTIFICATION_DBG("result[%d]", result); return result; } @@ -1358,7 +1353,7 @@ int notification_ipc_request_load_system_setting(notification_system_setting_h * result = _dbus_init(); if (result != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("Can't init dbus %d", result); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", result); return result; } @@ -1405,7 +1400,7 @@ out: if (reply) g_object_unref(reply); - NOTIFICATION_DBG("notification_ipc_request_load_system_setting done [result: %d]", result); + NOTIFICATION_DBG("result[%d]", result); return result; } @@ -1417,7 +1412,7 @@ int notification_ipc_update_setting(notification_setting_h setting, uid_t uid) result = _dbus_init(); if (result != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("Can't init dbus %d", result); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", result); return result; } @@ -1436,7 +1431,7 @@ int notification_ipc_update_setting(notification_setting_h setting, uid_t uid) if (reply) g_object_unref(reply); - NOTIFICATION_DBG("notification_ipc_update_setting done [result: %d]", result); + NOTIFICATION_DBG("result[%d]", result); return result; } @@ -1450,7 +1445,7 @@ int notification_ipc_update_system_setting(notification_system_setting_h system_ result = _dbus_init(); if (result != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("Can't init dbus %d", result); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", result); return result; } @@ -1484,7 +1479,7 @@ int notification_ipc_update_system_setting(notification_system_setting_h system_ if (reply) g_object_unref(reply); - NOTIFICATION_DBG("notification_ipc_update_system_setting done [result: %d]", result); + NOTIFICATION_DBG("result[%d]", result); return result; } @@ -1496,13 +1491,13 @@ int notification_ipc_request_save_as_template(notification_h noti, const char *t result = _dbus_init(); if (result != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("Can't init dbus %d", result); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", result); return result; } body = notification_ipc_make_gvariant_from_noti(noti, false); if (body == NULL) { - NOTIFICATION_ERR("cannot make gvariant"); + NOTIFICATION_ERR("Failed to make gvariant from notification handle"); return NOTIFICATION_ERROR_OUT_OF_MEMORY; } @@ -1511,7 +1506,7 @@ int notification_ipc_request_save_as_template(notification_h noti, const char *t if (reply) g_object_unref(reply); - NOTIFICATION_DBG("notification_ipc_request_save_as_template [result: %d]", result); + NOTIFICATION_DBG("result[%d]", result); return result; } @@ -1525,7 +1520,7 @@ int notification_ipc_request_create_from_template(notification_h noti, const cha result = _dbus_init(); if (result != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("Can't init dbus %d", result); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", result); return result; } @@ -1544,7 +1539,7 @@ int notification_ipc_request_create_from_template(notification_h noti, const cha if (reply) g_object_unref(reply); - NOTIFICATION_DBG("notification_ipc_request_create_from_template done [result: %d]", result); + NOTIFICATION_DBG("result[%d]", result); return result; } @@ -1559,7 +1554,7 @@ int notification_ipc_request_create_from_package_template(notification_h noti, c result = _dbus_init(); if (result != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("Can't init dbus %d", result); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", result); return result; } @@ -1578,7 +1573,7 @@ int notification_ipc_request_create_from_package_template(notification_h noti, c if (reply) g_object_unref(reply); - NOTIFICATION_DBG("notification_ipc_request_create_from_package_template [result: %d]", result); + NOTIFICATION_DBG("result[%d]", result); return result; } @@ -1601,7 +1596,7 @@ int notification_ipc_get_noti_block_state(const char *app_id, int *do_not_distur ret = _dbus_init(); if (ret != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("Can't init dbus %d", ret); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", ret); return ret; } @@ -1622,7 +1617,7 @@ int notification_ipc_get_noti_block_state(const char *app_id, int *do_not_distur if (reply) g_object_unref(reply); - NOTIFICATION_DBG("notification_ipc_get_noti_block_state done"); + NOTIFICATION_DBG("result[%d]", ret); return ret; } @@ -1635,7 +1630,7 @@ int notification_ipc_send_event(notification_h noti, int event_type, int priv_id ret = _dbus_init(); if (ret != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("Can't init dbus %d", ret); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", ret); return ret; } @@ -1654,7 +1649,7 @@ int notification_ipc_send_event(notification_h noti, int event_type, int priv_id if (reply) g_object_unref(reply); - NOTIFICATION_DBG("notification_ipc_send_event done [%d]", ret); + NOTIFICATION_DBG("result[%d]", ret); return ret; } @@ -1668,7 +1663,7 @@ int notification_ipc_check_event_receiver(int priv_id, bool *available) ret = _dbus_init(); if (ret != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("Can't init dbus %d", ret); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", ret); return ret; } @@ -1682,7 +1677,7 @@ int notification_ipc_check_event_receiver(int priv_id, bool *available) if (reply) g_object_unref(reply); - NOTIFICATION_DBG("notification_ipc_check_event_receiver done"); + NOTIFICATION_DBG("result[%d]", ret); return ret; } @@ -1693,7 +1688,7 @@ void notification_ipc_reset_event_handler(int priv_id) ret = _dbus_init(); if (ret != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("Can't init dbus %d", ret); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", ret); return; } @@ -2011,12 +2006,12 @@ EXPORT_API int notification_ipc_make_noti_from_gvariant(notification_h noti, char *tag = NULL; if (noti == NULL) { - NOTIFICATION_ERR("invalid data noti NULL"); + NOTIFICATION_ERR("Invalid noti NULL"); return NOTIFICATION_ERROR_INVALID_PARAMETER; } if (variant == NULL) { - NOTIFICATION_ERR("invalid data variant NULL"); + NOTIFICATION_ERR("Invalid variant NULL"); return NOTIFICATION_ERROR_INVALID_PARAMETER; } @@ -2171,7 +2166,7 @@ EXPORT_API int notification_ipc_make_system_setting_from_gvariant(struct notific int lock_screen_content_level; if (noti_setting == NULL) { - NOTIFICATION_ERR("invalid data"); + NOTIFICATION_ERR("Invalid setting handle"); return NOTIFICATION_ERROR_INVALID_PARAMETER; } @@ -2187,7 +2182,7 @@ EXPORT_API int notification_ipc_make_system_setting_from_gvariant(struct notific &dnd_end_min, &lock_screen_content_level); - NOTIFICATION_DBG("system setting #### %d, %d, %d, %d, [%d:%d] [%d:%d], %d", + NOTIFICATION_DBG("system setting %d, %d, %d, %d, [%d:%d] [%d:%d], %d", do_not_disturb, visibility_class, dnd_schedule_enabled, dnd_schedule_day, dnd_start_hour, dnd_start_min, dnd_end_hour, dnd_end_min, lock_screen_content_level); @@ -2225,7 +2220,6 @@ EXPORT_API GVariant *notification_ipc_make_gvariant_from_setting(struct notifica EXPORT_API int notification_ipc_make_setting_from_gvariant(struct notification_setting *noti_setting, GVariant *variant) { - NOTIFICATION_DBG("notification_ipc_make_setting_from_gvariant !!!!"); char *pkgname; char *app_id; int allow_to_notify; @@ -2261,7 +2255,7 @@ EXPORT_API int notification_ipc_make_setting_from_gvariant(struct notification_s noti_setting->lock_screen_content_level = lock_screen_content_level; noti_setting->app_disabled = app_disabled; - NOTIFICATION_DBG("setting from variant %s, %s", + NOTIFICATION_DBG("setting->pkgname[%s] pkgname[%s]", noti_setting->package_name, pkgname); return NOTIFICATION_ERROR_NONE; @@ -2284,7 +2278,7 @@ int notification_ipc_make_dnd_allow_exception_from_gvariant(struct notification_ int value; if (dnd_allow_exception == NULL) { - NOTIFICATION_ERR("invalid data"); + NOTIFICATION_ERR("Invalid data"); return NOTIFICATION_ERROR_INVALID_PARAMETER; } @@ -2307,13 +2301,15 @@ static int _send_service_register(uid_t uid) if (reply) g_object_unref(reply); - NOTIFICATION_DBG("_send_service_register done = %s, result = %d", _bus_name, result); noti_op = _ipc_create_op(NOTIFICATION_OP_SERVICE_READY, 1, NULL, 1, NULL); if (noti_op != NULL) { notification_call_changed_cb_for_uid(noti_op, 1, uid); free(noti_op); + } else { + NOTIFICATION_ERR("Failed to create op"); } + NOTIFICATION_DBG("bus name[%s] result[%d]", _bus_name, result); return result; } @@ -2330,7 +2326,7 @@ static void _on_name_appeared(GDBusConnection *connection, { int uid = GPOINTER_TO_INT(user_data); - NOTIFICATION_DBG("name appeared [%d] : %s", uid, name); + NOTIFICATION_DBG("uid[%d] name[%s]", uid, name); is_master_started = 1; _ipc_monitor_register(uid); @@ -2346,7 +2342,7 @@ static void _on_name_vanished(GDBusConnection *connection, { int uid = GPOINTER_TO_INT(user_data); - NOTIFICATION_DBG("name vanished [%d] : %s", uid, name); + NOTIFICATION_DBG("uid[%d] name[%s]", uid, name); is_master_started = 0; } /* LCOV_EXCL_STOP */ @@ -2358,7 +2354,7 @@ int notification_ipc_monitor_init(uid_t uid) ret = _dbus_init(); if (ret != NOTIFICATION_ERROR_NONE) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("Can't init dbus %d", ret); + NOTIFICATION_ERR("Failed to init dbus connection[%d]", ret); return ret; /* LCOV_EXCL_STOP */ } @@ -2366,7 +2362,7 @@ int notification_ipc_monitor_init(uid_t uid) ret = _dbus_signal_init(); if (ret != NOTIFICATION_ERROR_NONE) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("Can't signal_init %d", ret); + NOTIFICATION_ERR("Failed to init signal[%d]", ret); return ret; /* LCOV_EXCL_STOP */ } @@ -2374,7 +2370,7 @@ int notification_ipc_monitor_init(uid_t uid) ret = _ipc_monitor_register(uid); if (ret != NOTIFICATION_ERROR_NONE) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("Can't init ipc_monitor_register %d", ret); + NOTIFICATION_ERR("Failed to register service[%d]", ret); return ret; /* LCOV_EXCL_STOP */ } @@ -2393,7 +2389,7 @@ int notification_ipc_monitor_init(uid_t uid) /* LCOV_EXCL_START */ g_dbus_connection_signal_unsubscribe(_gdbus_conn, monitor_id); monitor_id = 0; - NOTIFICATION_ERR("watch on name fail"); + NOTIFICATION_ERR("Failed to watch name"); return NOTIFICATION_ERROR_IO_ERROR; /* LCOV_EXCL_STOP */ } diff --git a/src/notification_list.c b/src/notification_list.c index 6b773d1..2dc8269 100755 --- a/src/notification_list.c +++ b/src/notification_list.c @@ -40,7 +40,7 @@ notification_list_h _notification_list_create(void) list = (notification_list_h) malloc(sizeof(struct _notification_list)); if (list == NULL) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("NO MEMORY"); + NOTIFICATION_ERR("Failed to alloc memory"); return NULL; /* LCOV_EXCL_STOP */ } @@ -58,7 +58,7 @@ EXPORT_API notification_list_h notification_list_get_head(notification_list_h li notification_list_h cur_list = NULL; if (list == NULL) { - NOTIFICATION_ERR("INVALID DATA : list == NULL"); + NOTIFICATION_ERR("Invalid parameter"); set_last_result(NOTIFICATION_ERROR_INVALID_PARAMETER); return NULL; } @@ -145,7 +145,7 @@ EXPORT_API int notification_list_get_count(notification_list_h list) notification_list_h cur_list = NULL; if (list == NULL) { - NOTIFICATION_ERR("INVALID DATA : list == NULL"); + NOTIFICATION_ERR("Invalid paramter"); set_last_result(NOTIFICATION_ERROR_INVALID_PARAMETER); return 0; } @@ -168,7 +168,7 @@ EXPORT_API notification_list_h notification_list_append(notification_list_h list notification_list_h cur_list = NULL; if (noti == NULL) { - NOTIFICATION_ERR("INVALID DATA : data == NULL"); + NOTIFICATION_ERR("Invalid parameter"); set_last_result(NOTIFICATION_ERROR_INVALID_PARAMETER); return NULL; } @@ -179,7 +179,7 @@ EXPORT_API notification_list_h notification_list_append(notification_list_h list new_list = _notification_list_create(); if (new_list == NULL) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("NO MEMORY"); + NOTIFICATION_ERR("Failed to alloc memory"); set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY); return NULL; /* LCOV_EXCL_STOP */ @@ -193,7 +193,7 @@ EXPORT_API notification_list_h notification_list_append(notification_list_h list cur_list = _notification_list_create(); if (cur_list == NULL) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("NO MEMORY"); + NOTIFICATION_ERR("Failed to alloc memory"); set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY); return NULL; /* LCOV_EXCL_STOP */ diff --git a/src/notification_noti.c b/src/notification_noti.c index b1eda75..52e85ea 100755 --- a/src/notification_noti.c +++ b/src/notification_noti.c @@ -143,15 +143,15 @@ static int _notification_noti_check_priv_id(notification_h noti, sqlite3 *db) "WHERE caller_app_id = %Q AND priv_id = %d", noti->caller_app_id, noti->priv_id); if (query == NULL) { - NOTIFICATION_ERR("fail to alloc query"); /* LCOV_EXCL_LINE */ + NOTIFICATION_ERR("Failed to alloc query"); /* LCOV_EXCL_LINE */ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto err; } ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL); if (ret != SQLITE_OK) { - NOTIFICATION_ERR("sqlite3_prepare_v2 failed [%d][%s]", ret, - sqlite3_errmsg(db)); + NOTIFICATION_ERR("Failed to sqlite3_prepare_v2 Failed [%d][%s]", + ret, sqlite3_errmsg(db)); ret = NOTIFICATION_ERROR_FROM_DB; goto err; } @@ -189,14 +189,14 @@ static int _notification_noti_get_internal_group_id_by_priv_id(const char *app_i "WHERE caller_app_id = %Q AND priv_id = %d", app_id, priv_id); if (query == NULL) { - NOTIFICATION_ERR("fail to alloc query"); /* LCOV_EXCL_LINE */ + NOTIFICATION_ERR("Failed to alloc query"); /* LCOV_EXCL_LINE */ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto err; } ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL); if (ret != SQLITE_OK) { - NOTIFICATION_ERR("sqlite3_prepare_v2 failed [%d][%s]", ret, + NOTIFICATION_ERR("sqlite3_prepare_v2 Failed [%d][%s]", ret, sqlite3_errmsg(db)); ret = NOTIFICATION_ERROR_FROM_DB; goto err; @@ -216,7 +216,7 @@ err: sqlite3_free(query); if (ret != NOTIFICATION_ERROR_NONE) - NOTIFICATION_ERR("failed to internal group ID:%d", ret); + NOTIFICATION_ERR("Failed to get internal group ID [%d]", ret); return result; } @@ -646,7 +646,7 @@ static int _get_notification_list(char *query_where, notification_list_h *list, if (count != -1 && internal_count >= count) { NOTIFICATION_INFO - ("internal count %d >= count %d", + ("internal count[%d] count[%d]", internal_count, count); break; } @@ -735,31 +735,32 @@ static int __get_setting_from_app_control(notification_h noti, notification_sett NULL, &b); if (ret != NOTIFICATION_ERROR_NONE || b == NULL) { - NOTIFICATION_WARN("Can't get or no the excute option [%x]", ret); + NOTIFICATION_WARN("Failed to get or no the excute option [%x]", ret); return NOTIFICATION_ERROR_INVALID_PARAMETER; } ret = app_control_create(&app_control); if (ret != APP_CONTROL_ERROR_NONE) { - NOTIFICATION_ERR("app_control_create failed [%x]", ret); + NOTIFICATION_ERR("Failed to create app_control [%x]", ret); goto out; } ret = app_control_import_from_bundle(app_control, b); if (ret != APP_CONTROL_ERROR_NONE) { - NOTIFICATION_ERR("app_control_import_from_bundle failed [%x]", ret); + NOTIFICATION_ERR("Failed to import from bundle to app_control [%x]", ret); goto out; } ret = app_control_get_app_id(app_control, &app_id); if (ret != APP_CONTROL_ERROR_NONE || app_id == NULL) { - NOTIFICATION_ERR("app_control_get_app_id failed [%x]", ret); + NOTIFICATION_ERR("Failed to get app id from app_control [%x]", ret); goto out; } ret = noti_setting_service_get_setting_by_app_id(app_id, &setting_new, noti->uid); if (ret != APP_CONTROL_ERROR_NONE || setting == NULL) { - NOTIFICATION_ERR("noti_setting_service_get_setting_by_app_id failed [%x]", ret); + NOTIFICATION_ERR("Failed to get setting by app id[%s][%x]", + app_id, ret); goto out; } @@ -794,13 +795,13 @@ static bool _is_allowed_to_notify(notification_h noti) err = notification_setting_get_allow_to_notify(setting, &allow_to_notify); if (err != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("get_allow_to_notify failed [%x]", err); + NOTIFICATION_ERR("Failed to get allow_to_notify [%x]", err); goto out; } err = notification_setting_get_app_disabled(setting, &app_disabled); if (err != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("get_app_disabled failed [%x]", err); + NOTIFICATION_ERR("Failed to get app_disabled [%x]", err); goto out; } @@ -823,21 +824,21 @@ static int _handle_do_not_disturb_option(notification_h noti) notification_system_setting_h system_setting = NULL; if (noti == NULL) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); + NOTIFICATION_ERR("Invalid notification handle"); return NOTIFICATION_ERROR_INVALID_PARAMETER; } /* Get system setting */ err = noti_system_setting_load_system_setting(&system_setting, noti->uid); if (err != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("_load_system_setting failed [%d]", err); + NOTIFICATION_ERR("Failed to load system setting [%d]", err); goto out; } err = notification_system_setting_get_do_not_disturb(system_setting, &do_not_disturb); if (err != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("_get_do_not_disturb failed [%d]", err); + NOTIFICATION_ERR("Failed to get do_not_disturb [%d]", err); goto out; } @@ -847,13 +848,13 @@ static int _handle_do_not_disturb_option(notification_h noti) /* Check exception option of the caller app_id */ err = noti_setting_service_get_setting_by_app_id(noti->caller_app_id, &setting, noti->uid); if (err != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("_get_setting_by_app_id failed [%d]", err); + NOTIFICATION_ERR("Failed to get setting by app_id [%d]", err); goto out; } err = notification_setting_get_do_not_disturb_except(setting, &do_not_disturb_exception); if (err != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("notification_setting_get_allow_to_notify failed [%d]", err); + NOTIFICATION_ERR("Failed to get do_not_disturb_exception [%d]", err); goto out; } @@ -895,13 +896,13 @@ static bool _is_pop_up_notification(const char *app_id, uid_t uid) err = noti_setting_service_get_setting_by_app_id(app_id, &setting, uid); if (err != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_WARN("Can't get the setting for %s [%x]", app_id, err); + NOTIFICATION_WARN("Failed get the setting for [%s] [%x]", app_id, err); goto out; } err = notification_setting_get_pop_up_notification(setting, &ret); if (err != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("notification_setting_get_pop_up_notification failed"); + NOTIFICATION_ERR("Failed to get pop_up_notification [%d]", err); goto out; } @@ -941,17 +942,17 @@ EXPORT_API int notification_noti_insert(notification_h noti) char *query = NULL; if (noti == NULL) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); + NOTIFICATION_ERR("Invalid notification handle"); return NOTIFICATION_ERROR_INVALID_PARAMETER; } if (_is_allowed_to_notify(noti) == false) { - NOTIFICATION_DBG("[%s] is not allowed to notify", noti->caller_app_id); + NOTIFICATION_ERR("[%s] is not allowed to notify", noti->caller_app_id); return NOTIFICATION_ERROR_PERMISSION_DENIED; } if (_handle_do_not_disturb_option(noti) != NOTIFICATION_ERROR_NONE) - NOTIFICATION_WARN("_handle_do_not_disturb_option failed"); + NOTIFICATION_WARN("Failed to handle do_not_disturb"); if (_is_pop_up_notification((const char *)noti->caller_app_id, noti->uid) == false) { noti->display_applist = (noti->display_applist & (~NOTIFICATION_DISPLAY_APP_ACTIVE)); @@ -973,14 +974,14 @@ EXPORT_API int notification_noti_insert(notification_h noti) query = sqlite3_mprintf("INSERT INTO noti_list (%s) VALUES (%s)", NOTI_LIST_DB_ATTRIBUTES_INSERT, NOTI_LIST_INSERT_VALUES); if (query == NULL) { - NOTIFICATION_ERR("sqlite3_mprintf failed"); + NOTIFICATION_ERR("sqlite3_mprintf Failed"); ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto err; } ret = sqlite3_prepare_v2(db, query, -1, &stmt, NULL); if (ret != SQLITE_OK) { - NOTIFICATION_ERR("sqlite3_prepare_v2 failed [%d][%s]", ret, + NOTIFICATION_ERR("sqlite3_prepare_v2 Failed [%d][%s]", ret, sqlite3_errmsg(db)); ret = NOTIFICATION_ERROR_FROM_DB; goto err; @@ -1018,7 +1019,7 @@ EXPORT_API int notification_noti_get_by_priv_id(notification_h noti, int priv_id char *query_where = NULL; if (priv_id < 0 || noti == NULL) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); + NOTIFICATION_ERR("Invalid parameter"); return NOTIFICATION_ERROR_INVALID_PARAMETER; } @@ -1044,7 +1045,7 @@ EXPORT_API int notification_noti_get_by_tag(notification_h noti, char *app_id, c char *query_where; if (tag == NULL || noti == NULL) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); + NOTIFICATION_ERR("Invalid paramter"); return NOTIFICATION_ERROR_INVALID_PARAMETER; } @@ -1072,7 +1073,7 @@ EXPORT_API int notification_noti_update(notification_h noti) char *query = NULL; if (noti == NULL) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); + NOTIFICATION_ERR("Invalid parameter"); return NOTIFICATION_ERROR_INVALID_PARAMETER; } @@ -1082,7 +1083,7 @@ EXPORT_API int notification_noti_update(notification_h noti) } if (_handle_do_not_disturb_option(noti) != NOTIFICATION_ERROR_NONE) - NOTIFICATION_WARN("_handle_do_not_disturb_option failed"); + NOTIFICATION_WARN("Failed to handle do_not_disturb"); if (_is_pop_up_notification((const char *)noti->caller_app_id, noti->uid) == false) { noti->display_applist = (noti->display_applist & (~NOTIFICATION_DISPLAY_APP_ACTIVE)); @@ -1097,7 +1098,7 @@ EXPORT_API int notification_noti_update(notification_h noti) /* Check private ID is exist */ ret = _notification_noti_check_priv_id(noti, db); if (ret != NOTIFICATION_ERROR_ALREADY_EXIST_ID) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_NOT_EXIST_ID"); + NOTIFICATION_ERR("The ID is not existed"); ret = NOTIFICATION_ERROR_NOT_EXIST_ID; goto err; } @@ -1111,7 +1112,7 @@ EXPORT_API int notification_noti_update(notification_h noti) ret = sqlite3_prepare_v2(db, query, -1, &stmt, NULL); if (ret != SQLITE_OK) { - NOTIFICATION_ERR("sqlite3_prepare_v2 failed [%d][%s]", ret, + NOTIFICATION_ERR("sqlite3_prepare_v2 Failed [%d][%s]", ret, sqlite3_errmsg(db)); ret = NOTIFICATION_ERROR_FROM_DB; goto err; @@ -1204,8 +1205,8 @@ EXPORT_API int notification_noti_delete_all(notification_type_e type, ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL); if (ret != SQLITE_OK) { - NOTIFICATION_ERR("Select DB error(%d) : %s", ret, - sqlite3_errmsg(db)); + NOTIFICATION_ERR("Failed to sqlite3_prepare_V2 [%d][%s]", + ret, sqlite3_errmsg(db)); ret = NOTIFICATION_ERROR_FROM_DB; goto err; @@ -1219,7 +1220,7 @@ EXPORT_API int notification_noti_delete_all(notification_type_e type, if (tmp) { *list_deleted_rowid = tmp; } else { - NOTIFICATION_ERR("Heap: %s\n", strerror_r(errno, err_buf, sizeof(err_buf))); + NOTIFICATION_ERR("Failed to realloc memory [%s]", strerror_r(errno, err_buf, sizeof(err_buf))); /*! * \TODO * How can I handle this? @@ -1470,8 +1471,8 @@ EXPORT_API int notification_noti_get_count(notification_type_e type, ret = sqlite3_prepare_v2(db, query, -1, &stmt, NULL); if (ret != SQLITE_OK) { - NOTIFICATION_ERR("Select DB error(%d) : %s", ret, - sqlite3_errmsg(db)); + NOTIFICATION_ERR("Failed to sqlite3_prepare_v2[%d][%s]", + ret, sqlite3_errmsg(db)); ret = NOTIFICATION_ERROR_FROM_DB; goto err; @@ -1671,8 +1672,8 @@ EXPORT_API int notification_noti_check_tag(notification_h noti) ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL); if (ret != SQLITE_OK) { - NOTIFICATION_ERR("sqlite3_prepare_v2 failed [%d][%s]", ret, - sqlite3_errmsg(db)); + NOTIFICATION_ERR("Failed to sqlite3_prepare_v2[%d][%s]", + ret, sqlite3_errmsg(db)); goto err; } @@ -1728,8 +1729,8 @@ EXPORT_API int notification_noti_check_count_for_template(notification_h noti, i ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL); if (ret != SQLITE_OK) { - NOTIFICATION_ERR("sqlite3_prepare_v2 failed [%d][%s]", ret, - sqlite3_errmsg(db)); + NOTIFICATION_ERR("Failed to sqlite3_prepare_v2[%d][%s]", + ret, sqlite3_errmsg(db)); ret = NOTIFICATION_ERROR_FROM_DB; goto err; } @@ -1788,8 +1789,8 @@ EXPORT_API int notification_noti_add_template(notification_h noti, char *templat ret = sqlite3_prepare_v2(db, query, -1, &stmt, NULL); if (ret != SQLITE_OK) { - NOTIFICATION_ERR("sqlite3_prepare_v2 failed [%d][%s]", ret, - sqlite3_errmsg(db)); + NOTIFICATION_ERR("Failed to sqlite3_prepare_v2[%d][%s]", + ret, sqlite3_errmsg(db)); ret = NOTIFICATION_ERROR_FROM_DB; goto err; } @@ -1834,7 +1835,7 @@ EXPORT_API int notification_noti_get_package_template(notification_h noti, char ret = _get_notification(query_where, noti); if (ret != NOTIFICATION_ERROR_NONE) - NOTIFICATION_ERR("_get_notification failed, %d", ret); + NOTIFICATION_ERR("Failed to get notification [%d]", ret); if (query_where) sqlite3_free(query_where); diff --git a/src/notification_ongoing.c b/src/notification_ongoing.c index b9f58f0..a5f4ec8 100755 --- a/src/notification_ongoing.c +++ b/src/notification_ongoing.c @@ -59,7 +59,7 @@ static void __notification_ongoing_update_callback(GDBusConnection *connection, info = calloc(1, sizeof(struct ongoing_info_s)); if (info == NULL) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("Out of memory"); + NOTIFICATION_ERR("Failed to alloc memory"); return; /* LCOV_EXCL_STOP */ } @@ -77,7 +77,7 @@ static void __notification_ongoing_update_callback(GDBusConnection *connection, if (app_id == NULL) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("app_id is null"); + NOTIFICATION_ERR("app_id is NULL"); free(info); return; /* LCOV_EXCL_STOP */ @@ -106,7 +106,8 @@ static int __send_ongoing_update_signal(const char *signal_name, GVariant *param conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err); if (conn == NULL) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("g_bus_get_sync() failed: %s", err->message); + NOTIFICATION_ERR("Failed to connect to the D-BUS Daemon[%s]", + err->message); ret = NOTIFICATION_ERROR_FROM_DBUS; goto end; /* LCOV_EXCL_STOP */ @@ -120,7 +121,7 @@ static int __send_ongoing_update_signal(const char *signal_name, GVariant *param param, &err) == FALSE) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("g_dbus_connection_emit_signal() failed: %s", + NOTIFICATION_ERR("Failed to emit gdbus signal[%s]", err->message); ret = NOTIFICATION_ERROR_FROM_DBUS; goto end; @@ -129,7 +130,7 @@ static int __send_ongoing_update_signal(const char *signal_name, GVariant *param if (g_dbus_connection_flush_sync(conn, NULL, &err) == FALSE) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("g_dbus_connection_flush_sync() failed: %s", + NOTIFICATION_ERR("Failed to flush connection sync[%s]", err->message); ret = NOTIFICATION_ERROR_FROM_DBUS; goto end; @@ -182,7 +183,7 @@ int notification_ongoing_update_cb_set(notification_ongoing_update_cb callback, NULL); if (od.subscribe_id == 0) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("g_dbus_connection_signal_subscribe() failed"); + NOTIFICATION_ERR("Failed to subscribe signal"); g_object_unref(od.conn); return NOTIFICATION_ERROR_FROM_DBUS; /* LCOV_EXCL_STOP */ @@ -225,8 +226,7 @@ int notification_ongoing_update_progress(const char *caller_app_id, ret = __send_ongoing_update_signal(MEMBER_PROGRESS, param); if (ret != NOTIFICATION_ERROR_NONE) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("notification_ongoing_update_progress failed %d", - ret); + NOTIFICATION_ERR("Failed to update progress[%d]", ret); return ret; /* LCOV_EXCL_STOP */ } @@ -245,8 +245,7 @@ int notification_ongoing_update_size(const char *caller_app_id, ret = __send_ongoing_update_signal(MEMBER_SIZE, param); if (ret != NOTIFICATION_ERROR_NONE) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("notification_ongoing_update_size failed %d", - ret); + NOTIFICATION_ERR("Failed to update size[%d]", ret); return ret; /* LCOV_EXCL_STOP */ } @@ -265,7 +264,7 @@ int notification_ongoing_update_content(const char *caller_app_id, ret = __send_ongoing_update_signal(MEMBER_CONTENT, param); if (ret != NOTIFICATION_ERROR_NONE) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("notification_ongoing_update_content failed %d", + NOTIFICATION_ERR("Failed to update content[%d]", ret); return ret; /* LCOV_EXCL_STOP */ diff --git a/src/notification_setting.c b/src/notification_setting.c index 997d849..33e4c5a 100755 --- a/src/notification_setting.c +++ b/src/notification_setting.c @@ -52,7 +52,7 @@ static GHashTable *_noti_dnd_cb_hash = NULL; EXPORT_API int notification_setting_get_setting_array_for_uid(notification_setting_h *setting_array, int *count, uid_t uid) { if (setting_array == NULL || count == NULL) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); + NOTIFICATION_ERR("Invalid parameter"); return NOTIFICATION_ERROR_INVALID_PARAMETER; } @@ -67,7 +67,7 @@ EXPORT_API int notification_setting_get_setting_array(notification_setting_h *se EXPORT_API int notification_setting_get_setting_by_appid_for_uid(const char *app_id, notification_setting_h *setting, uid_t uid) { if (app_id == NULL || setting == NULL) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); + NOTIFICATION_ERR("Invalid parameter"); return NOTIFICATION_ERROR_INVALID_PARAMETER; } @@ -333,7 +333,7 @@ static bool _is_package_in_setting_table(sqlite3 *db, const char *package_name, sql_ret = sqlite3_step(stmt); if (sql_ret == SQLITE_DONE) { - NOTIFICATION_INFO("no matched [%s] from package_name [%s], [%d]", + NOTIFICATION_INFO("No matched [%s] from package_name [%s], [%d]", app_id, package_name, sql_ret); err = false; goto out; @@ -369,7 +369,7 @@ static int _foreach_app_info_callback(const pkgmgrinfo_appinfo_h handle, ret = pkgmgrinfo_appinfo_get_appid(handle, &app_id); if (ret != PACKAGE_MANAGER_ERROR_NONE) { - NOTIFICATION_ERR("pkgmgrinfo_appinfo_get_appid failed [%d]", + NOTIFICATION_ERR("Failed to get appid from pkgmgrinfo [%d]", ret); err = false; goto out; @@ -377,7 +377,7 @@ static int _foreach_app_info_callback(const pkgmgrinfo_appinfo_h handle, ret = pkgmgrinfo_appinfo_get_pkgname(handle, &package_name); if (ret != PACKAGE_MANAGER_ERROR_NONE) { - NOTIFICATION_ERR("pkgmgrinfo_appinfo_get_pkgname failed [%d]", + NOTIFICATION_ERR("Failed to get pkgname from pkgmgrinfo[%d]", ret); goto out; } @@ -388,9 +388,6 @@ static int _foreach_app_info_callback(const pkgmgrinfo_appinfo_h handle, goto out; } - NOTIFICATION_INFO("uid %d package_name %s [%s] will be inserted", - info->uid, package_name, app_id); - query = sqlite3_mprintf("INSERT INTO %s (uid, package_name, app_id) " "VALUES (%d, %Q, %Q) ", NOTIFICATION_SETTING_DB_TABLE, @@ -406,6 +403,9 @@ static int _foreach_app_info_callback(const pkgmgrinfo_appinfo_h handle, ret = notification_db_exec(db, query, NULL); if (ret != NOTIFICATION_ERROR_NONE) err = false; + else + NOTIFICATION_INFO("uid [%d] package_name [%s] appid [%s] is inserted", + info->uid, package_name, app_id); out: if (query) @@ -424,28 +424,29 @@ static int _foreach_package_info_callback(const pkgmgrinfo_pkginfo_h package_inf pkgmgr_ret = pkgmgrinfo_pkginfo_get_pkgname(package_info, &package_name); if (pkgmgr_ret != PACKAGE_MANAGER_ERROR_NONE) { - NOTIFICATION_ERR("package_info_get_package failed [%d]", pkgmgr_ret); + NOTIFICATION_ERR("Failed to get pkgname from pkgmgrinfo[%d]", pkgmgr_ret); err = false; goto out; } pkgmgr_ret = pkgmgrinfo_appinfo_filter_create(&handle); if (pkgmgr_ret != PMINFO_R_OK) { - NOTIFICATION_ERR("pkgmgrinfo_appinfo_filter_create failed [%d]", pkgmgr_ret); + NOTIFICATION_ERR("Failed to create appinofo[%d]", + pkgmgr_ret); err = false; goto out; } pkgmgr_ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_PACKAGE, package_name); if (pkgmgr_ret != PMINFO_R_OK) { - NOTIFICATION_ERR("pkgmgrinfo_appinfo_filter_add_string failed [%d]", pkgmgr_ret); + NOTIFICATION_ERR("Failed to add string to appinfo[%d]", pkgmgr_ret); err = false; goto out; } pkgmgr_ret = pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(handle, _foreach_app_info_callback, info, info->uid); if (pkgmgr_ret != PMINFO_R_OK) { - NOTIFICATION_ERR("pkgmgrinfo_pkginfo_filter_foreach_appinfo failed [%d]", pkgmgr_ret); + NOTIFICATION_ERR("Failed to iterate appinfo[%d]", pkgmgr_ret); err = false; goto out; } @@ -471,21 +472,21 @@ static int _install_and_update_package(const char *package_name, uid_t uid) pkgmgr_ret = pkgmgrinfo_pkginfo_filter_create(&handle); if (pkgmgr_ret != PMINFO_R_OK) { - NOTIFICATION_ERR("pkgmgrinfo_pkginfo_filter_create failed [%d]", pkgmgr_ret); + NOTIFICATION_ERR("Failed to create pkginfo_filter[%d]", pkgmgr_ret); err = NOTIFICATION_ERROR_FROM_DB; goto out; } pkgmgr_ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_PRIVILEGE, NOTIFICATION_PRIVILEGE); if (pkgmgr_ret != PMINFO_R_OK) { - NOTIFICATION_ERR("pkgmgrinfo_pkginfo_filter_add_string failed [%d]", pkgmgr_ret); + NOTIFICATION_ERR("Failed to add string to pkginfo_filter[%d]", pkgmgr_ret); err = NOTIFICATION_ERROR_FROM_DB; goto out; } pkgmgr_ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_ID, package_name); if (pkgmgr_ret != PMINFO_R_OK) { - NOTIFICATION_ERR("pkgmgrinfo_pkginfo_filter_add_string failed [%d]", pkgmgr_ret); + NOTIFICATION_ERR("Failed to add string to pkginfo_filter[%d]", pkgmgr_ret); err = NOTIFICATION_ERROR_FROM_DB; goto out; } @@ -494,7 +495,7 @@ static int _install_and_update_package(const char *package_name, uid_t uid) info.uid = uid; pkgmgr_ret = pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo(handle, _foreach_package_info_callback, &info, uid); if (pkgmgr_ret != PMINFO_R_OK) { - NOTIFICATION_ERR("pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo failed [%d]", pkgmgr_ret); + NOTIFICATION_ERR("Failed to iterate pkginfo[%d]", pkgmgr_ret); err = NOTIFICATION_ERROR_FROM_DB; goto out; } @@ -533,7 +534,7 @@ static int _delete_package_from_setting_db(const char *package_name, uid_t uid) package_name); if (query == NULL) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("fail to alloc query"); + NOTIFICATION_ERR("Failed to alloc query"); err = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto out; /* LCOV_EXCL_STOP */ @@ -559,7 +560,7 @@ EXPORT_API int notification_setting_refresh_setting_table(uid_t uid) pkgmgrinfo_pkginfo_filter_h filter = NULL; setting_local_info info; - NOTIFICATION_INFO("refresh setting table [%d]", uid); + NOTIFICATION_INFO("Refresh setting table [%d]", uid); db = notification_db_open(DBPATH); if (!db) @@ -567,14 +568,14 @@ EXPORT_API int notification_setting_refresh_setting_table(uid_t uid) pkgmgr_ret = pkgmgrinfo_pkginfo_filter_create(&filter); if (pkgmgr_ret != PMINFO_R_OK) { - NOTIFICATION_ERR("pkgmgrinfo_pkginfo_filter_create failed [%d]", pkgmgr_ret); + NOTIFICATION_ERR("Failed to create pkginfo_filter[%d]", pkgmgr_ret); err = NOTIFICATION_ERROR_FROM_DB; goto out; } pkgmgr_ret = pkgmgrinfo_pkginfo_filter_add_string(filter, PMINFO_PKGINFO_PROP_PACKAGE_PRIVILEGE, NOTIFICATION_PRIVILEGE); if (pkgmgr_ret != PMINFO_R_OK) { - NOTIFICATION_ERR("pkgmgrinfo_pkginfo_filter_add_string failed [%d]", pkgmgr_ret); + NOTIFICATION_ERR("Failed to add string to pkginfo_filter[%d]", pkgmgr_ret); err = NOTIFICATION_ERROR_FROM_DB; goto out; } @@ -583,7 +584,7 @@ EXPORT_API int notification_setting_refresh_setting_table(uid_t uid) info.uid = uid; pkgmgr_ret = pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo(filter, _foreach_package_info_callback, &info, uid); if (pkgmgr_ret != PMINFO_R_OK) { - NOTIFICATION_ERR("pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo failed [%d]", pkgmgr_ret); + NOTIFICATION_ERR("Failed to foreach pkginfo[%d]", pkgmgr_ret); err = NOTIFICATION_ERROR_FROM_DB; goto out; } @@ -857,7 +858,7 @@ EXPORT_API int notification_system_setting_get_dnd_allow_exceptions(notification dnd_allow_exception_data = (dnd_allow_exception_h)list->data; *value = dnd_allow_exception_data->value; } else { - NOTIFICATION_ERR("Invalid parameter - type"); + NOTIFICATION_ERR("Invalid type"); return NOTIFICATION_ERROR_INVALID_PARAMETER; } @@ -917,7 +918,7 @@ void notification_call_dnd_changed_cb_for_uid(int do_not_disturb, uid_t uid) noti_dnd_cb_list = (GList *)g_hash_table_lookup(_noti_dnd_cb_hash, GUINT_TO_POINTER(uid)); if (noti_dnd_cb_list == NULL) { - NOTIFICATION_ERR("Invalide data"); + NOTIFICATION_ERR("Invalid data"); return; } @@ -941,7 +942,7 @@ EXPORT_API int notification_register_system_setting_dnd_changed_cb_for_uid(dnd_c return NOTIFICATION_ERROR_INVALID_PARAMETER; if (notification_ipc_monitor_init(uid) != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("notification_ipc_monitor_init error"); + NOTIFICATION_ERR("Failed to init monitor"); return NOTIFICATION_ERROR_IO_ERROR; } @@ -1037,7 +1038,7 @@ static bool _is_uid_in_system_setting_table(sqlite3 *db, uid_t uid) NOTIFICATION_SYSTEM_SETTING_DB_TABLE, uid); if (query == NULL) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("fail to alloc query"); + NOTIFICATION_ERR("Failed to alloc query"); return NOTIFICATION_ERROR_OUT_OF_MEMORY; /* LCOV_EXCL_STOP */ } @@ -1054,7 +1055,7 @@ static bool _is_uid_in_system_setting_table(sqlite3 *db, uid_t uid) sql_ret = sqlite3_step(stmt); if (sql_ret == SQLITE_DONE) { - NOTIFICATION_INFO("no matched uid found[%d][%d]", uid, sql_ret); + NOTIFICATION_INFO("No matched uid[%d] err[%d]", uid, sql_ret); err = false; goto out; } @@ -1089,7 +1090,7 @@ EXPORT_API int notification_system_setting_init_system_setting_table(uid_t uid) return get_last_result(); /* LCOV_EXCL_LINE */ if (_is_uid_in_system_setting_table(db, uid) == true) { - NOTIFICATION_DBG("table is already initialized."); + NOTIFICATION_INFO("Setting table is already initialized."); goto out; } @@ -1117,7 +1118,7 @@ EXPORT_API int notification_system_setting_init_system_setting_table(uid_t uid) uid); if (query_dnd_allow_exception == NULL) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("fail to alloc query"); + NOTIFICATION_ERR("Failed to alloc query"); ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto out; /* LCOV_EXCL_STOP */ @@ -1127,7 +1128,7 @@ EXPORT_API int notification_system_setting_init_system_setting_table(uid_t uid) if (ret != NOTIFICATION_ERROR_NONE) goto out; - NOTIFICATION_DBG("initialization is success."); + NOTIFICATION_DBG("Initialization is success."); out: if (query_system_setting) diff --git a/src/notification_setting_service.c b/src/notification_setting_service.c index 70a7001..58d747c 100755 --- a/src/notification_setting_service.c +++ b/src/notification_setting_service.c @@ -75,7 +75,7 @@ static int _get_table_field_data_string(char **table, char **buf, int ucs2, int if (sLen) { *buf = (char *)malloc(sLen + 1); if (*buf == NULL) { - NOTIFICATION_ERR("malloc is failed"); /* LCOV_EXCL_LINE */ + NOTIFICATION_ERR("Failed to alloc memory"); /* LCOV_EXCL_LINE */ goto out; } memset(*buf, 0, sLen + 1); @@ -106,7 +106,7 @@ int noti_setting_service_get_setting_by_app_id(const char *app_id, notification_ notification_setting_h result_setting_array = NULL; if (app_id == NULL || setting == NULL) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); /* LCOV_EXCL_LINE */ + NOTIFICATION_ERR("Invalid parameter"); /* LCOV_EXCL_LINE */ return NOTIFICATION_ERROR_INVALID_PARAMETER; } @@ -118,7 +118,7 @@ int noti_setting_service_get_setting_by_app_id(const char *app_id, notification_ NOTIFICATION_SETTING_DB_ATTRIBUTES, NOTIFICATION_SETTING_DB_TABLE, app_id, uid); if (query == NULL) { - NOTIFICATION_ERR("fail to alloc query"); /* LCOV_EXCL_LINE */ + NOTIFICATION_ERR("Failed to alloc query"); /* LCOV_EXCL_LINE */ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto out; } @@ -137,12 +137,12 @@ int noti_setting_service_get_setting_by_app_id(const char *app_id, notification_ goto out; } - NOTIFICATION_DBG("row_count [%d] column_count [%d]", row_count, column_count); + NOTIFICATION_DBG("row_count[%d] column_count[%d]", row_count, column_count); row_count = 1; if (!(result_setting_array = (struct notification_setting *)malloc(sizeof(struct notification_setting) * row_count))) { - NOTIFICATION_ERR("malloc failed..."); /* LCOV_EXCL_LINE */ + NOTIFICATION_ERR("Failed to alloc memory"); /* LCOV_EXCL_LINE */ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto out; } @@ -201,29 +201,29 @@ int noti_setting_get_setting_array(notification_setting_h *setting_array, int *c "app_id ", NOTIFICATION_SETTING_DB_ATTRIBUTES, NOTIFICATION_SETTING_DB_TABLE, uid, 0); if (query == NULL) { - NOTIFICATION_ERR("fail to alloc query"); /* LCOV_EXCL_LINE */ + NOTIFICATION_ERR("Failed to alloc query"); /* LCOV_EXCL_LINE */ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto out; } sql_ret = sqlite3_get_table(db, query, &query_result, &row_count, &column_count, NULL); if (sql_ret != SQLITE_OK && sql_ret != -1) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_FROM_DB failed [%d][%s]", + NOTIFICATION_ERR("Failed to get db table [%d][%s]", sql_ret, query); /* LCOV_EXCL_LINE */ ret = NOTIFICATION_ERROR_FROM_DB; goto out; } if (!row_count) { - NOTIFICATION_DBG("No setting found..."); /* LCOV_EXCL_LINE */ + NOTIFICATION_DBG("No setting found"); /* LCOV_EXCL_LINE */ ret = NOTIFICATION_ERROR_NOT_EXIST_ID; goto out; } - NOTIFICATION_DBG("row_count [%d] column_count [%d]", row_count, column_count); + NOTIFICATION_DBG("row_count[%d] column_count[%d]", row_count, column_count); if (!(result_setting_array = (struct notification_setting *)malloc(sizeof(struct notification_setting) * row_count))) { - NOTIFICATION_ERR("malloc failed..."); /* LCOV_EXCL_LINE */ + NOTIFICATION_ERR("Failed to alloc memory"); /* LCOV_EXCL_LINE */ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto out; } @@ -272,7 +272,7 @@ int noti_system_setting_load_system_setting(notification_system_setting_h *syste notification_system_setting_h result_system_setting = NULL; if (system_setting == NULL) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); /* LCOV_EXCL_LINE */ + NOTIFICATION_ERR("Invalid parameter"); /* LCOV_EXCL_LINE */ return NOTIFICATION_ERROR_INVALID_PARAMETER; } @@ -284,14 +284,14 @@ int noti_system_setting_load_system_setting(notification_system_setting_h *syste NOTIFICATION_SYSTEM_SETTING_DB_ATTRIBUTES, NOTIFICATION_SYSTEM_SETTING_DB_TABLE, uid); if (query == NULL) { - NOTIFICATION_ERR("fail to alloc query"); /* LCOV_EXCL_LINE */ + NOTIFICATION_ERR("Failed to alloc query"); /* LCOV_EXCL_LINE */ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto out; } sql_ret = sqlite3_get_table(db, query, &query_result, &row_count, &column_count, NULL); if (sql_ret != SQLITE_OK && sql_ret != -1) { - NOTIFICATION_ERR("sqlite3_get_table failed [%d][%s]", sql_ret, query); /* LCOV_EXCL_LINE */ + NOTIFICATION_ERR("Failed to get db table [%d][%s]", sql_ret, query); /* LCOV_EXCL_LINE */ ret = NOTIFICATION_ERROR_FROM_DB; goto out; } @@ -300,14 +300,14 @@ int noti_system_setting_load_system_setting(notification_system_setting_h *syste result_system_setting = (struct notification_system_setting *)malloc(sizeof(struct notification_system_setting)); if (result_system_setting == NULL) { - NOTIFICATION_ERR("malloc failed..."); /* LCOV_EXCL_LINE */ + NOTIFICATION_ERR("Failed to alloc memory"); /* LCOV_EXCL_LINE */ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto out; } /* no system setting record. allow everyting */ if (!row_count) { - NOTIFICATION_DBG("No setting found..."); /* LCOV_EXCL_LINE */ + NOTIFICATION_DBG("No setting found"); /* LCOV_EXCL_LINE */ result_system_setting->do_not_disturb = 0; result_system_setting->visibility_class = 0; result_system_setting->dnd_schedule_enabled = 0; @@ -360,7 +360,7 @@ int notification_setting_db_update(const char *package_name, const char *app_id, int ret = NOTIFICATION_ERROR_NONE; if (package_name == NULL || app_id == NULL) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); /* LCOV_EXCL_LINE */ + NOTIFICATION_ERR("Invalid paramter"); /* LCOV_EXCL_LINE */ return NOTIFICATION_ERROR_INVALID_PARAMETER; } @@ -456,7 +456,7 @@ int notification_setting_db_update_do_not_disturb(int do_not_disturb, uid_t uid) NOTIFICATION_SYSTEM_SETTING_DB_TABLE, do_not_disturb, uid); if (query == NULL) { - NOTIFICATION_ERR("fail to alloc query"); /* LCOV_EXCL_LINE */ + NOTIFICATION_ERR("Failed to alloc query"); /* LCOV_EXCL_LINE */ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto out; } @@ -501,7 +501,7 @@ int notification_system_setting_get_dnd_schedule_enabled_uid(uid_t **uids, int * ret = sqlite3_get_table(db, query, &query_result, &row_count, &column_count, NULL); if (ret != SQLITE_OK && ret != -1) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_FROM_DB failed [%d][%s]", ret, query); /* LCOV_EXCL_LINE */ + NOTIFICATION_ERR("Failed to get DB table [%d][%s]", ret, query); /* LCOV_EXCL_LINE */ ret = NOTIFICATION_ERROR_FROM_DB; goto out; } @@ -513,7 +513,7 @@ int notification_system_setting_get_dnd_schedule_enabled_uid(uid_t **uids, int * } if (!(result_uids = (uid_t *)malloc(sizeof(int) * row_count))) { - NOTIFICATION_ERR("Memory allocation fail"); + NOTIFICATION_ERR("Failed to alloc memory"); ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto out; } @@ -569,7 +569,7 @@ int notification_get_dnd_and_allow_to_notify(const char *app_id, NOTIFICATION_SETTING_DB_TABLE, app_id, uid, tzplatform_getuid(TZ_SYS_GLOBALAPP_USER)); if (query_setting == NULL) { - NOTIFICATION_ERR("fail to alloc query"); + NOTIFICATION_ERR("Failed to alloc memory"); ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto out; } @@ -578,14 +578,14 @@ int notification_get_dnd_and_allow_to_notify(const char *app_id, "WHERE uid = %d", NOTIFICATION_SYSTEM_SETTING_DB_TABLE, uid); if (query_system_setting == NULL) { - NOTIFICATION_ERR("fail to alloc query"); + NOTIFICATION_ERR("Failed to alloc memory"); ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto out; } sql_ret = sqlite3_get_table(db, query_setting, &query_setting_result, &row_count, &col_count, NULL); if (sql_ret != SQLITE_OK && sql_ret != -1) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_FROM_DB failed [%d][%s]", sql_ret, query_setting); + NOTIFICATION_ERR("Failed to get DB table [%d][%s]", sql_ret, query_setting); ret = NOTIFICATION_ERROR_FROM_DB; goto out; } @@ -602,7 +602,7 @@ int notification_get_dnd_and_allow_to_notify(const char *app_id, sql_ret = sqlite3_get_table(db, query_system_setting, &query_system_setting_result, &row_count, &col_count, NULL); if (sql_ret != SQLITE_OK && sql_ret != -1) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_FROM_DB failed [%d][%s]", sql_ret, query_setting); + NOTIFICATION_ERR("Failed to get DB table [%d][%s]", sql_ret, query_setting); ret = NOTIFICATION_ERROR_FROM_DB; goto out; } @@ -649,7 +649,7 @@ EXPORT_API int notification_system_setting_load_dnd_allow_exception(dnd_allow_ex dnd_allow_exception_h dnd_allow_exception_data = NULL; if (dnd_allow_exception == NULL) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); /* LCOV_EXCL_LINE */ + NOTIFICATION_ERR("Invalid paramter"); /* LCOV_EXCL_LINE */ return NOTIFICATION_ERROR_INVALID_PARAMETER; } @@ -660,25 +660,25 @@ EXPORT_API int notification_system_setting_load_dnd_allow_exception(dnd_allow_ex query = sqlite3_mprintf("SELECT type, value FROM %s WHERE uid = %d", NOTIFICATION_DND_ALLOW_EXCEPTION, uid); if (query == NULL) { - NOTIFICATION_ERR("fail to alloc query"); /* LCOV_EXCL_LINE */ + NOTIFICATION_ERR("Failed to alloc memory"); /* LCOV_EXCL_LINE */ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto out; } sql_ret = sqlite3_get_table(db, query, &query_result, &row_count, &column_count, NULL); if (sql_ret != SQLITE_OK && sql_ret != -1) { - NOTIFICATION_ERR("sqlite3_get_table failed [%d][%s]", sql_ret, query); /* LCOV_EXCL_LINE */ + NOTIFICATION_ERR("Failed to get DB table [%d][%s]", sql_ret, query); /* LCOV_EXCL_LINE */ ret = NOTIFICATION_ERROR_FROM_DB; goto out; } if (!row_count) { - NOTIFICATION_DBG("No setting found..."); /* LCOV_EXCL_LINE */ + NOTIFICATION_DBG("No setting found"); /* LCOV_EXCL_LINE */ goto out; } else { dnd_allow_exception_data = (dnd_allow_exception_h)malloc(sizeof(struct notification_system_setting_dnd_allow_exception) * row_count); if (dnd_allow_exception_data == NULL) { - NOTIFICATION_ERR("failed to malloc"); + NOTIFICATION_ERR("Failed to alloc memory"); return NOTIFICATION_ERROR_OUT_OF_MEMORY; } @@ -723,7 +723,7 @@ int notification_system_setting_update_dnd_allow_exception(int type, int value, NOTIFICATION_DND_ALLOW_EXCEPTION, uid, type, value); if (query == NULL) { - NOTIFICATION_ERR("fail to alloc query"); /* LCOV_EXCL_LINE */ + NOTIFICATION_ERR("Failed to alloc memory"); /* LCOV_EXCL_LINE */ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto out; } @@ -763,14 +763,14 @@ int noti_system_setting_get_do_not_disturb(int *do_not_disturb, uid_t uid) query = sqlite3_mprintf("SELECT do_not_disturb FROM %s WHERE uid = %d", NOTIFICATION_SYSTEM_SETTING_DB_TABLE, uid); if (query == NULL) { - NOTIFICATION_ERR("fail to alloc query"); + NOTIFICATION_ERR("Failed to alloc memory"); ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto out; } ret = sqlite3_get_table(db, query, &query_result, &row_count, &col_count, NULL); if (ret != SQLITE_OK && ret != -1) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_FROM_DB failed [%d][%s]", ret, query); + NOTIFICATION_ERR("Failed to get DB table [%d][%s]", ret, query); ret = NOTIFICATION_ERROR_FROM_DB; goto out; } @@ -817,7 +817,7 @@ int notification_setting_db_update_app_disabled(const char *app_id, bool value, NOTIFICATION_SETTING_DB_TABLE, value, app_id, uid); if (query == NULL) { - NOTIFICATION_ERR("fail to alloc query"); /* LCOV_EXCL_LINE */ + NOTIFICATION_ERR("Failed to alloc memory"); /* LCOV_EXCL_LINE */ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto out; } diff --git a/src/notification_shared_file.c b/src/notification_shared_file.c index 322051d..eef21a7 100755 --- a/src/notification_shared_file.c +++ b/src/notification_shared_file.c @@ -83,7 +83,7 @@ static bool __make_sharing_dir(const char *dir) noti_dir = g_file_new_for_path(dir); if (g_file_make_directory(noti_dir, NULL, &g_err) == false) { if (g_err) { - NOTIFICATION_ERR("make_directory fail (%s)", + NOTIFICATION_ERR("Failed to make sharing dir[%s]", g_err->message); g_error_free(g_err); } @@ -189,20 +189,20 @@ int notification_copy_private_file(const char* src_path, dst = g_file_new_for_path(dst_path); if (dst == NULL) { - NOTIFICATION_ERR("des is wrong path [%s]", dst_path); + NOTIFICATION_ERR("dst path is wrong [%s]", dst_path); ret = NOTIFICATION_ERROR_IO_ERROR; goto out; } if (g_file_query_exists(dst, NULL) == true) { ret = NOTIFICATION_ERROR_ALREADY_EXIST_ID; - NOTIFICATION_INFO("dst_path existed [%s]", dst_path); + NOTIFICATION_INFO("dst path existed [%s]", dst_path); goto out; } src = g_file_new_for_path(src_path); if (src == NULL) { - NOTIFICATION_ERR("src is wrong path [%s]", src_path); + NOTIFICATION_ERR("src path is wrong [%s]", src_path); ret = NOTIFICATION_ERROR_IO_ERROR; goto out; } @@ -221,7 +221,7 @@ int notification_copy_private_file(const char* src_path, ut.modtime = time(NULL); if (g_utime(dst_path, &ut) != 0) - NOTIFICATION_DBG("failed to set g_utime %d ", errno); + NOTIFICATION_DBG("Failed to set g_utime %d ", errno); out: if (src) @@ -370,7 +370,7 @@ static void __make_file_info(char *src_path, char *dst_path, __free_file_info(file_info)); if (stat(dst_path, &stat_buf) != 0) - NOTIFICATION_ERR("fail to get stat info"); + NOTIFICATION_ERR("Failed to get stat info"); file_info->modification_time = stat_buf.st_mtime; *new_file_list = g_list_append(*new_file_list, file_info); @@ -378,7 +378,7 @@ static void __make_file_info(char *src_path, char *dst_path, file_info = (sharing_file_info_s *)tmp->data; if (stat(file_info->dst_path, &stat_buf) != 0) - NOTIFICATION_ERR("fail to get stat info"); + NOTIFICATION_ERR("Failed to get stat info"); if (file_info->modification_time != stat_buf.st_mtime) { dup_file_info = __dup_file_info(file_info); @@ -478,13 +478,13 @@ static char* __get_shared_dir(notification_h noti) path = noti->priv_vibration_path; if (path == NULL) { - NOTIFICATION_DBG("failed to find priv path"); + NOTIFICATION_DBG("No private resource"); return NULL; } index = __last_index_of(path, "/"); if (index == NULL) { - NOTIFICATION_ERR("failed to find directory separator"); + NOTIFICATION_ERR("Failed to find directory separator"); return NULL; } @@ -604,13 +604,13 @@ EXPORT_API void notification_add_private_sharing_target_id(pid_t pid, if (target_app == NULL) { app_id = notification_get_app_id_by_pid((int)pid); if (app_id == NULL) { - NOTIFICATION_ERR("out of memory"); + NOTIFICATION_ERR("Failed to get app id by pid"); return; } target_info = (target_app_info_s *)calloc(1, sizeof(target_app_info_s)); if (target_info == NULL) { - NOTIFICATION_ERR("out of memory"); + NOTIFICATION_ERR("Failed to alloc memory"); free(app_id); return; } @@ -618,7 +618,7 @@ EXPORT_API void notification_add_private_sharing_target_id(pid_t pid, target_info->app_id = app_id; target_info->dbus_sender_name = strdup(sender); if (target_info->dbus_sender_name == NULL) { - NOTIFICATION_ERR("out of memory"); + NOTIFICATION_ERR("Failed to alloc memory"); free(target_info); free(app_id); return; @@ -640,7 +640,7 @@ char *notification_check_file_path_is_private(const char *pkg_id, size = smack_new_label_from_path(file_path, XATTR_NAME_SMACK, TRUE, &smack_label); if (size <= 0) { - NOTIFICATION_ERR("fail to get smack info"); + NOTIFICATION_ERR("Failed to get smack info"); return NULL; } @@ -651,7 +651,7 @@ char *notification_check_file_path_is_private(const char *pkg_id, if (dst_path == NULL && __is_private_file(smack_label, pkg_id)) { dst_path = strdup(file_path); if (dst_path == NULL) - NOTIFICATION_ERR("out of memory"); + NOTIFICATION_ERR("Failed to strdup"); } free(smack_label); @@ -863,14 +863,14 @@ int __set_sharing_for_new_file(sharing_req_data_s *req_data, ret = security_manager_private_sharing_req_new(&handle); if (ret != SECURITY_MANAGER_SUCCESS) { ret = NOTIFICATION_ERROR_IO_ERROR; - NOTIFICATION_ERR("Failed to create private sharing request handle"); + NOTIFICATION_ERR("Failed to create private sharing request handle[%d]", ret); goto out; } ret = security_manager_private_sharing_req_set_owner_appid(handle, req_data->app_id); if (ret != SECURITY_MANAGER_SUCCESS) { - NOTIFICATION_ERR("Failed to set owner appid(%s) %d", + NOTIFICATION_ERR("Failed to set owner appid[%s][%d]", req_data->app_id, ret); ret = NOTIFICATION_ERROR_IO_ERROR; goto out; @@ -879,7 +879,7 @@ int __set_sharing_for_new_file(sharing_req_data_s *req_data, ret = security_manager_private_sharing_req_add_paths(handle, (const char **)path_array, len); if (ret != SECURITY_MANAGER_SUCCESS) { - NOTIFICATION_ERR("Failed to add paths %d", ret); + NOTIFICATION_ERR("Failed to add paths [%d]", ret); ret = NOTIFICATION_ERROR_IO_ERROR; goto out; } @@ -890,7 +890,7 @@ int __set_sharing_for_new_file(sharing_req_data_s *req_data, ret = security_manager_private_sharing_req_set_target_appid( handle, (const char *)iter->data); if (ret != SECURITY_MANAGER_SUCCESS) { - NOTIFICATION_ERR("Failed to set target appid(%s)", + NOTIFICATION_ERR("Failed to set target appid [%s]", (const char *)iter->data); ret = NOTIFICATION_ERROR_IO_ERROR; goto out; @@ -898,7 +898,7 @@ int __set_sharing_for_new_file(sharing_req_data_s *req_data, ret = security_manager_private_sharing_drop(handle); if (ret != SECURITY_MANAGER_SUCCESS) { - NOTIFICATION_ERR("Failed to drop %d", ret); + NOTIFICATION_ERR("Failed to drop [%d]", ret); ret = NOTIFICATION_ERROR_IO_ERROR; goto out; } @@ -910,7 +910,7 @@ int __set_sharing_for_new_file(sharing_req_data_s *req_data, ret = security_manager_private_sharing_req_set_target_appid(handle, (const char *)iter->data); if (ret != SECURITY_MANAGER_SUCCESS) { - NOTIFICATION_ERR("Failed to set target appid(%s)", + NOTIFICATION_ERR("Failed to set target appid [%s]", (const char *)iter->data); ret = NOTIFICATION_ERROR_IO_ERROR; goto out; @@ -918,7 +918,7 @@ int __set_sharing_for_new_file(sharing_req_data_s *req_data, ret = security_manager_private_sharing_apply(handle); if (ret != SECURITY_MANAGER_SUCCESS) { - NOTIFICATION_ERR("Failed to apply PS %d", ret); + NOTIFICATION_ERR("Failed to apply PS [%d]", ret); ret = NOTIFICATION_ERROR_IO_ERROR; goto out; } @@ -1023,7 +1023,8 @@ EXPORT_API int notification_set_private_sharing(notification_h noti, ret = NOTIFICATION_ERROR_IO_ERROR; goto out; } - NOTIFICATION_INFO("PS success [%d] [%d] [%d]", noti->priv_id, + NOTIFICATION_INFO("PS success priv id[%d] shared file count[%d] target app count[%d]", + noti->priv_id, g_list_length(req_data->shared_file_list), g_list_length(req_data->target_app_table)); @@ -1133,7 +1134,7 @@ EXPORT_API void notification_remove_private_sharing( iter = req_data->shared_file_list; for (; iter != NULL; iter = g_list_next(iter)) { if (g_remove(((sharing_file_info_s *)(iter->data))->dst_path) != 0) - NOTIFICATION_ERR("failed [%s] [%d]", iter->data, errno); + NOTIFICATION_ERR("Failed [%s] [%d]", iter->data, errno); } g_rmdir(req_data->dir); diff --git a/src/notification_status.c b/src/notification_status.c index 9d3cf3e..a83e0fd 100755 --- a/src/notification_status.c +++ b/src/notification_status.c @@ -57,14 +57,14 @@ static void __notification_status_message_dbus_callback(GDBusConnection *connect g_variant_get(parameters, "(&s)", &message); if (strlen(message) <= 0) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("message has only NULL"); + NOTIFICATION_ERR("message is NULL"); return; /* LCOV_EXCL_STOP */ } if (!md.callback) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("no callback"); + NOTIFICATION_ERR("No callback"); return; /* LCOV_EXCL_STOP */ } @@ -84,7 +84,7 @@ int notification_status_monitor_message_cb_set(notification_status_message_cb ca md.conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); if (md.conn == NULL) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("Failed to connect to the D-BUS Daemon: %s", + NOTIFICATION_ERR("Failed to connect to the D-BUS Daemon[%s]", error->message); g_error_free(error); return NOTIFICATION_ERROR_FROM_DBUS; @@ -105,7 +105,7 @@ int notification_status_monitor_message_cb_set(notification_status_message_cb ca NULL); if (md.message_id == 0) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("g_dbus_connection_signal_subscribe() failed."); + NOTIFICATION_ERR("Failed to subscribe signal"); g_object_unref(md.conn); return NOTIFICATION_ERROR_FROM_DBUS; /* LCOV_EXCL_STOP */ @@ -153,7 +153,8 @@ int notification_status_message_post(const char *message) conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err); if (conn == NULL) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("g_bus_get_sync() failed: %s", err->message); + NOTIFICATION_ERR("Failed to connect to the D-BUS Daemon[%s]", + err->message); ret = NOTIFICATION_ERROR_FROM_DBUS; goto end; /* LCOV_EXCL_STOP */ @@ -169,7 +170,7 @@ int notification_status_message_post(const char *message) param, &err) == FALSE) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("g_dbus_connection_emit_signal() failed: %s", + NOTIFICATION_ERR("Failed to emit signal[%s]", err->message); ret = NOTIFICATION_ERROR_FROM_DBUS; goto end; @@ -178,7 +179,7 @@ int notification_status_message_post(const char *message) if (g_dbus_connection_flush_sync(conn, NULL, &err) == FALSE) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("g_dbus_connection_flush_sync() failed: %s", + NOTIFICATION_ERR("Failed to flush connection sync[%s]", err->message); ret = NOTIFICATION_ERROR_FROM_DBUS; goto end; diff --git a/src/notification_viewer.c b/src/notification_viewer.c index 0f70b4e..b28fd8a 100644 --- a/src/notification_viewer.c +++ b/src/notification_viewer.c @@ -58,13 +58,13 @@ EXPORT_API int notification_launch_default_viewer(const char *default_viewer, in ret = app_control_create(&app_control); if (ret != APP_CONTROL_ERROR_NONE) { - NOTIFICATION_ERR("app_control_create failed [%x]", ret); + NOTIFICATION_ERR("Failed to create app_control[%x]", ret); goto out; } ret = app_control_set_app_id(app_control, default_viewer); if (ret != APP_CONTROL_ERROR_NONE) { - NOTIFICATION_ERR("app_control_set_app_id failed [%x]", ret); + NOTIFICATION_ERR("Failed to set app id to app_control[%x]", ret); goto out; } @@ -72,13 +72,13 @@ EXPORT_API int notification_launch_default_viewer(const char *default_viewer, in ret = app_control_add_extra_data(app_control, "NOTIFICATION_PRIVATE_ID", buf); if (ret != APP_CONTROL_ERROR_NONE) { - NOTIFICATION_ERR("app_control_set_extra_data failed [%x]", ret); + NOTIFICATION_ERR("Failed to add extra data to app_control[%x]", ret); goto out; } ret = app_control_send_launch_request(app_control, NULL, NULL); if (ret != APP_CONTROL_ERROR_NONE) { - NOTIFICATION_ERR("app_control_send_launch_request failed [%x]", ret); + NOTIFICATION_ERR("Failed to request app launch[%x]", ret); goto out; } -- 2.7.4