From: Hwankyu Jhun Date: Tue, 26 Sep 2017 12:29:46 +0000 (+0900) Subject: Exclude some lines from lcov X-Git-Tag: submit/tizen/20170928.055049~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bd3b9fb182d83e52db79acb3a019e826c21d2946;p=platform%2Fcore%2Fapi%2Fapp-manager.git Exclude some lines from lcov Change-Id: I33b04914e1669b6dece2119a33628895ab4a26f0 Signed-off-by: Hwankyu Jhun --- diff --git a/src/app_context.c b/src/app_context.c index f61128b..82f859c 100644 --- a/src/app_context.c +++ b/src/app_context.c @@ -110,7 +110,7 @@ static int app_context_foreach_app_context_cb(const aul_app_info *aul_app_contex bool is_sub_app = false; if (foreach_context == NULL) { - app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); + app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ return 0; } @@ -147,7 +147,7 @@ int app_context_foreach_app_context(app_manager_app_context_cb callback, void *u return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); if (aul_app_get_running_app_info(app_context_foreach_app_context_cb, &foreach_context) != AUL_R_OK) - return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ return APP_MANAGER_ERROR_NONE; } @@ -160,7 +160,7 @@ static int app_context_foreach_running_app_context_cb(const aul_app_info *aul_ap bool is_sub_app = false; if (foreach_context == NULL) { - app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); + app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ return 0; } @@ -199,7 +199,7 @@ int app_context_foreach_running_app_context(app_manager_app_context_cb callback, ret = aul_app_get_all_running_app_info(app_context_foreach_running_app_context_cb, &foreach_context); if (ret != AUL_R_OK) - return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ return APP_MANAGER_ERROR_NONE; } @@ -287,32 +287,36 @@ static int app_context_create(const char *app_id, pid_t pid, const char *pkg_id, app_context_h app_context_created; if (app_id == NULL || pid <= 0 || pkg_id == NULL || app_context == NULL) - return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ app_context_created = calloc(1, sizeof(struct app_context_s)); if (app_context_created == NULL) - return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ app_context_created->app_id = strdup(app_id); if (app_context_created->app_id == NULL) { free(app_context_created); - return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ } app_context_created->pkg_id = strdup(pkg_id); if (app_context_created->pkg_id == NULL) { + /* LCOV_EXCL_START */ free(app_context_created->app_id); free(app_context_created); return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + /* LCOV_EXCL_STOP */ } if (instance_id) { app_context_created->instance_id = strdup(instance_id); if (app_context_created->instance_id == NULL) { + /* LCOV_EXCL_START */ free(app_context_created->pkg_id); free(app_context_created->app_id); free(app_context_created); return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + /* LCOV_EXCL_STOP */ } } @@ -355,7 +359,7 @@ API int app_context_get_app_id(app_context_h app_context, char **app_id) app_id_dup = strdup(app_context->app_id); if (app_id_dup == NULL) - return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ *app_id = app_id_dup; @@ -381,7 +385,7 @@ API int app_context_get_package_id(app_context_h app_context, char **pkg_id) pkg_id_dup = strdup(app_context->pkg_id); if (pkg_id_dup == NULL) - return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ *pkg_id = pkg_id_dup; @@ -455,7 +459,7 @@ API int app_context_clone(app_context_h *clone, app_context_h app_context) app_context->instance_id, clone); if (retval != APP_MANAGER_ERROR_NONE) - return app_manager_error(retval, __FUNCTION__, NULL); + return app_manager_error(retval, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ return APP_MANAGER_ERROR_NONE; } @@ -489,8 +493,10 @@ static bool app_context_load_all_app_context_cb_locked(app_context_h app_context if (event_cb_context != NULL && event_cb_context->pid_table != NULL) { g_hash_table_insert(event_cb_context->pid_table, GINT_TO_POINTER(&(app_context_cloned->pid)), app_context_cloned); } else { + /* LCOV_EXCL_START */ app_context_destroy(app_context_cloned); app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, "invalid callback context"); + /* LCOV_EXCL_STOP */ } } @@ -514,11 +520,13 @@ static int app_context_get_pkgid_by_appid(const char *app_id, char **pkg_id) return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); if (pkgmgrinfo_appinfo_get_usr_appinfo(app_id, getuid(), &appinfo) < 0) - return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, "fail to get appinfo"); + return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, "fail to get appinfo"); /* LCOV_EXCL_LINE */ if (pkgmgrinfo_appinfo_get_pkgid(appinfo, &pkg_id_dup) < 0) { + /* LCOV_EXCL_START */ pkgmgrinfo_appinfo_destroy_appinfo(appinfo); return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, "fail to get pkgid"); + /* LCOV_EXCL_STOP */ } *pkg_id = strdup(pkg_id_dup); @@ -536,7 +544,7 @@ static int app_context_launched_event_cb(pid_t pid, const char *app_id, void *da return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); if (app_context_get_pkgid_by_appid(app_id, &pkg_id) < 0) - return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, "no such pkg_id"); + return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, "no such pkg_id"); /* LCOV_EXCL_LINE */ app_context_lock_event_cb_context(); @@ -545,8 +553,10 @@ static int app_context_launched_event_cb(pid_t pid, const char *app_id, void *da g_hash_table_insert(event_cb_context->pid_table, GINT_TO_POINTER(&(app_context->pid)), app_context); event_cb_context->callback(app_context, APP_CONTEXT_EVENT_LAUNCHED, event_cb_context->user_data); } else { + /* LCOV_EXCL_START */ app_context_destroy(app_context); app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, "invalid callback context"); + /* LCOV_EXCL_STOP */ } } @@ -571,7 +581,7 @@ static int app_context_terminated_event_cb(pid_t pid, void *data) g_hash_table_remove(event_cb_context->pid_table, GINT_TO_POINTER(&(app_context->pid))); } } else { - app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, "invalid callback context"); + app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, "invalid callback context"); /* LCOV_EXCL_LINE */ } app_context_unlock_event_cb_context(); @@ -590,16 +600,20 @@ int app_context_set_event_cb(app_manager_app_context_event_cb callback, void *us event_cb_context = calloc(1, sizeof(event_cb_context_s)); if (event_cb_context == NULL) { + /* LCOV_EXCL_START */ app_context_unlock_event_cb_context(); return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + /* LCOV_EXCL_STOP */ } event_cb_context->pid_table = g_hash_table_new_full(g_int_hash, g_int_equal, NULL, app_context_pid_table_entry_destroyed_cb); if (event_cb_context->pid_table == NULL) { + /* LCOV_EXCL_START */ free(event_cb_context); event_cb_context = NULL; app_context_unlock_event_cb_context(); return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, "failed to initialize pid-table"); + /* LCOV_EXCL_STOP */ } app_context_foreach_app_context(app_context_load_all_app_context_cb_locked, NULL); @@ -655,15 +669,19 @@ static struct status_listen_info *__create_status_listen_info(app_manager_app_co info = calloc(1, sizeof(struct status_listen_info)); if (info == NULL) { + /* LCOV_EXCL_START */ LOGE("Out of memory"); return NULL; + /* LCOV_EXCL_STOP */ } info->appid = strdup(appid); if (info->appid == NULL) { + /* LCOV_EXCL_START */ LOGE("Out of memory"); free(info); return NULL; + /* LCOV_EXCL_STOP */ } info->callback = callback; @@ -730,11 +748,13 @@ int app_context_set_status_cb(app_manager_app_context_status_cb callback, const ret = aul_listen_app_status(appid, app_context_status_cb, info, &info->handle); if (ret != AUL_R_OK) { + /* LCOV_EXCL_START */ __destroy_status_listen_info(info); if (ret == AUL_R_EINVAL) return APP_MANAGER_ERROR_INVALID_PARAMETER; return APP_MANAGER_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } status_listen_list = g_list_append(status_listen_list, info); @@ -760,7 +780,7 @@ int app_context_get_app_context_by_instance_id(const char *app_id, const char *i aul_app_get_running_app_instance_info(app_context_retrieve_app_context, &retrieval_context); if (retrieval_context.matched == false) - return app_manager_error(APP_MANAGER_ERROR_NO_SUCH_APP, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_NO_SUCH_APP, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ ret = app_context_create(retrieval_context.app_id, retrieval_context.pid, @@ -781,7 +801,7 @@ int app_context_get_instance_id(app_context_h app_context, char **instance_id) *instance_id = strdup(app_context->instance_id); if (*instance_id == NULL) - return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ return APP_MANAGER_ERROR_NONE; } @@ -913,18 +933,22 @@ int app_context_foreach_visible_app_context(app_manager_app_context_cb callback, app_context_table = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)app_context_destroy); if (app_context_table == NULL) - return APP_MANAGER_ERROR_OUT_OF_MEMORY; + return APP_MANAGER_ERROR_OUT_OF_MEMORY; /* LCOV_EXCL_LINE */ ret = aul_app_get_all_running_app_info(__foreach_app_context_cb, app_context_table); if (ret != AUL_R_OK) { + /* LCOV_EXCL_START */ g_hash_table_destroy(app_context_table); return APP_MANAGER_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } ret = aul_window_stack_get(&handle); if (ret < 0) { + /* LCOV_EXCL_START */ g_hash_table_destroy(app_context_table); return APP_MANAGER_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } ret = aul_window_stack_foreach(handle, __foreach_window_info_cb, &pid_list); diff --git a/src/app_info.c b/src/app_info.c index 9998830..e3da11b 100644 --- a/src/app_info.c +++ b/src/app_info.c @@ -130,27 +130,33 @@ static int app_info_foreach_app_filter_cb(pkgmgrinfo_appinfo_h handle, void *use info = calloc(1, sizeof(struct app_info_s)); if (info == NULL) - return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ foreach_context_s *foreach_context = user_data; if (handle == NULL || foreach_context == NULL) { + /* LCOV_EXCL_START */ free(info); return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); + /* LCOV_EXCL_STOP */ } retval = pkgmgrinfo_appinfo_get_appid(handle, &appid); if (retval < 0) { + /* LCOV_EXCL_START */ free(info); return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); + /* LCOV_EXCL_STOP */ } info->app_id = strdup(appid); if (info->app_id == NULL) { + /* LCOV_EXCL_START */ if (info) { free(info); info = NULL; } return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + /* LCOV_EXCL_STOP */ } info->pkg_app_info = handle; @@ -178,7 +184,7 @@ static int app_info_foreach_app_metadata_cb(const char *metadata_key, const char bool iteration_next = true; if (metadata_value == NULL || foreach_context == NULL) - return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ iteration_next = foreach_context->callback(metadata_key, metadata_value, foreach_context->user_data); if (iteration_next == true) @@ -193,7 +199,7 @@ static int app_info_foreach_category_cb(const char *category_name, void *user_da bool iteration_next = true; if (category_name == NULL || foreach_category == NULL) - return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ iteration_next = foreach_category->callback(category_name, foreach_category->user_data); if (iteration_next == true) @@ -217,14 +223,18 @@ static int app_info_foreach_app_info_cb(pkgmgrinfo_appinfo_h handle, void *cb_da ret = pkgmgrinfo_appinfo_get_appid(handle, &appid); if (ret != PMINFO_R_OK) { + /* LCOV_EXCL_START */ app_manager_error(APP_MANAGER_ERROR_NO_SUCH_APP, __FUNCTION__, NULL); return PMINFO_R_ERROR; + /* LCOV_EXCL_STOP */ } app_info = calloc(1, sizeof(struct app_info_s)); if (app_info == NULL) { + /* LCOV_EXCL_START */ app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); return PMINFO_R_ERROR; + /* LCOV_EXCL_STOP */ } app_info->app_id = strdup(appid); @@ -272,23 +282,29 @@ static int _check_privilege(char *privilege) ret = cynara_initialize(&p_cynara, NULL); if (ret != CYNARA_API_SUCCESS) { + /* LCOV_EXCL_START */ LOGE("cynara_initialize [%d] failed!", ret); return APP_MANAGER_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } fd = open("/proc/self/attr/current", O_RDONLY); if (fd < 0) { + /* LCOV_EXCL_START */ LOGE("open [%d] failed!", errno); ret = APP_MANAGER_ERROR_IO_ERROR; goto out; + /* LCOV_EXCL_STOP */ } ret = read(fd, client, SMACK_LABEL_LEN); if (ret < 0) { + /* LCOV_EXCL_START */ LOGE("read [%d] failed!", errno); close(fd); ret = APP_MANAGER_ERROR_IO_ERROR; goto out; + /* LCOV_EXCL_STOP */ } close(fd); snprintf(uid, 10, "%d", getuid()); @@ -327,10 +343,11 @@ API int app_info_create(const char *app_id, app_info_h *app_info) info = calloc(1, sizeof(struct app_info_s)); if (info == NULL) - return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ if (aul_svc_get_appid_by_alias_appid(app_id, &real_appid) == AUL_SVC_RET_OK && real_appid != NULL) { + /* LCOV_EXCL_START */ retval = pkgmgrinfo_appinfo_get_usr_appinfo(real_appid, getuid(), &appinfo); free(real_appid); @@ -340,6 +357,7 @@ API int app_info_create(const char *app_id, app_info_h *app_info) *app_info = info; return APP_MANAGER_ERROR_NONE; } + /* LCOV_EXCL_STOP */ } retval = pkgmgrinfo_appinfo_get_usr_appinfo(app_id, getuid(), &appinfo); if (!retval) { @@ -403,7 +421,7 @@ API int app_info_get_app_id(app_info_h app_info, char **app_id) app_id_dup = strdup(app_info->app_id); if (app_id_dup == NULL) - return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ *app_id = app_id_dup; @@ -425,7 +443,7 @@ API int app_info_get_exec(app_info_h app_info, char **exec) app_exec_dup = strdup(val); if (app_exec_dup == NULL) - return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ *exec = app_exec_dup; @@ -447,7 +465,7 @@ API int app_info_get_label(app_info_h app_info, char **label) app_label_dup = strdup(val); if (app_label_dup == NULL) - return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ *label = app_label_dup; @@ -467,11 +485,13 @@ API int app_info_get_localed_label(const char *app_id, const char *locale, char app_label_dup = strdup(val); if (app_label_dup == NULL) { + /* LCOV_EXCL_START */ if (val) { free(val); val = NULL; } return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + /* LCOV_EXCL_STOP */ } *label = app_label_dup; @@ -495,7 +515,7 @@ API int app_info_get_icon(app_info_h app_info, char **path) app_icon_dup = strdup(val); if (app_icon_dup == NULL) - return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ *path = app_icon_dup; @@ -513,13 +533,13 @@ API int app_info_get_package(app_info_h app_info, char **package) ret = pkgmgrinfo_appinfo_get_pkgname(app_info->pkg_app_info, &val); if (ret < 0) - return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ if (val == NULL) return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); app_package_dup = strdup(val); if (app_package_dup == NULL) - return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ *package = app_package_dup; @@ -537,13 +557,13 @@ API int app_info_get_type(app_info_h app_info, char **type) ret = pkgmgrinfo_appinfo_get_apptype(app_info->pkg_app_info, &val); if (ret < 0) - return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ if (val == NULL) return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); app_type_dup = strdup(val); if (app_type_dup == NULL) - return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ *type = app_type_dup; @@ -670,18 +690,22 @@ API int app_info_clone(app_info_h *clone, app_info_h app_info) info = calloc(1, sizeof(struct app_info_s)); if (info == NULL) - return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ info->app_id = strdup(app_info->app_id); if (info->app_id == NULL) { + /* LCOV_EXCL_START */ free(info); return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + /* LCOV_EXCL_STOP */ } if (pkgmgrinfo_appinfo_clone_appinfo(app_info->pkg_app_info, &(info->pkg_app_info)) < 0) { + /* LCOV_EXCL_START */ free(info->app_id); free(info); return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + /* LCOV_EXCL_STOP */ } *clone = info; @@ -722,12 +746,14 @@ API int app_info_filter_create(app_info_filter_h *handle) retval = pkgmgrinfo_appinfo_filter_create(&filter_h); if (retval < 0) - return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ filter_created = calloc(1, sizeof(struct app_info_filter_s)); if (filter_created == NULL) { + /* LCOV_EXCL_START */ free(filter_h); return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + /* LCOV_EXCL_STOP */ } filter_created->pkg_app_info_filter = filter_h; @@ -746,7 +772,7 @@ API int app_info_filter_destroy(app_info_filter_h handle) retval = pkgmgrinfo_appinfo_filter_destroy(handle->pkg_app_info_filter); if (retval < 0) - return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ free(handle); return APP_MANAGER_ERROR_NONE; @@ -766,7 +792,7 @@ API int app_info_filter_add_bool(app_info_filter_h handle, const char *property, retval = pkgmgrinfo_appinfo_filter_add_bool(handle->pkg_app_info_filter, converted_property, value); if (retval < 0) - return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ return APP_MANAGER_ERROR_NONE; } @@ -785,7 +811,7 @@ API int app_info_filter_add_string(app_info_filter_h handle, const char *propert retval = pkgmgrinfo_appinfo_filter_add_string(handle->pkg_app_info_filter, converted_property, value); if (retval < 0) - return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ return APP_MANAGER_ERROR_NONE; } @@ -799,7 +825,7 @@ API int app_info_filter_count_appinfo(app_info_filter_h handle, int *count) retval = pkgmgrinfo_appinfo_filter_count(handle->pkg_app_info_filter, count); if (retval < 0) - return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ return APP_MANAGER_ERROR_NONE; } @@ -818,7 +844,7 @@ API int app_info_filter_foreach_appinfo(app_info_filter_h handle, app_info_filte retval = pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(handle->pkg_app_info_filter, app_info_foreach_app_filter_cb, &foreach_context, getuid()); if (retval < 0) - return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ return APP_MANAGER_ERROR_NONE; } @@ -834,12 +860,14 @@ API int app_info_metadata_filter_create(app_info_metadata_filter_h *handle) filter_created = calloc(1, sizeof(struct app_info_metadata_filter_s)); if (filter_created == NULL) - return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ retval = pkgmgrinfo_appinfo_metadata_filter_create(&filter_h); if (retval < 0) { + /* LCOV_EXCL_START */ free(filter_created); return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); + /* LCOV_EXCL_STOP */ } filter_created->pkg_app_info_metadata_filter = filter_h; @@ -858,7 +886,7 @@ API int app_info_metadata_filter_destroy(app_info_metadata_filter_h handle) retval = pkgmgrinfo_appinfo_metadata_filter_destroy(handle->pkg_app_info_metadata_filter); if (retval < 0) - return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ free(handle); return APP_MANAGER_ERROR_NONE; @@ -873,7 +901,7 @@ API int app_info_metadata_filter_add(app_info_metadata_filter_h handle, const ch retval = pkgmgrinfo_appinfo_metadata_filter_add(handle->pkg_app_info_metadata_filter, key, value); if (retval < 0) - return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ return APP_MANAGER_ERROR_NONE; } @@ -895,7 +923,7 @@ API int app_info_metadata_filter_foreach(app_info_metadata_filter_h handle, app_ retval = pkgmgrinfo_appinfo_usr_metadata_filter_foreach(handle->pkg_app_info_metadata_filter, app_info_foreach_app_filter_cb, &foreach_context, getuid()); if (retval < 0) - return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ return APP_MANAGER_ERROR_NONE; } diff --git a/src/app_manager.c b/src/app_manager.c index bd9dd76..88a3895 100644 --- a/src/app_manager.c +++ b/src/app_manager.c @@ -199,7 +199,7 @@ API int app_manager_get_app_id(pid_t pid, char **app_id) app_id_dup = strdup(buffer); if (app_id_dup == NULL) - return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ *app_id = app_id_dup; @@ -440,15 +440,20 @@ API int app_manager_event_create(app_manager_event_h *handle) __FUNCTION__, NULL); app_mgr_evt = (app_manager_event *)calloc(1, sizeof(app_manager_event)); - if (app_mgr_evt == NULL) + if (app_mgr_evt == NULL) { + /* LCOV_EXCL_START */ return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + /* LCOV_EXCL_STOP */ + } pc = pkgmgr_client_new(PC_LISTENING); if (pc == NULL) { + /* LCOV_EXCL_START */ free(app_mgr_evt); return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); + /* LCOV_EXCL_STOP */ } app_mgr_evt->pc = pc; @@ -472,10 +477,12 @@ API int app_manager_event_set_status(app_manager_event_h handle, int status_type ret = pkgmgr_client_set_status_type(handle->pc, pkgmgr_status_type); if (ret != PKGMGR_R_OK) { + /* LCOV_EXCL_START */ LOGE("[%s] APP_MANAGER_ERROR_REQUEST_FAILED(0x%08x) : " \ "Failed to set event status", __FUNCTION__, APP_MANAGER_ERROR_REQUEST_FAILED); return APP_MANAGER_ERROR_REQUEST_FAILED; + /* LCOV_EXCL_STOP */ } return APP_MANAGER_ERROR_NONE; @@ -497,10 +504,12 @@ API int app_manager_set_event_cb(app_manager_event_h handle, ret = pkgmgr_client_listen_app_status(handle->pc, app_event_handler, handle); if (ret < PKGMGR_R_OK) { + /* LCOV_EXCL_START */ LOGE("[%s] APP_MANAGER_ERROR_REQUEST_FAILED(0x%08x) : " \ "Failed to set event callback", __FUNCTION__, APP_MANAGER_ERROR_REQUEST_FAILED); return APP_MANAGER_ERROR_REQUEST_FAILED; + /* LCOV_EXCL_STOP */ } handle->req_id = ret; @@ -517,10 +526,12 @@ API int app_manager_unset_event_cb(app_manager_event_h handle) ret = pkgmgr_client_remove_listen_status(handle->pc); if (ret != 0) { + /* LCOV_EXCL_START */ LOGE("[%s] APP_MANAGER_ERROR_REQUEST_FAILED(0x%08x) : " \ "Failed to unset event callback", __FUNCTION__, APP_MANAGER_ERROR_REQUEST_FAILED); return APP_MANAGER_ERROR_REQUEST_FAILED; + /* LCOV_EXCL_STOP */ } return APP_MANAGER_ERROR_NONE; @@ -536,10 +547,12 @@ API int app_manager_event_destroy(app_manager_event_h handle) ret = pkgmgr_client_free(handle->pc); if (ret != 0) { + /* LCOV_EXCL_START */ LOGE("[%s] APP_MANAGER_ERROR_REQUEST_FAILED(0x%08x) : " \ "Failed to destroy handle", __FUNCTION__, APP_MANAGER_ERROR_REQUEST_FAILED); return APP_MANAGER_ERROR_REQUEST_FAILED; + /* LCOV_EXCL_STOP */ } remove_app_manager_event_info_list(handle->head); @@ -579,14 +592,14 @@ API int app_manager_get_focused_app_context(app_context_h *app_context) ret = aul_window_get_focused_pid(&pid); if (ret != 0) - return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); + return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ if (pid < 0) return app_manager_error(APP_MANAGER_ERROR_NO_SUCH_APP, __FUNCTION__, NULL); ret = app_context_get_app_context_by_pid(pid, app_context); if (ret != APP_MANAGER_ERROR_NONE) - return app_manager_error(ret, __FUNCTION__, NULL); + return app_manager_error(ret, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */ return APP_MANAGER_ERROR_NONE; } diff --git a/src/app_manager_event.c b/src/app_manager_event.c index 0b87da1..4970de4 100644 --- a/src/app_manager_event.c +++ b/src/app_manager_event.c @@ -163,17 +163,22 @@ int app_event_handler(uid_t target_uid, int req_id, != APP_MANAGER_ERROR_NONE) return APP_MANAGER_ERROR_REQUEST_FAILED; - if (strcasecmp(val, "ok") == 0) + if (strcasecmp(val, "ok") == 0) { app_evt->event_cb(pkg_type, appid, event_type, APP_MANAGER_EVENT_STATE_COMPLETED, app_evt, app_evt->user_data); - else if (strcasecmp(val, "fail") == 0) + } else if (strcasecmp(val, "fail") == 0) { + /* LCOV_EXCL_START */ app_evt->event_cb(pkg_type, appid, event_type, APP_MANAGER_EVENT_STATE_FAILED, app_evt, app_evt->user_data); + /* LCOV_EXCL_STOP */ + } ret = __remove_app_manager_event_info(&(app_evt->head), req_id); if (ret != APP_MANAGER_ERROR_NONE) { + /* LCOV_EXCL_START */ LOGE("failed to remove app event info"); return APP_MANAGER_ERROR_REQUEST_FAILED; + /* LCOV_EXCL_STOP */ } } else {