ret = db_util_open(dbfile, &db, 0);
if (ret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
DbgPrint("Failed to open a %s\n", dbfile);
return NULL;
+ /* LCOV_EXCL_STOP */
}
return db;
ret = db_util_close(*db);
if (ret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
DbgPrint("DB close error(%d)", ret);
return SHORTCUT_ERROR_IO_ERROR;
+ /* LCOV_EXCL_STOP */
}
*db = NULL;
return SHORTCUT_ERROR_NONE;
}
-
+/* LCOV_EXCL_START */
/*!
* \note this function will returns allocated(heap) string
*/
sqlite3_finalize(stmt);
return ret;
}
+/* LCOV_EXCL_STOP */
static inline char *_cur_locale(void)
{
handle = _open_db();
if (!handle) {
+ /* LCOV_EXCL_START */
ErrPrint("Failed to open a DB\n");
return SHORTCUT_ERROR_IO_ERROR;
+ /* LCOV_EXCL_STOP */
}
language = _cur_locale();
if (!language) {
+ /* LCOV_EXCL_START */
ErrPrint("Locale is not valid\n");
_close_db(&handle);
return SHORTCUT_ERROR_FAULT;
+ /* LCOV_EXCL_STOP */
}
if (package_name) {
query = "SELECT id, appid, name, extra_key, extra_data, icon FROM shortcut_service WHERE appid = ?";
ret = sqlite3_prepare_v2(handle, query, -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
ErrPrint("prepare: %s\n", sqlite3_errmsg(handle));
free(language);
_close_db(&handle);
return SHORTCUT_ERROR_IO_ERROR;
+ /* LCOV_EXCL_STOP */
}
ret = sqlite3_bind_text(stmt, 1, package_name, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
ErrPrint("bind text: %s\n", sqlite3_errmsg(handle));
sqlite3_finalize(stmt);
free(language);
_close_db(&handle);
return SHORTCUT_ERROR_IO_ERROR;
+ /* LCOV_EXCL_STOP */
}
} else {
query = "SELECT id, appid, name, extra_key, extra_data, icon FROM shortcut_service";
ret = sqlite3_prepare_v2(handle, query, -1, &stmt, NULL);
if (ret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
ErrPrint("prepare: %s\n", sqlite3_errmsg(handle));
free(language);
_close_db(&handle);
return SHORTCUT_ERROR_IO_ERROR;
+ /* LCOV_EXCL_STOP */
}
}
cnt = 0;
*shortcut_list = NULL;
while (SQLITE_ROW == sqlite3_step(stmt)) {
+ /* LCOV_EXCL_START */
id = sqlite3_column_int(stmt, 0);
package_name = (const char *)sqlite3_column_text(stmt, 1);
free(i18n_icon);
i18n_icon = NULL;
+ /* LCOV_EXCL_STOP */
}
sqlite3_reset(stmt);
return (GQuark) quark_volatile;
}
+/* LCOV_EXCL_START */
static void _add_shortcut_notify(GVariant *parameters)
{
const char *appid;
DbgPrint("_add_shortcut_notify sender_pid: %d ", sender_pid);
_callback_info.request_cb(appid, name, type, content, icon, sender_pid, -1.0f, allow_duplicate, _callback_info.data);
}
+/* LCOV_EXCL_STOP */
+/* LCOV_EXCL_START */
static void _add_shortcut_widget_notify(GVariant *parameters)
{
const char *appid;
g_variant_get(parameters, "(i&s&si&s&sdi)", &sender_pid, &appid, &name, &type, &content, &icon, &period, &allow_duplicate);
_callback_info.request_cb(appid, name, type, content, icon, sender_pid, period, allow_duplicate, _callback_info.data);
}
+/* LCOV_EXCL_STOP */
+/* LCOV_EXCL_START */
static void _handle_shortcut_notify(GDBusConnection *connection,
const gchar *sender_name,
const gchar *object_path,
else if (g_strcmp0(signal_name, "add_shortcut_widget_notify") == 0)
_add_shortcut_widget_notify(parameters);
}
+/* LCOV_EXCL_STOP */
static int _dbus_init(void)
{
_gdbus_conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
if (_gdbus_conn == NULL) {
+ /* LCOV_EXCL_START */
if (error != NULL) {
+
ErrPrint("Failed to get dbus [%s]", error->message);
g_error_free(error);
+
}
return SHORTCUT_ERROR_IO_ERROR;
+ /* LCOV_EXCL_STOP */
}
shortcut_error_quark();
}
DbgPrint("subscribe id : %d", id);
if (id == 0) {
+ /* LCOV_EXCL_START */
ret = SHORTCUT_ERROR_IO_ERROR;
ErrPrint("Failed to _register_noti_dbus_interface");
+ /* LCOV_EXCL_STOP */
} else {
monitor_id = id;
}
ret = aul_app_get_pkgname_bypid(pid, pkgname, sizeof(pkgname));
if (ret != 0) {
+ /* LCOV_EXCL_START */
snprintf(buf, sizeof(buf), "/proc/%d/cmdline", pid);
fd = open(buf, O_RDONLY);
return NULL;
pkgname[ret] = '\0';
+ /* LCOV_EXCL_STOP */
/*!
* \NOTE
* "ret" is not able to be larger than "sizeof(pkgname) - 1",
dup_pkgname = strdup(pkgname);
if (!dup_pkgname)
- ErrPrint("Heap: %d\n", errno);
+ ErrPrint("Heap: %d\n", errno); /* LCOV_EXCL_LINE */
return dup_pkgname;
}
PROVIDER_SHORTCUT_INTERFACE_NAME,
cmd);
if (!msg) {
+ /* LCOV_EXCL_START */
ErrPrint("Can't allocate new method call");
if (body)
g_variant_unref(body);
return SHORTCUT_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
if (body != NULL)
g_object_unref(msg);
if (!*reply) {
+ /* LCOV_EXCL_START */
ret = SHORTCUT_ERROR_COMM;
if (err != NULL) {
ErrPrint("No reply. cmd = %s, error = %s", cmd, err->message);
g_error_free(err);
}
return ret;
+ /* LCOV_EXCL_STOP */
}
if (g_dbus_message_to_gerror(*reply, &err)) {
+ /* LCOV_EXCL_START */
if (err->code == G_DBUS_ERROR_ACCESS_DENIED)
ret = SHORTCUT_ERROR_PERMISSION_DENIED;
else
ErrPrint("_send_sync_shortcut error %s err code: %d", err->message, ret);
g_error_free(err);
return ret;
+ /* LCOV_EXCL_STOP */
}
DbgPrint("_send_sync_shortcut done !!");
return SHORTCUT_ERROR_NONE;
struct result_cb_item *cb_item = (struct result_cb_item *)user_data;
if (cb_item == NULL) {
+ /* LCOV_EXCL_START */
ErrPrint("Failed to get a callback item");
return;
+ /* LCOV_EXCL_STOP */
}
reply = g_dbus_connection_send_message_with_reply_finish(
&err);
if (!reply) {
+ /* LCOV_EXCL_START */
if (err != NULL) {
ErrPrint("No reply. error = %s", err->message);
g_error_free(err);
}
result = SHORTCUT_ERROR_COMM;
+ /* LCOV_EXCL_STOP */
} else if (g_dbus_message_to_gerror(reply, &err)) {
+ /* LCOV_EXCL_START */
if (err->code == G_DBUS_ERROR_ACCESS_DENIED)
result = SHORTCUT_ERROR_PERMISSION_DENIED;
else
ErrPrint("_send_message_with_reply_sync_cb error %s err code: %d", err->message, result);
g_error_free(err);
+ /* LCOV_EXCL_STOP */
}
if (cb_item->result_internal_cb)
- result = cb_item->result_internal_cb(result, getpid(), cb_item->data);
+ result = cb_item->result_internal_cb(result, getpid(), cb_item->data); /* LCOV_EXCL_LINE */
else if (cb_item->result_cb)
result = cb_item->result_cb(result, cb_item->data);
PROVIDER_SHORTCUT_INTERFACE_NAME,
cmd);
if (!msg) {
+ /* LCOV_EXCL_START */
ErrPrint("Can't allocate new method call");
return SHORTCUT_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
if (body != NULL)
return SHORTCUT_ERROR_NONE;
}
+/* LCOV_EXCL_START */
static void _on_name_appeared(GDBusConnection *connection,
const gchar *name,
const gchar *name_owner,
DbgPrint("name appeared : %s", name);
_send_service_register();
}
+/* LCOV_EXCL_STOP */
+/* LCOV_EXCL_START */
static void _on_name_vanished(GDBusConnection *connection,
const gchar *name,
gpointer user_data)
{
DbgPrint("name vanished : %s", name);
}
+/* LCOV_EXCL_STOP */
static int _check_privilege(void)
{
int ret = _dbus_init();
if (ret != SHORTCUT_ERROR_NONE) {
+ /* LCOV_EXCL_START */
ErrPrint("Can't init dbus %d", ret);
return ret;
+ /* LCOV_EXCL_STOP */
}
ret = _dbus_signal_init();
if (ret != SHORTCUT_ERROR_NONE) {
+ /* LCOV_EXCL_START */
ErrPrint("Can't init dbus_signal %d", ret);
return ret;
+ /* LCOV_EXCL_STOP */
}
ret = _send_service_register();
if (ret != SHORTCUT_ERROR_NONE) {
+ /* LCOV_EXCL_START */
ErrPrint("Can't init ipc_monitor_register %d", ret);
return ret;
+ /* LCOV_EXCL_STOP */
}
if (request_cb == NULL)
- return SHORTCUT_ERROR_INVALID_PARAMETER;
+ return SHORTCUT_ERROR_INVALID_PARAMETER; /* LCOV_EXCL_LINE */
if (provider_monitor_id == 0) {
provider_monitor_id = g_bus_watch_name_on_connection(
NULL);
if (provider_monitor_id == 0) {
+ /* LCOV_EXCL_START */
ErrPrint("watch on name fail");
return SHORTCUT_ERROR_IO_ERROR;
+ /* LCOV_EXCL_STOP */
}
}
GVariant *body;
if (ADD_TO_HOME_IS_DYNAMICBOX(type)) {
+ /* LCOV_EXCL_START */
ErrPrint("Invalid type used for adding a shortcut\n");
return SHORTCUT_ERROR_INVALID_PARAMETER;
+ /* LCOV_EXCL_STOP */
}
ret = _dbus_init();
if (ret != SHORTCUT_ERROR_NONE) {
+ /* LCOV_EXCL_START */
ErrPrint("Can't init dbus %d", ret);
return ret;
+ /* LCOV_EXCL_STOP */
}
ret = _check_privilege();
appid = _shortcut_get_pkgname_by_pid();
item = malloc(sizeof(struct result_cb_item));
if (!item) {
+ /* LCOV_EXCL_START */
if (appid)
free(appid);
ErrPrint("Heap: %d\n", errno);
return SHORTCUT_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
item->result_cb = result_cb;
ret = _send_async_shortcut(body, item, "add_shortcut");
if (ret != SHORTCUT_ERROR_NONE) {
+ /* LCOV_EXCL_START */
free(item);
item = NULL;
+ /* LCOV_EXCL_STOP */
}
if (appid)
}
if (!SHORTCUT_IS_WIDGET_SIZE(size)) {
+ /* LCOV_EXCL_START */
ErrPrint("Invalid type used for adding a widget\n");
return SHORTCUT_ERROR_INVALID_PARAMETER;
+ /* LCOV_EXCL_STOP */
}
ret = _dbus_init();
if (ret != SHORTCUT_ERROR_NONE) {
+ /* LCOV_EXCL_START */
ErrPrint("Can't init dbus %d", ret);
return ret;
+ /* LCOV_EXCL_STOP */
}
ret = _check_privilege();
appid = _shortcut_get_pkgname_by_pid();
item = malloc(sizeof(struct result_cb_item));
if (!item) {
+ /* LCOV_EXCL_START */
if (appid)
free(appid);
ErrPrint("Heap: %d\n", errno);
return SHORTCUT_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
item->result_cb = result_cb;
ret = _send_async_shortcut(body, item, "add_shortcut_widget");
if (ret != SHORTCUT_ERROR_NONE) {
+ /* LCOV_EXCL_START */
free(item);
item = NULL;
+ /* LCOV_EXCL_STOP */
}
if (appid)
return ret;
}
+/* LCOV_EXCL_START */
EAPI int add_to_home_shortcut(const char *appid, const char *name, int type, const char *content,
const char *icon, int allow_duplicate, result_internal_cb_t result_cb, void *data)
{
/*Deprecated API */
return SHORTCUT_ERROR_NONE;
}
+/* LCOV_EXCL_STOP */
+/* LCOV_EXCL_START */
EAPI int add_to_home_dynamicbox(const char *appid, const char *name, int type, const char *content, const char *icon, double period, int allow_duplicate, result_internal_cb_t result_cb, void *data)
{
/*Deprecated API */
return SHORTCUT_ERROR_NONE;
}
-
+/* LCOV_EXCL_STOP */
EAPI int shortcut_get_list(const char *package_name, shortcut_list_cb list_cb, void *data)
{
result = _dbus_init();
if (result != SHORTCUT_ERROR_NONE) {
+ /* LCOV_EXCL_START */
ErrPrint("Can't init dbus %d", result);
return result;
+ /* LCOV_EXCL_STOP */
}
b = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
}
g_variant_iter_free(iter);
} else {
- ret = result;
+ ret = result; /* LCOV_EXCL_LINE */
}
if (reply)