From 15a63c8284b321f32bb8c210d2ff029014f21de8 Mon Sep 17 00:00:00 2001 From: Inkyun Kil Date: Wed, 21 Aug 2019 17:34:36 +0900 Subject: Simplify logs Change-Id: I711418b2e270dfddd842373805f0f8b2700a809b Signed-off-by: Inkyun Kil --- include/alarm-internal.h | 4 - lib/alarm-lib-dbus.c | 116 +++++++-------- lib/alarm-lib.c | 180 ++++++++++++------------ server/alarm-manager-db.c | 42 +++--- server/alarm-manager-dbus.c | 54 ++++--- server/alarm-manager-main.c | 2 +- server/alarm-manager-schedule.c | 46 +++--- server/alarm-manager-timer.c | 32 ++--- server/alarm-manager-util.c | 68 ++++----- server/alarm-manager.c | 304 ++++++++++++++++++++-------------------- 10 files changed, 410 insertions(+), 438 deletions(-) diff --git a/include/alarm-internal.h b/include/alarm-internal.h index 82ba453..c8f8365 100755 --- a/include/alarm-internal.h +++ b/include/alarm-internal.h @@ -199,10 +199,6 @@ int alarm_manager_alarm_set_timezone(GVariant* parameters); int alarm_manager_alarm_set_global(GVariant *parameters, uid_t uid); int alarm_manager_alarm_get_global(GVariant *parameters, gboolean *global); -#define ALARM_MGR_LOG_PRINT(FMT, ARG...) LOGD(FMT, ##ARG) -#define ALARM_MGR_EXCEPTION_PRINT(FMT, ARG...) LOGW(FMT, ##ARG) -#define ALARM_MGR_ASSERT_PRINT(FMT, ARG...) LOGE(FMT, ##ARG) - #define CHECK_NULL_STRING(x) x ? x : "null" #define STRDUP_WITH_NULLCMP(a) strcmp(a, "null") ? strdup(a) : NULL diff --git a/lib/alarm-lib-dbus.c b/lib/alarm-lib-dbus.c index 0af22bb..666a9f4 100644 --- a/lib/alarm-lib-dbus.c +++ b/lib/alarm-lib-dbus.c @@ -87,7 +87,7 @@ bool _send_alarm_create_noti(alarm_context_t context, alarm_info_t *alarm_info, *error_code = ERR_ALARM_SYSTEM_FAIL; } - ALARM_MGR_EXCEPTION_PRINT("g_dbus_proxy_call_sync() failed. alarm_id[%d],\ + LOGE("g_dbus_proxy_call_sync() failed. alarm_id[%d],\ return_code[%d].error->message is %s(%d)", *(int *)alarm_id, return_code, error->message, error->code); g_error_free(error); @@ -96,8 +96,7 @@ bool _send_alarm_create_noti(alarm_context_t context, alarm_info_t *alarm_info, g_variant_get(reply, "(ii)", alarm_id, &return_code); - ALARM_MGR_LOG_PRINT( - "alarm_create_noti() success. alarm_id[%d], return_code[%d].", + LOGD("alarm_create_noti() success. alarm_id[%d], return_code[%d].", *alarm_id, return_code); if (return_code != 0) { @@ -123,7 +122,7 @@ bool _send_alarm_create_appsvc(alarm_context_t context, alarm_info_t *alarm_info GVariant *reply = NULL; if (bundle_encode(b, &b_data, &datalen)) { - ALARM_MGR_EXCEPTION_PRINT("Unable to encode the bundle data\n"); + LOGE("Unable to encode the bundle data\n"); if (error_code) *error_code = ERR_ALARM_SYSTEM_FAIL; return false; @@ -159,7 +158,7 @@ bool _send_alarm_create_appsvc(alarm_context_t context, alarm_info_t *alarm_info *error_code = ERR_ALARM_SYSTEM_FAIL; } - ALARM_MGR_EXCEPTION_PRINT("g_dbus_proxy_call_sync() failed.\ + LOGE("g_dbus_proxy_call_sync() failed.\ alarm_id[%d], return_code[%d]. error->message is %s(%d)", *alarm_id, return_code, error->message, error->code); g_error_free(error); @@ -168,8 +167,7 @@ bool _send_alarm_create_appsvc(alarm_context_t context, alarm_info_t *alarm_info g_variant_get(reply, "(ii)", alarm_id, &return_code); - ALARM_MGR_LOG_PRINT( - "alarm_create_appsvc() success. alarm_id[%d], return_code[%d].", + LOGD("alarm_create_appsvc() success. alarm_id[%d], return_code[%d].", *alarm_id, return_code); if (return_code != 0) { @@ -197,7 +195,7 @@ bool _send_alarm_create(alarm_context_t context, alarm_info_t *alarm_info, if (context.app_service_name == NULL && strlen(dst_service_name) == 4 && strncmp(dst_service_name, "null", 4) == 0) { - ALARM_MGR_EXCEPTION_PRINT("Invalid arg. Provide valid destination or call alarmmgr_init()\n"); + LOGE("Invalid arg. Provide valid destination or call alarmmgr_init()\n"); if (error_code) *error_code = ERR_ALARM_INVALID_PARAM; return false; @@ -232,7 +230,7 @@ bool _send_alarm_create(alarm_context_t context, alarm_info_t *alarm_info, *error_code = ERR_ALARM_SYSTEM_FAIL; } - ALARM_MGR_EXCEPTION_PRINT("g_dbus_proxy_call_sync() failed.\ + LOGE("g_dbus_proxy_call_sync() failed.\ alarm_id[%d], return_code[%d]. error->message is %s(%d)", *alarm_id, return_code, error->message, error->code); g_error_free(error); @@ -242,8 +240,7 @@ bool _send_alarm_create(alarm_context_t context, alarm_info_t *alarm_info, g_variant_get(reply, "(ii)", alarm_id, return_code); - ALARM_MGR_LOG_PRINT( - "alarm_create() dbus sync success. alarm_id[%d], return_code[%d].", + LOGD("alarm_create() dbus sync success. alarm_id[%d], return_code[%d].", *alarm_id, return_code); if (return_code != 0) { @@ -267,7 +264,7 @@ bool _send_alarm_create_periodic(alarm_context_t context, int interval, int is_r GVariant *reply = NULL; if (context.app_service_name == NULL) { - ALARM_MGR_EXCEPTION_PRINT("Invalid arg. Provide valid destination or call alarmmgr_init()\n"); + LOGE("Invalid arg. Provide valid destination or call alarmmgr_init()\n"); if (error_code) *error_code = ERR_ALARM_INVALID_PARAM; return false; @@ -288,7 +285,7 @@ bool _send_alarm_create_periodic(alarm_context_t context, int interval, int is_r *error_code = ERR_ALARM_SYSTEM_FAIL; } - ALARM_MGR_EXCEPTION_PRINT("g_dbus_proxy_call_sync() failed.\ + LOGE("g_dbus_proxy_call_sync() failed.\ alarm_id[%d], return_code[%d]. error->message is %s(%d)", *(int *)alarm_id, return_code, error->message, error->code); @@ -299,8 +296,7 @@ bool _send_alarm_create_periodic(alarm_context_t context, int interval, int is_r g_variant_get(reply, "(ii)", alarm_id, &return_code); - ALARM_MGR_LOG_PRINT( - "alarm_create_periodic() dbus sync success. alarm_id[%d], return_code[%d].", + LOGD("alarm_create_periodic() dbus sync success. alarm_id[%d], return_code[%d].", *alarm_id, return_code); if (return_code != 0) { @@ -336,7 +332,7 @@ bundle *_send_alarm_get_appsvc_info(alarm_context_t context, alarm_id_t alarm_id *error_code = ERR_ALARM_SYSTEM_FAIL; } - ALARM_MGR_EXCEPTION_PRINT("g_dbus_proxy_call_sync() failed.\ + LOGE("g_dbus_proxy_call_sync() failed.\ alarm_id[%d], return_code[%d]. error->message is %s(%d)", alarm_id, return_code, error->message, error->code); @@ -347,8 +343,7 @@ bundle *_send_alarm_get_appsvc_info(alarm_context_t context, alarm_id_t alarm_id g_variant_get(reply, "(si)", &b_data, &return_code); - ALARM_MGR_LOG_PRINT( - "alarm_get_appsvc_info() dbus sync success. return_code[%d].", + LOGD("alarm_get_appsvc_info() dbus sync success. return_code[%d].", return_code); if (return_code != 0) { @@ -390,7 +385,7 @@ notification_h _send_alarm_get_noti_info(alarm_context_t context, alarm_id_t ala *error_code = ERR_ALARM_SYSTEM_FAIL; } - ALARM_MGR_EXCEPTION_PRINT("g_dbus_proxy_call_sync() failed.\ + LOGE("g_dbus_proxy_call_sync() failed.\ alarm_id[%d], return_code[%d]. error->message is %s(%d)", alarm_id, return_code, error->message, error->code); @@ -401,8 +396,7 @@ notification_h _send_alarm_get_noti_info(alarm_context_t context, alarm_id_t ala g_variant_get(reply, "(si)", ¬i_data, &return_code); - ALARM_MGR_LOG_PRINT( - "alarm_get_noti_info() dbus sync success. return_code[%d].", + LOGD("alarm_get_noti_info() dbus sync success. return_code[%d].", return_code); if (return_code != 0) { @@ -451,7 +445,7 @@ bool _send_alarm_set_rtc_time(alarm_context_t context, alarm_date_t *time, int * *error_code = ERR_ALARM_SYSTEM_FAIL; } - ALARM_MGR_EXCEPTION_PRINT("g_dbus_proxy_call_sync() failed.\ + LOGE("g_dbus_proxy_call_sync() failed.\ return_code[%d]. error->message is %s(%d)", return_code, error->message, error->code); @@ -462,8 +456,7 @@ bool _send_alarm_set_rtc_time(alarm_context_t context, alarm_date_t *time, int * g_variant_get(reply, "(i)", &return_code); - ALARM_MGR_LOG_PRINT( - "alarm_set_rtc_time() dbus sync success. return_code[%d].", + LOGD("alarm_set_rtc_time() dbus sync success. return_code[%d].", return_code); if (return_code != 0) { @@ -497,7 +490,7 @@ bool _send_alarm_delete(alarm_context_t context, alarm_id_t alarm_id, int *error *error_code = ERR_ALARM_SYSTEM_FAIL; } - ALARM_MGR_EXCEPTION_PRINT("g_dbus_proxy_call_sync() failed.\ + LOGE("g_dbus_proxy_call_sync() failed.\ alarm_id[%d], return_code[%d]. error->message is %s(%d)", alarm_id, return_code, error->message, error->code); @@ -508,8 +501,7 @@ bool _send_alarm_delete(alarm_context_t context, alarm_id_t alarm_id, int *error g_variant_get(reply, "(i)", &return_code); - ALARM_MGR_LOG_PRINT( - "alarm_delete() dbus sync success. return_code[%d].", + LOGD("alarm_delete() dbus sync success. return_code[%d].", return_code); if (return_code != 0) { @@ -540,7 +532,7 @@ bool _send_alarm_delete_all(alarm_context_t context, int *error_code) *error_code = ERR_ALARM_SYSTEM_FAIL; } - ALARM_MGR_EXCEPTION_PRINT("g_dbus_proxy_call_sync() failed.\ + LOGE("g_dbus_proxy_call_sync() failed.\ return_code[%d]. error->message is %s(%d)", return_code, error->message, error->code); @@ -550,8 +542,7 @@ bool _send_alarm_delete_all(alarm_context_t context, int *error_code) g_variant_get(reply, "(i)", &return_code); - ALARM_MGR_LOG_PRINT( - "alarm_delete_all() dbus sync success. return_code[%d].", + LOGD("alarm_delete_all() dbus sync success. return_code[%d].", return_code); if (return_code != 0) { @@ -588,7 +579,7 @@ bool _send_alarm_get_list_of_ids(alarm_context_t context, int maxnum_of_ids, else *error_code = ERR_ALARM_SYSTEM_FAIL; } - ALARM_MGR_EXCEPTION_PRINT("g_dbus_proxy_call_sync() failed.\ + LOGE("g_dbus_proxy_call_sync() failed.\ return_code[%d]. error->message is %s(%d)", return_code, error->message, error->code); @@ -600,8 +591,7 @@ bool _send_alarm_get_list_of_ids(alarm_context_t context, int maxnum_of_ids, g_variant_get(reply, "(@aiii)", &arr, num_of_ids, &return_code); g_variant_get(arr, "ai", &iter_temp); - ALARM_MGR_LOG_PRINT( - "alarm_get_list_of_ids() dbus sync success. return_code[%d].", + LOGD("alarm_get_list_of_ids() dbus sync success. return_code[%d].", return_code); if (return_code != 0) { @@ -636,7 +626,7 @@ bool _send_alarm_get_number_of_ids(alarm_context_t context, int *num_of_ids, *error_code = ERR_ALARM_SYSTEM_FAIL; } - ALARM_MGR_EXCEPTION_PRINT("g_dbus_proxy_call_sync() failed.\ + LOGE("g_dbus_proxy_call_sync() failed.\ return_code[%d]. error->message is %s(%d)", return_code, error->message, error->code); @@ -646,8 +636,7 @@ bool _send_alarm_get_number_of_ids(alarm_context_t context, int *num_of_ids, g_variant_get(reply, "(ii)", num_of_ids, &return_code); - ALARM_MGR_LOG_PRINT( - "alarm_get_number_of_ids() dbus sync success.\ + LOGD("alarm_get_number_of_ids() dbus sync success.\ num_of_ids[%d] return_code[%d].", *num_of_ids, return_code); @@ -683,7 +672,7 @@ bool _send_alarm_get_info(alarm_context_t context, alarm_id_t alarm_id, *error_code = ERR_ALARM_SYSTEM_FAIL; } - ALARM_MGR_EXCEPTION_PRINT("g_dbus_proxy_call_sync() failed.\ + LOGE("g_dbus_proxy_call_sync() failed.\ alarm_id [%d] return_code[%d]. error->message is %s(%d)", alarm_id, return_code, error->message, error->code); @@ -707,8 +696,7 @@ bool _send_alarm_get_info(alarm_context_t context, alarm_id_t alarm_id, &alarm_info->reserved_info, &return_code); - ALARM_MGR_LOG_PRINT( - "alarm_get_info() dbus sync success. return_code[%d].", + LOGD("alarm_get_info() dbus sync success. return_code[%d].", return_code); if (return_code != 0) { @@ -744,7 +732,7 @@ bool _send_alarm_get_next_duetime(alarm_context_t context, alarm_id_t alarm_id, *error_code = ERR_ALARM_SYSTEM_FAIL; } - ALARM_MGR_EXCEPTION_PRINT("g_dbus_proxy_call_sync() failed.\ + LOGE("g_dbus_proxy_call_sync() failed.\ alarm_id [%d] return_code[%d]. error->message is %s(%d)", alarm_id, return_code, error->message, error->code); @@ -754,8 +742,7 @@ bool _send_alarm_get_next_duetime(alarm_context_t context, alarm_id_t alarm_id, g_variant_get(reply, "(ii)", &_duetime, &return_code); - ALARM_MGR_LOG_PRINT( - "alarm_get_next_duetime() dbus sync success. return_code[%d].", + LOGD("alarm_get_next_duetime() dbus sync success. return_code[%d].", return_code); if (return_code != 0) { @@ -788,7 +775,7 @@ bool _send_alarm_get_all_info(alarm_context_t context, char **db_path, int *erro *error_code = ERR_ALARM_SYSTEM_FAIL; } - ALARM_MGR_EXCEPTION_PRINT("g_dbus_proxy_call_sync() failed.\ + LOGE("g_dbus_proxy_call_sync() failed.\ return_code[%d]. error->message is %s(%d)", return_code, error->message, error->code); @@ -798,8 +785,7 @@ bool _send_alarm_get_all_info(alarm_context_t context, char **db_path, int *erro g_variant_get(reply, "(si)", &_db_path, &return_code); - ALARM_MGR_LOG_PRINT( - "alarm_get_all_info() dbus sync success. db_path[%s] return_code[%d].", + LOGD("alarm_get_all_info() dbus sync success. db_path[%s] return_code[%d].", *db_path, return_code); if (return_code != ALARMMGR_RESULT_SUCCESS) { @@ -830,7 +816,7 @@ bool _send_alarm_set_time(alarm_context_t context, int new_time, int *error_code if (error_code) *error_code = ERR_ALARM_SYSTEM_FAIL; - ALARM_MGR_EXCEPTION_PRINT("g_dbus_proxy_call_sync() failed.\ + LOGE("g_dbus_proxy_call_sync() failed.\ return_code[%d]. error->message is %s(%d)", return_code, error->message, error->code); @@ -840,8 +826,7 @@ bool _send_alarm_set_time(alarm_context_t context, int new_time, int *error_code g_variant_get(reply, "(i)", &return_code); - ALARM_MGR_LOG_PRINT( - "alarm_set_time() dbus sync success. return_code[%d].", + LOGD("alarm_set_time() dbus sync success. return_code[%d].", return_code); if (return_code != ALARMMGR_RESULT_SUCCESS) { @@ -866,13 +851,12 @@ static void _alarm_set_time_cb(GObject *source_object, GAsyncResult *res, reply = g_dbus_proxy_call_finish(func_data->proxy, res, &error); if (error) { - ALARM_MGR_EXCEPTION_PRINT("dbus error message: %s", error->message); + LOGE("dbus error message: %s", error->message); g_error_free(error); return_code = ERR_ALARM_SYSTEM_FAIL; } else { g_variant_get(reply, "(i)", &return_code); - ALARM_MGR_LOG_PRINT( - "alarm_set_time_async() dbus success. return_code[%d].", + LOGD("alarm_set_time_async() dbus success. return_code[%d].", return_code); } @@ -924,7 +908,7 @@ bool _send_alarm_set_time_with_propagation_delay(alarm_context_t context, unsign *error_code = ERR_ALARM_SYSTEM_FAIL; } - ALARM_MGR_EXCEPTION_PRINT("g_dbus_proxy_call_sync() failed.\ + LOGE("g_dbus_proxy_call_sync() failed.\ return_code[%d]. error->message is %s(%d)", return_code, error->message, error->code); @@ -934,8 +918,7 @@ bool _send_alarm_set_time_with_propagation_delay(alarm_context_t context, unsign g_variant_get(reply, "(i)", &return_code); - ALARM_MGR_LOG_PRINT( - "alarm_set_time_with_propagation_delay dbus sync() success.\ + LOGD("alarm_set_time_with_propagation_delay dbus sync() success.\ return_code[%d]", return_code); if (return_code != ALARMMGR_RESULT_SUCCESS) { @@ -960,14 +943,13 @@ static void _alarm_set_time_with_delay_cb(GObject *source_object, GAsyncResult * reply = g_dbus_proxy_call_finish(func_data->proxy, res, &error); if (error) { - ALARM_MGR_EXCEPTION_PRINT("dbus error message: %s", error->message); + LOGE("dbus error message: %s", error->message); g_error_free(error); return_code = ERR_ALARM_SYSTEM_FAIL; } else { g_variant_get(reply, "(i)", &return_code); - ALARM_MGR_LOG_PRINT( - "alarm_set_time_with_propagation_delay_async() dbus success.\ + LOGD("alarm_set_time_with_propagation_delay_async() dbus success.\ return_code[%d].", return_code); } @@ -1019,7 +1001,7 @@ bool _send_alarm_set_timezone(alarm_context_t context, char *tzpath_str, int *er *error_code = ERR_ALARM_SYSTEM_FAIL; } - ALARM_MGR_EXCEPTION_PRINT("g_dbus_proxy_call_sync() failed.\ + LOGE("g_dbus_proxy_call_sync() failed.\ return_code[%d]. error->message is %s(%d)", return_code, error->message, error->code); @@ -1029,8 +1011,7 @@ bool _send_alarm_set_timezone(alarm_context_t context, char *tzpath_str, int *er g_variant_get(reply, "(i)", &return_code); - ALARM_MGR_LOG_PRINT( - "alarm_set_timezon dbus sync() success. tz_path[%s] return_code[%d]", + LOGD("alarm_set_timezon dbus sync() success. tz_path[%s] return_code[%d]", tzpath_str, return_code); if (return_code != ALARMMGR_RESULT_SUCCESS) { @@ -1064,7 +1045,7 @@ bool _send_alarm_set_global(alarm_context_t context, const alarm_id_t alarm_id, *error_code = ERR_ALARM_SYSTEM_FAIL; } - ALARM_MGR_EXCEPTION_PRINT("g_dbus_proxy_call_sync() failed.\ + LOGE("g_dbus_proxy_call_sync() failed.\ alarm_id[%d] return_code[%d]. error->message is %s(%d)", alarm_id, return_code, error->message, error->code); @@ -1074,8 +1055,7 @@ bool _send_alarm_set_global(alarm_context_t context, const alarm_id_t alarm_id, g_variant_get(reply, "(i)", &return_code); - ALARM_MGR_LOG_PRINT( - "alarm_set_global dbus sync() success. alarm_id[%d], global[%d]\ + LOGD("alarm_set_global dbus sync() success. alarm_id[%d], global[%d]\ return_code[%d]", alarm_id, global, return_code); if (return_code != ALARMMGR_RESULT_SUCCESS) { @@ -1109,7 +1089,7 @@ bool _send_alarm_get_global(alarm_context_t context, const alarm_id_t alarm_id, *error_code = ERR_ALARM_SYSTEM_FAIL; } - ALARM_MGR_EXCEPTION_PRINT("g_dbus_proxy_call_sync() failed.\ + LOGE("g_dbus_proxy_call_sync() failed.\ alarm_id[%d] return_code[%d]. error->message is %s(%d)", alarm_id, return_code, error->message, error->code); @@ -1119,8 +1099,7 @@ bool _send_alarm_get_global(alarm_context_t context, const alarm_id_t alarm_id, g_variant_get(reply, "(bi)", global, &return_code); - ALARM_MGR_LOG_PRINT( - "alarm_get_global dbus sync() success. alarm_id[%d], global[%d]\ + LOGD("alarm_get_global dbus sync() success. alarm_id[%d], global[%d]\ return_code[%d]", alarm_id, *global, return_code); if (return_code != 0) { @@ -1170,7 +1149,7 @@ bool _send_alarm_update(alarm_context_t context, alarm_id_t alarm_id, *error_code = ERR_ALARM_SYSTEM_FAIL; } - ALARM_MGR_EXCEPTION_PRINT("g_dbus_proxy_call_sync() failed.\ + LOGE("g_dbus_proxy_call_sync() failed.\ alarm_id[%d] return_code[%d]. error->message is %s(%d)", alarm_id, return_code, error->message, error->code); @@ -1180,8 +1159,7 @@ bool _send_alarm_update(alarm_context_t context, alarm_id_t alarm_id, g_variant_get(reply, "(i)", &return_code); - ALARM_MGR_LOG_PRINT( - "alarm_update dbus sync() success. alarm_id[%d], return_code[%d]",\ + LOGD("alarm_update dbus sync() success. alarm_id[%d], return_code[%d]", alarm_id, return_code); if (return_code != 0) { diff --git a/lib/alarm-lib.c b/lib/alarm-lib.c index 95a15a8..22aa833 100755 --- a/lib/alarm-lib.c +++ b/lib/alarm-lib.c @@ -142,7 +142,7 @@ void _initialize_alarm_info(alarm_info_t *alarm_info, int alarm_type, alarm_info->msec = precision ? (int)current_time.tv_usec / 1000 : 0; - ALARM_MGR_LOG_PRINT("trigger_at_time(%ld), start(%d-%d-%d, %02d:%02d:%02d),\ + LOGD("trigger_at_time(%ld), start(%d-%d-%d, %02d:%02d:%02d),\ repeat(%d), interval(%d), type(%d)", trigger_at_time, alarm_info->start.day, alarm_info->start.month, alarm_info->start.year, alarm_info->start.hour, @@ -173,7 +173,7 @@ static alarm_cb_info_t *__find_resultcb(alarm_id_t alarm_id) tmp = alarmcb_head; while (tmp) { if (tmp->alarm_id == alarm_id) { - ALARM_MGR_LOG_PRINT("matched alarm id = %d", alarm_id); + LOGD("matched alarm id = %d", alarm_id); return tmp; } tmp = tmp->next; @@ -230,7 +230,7 @@ static void __handle_expiry_method_call(GDBusConnection *conn, int msec; g_variant_get(param, "(ii&s)", &alarm_id, &msec, &package_name); - ALARM_MGR_LOG_PRINT("[alarm-lib] : Alarm expired for [%s] : Alarm id [%d]", package_name, alarm_id); + LOGD("[alarm-lib] : Alarm expired for [%s] : Alarm id [%d]", package_name, alarm_id); if (alarm_context.alarm_handler != NULL) { if (msec > 0) { @@ -262,7 +262,7 @@ static void __handle_expiry_method_call(GDBusConnection *conn, info->cb_func(alarm_id, info->priv_data); } } else { - ALARM_MGR_EXCEPTION_PRINT("[alarm-lib] Call expired callback"); + LOGW("[alarm-lib] Call expired callback"); info->cb_func(alarm_id, info->priv_data); } } @@ -352,7 +352,7 @@ static int __alarm_context_init() NULL); if (alarm_context.proxy == NULL) { - ALARM_MGR_EXCEPTION_PRINT("Creating a proxy is failed."); + LOGE("Creating a proxy is failed."); g_object_unref(alarm_context.connection); return ERR_ALARM_SYSTEM_FAIL; } @@ -372,7 +372,7 @@ static void __bus_get_for_async_api(GObject *source_object, GAsyncResult *res, alarm_context.connection = g_bus_get_finish(res, &error); if (!alarm_context.connection) { - ALARM_MGR_EXCEPTION_PRINT("dbus error message: %s", error->message); + LOGE("dbus error message: %s", error->message); g_error_free(error); g_variant_unref(param->v); g_free(param); @@ -429,7 +429,7 @@ static int __sub_init() alarm_context.connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); if (alarm_context.connection == NULL) { - ALARM_MGR_EXCEPTION_PRINT("g_bus_get_sync() is failed. error: %s", error->message); + LOGE("g_bus_get_sync() is failed. error: %s", error->message); g_error_free(error); pthread_mutex_unlock(&init_lock); return ERR_ALARM_SYSTEM_FAIL; @@ -449,15 +449,15 @@ static int __compare_api_version(int *result, uid_t uid) char *pkg_version; if (aul_app_get_pkgid_bypid_for_uid(getpid(), pkgid, sizeof(pkgid), uid) != AUL_R_OK) { - ALARM_MGR_EXCEPTION_PRINT("aul_app_get_pkgid_bypid() is failed. PID %d may not be app.", getpid()); + LOGE("aul_app_get_pkgid_bypid() is failed. PID %d may not be app.", getpid()); } else { ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &pkginfo); if (ret != PMINFO_R_OK) { - ALARM_MGR_EXCEPTION_PRINT("Failed to get pkginfo\n"); + LOGE("Failed to get pkginfo\n"); } else { ret = pkgmgrinfo_pkginfo_get_api_version(pkginfo, &pkg_version); if (ret != PMINFO_R_OK) - ALARM_MGR_EXCEPTION_PRINT("Failed to check api version [%d]\n", ret); + LOGE("Failed to check api version [%d]\n", ret); *result = strverscmp(pkg_version, "2.4"); pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo); @@ -517,7 +517,7 @@ EXPORT_API int alarmmgr_init(const char *appid) introspection_data = g_dbus_node_info_new_for_xml(introspection_xml, NULL); if (introspection_data == NULL) { - ALARM_MGR_EXCEPTION_PRINT("g_dbus_node_info_new_for_xml() is failed."); + LOGE("g_dbus_node_info_new_for_xml() is failed."); goto error; } @@ -527,7 +527,7 @@ EXPORT_API int alarmmgr_init(const char *appid) introspection_data->interfaces[0], &interface_vtable, NULL, NULL, NULL); if (registration_id == 0) { - ALARM_MGR_EXCEPTION_PRINT("Registering the callback is failed."); + LOGE("Registering the callback is failed."); goto error; } @@ -536,7 +536,7 @@ EXPORT_API int alarmmgr_init(const char *appid) service_name_mod, G_BUS_NAME_OWNER_FLAGS_NONE, NULL, NULL, NULL, NULL); if (owner_id == 0) { - ALARM_MGR_EXCEPTION_PRINT("Acquiring the own name is failed. %s", service_name_mod); + LOGE("Acquiring the own name is failed. %s", service_name_mod); goto error; } @@ -621,7 +621,7 @@ EXPORT_API int alarmmgr_set_cb(alarm_cb_t handler, void *user_param) SECURE_LOGD("Enter"); if (handler == NULL) { - ALARM_MGR_EXCEPTION_PRINT("callback is NULL."); + LOGE("callback is NULL."); return ERR_ALARM_INVALID_PARAM; } alarm_context.alarm_handler = handler; @@ -684,12 +684,12 @@ EXPORT_API int alarmmgr_set_time(alarm_entry_t *alarm, alarm_date_t time) alarm_info = (alarm_info_t *)alarm; if (!__alarm_validate_date(&time, &error_code)) { - ALARM_MGR_EXCEPTION_PRINT("start date error\n"); + LOGE("start date error\n"); return error_code; } if (!__alarm_validate_time(&time, &error_code)) { - ALARM_MGR_EXCEPTION_PRINT("start time error\n"); + LOGE("start time error\n"); return error_code; } @@ -778,7 +778,7 @@ EXPORT_API int alarmmgr_get_type(const alarm_entry_t *alarm, int *alarm_type) static int __alarmmgr_init_appsvc(void) { if (b_initialized) { - ALARM_MGR_EXCEPTION_PRINT("alarm was already initialized."); + LOGW("alarm was already initialized."); return ALARMMGR_RESULT_SUCCESS; } @@ -802,7 +802,7 @@ EXPORT_API void *alarmmgr_get_alarm_appsvc_info(alarm_id_t alarm_id, int *return return NULL; } - ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_get_alarm_appsvc_info() is called."); + LOGD("[alarm-lib]:alarmmgr_get_alarm_appsvc_info() is called."); if (alarm_id <= 0) { if (return_code) @@ -822,7 +822,7 @@ EXPORT_API int alarmmgr_get_alarm_noti_info(alarm_id_t alarm_id, notification_h if (ret < 0) return ret; - ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_get_alarm_appsvc_info() is called."); + LOGD("[alarm-lib]:alarmmgr_get_alarm_appsvc_info() is called."); if (alarm_id <= 0) return ERR_ALARM_INVALID_ID; @@ -839,7 +839,7 @@ EXPORT_API int alarmmgr_set_rtc_time(alarm_date_t *time) int error_code = 0; if (!time) { - ALARM_MGR_EXCEPTION_PRINT("Invalid parameter time\n"); + LOGE("Invalid parameter time\n"); return ERR_ALARM_INVALID_PARAM; } @@ -847,15 +847,15 @@ EXPORT_API int alarmmgr_set_rtc_time(alarm_date_t *time) if (ret < 0) return ret; - ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_set_rtc_time() is called\n"); + LOGD("[alarm-lib]:alarmmgr_set_rtc_time() is called\n"); if (!__alarm_validate_date(time, &error_code)) { - ALARM_MGR_EXCEPTION_PRINT("RTC date error\n"); + LOGE("RTC date error\n"); return error_code; } if (!__alarm_validate_time(time, &error_code)) { - ALARM_MGR_EXCEPTION_PRINT("RTC time error\n"); + LOGE("RTC time error\n"); return error_code; } @@ -876,14 +876,14 @@ EXPORT_API int alarmmgr_add_alarm_appsvc_with_localtime(alarm_entry_t *alarm, vo const char *appid = NULL; bundle *b; - ALARM_MGR_LOG_PRINT("[alarm-lib]:alarm_create() is called\n"); + LOGD("[alarm-lib]:alarm_create() is called\n"); if (alarm == NULL) return ERR_ALARM_INVALID_PARAM; b = (bundle *)bundle_data; if (b == NULL) { - ALARM_MGR_EXCEPTION_PRINT("Invalid parameter bundle\n"); + LOGE("Invalid parameter bundle\n"); return ERR_ALARM_INVALID_PARAM; } @@ -892,7 +892,7 @@ EXPORT_API int alarmmgr_add_alarm_appsvc_with_localtime(alarm_entry_t *alarm, vo appsvc_set_operation(b, APPSVC_OPERATION_DEFAULT); if (__alarmmgr_init_appsvc() < 0) { - ALARM_MGR_EXCEPTION_PRINT("Unable to initialize dbus!!!\n"); + LOGE("Unable to initialize dbus!!!\n"); return ERR_ALARM_SYSTEM_FAIL; } @@ -900,17 +900,17 @@ EXPORT_API int alarmmgr_add_alarm_appsvc_with_localtime(alarm_entry_t *alarm, vo appid = appsvc_get_appid(b); if ((appid == NULL && (alarm_info->alarm_type & ALARM_TYPE_NOLAUNCH)) || (appid == NULL && operation && !strcmp(operation, APPSVC_OPERATION_DEFAULT))) { - ALARM_MGR_EXCEPTION_PRINT("Invalid parameter\n"); + LOGE("Invalid parameter\n"); return ERR_ALARM_INVALID_PARAM; } if (alarm_info == NULL || alarm_id == NULL) { - ALARM_MGR_EXCEPTION_PRINT("Invalid parameter\n"); + LOGE("Invalid parameter\n"); return ERR_ALARM_INVALID_PARAM; } alarm_mode_t *mode = &alarm_info->mode; - ALARM_MGR_EXCEPTION_PRINT("start(%d-%d-%d, %02d:%02d:%02d), end(%d-%d-%d), repeat(%d), interval(%d), type(%d)", + LOGW("start(%d-%d-%d, %02d:%02d:%02d), end(%d-%d-%d), repeat(%d), interval(%d), type(%d)", alarm_info->start.day, alarm_info->start.month, alarm_info->start.year, alarm_info->start.hour, alarm_info->start.min, alarm_info->start.sec, alarm_info->end.year, alarm_info->end.month, alarm_info->end.day, @@ -921,17 +921,17 @@ EXPORT_API int alarmmgr_add_alarm_appsvc_with_localtime(alarm_entry_t *alarm, vo return ERR_ALARM_INVALID_PARAM; if (!__alarm_validate_date(&alarm_info->start, &error_code)) { - ALARM_MGR_EXCEPTION_PRINT("start date error\n"); + LOGE("start date error\n"); return error_code; } if (!__alarm_validate_time(&alarm_info->start, &error_code)) { - ALARM_MGR_EXCEPTION_PRINT("start time error\n"); + LOGE("start time error\n"); return error_code; } if (!__alarm_validate_date(&alarm_info->end, &error_code)) { - ALARM_MGR_EXCEPTION_PRINT("end date error\n"); + LOGE("end date error\n"); return error_code; } @@ -952,7 +952,7 @@ EXPORT_API int alarmmgr_add_alarm_with_localtime(alarm_entry_t *alarm, int i = 0; int j = 0; - ALARM_MGR_LOG_PRINT("[alarm-lib]:alarm_create() is called\n"); + LOGD("[alarm-lib]:alarm_create() is called\n"); if (alarm == NULL) return ERR_ALARM_INVALID_PARAM; @@ -968,7 +968,7 @@ EXPORT_API int alarmmgr_add_alarm_with_localtime(alarm_entry_t *alarm, if (ret < 0) return ret; - ALARM_MGR_LOG_PRINT("start(%d-%d-%d, %02d:%02d:%02d), end(%d-%d-%d), repeat(%d), interval(%d), type(%d)", + LOGD("start(%d-%d-%d, %02d:%02d:%02d), end(%d-%d-%d), repeat(%d), interval(%d), type(%d)", alarm_info->start.day, alarm_info->start.month, alarm_info->start.year, alarm_info->start.hour, alarm_info->start.min, alarm_info->start.sec, alarm_info->end.year, alarm_info->end.month, alarm_info->end.day, @@ -979,23 +979,23 @@ EXPORT_API int alarmmgr_add_alarm_with_localtime(alarm_entry_t *alarm, return ERR_ALARM_INVALID_PARAM; if (destination && strlen(destination) >= MAX_PKG_NAME_LEN) { - ALARM_MGR_EXCEPTION_PRINT("[alarm-lib]: destination name is too long!\n"); + LOGE("[alarm-lib]: destination name is too long!\n"); return ERR_ALARM_INVALID_PARAM; } if (!__alarm_validate_date(&alarm_info->start, &error_code)) { - ALARM_MGR_EXCEPTION_PRINT("start date error\n"); + LOGE("start date error\n"); return error_code; } if (!__alarm_validate_time(&alarm_info->start, &error_code)) { - ALARM_MGR_EXCEPTION_PRINT("start time error\n"); + LOGE("start time error\n"); return error_code; } if (!__alarm_validate_date(&alarm_info->end, &error_code)) { - ALARM_MGR_EXCEPTION_PRINT("end date error\n"); + LOGE("end date error\n"); return error_code; } @@ -1033,19 +1033,19 @@ EXPORT_API int alarmmgr_add_alarm_noti_with_localtime(alarm_entry_t *alarm, noti return ERR_ALARM_INVALID_PARAM; if (__alarmmgr_init_appsvc() < 0) { - ALARM_MGR_EXCEPTION_PRINT("Unable to initialize dbus!!!\n"); + LOGE("Unable to initialize dbus!!!\n"); return ERR_ALARM_SYSTEM_FAIL; } alarm_info = (alarm_info_t *)alarm; if (alarm_info == NULL || alarm_id == NULL) { - ALARM_MGR_EXCEPTION_PRINT("Invalid parameter\n"); + LOGE("Invalid parameter\n"); return ERR_ALARM_INVALID_PARAM; } alarm_mode_t *mode = &alarm_info->mode; - ALARM_MGR_EXCEPTION_PRINT("start(%d-%d-%d, %02d:%02d:%02d), end(%d-%d-%d), repeat(%d), interval(%d), type(%d)", + LOGW("start(%d-%d-%d, %02d:%02d:%02d), end(%d-%d-%d), repeat(%d), interval(%d), type(%d)", alarm_info->start.day, alarm_info->start.month, alarm_info->start.year, alarm_info->start.hour, alarm_info->start.min, alarm_info->start.sec, alarm_info->end.year, alarm_info->end.month, alarm_info->end.day, @@ -1056,17 +1056,17 @@ EXPORT_API int alarmmgr_add_alarm_noti_with_localtime(alarm_entry_t *alarm, noti return ERR_ALARM_INVALID_PARAM; if (!__alarm_validate_date(&alarm_info->start, &error_code)) { - ALARM_MGR_EXCEPTION_PRINT("start date error\n"); + LOGE("start date error\n"); return error_code; } if (!__alarm_validate_time(&alarm_info->start, &error_code)) { - ALARM_MGR_EXCEPTION_PRINT("start time error\n"); + LOGE("start time error\n"); return error_code; } if (!__alarm_validate_date(&alarm_info->end, &error_code)) { - ALARM_MGR_EXCEPTION_PRINT("end date error\n"); + LOGE("end date error\n"); return error_code; } @@ -1087,11 +1087,11 @@ EXPORT_API int alarmmgr_add_alarm_appsvc(int alarm_type, time_t trigger_at_time, const char *appid = NULL; bundle *b; - ALARM_MGR_LOG_PRINT("[alarm-lib]:alarm_create() is called\n"); + LOGD("[alarm-lib]:alarm_create() is called\n"); b = (bundle *)bundle_data; if (b == NULL) { - ALARM_MGR_EXCEPTION_PRINT("Invalid parameter bundle\n"); + LOGE("Invalid parameter bundle\n"); return ERR_ALARM_INVALID_PARAM; } @@ -1103,12 +1103,12 @@ EXPORT_API int alarmmgr_add_alarm_appsvc(int alarm_type, time_t trigger_at_time, if ((appid == NULL && (alarm_type & ALARM_TYPE_NOLAUNCH)) || (appid == NULL && operation && !strcmp(operation, APPSVC_OPERATION_DEFAULT))) { - ALARM_MGR_EXCEPTION_PRINT("Invalid parameter\n"); + LOGE("Invalid parameter\n"); return ERR_ALARM_INVALID_PARAM; } if (__alarmmgr_init_appsvc() < 0) { - ALARM_MGR_EXCEPTION_PRINT("Unable to initialize dbus!!!\n"); + LOGE("Unable to initialize dbus!!!\n"); return ERR_ALARM_SYSTEM_FAIL; } @@ -1122,7 +1122,7 @@ EXPORT_API int alarmmgr_add_alarm_appsvc(int alarm_type, time_t trigger_at_time, false); alarm_info.alarm_type |= ALARM_TYPE_RELATIVE; - ALARM_MGR_LOG_PRINT("alarm_info.type : %d", alarm_info.alarm_type); + LOGD("alarm_info.type : %d", alarm_info.alarm_type); if (__compare_api_version(&result, getuid()) < 0) return ERR_ALARM_SYSTEM_FAIL; @@ -1139,7 +1139,7 @@ EXPORT_API int alarmmgr_add_alarm_appsvc(int alarm_type, time_t trigger_at_time, return error_code; - ALARM_MGR_LOG_PRINT("alarm_id : %d", *alarm_id); + LOGD("alarm_id : %d", *alarm_id); return ALARMMGR_RESULT_SUCCESS; } @@ -1152,7 +1152,7 @@ EXPORT_API int alarmmgr_add_alarm_noti(int alarm_type, time_t trigger_at_time, alarm_info_t alarm_info; if (__alarmmgr_init_appsvc() < 0) { - ALARM_MGR_EXCEPTION_PRINT("Unable to initialize dbus!!!\n"); + LOGE("Unable to initialize dbus!!!\n"); return ERR_ALARM_SYSTEM_FAIL; } @@ -1166,7 +1166,7 @@ EXPORT_API int alarmmgr_add_alarm_noti(int alarm_type, time_t trigger_at_time, false); alarm_info.alarm_type |= ALARM_TYPE_RELATIVE; - ALARM_MGR_LOG_PRINT("alarm_info.type : %d", alarm_info.alarm_type); + LOGD("alarm_info.type : %d", alarm_info.alarm_type); if ((alarm_info.alarm_type & ALARM_TYPE_INEXACT) && alarm_info.mode.u_interval.interval < MIN_INEXACT_INTERVAL) @@ -1202,7 +1202,7 @@ static int _alarmmgr_add_alarm(int alarm_type, return ERR_ALARM_INVALID_PARAM; if (destination && strlen(destination) >= MAX_PKG_NAME_LEN) { - ALARM_MGR_EXCEPTION_PRINT("[alarm-lib]: destination name is too long!\n"); + LOGE("[alarm-lib]: destination name is too long!\n"); return ERR_ALARM_INVALID_PARAM; } @@ -1211,7 +1211,7 @@ static int _alarmmgr_add_alarm(int alarm_type, alarm_info.alarm_type |= ALARM_TYPE_RELATIVE; - ALARM_MGR_LOG_PRINT("alarm_info.type : %d", alarm_info.alarm_type); + LOGD("alarm_info.type : %d", alarm_info.alarm_type); if (destination != NULL) { memset(dst_service_name, 0, @@ -1272,9 +1272,9 @@ static int _alarmmgr_add_alarm_withcb(int alarm_type, time_t trigger_at_time, if (flag_appid_checked == 0) { if (aul_app_get_appid_bypid(getpid(), g_appid, sizeof(g_appid)) != AUL_R_OK) - ALARM_MGR_EXCEPTION_PRINT("PID[%d] may not be app. Please call alarmmgr_init(caller name) in advance.", getpid()); + LOGE("PID[%d] may not be app. Please call alarmmgr_init(caller name) in advance.", getpid()); else - ALARM_MGR_LOG_PRINT("Get appid only once. appid[%s]", g_appid); + LOGD("Get appid only once. appid[%s]", g_appid); flag_appid_checked = 1; } @@ -1282,7 +1282,7 @@ static int _alarmmgr_add_alarm_withcb(int alarm_type, time_t trigger_at_time, if (ret < 0) return ret; - ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_add_alarm_withcb() is called"); + LOGD("[alarm-lib]:alarmmgr_add_alarm_withcb() is called"); if (alarm_id == NULL) return ERR_ALARM_INVALID_PARAM; @@ -1296,7 +1296,7 @@ static int _alarmmgr_add_alarm_withcb(int alarm_type, time_t trigger_at_time, alarm_info.alarm_type |= ALARM_TYPE_RELATIVE; alarm_info.alarm_type |= ALARM_TYPE_WITHCB; - ALARM_MGR_LOG_PRINT("alarm_info.type : %d", alarm_info.alarm_type); + LOGD("alarm_info.type : %d", alarm_info.alarm_type); if (!_send_alarm_create(alarm_context, &alarm_info, alarm_id, "null", "null", &error_code)) return error_code; @@ -1330,7 +1330,7 @@ EXPORT_API int alarmmgr_remove_alarm(alarm_id_t alarm_id) if (ret < 0) return ret; - ALARM_MGR_LOG_PRINT("[alarm-lib]:alarm_delete(%d) is called\n", alarm_id); + LOGD("[alarm-lib]:alarm_delete(%d) is called\n", alarm_id); if (alarm_id <= 0) return ERR_ALARM_INVALID_ID; @@ -1373,20 +1373,20 @@ EXPORT_API int alarmmgr_enum_alarm_ids(alarm_enum_fn_t fn, void *user_param) ret = __sub_init(); if (ret < 0) { - ALARM_MGR_EXCEPTION_PRINT("__sub_init() is failed."); + LOGE("__sub_init() is failed."); return ret; } if (!_send_alarm_get_number_of_ids(alarm_context, &maxnum_of_ids, &return_code)) return return_code; - ALARM_MGR_LOG_PRINT("maxnum_of_ids[%d]", maxnum_of_ids); + LOGD("maxnum_of_ids[%d]", maxnum_of_ids); if (!_send_alarm_get_list_of_ids(alarm_context, maxnum_of_ids, &iter, &num_of_ids, &return_code)) return return_code; while (g_variant_iter_loop(iter, "i", &alarm_id)) { - ALARM_MGR_LOG_PRINT("alarm_id (%d)", alarm_id); + LOGD("alarm_id (%d)", alarm_id); (*fn)(alarm_id, user_param); } g_variant_iter_free(iter); @@ -1404,7 +1404,7 @@ EXPORT_API int alarmmgr_get_info(alarm_id_t alarm_id, alarm_entry_t *alarm) if (ret < 0) return ret; - ALARM_MGR_LOG_PRINT("[alarm-lib]:alarm_get_info() is called\n"); + LOGD("[alarm-lib]:alarm_get_info() is called\n"); if (alarm_id < 0 || alarm_info == NULL) return ERR_ALARM_INVALID_PARAM; @@ -1418,12 +1418,12 @@ EXPORT_API int alarmmgr_get_info(alarm_id_t alarm_id, alarm_entry_t *alarm) int alarmmgr_get_number_of_ids(int *num_of_ids) { int error_code; - ALARM_MGR_LOG_PRINT("[alarm-lib]: alarm_get_number_of_ids() is called."); + LOGD("[alarm-lib]: alarm_get_number_of_ids() is called."); if (num_of_ids == NULL) return ERR_ALARM_INVALID_PARAM; - ALARM_MGR_LOG_PRINT("call alarm_get_number_of_ids\n"); + LOGD("call alarm_get_number_of_ids\n"); if (!_send_alarm_get_number_of_ids(alarm_context, num_of_ids, &error_code)) return error_code; @@ -1439,7 +1439,7 @@ EXPORT_API int alarmmgr_get_next_duetime(alarm_id_t alarm_id, time_t *duetime) if (ret < 0) return ret; - ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_get_next_duetime() is called."); + LOGD("[alarm-lib]:alarmmgr_get_next_duetime() is called."); if (duetime == NULL) return ERR_ALARM_INVALID_PARAM; @@ -1453,7 +1453,7 @@ EXPORT_API int alarmmgr_get_next_duetime(alarm_id_t alarm_id, time_t *duetime) EXPORT_API int alarmmgr_get_all_info(char **db_path) { int error_code; - ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_get_all_info() is called."); + LOGD("[alarm-lib]:alarmmgr_get_all_info() is called."); if (db_path == NULL) return ERR_ALARM_INVALID_PARAM; @@ -1461,7 +1461,7 @@ EXPORT_API int alarmmgr_get_all_info(char **db_path) if (!_send_alarm_get_all_info(alarm_context, db_path, &error_code)) return error_code; - ALARM_MGR_LOG_PRINT("[alarm-lib]: successfully save info in %s.", *db_path); + LOGD("[alarm-lib]: successfully save info in %s.", *db_path); return ALARMMGR_RESULT_SUCCESS; } @@ -1473,9 +1473,9 @@ EXPORT_API int alarmmgr_add_periodic_alarm_withcb(int interval, periodic_method_ if (flag_appid_checked == 0) { if (aul_app_get_appid_bypid(getpid(), g_appid, sizeof(g_appid)) != AUL_R_OK) - ALARM_MGR_EXCEPTION_PRINT("PID[%d] may not be app. Please call alarmmgr_init(caller name) in advance.", getpid()); + LOGE("PID[%d] may not be app. Please call alarmmgr_init(caller name) in advance.", getpid()); else - ALARM_MGR_LOG_PRINT("Get appid only once. appid[%s]", g_appid); + LOGD("Get appid only once. appid[%s]", g_appid); flag_appid_checked = 1; } @@ -1504,9 +1504,9 @@ EXPORT_API int alarmmgr_add_reference_periodic_alarm_withcb(int interval, if (flag_appid_checked == 0) { if (aul_app_get_appid_bypid(getpid(), g_appid, sizeof(g_appid)) != AUL_R_OK) - ALARM_MGR_EXCEPTION_PRINT("PID[%d] may not be app. Please call alarmmgr_init(caller name) in advance.", getpid()); + LOGE("PID[%d] may not be app. Please call alarmmgr_init(caller name) in advance.", getpid()); else - ALARM_MGR_LOG_PRINT("Get appid only once. appid[%s]", g_appid); + LOGD("Get appid only once. appid[%s]", g_appid); flag_appid_checked = 1; } @@ -1529,17 +1529,17 @@ EXPORT_API int alarmmgr_add_reference_periodic_alarm_withcb(int interval, EXPORT_API int alarmmgr_set_systime(int new_time) { int error_code; - ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_set_systime(%d) is called.", new_time); + LOGD("[alarm-lib]:alarmmgr_set_systime(%d) is called.", new_time); if (__sub_init() < 0) return ERR_ALARM_SYSTEM_FAIL; if (!_send_alarm_set_time(alarm_context, new_time, &error_code)) { - ALARM_MGR_EXCEPTION_PRINT("Failed to set time. error: %d", error_code); + LOGE("Failed to set time. error: %d", error_code); return error_code; } - ALARM_MGR_LOG_PRINT("[alarm-lib]: successfully set the time(%d) by pid(%d).", new_time, getpid()); + LOGD("[alarm-lib]: successfully set the time(%d) by pid(%d).", new_time, getpid()); return ALARMMGR_RESULT_SUCCESS; } @@ -1547,7 +1547,7 @@ EXPORT_API int alarmmgr_set_systime_async(int new_time, alarm_set_time_cb_t resu { struct alarm_async_param_t *param; - ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_set_systime(%d) is called.", new_time); + LOGD("[alarm-lib]:alarmmgr_set_systime(%d) is called.", new_time); if (sub_initialized) { if (!_send_alarm_set_time_async(alarm_context, new_time, @@ -1562,7 +1562,7 @@ EXPORT_API int alarmmgr_set_systime_async(int new_time, alarm_set_time_cb_t resu #endif param = g_try_new0(struct alarm_async_param_t, 1); if (param == NULL) { - ALARM_MGR_EXCEPTION_PRINT("Failed to alloc param"); + LOGE("Failed to alloc param"); return ERR_ALARM_SYSTEM_FAIL; } param->type = SET_SYSTIME; @@ -1578,18 +1578,18 @@ EXPORT_API int alarmmgr_set_systime_async(int new_time, alarm_set_time_cb_t resu EXPORT_API int alarmmgr_set_systime_with_propagation_delay(struct timespec new_time, struct timespec req_time) { int error_code; - ALARM_MGR_LOG_PRINT("[alarm-lib] New: %ld(sec) %09ld(nsec), Requested: %ld(sec) %09ld(nsec)", + LOGD("[alarm-lib] New: %ld(sec) %09ld(nsec), Requested: %ld(sec) %09ld(nsec)", new_time.tv_sec, new_time.tv_nsec, req_time.tv_sec, req_time.tv_nsec); if (__sub_init() < 0) return ERR_ALARM_SYSTEM_FAIL; if (!_send_alarm_set_time_with_propagation_delay(alarm_context, new_time.tv_sec, new_time.tv_nsec, req_time.tv_sec, req_time.tv_nsec, &error_code)) { - ALARM_MGR_EXCEPTION_PRINT("Failed to set time with propagation delay. error: %d", error_code); + LOGE("Failed to set time with propagation delay. error: %d", error_code); return error_code; } - ALARM_MGR_LOG_PRINT("[alarm-lib]: successfully set the time by pid(%d).", getpid()); + LOGD("[alarm-lib]: successfully set the time by pid(%d).", getpid()); return ALARMMGR_RESULT_SUCCESS; } @@ -1597,7 +1597,7 @@ EXPORT_API int alarmmgr_set_systime_with_propagation_delay_async(struct timespec { struct alarm_async_param_t *param; - ALARM_MGR_LOG_PRINT("[alarm-lib] New: %ld(sec) %09ld(nsec), Requested: %ld(sec) %09ld(nsec)", + LOGD("[alarm-lib] New: %ld(sec) %09ld(nsec), Requested: %ld(sec) %09ld(nsec)", new_time.tv_sec, new_time.tv_nsec, req_time.tv_sec, req_time.tv_nsec); if (sub_initialized) { @@ -1614,7 +1614,7 @@ EXPORT_API int alarmmgr_set_systime_with_propagation_delay_async(struct timespec #endif param = g_try_new0(struct alarm_async_param_t, 1); if (param == NULL) { - ALARM_MGR_EXCEPTION_PRINT("Failed to alloc param"); + LOGE("Failed to alloc param"); return ERR_ALARM_SYSTEM_FAIL; } param->type = SET_SYSTIME_WITH_PROPAGATION_DELAY; @@ -1631,7 +1631,7 @@ EXPORT_API int alarmmgr_set_systime_with_propagation_delay_async(struct timespec EXPORT_API int alarmmgr_set_timezone(char *tzpath_str) { int error_code; - ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_set_timezone() is called."); + LOGD("[alarm-lib]:alarmmgr_set_timezone() is called."); if (tzpath_str == NULL) return ERR_ALARM_INVALID_PARAM; @@ -1642,7 +1642,7 @@ EXPORT_API int alarmmgr_set_timezone(char *tzpath_str) if (!_send_alarm_set_timezone(alarm_context, tzpath_str, &error_code)) return error_code; - ALARM_MGR_LOG_PRINT("[alarm-lib]: successfully set the timezone(%s) by pid(%d)", tzpath_str, getpid()); + LOGD("[alarm-lib]: successfully set the timezone(%s) by pid(%d)", tzpath_str, getpid()); return ALARMMGR_RESULT_SUCCESS; } @@ -1650,7 +1650,7 @@ EXPORT_API int alarmmgr_set_global(const alarm_id_t alarm_id, bool global) { int error_code; - ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_set_global(%d) is called.", alarm_id); + LOGD("[alarm-lib]:alarmmgr_set_global(%d) is called.", alarm_id); if (__sub_init() < 0) return ERR_ALARM_SYSTEM_FAIL; @@ -1685,7 +1685,7 @@ EXPORT_API int alarmmgr_update_alarm(alarm_id_t alarm_id, alarm_info_t *alarm_info; int ret; - ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_update_alarm() is called\n"); + LOGD("[alarm-lib]:alarmmgr_update_alarm() is called\n"); if (alarm == NULL) return ERR_ALARM_INVALID_PARAM; @@ -1700,7 +1700,7 @@ EXPORT_API int alarmmgr_update_alarm(alarm_id_t alarm_id, if (ret < 0) return ret; - ALARM_MGR_LOG_PRINT("start(%d-%d-%d, %02d:%02d:%02d), end(%d-%d-%d), repeat(%d), interval(%d), type(%d)", + LOGD("start(%d-%d-%d, %02d:%02d:%02d), end(%d-%d-%d), repeat(%d), interval(%d), type(%d)", alarm_info->start.day, alarm_info->start.month, alarm_info->start.year, alarm_info->start.hour, alarm_info->start.min, alarm_info->start.sec, alarm_info->end.year, alarm_info->end.month, alarm_info->end.day, @@ -1708,17 +1708,17 @@ EXPORT_API int alarmmgr_update_alarm(alarm_id_t alarm_id, if (update_flag == ALARM_UPDATE_FLAG_TIME) { if (!__alarm_validate_date(&alarm_info->start, &error_code)) { - ALARM_MGR_EXCEPTION_PRINT("start date error\n"); + LOGE("start date error\n"); return error_code; } if (!__alarm_validate_time(&alarm_info->start, &error_code)) { - ALARM_MGR_EXCEPTION_PRINT("start time error\n"); + LOGE("start time error\n"); return error_code; } if (!__alarm_validate_date(&alarm_info->end, &error_code)) { - ALARM_MGR_EXCEPTION_PRINT("end date error\n"); + LOGE("end date error\n"); return error_code; } } diff --git a/server/alarm-manager-db.c b/server/alarm-manager-db.c index b92f0cc..f2e9c30 100644 --- a/server/alarm-manager-db.c +++ b/server/alarm-manager-db.c @@ -74,10 +74,10 @@ static int __db_busyhandler(void *pData, int count) .tv_nsec = (count + 1) * 100 * 1000 * 1000 }; nanosleep(&time, NULL); - ALARM_MGR_LOG_PRINT("alarmmgr_db: busy handler called. count: %d", count + 1); + LOGD("alarmmgr_db: busy handler called. count: %d", count + 1); return 1; } else { - ALARM_MGR_LOG_PRINT("alarmmgr_db: busy handler will return SQLITE_BUSY error"); + LOGD("alarmmgr_db: busy handler will return SQLITE_BUSY error"); return 0; } } @@ -228,7 +228,7 @@ void _load_alarms_from_db() char *noti; if (SQLITE_OK != sqlite3_prepare(alarmmgr_db, query, strlen(query), &stmt, &tail)) { - ALARM_MGR_EXCEPTION_PRINT("sqlite3_prepare() is failed."); + LOGE("sqlite3_prepare() is failed."); return; } @@ -237,7 +237,7 @@ void _load_alarms_from_db() __alarm_info = (__alarm_info_t *)calloc(1, sizeof(__alarm_info_t)); if (G_UNLIKELY(__alarm_info == NULL)) { - ALARM_MGR_EXCEPTION_PRINT("Memory allocation failed."); + LOGE("Memory allocation failed."); goto done; } alarm_info = (alarm_info_t *) &(__alarm_info->alarm_info); @@ -300,7 +300,7 @@ void _load_alarms_from_db() if (is_disabled) { _alarm_set_next_duetime(__alarm_info); g_disabled_alarm_list = g_slist_append(g_disabled_alarm_list, __alarm_info); - ALARM_MGR_EXCEPTION_PRINT("Save alarm_id[%d] caller[%s] callee[%s]", __alarm_info->alarm_id, caller_pkgid, callee_pkgid); + LOGW("Save alarm_id[%d] caller[%s] callee[%s]", __alarm_info->alarm_id, caller_pkgid, callee_pkgid); } else { _alarm_set_next_duetime(__alarm_info); alarm_context.alarms = g_slist_append(alarm_context.alarms, __alarm_info); @@ -309,7 +309,7 @@ void _load_alarms_from_db() done: _alarm_schedule(); if (sqlite3_finalize(stmt) != SQLITE_OK) - ALARM_MGR_EXCEPTION_PRINT("sqlite3_finalize() is failed."); + LOGE("sqlite3_finalize() is failed."); return; } @@ -348,31 +348,31 @@ int _get_db_path_for_all_info(uid_t uid, char** db_path) current_tm.tm_year + 1900, current_tm.tm_mon + 1, current_tm.tm_mday, current_tm.tm_hour, current_tm.tm_min, current_tm.tm_sec); *db_path = strdup(db_path_tmp); if (*db_path == NULL) { - ALARM_MGR_EXCEPTION_PRINT("Out of memory"); + LOGE("Out of memory"); return ERR_ALARM_SYSTEM_FAIL; } if (sqlite3_open(db_path_tmp, &alarmmgr_tool_db) != SQLITE_OK) { - ALARM_MGR_EXCEPTION_PRINT("Failed to open [%s]", db_path_tmp); + LOGE("Failed to open [%s]", db_path_tmp); return ERR_ALARM_SYSTEM_FAIL; } /* Register busy handler */ if (sqlite3_busy_handler(alarmmgr_tool_db, __db_busyhandler, NULL) != SQLITE_OK) { - ALARM_MGR_EXCEPTION_PRINT("Failed to register the busy handler"); + LOGE("Failed to register the busy handler"); sqlite3_close(alarmmgr_tool_db); return ERR_ALARM_SYSTEM_FAIL; } /* Drop a table */ if (sqlite3_exec(alarmmgr_tool_db, query_for_deleting_table, NULL, NULL, &error_message) != SQLITE_OK) { - ALARM_MGR_EXCEPTION_PRINT("Deleting the table is failed. error message = %s", error_message); + LOGE("Deleting the table is failed. error message = %s", error_message); sqlite3_free(error_message); } /* Create a table if it does not exist */ if (sqlite3_exec(alarmmgr_tool_db, query_for_creating_table, NULL, NULL, &error_message) != SQLITE_OK) { - ALARM_MGR_EXCEPTION_PRINT("Creating the table is failed. error message = %s", error_message); + LOGE("Creating the table is failed. error message = %s", error_message); sqlite3_free(error_message); sqlite3_close(alarmmgr_tool_db); return ERR_ALARM_SYSTEM_FAIL; @@ -470,7 +470,7 @@ void _update_db_for_disabled_alarm(alarm_id_t alarm_id, bool disabled) { char *error_message = NULL; - ALARM_MGR_EXCEPTION_PRINT("Update (%d) is_disabled to (%d)", alarm_id, disabled); + LOGW("Update (%d) is_disabled to (%d)", alarm_id, disabled); char *query = sqlite3_mprintf("update alarmmgr set is_disabled=%d where alarm_id=%d", disabled, alarm_id); if (SQLITE_OK != sqlite3_exec(alarmmgr_db, query, NULL, NULL, &error_message)) { @@ -485,11 +485,11 @@ void _update_db_for_disabled_alarm(alarm_id_t alarm_id, bool disabled) int __check_callback(void *pid, int argc, char **argv, char **notUsed2) { if (strcmp(argv[0], "ok") != 0) { - ALARM_MGR_EXCEPTION_PRINT("check integrity result : %s" , argv[0]); + LOGE("check integrity result : %s" , argv[0]); is_db_corrupted = true; return -1; } else { - ALARM_MGR_LOG_PRINT("check integrity result : %s" , argv[0]); + LOGD("check integrity result : %s" , argv[0]); } return 0; @@ -503,7 +503,7 @@ bool _initialize_db() /* Create or Open the DB file */ ret = sqlite3_open(ALARMMGR_DB_FILE, &alarmmgr_db); if (ret != SQLITE_OK) { - ALARM_MGR_EXCEPTION_PRINT("Failed to open [%s]. error: %s", ALARMMGR_DB_FILE, sqlite3_errmsg(alarmmgr_db)); + LOGE("Failed to open [%s]. error: %s", ALARMMGR_DB_FILE, sqlite3_errmsg(alarmmgr_db)); if (ret == SQLITE_CORRUPT) goto recover; else @@ -512,7 +512,7 @@ bool _initialize_db() /* Register busy handler */ ret = sqlite3_busy_handler(alarmmgr_db, __db_busyhandler, NULL); if (ret != SQLITE_OK) { - ALARM_MGR_EXCEPTION_PRINT("Failed to register the busy handler"); + LOGE("Failed to register the busy handler"); if (ret == SQLITE_CORRUPT) { goto recover; } else { @@ -523,7 +523,7 @@ bool _initialize_db() /* Create alarmmgr table */ ret = sqlite3_exec(alarmmgr_db, QUERY_CREATE_TABLE_ALARMMGR, NULL, NULL, &error_message); if (ret != SQLITE_OK) { - ALARM_MGR_EXCEPTION_PRINT("Don't execute query = %s, error message = %s", QUERY_CREATE_TABLE_ALARMMGR, error_message); + LOGE("Don't execute query = %s, error message = %s", QUERY_CREATE_TABLE_ALARMMGR, error_message); if (ret == SQLITE_CORRUPT || ret == SQLITE_NOTADB) { goto recover; } else { @@ -536,7 +536,7 @@ bool _initialize_db() /* Check integrity of DB */ ret = sqlite3_exec(alarmmgr_db, "PRAGMA integrity_check", __check_callback, NULL, 0); if (ret != SQLITE_OK || is_db_corrupted) { - ALARM_MGR_EXCEPTION_PRINT("Loss alarm db's integrity"); + LOGE("Loss alarm db's integrity"); goto recover; } @@ -551,20 +551,20 @@ recover: ret = sqlite3_open(ALARMMGR_DB_FILE, &alarmmgr_db); if (ret != SQLITE_OK) { - ALARM_MGR_EXCEPTION_PRINT("[recover] Failed to open [%s]. error: %s", ALARMMGR_DB_FILE, sqlite3_errmsg(alarmmgr_db)); + LOGE("[recover] Failed to open [%s]. error: %s", ALARMMGR_DB_FILE, sqlite3_errmsg(alarmmgr_db)); return false; } ret = sqlite3_busy_handler(alarmmgr_db, __db_busyhandler, NULL); if (ret != SQLITE_OK) { - ALARM_MGR_EXCEPTION_PRINT("[recover] Failed to register the busy handler"); + LOGE("[recover] Failed to register the busy handler"); sqlite3_close(alarmmgr_db); return false; } ret = sqlite3_exec(alarmmgr_db, QUERY_CREATE_TABLE_ALARMMGR, NULL, NULL, &error_message); if (ret != SQLITE_OK) { - ALARM_MGR_EXCEPTION_PRINT("[recover] Don't execute query = %s, error message = %s", QUERY_CREATE_TABLE_ALARMMGR, error_message); + LOGE("[recover] Don't execute query = %s, error message = %s", QUERY_CREATE_TABLE_ALARMMGR, error_message); sqlite3_close(alarmmgr_db); sqlite3_free(error_message); return false; diff --git a/server/alarm-manager-dbus.c b/server/alarm-manager-dbus.c index 3dadc6c..6e8f9cd 100755 --- a/server/alarm-manager-dbus.c +++ b/server/alarm-manager-dbus.c @@ -239,7 +239,7 @@ static gboolean __send_noti_to_session_bus(char *service_name, ret = connect(fd, (struct sockaddr *)&saddr, sizeof(saddr)); if (ret < 0) { - ALARM_MGR_EXCEPTION_PRINT("connect failed - (errno %d)", errno); + LOGE("connect failed - (errno %d)", errno); close(fd); return FALSE; } @@ -277,7 +277,7 @@ static gboolean __send_noti_to_session_bus(char *service_name, free(gv_data); if (send(fd, data, len + 4, 0) == -1) { - ALARM_MGR_EXCEPTION_PRINT("sendto() failed (errno %d)", errno); + LOGE("sendto() failed (errno %d)", errno); free(data); close(fd); return FALSE; @@ -295,7 +295,7 @@ void _alarm_send_noti_to_application_by_dbus(const char *app_service_name, gboolean ret; if (app_service_name == NULL || strlen(app_service_name) == 0) { - ALARM_MGR_EXCEPTION_PRINT("This alarm destination is invalid."); + LOGE("This alarm destination is invalid."); return; } @@ -309,7 +309,7 @@ void _alarm_send_noti_to_application_by_dbus(const char *app_service_name, if (uid >= REGULAR_UID_MIN) { ret = __send_noti_to_session_bus(service_name, alarm_id, msec, uid); if (ret != TRUE) - ALARM_MGR_EXCEPTION_PRINT("failed to send alarm expired noti for %d, %s", + LOGE("failed to send alarm expired noti for %d, %s", alarm_id, service_name); } else { g_dbus_connection_call(alarm_context.connection, @@ -346,9 +346,9 @@ static uid_t __get_caller_uid(const char *name) NULL, &error); if (!ret) { - ALARM_MGR_EXCEPTION_PRINT("failed to get caller uid"); + LOGE("failed to get caller uid"); if (error) { - ALARM_MGR_EXCEPTION_PRINT("dbus error message : %s", error->message); + LOGE("dbus error message : %s", error->message); g_error_free(error); } return -1; @@ -377,9 +377,9 @@ static pid_t __get_caller_pid(const char *name) NULL, &error); if (!ret) { - ALARM_MGR_EXCEPTION_PRINT("failed to get caller pid"); + LOGE("failed to get caller pid"); if (error) { - ALARM_MGR_EXCEPTION_PRINT("dbus error message : %s", error->message); + LOGE("dbus error message : %s", error->message); g_error_free(error); } return -1; @@ -404,8 +404,7 @@ int _display_lock_state(char *state, char *flag, unsigned int timeout) DEVICED_INTERFACE_DISPLAY, DEVICED_LOCK_STATE); if (!msg) { - ALARM_MGR_EXCEPTION_PRINT( - "g_dbus_message_new_method_call() is failed. (%s:%s-%s)", + LOGE("g_dbus_message_new_method_call() is failed. (%s:%s-%s)", DEVICED_BUS_NAME, DEVICED_INTERFACE_DISPLAY, DEVICED_LOCK_STATE); return ERR_ALARM_SYSTEM_FAIL; } @@ -419,21 +418,21 @@ int _display_lock_state(char *state, char *flag, unsigned int timeout) G_DBUS_SEND_MESSAGE_FLAGS_NONE, DEVICED_DBUS_REPLY_TIMEOUT, NULL, NULL, NULL); if (!reply) { - ALARM_MGR_EXCEPTION_PRINT("No reply.\ + LOGE("No reply.\ g_dbus_connection_send_message_with_reply_sync() is failed."); ret = ERR_ALARM_SYSTEM_FAIL; } else { body = g_dbus_message_get_body(reply); if (!body) { - ALARM_MGR_EXCEPTION_PRINT("g_dbus_message_get_body() is failed."); + LOGE("g_dbus_message_get_body() is failed."); ret = ERR_ALARM_SYSTEM_FAIL; } else { g_variant_get(body, "(i)", &val); if (val != 0) { - ALARM_MGR_EXCEPTION_PRINT("Failed to lock display"); + LOGE("Failed to lock display"); ret = ERR_ALARM_SYSTEM_FAIL; } else { - ALARM_MGR_LOG_PRINT("Lock LCD OFF is successfully done"); + LOGD("Lock LCD OFF is successfully done"); } } } @@ -460,8 +459,7 @@ int _display_unlock_state(char *state, char *flag) DEVICED_INTERFACE_DISPLAY, DEVICED_UNLOCK_STATE); if (!msg) { - ALARM_MGR_EXCEPTION_PRINT( - "g_dbus_message_new_method_call() is failed. (%s:%s-%s)", + LOGE("g_dbus_message_new_method_call() is failed. (%s:%s-%s)", DEVICED_BUS_NAME, DEVICED_INTERFACE_DISPLAY, DEVICED_UNLOCK_STATE); return ERR_ALARM_SYSTEM_FAIL; } @@ -474,21 +472,21 @@ int _display_unlock_state(char *state, char *flag) G_DBUS_SEND_MESSAGE_FLAGS_NONE, DEVICED_DBUS_REPLY_TIMEOUT, NULL, NULL, NULL); if (!reply) { - ALARM_MGR_EXCEPTION_PRINT("No reply.\ + LOGE("No reply.\ g_dbus_connection_send_message_with_reply_sync() is failed."); ret = ERR_ALARM_SYSTEM_FAIL; } else { body = g_dbus_message_get_body(reply); if (!body) { - ALARM_MGR_EXCEPTION_PRINT("g_dbus_message_get_body() is failed."); + LOGE("g_dbus_message_get_body() is failed."); ret = ERR_ALARM_SYSTEM_FAIL; } else { g_variant_get(body, "(i)", &val); if (val != 0) { - ALARM_MGR_EXCEPTION_PRINT("Failed to unlock display"); + LOGE("Failed to unlock display"); ret = ERR_ALARM_SYSTEM_FAIL; } else { - ALARM_MGR_LOG_PRINT("Unlock LCD OFF is successfully done"); + LOGD("Unlock LCD OFF is successfully done"); } } } @@ -622,7 +620,7 @@ static void __on_bus_name_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data) { - ALARM_MGR_LOG_PRINT("bus acquired(%s)", name); + LOGD("bus acquired(%s)", name); guint reg_id = 0; GError *error = NULL; @@ -633,7 +631,7 @@ static void __on_bus_name_acquired(GDBusConnection *connection, &interface_vtable, NULL, NULL, &error); if (reg_id == 0) { - ALARM_MGR_EXCEPTION_PRINT("g_dbus_connection_register_object error(%s)", error->message); + LOGE("g_dbus_connection_register_object error(%s)", error->message); g_error_free(error); } } @@ -684,13 +682,13 @@ bool _initialize_dbus(void) GError *error = NULL; guint subsc_id; guint owner_id; - ALARM_MGR_LOG_PRINT("__initialize_dbus Enter"); + LOGD("__initialize_dbus Enter"); connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); if (connection == NULL) { - ALARM_MGR_EXCEPTION_PRINT("g_bus_get_sync() is failed"); + LOGE("g_bus_get_sync() is failed"); if (error) { - ALARM_MGR_EXCEPTION_PRINT("dbus error message : %s", error->message); + LOGE("dbus error message : %s", error->message); g_error_free(error); } return false; @@ -701,14 +699,14 @@ bool _initialize_dbus(void) "NameOwnerChanged", "/org/freedesktop/DBus", NULL, G_DBUS_SIGNAL_FLAGS_NONE, __on_bus_name_owner_changed, NULL, NULL); if (subsc_id == 0) { - ALARM_MGR_EXCEPTION_PRINT("Subscribing to signal for invoking callback is failed."); + LOGE("Subscribing to signal for invoking callback is failed."); g_object_unref(connection); return false; } introspection_data = g_dbus_node_info_new_for_xml(introspection_xml, &error); if (!introspection_data) { - ALARM_MGR_EXCEPTION_PRINT("g_dbus_node_info_new_for_xml error(%s)", error->message); + LOGE("g_dbus_node_info_new_for_xml error(%s)", error->message); g_object_unref(connection); g_error_free(error); return false; @@ -719,7 +717,7 @@ bool _initialize_dbus(void) __on_bus_name_acquired, NULL, NULL, NULL); if (owner_id == 0) { - ALARM_MGR_EXCEPTION_PRINT("Acquiring the own name is failed."); + LOGE("Acquiring the own name is failed."); g_dbus_node_info_unref(introspection_data); g_object_unref(connection); return false; diff --git a/server/alarm-manager-main.c b/server/alarm-manager-main.c index 9594bce..7e11e8c 100644 --- a/server/alarm-manager-main.c +++ b/server/alarm-manager-main.c @@ -23,7 +23,7 @@ int main() { GMainLoop *mainloop = NULL; - ALARM_MGR_LOG_PRINT("Enter main loop\n"); + LOGD("Enter main loop\n"); #ifdef TIZEN_TEST_GCOV setenv("GCOV_PREFIX", "/tmp/daemon", 1); diff --git a/server/alarm-manager-schedule.c b/server/alarm-manager-schedule.c index 8fd4091..a18c068 100644 --- a/server/alarm-manager-schedule.c +++ b/server/alarm-manager-schedule.c @@ -50,7 +50,7 @@ void _add_to_scheduled_alarm_list(__alarm_info_t *__alarm_info) alarm = (__scheduled_alarm_t *)g_malloc(sizeof(__scheduled_alarm_t)); if (alarm == NULL) { - ALARM_MGR_EXCEPTION_PRINT("Out of memory"); + LOGE("Out of memory"); return; } @@ -97,7 +97,7 @@ static time_t __alarm_next_duetime_once(__alarm_info_t *__alarm_info) int current_dst = 0; if ((__alarm_info->alarm_info.alarm_type & ALARM_TYPE_RELATIVE) && __alarm_info->start != 0) { - ALARM_MGR_EXCEPTION_PRINT("Final due_time = %ld, %s", + LOGE("Final due_time = %ld, %s", __alarm_info->start, ctime(&__alarm_info->start)); return __alarm_info->start; } @@ -128,30 +128,30 @@ static time_t __alarm_next_duetime_once(__alarm_info_t *__alarm_info) } if (due_time <= current_time) { - ALARM_MGR_EXCEPTION_PRINT("duetime is less than or equal to current time. current_dst = %d", current_dst); + LOGW("duetime is less than or equal to current time. current_dst = %d", current_dst); duetime_tm.tm_isdst = 0; due_time_tmp = mktime(&duetime_tm); localtime_r(&due_time_tmp, &tmp_tm); - ALARM_MGR_LOG_PRINT("%d:%d:%d. duetime = %ld", tmp_tm.tm_hour, tmp_tm.tm_min, tmp_tm.tm_sec, due_time); + LOGD("%d:%d:%d. duetime = %ld", tmp_tm.tm_hour, tmp_tm.tm_min, tmp_tm.tm_sec, due_time); if (tmp_tm.tm_hour == start->hour && tmp_tm.tm_min == start->min && tmp_tm.tm_sec == start->sec) { due_time = due_time_tmp; - ALARM_MGR_EXCEPTION_PRINT("due_time = %ld", due_time); + LOGW("due_time = %ld", due_time); } } else { localtime_r(&due_time, &tmp_tm); - ALARM_MGR_LOG_PRINT("%d:%d:%d. current_dst = %d, duetime_dst = %d", tmp_tm.tm_hour, tmp_tm.tm_min, tmp_tm.tm_sec, current_dst, tmp_tm.tm_isdst); + LOGD("%d:%d:%d. current_dst = %d, duetime_dst = %d", tmp_tm.tm_hour, tmp_tm.tm_min, tmp_tm.tm_sec, current_dst, tmp_tm.tm_isdst); if (current_dst == 1 && tmp_tm.tm_isdst == 1 && tmp_tm.tm_hour == start->hour + 1) { /* When the calculated duetime is forwarded 1hour due to DST, Adds 23hours. */ due_time += 60 * 60 * 23; localtime_r(&due_time, &duetime_tm); - ALARM_MGR_EXCEPTION_PRINT("due_time = %ld", due_time); + LOGW("due_time = %ld", due_time); } } - ALARM_MGR_EXCEPTION_PRINT("Final due_time = %ld, %s", due_time, ctime(&due_time)); + LOGW("Final due_time = %ld, %s", due_time, ctime(&due_time)); return due_time; } @@ -189,7 +189,7 @@ static time_t __alarm_next_duetime_repeat(__alarm_info_t *__alarm_info) while (__alarm_info->start > due_time || current_time > due_time || ((!is_time_changed) && (current_time == due_time))) { if (due_time + alarm_info->mode.u_interval.interval < due_time) { - ALARM_MGR_LOG_PRINT("time_t OVERFLOW!! duetime = %ld", due_time); + LOGD("time_t OVERFLOW!! duetime = %ld", due_time); due_time = -1; break; } @@ -236,7 +236,7 @@ static time_t __alarm_next_duetime_annually(__alarm_info_t *__alarm_info) duetime_tm.tm_year += 1; due_time = mktime(&duetime_tm); if (due_time < 0) { - ALARM_MGR_LOG_PRINT("time_t OVERFLOW!! duetime = %ld", due_time); + LOGD("time_t OVERFLOW!! duetime = %ld", due_time); break; } } @@ -277,7 +277,7 @@ static time_t __alarm_next_duetime_monthly(__alarm_info_t *__alarm_info) } due_time = mktime(&duetime_tm); if (due_time < 0) { - ALARM_MGR_LOG_PRINT("time_t OVERFLOW!! duetime = %ld", due_time); + LOGD("time_t OVERFLOW!! duetime = %ld", due_time); break; } } @@ -321,10 +321,10 @@ static time_t __alarm_next_duetime_weekly(__alarm_info_t *__alarm_info) due_time = mktime(&duetime_tm); localtime_r(&due_time, &tmp_tm); - ALARM_MGR_LOG_PRINT("%d:%d:%d. duetime = %ld, isdst = %d", tmp_tm.tm_hour, tmp_tm.tm_min, tmp_tm.tm_sec, due_time, tmp_tm.tm_isdst); + LOGD("%d:%d:%d. duetime = %ld, isdst = %d", tmp_tm.tm_hour, tmp_tm.tm_min, tmp_tm.tm_sec, due_time, tmp_tm.tm_isdst); if (due_time <= current_time) { - ALARM_MGR_EXCEPTION_PRINT("duetime is less than or equal to current time. current_dst = %d", current_dst); + LOGW("duetime is less than or equal to current time. current_dst = %d", current_dst); duetime_tm.tm_isdst = 0; due_time = mktime(&duetime_tm); @@ -374,7 +374,7 @@ static time_t __alarm_next_duetime_weekly(__alarm_info_t *__alarm_info) day = 0; } - ALARM_MGR_LOG_PRINT("interval : %d\n", interval); + LOGD("interval : %d\n", interval); due_time += 60 * 60 * 24 * interval; } @@ -388,7 +388,7 @@ static time_t __alarm_next_duetime_weekly(__alarm_info_t *__alarm_info) else if (before_tm.tm_isdst == 0 && after_tm.tm_isdst == 1) due_time -= 60 * 60; /* Subtract an hour */ - ALARM_MGR_LOG_PRINT("Final due_time = %ld", due_time); + LOGD("Final due_time = %ld", due_time); return due_time; } @@ -408,7 +408,7 @@ void _alarm_set_next_duetime(__alarm_info_t *__alarm_info) if (cur_tm && cur_tm->tm_isdst > 0) is_dst = 1; - ALARM_MGR_LOG_PRINT("mode->repeat is %d\n", mode->repeat); + LOGD("mode->repeat is %d\n", mode->repeat); if (mode->repeat == ALARM_REPEAT_MODE_ONCE) { due_time = __alarm_next_duetime_once(__alarm_info); @@ -421,7 +421,7 @@ void _alarm_set_next_duetime(__alarm_info_t *__alarm_info) } else if (mode->repeat == ALARM_REPEAT_MODE_WEEKLY) { due_time = __alarm_next_duetime_weekly(__alarm_info); } else { - ALARM_MGR_EXCEPTION_PRINT("repeat mode(%d) is wrong\n", + LOGE("repeat mode(%d) is wrong\n", mode->repeat); __alarm_info->due_time = due_time; return; @@ -430,20 +430,20 @@ void _alarm_set_next_duetime(__alarm_info_t *__alarm_info) if (mode->repeat != ALARM_REPEAT_MODE_WEEKLY && mode->repeat != ALARM_REPEAT_MODE_ONCE) { due_tm = localtime_r(&due_time, &tm); if (is_dst == 0 && due_tm && due_tm->tm_isdst == 1) { - ALARM_MGR_LOG_PRINT("DST alarm found, enable\n"); + LOGD("DST alarm found, enable\n"); due_tm->tm_hour = due_tm->tm_hour - DST_TIME_DIFF; } else if (is_dst == 1 && due_tm && due_tm->tm_isdst == 0) { - ALARM_MGR_LOG_PRINT("DST alarm found. disable\n"); + LOGD("DST alarm found. disable\n"); due_tm->tm_hour = due_tm->tm_hour + DST_TIME_DIFF; } if (due_tm) due_time = mktime(due_tm); } - ALARM_MGR_LOG_PRINT("alarm_id: %d, next duetime: %ld", __alarm_info->alarm_id, due_time); + LOGD("alarm_id: %d, next duetime: %ld", __alarm_info->alarm_id, due_time); if (__alarm_info->end != 0 && __alarm_info->end < due_time) { - ALARM_MGR_LOG_PRINT("due time > end time"); + LOGD("due time > end time"); __alarm_info->due_time = 0; return; } @@ -477,7 +477,7 @@ static bool __find_next_alarm_to_be_scheduled(time_t *min_due_time) interval = difftime(due_time, current_time); if (interval < 0) /*When the alarm expires, it may makes an error.*/ { - ALARM_MGR_EXCEPTION_PRINT("The duetime of alarm(%d) is OVER.", entry->alarm_id); + LOGW("The duetime of alarm(%d) is OVER.", entry->alarm_id); continue; } @@ -488,7 +488,7 @@ static bool __find_next_alarm_to_be_scheduled(time_t *min_due_time) } if (min_time == -1) { - ALARM_MGR_EXCEPTION_PRINT("[alarm-server][schedule]: There is no alarm to be scheduled."); + LOGE("[alarm-server][schedule]: There is no alarm to be scheduled."); return false; } diff --git a/server/alarm-manager-timer.c b/server/alarm-manager-timer.c index 94b70f8..4a20307 100644 --- a/server/alarm-manager-timer.c +++ b/server/alarm-manager-timer.c @@ -44,23 +44,23 @@ static gboolean __alarm_handler_idle(gpointer user_data) #endif if (gpollfd == NULL) { - ALARM_MGR_EXCEPTION_PRINT("gpollfd is NULL"); + LOGE("gpollfd is NULL"); return false; } if (read(gpollfd->fd, &exp, sizeof(uint64_t)) < 0) { - ALARM_MGR_EXCEPTION_PRINT("Reading the fd is failed."); + LOGE("Reading the fd is failed."); return false; } - ALARM_MGR_LOG_PRINT("Lock the display not to enter LCD OFF"); + LOGD("Lock the display not to enter LCD OFF"); if (_display_lock_state(DEVICED_LCD_OFF, DEVICED_STAY_CUR_STATE, 0) != ALARMMGR_RESULT_SUCCESS) - ALARM_MGR_EXCEPTION_PRINT("_display_lock_state() is failed"); + LOGE("_display_lock_state() is failed"); if (g_dummy_timer_is_set == true) { - ALARM_MGR_LOG_PRINT("dummy alarm timer has expired."); + LOGD("dummy alarm timer has expired."); } else { - ALARM_MGR_LOG_PRINT("__alarm_handler_idle"); + LOGD("__alarm_handler_idle"); _alarm_expired(); } @@ -72,16 +72,16 @@ static gboolean __alarm_handler_idle(gpointer user_data) */ time(¤t_time); if (alarm_context.c_due_time == current_time) { - ALARM_MGR_LOG_PRINT("Expire alarms forcibly when duetime is same to current time(%ld).", current_time); + LOGD("Expire alarms forcibly when duetime is same to current time(%ld).", current_time); _alarm_expired(); _alarm_schedule(); } _rtc_set(); - ALARM_MGR_LOG_PRINT("Unlock the display from LCD OFF"); + LOGD("Unlock the display from LCD OFF"); if (_display_unlock_state(DEVICED_LCD_OFF, DEVICED_SLEEP_MARGIN) != ALARMMGR_RESULT_SUCCESS) - ALARM_MGR_EXCEPTION_PRINT("_display_unlock_state() is failed"); + LOGE("_display_unlock_state() is failed"); return false; } @@ -148,14 +148,14 @@ int _initialize_timer() fd = timerfd_create(CLOCK_REALTIME, 0); if (fd == -1) { - ALARM_MGR_EXCEPTION_PRINT("timerfd_create() is failed.\n"); + LOGE("timerfd_create() is failed.\n"); return -1; } src = g_source_new(&funcs, sizeof(GSource)); gpollfd = (GPollFD *) g_malloc(sizeof(GPollFD)); if (gpollfd == NULL) { - ALARM_MGR_EXCEPTION_PRINT("Out of memory\n"); + LOGE("Out of memory\n"); return -1; } gpollfd->events = G_IO_IN; @@ -168,7 +168,7 @@ int _initialize_timer() ret = g_source_attach(src, NULL); if (ret == 0) { - ALARM_MGR_EXCEPTION_PRINT("g_source_attach() is failed.\n"); + LOGE("g_source_attach() is failed.\n"); return -1; } @@ -186,7 +186,7 @@ void _alarm_disable_timer() time_spec.it_interval.tv_sec = time_spec.it_interval.tv_nsec = 0; if (timerfd_settime(alarm_context.timer, 0, &time_spec, NULL) < 0) - ALARM_MGR_EXCEPTION_PRINT("timerfd_settime has failed : errno(%d).", errno); + LOGE("timerfd_settime has failed : errno(%d).", errno); } void _alarm_set_timer(int timer, time_t due_time) @@ -200,7 +200,7 @@ void _alarm_set_timer(int timer, time_t due_time) time(¤t_time); interval = difftime(due_time, current_time); - ALARM_MGR_LOG_PRINT("[alarm-server][timer]: remain time from current is %f , due_time is %ld.", interval, due_time); + LOGD("[alarm-server][timer]: remain time from current is %f , due_time is %ld.", interval, due_time); /*set timer as absolute time */ /*we create dummy timer when the interval is longer than one day. */ @@ -212,7 +212,7 @@ void _alarm_set_timer(int timer, time_t due_time) interval = 60 * 60 * 12; g_dummy_timer_is_set = true; strftime(due_time_r, 30, "%c", &ts_ret); - ALARM_MGR_LOG_PRINT("create dummy alarm timer(%d), due_time(%s)", timer, due_time_r); + LOGD("create dummy alarm timer(%d), due_time(%s)", timer, due_time_r); } else { g_dummy_timer_is_set = false; } @@ -222,7 +222,7 @@ void _alarm_set_timer(int timer, time_t due_time) time_spec.it_interval.tv_sec = time_spec.it_interval.tv_nsec = 0; if (interval > 0 && timerfd_settime(timer, TFD_TIMER_ABSTIME, &time_spec, NULL) != 0) { - ALARM_MGR_EXCEPTION_PRINT("set timer has failed : timer(%d), due_time(%ld) , errno(%d).", timer, due_time, errno); + LOGE("set timer has failed : timer(%d), due_time(%ld) , errno(%d).", timer, due_time, errno); } /* we set c_due_time to due_time due to allow newly created alarm can diff --git a/server/alarm-manager-util.c b/server/alarm-manager-util.c index ea0c43f..03e6272 100755 --- a/server/alarm-manager-util.c +++ b/server/alarm-manager-util.c @@ -32,7 +32,7 @@ static int __bg_category_func(const char *name, void *user_data) { bg_category_cb_info_t *info = (bg_category_cb_info_t *)user_data; - ALARM_MGR_LOG_PRINT("appid[%s], bg name = %s", info->appid, name); + LOGD("appid[%s], bg name = %s", info->appid, name); if (name && strncmp("enable", name, strlen(name)) && strncmp("disable", name, strlen(name))) { info->has_bg = true; @@ -54,7 +54,7 @@ profile_t _get_profile() r = system_info_get_platform_string("http://tizen.org/feature/profile", &profileName); if (r != SYSTEM_INFO_ERROR_NONE) { - ALARM_MGR_LOG_PRINT("Failed to get profile info. error(%d)", r); + LOGD("Failed to get profile info. error(%d)", r); return saved; } @@ -91,7 +91,7 @@ int _pkg_is_global(const char *callee_pkgid, uid_t uid) retval = pkgmgrinfo_pkginfo_get_usr_pkginfo(callee_pkgid, uid, &handle); if (retval != PMINFO_R_OK) { - ALARM_MGR_EXCEPTION_PRINT("Failed to get pkginfo\n"); + LOGE("Failed to get pkginfo\n"); return_code = ERR_ALARM_INVALID_ID; } else { bool is_global = 0; @@ -123,7 +123,7 @@ int _cynara_check(GDBusMethodInvocation *invocation, const char *privilege, ret = cynara_initialize(&p_cynara, NULL); if (ret != CYNARA_API_SUCCESS) { - ALARM_MGR_EXCEPTION_PRINT("cynara_initialize() failed : %d", ret); + LOGE("cynara_initialize() failed : %d", ret); ret = ERR_ALARM_SYSTEM_FAIL; goto cynara_out; } @@ -131,7 +131,7 @@ int _cynara_check(GDBusMethodInvocation *invocation, const char *privilege, ret = cynara_creds_gdbus_get_user(connection, sender_unique_name, USER_METHOD_DEFAULT, &user); if (ret != CYNARA_API_SUCCESS) { - ALARM_MGR_EXCEPTION_PRINT("cynara_creds_gdbus_get_user() failed : %d", ret); + LOGE("cynara_creds_gdbus_get_user() failed : %d", ret); ret = ERR_ALARM_SYSTEM_FAIL; goto cynara_out; } @@ -139,17 +139,17 @@ int _cynara_check(GDBusMethodInvocation *invocation, const char *privilege, ret = cynara_creds_gdbus_get_client(connection, sender_unique_name, CLIENT_METHOD_DEFAULT, &client); if (ret != CYNARA_API_SUCCESS) { - ALARM_MGR_EXCEPTION_PRINT("cynara_creds_gdbus_get_client() failed : %d", ret); + LOGE("cynara_creds_gdbus_get_client() failed : %d", ret); ret = ERR_ALARM_SYSTEM_FAIL; goto cynara_out; } - ALARM_MGR_LOG_PRINT("user :%s , client :%s ,unique_name : %s, pid() : %d", + LOGD("user :%s , client :%s ,unique_name : %s, pid() : %d", user, client, sender_unique_name, pid); client_session = cynara_session_from_pid(pid); if (!client_session) { - ALARM_MGR_EXCEPTION_PRINT("cynara_session_from_pid() failed : %d", ret); + LOGE("cynara_session_from_pid() failed : %d", ret); ret = ERR_ALARM_SYSTEM_FAIL; goto cynara_out; } @@ -157,11 +157,11 @@ int _cynara_check(GDBusMethodInvocation *invocation, const char *privilege, ret = cynara_check(p_cynara, client, client_session, user, privilege); if (ret == CYNARA_API_ACCESS_ALLOWED) { - ALARM_MGR_LOG_PRINT("CYNARA_ACCESS_ALLOWED"); + LOGD("CYNARA_ACCESS_ALLOWED"); ret = ALARMMGR_RESULT_SUCCESS; } else { - ALARM_MGR_LOG_PRINT("CYNARA_NOT_ALLOWED [%d]", ret); + LOGD("CYNARA_NOT_ALLOWED [%d]", ret); ret = ERR_ALARM_NOT_PERMITTED_APP; } @@ -183,11 +183,11 @@ int _get_pid_from_appid(const char *app_id, uid_t uid) int pid; pid = aul_app_get_pid_for_uid(app_id, uid); if (pid < 0) { - ALARM_MGR_EXCEPTION_PRINT("aul_app_get_pid_for_uid() is failed. appid %s may not be app. uid : [%d]", app_id, uid); + LOGE("aul_app_get_pid_for_uid() is failed. appid %s may not be app. uid : [%d]", app_id, uid); return 0; } - ALARM_MGR_LOG_PRINT("app_id:%s [pid:%d]", app_id, pid); + LOGD("app_id:%s [pid:%d]", app_id, pid); return pid; } @@ -255,15 +255,15 @@ int _compare_api_version(int *result, int pid, uid_t uid) char *pkg_version; if (aul_app_get_pkgid_bypid_for_uid(pid, pkgid, sizeof(pkgid), uid) != AUL_R_OK) { - ALARM_MGR_EXCEPTION_PRINT("aul_app_get_pkgid_bypid() is failed. PID %d may not be app.", getpid()); + LOGE("aul_app_get_pkgid_bypid() is failed. PID %d may not be app.", getpid()); } else { ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &pkginfo); if (ret != PMINFO_R_OK) { - ALARM_MGR_EXCEPTION_PRINT("Failed to get pkginfo\n"); + LOGE("Failed to get pkginfo\n"); } else { ret = pkgmgrinfo_pkginfo_get_api_version(pkginfo, &pkg_version); if (ret != PMINFO_R_OK) - ALARM_MGR_EXCEPTION_PRINT("Failed to check api version [%d]\n", ret); + LOGE("Failed to check api version [%d]\n", ret); *result = strverscmp(pkg_version, "2.4"); pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo); } @@ -275,13 +275,13 @@ bool _permit_by_config(pkgmgrinfo_appinfo_h handle, uid_t uid) { if (access(tzplatform_mkpath(TZ_SYS_RO_SHARE, "alarm-manager/alarm-config-service-restricted"), F_OK) == 0) { - ALARM_MGR_LOG_PRINT("This profile restrict alarms for service applications\n"); + LOGD("This profile restrict alarms for service applications\n"); return false; } if (access(tzplatform_mkpath(TZ_SYS_RO_SHARE, "alarm-manager/alarm-config-platform-service-permitted"), F_OK) == 0) { - ALARM_MGR_LOG_PRINT("This profile permit alarm for service applications which has platform cert\n"); + LOGD("This profile permit alarm for service applications which has platform cert\n"); char *pkgid; int r; const char *cert_value; @@ -292,19 +292,19 @@ bool _permit_by_config(pkgmgrinfo_appinfo_h handle, uid_t uid) r = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid); if (r != PMINFO_R_OK) { - ALARM_MGR_EXCEPTION_PRINT("Failed to get certinfo pkgid"); + LOGE("Failed to get certinfo pkgid"); return false; } r = pkgmgrinfo_pkginfo_create_certinfo(&certinfo); if (r != PMINFO_R_OK) { - ALARM_MGR_EXCEPTION_PRINT("Failed to create certinfo"); + LOGE("Failed to create certinfo"); return false; } r = pkgmgrinfo_pkginfo_load_certinfo(pkgid, certinfo, uid); if (r != PMINFO_R_OK) { - ALARM_MGR_EXCEPTION_PRINT("Failed to load certinfo"); + LOGE("Failed to load certinfo"); pkgmgrinfo_pkginfo_destroy_certinfo(certinfo); return false; } @@ -312,14 +312,14 @@ bool _permit_by_config(pkgmgrinfo_appinfo_h handle, uid_t uid) r = pkgmgrinfo_pkginfo_get_cert_value(certinfo, PMINFO_DISTRIBUTOR_ROOT_CERT, &cert_value); if (r != PMINFO_R_OK || cert_value == NULL) { - ALARM_MGR_EXCEPTION_PRINT("Failed to get cert value"); + LOGE("Failed to get cert value"); pkgmgrinfo_pkginfo_destroy_certinfo(certinfo); return false; } r = certsvc_instance_new(&instance); if (r != CERTSVC_SUCCESS) { - ALARM_MGR_EXCEPTION_PRINT("certsvc_instance_new() is failed."); + LOGE("certsvc_instance_new() is failed."); pkgmgrinfo_pkginfo_destroy_certinfo(certinfo); return false; } @@ -330,7 +330,7 @@ bool _permit_by_config(pkgmgrinfo_appinfo_h handle, uid_t uid) CERTSVC_FORM_DER_BASE64, &certificate); if (r != CERTSVC_SUCCESS) { - ALARM_MGR_EXCEPTION_PRINT("certsvc_certificate_new_from_memory() is failed."); + LOGE("certsvc_certificate_new_from_memory() is failed."); pkgmgrinfo_pkginfo_destroy_certinfo(certinfo); certsvc_instance_free(instance); return false; @@ -338,13 +338,13 @@ bool _permit_by_config(pkgmgrinfo_appinfo_h handle, uid_t uid) r = certsvc_certificate_get_visibility(certificate, &visibility); if (r != CERTSVC_SUCCESS) - ALARM_MGR_EXCEPTION_PRINT("certsvc_certificate_get_visibility() is failed."); + LOGE("certsvc_certificate_get_visibility() is failed."); pkgmgrinfo_pkginfo_destroy_certinfo(certinfo); certsvc_instance_free(instance); certsvc_certificate_free(certificate); - ALARM_MGR_EXCEPTION_PRINT("visibility is %d", visibility); + LOGW("visibility is %d", visibility); if (visibility & CERTSVC_VISIBILITY_PLATFORM) { return true; } @@ -352,7 +352,7 @@ bool _permit_by_config(pkgmgrinfo_appinfo_h handle, uid_t uid) if (access(tzplatform_mkpath(TZ_SYS_RO_SHARE, "alarm-manager/alarm-config-all-service-permitted"), F_OK) == 0) { - ALARM_MGR_LOG_PRINT("This profile permit alarms for all service applications\n"); + LOGD("This profile permit alarms for all service applications\n"); return true; } @@ -366,32 +366,32 @@ bool _is_permitted(const char *app_id, int alarm_type, uid_t uid) bool _return = false; if (app_id == NULL) { - ALARM_MGR_EXCEPTION_PRINT("app_id is NULL. Only expicit launch is permitted\n"); + LOGE("app_id is NULL. Only expicit launch is permitted\n"); return false; } ret = pkgmgrinfo_appinfo_get_usr_appinfo(app_id, uid, &handle); if (ret != PMINFO_R_OK) { - ALARM_MGR_EXCEPTION_PRINT("Failed to get appinfo [%s]\n", app_id); + LOGE("Failed to get appinfo [%s]\n", app_id); } else { char *app_type = NULL; ret = pkgmgrinfo_appinfo_get_component_type(handle, &app_type); if (app_type && strcmp("uiapp", app_type) == 0) { if (alarm_type & ALARM_TYPE_EXACT_SERVICE_APP) { - ALARM_MGR_EXCEPTION_PRINT("[%s] is ui application.\ + LOGE("[%s] is ui application.\ But alarm_type is ALARM_TYPE_EXACT_SERVICE_APP.\ soit is not allowed", app_id); _return = false; goto out; } - ALARM_MGR_LOG_PRINT("[%s] is ui application. It is allowed", app_id); + LOGD("[%s] is ui application. It is allowed", app_id); _return = true; goto out; } else if (app_type && strcmp("svcapp", app_type) == 0) { - ALARM_MGR_LOG_PRINT("[%s] is service application.", app_id); + LOGD("[%s] is service application.", app_id); if (_permit_by_config(handle, uid)) { - ALARM_MGR_LOG_PRINT("service applications are allowed"); + LOGD("service applications are allowed"); _return = true; goto out; } @@ -404,11 +404,11 @@ bool _is_permitted(const char *app_id, int alarm_type, uid_t uid) if (alarm_type & ALARM_TYPE_INEXACT || alarm_type & ALARM_TYPE_EXACT_SERVICE_APP) { ret = pkgmgrinfo_appinfo_foreach_background_category(handle, __bg_category_func, &info); if (ret == PMINFO_R_OK && info.has_bg) { - ALARM_MGR_LOG_PRINT("[%s] has background categories. It is allowed", app_id); + LOGD("[%s] has background categories. It is allowed", app_id); _return = true; goto out; } else { - ALARM_MGR_EXCEPTION_PRINT("Failed to foreach background category. [%s] is not allowed", app_id); + LOGE("Failed to foreach background category. [%s] is not allowed", app_id); } } } diff --git a/server/alarm-manager.c b/server/alarm-manager.c index 49f6adb..f562da7 100755 --- a/server/alarm-manager.c +++ b/server/alarm-manager.c @@ -138,7 +138,7 @@ static bool __get_caller_unique_name(int pid, char *unique_name, int size, bool char caller_appid[MAX_APP_ID_LEN] = {0,}; if (unique_name == NULL) { - ALARM_MGR_EXCEPTION_PRINT("unique_name should not be NULL."); + LOGE("unique_name should not be NULL."); return false; } @@ -167,7 +167,7 @@ static bool __get_caller_unique_name(int pid, char *unique_name, int size, bool return false; } else { if (read(fd, process_name, sizeof(process_name) - 1) <= 0) { - ALARM_MGR_EXCEPTION_PRINT("Unable to get the process name."); + LOGE("Unable to get the process name."); close(fd); return false; } @@ -192,7 +192,7 @@ gboolean __hash_table_remove_cb(gpointer key, gpointer value, gpointer user_data char *target_name = (char *)user_data; appid_cache_t *data = (appid_cache_t *)value; if (target_name && data && strcmp(target_name, data->unique_name) == 0) { - ALARM_MGR_LOG_PRINT("Remove cached data of [%s]", target_name); + LOGD("Remove cached data of [%s]", target_name); return true; } @@ -210,11 +210,11 @@ static bool __get_cached_unique_name(int pid, char *unique_name, int size, bool snprintf(unique_name, MAX_APP_ID_LEN, "%s", data->unique_name); if (is_app) *is_app = data->is_app; - ALARM_MGR_LOG_PRINT("Get cached unique_name: %s, pid:%d", unique_name, pid); + LOGD("Get cached unique_name: %s, pid:%d", unique_name, pid); return true; } - ALARM_MGR_LOG_PRINT("There is no cached unique_name for pid(%d)", pid); + LOGD("There is no cached unique_name for pid(%d)", pid); ret = __get_caller_unique_name(pid, unique_name, size, &_is_app, uid); if (ret) { @@ -240,7 +240,7 @@ void __hashtable_foreach_cb(gpointer key, gpointer value, gpointer user_data) { appid_cache_t *data = (appid_cache_t *)value; if (data) - ALARM_MGR_LOG_PRINT("# %s(%d) - %d", data->unique_name, data->pid, data->is_app); + LOGD("# %s(%d) - %d", data->unique_name, data->pid, data->is_app); } void __free_cached_value(gpointer data) @@ -263,14 +263,14 @@ void _rtc_set() char log_message[ALARMMGR_LOG_MESSAGE_SIZE] = {0,}; #endif #ifdef _SIMUL /* RTC does not work in simulator. */ - ALARM_MGR_EXCEPTION_PRINT("because it is simulator's mode, we don't set RTC."); + LOGE("because it is simulator's mode, we don't set RTC."); return; #endif if (gfd < 0) { gfd = open(rtc, O_RDWR); if (gfd < 0) { - ALARM_MGR_EXCEPTION_PRINT("RTC open failed."); + LOGE("RTC open failed."); return; } } @@ -286,7 +286,7 @@ void _rtc_set() } #endif - ALARM_MGR_LOG_PRINT("alarm_context.c_due_time is %d.", (int)alarm_context.c_due_time); + LOGD("alarm_context.c_due_time is %d.", (int)alarm_context.c_due_time); if (alarm_context.c_due_time != -1) { struct rtc_wkalrm rtc_wkalarm = { 0, }; @@ -301,20 +301,20 @@ void _rtc_set() retval = ioctl(gfd, RTC_WKALM_SET, &rtc_wkalarm); if (retval == -1) { if (errno == ENOTTY) - ALARM_MGR_EXCEPTION_PRINT("Alarm IRQs is not supported."); + LOGE("Alarm IRQs is not supported."); - ALARM_MGR_EXCEPTION_PRINT("RTC_WKALM_SET disabled ioctl is failed. errno = %s", strerror_r(errno, buf, sizeof(buf))); + LOGE("RTC_WKALM_SET disabled ioctl is failed. errno = %s", strerror_r(errno, buf, sizeof(buf))); #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG __save_module_log("FAIL: SET RTC", log_message); #endif return; } - ALARM_MGR_LOG_PRINT("[alarm-server]RTC_WKALM_SET disabled ioctl is successfully done."); + LOGD("[alarm-server]RTC_WKALM_SET disabled ioctl is successfully done."); time_t due_time = alarm_context.c_due_time; gmtime_r(&due_time, &due_tm); - ALARM_MGR_LOG_PRINT("Setted RTC Alarm date/time is %d-%d-%d, %02d:%02d:%02d (UTC).", + LOGD("Setted RTC Alarm date/time is %d-%d-%d, %02d:%02d:%02d (UTC).", due_tm.tm_mday, due_tm.tm_mon + 1, due_tm.tm_year + 1900, due_tm.tm_hour, due_tm.tm_min, due_tm.tm_sec); @@ -328,24 +328,24 @@ void _rtc_set() retval = ioctl(gfd, RTC_WKALM_SET, &rtc_wkalarm); if (retval == -1) { if (errno == ENOTTY) - ALARM_MGR_EXCEPTION_PRINT("Alarm IRQs is not supported."); + LOGE("Alarm IRQs is not supported."); - ALARM_MGR_EXCEPTION_PRINT("RTC ALARM_SET ioctl is failed. errno = %s", strerror_r(errno, buf, sizeof(buf))); + LOGE("RTC ALARM_SET ioctl is failed. errno = %s", strerror_r(errno, buf, sizeof(buf))); #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG __save_module_log("FAIL: SET RTC", log_message); #endif return; } - ALARM_MGR_LOG_PRINT("[alarm-server]RTC ALARM_SET ioctl is successfully done."); + LOGD("[alarm-server]RTC ALARM_SET ioctl is successfully done."); #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG __save_module_log("SET RTC", log_message); #endif } else { - ALARM_MGR_EXCEPTION_PRINT("[alarm-server]alarm_context.c_due_time is" + LOGE("[alarm-server]alarm_context.c_due_time is" "less than 10 sec. RTC alarm does not need to be set"); } } else { - ALARM_MGR_LOG_PRINT("[alarm-server] RTC does not work."); + LOGD("[alarm-server] RTC does not work."); } return; } @@ -361,13 +361,13 @@ static bool __set_time(time_t _time) gmtime_res = gmtime_r(&(tv.tv_sec), &tm); if (!gmtime_res) { - ALARM_MGR_EXCEPTION_PRINT("gmtime_r is failed. [%d]", errno); + LOGE("gmtime_r is failed. [%d]", errno); return false; } ret = settimeofday(&tv, NULL); if (ret < 0) { - ALARM_MGR_EXCEPTION_PRINT("settimeofday is failed.[%d]", errno); + LOGE("settimeofday is failed.[%d]", errno); return false; } @@ -389,7 +389,7 @@ static bool __set_time(time_t _time) if (gfd < 0) { gfd = open(rtc0, O_RDWR); if (gfd < 0) { - ALARM_MGR_EXCEPTION_PRINT("Opening the /dev/rtc is failed."); + LOGE("Opening the /dev/rtc is failed."); return false; } } @@ -407,13 +407,13 @@ static bool __set_time(time_t _time) ret = ioctl(gfd, RTC_SET_TIME, &_rtc_time); if (ret == -1) { - ALARM_MGR_EXCEPTION_PRINT("ALARM_SET_RTC ioctl is failed. errno = %s", strerror_r(errno, buf, sizeof(buf))); + LOGE("ALARM_SET_RTC ioctl is failed. errno = %s", strerror_r(errno, buf, sizeof(buf))); #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG strncpy(log_tag, "FAIL: SET RTC", sizeof(log_tag) - 1); __save_module_log(log_tag, log_message); #endif } else { - ALARM_MGR_LOG_PRINT("ALARM_SET_RTC ioctl is succeed. [%d]", (int)_time); + LOGD("ALARM_SET_RTC ioctl is succeed. [%d]", (int)_time); #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG strncpy(log_tag, "SET RTC", sizeof(log_tag) - 1); __save_module_log(log_tag, log_message); @@ -421,7 +421,7 @@ static bool __set_time(time_t _time) return false; } } else { - ALARM_MGR_LOG_PRINT("[alarm-server] RTC does not work."); + LOGD("[alarm-server] RTC does not work."); } return true; @@ -451,7 +451,7 @@ static void __alarm_generate_alarm_id(__alarm_info_t *__alarm_info, alarm_id_t * GSList *iter = NULL; __alarm_info->alarm_id = g_random_int_range(0, INT_MAX) + 1; - ALARM_MGR_LOG_PRINT("__alarm_info->alarm_id is %d", __alarm_info->alarm_id); + LOGD("__alarm_info->alarm_id is %d", __alarm_info->alarm_id); while (unique_id == false) { unique_id = true; @@ -477,20 +477,20 @@ static void __alarm_add_to_list(__alarm_info_t *__alarm_info) __alarm_info_t *entry = NULL; GSList *iter = NULL; - ALARM_MGR_LOG_PRINT("[alarm-server]: Before add alarm_id(%d)", __alarm_info->alarm_id); + LOGD("[alarm-server]: Before add alarm_id(%d)", __alarm_info->alarm_id); alarm_context.alarms = g_slist_append(alarm_context.alarms, __alarm_info); - ALARM_MGR_LOG_PRINT("[alarm-server]: After add alarm_id(%d)", __alarm_info->alarm_id); + LOGD("[alarm-server]: After add alarm_id(%d)", __alarm_info->alarm_id); /* alarm list */ for (iter = alarm_context.alarms; iter != NULL; iter = g_slist_next(iter)) { entry = (__alarm_info_t *)iter->data; - ALARM_MGR_LOG_PRINT("[alarm-server]: alarm_id(%d).", entry->alarm_id); + LOGD("[alarm-server]: alarm_id(%d).", entry->alarm_id); } if (!(alarm_info->alarm_type & ALARM_TYPE_VOLATILE)) { if (!_save_alarms(__alarm_info)) - ALARM_MGR_EXCEPTION_PRINT("Saving alarm_id(%d) in DB is failed.", __alarm_info->alarm_id); + LOGE("Saving alarm_id(%d) in DB is failed.", __alarm_info->alarm_id); } } @@ -581,7 +581,7 @@ static __alarm_info_t *__alarm_update_in_list(uid_t uid, alarm_id_t alarm_id, if (!(alarm_info->alarm_type & ALARM_TYPE_VOLATILE)) { if (!_update_alarms(entry)) - ALARM_MGR_EXCEPTION_PRINT("Updating alarm_id(%d) in DB is failed.", alarm_id); + LOGE("Updating alarm_id(%d) in DB is failed.", alarm_id); } return entry; @@ -598,14 +598,14 @@ static bool __alarm_remove_from_list(uid_t uid, alarm_id_t alarm_id, __alarm_info_t *entry = NULL; /*list alarms */ - ALARM_MGR_LOG_PRINT("[alarm-server]: before del : alarm id(%d)", alarm_id); + LOGD("[alarm-server]: before del : alarm id(%d)", alarm_id); for (iter = alarm_context.alarms; iter != NULL; iter = g_slist_next(iter)) { entry = (__alarm_info_t *)iter->data; if (entry->uid == uid && entry->alarm_id == alarm_id) { alarm_info = &entry->alarm_info; - ALARM_MGR_LOG_PRINT("[alarm-server]:Remove alarm id(%d)", entry->alarm_id); + LOGD("[alarm-server]:Remove alarm id(%d)", entry->alarm_id); if (!(alarm_info->alarm_type & ALARM_TYPE_VOLATILE)) { if (!_delete_alarms(alarm_id)) @@ -619,7 +619,7 @@ static bool __alarm_remove_from_list(uid_t uid, alarm_id_t alarm_id, } } - ALARM_MGR_LOG_PRINT("[alarm-server]: after del\n"); + LOGD("[alarm-server]: after del\n"); if (!found) { if (error_code) @@ -732,7 +732,7 @@ static void __alarm_update_due_time_of_all_items_in_list(double diff_time) double interval = 0; - ALARM_MGR_LOG_PRINT("alarm[%d] with duetime(%ld) at current(%ld)", entry->alarm_id, due_time, current_time); + LOGD("alarm[%d] with duetime(%ld) at current(%ld)", entry->alarm_id, due_time, current_time); if (due_time == 0) { /* 0 means this alarm has been disabled */ continue; } @@ -740,7 +740,7 @@ static void __alarm_update_due_time_of_all_items_in_list(double diff_time) interval = difftime(due_time, current_time); if (interval < 0) { - ALARM_MGR_EXCEPTION_PRINT("The duetime of alarm(%d) is OVER.", entry->alarm_id); + LOGE("The duetime of alarm(%d) is OVER.", entry->alarm_id); continue; } @@ -843,7 +843,7 @@ static bool __alarm_create_appsvc(alarm_info_t *alarm_info, alarm_id_t *alarm_id time(¤t_time); if (alarm_context.c_due_time < current_time) { - ALARM_MGR_EXCEPTION_PRINT("Caution!! alarm_context.c_due_time " + LOGE("Caution!! alarm_context.c_due_time " "(%ld) is less than current time(%ld)", alarm_context.c_due_time, current_time); alarm_context.c_due_time = -1; } @@ -852,16 +852,16 @@ static bool __alarm_create_appsvc(alarm_info_t *alarm_info, alarm_id_t *alarm_id __alarm_add_to_list(__alarm_info); if (__alarm_info->due_time == 0) { - ALARM_MGR_EXCEPTION_PRINT("[alarm-server]:Create a new alarm: " + LOGE("[alarm-server]:Create a new alarm: " "__alarm_info->due_time is 0, alarm(%d) \n", *alarm_id); return true; } else if (current_time == __alarm_info->due_time) { - ALARM_MGR_EXCEPTION_PRINT("[alarm-server]:Create alarm: " + LOGE("[alarm-server]:Create alarm: " "current_time(%ld) is same as __alarm_info->due_time(%ld)", current_time, __alarm_info->due_time); return true; } else if (difftime(__alarm_info->due_time, current_time) < 0) { - ALARM_MGR_EXCEPTION_PRINT("[alarm-server]: Expired Due Time.\ + LOGE("[alarm-server]: Expired Due Time.\ [Due time=%ld, Current Time=%ld]!!!Do not add to schedule list\n", __alarm_info->due_time, current_time); return true; @@ -873,7 +873,7 @@ static bool __alarm_create_appsvc(alarm_info_t *alarm_info, alarm_id_t *alarm_id due_time_r); } - ALARM_MGR_LOG_PRINT("[alarm-server]:alarm_context.c_due_time(%ld),\ + LOGD("[alarm-server]:alarm_context.c_due_time(%ld),\ __alarm_info->due_time(%ld)", alarm_context.c_due_time, __alarm_info->due_time); @@ -954,7 +954,7 @@ static bool __alarm_create(alarm_info_t *alarm_info, alarm_id_t *alarm_id, uid_t alarm_context.c_due_time); if (alarm_context.c_due_time < current_time) { - ALARM_MGR_EXCEPTION_PRINT("Caution!! alarm_context.c_due_time " + LOGE("Caution!! alarm_context.c_due_time " "(%ld) is less than current time(%ld)", alarm_context.c_due_time, current_time); alarm_context.c_due_time = -1; } @@ -963,14 +963,14 @@ static bool __alarm_create(alarm_info_t *alarm_info, alarm_id_t *alarm_id, uid_t __alarm_add_to_list(__alarm_info); if (__alarm_info->due_time == 0) { - ALARM_MGR_EXCEPTION_PRINT("[alarm-server]:Create a new alarm: due_time is 0, alarm(%d).", *alarm_id); + LOGE("[alarm-server]:Create a new alarm: due_time is 0, alarm(%d).", *alarm_id); return true; } else if (current_time == __alarm_info->due_time) { - ALARM_MGR_EXCEPTION_PRINT("[alarm-server]:Create alarm: current_time(%ld)\ + LOGE("[alarm-server]:Create alarm: current_time(%ld)\ is same as due_time(%ld).", current_time, __alarm_info->due_time); return true; } else if (difftime(__alarm_info->due_time, current_time) < 0) { - ALARM_MGR_EXCEPTION_PRINT("[alarm-server]: Expired Due Time.[Due time=%ld,\ + LOGE("[alarm-server]: Expired Due Time.[Due time=%ld,\ Current Time=%ld]!!!Do not add to schedule list.", __alarm_info->due_time, current_time); return true; @@ -981,7 +981,7 @@ static bool __alarm_create(alarm_info_t *alarm_info, alarm_id_t *alarm_id, uid_t *alarm_id, due_time_r); } - ALARM_MGR_LOG_PRINT("[alarm-server]:alarm_context.c_due_time(%ld), due_time(%ld)", + LOGD("[alarm-server]:alarm_context.c_due_time(%ld), due_time(%ld)", alarm_context.c_due_time, __alarm_info->due_time); if (alarm_context.c_due_time == -1 || __alarm_info->due_time < alarm_context.c_due_time) { @@ -1106,7 +1106,7 @@ static bool __alarm_create_noti(alarm_info_t *alarm_info, alarm_id_t *alarm_id, alarm_context.c_due_time); if (alarm_context.c_due_time < current_time) { - ALARM_MGR_EXCEPTION_PRINT("Caution!! alarm_context.c_due_time " + LOGE("Caution!! alarm_context.c_due_time " "(%ld) is less than current time(%ld)", alarm_context.c_due_time, current_time); alarm_context.c_due_time = -1; } @@ -1115,14 +1115,14 @@ static bool __alarm_create_noti(alarm_info_t *alarm_info, alarm_id_t *alarm_id, __alarm_add_to_list(__alarm_info); if (__alarm_info->due_time == 0) { - ALARM_MGR_EXCEPTION_PRINT("[alarm-server]:Create a new alarm: due_time is 0, alarm(%d).", *alarm_id); + LOGE("[alarm-server]:Create a new alarm: due_time is 0, alarm(%d).", *alarm_id); return true; } else if (current_time == __alarm_info->due_time) { - ALARM_MGR_EXCEPTION_PRINT("[alarm-server]:Create alarm: current_time(%ld)\ + LOGE("[alarm-server]:Create alarm: current_time(%ld)\ is same as due_time(%ld).", current_time, __alarm_info->due_time); return true; } else if (difftime(__alarm_info->due_time, current_time) < 0) { - ALARM_MGR_EXCEPTION_PRINT("[alarm-server]: Expired Due Time.[Due time=%ld,\ + LOGE("[alarm-server]: Expired Due Time.[Due time=%ld,\ Current Time=%ld]!!!Do not add to schedule list.", __alarm_info->due_time, current_time); return true; @@ -1132,7 +1132,7 @@ static bool __alarm_create_noti(alarm_info_t *alarm_info, alarm_id_t *alarm_id, SECURE_LOGD("[alarm-server]:Create a new alarm: alarm(%d) due_time(%s)", *alarm_id, due_time_r); } - ALARM_MGR_LOG_PRINT("[alarm-server]:alarm_context.c_due_time(%ld), due_time(%ld)", + LOGD("[alarm-server]:alarm_context.c_due_time(%ld), due_time(%ld)", alarm_context.c_due_time, __alarm_info->due_time); if (alarm_context.c_due_time == -1 || __alarm_info->due_time < alarm_context.c_due_time) { @@ -1159,7 +1159,7 @@ static bool __alarm_update(uid_t uid, alarm_id_t alarm_id, time(¤t_time); if (alarm_context.c_due_time < current_time) { - ALARM_MGR_EXCEPTION_PRINT("Caution!! alarm_context.c_due_time " + LOGE("Caution!! alarm_context.c_due_time " "(%ld) is less than current time(%ld)", alarm_context.c_due_time, current_time); alarm_context.c_due_time = -1; } @@ -1167,7 +1167,7 @@ static bool __alarm_update(uid_t uid, alarm_id_t alarm_id, __alarm_info = __alarm_update_in_list(uid, alarm_id, alarm_info, update_flag, error_code); if (!__alarm_info) { - ALARM_MGR_EXCEPTION_PRINT("[alarm-server]: requested alarm_id " + LOGE("[alarm-server]: requested alarm_id " "(%d) does not exist. so this value is invalid id.", alarm_id); return false; } @@ -1180,27 +1180,27 @@ static bool __alarm_update(uid_t uid, alarm_id_t alarm_id, _alarm_disable_timer(); _alarm_schedule(); - ALARM_MGR_LOG_PRINT("[alarm-server]:Update alarm: alarm(%d).", alarm_id); + LOGD("[alarm-server]:Update alarm: alarm(%d).", alarm_id); _rtc_set(); if (__alarm_info->due_time == 0) - ALARM_MGR_EXCEPTION_PRINT("[alarm-server]:Update alarm: due_time is 0."); + LOGE("[alarm-server]:Update alarm: due_time is 0."); return true; } if (__alarm_info->due_time == 0) { - ALARM_MGR_EXCEPTION_PRINT("[alarm-server]:Update alarm: " + LOGE("[alarm-server]:Update alarm: " "due_time is 0, alarm(%d)\n", alarm_id); return true; } else if (current_time == __alarm_info->due_time) { - ALARM_MGR_EXCEPTION_PRINT("[alarm-server]:Update alarm: " + LOGE("[alarm-server]:Update alarm: " "current_time(%ld) is same as due_time(%ld)", current_time, __alarm_info->due_time); return true; } else if (difftime(__alarm_info->due_time, current_time) < 0) { - ALARM_MGR_EXCEPTION_PRINT("[alarm-server]: Expired Due Time.[Due time=%ld,\ + LOGE("[alarm-server]: Expired Due Time.[Due time=%ld,\ Current Time=%ld]!!!Do not add to schedule list\n", __alarm_info->due_time, current_time); return true; @@ -1211,18 +1211,18 @@ static bool __alarm_update(uid_t uid, alarm_id_t alarm_id, "due_time(%s)\n", alarm_id, due_time_r); } - ALARM_MGR_LOG_PRINT("[alarm-server]:alarm_context.c_due_time(%ld), due_time(%ld)", + LOGD("[alarm-server]:alarm_context.c_due_time(%ld), due_time(%ld)", alarm_context.c_due_time, __alarm_info->due_time); if (alarm_context.c_due_time == -1 || __alarm_info->due_time < alarm_context.c_due_time) { _clear_scheduled_alarm_list(); _add_to_scheduled_alarm_list(__alarm_info); _alarm_set_timer(alarm_context.timer, __alarm_info->due_time); - ALARM_MGR_LOG_PRINT("[alarm-server1]:alarm_context.c_due_time " + LOGD("[alarm-server1]:alarm_context.c_due_time " "(%ld), due_time(%ld)", alarm_context.c_due_time, __alarm_info->due_time); } else if (__alarm_info->due_time == alarm_context.c_due_time) { _add_to_scheduled_alarm_list(__alarm_info); - ALARM_MGR_LOG_PRINT("[alarm-server2]:alarm_context.c_due_time " + LOGD("[alarm-server2]:alarm_context.c_due_time " "(%ld), due_time(%ld)", alarm_context.c_due_time, __alarm_info->due_time); } @@ -1383,9 +1383,9 @@ static int __post_notification(guchar *data, int datalen, uid_t uid) return -1; if (vconf_get_int(VCONFKEY_ALARM_EXPIRE_MODE, &expire_mode) != 0) - ALARM_MGR_EXCEPTION_PRINT("Failed to get value of VCONFKEY_ALARM_EXPIRE_MODE"); + LOGE("Failed to get value of VCONFKEY_ALARM_EXPIRE_MODE"); - ALARM_MGR_LOG_PRINT("Value of alarm_expire_mode [%d]", expire_mode); + LOGD("Value of alarm_expire_mode [%d]", expire_mode); if (expire_mode == ALARM_EXPIRE_MODE_NORMAL) device_display_change_state(DISPLAY_STATE_NORMAL); @@ -1427,7 +1427,7 @@ void _alarm_expired() char log_message[ALARMMGR_LOG_MESSAGE_SIZE] = {0,}; #endif - ALARM_MGR_LOG_PRINT("[alarm-server]: Enter"); + LOGD("[alarm-server]: Enter"); time_t current_time; double interval; @@ -1435,17 +1435,17 @@ void _alarm_expired() time(¤t_time); interval = difftime(alarm_context.c_due_time, current_time); - ALARM_MGR_LOG_PRINT("[alarm-server]: c_due_time(%ld), current_time(%ld), interval(%f)", + LOGD("[alarm-server]: c_due_time(%ld), current_time(%ld), interval(%f)", alarm_context.c_due_time, current_time, interval); if (alarm_context.c_due_time > current_time + 1) { - ALARM_MGR_EXCEPTION_PRINT("[alarm-server]: False Alarm. due time is (%ld) seconds future", + LOGE("[alarm-server]: False Alarm. due time is (%ld) seconds future", alarm_context.c_due_time - current_time); goto done; } /* 10 seconds is maximum permitted delay from timer expire to this function */ if (alarm_context.c_due_time + 10 < current_time) { - ALARM_MGR_EXCEPTION_PRINT("[alarm-server]: False Alarm. due time is (%ld) seconds past.", + LOGE("[alarm-server]: False Alarm. due time is (%ld) seconds past.", current_time - alarm_context.c_due_time); goto done; } @@ -1465,41 +1465,41 @@ void _alarm_expired() b = bundle_decode((bundle_raw *)(__alarm_info->bundle), b_len); if (b == NULL) { - ALARM_MGR_EXCEPTION_PRINT("Error!!!..Unable to decode the bundle!!\n"); + LOGE("Error!!!..Unable to decode the bundle!!\n"); } else { snprintf(alarm_id_val, sizeof(alarm_id_val), "%d", alarm_id); if (bundle_add_str(b, "http://tizen.org/appcontrol/data/alarm_id", alarm_id_val)) { - ALARM_MGR_EXCEPTION_PRINT("Unable to add alarm id to the bundle\n"); + LOGE("Unable to add alarm id to the bundle\n"); } else { int result = 0; int expire_mode = ALARM_EXPIRE_MODE_NORMAL; if (vconf_get_int(VCONFKEY_ALARM_EXPIRE_MODE, &expire_mode) != 0) - ALARM_MGR_EXCEPTION_PRINT("Failed to get value of VCONFKEY_ALARM_EXPIRE_MODE"); + LOGE("Failed to get value of VCONFKEY_ALARM_EXPIRE_MODE"); - ALARM_MGR_LOG_PRINT("Value of alarm_expire_mode [%d]", expire_mode); + LOGD("Value of alarm_expire_mode [%d]", expire_mode); if (_compare_api_version(&result, app_pid, __alarm_info->uid) < 0) { - ALARM_MGR_EXCEPTION_PRINT("Unable to check api version\n"); + LOGE("Unable to check api version\n"); result = -1; } if (result < 0) { /* before 2.4 */ if (aul_svc_run_service_async_for_uid(b, 0, NULL, NULL, __alarm_info->uid) < 0) - ALARM_MGR_EXCEPTION_PRINT("Unable to run app svc\n"); + LOGE("Unable to run app svc\n"); else - ALARM_MGR_LOG_PRINT("Successfuly run app svc\n"); + LOGD("Successfuly run app svc\n"); } else { /* since 2.4 */ appid = (char *)appsvc_get_appid(b); if ((__alarm_info->alarm_info.alarm_type & ALARM_TYPE_NOLAUNCH) && !aul_app_is_running(appid)) { - ALARM_MGR_EXCEPTION_PRINT("This alarm is ignored\n"); + LOGE("This alarm is ignored\n"); } else if (!(__alarm_info->alarm_info.alarm_type & ALARM_TYPE_INEXACT) || !_can_skip_expired_cb(__alarm_info->alarm_id)) { if (__alarm_info->global) { if (__find_login_user(&target_uid) < 0) { - ALARM_MGR_EXCEPTION_PRINT("Fail to get login user\n"); + LOGE("Fail to get login user\n"); ret = -1; } else { ret = aul_svc_run_service_async_for_uid(b, 0, NULL, NULL, target_uid); @@ -1509,9 +1509,9 @@ void _alarm_expired() } if (ret < 0) { - ALARM_MGR_EXCEPTION_PRINT("Unable to launch app [%s] \n", appid); + LOGE("Unable to launch app [%s] \n", appid); } else { - ALARM_MGR_LOG_PRINT("Successfuly ran app svc\n"); + LOGD("Successfuly ran app svc\n"); if (_is_ui_app(appid, __alarm_info->uid) && expire_mode == ALARM_EXPIRE_MODE_NORMAL) device_display_change_state(DISPLAY_STATE_NORMAL); @@ -1534,7 +1534,7 @@ void _alarm_expired() } if (ret < 0) - ALARM_MGR_EXCEPTION_PRINT("Failed to post notification\n"); + LOGE("Failed to post notification\n"); } else { char appid[MAX_SERVICE_NAME_LEN] = { 0, }; struct running_info_t app_info; @@ -1568,7 +1568,7 @@ void _alarm_expired() if (__alarm_info->uid >= REGULAR_UID_MIN) { is_app = _is_app(appid, __alarm_info->uid); } - ALARM_MGR_LOG_PRINT("appid : %s app?(%d)", appid, is_app); + LOGD("appid : %s app?(%d)", appid, is_app); /* Case #2. The process was killed && App type * This app is launched and owner of DBus connection is changed. and then, expiration noti is sent by DBus. */ @@ -1592,7 +1592,7 @@ void _alarm_expired() expire_info = (__expired_alarm_t *)malloc(sizeof(__expired_alarm_t)); if (G_UNLIKELY(NULL == expire_info)) { - ALARM_MGR_ASSERT_PRINT("[alarm-server]:Malloc failed!Can't notify alarm expiry info\n"); + LOGE("[alarm-server]:Malloc failed!Can't notify alarm expiry info\n"); goto done; } memset(expire_info, '\0', sizeof(__expired_alarm_t)); @@ -1610,7 +1610,7 @@ void _alarm_expired() if (__alarm_info->global) { if (__find_login_user(&target_uid) < 0) - ALARM_MGR_EXCEPTION_PRINT("Fail to get login user\n"); + LOGE("Fail to get login user\n"); else aul_launch_app_for_uid(appid, kb, target_uid); /* on_bus_name_owner_changed will be called. */ } else { @@ -1621,15 +1621,15 @@ void _alarm_expired() } else { /* Case #3. The process is alive or was killed && non-app type(daemon) * Expiration noti is sent by DBus. it makes the process alive. (dbus auto activation) */ - ALARM_MGR_LOG_PRINT("before alarm_send_noti_to_application"); + LOGD("before alarm_send_noti_to_application"); _alarm_send_noti_to_application_by_dbus(destination_app_service_name, alarm_id, __alarm_info->alarm_info.msec, __alarm_info->uid); /* dbus auto activation */ - ALARM_MGR_LOG_PRINT("after _alarm_send_noti_to_application_by_dbus"); + LOGD("after _alarm_send_noti_to_application_by_dbus"); } } - ALARM_MGR_LOG_PRINT("alarm_id[%d] is expired.", alarm_id); + LOGD("alarm_id[%d] is expired.", alarm_id); #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG snprintf(log_message, sizeof(log_message), "alarmID: %d, duetime: %ld", alarm_id, __alarm_info->due_time); @@ -1646,7 +1646,7 @@ done: _clear_scheduled_alarm_list(); alarm_context.c_due_time = -1; - ALARM_MGR_LOG_PRINT("[alarm-server]: Leave"); + LOGD("[alarm-server]: Leave"); } @@ -1661,7 +1661,7 @@ static void __on_system_time_external_changed(keynode_t *node, void *data) diff_time = vconf_keynode_get_dbl(node); } else { if (vconf_get_dbl(VCONFKEY_SYSTEM_TIMECHANGE_EXTERNAL, &diff_time) != 0) { - ALARM_MGR_EXCEPTION_PRINT("Failed to get value of VCONFKEY_SYSTEM_TIMECHANGE_EXTERNAL."); + LOGE("Failed to get value of VCONFKEY_SYSTEM_TIMECHANGE_EXTERNAL."); return; } } @@ -1669,14 +1669,14 @@ static void __on_system_time_external_changed(keynode_t *node, void *data) tzset(); time(&cur_time); - ALARM_MGR_LOG_PRINT("diff_time is %f, New time is %s\n", diff_time, ctime(&cur_time)); + LOGD("diff_time is %f, New time is %s\n", diff_time, ctime(&cur_time)); - ALARM_MGR_LOG_PRINT("[alarm-server] System time has been changed externally\n"); - ALARM_MGR_LOG_PRINT("1.alarm_context.c_due_time is %ld\n", + LOGD("[alarm-server] System time has been changed externally\n"); + LOGD("1.alarm_context.c_due_time is %ld\n", alarm_context.c_due_time); if (!__set_time(cur_time)) { /* Change both OS time and RTC */ - ALARM_MGR_EXCEPTION_PRINT("Failed to change both OS time and RTC"); + LOGE("Failed to change both OS time and RTC"); _clear_scheduled_alarm_list(); _alarm_schedule(); _rtc_set(); @@ -1692,7 +1692,7 @@ static void __on_system_time_external_changed(keynode_t *node, void *data) __alarm_update_due_time_of_all_items_in_list(diff_time); - ALARM_MGR_LOG_PRINT("2.alarm_context.c_due_time is %ld\n", + LOGD("2.alarm_context.c_due_time is %ld\n", alarm_context.c_due_time); _clear_scheduled_alarm_list(); _alarm_schedule(); @@ -1809,7 +1809,7 @@ static int __on_app_uninstalled(uid_t target_uid, int req_id, const char *pkg_ty } if (g_hash_table_remove(caller_appid_cache_table, GINT_TO_POINTER(pid)) == true) - ALARM_MGR_LOG_PRINT("Remove cachd data of pid[%d]", pid); + LOGD("Remove cachd data of pid[%d]", pid); SECURE_LOGD("Remove pkgid[%s], alarm_id[%d]", pkgid, entry->alarm_id); alarm_context.alarms = g_slist_remove(alarm_context.alarms, entry); @@ -1836,7 +1836,7 @@ static void __initialize_module_log(void) log_fd = open(ALARMMGR_LOG_FILE_PATH, O_CREAT | O_WRONLY, 0644); if (log_fd == -1) { - ALARM_MGR_EXCEPTION_PRINT("Opening the file for alarmmgr log is failed. err: %s", strerror_r(errno, buf, sizeof(buf))); + LOGE("Opening the file for alarmmgr log is failed. err: %s", strerror_r(errno, buf, sizeof(buf))); return; } @@ -1858,7 +1858,7 @@ static void __save_module_log(const char *tag, const char *message) char buf[1024]; if (log_fd == -1) { - ALARM_MGR_EXCEPTION_PRINT("The file is not ready."); + LOGE("The file is not ready."); return; } @@ -1872,7 +1872,7 @@ static void __save_module_log(const char *tag, const char *message) int ret = write(log_fd, buffer, strlen(buffer)); if (ret < 0) { - ALARM_MGR_EXCEPTION_PRINT("Writing the alarmmgr log is failed. err: %s", strerror_r(errno, buf, sizeof(buf))); + LOGE("Writing the alarmmgr log is failed. err: %s", strerror_r(errno, buf, sizeof(buf))); return; } @@ -1915,12 +1915,12 @@ gboolean __alarm_expired_directly(gpointer user_data) /* Expire alarms with duetime equal to newtime by force */ if (alarm_info->due_time == time_sec) { if (_display_lock_state(DEVICED_LCD_OFF, DEVICED_STAY_CUR_STATE, 0) != ALARMMGR_RESULT_SUCCESS) - ALARM_MGR_EXCEPTION_PRINT("_display_lock_state() is failed"); + LOGE("_display_lock_state() is failed"); if (g_dummy_timer_is_set == true) { - ALARM_MGR_LOG_PRINT("dummy alarm timer has expired."); + LOGD("dummy alarm timer has expired."); } else { - ALARM_MGR_LOG_PRINT("due_time=%ld is expired.", alarm_info->due_time); + LOGD("due_time=%ld is expired.", alarm_info->due_time); _alarm_expired(); } @@ -1928,7 +1928,7 @@ gboolean __alarm_expired_directly(gpointer user_data) _rtc_set(); if (_display_unlock_state(DEVICED_LCD_OFF, DEVICED_SLEEP_MARGIN) != ALARMMGR_RESULT_SUCCESS) - ALARM_MGR_EXCEPTION_PRINT("_display_unlock_state() is failed"); + LOGE("_display_unlock_state() is failed"); } return false; @@ -1948,7 +1948,7 @@ void __reschedule_alarms_with_newtime(int cur_time, int new_time, double diff_ti bundle_free(b); __alarm_update_due_time_of_all_items_in_list(diff_time); /* Rescheduling alarms with ALARM_TYPE_RELATIVE */ - ALARM_MGR_LOG_PRINT("Next duetime is %ld", alarm_context.c_due_time); + LOGD("Next duetime is %ld", alarm_context.c_due_time); _clear_scheduled_alarm_list(); _alarm_schedule(); @@ -1980,13 +1980,13 @@ static int __check_modifiable(uid_t uid, pid_t pid, int alarm_id) return ERR_ALARM_SYSTEM_FAIL; if (!caller_is_app) { - ALARM_MGR_LOG_PRINT("Daemon process is possible to modify alarms[%s]", + LOGD("Daemon process is possible to modify alarms[%s]", app_name); return ALARMMGR_RESULT_SUCCESS; } else { caller_pkgid = _get_pkgid_by_appid(app_name, uid); if (!caller_pkgid) { - ALARM_MGR_EXCEPTION_PRINT("Failed to get appinfo %s", app_name); + LOGE("Failed to get appinfo %s", app_name); return ERR_ALARM_SYSTEM_FAIL; } } @@ -1995,7 +1995,7 @@ static int __check_modifiable(uid_t uid, pid_t pid, int alarm_id) entry = (__alarm_info_t *)gs_iter->data; if (entry->uid == uid && entry->alarm_id == alarm_id && strcmp(caller_pkgid, entry->caller_pkgid) == 0) { - ALARM_MGR_LOG_PRINT("Found alarm of app (uid:%d, pid:%d, caller_pkgid:%s) ", uid, pid, caller_pkgid); + LOGD("Found alarm of app (uid:%d, pid:%d, caller_pkgid:%s) ", uid, pid, caller_pkgid); if (caller_pkgid) free(caller_pkgid); @@ -2003,7 +2003,7 @@ static int __check_modifiable(uid_t uid, pid_t pid, int alarm_id) } } - ALARM_MGR_EXCEPTION_PRINT("[%s] is not permitted to modify alarm_id[%d]", app_name, alarm_id); + LOGW("[%s] is not permitted to modify alarm_id[%d]", app_name, alarm_id); if (caller_pkgid) free(caller_pkgid); @@ -2032,7 +2032,7 @@ int alarm_manager_alarm_set_rtc_time(GVariant *parameters) current_time = time(NULL); alarm_tm = gmtime_r(¤t_time, &tm); if (alarm_tm == NULL) { - ALARM_MGR_EXCEPTION_PRINT("alarm_tm is NULL"); + LOGE("alarm_tm is NULL"); return ERR_ALARM_SYSTEM_FAIL; } @@ -2049,7 +2049,7 @@ int alarm_manager_alarm_set_rtc_time(GVariant *parameters) if (gfd < 0) { gfd = open(rtc, O_RDWR); if (gfd < 0) { - ALARM_MGR_EXCEPTION_PRINT("RTC open failed."); + LOGE("RTC open failed."); return ERR_ALARM_SYSTEM_FAIL; } } @@ -2065,15 +2065,15 @@ int alarm_manager_alarm_set_rtc_time(GVariant *parameters) retval = ioctl(gfd, RTC_WKALM_SET, &rtc_wkalarm); if (retval == -1) { if (errno == ENOTTY) - ALARM_MGR_EXCEPTION_PRINT("Alarm IRQs is not supported."); + LOGE("Alarm IRQs is not supported."); - ALARM_MGR_EXCEPTION_PRINT("RTC ALARM_SET ioctl is failed. errno = %s", strerror_r(errno, buf, sizeof(buf))); + LOGE("RTC ALARM_SET ioctl is failed. errno = %s", strerror_r(errno, buf, sizeof(buf))); return_code = ERR_ALARM_SYSTEM_FAIL; #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG strncpy(log_tag, "FAIL: SET RTC", sizeof(log_tag) - 1); #endif } else { - ALARM_MGR_LOG_PRINT("[alarm-server]RTC alarm is setted"); + LOGD("[alarm-server]RTC alarm is setted"); #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG strncpy(log_tag, "SET RTC", sizeof(log_tag) - 1); #endif @@ -2085,7 +2085,7 @@ int alarm_manager_alarm_set_rtc_time(GVariant *parameters) #endif return return_code; } else { - ALARM_MGR_LOG_PRINT("[alarm-server] RTC does not work."); + LOGW("[alarm-server] RTC does not work."); return ERR_ALARM_SYSTEM_FAIL; } } @@ -2114,14 +2114,14 @@ int alarm_manager_alarm_set_time(GVariant* parameters) } if (!__set_time(time_sec)) { /* Change both OS time and RTC */ - ALARM_MGR_EXCEPTION_PRINT("Failed to change both OS time and RTC"); + LOGE("Failed to change both OS time and RTC"); _clear_scheduled_alarm_list(); _alarm_schedule(); _rtc_set(); return ERR_ALARM_SYSTEM_FAIL; } - ALARM_MGR_LOG_PRINT("[TIMESTAMP]Current time(%ld), New time(%d)(%s), diff_time(%f)", + LOGD("[TIMESTAMP]Current time(%ld), New time(%d)(%s), diff_time(%f)", cur_time.tv_sec, time_sec, ctime((const time_t *)&time_sec), diff_time); __reschedule_alarms_with_newtime(cur_time.tv_sec, time_sec, diff_time); @@ -2147,7 +2147,7 @@ int alarm_manager_alarm_set_time_with_propagation_delay(GVariant* parameters) /* Check validation of requested time */ if (req_sec > cur_time.tv_sec || (req_sec == cur_time.tv_sec && req_nsec > cur_time.tv_nsec)) { - ALARM_MGR_EXCEPTION_PRINT("The requeted time(%d.%09d) must be equal to or less than current time(%ld.%09ld).", + LOGE("The requeted time(%d.%09d) must be equal to or less than current time(%ld.%09ld).", req_sec, req_nsec, cur_time.tv_sec, cur_time.tv_nsec); return ERR_ALARM_INVALID_PARAM; } @@ -2172,7 +2172,7 @@ int alarm_manager_alarm_set_time_with_propagation_delay(GVariant* parameters) nanosleep(&sleep_time, NULL); /* Wait until 0 nsec to match both OS time and RTC(sec) */ if (!__set_time(real_newtime)) { /* Change both OS time and RTC */ - ALARM_MGR_EXCEPTION_PRINT("Failed to change both OS time and RTC"); + LOGE("Failed to change both OS time and RTC"); _clear_scheduled_alarm_list(); _alarm_schedule(); _rtc_set(); @@ -2180,9 +2180,9 @@ int alarm_manager_alarm_set_time_with_propagation_delay(GVariant* parameters) } diff_time = difftime(real_newtime, cur_time.tv_sec); - ALARM_MGR_LOG_PRINT("[TIMESTAMP]Current time(%ld.%09ld), New time(%d.%09d), Real Newtime(%d), diff_time(%f)", + LOGD("[TIMESTAMP]Current time(%ld.%09ld), New time(%d.%09d), Real Newtime(%d), diff_time(%f)", cur_time.tv_sec, cur_time.tv_nsec, new_sec, new_nsec, real_newtime, diff_time); - ALARM_MGR_LOG_PRINT("Requested(%d.%09d) Delay(%ld.%09ld) Sleep(%09ld)", req_sec, req_nsec, delay.tv_sec, delay.tv_nsec, sleep_time.tv_nsec); + LOGD("Requested(%d.%09d) Delay(%ld.%09ld) Sleep(%09ld)", req_sec, req_nsec, delay.tv_sec, delay.tv_nsec, sleep_time.tv_nsec); __reschedule_alarms_with_newtime(cur_time.tv_sec, real_newtime, diff_time); return ALARMMGR_RESULT_SUCCESS; } @@ -2201,10 +2201,10 @@ int alarm_manager_alarm_set_timezone(GVariant* parameters) g_variant_get(parameters, "(&s)", &tzpath_str); - ALARM_MGR_LOG_PRINT("[TIMESTAMP]Set the timezone to %s.", tzpath_str); + LOGD("[TIMESTAMP]Set the timezone to %s.", tzpath_str); if (lstat(tzpath_str, &statbuf) == -1 && errno == ENOENT) { - ALARM_MGR_EXCEPTION_PRINT("Invalid tzpath, %s", tzpath_str); + LOGE("Invalid tzpath, %s", tzpath_str); return_code = ERR_ALARM_INVALID_PARAM; goto done; } @@ -2213,7 +2213,7 @@ int alarm_manager_alarm_set_timezone(GVariant* parameters) if (retval == 0 || (retval == -1 && errno != ENOENT)) { /* unlink the current link */ if (unlink(TIMEZONE_INFO_LINK_PATH) < 0) { - ALARM_MGR_EXCEPTION_PRINT("unlink() is failed."); + LOGE("unlink() is failed."); return_code = ERR_ALARM_SYSTEM_FAIL; goto done; } @@ -2221,7 +2221,7 @@ int alarm_manager_alarm_set_timezone(GVariant* parameters) /* create a new symlink when the /opt/etc/localtime is empty. */ if (symlink(tzpath_str, TIMEZONE_INFO_LINK_PATH) < 0) { - ALARM_MGR_EXCEPTION_PRINT("Failed to create an symlink of %s.", tzpath_str); + LOGE("Failed to create an symlink of %s.", tzpath_str); return_code = ERR_ALARM_SYSTEM_FAIL; goto done; } @@ -2231,7 +2231,7 @@ int alarm_manager_alarm_set_timezone(GVariant* parameters) /* Rescheduling alarms */ _alarm_disable_timer(); __alarm_update_due_time_of_all_items_in_list(0); - ALARM_MGR_LOG_PRINT("next expiring due_time is %ld", alarm_context.c_due_time); + LOGD("next expiring due_time is %ld", alarm_context.c_due_time); _clear_scheduled_alarm_list(); _alarm_schedule(); @@ -2291,13 +2291,13 @@ int alarm_manager_alarm_create_appsvc(GVariant *parameters, uid_t uid, pid_t pid b = bundle_decode((bundle_raw *)bundle_data, strlen(bundle_data)); if (b == NULL) { int ret_bundle = get_last_result(); - ALARM_MGR_EXCEPTION_PRINT("Failed to decode bundle_data[Error:%d]\n", ret_bundle); + LOGE("Failed to decode bundle_data[Error:%d]\n", ret_bundle); return ERR_ALARM_SYSTEM_FAIL; } else { callee_appid = appsvc_get_appid(b); if (_compare_api_version(&result, pid, uid) < 0) { - ALARM_MGR_EXCEPTION_PRINT("Unable to check api version\n"); + LOGE("Unable to check api version\n"); bundle_free(b); return ERR_ALARM_SYSTEM_FAIL; } @@ -2307,7 +2307,7 @@ int alarm_manager_alarm_create_appsvc(GVariant *parameters, uid_t uid, pid_t pid alarm_type ^= ALARM_TYPE_INEXACT; } else { /* Since 2.4 */ if (!_is_permitted(callee_appid, alarm_type, uid)) { - ALARM_MGR_EXCEPTION_PRINT("[%s] is not permitted \n", callee_appid); + LOGE("[%s] is not permitted \n", callee_appid); bundle_free(b); return ERR_ALARM_NOT_PERMITTED_APP; } @@ -2342,7 +2342,7 @@ int alarm_manager_alarm_create_appsvc(GVariant *parameters, uid_t uid, pid_t pid } if (!__alarm_create_appsvc(&alarm_info, &_alarm_id, mode_interval, uid, pid, bundle_data, &return_code)) { - ALARM_MGR_EXCEPTION_PRINT("Unable to create alarm! return_code[%d]", return_code); + LOGE("Unable to create alarm! return_code[%d]", return_code); #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG strncpy(log_tag, "FAIL: CREATE", sizeof(log_tag) - 1); #endif @@ -2414,7 +2414,7 @@ int alarm_manager_alarm_create_noti(GVariant *parameters, uid_t uid, pid_t pid, } if (!__alarm_create_noti(&alarm_info, &_alarm_id, mode_interval, uid, pid, noti_data, &return_code)) { - ALARM_MGR_EXCEPTION_PRINT("Unable to create alarm! return_code[%d]", return_code); + LOGE("Unable to create alarm! return_code[%d]", return_code); #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG strncpy(log_tag, "FAIL: CREATE", sizeof(log_tag) - 1); #endif @@ -2493,7 +2493,7 @@ int alarm_manager_alarm_create(GVariant *parameters, uid_t uid, pid_t pid, int * if (!__alarm_create(&alarm_info, &_alarm_id, uid, pid, QUANTUMIZE, 0, 0, app_service_name, app_service_name_mod, _reserved_service_name, _reserved_service_name_mod, &return_code)) { - ALARM_MGR_EXCEPTION_PRINT("Unable to create alarm! return_code[%d]", return_code); + LOGE("Unable to create alarm! return_code[%d]", return_code); #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG strncpy(log_tag, "FAIL: CREATE", sizeof(log_tag) - 1); #endif @@ -2521,7 +2521,7 @@ time_t _get_periodic_alarm_standard_time(void) if (periodic_alarm_standard_time == 0) periodic_alarm_standard_time = g_random_int_range(0, BILLION) + 1; - ALARM_MGR_LOG_PRINT("periodic_standard_time : [%ld]", periodic_alarm_standard_time); + LOGD("periodic_standard_time : [%ld]", periodic_alarm_standard_time); return periodic_alarm_standard_time; } @@ -2584,7 +2584,7 @@ int alarm_manager_alarm_create_periodic(GVariant *parameters, uid_t uid, if (!__alarm_create(&alarm_info, &_alarm_id, uid, pid, (periodic_method_e)method, interval * 60, is_ref, app_service_name, app_service_name_mod, NULL, NULL, &return_code)) { - ALARM_MGR_EXCEPTION_PRINT("Unable to create alarm! return_code[%d]", return_code); + LOGE("Unable to create alarm! return_code[%d]", return_code); #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG strncpy(log_tag, "FAIL: CREATE", sizeof(log_tag) - 1); #endif @@ -2626,13 +2626,13 @@ int alarm_manager_alarm_delete(GVariant *parameters, uid_t uid, pid_t pid) return return_code; if (!__alarm_delete(uid, alarm_id, &return_code)) { - ALARM_MGR_EXCEPTION_PRINT("Unable to delete the alarm! alarm_id[%d], return_code[%d]", alarm_id, return_code); + LOGE("Unable to delete the alarm! alarm_id[%d], return_code[%d]", alarm_id, return_code); #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG strncpy(log_tag, "FAIL: DELETE", sizeof(log_tag) - 1); #endif return_code = ERR_ALARM_SYSTEM_FAIL; } else { - ALARM_MGR_LOG_PRINT("alarm_id[%d] is removed.", alarm_id); + LOGD("alarm_id[%d] is removed.", alarm_id); #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG strncpy(log_tag, "DELETE", sizeof(log_tag) - 1); #endif @@ -2691,7 +2691,7 @@ int alarm_manager_alarm_delete_all(GVariant *parameters, uid_t uid, pid_t pid) gs_iter = g_slist_next(gs_iter); if (is_found) { - ALARM_MGR_LOG_PRINT("alarm_id[%d] is removed.", entry->alarm_id); + LOGD("alarm_id[%d] is removed.", entry->alarm_id); SECURE_LOGD("Removing is done. app_name[%s], alarm_id [%d]\n", tmp_appname, entry->alarm_id); alarm_context.alarms = g_slist_remove(alarm_context.alarms, entry); _release_alarm_info_t(entry); @@ -2757,7 +2757,7 @@ int alarm_manager_alarm_update(GVariant *parameters, uid_t uid, pid_t pid) if (!__alarm_update(uid, alarm_id, &alarm_info, update_flag, &return_code)) { - ALARM_MGR_EXCEPTION_PRINT("Unable to update the alarm! alarm_id[%d], return_code[%d]", alarm_id, return_code); + LOGE("Unable to update the alarm! alarm_id[%d], return_code[%d]", alarm_id, return_code); #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG strncpy(log_tag, "FAIL: UPDATE", sizeof(log_tag) - 1); #endif @@ -2881,11 +2881,11 @@ int alarm_manager_alarm_get_appsvc_info(GVariant *parameters, uid_t uid, gchar * if (found) { if (*b_data == NULL) { - ALARM_MGR_EXCEPTION_PRINT("The alarm(%d) is an regular alarm, not svc alarm.", alarm_id); + LOGE("The alarm(%d) is an regular alarm, not svc alarm.", alarm_id); return_code = ERR_ALARM_INVALID_TYPE; } } else { - ALARM_MGR_EXCEPTION_PRINT("The alarm(%d) is not found.", alarm_id); + LOGE("The alarm(%d) is not found.", alarm_id); return_code = ERR_ALARM_INVALID_ID; } @@ -2918,11 +2918,11 @@ int alarm_manager_alarm_get_noti_info(GVariant *parameters, uid_t uid, gchar **n if (found) { if (*noti_data == NULL) { - ALARM_MGR_EXCEPTION_PRINT("The alarm(%d) is an regular alarm, not svc alarm.", alarm_id); + LOGE("The alarm(%d) is an regular alarm, not svc alarm.", alarm_id); return_code = ERR_ALARM_INVALID_TYPE; } } else { - ALARM_MGR_EXCEPTION_PRINT("The alarm(%d) is not found.", alarm_id); + LOGE("The alarm(%d) is not found.", alarm_id); return_code = ERR_ALARM_INVALID_ID; } @@ -2951,10 +2951,10 @@ int alarm_manager_alarm_get_info(GVariant *parameters, uid_t uid, alarm_info_t * } if (_alarm_info == NULL) { - ALARM_MGR_EXCEPTION_PRINT("The alarm(%d) is not found.", alarm_id); + LOGE("The alarm(%d) is not found.", alarm_id); return ERR_ALARM_INVALID_ID; } else { - ALARM_MGR_LOG_PRINT("The alarm(%d) is found.", alarm_id); + LOGD("The alarm(%d) is found.", alarm_id); alarm_info->start.year = _alarm_info->start.year; alarm_info->start.month = _alarm_info->start.month; alarm_info->start.day = _alarm_info->start.day; @@ -2996,12 +2996,12 @@ int alarm_manager_alarm_get_next_duetime(GVariant *parameters, uid_t uid, int *d } if (find_item == NULL) { - ALARM_MGR_EXCEPTION_PRINT("The alarm(%d) is not found.", alarm_id); + LOGE("The alarm(%d) is not found.", alarm_id); return ERR_ALARM_INVALID_ID; } _alarm_set_next_duetime(find_item); - ALARM_MGR_LOG_PRINT("Next duetime : %s", ctime(&(find_item->due_time))); + LOGD("Next duetime : %s", ctime(&(find_item->due_time))); *duetime = (int)(find_item->due_time); return ALARMMGR_RESULT_SUCCESS; @@ -3041,17 +3041,17 @@ int alarm_manager_alarm_set_global(GVariant *parameters, uid_t uid) } if (alarm_info == NULL) { - ALARM_MGR_EXCEPTION_PRINT("The alarm(%d) is not found.", alarm_id); + LOGE("The alarm(%d) is not found.", alarm_id); return ERR_ALARM_INVALID_ID; } else { - ALARM_MGR_LOG_PRINT("The alarm(%d) is found.", alarm_id); + LOGD("The alarm(%d) is found.", alarm_id); if (entry->callee_pkgid == NULL) callee_pkgid = entry->app_service_name + 6; else callee_pkgid = entry->callee_pkgid; - ALARM_MGR_LOG_PRINT("The alarm pkgid : %s.", callee_pkgid); + LOGD("The alarm pkgid : %s.", callee_pkgid); retval = _pkg_is_global(callee_pkgid, uid); if (retval == ALARMMGR_RESULT_SUCCESS) { @@ -3059,7 +3059,7 @@ int alarm_manager_alarm_set_global(GVariant *parameters, uid_t uid) if (!_alarm_set_global_to_db(entry, (bool)global)) return_code = ERR_ALARM_SYSTEM_FAIL; } else { - ALARM_MGR_EXCEPTION_PRINT("Get pkginfo error [%d]", retval); + LOGE("Get pkginfo error [%d]", retval); return_code = retval; } } @@ -3087,12 +3087,12 @@ int alarm_manager_alarm_get_global(GVariant *parameters, gboolean *global) } if (find_item == NULL) { - ALARM_MGR_EXCEPTION_PRINT("The alarm(%d) is not found.", alarm_id); + LOGE("The alarm(%d) is not found.", alarm_id); return ERR_ALARM_INVALID_ID; } *global = (gboolean)find_item->global; - ALARM_MGR_LOG_PRINT("Is global : %d", *global); + LOGD("Is global : %d", *global); return ALARMMGR_RESULT_SUCCESS; } @@ -3117,7 +3117,7 @@ static void __initialize_noti() /* VCONFKEY_SYSTEM_TIMECHANGE_EXTERNAL is set by OSP app-service. */ if (vconf_notify_key_changed (VCONFKEY_SYSTEM_TIMECHANGE_EXTERNAL, __on_system_time_external_changed, NULL) < 0) { - ALARM_MGR_LOG_PRINT("Failed to add callback for time external changing event."); + LOGD("Failed to add callback for time external changing event."); } /* If the caller or callee app is uninstalled, all registered alarms will be canceled. */ @@ -3141,11 +3141,11 @@ void _alarm_initialize() //For debug int expire_mode = ALARM_EXPIRE_MODE_NORMAL; vconf_get_int(VCONFKEY_ALARM_EXPIRE_MODE, &expire_mode); - ALARM_MGR_LOG_PRINT("alarm_expire_mode : %d", expire_mode); + LOGD("alarm_expire_mode : %d", expire_mode); alarm_context.timer = _initialize_timer(); if (alarm_context.timer == -1) { - ALARM_MGR_EXCEPTION_PRINT("because _initialize_timer failed, " + LOGE("because _initialize_timer failed, " "alarm-server cannot be runned.\n"); exit(1); } @@ -3153,7 +3153,7 @@ void _alarm_initialize() if (_initialize_dbus() == false) { /* because dbus's initialize * failed, we cannot continue any more. */ - ALARM_MGR_EXCEPTION_PRINT("because _initialize_dbus failed, " + LOGE("because _initialize_dbus failed, " "alarm-server cannot be runned.\n"); exit(1); } @@ -3164,7 +3164,7 @@ void _alarm_initialize() __initialize_scheduled_alarm_list(); if (_initialize_db() == false) { - ALARM_MGR_EXCEPTION_PRINT("_initialize_db failed, " + LOGE("_initialize_db failed, " "alarm cannot be stored to database.\n"); } __initialize_alarm_list(); -- cgit v1.2.3