/*
- * Copyright (c) 2000 - 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2000 - 2019 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
int j = 0;
bool is_user = false;
- if (appid == NULL)
+ if (appid == NULL) {
+ LOGE("alarm is null");
return ERR_ALARM_INVALID_PARAM;
+ }
- if (strlen(appid) >= MAX_PKG_NAME_LEN)
+ if (strlen(appid) >= MAX_PKG_NAME_LEN) {
+ LOGE("length of appid is invalid");
return ERR_ALARM_INVALID_PARAM;
+ }
if (b_initialized) {
SECURE_LOGD("alarm was already initialized. app_service_name=%s",
{
alarm_info_t *alarm = (alarm_info_t *)malloc(sizeof(alarm_info_t));
- if (alarm == NULL)
+ if (alarm == NULL) {
+ LOGE("alarm is null");
return NULL;
+ }
alarm->start.year = 0;
alarm->start.month = 0;
EXPORT_API int alarmmgr_free_alarm(alarm_entry_t *alarm)
{
- if (alarm == NULL)
+ if (alarm == NULL) {
+ LOGE("alarm is null");
return ERR_ALARM_INVALID_PARAM;
+ }
free(alarm);
alarm_info_t *alarm_info;
int error_code;
- if (alarm == NULL)
+ if (alarm == NULL) {
+ LOGE("alarm is null");
return ERR_ALARM_INVALID_PARAM;
+ }
alarm_info = (alarm_info_t *)alarm;
if (!__alarm_validate_date(&time, &error_code)) {
{
alarm_info_t *alarm_info = (alarm_info_t *)alarm;
- if (alarm == NULL)
+ if (alarm == NULL) {
+ LOGE("alarm is null");
return ERR_ALARM_INVALID_PARAM;
+ }
if (time != NULL)
memcpy(time, &alarm_info->start, sizeof(alarm_date_t));
{
alarm_info_t *alarm_info = (alarm_info_t *)alarm;
- if (repeat >= ALARM_REPEAT_MODE_MAX)
+ if (repeat >= ALARM_REPEAT_MODE_MAX) {
+ LOGE("repeat value is invalid");
return ERR_ALARM_INVALID_PARAM;
+ }
alarm_info->mode.repeat = repeat;
{
alarm_info_t *alarm_info = (alarm_info_t *)alarm;
- if (alarm == NULL)
+ if (alarm == NULL) {
+ LOGE("alarm is null");
return ERR_ALARM_INVALID_PARAM;
+ }
if (repeat != NULL)
*repeat = alarm_info->mode.repeat;
{
alarm_info_t *alarm_info;
- if (alarm == NULL)
+ if (alarm == NULL) {
+ LOGE("alarm is null");
return ERR_ALARM_INVALID_PARAM;
+ }
alarm_info = (alarm_info_t *)alarm;
alarm_info->alarm_type = alarm_type;
{
alarm_info_t *alarm_info = (alarm_info_t *)alarm;
- if (alarm == NULL)
+ if (alarm == NULL) {
+ LOGE("alarm is null");
return ERR_ALARM_INVALID_PARAM;
+ }
if (alarm_type != NULL)
*alarm_type = alarm_info->alarm_type;
LOGD("[alarm-lib]:alarmmgr_get_alarm_appsvc_info() is called.");
if (alarm_id <= 0) {
+ LOGE("alarm_id is Invalid[%d]", alarm_id);
if (return_code)
*return_code = ERR_ALARM_INVALID_ID;
LOGD("[alarm-lib]:alarmmgr_get_alarm_appsvc_info() is called.");
- if (alarm_id <= 0)
+ if (alarm_id <= 0) {
+ LOGE("alarm_id is Invalid[%d]", alarm_id);
return ERR_ALARM_INVALID_ID;
+ }
*noti = _send_alarm_get_noti_info(alarm_context, alarm_id, &ret);
appid = appsvc_get_appid(b);
if ((appid == NULL && (alarm_info->alarm_type & ALARM_TYPE_NOLAUNCH)) ||
(appid == NULL && operation && !strcmp(operation, APPSVC_OPERATION_DEFAULT))) {
- LOGE("Invalid parameter\n");
- return ERR_ALARM_INVALID_PARAM;
- }
-
- if (alarm_info == NULL || alarm_id == NULL) {
- LOGE("Invalid parameter\n");
+ LOGE("appid is ivalid");
return ERR_ALARM_INVALID_PARAM;
}
LOGD("[alarm-lib]:alarm_create() is called\n");
- if (alarm == NULL)
+ if (alarm == NULL) {
+ LOGE("alarm is null");
return ERR_ALARM_INVALID_PARAM;
+ }
alarm_info = (alarm_info_t *) alarm;
if (alarm_info == NULL || alarm_id == NULL) {
alarm_info->mode.repeat, alarm_info->mode.u_interval.interval, alarm_info->alarm_type);
/* TODO: This should be changed to > ALARM_REPEAT_MODE_MAX ? */
- if (mode->repeat >= ALARM_REPEAT_MODE_MAX)
+ if (mode->repeat >= ALARM_REPEAT_MODE_MAX) {
+ LOGE("repeat is Invalid");
return ERR_ALARM_INVALID_PARAM;
+ }
if (destination && strlen(destination) >= MAX_PKG_NAME_LEN) {
LOGE("[alarm-lib]: destination name is too long!\n");
return ERR_ALARM_SYSTEM_FAIL;
}
- if (alarm_id == NULL)
+ if (alarm_id == NULL) {
+ LOGE("alarm_id is null");
return ERR_ALARM_INVALID_PARAM;
+ }
- if (trigger_at_time < 0)
+ if (trigger_at_time < 0) {
+ LOGE("trigger_at_time is invalid[%ld]", trigger_at_time);
return ERR_ALARM_INVALID_PARAM;
+ }
_initialize_alarm_info(&alarm_info, alarm_type, trigger_at_time, interval,
false);
return ERR_ALARM_SYSTEM_FAIL;
}
- if (alarm_id == NULL)
+ if (alarm_id == NULL) {
+ LOGE("alarm_id is null");
return ERR_ALARM_INVALID_PARAM;
+ }
- if (trigger_at_time < 0)
+ if (trigger_at_time < 0) {
+ LOGE("trigger_at_time is invalid[%ld]", trigger_at_time);
return ERR_ALARM_INVALID_PARAM;
+ }
_initialize_alarm_info(&alarm_info, alarm_type, trigger_at_time, interval,
false);
if (ret < 0)
return ret;
- if (alarm_id == NULL)
+ if (alarm_id == NULL) {
+ LOGE("[alarm-lib]: alarm_id is null");
return ERR_ALARM_INVALID_PARAM;
+ }
if (trigger_at_time < 0)
+ LOGE("trigger_at_time is invalid[%ld]", trigger_at_time);
return ERR_ALARM_INVALID_PARAM;
if (destination && strlen(destination) >= MAX_PKG_NAME_LEN) {
LOGD("[alarm-lib]:alarmmgr_add_alarm_withcb() is called");
- if (alarm_id == NULL)
+ if (alarm_id == NULL) {
+ LOGE("alarm_id is null ");
return ERR_ALARM_INVALID_PARAM;
+ }
- if (trigger_at_time < 0)
+ if (trigger_at_time < 0) {
+ LOGE("trigger_at_time is invalid[%ld]", trigger_at_time);
return ERR_ALARM_INVALID_PARAM;
+ }
_initialize_alarm_info(&alarm_info, alarm_type, trigger_at_time, interval,
precision);
LOGD("[alarm-lib]:alarm_delete(%d) is called\n", alarm_id);
- if (alarm_id <= 0)
+ if (alarm_id <= 0) {
+ LOGE("[alarm-lib]:alarm_id is invalid[%d]\n", alarm_id);
return ERR_ALARM_INVALID_ID;
+ }
if (!_send_alarm_delete(alarm_context, alarm_id, &error_code))
return error_code;
int ret = 0;
GVariantIter *iter = NULL;
- if (fn == NULL)
+ if (fn == NULL) {
+ LOGE("fn is null.");
return ERR_ALARM_INVALID_PARAM;
+ }
ret = __sub_init();
if (ret < 0) {
LOGD("[alarm-lib]:alarm_get_info() is called\n");
- if (alarm_id < 0 || alarm_info == NULL)
+ if (alarm_id < 0 || alarm_info == NULL) {
+ LOGE("[alarm-lib]:alarm_info is null or alar_id is invalid[%d].", alarm_id);
return ERR_ALARM_INVALID_PARAM;
+ }
if (!_send_alarm_get_info(alarm_context, alarm_id, alarm_info, &error_code))
return error_code;
int error_code;
LOGD("[alarm-lib]: alarm_get_number_of_ids() is called.");
- if (num_of_ids == NULL)
+ if (num_of_ids == NULL) {
+ LOGE("[alarm-lib]:num_of_ids.");
return ERR_ALARM_INVALID_PARAM;
+ }
LOGD("call alarm_get_number_of_ids\n");
if (!_send_alarm_get_number_of_ids(alarm_context, num_of_ids, &error_code))
LOGD("[alarm-lib]:alarmmgr_get_next_duetime() is called.");
- if (duetime == NULL)
+ if (duetime == NULL) {
+ LOGE("[alarm-lib]:duetime is null.");
return ERR_ALARM_INVALID_PARAM;
+ }
if (!_send_alarm_get_next_duetime(alarm_context, alarm_id, duetime, &error_code))
return error_code;
int error_code;
LOGD("[alarm-lib]:alarmmgr_get_all_info() is called.");
- if (db_path == NULL)
+ if (db_path == NULL) {
+ LOGE("[alarm-lib]:db_path is null.");
return ERR_ALARM_INVALID_PARAM;
+ }
if (!_send_alarm_get_all_info(alarm_context, db_path, &error_code))
return error_code;
if (ret < 0)
return ret;
- if (alarm_id == NULL)
+ if (alarm_id == NULL) {
+ LOGE("[alarm-lib]:alarm_id is null.");
return ERR_ALARM_INVALID_PARAM;
+ }
if (!_send_alarm_create_periodic(alarm_context, interval, 0,
(int)method, alarm_id,
if (ret < 0)
return ret;
- if (alarm_id == NULL)
+ if (alarm_id == NULL) {
+ LOGE("[alarm-lib]:alarm_id is null.");
return ERR_ALARM_INVALID_PARAM;
+ }
if (!_send_alarm_create_periodic(alarm_context, interval, 1, 0,
alarm_id, &error_code))
int error_code;
LOGD("[alarm-lib]:alarmmgr_set_timezone() is called.");
- if (tzpath_str == NULL)
+ if (tzpath_str == NULL) {
+ LOGE("[alarm-lib]:tzpath_str is NULL\n");
return ERR_ALARM_INVALID_PARAM;
+ }
if (__sub_init() < 0)
return ERR_ALARM_SYSTEM_FAIL;
if (__sub_init() < 0)
return ERR_ALARM_SYSTEM_FAIL;
- if (global == NULL)
+ if (global == NULL) {
+ LOGE("[alarm-lib]:global is NULL\n");
return ERR_ALARM_INVALID_PARAM;
+ }
if (!_send_alarm_get_global(alarm_context, alarm_id, global, &error_code))
return error_code;
LOGD("[alarm-lib]:alarmmgr_update_alarm() is called\n");
- if (alarm == NULL)
+ if (alarm == NULL) {
+ LOGE("[alarm-lib]:alarm is NULL\n");
return ERR_ALARM_INVALID_PARAM;
+ }
alarm_info = (alarm_info_t *) alarm;
- if (alarm_info == NULL || alarm_id <= 0)
+ if (alarm_info == NULL || alarm_id <= 0) {
+ LOGE("[alarm-lib]:alarm is NULL or invalid alarm_id[%d]\n", alarm_id);
return ERR_ALARM_INVALID_PARAM;
+ }
int error_code;