job = calloc(1, sizeof(struct job_s));
if (job == NULL) {
+ /* LCOV_EXCL_START */
LOGE("Out of memory");
return NULL;
+ /* LCOV_EXCL_STOP */
}
job->job_id = strdup(job_id);
if (job->job_id == NULL) {
+ /* LCOV_EXCL_START */
LOGE("Out of memory");
free(job);
return NULL;
+ /* LCOV_EXCL_STOP */
}
job->job_data = bundle_dup(job_data);
if (job->job_data == NULL) {
+ /* LCOV_EXCL_START */
LOGE("Out of memory");
free(job->job_id);
free(job);
return NULL;
+ /* LCOV_EXCL_STOP */
}
job->job_status = job_status;
return;
if (job->idler)
- g_source_remove(job->idler);
+ g_source_remove(job->idler); /* LCOV_EXCL_LINE */
if (job->timer)
- g_source_remove(job->timer);
+ g_source_remove(job->timer); /* LCOV_EXCL_LINE */
if (job->job_data)
bundle_free(job->job_data);
if (job->job_id)
free(job);
}
+/* LCOV_EXCL_START */
static gboolean __pending_job_timeout_handler(gpointer data)
{
struct job_s *job = (struct job_s *)data;
return G_SOURCE_REMOVE;
}
+/* LCOV_EXCL_STOP */
static void __job_finish(void)
{
if (__context.running_jobs) {
+ /* LCOV_EXCL_START */
g_list_free_full(__context.running_jobs, __destroy_job);
__context.running_jobs = NULL;
+ /* LCOV_EXCL_STOP */
}
if (__context.pending_jobs) {
+ /* LCOV_EXCL_START */
g_list_free_full(__context.pending_jobs, __destroy_job);
__context.pending_jobs = NULL;
+ /* LCOV_EXCL_STOP */
}
if (__context.job_handlers) {
return __on_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "service_app_create_cb() callback must be registered");
if (__app_state != APP_STATE_NOT_RUNNING)
- return __on_error(APP_ERROR_ALREADY_RUNNING, __FUNCTION__, NULL);
+ return __on_error(APP_ERROR_ALREADY_RUNNING, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */
/* override methods */
ops.create = __service_app_create;
__app_state = APP_STATE_CREATING;
ret = appcore_base_init(ops, argc, argv, NULL);
if (ret < 0) {
+ /* LCOV_EXCL_START */
__app_state = APP_STATE_NOT_RUNNING;
return __on_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
+ /* LCOV_EXCL_STOP */
}
appcore_base_fini();
handler = calloc(1, sizeof(struct app_event_handler));
if (!handler)
- return __on_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, "insufficient memory");
+ return __on_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, "insufficient memory"); /* LCOV_EXCL_LINE */
handler->type = event_type;
handler->cb = callback;
if (type < APP_EVENT_LOW_MEMORY ||
type > APP_EVENT_SUSPENDED_STATE_CHANGED ||
type == APP_EVENT_DEVICE_ORIENTATION_CHANGED)
- return __on_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ return __on_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */
ret = appcore_base_remove_event(event_handler->raw);
free(event_handler);
if (ret < 0)
- return __on_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ return __on_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */
return APP_ERROR_NONE;
}
iter = __context.pending_jobs;
while (iter) {
+ /* LCOV_EXCL_START */
job = (struct job_s *)iter->data;
iter = iter->next;
if (strcmp(job->job_id, job_id) == 0) {
__context.running_jobs = g_list_append(
__context.running_jobs, job);
}
+ /* LCOV_EXCL_STOP */
}
}
handle = calloc(1, sizeof(struct service_app_job_s));
if (handle == NULL) {
+ /* LCOV_EXCL_START */
LOGE("Out of memory");
return NULL;
+ /* LCOV_EXCL_STOP */
}
handle->job_id = strdup(job_id);
if (handle->job_id == NULL) {
+ /* LCOV_EXCL_START */
LOGE("Out of memory");
free(handle);
return NULL;
+ /* LCOV_EXCL_STOP */
}
handle->callback = callback;
struct service_app_job_s *handle;
if (job_id == NULL || callback == NULL) {
+ /* LCOV_EXCL_START */
LOGE("Invalid parameter");
return NULL;
+ /* LCOV_EXCL_STOP */
}
handle = __create_job_handler(job_id, callback, user_data);
{
if (handle == NULL ||
g_list_index(__context.job_handlers, handle) < 0) {
+ /* LCOV_EXCL_START */
return __on_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__,
NULL);
+ /* LCOV_EXCL_STOP */
}
__context.job_handlers = g_list_remove(__context.job_handlers, handle);
if (job_status < SERVICE_APP_JOB_STATUS_START ||
job_status > SERVICE_APP_JOB_STATUS_STOP ||
job_id == NULL || job_data == NULL) {
+ /* LCOV_EXCL_START */
return __on_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__,
NULL);
+ /* LCOV_EXCL_STOP */
}
job = __create_job(job_status, job_id, job_data);
if (job == NULL)
- return __on_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
+ return __on_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); /* LCOV_EXCL_LINE */
if (!__exist_job_handler(job_id)) {
+ /* LCOV_EXCL_START */
job->timer = g_timeout_add(5000, __pending_job_timeout_handler,
job);
__context.pending_jobs = g_list_append(__context.pending_jobs,
job);
+ /* LCOV_EXCL_STOP */
} else {
job->idler = g_idle_add(__handle_job, job);
__context.running_jobs = g_list_append(__context.running_jobs,
iter = __context.running_jobs;
while (iter) {
+ /* LCOV_EXCL_START */
job = (struct job_s *)iter->data;
iter = iter->next;
if (strcmp(job->job_id, job_id) == 0) {
__context.running_jobs, job);
__destroy_job(job);
}
+ /* LCOV_EXCL_STOP */
}
}
int r;
if (job_id == NULL) {
+ /* LCOV_EXCL_START */
return __on_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__,
NULL);
+ /* LCOV_EXCL_STOP */
}
__remove_running_job(job_id);
r = aul_job_scheduler_update_job_status(job_id, JOB_STATUS_FINISHED);
if (r != AUL_R_OK) {
+ /* LCOV_EXCL_START */
return __on_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__,
NULL);
+ /* LCOV_EXCL_STOP */
}
return APP_ERROR_NONE;