From 026ec5afe89e86a93b3f5e1e6c2e178b5733833f Mon Sep 17 00:00:00 2001 From: Jiwoong Im Date: Tue, 19 Apr 2016 13:54:25 +0900 Subject: [PATCH] set destination in alarm_expired signal Change-Id: I12f2bc4681dd7093ed229cdc149aaebc0703e091 Signed-off-by: Jiwoong Im --- alarm-manager.c | 8 ++++---- src/alarm-lib.c | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/alarm-manager.c b/alarm-manager.c index 43edc3a..46a5246 100644 --- a/alarm-manager.c +++ b/alarm-manager.c @@ -1149,7 +1149,7 @@ static void __alarm_send_noti_to_application(const char *app_service_name, alarm SECURE_LOGI("[alarm server][send expired_alarm(alarm_id=%d) to app_service_name(%s)]", alarm_id, service_name); ret = g_dbus_connection_emit_signal(alarm_context.connection, - NULL, + service_name, "/org/tizen/alarm/manager", "org.tizen.alarm.manager", "alarm_expired", @@ -1399,14 +1399,14 @@ static void __alarm_expired() char appid[MAX_SERVICE_NAME_LEN] = { 0, }; pkgmgrinfo_appinfo_h appinfo_handle = NULL; - if (strncmp(g_quark_to_string(__alarm_info->quark_dst_service_name), "null", 4) == 0) { + if (g_quark_to_string(__alarm_info->quark_bundle) != NULL && strncmp(g_quark_to_string(__alarm_info->quark_dst_service_name), "null", 4) == 0) { SECURE_LOGD("[alarm-server]:destination is null, so we send expired alarm to %s(%u).", g_quark_to_string(__alarm_info->quark_app_service_name), __alarm_info->quark_app_service_name); - destination_app_service_name = g_quark_to_string(__alarm_info->quark_app_service_name); + destination_app_service_name = g_quark_to_string(__alarm_info->quark_app_service_name_mod); } else { SECURE_LOGD("[alarm-server]:destination :%s(%u)", g_quark_to_string(__alarm_info->quark_dst_service_name), __alarm_info->quark_dst_service_name); - destination_app_service_name = g_quark_to_string(__alarm_info->quark_dst_service_name); + destination_app_service_name = g_quark_to_string(__alarm_info->quark_dst_service_name_mod); } /* diff --git a/src/alarm-lib.c b/src/alarm-lib.c index 29cfaec..a1e65ff 100644 --- a/src/alarm-lib.c +++ b/src/alarm-lib.c @@ -351,8 +351,11 @@ EXPORT_API int alarmmgr_init(const char *appid) { SECURE_LOGD("Enter"); char service_name[MAX_SERVICE_NAME_LEN] = { 0 }; + char service_name_mod[MAX_SERVICE_NAME_LEN] = { 0 }; int ret; int len = 0; + int i = 0; + int j = 0; if (appid == NULL) return ERR_ALARM_INVALID_PARAM; @@ -382,11 +385,23 @@ EXPORT_API int alarmmgr_init(const char *appid) NULL, NULL); + memset(service_name_mod, 'a', MAX_SERVICE_NAME_LEN - 1); + len = strlen("ALARM."); strncpy(service_name, "ALARM.", len); strncpy(service_name + len, appid, strlen(appid)); + for (i = 0; i <= strlen(service_name); i++) { + if (service_name[i] == '.') { + service_name_mod[j] = service_name[i]; + j++; + } else { + service_name_mod[j] = service_name[i]; + } + j++; + } alarm_context.quark_app_service_name = g_quark_from_string(service_name); + alarm_context.quark_app_service_name_mod = g_quark_from_string(service_name_mod); b_initialized = true; -- 2.7.4