b = bundle_decode(b_raw, len);
if (b == NULL)
- _E("Failed to decode bundle raw(%s)", b_raw);
+ _E("Failed to decode bundle raw(%s)", b_raw); /* LCOV_EXCL_LINE */
free(b_raw);
b = __get_bundle_from_job(job);
if (b == NULL) {
+ /* LCOV_EXCL_START */
ctx_sched_job_destroy(job);
return;
+ /* LCOV_EXCL_STOP */
}
job_id = bundle_get_val(b, AUL_K_JOB_ID);
if (job_id == NULL) {
+ /* LCOV_EXCL_START */
ctx_sched_job_destroy(job);
bundle_free(b);
return;
+ /* LCOV_EXCL_STOP */
}
if (!g_hash_table_contains(__handle.job_id_table, job_id))
b = __get_bundle_from_job(job);
if (b == NULL) {
+ /* LCOV_EXCL_START */
ctx_sched_job_destroy(job);
return;
+ /* LCOV_EXCL_STOP */
}
job_id = bundle_get_val(b, AUL_K_JOB_ID);
if (job_id == NULL) {
+ /* LCOV_EXCL_START */
ctx_sched_job_destroy(job);
bundle_free(b);
return;
+ /* LCOV_EXCL_STOP */
}
service_app_job_raise(SERVICE_APP_JOB_STATUS_STOP, job_id, b);
r = ctx_sched_create(&handle);
if (r != 0)
- return r;
+ return r; /* LCOV_EXCL_LINE */
r = ctx_sched_foreach_job(handle, __foreach_job_cb, NULL);
if (r != 0 && r != TIZEN_ERROR_NO_DATA) {
+ /* LCOV_EXCL_START */
ctx_sched_destroy(handle);
return r;
+ /* LCOV_EXCL_STOP */
}
r = ctx_sched_set_job_cb(handle, __start_job_cb, __stop_job_cb, NULL);
if (r != 0) {
+ /* LCOV_EXCL_START */
ctx_sched_destroy(handle);
return r;
+ /* LCOV_EXCL_STOP */
}
*scheduler = handle;
r = app_get_id(&__handle.app_id);
if (r != APP_ERROR_NONE) {
+ /* LCOV_EXCL_START */
return job_error(JOB_ERROR_IO_ERROR, __FUNCTION__,
__LINE__, NULL);
+ /* LCOV_EXCL_STOP */
}
__handle.job_id_table = g_hash_table_new_full(g_str_hash, g_str_equal,
free, NULL);
if (__handle.job_id_table == NULL) {
+ /* LCOV_EXCL_START */
free(__handle.app_id);
return job_error(JOB_ERROR_OUT_OF_MEMORY, __FUNCTION__,
__LINE__, NULL);
+ /* LCOV_EXCL_STOP */
}
r = __init_scheduler(&__handle.scheduler);
if (r != 0) {
+ /* LCOV_EXCL_START */
g_hash_table_destroy(__handle.job_id_table);
free(__handle.app_id);
return job_error(JOB_ERROR_IO_ERROR, __FUNCTION__,
__LINE__, NULL);
+ /* LCOV_EXCL_STOP */
}
__handle.initialized = true;
r = aul_svc_set_operation(b, AUL_SVC_OPERATION_DEFAULT);
if (r != AUL_SVC_RET_OK) {
+ /* LCOV_EXCL_START */
_E("Failed to set operation");
return JOB_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
r = aul_svc_set_appid(b, __handle.app_id);
if (r != AUL_SVC_RET_OK) {
+ /* LCOV_EXCL_START */
_E("Failed to add appid(%s)", __handle.app_id);
return JOB_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
r = ctx_sched_job_set_app_control(job, b);
if (r != 0) {
+ /* LCOV_EXCL_START */
_E("Failed to set app control (%d)", r);
return JOB_ERROR_IO_ERROR;
+ /* LCOV_EXCL_STOP */
}
return JOB_ERROR_NONE;
r = ctx_sched_job_set_user_data(job, (const char *)b_raw, len);
if (r != 0) {
+ /* LCOV_EXCL_START */
_E("Failed to set user data");
free(b_raw);
return JOB_ERROR_IO_ERROR;
+ /* LCOV_EXCL_STOP */
}
free(b_raw);
r = ctx_sched_job_set_persistent(job, persistent);
if (r != 0) {
+ /* LCOV_EXCL_START */
_E("Failed to set persistent (%d)", r);
return r;
+ /* LCOV_EXCL_STOP */
}
if (persistent)
r = ctx_sched_job_set_one_time(job, once);
if (r != 0) {
+ /* LCOV_EXCL_START */
_E("Failed to set one time (%d)", r);
return r;
+ /* LCOV_EXCL_STOP */
}
if (once)
r = ctx_sched_job_set_requirement_timeout(job, timeout);
if (r != 0) {
+ /* LCOV_EXCL_START */
_E("Failed to set requirement timeout (%d)", r);
return r;
+ /* LCOV_EXCL_STOP */
}
if (timeout) {
r = ctx_sched_job_context_prepare_attribute_str(context, name);
if (r != 0) {
+ /* LCOV_EXCL_START */
_E("Failed to prepare string attribute(%s) - %d", name, r);
return r;
+ /* LCOV_EXCL_STOP */
}
r = ctx_sched_job_context_attribute_add_ne_str(context, name, value);
if (r != 0) {
+ /* LCOV_EXCL_START */
_E("Failed to add string value(%s) - %d", value, r);
return r;
+ /* LCOV_EXCL_STOP */
}
return JOB_ERROR_NONE;
r = ctx_sched_job_context_prepare_attribute_str(context, name);
if (r != 0) {
+ /* LCOV_EXCL_START */
_E("Failed to prepare string attribute(%s) - %d", name, r);
return r;
+ /* LCOV_EXCL_STOP */
}
r = ctx_sched_job_context_attribute_add_eq_str(context, name, value);
if (r != 0) {
+ /* LCOV_EXCL_START */
_E("Failed to add string value(%s) - %d", value, r);
return r;
+ /* LCOV_EXCL_STOP */
}
return JOB_ERROR_NONE;
r = ctx_sched_job_context_prepare_attribute_int(context, name);
if (r != 0) {
+ /* LCOV_EXCL_START */
_E("Failed to prepare integer attribute(%s) - %d", name, r);
return r;
+ /* LCOV_EXCL_STOP */
}
r = ctx_sched_job_context_attribute_add_eq_int(context, name, value);
if (r != 0) {
+ /* LCOV_EXCL_START */
_E("Failed to add integer value(%s) - %d", value, r);
return r;
+ /* LCOV_EXCL_STOP */
}
return JOB_ERROR_NONE;
r = ctx_sched_job_requirement_create(CTX_SCHED_URI_BATTERY, false,
&requirement);
if (r != 0) {
+ /* LCOV_EXCL_START */
_E("Failed to create requirement (%d)", r);
return r;
+ /* LCOV_EXCL_STOP */
}
if (battery_not_low) {
CTX_SCHED_ATTR_VALUE_HIGH);
}
if (r != JOB_ERROR_NONE) {
+ /* LCOV_EXCL_START */
ctx_sched_job_context_destroy(requirement);
return r;
+ /* LCOV_EXCL_STOP */
}
r = ctx_sched_job_add_requirement(job, requirement);
if (r != 0) {
+ /* LCOV_EXCL_START */
_E("Failed to add requirement (%d)", r);
ctx_sched_job_context_destroy(requirement);
return r;
+ /* LCOV_EXCL_STOP */
}
if (battery_not_low)
r = ctx_sched_job_requirement_create(CTX_SCHED_URI_BATTERY, false,
&requirement);
if (r != 0) {
+ /* LCOV_EXCL_START */
_E("Failed to create requirement (%d)", r);
return r;
+ /* LCOV_EXCL_STOP */
}
r = __add_int_attr_eq(requirement, CTX_SCHED_ATTR_NAME_IS_CHARGING,
charging);
if (r != JOB_ERROR_NONE) {
+ /* LCOV_EXCL_START */
ctx_sched_job_context_destroy(requirement);
return r;
+ /* LCOV_EXCL_STOP */
}
r = ctx_sched_job_add_requirement(job, requirement);
if (r != 0) {
+ /* LCOV_EXCL_START */
_E("Failed to add requirement (%d)", r);
ctx_sched_job_context_destroy(requirement);
return r;
+ /* LCOV_EXCL_STOP */
}
if (charging)
r = ctx_sched_job_requirement_create(CTX_SCHED_URI_WIFI, false,
&requirement);
if (r != 0) {
+ /* LCOV_EXCL_START */
_E("Failed to create requirement (%d)", r);
return r;
+ /* LCOV_EXCL_STOP */
}
if (wifi_connection) {
CTX_SCHED_ATTR_VALUE_CONNECTED);
}
if (r != JOB_ERROR_NONE) {
+ /* LCOV_EXCL_START */
ctx_sched_job_context_destroy(requirement);
return r;
+ /* LCOV_EXCL_STOP */
}
r = ctx_sched_job_add_requirement(job, requirement);
if (r != 0) {
+ /* LCOV_EXCL_START */
_E("Failed to add requirement (%d)", r);
ctx_sched_job_context_destroy(requirement);
return r;
+ /* LCOV_EXCL_STOP */
}
if (wifi_connection)
r = ctx_sched_job_trigger_create(job_trigger_map[event].uri,
&trigger);
if (r != 0) {
+ /* LCOV_EXCL_START */
_E("Failed to create trigger (%d)", r);
return r;
+ /* LCOV_EXCL_STOP */
}
if (job_trigger_map[event].attr_type == ATTR_TYPE_INTEGER) {
r = ctx_sched_job_add_trigger(job, trigger);
if (r != 0) {
+ /* LCOV_EXCL_START */
_E("Failed to add trigger (%d)", r);
ctx_sched_job_context_destroy(trigger);
return r;
+ /* LCOV_EXCL_STOP */
}
bundle_add(b, job_trigger_map[event].key, "true");
b = bundle_create();
if (b == NULL) {
+ /* LCOV_EXCL_START */
_E("Failed to create bundle");
return NULL;
+ /* LCOV_EXCL_STOP */
}
r = bundle_add(b, AUL_K_JOB_ID, job_id);
if (r != BUNDLE_ERROR_NONE) {
+ /* LCOV_EXCL_START */
_E("Failed to add job id(%s)", job_id);
bundle_free(b);
return NULL;
+ /* LCOV_EXCL_STOP */
}
job_info_get_periodic(job_info, &interval);
r = ctx_sched_job_create_periodic(interval, 0, &job);
}
if (r != 0) {
+ /* LCOV_EXCL_START */
_E("Failed to create job (%d)", r);
bundle_free(b);
return NULL;
+ /* LCOV_EXCL_STOP */
}
for (i = 0; i < ARRAY_SIZE(job_constructor); ++i) {
if (job_constructor[i]) {
r = job_constructor[i](job, job_info, b);
if (r != JOB_ERROR_NONE) {
+ /* LCOV_EXCL_START */
ctx_sched_job_destroy(job);
bundle_free(b);
return NULL;
+ /* LCOV_EXCL_STOP */
}
}
}
job = __create_job(job_info, job_id);
if (job == NULL) {
+ /* LCOV_EXCL_START */
return job_error(JOB_ERROR_OUT_OF_MEMORY, __FUNCTION__,
__LINE__, NULL);
+ /* LCOV_EXCL_STOP */
}
r = job_info_set_job_id(job_info, job_id);
if (r != JOB_ERROR_NONE) {
+ /* LCOV_EXCL_START */
ctx_sched_job_destroy(job);
return job_error(r, __FUNCTION__, __LINE__, NULL);
+ /* LCOV_EXCL_STOP */
}
r = ctx_sched_schedule(__handle.scheduler, job, &id);
if (r != 0) {
+ /* LCOV_EXCL_START */
ctx_sched_job_destroy(job);
if (r == JOB_ERROR_PERMISSION_DENIED) {
return job_error(JOB_ERROR_PERMISSION_DENIED,
return job_error(JOB_ERROR_IO_ERROR,
__FUNCTION__, __LINE__, NULL);
}
+ /* LCOV_EXCL_STOP */
}
ctx_sched_job_destroy(job);
g_hash_table_insert(__handle.job_id_table, strdup(job_id),
r = ctx_sched_cancel(__handle.scheduler, id);
if (r != 0) {
+ /* LCOV_EXCL_START */
return job_error(JOB_ERROR_IO_ERROR, __FUNCTION__,
__LINE__, NULL);
+ /* LCOV_EXCL_STOP */
}
g_hash_table_remove(__handle.job_id_table, job_id);
r = ctx_sched_cancel_all(__handle.scheduler);
if (r != 0) {
+ /* LCOV_EXCL_START */
return job_error(JOB_ERROR_IO_ERROR, __FUNCTION__,
__LINE__, NULL);
+ /* LCOV_EXCL_STOP */
}
g_hash_table_remove_all(__handle.job_id_table);
r = ctx_sched_job_finished(__handle.scheduler, id);
if (r != 0) {
+ /* LCOV_EXCL_START */
return job_error(JOB_ERROR_IO_ERROR, __FUNCTION__,
__LINE__, NULL);
+ /* LCOV_EXCL_STOP */
}
r = service_app_job_finished(job_id);
if (r != 0) {
+ /* LCOV_EXCL_START */
return job_error(JOB_ERROR_IO_ERROR, __FUNCTION__,
__LINE__, NULL);
+ /* LCOV_EXCL_STOP */
}
return JOB_ERROR_NONE;
r = ctx_sched_get_job(__handle.scheduler, id, &job);
if (r != 0) {
+ /* LCOV_EXCL_START */
_E("Failed to get job from job id(%s:%d)", job_id, id);
return;
+ /* LCOV_EXCL_STOP */
}
b = __get_bundle_from_job(job);
if (b == NULL) {
+ /* LCOV_EXCL_START */
ctx_sched_job_destroy(job);
return;
+ /* LCOV_EXCL_STOP */
}
ctx_sched_job_destroy(job);
r = job_info_create_with_bundle(b, &job_info);
if (r != JOB_ERROR_NONE) {
+ /* LCOV_EXCL_START */
bundle_free(b);
return;
+ /* LCOV_EXCL_STOP */
}
bundle_free(b);
r = job_info_set_job_id(job_info, job_id);
if (r != JOB_ERROR_NONE) {
+ /* LCOV_EXCL_START */
job_info_destroy(job_info);
return;
+ /* LCOV_EXCL_STOP */
}
*list = g_list_append(*list, job_info);
service = calloc(1, sizeof(struct job_service_s));
if (service == NULL) {
+ /* LCOV_EXCL_START */
_E("Out of memory");
return NULL;
+ /* LCOV_EXCL_STOP */
}
service->handle = service_app_add_job_handler(job_id, __job_service_cb,
service);
if (service->handle == NULL) {
+ /* LCOV_EXCL_START */
_E("Out of memory");
free(service);
return NULL;
+ /* LCOV_EXCL_STOP */
}
service->callback = *callback;
service = __create_job_service(job_id, callback, user_data);
if (service == NULL) {
+ /* LCOV_EXCL_START */
return job_error(JOB_ERROR_OUT_OF_MEMORY, __FUNCTION__,
__LINE__, NULL);
+ /* LCOV_EXCL_STOP */
}
__handle.job_service_list = g_list_append(__handle.job_service_list,
}
if (!__handle.initialized) {
+ /* LCOV_EXCL_START */
return job_error(JOB_ERROR_NOT_INITIALIZED, __FUNCTION__,
__LINE__, NULL);
+ /* LCOV_EXCL_STOP */
}
__handle.job_service_list = g_list_remove(__handle.job_service_list,
r = ctx_sched_job_requirement_is_supported(__handle.scheduler,
uri, &supported);
if (r != 0) {
+ /* LCOV_EXCL_START */
return job_error(JOB_ERROR_IO_ERROR, __FUNCTION__,
__LINE__, NULL);
+ /* LCOV_EXCL_STOP */
}
if (!supported) {
+ /* LCOV_EXCL_START */
return job_error(JOB_ERROR_NOT_SUPPORTED, __FUNCTION__,
__LINE__, NULL);
+ /* LCOV_EXCL_STOP */
}
return JOB_ERROR_NONE;
r = ctx_sched_job_trigger_is_supported(__handle.scheduler,
uri, &supported);
if (r != 0) {
+ /* LCOV_EXCL_START */
return job_error(JOB_ERROR_IO_ERROR, __FUNCTION__,
__LINE__, NULL);
+ /* LCOV_EXCL_STOP */
}
if (!supported) {
+ /* LCOV_EXCL_START */
return job_error(JOB_ERROR_NOT_SUPPORTED, __FUNCTION__,
__LINE__, NULL);
+ /* LCOV_EXCL_STOP */
}
return JOB_ERROR_NONE;
r = cynara_creds_self_get_client(CLIENT_METHOD_DEFAULT,
&__cynara.client);
if (r != CYNARA_API_SUCCESS) {
+ /* LCOV_EXCL_START */
_E("Failed to get client");
return -1;
+ /* LCOV_EXCL_STOP */
}
r = cynara_creds_self_get_user(CLIENT_METHOD_DEFAULT, &__cynara.user);
if (r != CYNARA_API_SUCCESS) {
+ /* LCOV_EXCL_START */
_E("Failed to get user");
goto err;
+ /* LCOV_EXCL_STOP */
}
__cynara.session = cynara_session_from_pid(getpid());
if (__cynara.session == NULL) {
+ /* LCOV_EXCL_START */
_E("Failed to get session");
goto err;
+ /* LCOV_EXCL_STOP */
}
r = cynara_configuration_create(&conf);
if (r != CYNARA_API_SUCCESS) {
+ /* LCOV_EXCL_START */
_E("Failed to create cynara configuration");
goto err;
+ /* LCOV_EXCL_STOP */
}
r = cynara_configuration_set_cache_size(conf, 10);
if (r != CYNARA_API_SUCCESS) {
+ /* LCOV_EXCL_START */
_E("Failed to set cache size");
goto err;
+ /* LCOV_EXCL_STOP */
}
r = cynara_initialize(&__cynara.handle, conf);
cynara_configuration_destroy(conf);
conf = NULL;
if (r != CYNARA_API_SUCCESS) {
+ /* LCOV_EXCL_START */
_E("Failed to initialize cynara");
goto err;
+ /* LCOV_EXCL_STOP */
}
__cynara.initialized = true;
return 0;
err:
+ /* LCOV_EXCL_START */
if (conf)
cynara_configuration_destroy(conf);
}
return -1;
+ /* LCOV_EXCL_STOP */
}
static void __finish_cynara(void)
r = cynara_check(__cynara.handle, __cynara.client, __cynara.session,
__cynara.user, priv);
if (r != CYNARA_API_ACCESS_ALLOWED) {
+ /* LCOV_EXCL_START */
_E("Failed to check cynara access (%d)", r);
return JOB_ERROR_PERMISSION_DENIED;
+ /* LCOV_EXCL_STOP */
}
return JOB_ERROR_NONE;