if (ret == APP_CONTROL_ERROR_NONE) {
*app_control = app_control_new;
} else {
+ /* LCOV_EXCL_START */
app_control_destroy(app_control_new);
NOTIFICATION_ERR("Failed to import app control from bundle[%d]", ret);
return NOTIFICATION_ERROR_IO_ERROR;
+ /* LCOV_EXCL_STOP */
}
} else {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to create app control[%d]", ret);
return NOTIFICATION_ERROR_IO_ERROR;
+ /* LCOV_EXCL_STOP */
}
} else {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to get execute option[%d]", ret);
return ret;
+ /* LCOV_EXCL_STOP */
}
return NOTIFICATION_ERROR_NONE;
if (event_type < NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1
|| event_type > NOTIFICATION_EVENT_TYPE_MAX) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Invalid event type");
err = NOTIFICATION_ERROR_INVALID_PARAMETER;
goto out;
+ /* LCOV_EXCL_STOP */
}
b = noti->b_event_handler[event_type];
if (b == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("No event handler");
err = NOTIFICATION_ERROR_NOT_EXIST_ID;
goto out;
+ /* LCOV_EXCL_STOP */
}
err = app_control_create(&app_control_new);
if (err != APP_CONTROL_ERROR_NONE || app_control_new == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failted to create app_control[%d]", err);
err = NOTIFICATION_ERROR_IO_ERROR;
goto out;
+ /* LCOV_EXCL_STOP */
}
err = app_control_import_from_bundle(app_control_new, b);
if (err == APP_CONTROL_ERROR_NONE) {
*event_handler = app_control_new;
} else {
+ /* LCOV_EXCL_START */
app_control_destroy(app_control_new);
app_control_new = NULL;
NOTIFICATION_ERR("Failed to import app control from bundle[%d]", err);
err = NOTIFICATION_ERROR_IO_ERROR;
goto out;
+ /* LCOV_EXCL_STOP */
}
out:
noti = (notification_h)calloc(1, sizeof(struct _notification));
if (noti == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to alloc memory");
set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY);
return NULL;
+ /* LCOV_EXCL_STOP */
}
noti->type = type;
err = package_info_create(pkg_id, &package_info);
if (err != PACKAGE_MANAGER_ERROR_NONE || package_info == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_WARN("Failed to create package_info err[%d] pkg_id[%s]",
err, pkg_id);
goto out;
+ /* LCOV_EXCL_STOP */
}
err = package_info_get_root_path(package_info, &app_root_path);
if (err != PACKAGE_MANAGER_ERROR_NONE || app_root_path == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_WARN("Failed to get root path err[%d] path[%p]",
err, app_root_path);
goto out;
+ /* LCOV_EXCL_STOP */
}
snprintf(locale_directory, PATH_MAX, "%s/res/locale", app_root_path);
new_noti = (notification_h) calloc(1, sizeof(struct _notification));
if (new_noti == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to alloc memory");
return NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
new_noti->type = noti->type;
noti = (notification_h)calloc(1, sizeof(struct _notification));
if (noti == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to alloc memory");
set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY);
return NULL;
+ /* LCOV_EXCL_STOP */
}
ret = notification_ipc_request_create_from_template(noti, template_name);
ret = access(dbfile, R_OK | W_OK);
if (ret != 0) {
+ /* LCOV_EXCL_START */
set_last_result(NOTIFICATION_ERROR_FROM_DB);
return NULL;
+ /* LCOV_EXCL_STOP */
}
ret = sqlite3_open_v2(dbfile, &db, SQLITE_OPEN_READWRITE, NULL);
info->cb(noti, event_type, info->userdata);
}
+/* LCOV_EXCL_START */
void notification_delete_event_handler_cb(int priv_id)
{
GList *delete_list;
if (__noti_event_cb_list == NULL)
notification_ipc_event_monitor_fini();
}
+/* LCOV_EXCL_STOP */
EXPORT_API int notification_add_deferred_task(
void (*deferred_task_cb)(void *data), void *user_data)
noti_cb_info_new = (notification_cb_info_s *)malloc(sizeof(notification_cb_info_s));
if (noti_cb_info_new == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to alloc memory");
return NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
noti_cb_info_new->cb_type = NOTIFICATION_CB_NORMAL;
noti_cb_info_new = (notification_cb_info_s *)malloc(sizeof(notification_cb_info_s));
if (noti_cb_info_new == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to alloc memory");
return NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
noti_cb_info_new->cb_type = NOTIFICATION_CB_DETAILED;
return file_list;
}
+/* LCOV_EXCL_START */
static void __remove_private_file(gpointer data, gpointer user_data)
{
GFile *src = NULL;
g_object_unref(src);
}
}
+/* LCOV_EXCL_STOP */
EXPORT_API int notification_post_for_uid(notification_h noti, uid_t uid)
{
noti = (notification_h)calloc(1, sizeof(struct _notification));
if (noti == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to alloc memory");
set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY);
return NULL;
+ /* LCOV_EXCL_STOP */
}
ret = notification_ipc_request_create_from_package_template(noti, app_id, template_name);
} else {
info = (notification_event_cb_info_s *)malloc(sizeof(notification_cb_info_s));
if (info == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to alloc memory");
return NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
info->priv_id = priv_id;
info->cb = cb;
err = app_control_export_as_bundle(event_handler, &app_control_bundle);
if (err != APP_CONTROL_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to export app_control to bundle [%d]", err);
ret = NOTIFICATION_ERROR_IO_ERROR;
goto out;
+ /* LCOV_EXCL_STOP */
}
err = bundle_encode(app_control_bundle, &b_raw, &len);
if (err != BUNDLE_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to encode bundle [%d]", err);
ret = NOTIFICATION_ERROR_IO_ERROR;
goto out;
+ /* LCOV_EXCL_STOP */
}
err = bundle_add_str(noti->args, key, (const char *)b_raw);
if (err != BUNDLE_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to add str to bundle [%d]", err);
ret = NOTIFICATION_ERROR_IO_ERROR;
goto out;
+ /* LCOV_EXCL_STOP */
}
out:
app_control_bundle = _create_bundle_from_bundle_raw((bundle_raw *)ret_str);
if (app_control_bundle == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to create bundle");
return NOTIFICATION_ERROR_IO_ERROR;
+ /* LCOV_EXCL_STOP */
}
err = app_control_create(&ret_app_control);
if (err != APP_CONTROL_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to create app control [%d]", err);
ret = NOTIFICATION_ERROR_IO_ERROR;
goto out;
+ /* LCOV_EXCL_STOP */
}
err = app_control_import_from_bundle(ret_app_control, app_control_bundle);
if (err != APP_CONTROL_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to import app control from bundle [%d]",
err);
app_control_destroy(ret_app_control);
ret = NOTIFICATION_ERROR_IO_ERROR;
goto out;
+ /* LCOV_EXCL_STOP */
}
*event_handler = ret_app_control;
notification_reset_event_handler_list();
}
+/* LCOV_EXCL_START */
static void __provider_vanished_cb(GDBusConnection *connection,
const gchar *name,
gpointer user_data)
{
NOTIFICATION_INFO("name [%s]", name);
}
+/* LCOV_EXCL_STOP */
static int _dbus_init()
{
_gdbus_conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
if (_gdbus_conn == NULL) {
+ /* LCOV_EXCL_START */
if (error != NULL) {
NOTIFICATION_ERR("Failed to get dbus[%s]",
error->message);
g_error_free(error);
}
return NOTIFICATION_ERROR_IO_ERROR;
+ /* LCOV_EXCL_STOP */
}
_bus_name = g_dbus_connection_get_unique_name(_gdbus_conn);
NOTIFICATION_INFO("Connected bus name[%s]", _bus_name);
op_list = (notification_op *)malloc(sizeof(notification_op) * num_op);
if (op_list == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to alloc memory");
return NULL;
+ /* LCOV_EXCL_STOP */
}
memset(op_list, 0x0, sizeof(notification_op) * num_op);
noti = notification_create(NOTIFICATION_TYPE_NOTI);
if (noti == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to create notification handle");
return;
+ /* LCOV_EXCL_STOP */
}
g_variant_get(parameters, "(vi)", &coupled_body, &event_type);
notification_free(noti);
}
+/* LCOV_EXCL_START */
static void _delete_event(GVariant *parameters)
{
int priv_id;
g_variant_get(parameters, "(i)", &priv_id);
notification_delete_event_handler_cb(priv_id);
}
+/* LCOV_EXCL_STOP */
static void _handle_noti_event_handler_notify(GDBusConnection *connection,
const gchar *sender_name,
NOTIFICATION_DBG("subscribe id[%d]", id);
if (id == 0) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_IO_ERROR;
NOTIFICATION_ERR("Failed to subscribe connection signal");
+ /* LCOV_EXCL_STOP */
} else {
event_monitor_id = id;
}
result_cb_item *cb_item = (result_cb_item *)user_data;
if (cb_item == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to get a callback item");
return;
+ /* LCOV_EXCL_START */
}
reply = g_dbus_connection_send_message_with_reply_finish(
result = _dbus_init();
if (result != NOTIFICATION_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to init dbus connection[%d]", result);
return result;
+ /* LCOV_EXCL_STOP */
}
result = notification_get_event_flag(noti, &event_flag);
result = _dbus_init();
if (result != NOTIFICATION_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to init dbus connection[%d]", result);
return result;
+ /* LCOV_EXCL_STOP */
}
body = g_variant_new("(i)", uid);
result = _dbus_init();
if (result != NOTIFICATION_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to init dbus connection[%d]", result);
return result;
+ /* LCOV_EXCL_STOP */
}
body = g_variant_new("(sii)", app_id, priv_id, uid);
result = _dbus_init();
if (result != NOTIFICATION_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to init dbus connection[%d]", result);
return result;
+ /* LCOV_EXCL_STOP */
}
if (!app_id)
result = _dbus_init();
if (result != NOTIFICATION_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to init dbus connection[%d]", result);
return result;
+ /* LCOV_EXCL_STOP */
}
body = g_variant_new("(ssi)", app_id, tag, uid);
result = _dbus_init();
if (result != NOTIFICATION_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to init dbus connection[%d]", result);
return result;
+ /* LCOV_EXCL_STOP */
}
body = g_variant_new("(iii)", type, count, uid);
while (g_variant_iter_loop(iter, "(v)", &iter_body)) {
noti = notification_create(NOTIFICATION_TYPE_NOTI);
if (!noti) {
+ /* LCOV_EXCL_START */
result = NOTIFICATION_ERROR_OUT_OF_MEMORY;
NOTIFICATION_ERR("failed to create a notification");
notification_free_list(*list);
break;
+ /* LCOV_EXCL_STOP */
}
g_variant_get(iter_body, "(v)", ¬i_body);
notification_ipc_make_noti_from_gvariant(noti, noti_body);
result = _dbus_init();
if (result != NOTIFICATION_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to init dbus connection[%d]", result);
return result;
+ /* LCOV_EXCL_STOP */
}
result = _send_sync_noti(g_variant_new("(i)", uid), &reply, "get_setting_array");
NOTIFICATION_DBG("get setting arr cnt: %d", setting_cnt);
result_setting_array = (struct notification_setting *)malloc(sizeof(struct notification_setting) * setting_cnt);
if (result_setting_array == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("malloc failed");
g_object_unref(reply);
g_variant_iter_free(iter);
return NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
setting_idx = 0;
result_setting = (struct notification_setting *)malloc(sizeof(struct notification_setting));
if (result_setting == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("malloc failed");
g_object_unref(reply);
g_variant_unref(body);
return NOTIFICATION_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
notification_ipc_make_setting_from_gvariant(result_setting, setting_body);
result = _dbus_init();
if (result != NOTIFICATION_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to init dbus connection[%d]", result);
return result;
+ /* LCOV_EXCL_STOP */
}
result = _send_sync_noti(g_variant_new("(i)", uid), &reply, "load_system_setting");
result_setting = (struct notification_system_setting *)calloc(1, sizeof(struct notification_system_setting));
if (result_setting == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("malloc failed");
result = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
notification_ipc_make_system_setting_from_gvariant(result_setting, setting_body);
while (g_variant_iter_loop(iter, "(v)", &iter_body)) {
dnd_allow_exception = (dnd_allow_exception_h)calloc(1, sizeof(struct notification_system_setting_dnd_allow_exception));
if (dnd_allow_exception == NULL) {
+ /* LCOV_EXCL_START */
result = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
notification_ipc_make_dnd_allow_exception_from_gvariant(dnd_allow_exception, iter_body);
result = _dbus_init();
if (result != NOTIFICATION_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to init dbus connection[%d]", result);
return result;
+ /* LCOV_EXCL_STOP */
}
body = g_variant_new("(ssiiiiii)",
result = _dbus_init();
if (result != NOTIFICATION_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to init dbus connection[%d]", result);
return result;
+ /* LCOV_EXCL_STOP */
}
body = g_variant_new("(iiiiiiiiii)",
result = _dbus_init();
if (result != NOTIFICATION_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to init dbus connection[%d]", result);
return result;
+ /* LCOV_EXCL_STOP */
}
body = notification_ipc_make_gvariant_from_noti(noti, false);
result = _dbus_init();
if (result != NOTIFICATION_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to init dbus connection[%d]", result);
return result;
+ /* LCOV_EXCL_STOP */
}
body = g_variant_new("(s)", template_name);
result = _dbus_init();
if (result != NOTIFICATION_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to init dbus connection[%d]", result);
return result;
+ /* LCOV_EXCL_STOP */
}
body = g_variant_new("(ss)", app_id, template_name);
ret = _dbus_init();
if (ret != NOTIFICATION_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to init dbus connection[%d]", ret);
return ret;
+ /* LCOV_EXCL_STOP */
}
body = g_variant_new("(si)", app_id, uid);
ret = _dbus_init();
if (ret != NOTIFICATION_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to init dbus connection[%d]", ret);
return ret;
+ /* LCOV_EXCL_STOP */
}
if (priv_id > 0) {
ret = _dbus_init();
if (ret != NOTIFICATION_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to init dbus connection[%d]", ret);
return ret;
+ /* LCOV_EXCL_STOP */
}
ret = _send_sync_noti(g_variant_new("(i)", priv_id), &reply, "check_event_receiver");
return ret;
}
+/* LCOV_EXCL_START */
void notification_ipc_reset_event_handler(int priv_id)
{
int ret;
if (reply)
g_object_unref(reply);
}
+/* LCOV_EXCL_STOP */
EXPORT_API GVariant *notification_ipc_make_gvariant_from_noti(notification_h noti, bool translate)
{
while (g_variant_iter_next(&iter, "{iv}", &key, &value)) {
hash_key = (int *)calloc(sizeof(int), 1);
if (hash_key == NULL) {
+ /* LCOV_EXCL_START */
g_hash_table_unref(*dict);
return FALSE;
+ /* LCOV_EXCL_STOP */
}
*hash_key = key;
g_hash_table_insert(*dict, (gpointer)hash_key, value);
return _ipc_monitor_deregister();
}
+/* LCOV_EXCL_START */
void notification_ipc_event_monitor_fini(void)
{
if (event_monitor_id == 0)
g_dbus_connection_signal_unsubscribe(_gdbus_conn, event_monitor_id);
event_monitor_id = 0;
}
+/* LCOV_EXCL_STOP */
"WHERE caller_app_id = %Q AND priv_id = %d",
noti->caller_app_id, noti->priv_id);
if (query == NULL) {
- NOTIFICATION_ERR("Failed to alloc query"); /* LCOV_EXCL_LINE */
+ /* LCOV_EXCL_START */
+ NOTIFICATION_ERR("Failed to alloc query");
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
if (ret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to sqlite3_prepare_v2 Failed [%d][%s]",
ret, sqlite3_errmsg(db));
ret = NOTIFICATION_ERROR_FROM_DB;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = sqlite3_step(stmt);
"WHERE caller_app_id = %Q AND priv_id = %d",
app_id, priv_id);
if (query == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to alloc query"); /* LCOV_EXCL_LINE */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
if (ret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("sqlite3_prepare_v2 Failed [%d][%s]", ret,
sqlite3_errmsg(db));
ret = NOTIFICATION_ERROR_FROM_DB;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = sqlite3_step(stmt);
query = sqlite3_mprintf("SELECT %s FROM %s",
NOTI_LIST_DB_ATTRIBUTES_SELECT, query_where);
if (query == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = sqlite3_prepare_v2(db, query, -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("sqlite3_prepare_v2 failed [%d][%s]", ret,
sqlite3_errmsg(db));
ret = NOTIFICATION_ERROR_FROM_DB;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = sqlite3_step(stmt);
query = sqlite3_mprintf("SELECT %s FROM %s",
NOTI_LIST_DB_ATTRIBUTES_SELECT, query_where);
if (query == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = sqlite3_prepare_v2(db, query, -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("sqlite3_prepare_v2 failed [%d][%s]", ret,
sqlite3_errmsg(db));
ret = NOTIFICATION_ERROR_FROM_DB;
goto err;
+ /* LCOV_EXCL_STOP */
}
while (sqlite3_step(stmt) == SQLITE_ROW) {
noti = (notification_h)calloc(1, sizeof(struct _notification));
if (noti == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
__notification_noti_populate_from_stmt(stmt, noti);
query = sqlite3_mprintf("INSERT INTO noti_list (%s) VALUES (%s)",
NOTI_LIST_DB_ATTRIBUTES_INSERT, NOTI_LIST_INSERT_VALUES);
if (query == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("sqlite3_mprintf Failed");
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = sqlite3_prepare_v2(db, query, -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("sqlite3_prepare_v2 Failed [%d][%s]", ret,
sqlite3_errmsg(db));
ret = NOTIFICATION_ERROR_FROM_DB;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = _create_insertion_query(db, noti, stmt, NULL);
query_where = sqlite3_mprintf("noti_list WHERE priv_id = %d", priv_id);
if (query_where == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = _get_notification(query_where, noti);
query_where = sqlite3_mprintf("noti_list WHERE caller_app_id = %Q "
"AND tag = %Q AND uid = %d", app_id, tag, uid);
if (query_where == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = _get_notification(query_where, noti);
query = sqlite3_mprintf("UPDATE noti_list SET %s WHERE priv_id = %d ",
NOTI_LIST_DB_ATTRIBUTES_UPDATE, noti->priv_id);
if (query == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = sqlite3_prepare_v2(db, query, -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("sqlite3_prepare_v2 Failed [%d][%s]", ret,
sqlite3_errmsg(db));
ret = NOTIFICATION_ERROR_FROM_DB;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = _create_update_query(db, noti, stmt);
query_where = sqlite3_mprintf("WHERE type = %d "
"AND uid = %d", type, uid);
if (query_where == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
}
} else {
app_id, type, uid);
if (query_where == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
}
query = sqlite3_mprintf("SELECT priv_id FROM noti_list %s ", query_where);
if (query == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
if (ret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to sqlite3_prepare_V2 [%d][%s]",
ret, sqlite3_errmsg(db));
ret = NOTIFICATION_ERROR_FROM_DB;
goto err;
+ /* LCOV_EXCL_STOP */
}
while (sqlite3_step(stmt) == SQLITE_ROW) {
if (tmp) {
*list_deleted_rowid = tmp;
} else {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to realloc memory [%s]", strerror_r(errno, err_buf, sizeof(err_buf)));
/*!
* \TODO
*list_deleted_rowid = NULL;
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
}
*((*list_deleted_rowid) + data_cnt) = sqlite3_column_int(stmt, 0);
if (i % NOTI_BURST_DELETE_UNIT == 0 && i != 0) {
query = sqlite3_mprintf("%s WHERE priv_id in (%s)", query_base, query_where);
if (query == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret_tmp = notification_db_exec(db, query, NULL);
query_where[0] = '\0';
snprintf(buf, sizeof(buf) - 1, "%s%d", (i % NOTI_BURST_DELETE_UNIT == 0) ? "" : ",", *((*list_deleted_rowid) + i));
query_where = sqlite3_mprintf("%s%s", query_where, buf);
if (query_where == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
}
if ((i <= NOTI_BURST_DELETE_UNIT) || ((i % NOTI_BURST_DELETE_UNIT) > 0)) {
query = sqlite3_mprintf("%s WHERE priv_id in (%s)", query_base, query_where);
if (query == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret_tmp = notification_db_exec(db, query, NULL);
/* Make main query */
query = sqlite3_mprintf("%s %s", query_base, query_where);
if (query == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = notification_db_exec(db, query, num_deleted);
"AND priv_id = %d AND uid = %d",
app_id, priv_id, uid);
if (query == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = notification_db_exec(db, query, num_changes);
if (uid != NOTIFICATION_GLOBAL_UID) {
query_uid = sqlite3_mprintf(" AND uid = %d ", uid);
if (query_uid == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
}
query = sqlite3_mprintf("noti_list WHERE 1 > 0 %s %s "
"ORDER BY rowid DESC, time DESC", query_where, query_uid);
if (query == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = _get_notification_list(query, list, count);
}
if (query_where == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
query = sqlite3_mprintf("noti_list %s ORDER BY rowid DESC, time DESC",
query_where);
if (query == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = _get_notification_list(query, list, count);
NOTIFICATION_CHECK_STR(noti->caller_app_id),
NOTIFICATION_CHECK_STR(noti->tag));
if (query == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
if (ret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to sqlite3_prepare_v2[%d][%s]",
ret, sqlite3_errmsg(db));
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = sqlite3_step(stmt);
"WHERE caller_app_id = %Q",
NOTIFICATION_CHECK_STR(noti->caller_app_id));
if (query == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
if (ret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to sqlite3_prepare_v2[%d][%s]",
ret, sqlite3_errmsg(db));
ret = NOTIFICATION_ERROR_FROM_DB;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = sqlite3_step(stmt);
NOTI_LIST_INSERT_VALUES,
template_name);
if (query == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = sqlite3_prepare_v2(db, query, -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to sqlite3_prepare_v2[%d][%s]",
ret, sqlite3_errmsg(db));
ret = NOTIFICATION_ERROR_FROM_DB;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = _create_insertion_query(db, noti, stmt, &idx);
query = sqlite3_mprintf("DELETE FROM noti_template WHERE pkg_id = %Q",
NOTIFICATION_CHECK_STR(pkg_id));
if (query == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto err;
+ /* LCOV_EXCL_STOP */
}
ret = notification_db_exec(db, query, NULL);
}
if (sql_ret != SQLITE_OK && sql_ret != SQLITE_ROW) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("sqlite3_step failed [%d][%s]", sql_ret,
sqlite3_errmsg(db));
err = false;
goto out;
+ /* LCOV_EXCL_STOP */
}
out:
ret = pkgmgrinfo_appinfo_get_appid(handle, &app_id);
if (ret != PACKAGE_MANAGER_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to get appid from pkgmgrinfo [%d]",
ret);
err = false;
goto out;
+ /* LCOV_EXCL_STOP */
}
ret = pkgmgrinfo_appinfo_get_pkgname(handle, &package_name);
if (ret != PACKAGE_MANAGER_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to get pkgname from pkgmgrinfo[%d]",
ret);
goto out;
+ /* LCOV_EXCL_STOP */
}
if (_is_package_in_setting_table(db, package_name, app_id, info->uid) == true) {
pkgmgr_ret = pkgmgrinfo_pkginfo_get_pkgname(package_info, &package_name);
if (pkgmgr_ret != PACKAGE_MANAGER_ERROR_NONE) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to get pkgname from pkgmgrinfo[%d]", pkgmgr_ret);
err = false;
goto out;
+ /* LCOV_EXCL_STOP */
}
pkgmgr_ret = pkgmgrinfo_appinfo_filter_create(&handle);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to create appinofo[%d]",
pkgmgr_ret);
err = false;
goto out;
+ /* LCOV_EXCL_STOP */
}
pkgmgr_ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_PACKAGE, package_name);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to add string to appinfo[%d]", pkgmgr_ret);
err = false;
goto out;
+ /* LCOV_EXCL_STOP */
}
pkgmgr_ret = pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(handle, _foreach_app_info_callback, info, info->uid);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to iterate appinfo[%d]", pkgmgr_ret);
err = false;
goto out;
+ /* LCOV_EXCL_STOP */
}
out:
pkgmgr_ret = pkgmgrinfo_pkginfo_filter_create(&handle);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to create pkginfo_filter[%d]", pkgmgr_ret);
err = NOTIFICATION_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
pkgmgr_ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_PRIVILEGE, NOTIFICATION_PRIVILEGE);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to add string to pkginfo_filter[%d]", pkgmgr_ret);
err = NOTIFICATION_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
pkgmgr_ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_ID, package_name);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to add string to pkginfo_filter[%d]", pkgmgr_ret);
err = NOTIFICATION_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
info.db = db;
info.uid = uid;
pkgmgr_ret = pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo(handle, _foreach_package_info_callback, &info, uid);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to iterate pkginfo[%d]", pkgmgr_ret);
err = NOTIFICATION_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
out:
pkgmgr_ret = pkgmgrinfo_pkginfo_filter_create(&filter);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to create pkginfo_filter[%d]", pkgmgr_ret);
err = NOTIFICATION_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
pkgmgr_ret = pkgmgrinfo_pkginfo_filter_add_string(filter, PMINFO_PKGINFO_PROP_PACKAGE_PRIVILEGE, NOTIFICATION_PRIVILEGE);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to add string to pkginfo_filter[%d]", pkgmgr_ret);
err = NOTIFICATION_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
info.db = db;
info.uid = uid;
pkgmgr_ret = pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo(filter, _foreach_package_info_callback, &info, uid);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to foreach pkginfo[%d]", pkgmgr_ret);
err = NOTIFICATION_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
out:
return 1;
}
+/* LCOV_EXCL_START */
void notification_call_dnd_changed_cb_for_uid(int do_not_disturb, uid_t uid)
{
GList *noti_dnd_cb_list = NULL;
dnd_data->callback(dnd_data->user_data, do_not_disturb);
}
}
+/* LCOV_EXCL_STOP */
EXPORT_API int notification_register_system_setting_dnd_changed_cb_for_uid(dnd_changed_cb callback, void *user_data, uid_t uid)
{
NOTIFICATION_SETTING_DB_ATTRIBUTES, NOTIFICATION_SETTING_DB_TABLE,
app_id, uid);
if (query == NULL) {
- NOTIFICATION_ERR("Failed to alloc query"); /* LCOV_EXCL_LINE */
+ /* LCOV_EXCL_START */
+ NOTIFICATION_ERR("Failed to alloc query");
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
sql_ret = sqlite3_get_table(db, query, &query_result, &row_count, &column_count, NULL);
if (sql_ret != SQLITE_OK && sql_ret != -1) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("sqlite3_get_table failed [%d][%s]", sql_ret,
- query); /* LCOV_EXCL_LINE */
+ query);
ret = NOTIFICATION_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
if (!row_count) {
- NOTIFICATION_DBG("No setting found for [%s]", app_id); /* LCOV_EXCL_LINE */
+ NOTIFICATION_DBG("No setting found for [%s]", app_id);
ret = NOTIFICATION_ERROR_NOT_EXIST_ID;
goto out;
}
row_count = 1;
if (!(result_setting_array = (struct notification_setting *)malloc(sizeof(struct notification_setting) * row_count))) {
- NOTIFICATION_ERR("Failed to alloc memory"); /* LCOV_EXCL_LINE */
+ /* LCOV_EXCL_START */
+ NOTIFICATION_ERR("Failed to alloc memory");
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
col_index = column_count;
"app_id ", NOTIFICATION_SETTING_DB_ATTRIBUTES,
NOTIFICATION_SETTING_DB_TABLE, uid, 0);
if (query == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to alloc query"); /* LCOV_EXCL_LINE */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
sql_ret = sqlite3_get_table(db, query, &query_result, &row_count, &column_count, NULL);
if (sql_ret != SQLITE_OK && sql_ret != -1) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to get db table [%d][%s]",
sql_ret, query); /* LCOV_EXCL_LINE */
ret = NOTIFICATION_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
if (!row_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))) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to alloc memory"); /* LCOV_EXCL_LINE */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
col_index = column_count;
NOTIFICATION_SYSTEM_SETTING_DB_ATTRIBUTES,
NOTIFICATION_SYSTEM_SETTING_DB_TABLE, uid);
if (query == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to alloc query"); /* LCOV_EXCL_LINE */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
sql_ret = sqlite3_get_table(db, query, &query_result, &row_count, &column_count, NULL);
if (sql_ret != SQLITE_OK && sql_ret != -1) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to get db table [%d][%s]", sql_ret, query); /* LCOV_EXCL_LINE */
ret = NOTIFICATION_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
NOTIFICATION_DBG("row_count [%d] column_count [%d]", row_count, column_count);
result_system_setting = (struct notification_system_setting *)malloc(sizeof(struct notification_system_setting));
if (result_system_setting == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to alloc memory"); /* LCOV_EXCL_LINE */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
/* no system setting record. allow everyting */
pop_up_notification, lock_screen_content_level, app_id,
package_name, uid);
if (query == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
ret = notification_db_exec(db, query, NULL);
dnd_start_min, dnd_end_hour, dnd_end_min,
lock_screen_content_level);
if (query == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
ret = notification_db_exec(db, query, &num_changes);
NOTIFICATION_SYSTEM_SETTING_DB_TABLE,
do_not_disturb, uid);
if (query == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to alloc query"); /* LCOV_EXCL_LINE */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
ret = notification_db_exec(db, query, NULL);
"WHERE dnd_schedule_enabled = 1",
NOTIFICATION_SYSTEM_SETTING_DB_TABLE);
if (query == NULL) {
+ /* LCOV_EXCL_START */
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
ret = sqlite3_get_table(db, query, &query_result, &row_count, &column_count, NULL);
if (ret != SQLITE_OK && ret != -1) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to get DB table [%d][%s]", ret, query); /* LCOV_EXCL_LINE */
ret = NOTIFICATION_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
if (row_count == 0) {
}
if (!(result_uids = (uid_t *)malloc(sizeof(int) * row_count))) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to alloc memory");
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
column_index = column_count;
NOTIFICATION_SETTING_DB_TABLE, app_id,
uid, tzplatform_getuid(TZ_SYS_GLOBALAPP_USER));
if (query_setting == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to alloc memory");
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
query_system_setting = sqlite3_mprintf("SELECT do_not_disturb FROM %s "
"WHERE uid = %d",
NOTIFICATION_SYSTEM_SETTING_DB_TABLE, uid);
if (query_system_setting == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to alloc memory");
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
sql_ret = sqlite3_get_table(db, query_setting, &query_setting_result, &row_count, &col_count, NULL);
if (sql_ret != SQLITE_OK && sql_ret != -1) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to get DB table [%d][%s]", sql_ret, query_setting);
ret = NOTIFICATION_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
if (row_count == 0) {
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) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to get DB table [%d][%s]", sql_ret, query_setting);
ret = NOTIFICATION_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
if (row_count == 0) {
query = sqlite3_mprintf("SELECT type, value FROM %s WHERE uid = %d",
NOTIFICATION_DND_ALLOW_EXCEPTION, uid);
if (query == NULL) {
- NOTIFICATION_ERR("Failed to alloc memory"); /* LCOV_EXCL_LINE */
+ /* LCOV_EXCL_START */
+ NOTIFICATION_ERR("Failed to alloc memory");
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
sql_ret = sqlite3_get_table(db, query, &query_result, &row_count, &column_count, NULL);
if (sql_ret != SQLITE_OK && sql_ret != -1) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to get DB table [%d][%s]", sql_ret, query); /* LCOV_EXCL_LINE */
ret = NOTIFICATION_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
if (!row_count) {
NOTIFICATION_DND_ALLOW_EXCEPTION,
uid, type, value);
if (query == NULL) {
- NOTIFICATION_ERR("Failed to alloc memory"); /* LCOV_EXCL_LINE */
+ /* LCOV_EXCL_START */
+ NOTIFICATION_ERR("Failed to alloc memory");
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
ret = notification_db_exec(db, query, &num_changes);
query = sqlite3_mprintf("SELECT do_not_disturb FROM %s WHERE uid = %d",
NOTIFICATION_SYSTEM_SETTING_DB_TABLE, uid);
if (query == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to alloc memory");
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
ret = sqlite3_get_table(db, query, &query_result, &row_count, &col_count, NULL);
if (ret != SQLITE_OK && ret != -1) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to get DB table [%d][%s]", ret, query);
ret = NOTIFICATION_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
col_index = col_count;
if (row_count == 0) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("No system setting found");
ret = NOTIFICATION_ERROR_INVALID_PARAMETER;
+ /* LCOV_EXCL_STOP */
} else {
if (_get_table_field_data_int(query_result, (int *)do_not_disturb, col_index++) == false)
ret = NOTIFICATION_ERROR_FROM_DB;
if (access(dir, R_OK) != 0) {
noti_dir = g_file_new_for_path(dir);
if (g_file_make_directory(noti_dir, NULL, &g_err) == false) {
+ /* LCOV_EXCL_START */
if (g_err) {
NOTIFICATION_ERR("Failed to make sharing dir[%s]",
g_err->message);
}
g_object_unref(noti_dir);
return false;
+ /* LCOV_EXCL_STOP */
}
g_object_unref(noti_dir);
}
}
/* Check path that include res directory */
+/* LCOV_EXCL_START */
static bool __is_private_file(const char *smack_label, const char *pkg_id)
{
const char *smack_index;
return ret;
}
+/* LCOV_EXCL_STOP */
static bool __is_RO_file(const char *smack_label)
{
dst = g_file_new_for_path(dst_path);
if (dst == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("dst path is wrong [%s]", dst_path);
ret = NOTIFICATION_ERROR_IO_ERROR;
goto out;
+ /* LCOV_EXCL_STOP */
}
if (g_file_query_exists(dst, NULL) == true) {
src = g_file_new_for_path(src_path);
if (src == NULL) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("src path is wrong [%s]", src_path);
ret = NOTIFICATION_ERROR_IO_ERROR;
goto out;
+ /* LCOV_EXCL_STOP */
}
if (!g_file_copy(src, dst, G_FILE_COPY_NOFOLLOW_SYMLINKS,
+ /* LCOV_EXCL_START */
NULL, NULL, NULL, &g_err)) {
if (g_err) {
NOTIFICATION_ERR(
}
ret = NOTIFICATION_ERROR_IO_ERROR;
goto out;
+ /* LCOV_EXCL_STOP */
}
ut.modtime = time(NULL);
}
}
+/* LCOV_EXCL_START */
static void __free_req_info(gpointer data)
{
sharing_req_data_s * info = (sharing_req_data_s *)data;
free(info);
}
+/* LCOV_EXCL_STOP */
static char **__convert_list_to_array(GList *list, int *length)
{
return strcmp(new_file, file);
}
+/* LCOV_EXCL_START */
static gint __comp_file_info(gconstpointer a, gconstpointer b)
{
sharing_file_info_s *file = (sharing_file_info_s *)a;
return strcmp(new_file->dst_path, file->dst_path);
}
+/* LCOV_EXCL_STOP */
+/* LCOV_EXCL_START */
static gint __comp_dst_path(gconstpointer a, gconstpointer b)
{
sharing_file_info_s *info = (sharing_file_info_s *)a;
return strcmp(info->dst_path, path);
}
+/* LCOV_EXCL_STOP */
static sharing_file_info_s * __dup_file_info(sharing_file_info_s *src)
{
ret = security_manager_private_sharing_req_set_owner_appid(handle,
req_data->app_id);
if (ret != SECURITY_MANAGER_SUCCESS) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to set owner appid[%s][%d]",
req_data->app_id, ret);
ret = NOTIFICATION_ERROR_IO_ERROR;
goto out;
+ /* LCOV_EXCL_STOP */
}
ret = security_manager_private_sharing_req_add_paths(handle,
(const char **)path_array, len);
if (ret != SECURITY_MANAGER_SUCCESS) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to add paths [%d]", ret);
ret = NOTIFICATION_ERROR_IO_ERROR;
goto out;
+ /* LCOV_EXCL_STOP */
}
if (is_overlapping == true) {
ret = security_manager_private_sharing_req_set_target_appid(
handle, (const char *)iter->data);
if (ret != SECURITY_MANAGER_SUCCESS) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to set target appid [%s]",
(const char *)iter->data);
ret = NOTIFICATION_ERROR_IO_ERROR;
goto out;
+ /* LCOV_EXCL_STOP */
}
ret = security_manager_private_sharing_drop(handle);
if (ret != SECURITY_MANAGER_SUCCESS) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to drop [%d]", ret);
ret = NOTIFICATION_ERROR_IO_ERROR;
goto out;
+ /* LCOV_EXCL_STOP */
}
}
}
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]",
- (const char *)iter->data);
- ret = NOTIFICATION_ERROR_IO_ERROR;
- goto out;
+ /* LCOV_EXCL_START */
+ NOTIFICATION_ERR("Failed to set target appid [%s]",
+ (const char *)iter->data);
+ ret = NOTIFICATION_ERROR_IO_ERROR;
+ goto out;
+ /* LCOV_EXCL_STOP */
}
ret = security_manager_private_sharing_apply(handle);
if (ret != SECURITY_MANAGER_SUCCESS) {
+ /* LCOV_EXCL_START */
NOTIFICATION_ERR("Failed to apply PS [%d]", ret);
ret = NOTIFICATION_ERROR_IO_ERROR;
goto out;
+ /* LCOV_EXCL_STOP */
}
}
return -1;
}
+ /* LCOV_EXCL_START */
dict = iniparser_load(path);
if (!dict) {
NOTIFICATION_ERR("can't load file");
iniparser_freedict(dict);
return 0;
+ /* LCOV_EXCL_STOP */
}
+/* LCOV_EXCL_START */
EXPORT_API int notification_launch_default_viewer(const char *default_viewer, int priv_id, uid_t uid)
{
int ret;
return ret;
}
+/* LCOV_EXCL_STOP */