From 5511c1678655b10153caf040dfd9de1a023e1b2f Mon Sep 17 00:00:00 2001 From: Myungki Lee Date: Tue, 11 Apr 2017 15:33:18 +0900 Subject: [PATCH 01/16] Release version 1.4.9 - Use license macro Change-Id: Ie3979362e9792b27b091c67698e1b6122f651a87 Signed-off-by: Myungki Lee --- packaging/data-provider-master.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index 7d3d711..4bff4cf 100755 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -2,7 +2,7 @@ Name: data-provider-master Summary: Master service provider for badge, shortcut, notification -Version: 1.4.8 +Version: 1.4.9 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From 083d0fe48a05492a251ad3eb2f4d7baff2750602 Mon Sep 17 00:00:00 2001 From: Seungha Son Date: Tue, 18 Apr 2017 09:54:18 +0900 Subject: [PATCH 02/16] Fix memory leak Signed-off-by: Seungha Son Change-Id: I43af1f0eb21e3057e78b42528ed466c5d1780951 Signed-off-by: jusung son --- src/notification_service.c | 170 +++++++++++++++++++++++++-------------------- 1 file changed, 96 insertions(+), 74 deletions(-) diff --git a/src/notification_service.c b/src/notification_service.c index eff5676..30fc09d 100755 --- a/src/notification_service.c +++ b/src/notification_service.c @@ -720,24 +720,29 @@ int notification_load_noti_by_tag(GVariant *parameters, GVariant **reply_body, u g_variant_get(parameters, "(&s&si)", &pkgname, &tag, ¶m_uid); ret = _validate_and_set_param_uid_with_uid(uid, ¶m_uid); if (ret != NOTIFICATION_ERROR_NONE) - return ret; + goto out; DbgPrint("_load_noti_by_tag pkgname : %s, tag : %s ", pkgname, tag); ret = notification_noti_get_by_tag(noti, pkgname, tag, param_uid); + if (ret != NOTIFICATION_ERROR_NONE) { + ErrPrint("There is no notification that is matched tag [%s]", tag); + goto out; + } - DbgPrint("notification_noti_get_by_tag ret : %d", ret); print_noti(noti); - *reply_body = notification_ipc_make_gvariant_from_noti(noti, true); - notification_free(noti); - if (*reply_body == NULL) { ErrPrint("cannot make reply_body"); - return NOTIFICATION_ERROR_OUT_OF_MEMORY; + ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; } } else { ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; } + +out: + if (noti) + notification_free(noti); + DbgPrint("_load_noti_by_tag done !!"); return ret; } @@ -756,26 +761,27 @@ int notification_load_noti_by_priv_id(GVariant *parameters, GVariant **reply_bod g_variant_get(parameters, "(&sii)", &pkgname, &priv_id, ¶m_uid); ret = _validate_and_set_param_uid_with_uid(uid, ¶m_uid); if (ret != NOTIFICATION_ERROR_NONE) - return ret; + goto out; DbgPrint("load_noti_by_priv_id pkgname : %s, priv_id : %d ", pkgname, priv_id); ret = notification_noti_get_by_priv_id(noti, priv_id); - - DbgPrint("notification_noti_get_by_priv_id ret : %d", ret); - print_noti(noti); + if (ret != NOTIFICATION_ERROR_NONE) + goto out; *reply_body = notification_ipc_make_gvariant_from_noti(noti, true); - notification_free(noti); - if (*reply_body == NULL) { ErrPrint("cannot make reply_body"); - return NOTIFICATION_ERROR_OUT_OF_MEMORY; + ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; } } else { ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; } - DbgPrint("_load_noti_by_priv_id done !!"); +out: + if (noti) + notification_free(noti); + + DbgPrint("notification_load_noti_by_priv_id done [%d]", ret); return ret; } @@ -1630,22 +1636,28 @@ int notification_add_noti_template(GVariant *parameters, GVariant **reply_body, g_variant_unref(body); if (ret != NOTIFICATION_ERROR_NONE) { ErrPrint("failed to make a notification:%d\n", ret); - return ret; + goto out; } ret = notification_noti_check_count_for_template(noti, &count); - if (count >= NOTI_TEMPLATE_LIMIT) - return NOTIFICATION_ERROR_MAX_EXCEEDED; + if (count >= NOTI_TEMPLATE_LIMIT) { + ErrPrint("Exceed limit value that is saved tamplate :%d\n", ret); + ret = NOTIFICATION_ERROR_MAX_EXCEEDED; + goto out; + } ret = notification_noti_add_template(noti, template_name); - if (ret != NOTIFICATION_ERROR_NONE) { + if (ret != NOTIFICATION_ERROR_NONE) ErrPrint("failed to add a notification:%d\n", ret); - return ret; - } } else { ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; } +out: + if (noti) + notification_free(noti); + + DbgPrint("notification_add_noti_template is done [%d]", ret); return ret; } @@ -1663,27 +1675,30 @@ int notification_get_noti_template(GVariant *parameters, GVariant **reply_body, ret = aul_app_get_appid_bypid_for_uid(pid, appid, sizeof(appid), uid); if (ret != AUL_R_OK) { ErrPrint("failed to get appid:%d", ret); - return ret; + ret = NOTIFICATION_ERROR_INVALID_PARAMETER; + goto out; } ret = notification_noti_get_package_template(noti, appid, template_name); if (ret != NOTIFICATION_ERROR_NONE) { DbgPrint("failed to get template:%d", ret); - return ret; + goto out; } *reply_body = notification_ipc_make_gvariant_from_noti(noti, false); - notification_free(noti); - if (*reply_body == NULL) { ErrPrint("cannot make reply_body"); - return NOTIFICATION_ERROR_OUT_OF_MEMORY; + ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; } } else { ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; } - DbgPrint("_get_noti_template done !!"); +out: + if (noti) + notification_free(noti); + + DbgPrint("notification_get_noti_template is done [%d]", ret); return ret; } @@ -1700,23 +1715,24 @@ int notification_get_noti_package_template(GVariant *parameters, GVariant **repl ret = notification_noti_get_package_template(noti, pkgname, template_name); if (ret != NOTIFICATION_ERROR_NONE) { - DbgPrint("failed to get template:%d", ret); - return ret; + ErrPrint("failed to get template:%d", ret); + goto out; } *reply_body = notification_ipc_make_gvariant_from_noti(noti, false); - notification_free(noti); - if (*reply_body == NULL) { ErrPrint("cannot make reply_body"); - return NOTIFICATION_ERROR_OUT_OF_MEMORY; + ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; } } else { ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; } - DbgPrint("_get_noti_package_template done !!"); +out: + if (noti) + notification_free(noti); + DbgPrint("notification_get_noti_package_template is done [%d]", ret); return ret; } @@ -1868,53 +1884,60 @@ int notification_send_noti_event(GVariant *parameters, GVariant **reply_body) notification_h noti; noti = notification_create(NOTIFICATION_TYPE_NOTI); - if (noti != NULL) { g_variant_get(parameters, "(vi)", &coupled_body, &event_type); g_variant_get(coupled_body, "(v)", &body); ret = notification_ipc_make_noti_from_gvariant(noti, body); + g_variant_unref(coupled_body); + g_variant_unref(body); + if (ret != NOTIFICATION_ERROR_NONE) { ErrPrint("failed to make a notification from gvariant"); - return ret; + goto out; } - g_variant_unref(coupled_body); - g_variant_unref(body); - ret = notification_get_id(noti, NULL, &priv_id); if (ret != NOTIFICATION_ERROR_NONE) - return ret; + goto out; info = __find_sender_info_by_priv_id(priv_id); - if (info == NULL || info->busname == NULL) - return NOTIFICATION_ERROR_INVALID_PARAMETER; + if (info == NULL || info->busname == NULL) { + ret = NOTIFICATION_ERROR_INVALID_PARAMETER; + goto out; + } if (!info->watcher_id) { if (!is_existed_busname(info->busname)) { __event_list = g_list_remove(g_list_first(__event_list), info); __free_event_info(info); - return NOTIFICATION_ERROR_IO_ERROR; + ret = NOTIFICATION_ERROR_IO_ERROR; + goto out; } else { info->watcher_id = __insert_sender_watcher_id(info); } } ret = send_event_notify_by_busname(parameters, "send_event", info->busname, PROVIDER_NOTI_EVENT_INTERFACE_NAME); - notification_free(noti); + if (ret != NOTIFICATION_ERROR_NONE) { + ErrPrint("failed to send event"); + goto out; + } + *reply_body = g_variant_new("()"); + if (*reply_body == NULL) { + ErrPrint("cannot make reply body"); + ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; + } } else { ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; } - *reply_body = g_variant_new("()"); - if (*reply_body == NULL) { - ErrPrint("cannot make reply body"); - return NOTIFICATION_ERROR_OUT_OF_MEMORY; - } - - DbgPrint("notification_send_noti_event done !! %d", ret); +out: + if (noti) + notification_free(noti); + DbgPrint("notification_send_noti_event is done [%d]", ret); return ret; } @@ -1935,28 +1958,27 @@ int notification_send_noti_event_by_priv_id(GVariant *parameters, GVariant **rep ret = notification_noti_get_by_priv_id(noti, priv_id); if (ret != NOTIFICATION_ERROR_NONE) { ErrPrint("failed to get notification by priv id [%d]", ret); - notification_free(noti); - return ret; + goto out; } ret = notification_get_event_flag(noti, &event_flag); if (ret != NOTIFICATION_ERROR_NONE || event_flag == false) { - notification_free(noti); - return NOTIFICATION_ERROR_INVALID_PARAMETER; + ret = NOTIFICATION_ERROR_INVALID_PARAMETER; + goto out; } info = __find_sender_info_by_priv_id(priv_id); if (info == NULL || info->busname == NULL) { - notification_free(noti); - return NOTIFICATION_ERROR_INVALID_PARAMETER; + ret = NOTIFICATION_ERROR_INVALID_PARAMETER; + goto out; } if (!info->watcher_id) { if (!is_existed_busname(info->busname)) { __event_list = g_list_remove(g_list_first(__event_list), info); __free_event_info(info); - notification_free(noti); - return NOTIFICATION_ERROR_IO_ERROR; + ret = NOTIFICATION_ERROR_IO_ERROR; + goto out; } else { info->watcher_id = __insert_sender_watcher_id(info); } @@ -1965,23 +1987,25 @@ int notification_send_noti_event_by_priv_id(GVariant *parameters, GVariant **rep body = notification_ipc_make_gvariant_from_noti(noti, false); if (body == NULL) { ErrPrint("Can't make gvariant to noti"); - notification_free(noti); - return NOTIFICATION_ERROR_OUT_OF_MEMORY; + ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; + goto out; } ret = send_event_notify_by_busname(g_variant_new("(vi)", body, event_type), "send_event", info->busname, PROVIDER_NOTI_EVENT_INTERFACE_NAME); - notification_free(noti); + *reply_body = g_variant_new("()"); + if (*reply_body == NULL) { + ErrPrint("cannot make reply body"); + ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; + } } else { return NOTIFICATION_ERROR_OUT_OF_MEMORY; } - *reply_body = g_variant_new("()"); - if (*reply_body == NULL) { - ErrPrint("cannot make reply body"); - return NOTIFICATION_ERROR_OUT_OF_MEMORY; - } +out: + if (noti) + notification_free(noti); - DbgPrint("notification_send_noti_event_by_priv_id done !! %d", ret); + DbgPrint("notification_send_noti_event_by_priv_id done [%d]", ret); return ret; } @@ -2053,9 +2077,7 @@ HAPI int notification_delete_noti_by_appid(const char *appid, uid_t uid) ret = notification_noti_delete_all(NOTIFICATION_TYPE_NONE, appid, &num_deleted, &list_deleted, uid); if (ret != NOTIFICATION_ERROR_NONE) { ErrPrint("failed to delete notifications:%d\n", ret); - if (list_deleted != NULL) - free(list_deleted); - return ret; + goto out; } if (num_deleted > 0) { @@ -2070,18 +2092,18 @@ HAPI int notification_delete_noti_by_appid(const char *appid, uid_t uid) g_variant_unref(deleted_noti_list); if (ret != NOTIFICATION_ERROR_NONE) { ErrPrint("failed to send notify:%d\n", ret); - return ret; + goto out; } for (i = 0; i < num_deleted; i++) { ret = __delete_sender_info(*(list_deleted + i)); if (ret != NOTIFICATION_ERROR_NONE) - return ret; + goto out; } - - free(list_deleted); } - +out: + if (list_deleted != NULL) + free(list_deleted); return ret; } -- 2.7.4 From 3549f9d4b6fef242cdb732a263a4fe8b925d82e9 Mon Sep 17 00:00:00 2001 From: Seungha Son Date: Thu, 20 Apr 2017 07:26:42 +0900 Subject: [PATCH 03/16] Release version 1.4.10 Fix memory leak Signed-off-by: Seungha Son Change-Id: Icebf9b2b1cc1ea38846a4630948e0dfacf0d323e --- packaging/data-provider-master.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index 4bff4cf..e6e47db 100755 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -2,7 +2,7 @@ Name: data-provider-master Summary: Master service provider for badge, shortcut, notification -Version: 1.4.9 +Version: 1.4.10 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From ee13a9693c12e4d39c9483a5d167faecfd6a19f1 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 28 Apr 2017 07:34:07 +0900 Subject: [PATCH 04/16] Fix build problem Add a build dependency: - libtzplatform-config Change-Id: Ibaaebee560da79b7f02e3ef2866e63014bc8abd5 Signed-off-by: Hwankyu Jhun --- CMakeLists.txt | 1 + packaging/data-provider-master.spec | 1 + 2 files changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b8e3278..01b4bcd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ pkg_check_modules(pkg REQUIRED libsystemd-daemon capi-appfw-app-manager alarm-service + libtzplatform-config ) SET(PACKAGE "${PROJECT_NAME}") diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index e6e47db..c29dc4a 100755 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -30,6 +30,7 @@ BuildRequires: pkgconfig(badge) BuildRequires: pkgconfig(shortcut) BuildRequires: pkgconfig(libsystemd-daemon) BuildRequires: pkgconfig(alarm-service) +BuildRequires: pkgconfig(libtzplatform-config) Requires(post): dbus -- 2.7.4 From a7262856463049b2b3a1d679159f197ecc6e3872 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 28 Apr 2017 07:48:20 +0900 Subject: [PATCH 05/16] Release version 1.4.11 Changes: - Fix build problem Change-Id: I9b515ebe66dd13bc4703b9522038d0ffbd4f5a78 Signed-off-by: Hwankyu Jhun --- packaging/data-provider-master.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index c29dc4a..97af8f9 100755 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -2,7 +2,7 @@ Name: data-provider-master Summary: Master service provider for badge, shortcut, notification -Version: 1.4.10 +Version: 1.4.11 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From d982fb5e6db31ab10c0fb11cc6df79ca3004d2b4 Mon Sep 17 00:00:00 2001 From: Seungha Son Date: Wed, 10 May 2017 08:31:25 +0900 Subject: [PATCH 06/16] Remove unnecessary line Signed-off-by: Seungha Son Change-Id: I31ac9fb5efa661f97ebe71d6f187a0c63c4cc39a --- src/badge_service.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/badge_service.c b/src/badge_service.c index 24d01c1..69ecfca 100755 --- a/src/badge_service.c +++ b/src/badge_service.c @@ -341,8 +341,6 @@ int badge_insert(GVariant *parameters, GVariant **reply_body, uid_t uid) return ret; } - - ret = badge_db_get_allow_to_display_by_appid(pkgname, &allow_to_display, param_uid); if (ret != BADGE_ERROR_NONE) { ErrPrint("failed to get allow_to_display by appid : %d\n", ret); -- 2.7.4 From 3bd7ccaf1a4e4a056f4b18c8128c5f07464eb2c7 Mon Sep 17 00:00:00 2001 From: Seungha Son Date: Thu, 11 May 2017 16:47:57 +0900 Subject: [PATCH 07/16] Modify logic related with setting refresh If an application wants to get a notification_setting_h by using appid, the response time will be longer if DB data is not created. If the information is not in DB data, it shortens response time by sending initialized setting handle. Signed-off-by: Seungha Son Change-Id: Ie131b6d93309560c395d50f9b90921b2e41f7cfd --- src/notification_service.c | 77 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 63 insertions(+), 14 deletions(-) diff --git a/src/notification_service.c b/src/notification_service.c index 30fc09d..de7796e 100755 --- a/src/notification_service.c +++ b/src/notification_service.c @@ -886,20 +886,64 @@ int notification_get_setting_array(GVariant *parameters, GVariant **reply_body, return ret; } +static bool __init_setting_handle_by_appid(const char *appid, notification_setting_h *setting, uid_t uid) +{ + bool ret = false; + int ret_pkgmgr; + char *pkgname = NULL; + notification_setting_h ret_setting = NULL; + pkgmgrinfo_appinfo_h handle = NULL; + + if (appid == NULL || setting == NULL) + return false; + + ret_pkgmgr = pkgmgrinfo_appinfo_get_appinfo(appid, &handle); + if (ret_pkgmgr != PMINFO_R_OK) { + ErrPrint("failed to pkgmgrinfo_appinfo_get_appinfo [%s][%d]", appid, ret); + goto out; + } + + ret_pkgmgr = pkgmgrinfo_appinfo_get_pkgname(handle, &pkgname); + if (ret_pkgmgr != PMINFO_R_OK) { + ErrPrint("failed to pkgmgrinfo_appinfo_get_pkgname [%s][%d]", appid, ret); + goto out; + } + + ret_setting = (struct notification_setting *)malloc(sizeof(struct notification_setting)); + if (ret_setting == NULL) { + ErrPrint("failed to alloc memory"); + goto out; + } + + ret_setting->package_name = strdup(pkgname); + ret_setting->appid = strdup(appid); + ret_setting->allow_to_notify = 1; + ret_setting->do_not_disturb_except = 0; + ret_setting->visibility_class = 0; + ret_setting->pop_up_notification = 1; + ret_setting->lock_screen_content_level = 0; + ret_setting->app_disabled = 0; + + *setting = ret_setting; + ret = true; + +out: + if (handle) + pkgmgrinfo_appinfo_destroy_appinfo(handle); + + return ret; +} + /* get_setting_by_appid */ int notification_get_setting_by_appid(GVariant *parameters, GVariant **reply_body, uid_t uid) { + bool err; int ret; GVariant *body; char *appid = NULL; notification_setting_h setting = NULL; uid_t param_uid; - if (need_to_reload_pkginfo_for_notification) { - notification_setting_refresh_setting_table(tzplatform_getuid(TZ_SYS_DEFAULT_USER)); - need_to_reload_pkginfo_for_notification = 0; - } - g_variant_get(parameters, "(&si)", &appid, ¶m_uid); ret = _validate_and_set_param_uid_with_uid(uid, ¶m_uid); if (ret != NOTIFICATION_ERROR_NONE) @@ -907,23 +951,28 @@ int notification_get_setting_by_appid(GVariant *parameters, GVariant **reply_bod DbgPrint("get setting by appid : %s uid : %d", appid, param_uid); ret = noti_setting_service_get_setting_by_appid(appid, &setting, param_uid); - if (ret == NOTIFICATION_ERROR_NONE) { - body = notification_ipc_make_gvariant_from_setting(setting); - notification_setting_free_notification(setting); - - if (body == NULL) { - ErrPrint("fail to make gvariant"); - return NOTIFICATION_ERROR_OUT_OF_MEMORY; - } - } else { + if (ret == NOTIFICATION_ERROR_NOT_EXIST_ID) { + err = __init_setting_handle_by_appid(appid, &setting, param_uid); + if (err == false) + return NOTIFICATION_ERROR_IO_ERROR; + ret = NOTIFICATION_ERROR_NONE; + } else if (ret != NOTIFICATION_ERROR_NONE) { return ret; } + body = notification_ipc_make_gvariant_from_setting(setting); + notification_setting_free_notification(setting); + if (body == NULL) { + ErrPrint("fail to make gvariant"); + return NOTIFICATION_ERROR_OUT_OF_MEMORY; + } + *reply_body = g_variant_new("(v)", body); if (*reply_body == NULL) { ErrPrint("cannot make reply_body"); return NOTIFICATION_ERROR_OUT_OF_MEMORY; } + return ret; } -- 2.7.4 From 58d3add8c90e97f085421deff1624b9b24aaf65c Mon Sep 17 00:00:00 2001 From: Seungha Son Date: Fri, 19 May 2017 11:11:50 +0900 Subject: [PATCH 08/16] Release version 1.4.12 Changed: - Remove unnecessary Lines - Modify logic related with setting refresh Signed-off-by: Seungha Son Change-Id: Iaf0d3923f0da1a2d849b9c3893fc450e781882e9 --- packaging/data-provider-master.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index 97af8f9..61aafdf 100755 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -2,7 +2,7 @@ Name: data-provider-master Summary: Master service provider for badge, shortcut, notification -Version: 1.4.11 +Version: 1.4.12 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From 0fdc2f28fa869887e9eb49430849cbacaf4323c0 Mon Sep 17 00:00:00 2001 From: Seungha Son Date: Tue, 23 May 2017 11:15:41 +0900 Subject: [PATCH 09/16] Pass pid as a function paramter Before accessing badge db, pass pid to verify that the process is a daemon. related patch : https://review.tizen.org/gerrit/#/c/130553/ Signed-off-by: Seungha Son Change-Id: I9612315b0907f5544c522e36d12cc1a8a4f6f311 --- include/badge_service.h | 4 ++-- src/badge_service.c | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/badge_service.h b/include/badge_service.h index 3bbc725..6428739 100755 --- a/include/badge_service.h +++ b/include/badge_service.h @@ -23,8 +23,8 @@ extern int badge_service_fini(void); int badge_get_badge_existing(GVariant *parameters, GVariant **reply_body, uid_t uid); int badge_get_badge_list(GVariant *parameters, GVariant **reply_body, uid_t uid); int badge_insert(GVariant *parameters, GVariant **reply_body, uid_t uid); -int badge_delete(GVariant *parameters, GVariant **reply_body, uid_t uid); -int badge_set_badge_count(GVariant *parameters, GVariant **reply_body, uid_t uid); +int badge_delete(GVariant *parameters, GVariant **reply_body, uid_t uid, pid_t pid); +int badge_set_badge_count(GVariant *parameters, GVariant **reply_body, uid_t uid, pid_t pid); int badge_get_badge_count(GVariant *parameters, GVariant **reply_body, uid_t uid); int badge_set_display_option(GVariant *parameters, GVariant **reply_body, uid_t uid); int badge_get_display_option(GVariant *parameters, GVariant **reply_body, const gchar *sender, uid_t uid); diff --git a/src/badge_service.c b/src/badge_service.c index 69ecfca..eec1691 100755 --- a/src/badge_service.c +++ b/src/badge_service.c @@ -70,6 +70,7 @@ static void _badge_dbus_method_call_handler(GDBusConnection *conn, GVariant *reply_body = NULL; int ret = BADGE_ERROR_INVALID_PARAMETER; uid_t uid = get_sender_uid(sender); + pid_t pid = get_sender_pid(sender); if (g_strcmp0(method_name, "badge_service_register") == 0) ret = service_register(parameters, &reply_body, sender, @@ -81,9 +82,9 @@ static void _badge_dbus_method_call_handler(GDBusConnection *conn, else if (g_strcmp0(method_name, "insert_badge") == 0) ret = badge_insert(parameters, &reply_body, uid); else if (g_strcmp0(method_name, "delete_badge") == 0) - ret = badge_delete(parameters, &reply_body, uid); + ret = badge_delete(parameters, &reply_body, uid, pid); else if (g_strcmp0(method_name, "set_badge_count") == 0) - ret = badge_set_badge_count(parameters, &reply_body, uid); + ret = badge_set_badge_count(parameters, &reply_body, uid, pid); else if (g_strcmp0(method_name, "get_badge_count") == 0) ret = badge_get_badge_count(parameters, &reply_body, uid); else if (g_strcmp0(method_name, "set_disp_option") == 0) @@ -375,7 +376,7 @@ int badge_insert(GVariant *parameters, GVariant **reply_body, uid_t uid) } /* delete_badge */ -int badge_delete(GVariant *parameters, GVariant **reply_body, uid_t uid) +int badge_delete(GVariant *parameters, GVariant **reply_body, uid_t uid, pid_t pid) { int ret = BADGE_ERROR_NONE; char *pkgname = NULL; @@ -389,11 +390,10 @@ int badge_delete(GVariant *parameters, GVariant **reply_body, uid_t uid) if (ret != BADGE_ERROR_NONE) return ret; - if (pkgname != NULL && caller != NULL) { - ret = badge_db_delete(pkgname, caller, param_uid); - } else { + if (pkgname != NULL && caller != NULL) + ret = badge_db_delete(pkgname, caller, param_uid, pid); + else return BADGE_ERROR_INVALID_PARAMETER; - } if (ret != BADGE_ERROR_NONE) { ErrPrint("failed to delete badge :%d\n", ret); @@ -426,7 +426,7 @@ int badge_delete(GVariant *parameters, GVariant **reply_body, uid_t uid) } /* set_badge_count */ -int badge_set_badge_count(GVariant *parameters, GVariant **reply_body, uid_t uid) +int badge_set_badge_count(GVariant *parameters, GVariant **reply_body, uid_t uid, pid_t pid) { int ret = BADGE_ERROR_NONE; char *pkgname = NULL; @@ -447,7 +447,7 @@ int badge_set_badge_count(GVariant *parameters, GVariant **reply_body, uid_t uid badge_setting_refresh_setting_table(tzplatform_getuid(TZ_SYS_DEFAULT_USER)); need_to_reload_pkginfo_for_badge = 0; } - ret = badge_db_set_count(pkgname, caller, count, param_uid); + ret = badge_db_set_count(pkgname, caller, count, param_uid, pid); } else { return BADGE_ERROR_INVALID_PARAMETER; } -- 2.7.4 From 55d4ff8bc0f8d8849c44bd3c0fe420136cc2f01b Mon Sep 17 00:00:00 2001 From: Son seungha Date: Mon, 29 May 2017 01:24:30 +0000 Subject: [PATCH 10/16] Revert "Pass pid as a function paramter" This reverts commit 0fdc2f28fa869887e9eb49430849cbacaf4323c0. Change-Id: Ic91395f078fcfc7911d88c118b19edb9846d7c25 --- include/badge_service.h | 4 ++-- src/badge_service.c | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/badge_service.h b/include/badge_service.h index 6428739..3bbc725 100755 --- a/include/badge_service.h +++ b/include/badge_service.h @@ -23,8 +23,8 @@ extern int badge_service_fini(void); int badge_get_badge_existing(GVariant *parameters, GVariant **reply_body, uid_t uid); int badge_get_badge_list(GVariant *parameters, GVariant **reply_body, uid_t uid); int badge_insert(GVariant *parameters, GVariant **reply_body, uid_t uid); -int badge_delete(GVariant *parameters, GVariant **reply_body, uid_t uid, pid_t pid); -int badge_set_badge_count(GVariant *parameters, GVariant **reply_body, uid_t uid, pid_t pid); +int badge_delete(GVariant *parameters, GVariant **reply_body, uid_t uid); +int badge_set_badge_count(GVariant *parameters, GVariant **reply_body, uid_t uid); int badge_get_badge_count(GVariant *parameters, GVariant **reply_body, uid_t uid); int badge_set_display_option(GVariant *parameters, GVariant **reply_body, uid_t uid); int badge_get_display_option(GVariant *parameters, GVariant **reply_body, const gchar *sender, uid_t uid); diff --git a/src/badge_service.c b/src/badge_service.c index eec1691..69ecfca 100755 --- a/src/badge_service.c +++ b/src/badge_service.c @@ -70,7 +70,6 @@ static void _badge_dbus_method_call_handler(GDBusConnection *conn, GVariant *reply_body = NULL; int ret = BADGE_ERROR_INVALID_PARAMETER; uid_t uid = get_sender_uid(sender); - pid_t pid = get_sender_pid(sender); if (g_strcmp0(method_name, "badge_service_register") == 0) ret = service_register(parameters, &reply_body, sender, @@ -82,9 +81,9 @@ static void _badge_dbus_method_call_handler(GDBusConnection *conn, else if (g_strcmp0(method_name, "insert_badge") == 0) ret = badge_insert(parameters, &reply_body, uid); else if (g_strcmp0(method_name, "delete_badge") == 0) - ret = badge_delete(parameters, &reply_body, uid, pid); + ret = badge_delete(parameters, &reply_body, uid); else if (g_strcmp0(method_name, "set_badge_count") == 0) - ret = badge_set_badge_count(parameters, &reply_body, uid, pid); + ret = badge_set_badge_count(parameters, &reply_body, uid); else if (g_strcmp0(method_name, "get_badge_count") == 0) ret = badge_get_badge_count(parameters, &reply_body, uid); else if (g_strcmp0(method_name, "set_disp_option") == 0) @@ -376,7 +375,7 @@ int badge_insert(GVariant *parameters, GVariant **reply_body, uid_t uid) } /* delete_badge */ -int badge_delete(GVariant *parameters, GVariant **reply_body, uid_t uid, pid_t pid) +int badge_delete(GVariant *parameters, GVariant **reply_body, uid_t uid) { int ret = BADGE_ERROR_NONE; char *pkgname = NULL; @@ -390,10 +389,11 @@ int badge_delete(GVariant *parameters, GVariant **reply_body, uid_t uid, pid_t p if (ret != BADGE_ERROR_NONE) return ret; - if (pkgname != NULL && caller != NULL) - ret = badge_db_delete(pkgname, caller, param_uid, pid); - else + if (pkgname != NULL && caller != NULL) { + ret = badge_db_delete(pkgname, caller, param_uid); + } else { return BADGE_ERROR_INVALID_PARAMETER; + } if (ret != BADGE_ERROR_NONE) { ErrPrint("failed to delete badge :%d\n", ret); @@ -426,7 +426,7 @@ int badge_delete(GVariant *parameters, GVariant **reply_body, uid_t uid, pid_t p } /* set_badge_count */ -int badge_set_badge_count(GVariant *parameters, GVariant **reply_body, uid_t uid, pid_t pid) +int badge_set_badge_count(GVariant *parameters, GVariant **reply_body, uid_t uid) { int ret = BADGE_ERROR_NONE; char *pkgname = NULL; @@ -447,7 +447,7 @@ int badge_set_badge_count(GVariant *parameters, GVariant **reply_body, uid_t uid badge_setting_refresh_setting_table(tzplatform_getuid(TZ_SYS_DEFAULT_USER)); need_to_reload_pkginfo_for_badge = 0; } - ret = badge_db_set_count(pkgname, caller, count, param_uid, pid); + ret = badge_db_set_count(pkgname, caller, count, param_uid); } else { return BADGE_ERROR_INVALID_PARAMETER; } -- 2.7.4 From 332d0ccb80ea3360b478f3850b124dca32643d21 Mon Sep 17 00:00:00 2001 From: Son seungha Date: Mon, 29 May 2017 22:48:44 +0000 Subject: [PATCH 11/16] Revert "Revert "Pass pid as a function paramter"" This reverts commit 55d4ff8bc0f8d8849c44bd3c0fe420136cc2f01b. Change-Id: I1d3148d709192f995cc3720b8a5a370ffe814ece --- include/badge_service.h | 4 ++-- src/badge_service.c | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/badge_service.h b/include/badge_service.h index 3bbc725..6428739 100755 --- a/include/badge_service.h +++ b/include/badge_service.h @@ -23,8 +23,8 @@ extern int badge_service_fini(void); int badge_get_badge_existing(GVariant *parameters, GVariant **reply_body, uid_t uid); int badge_get_badge_list(GVariant *parameters, GVariant **reply_body, uid_t uid); int badge_insert(GVariant *parameters, GVariant **reply_body, uid_t uid); -int badge_delete(GVariant *parameters, GVariant **reply_body, uid_t uid); -int badge_set_badge_count(GVariant *parameters, GVariant **reply_body, uid_t uid); +int badge_delete(GVariant *parameters, GVariant **reply_body, uid_t uid, pid_t pid); +int badge_set_badge_count(GVariant *parameters, GVariant **reply_body, uid_t uid, pid_t pid); int badge_get_badge_count(GVariant *parameters, GVariant **reply_body, uid_t uid); int badge_set_display_option(GVariant *parameters, GVariant **reply_body, uid_t uid); int badge_get_display_option(GVariant *parameters, GVariant **reply_body, const gchar *sender, uid_t uid); diff --git a/src/badge_service.c b/src/badge_service.c index 69ecfca..eec1691 100755 --- a/src/badge_service.c +++ b/src/badge_service.c @@ -70,6 +70,7 @@ static void _badge_dbus_method_call_handler(GDBusConnection *conn, GVariant *reply_body = NULL; int ret = BADGE_ERROR_INVALID_PARAMETER; uid_t uid = get_sender_uid(sender); + pid_t pid = get_sender_pid(sender); if (g_strcmp0(method_name, "badge_service_register") == 0) ret = service_register(parameters, &reply_body, sender, @@ -81,9 +82,9 @@ static void _badge_dbus_method_call_handler(GDBusConnection *conn, else if (g_strcmp0(method_name, "insert_badge") == 0) ret = badge_insert(parameters, &reply_body, uid); else if (g_strcmp0(method_name, "delete_badge") == 0) - ret = badge_delete(parameters, &reply_body, uid); + ret = badge_delete(parameters, &reply_body, uid, pid); else if (g_strcmp0(method_name, "set_badge_count") == 0) - ret = badge_set_badge_count(parameters, &reply_body, uid); + ret = badge_set_badge_count(parameters, &reply_body, uid, pid); else if (g_strcmp0(method_name, "get_badge_count") == 0) ret = badge_get_badge_count(parameters, &reply_body, uid); else if (g_strcmp0(method_name, "set_disp_option") == 0) @@ -375,7 +376,7 @@ int badge_insert(GVariant *parameters, GVariant **reply_body, uid_t uid) } /* delete_badge */ -int badge_delete(GVariant *parameters, GVariant **reply_body, uid_t uid) +int badge_delete(GVariant *parameters, GVariant **reply_body, uid_t uid, pid_t pid) { int ret = BADGE_ERROR_NONE; char *pkgname = NULL; @@ -389,11 +390,10 @@ int badge_delete(GVariant *parameters, GVariant **reply_body, uid_t uid) if (ret != BADGE_ERROR_NONE) return ret; - if (pkgname != NULL && caller != NULL) { - ret = badge_db_delete(pkgname, caller, param_uid); - } else { + if (pkgname != NULL && caller != NULL) + ret = badge_db_delete(pkgname, caller, param_uid, pid); + else return BADGE_ERROR_INVALID_PARAMETER; - } if (ret != BADGE_ERROR_NONE) { ErrPrint("failed to delete badge :%d\n", ret); @@ -426,7 +426,7 @@ int badge_delete(GVariant *parameters, GVariant **reply_body, uid_t uid) } /* set_badge_count */ -int badge_set_badge_count(GVariant *parameters, GVariant **reply_body, uid_t uid) +int badge_set_badge_count(GVariant *parameters, GVariant **reply_body, uid_t uid, pid_t pid) { int ret = BADGE_ERROR_NONE; char *pkgname = NULL; @@ -447,7 +447,7 @@ int badge_set_badge_count(GVariant *parameters, GVariant **reply_body, uid_t uid badge_setting_refresh_setting_table(tzplatform_getuid(TZ_SYS_DEFAULT_USER)); need_to_reload_pkginfo_for_badge = 0; } - ret = badge_db_set_count(pkgname, caller, count, param_uid); + ret = badge_db_set_count(pkgname, caller, count, param_uid, pid); } else { return BADGE_ERROR_INVALID_PARAMETER; } -- 2.7.4 From 30891787eb018a56741d353c0baba4acfab9fe2b Mon Sep 17 00:00:00 2001 From: Myungki Lee Date: Thu, 1 Jun 2017 10:46:28 +0900 Subject: [PATCH 12/16] Release version 1.4.13 - Pass pid as a function paramter Change-Id: I1d02f37a8c324deacf3ace345715afc0932f5e59 Signed-off-by: Myungki Lee --- packaging/data-provider-master.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index 61aafdf..1627888 100755 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -2,7 +2,7 @@ Name: data-provider-master Summary: Master service provider for badge, shortcut, notification -Version: 1.4.12 +Version: 1.4.13 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From 1c2b884d44f910c6f739e66cce11b83dbebfa482 Mon Sep 17 00:00:00 2001 From: Myungki Lee Date: Thu, 1 Jun 2017 18:09:37 +0900 Subject: [PATCH 13/16] Get default viewer and launch - from /usr/share/notification/notification.ini - To launchaing application When notification posted or updated. Change-Id: I601848e36f631d966ab5b1fe36f57ed68abb3858 Signed-off-by: Myungki Lee --- src/notification_service.c | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/src/notification_service.c b/src/notification_service.c index de7796e..edf1971 100755 --- a/src/notification_service.c +++ b/src/notification_service.c @@ -49,6 +49,8 @@ static int _update_noti(GVariant **reply_body, notification_h noti, uid_t uid); static GList *_dnd_alarm_id_list; +static char *default_viewer; + typedef struct _dnd_alarm_id { uid_t uid; alarm_id_t dnd_start_id; @@ -426,6 +428,14 @@ static int _add_noti(GVariant **reply_body, notification_h noti, uid_t uid) return ret; } + if (default_viewer != NULL) { + ret = notification_launch_default_viewer(default_viewer, priv_id); + if (ret != NOTIFICATION_ERROR_NONE) { + ErrPrint("failed to launch (app_control error : %d)", ret); + return NOTIFICATION_ERROR_IO_ERROR; + } + } + *reply_body = g_variant_new("(i)", priv_id); if (*reply_body == NULL) { ErrPrint("cannot make reply_body"); @@ -648,12 +658,17 @@ static int _update_noti(GVariant **reply_body, notification_h noti, uid_t uid) int priv_id = NOTIFICATION_PRIV_ID_NONE; print_noti(noti); - notification_get_id(noti, NULL, &priv_id); - DbgPrint("priv_id: [%d]", priv_id); - ret = notification_noti_update(noti); - if (ret != NOTIFICATION_ERROR_NONE) + if (ret != NOTIFICATION_ERROR_NONE) { + ErrPrint("failed to update a notification:%d\n", ret); return ret; + } + + ret = notification_get_id(noti, NULL, &priv_id); + if (ret != NOTIFICATION_ERROR_NONE) { + ErrPrint("failed to gets priv_id:%d\n", ret); + return ret; + } body = notification_ipc_make_gvariant_from_noti(noti, true); if (body == NULL) { @@ -669,11 +684,20 @@ static int _update_noti(GVariant **reply_body, notification_h noti, uid_t uid) return ret; } + if (default_viewer != NULL) { + ret = notification_launch_default_viewer(default_viewer, priv_id); + if (ret != NOTIFICATION_ERROR_NONE) { + ErrPrint("failed to launch (app_control error : %d)", ret); + return NOTIFICATION_ERROR_IO_ERROR; + } + } + *reply_body = g_variant_new("(i)", priv_id); if (*reply_body == NULL) { ErrPrint("cannot make reply_body"); return NOTIFICATION_ERROR_OUT_OF_MEMORY; } + DbgPrint("_update_noti done !!"); return ret; } @@ -2250,6 +2274,8 @@ out: */ HAPI int notification_service_init(void) { +#define DEFAULT_VIEWER_CONF_FILE "/usr/share/notification/notification.ini" + int ret, i; int count = 0; uid_t *uids = NULL; @@ -2267,6 +2293,8 @@ HAPI int notification_service_init(void) return NOTIFICATION_ERROR_IO_ERROR; } + notification_get_default_viewer(DEFAULT_VIEWER_CONF_FILE, &default_viewer); + _notification_data_init(); notification_system_setting_init_system_setting_table(tzplatform_getuid(TZ_SYS_DEFAULT_USER)); -- 2.7.4 From 8481b8bca4605d9559e727c4d5e8dc026580c5db Mon Sep 17 00:00:00 2001 From: Seungha Son Date: Wed, 31 May 2017 15:29:10 +0900 Subject: [PATCH 14/16] Arrange naming of pkgid and appid Signed-off-by: Seungha Son Change-Id: Iaba85348f484624e92b045923e91816d87b92cf7 --- include/notification_service.h | 4 +- src/notification_service.c | 140 ++++++++++++++++++++--------------------- src/service_common.c | 10 +-- 3 files changed, 77 insertions(+), 77 deletions(-) diff --git a/include/notification_service.h b/include/notification_service.h index d2cd57f..4519141 100755 --- a/include/notification_service.h +++ b/include/notification_service.h @@ -34,7 +34,7 @@ int notification_load_noti_by_priv_id(GVariant *parameters, GVariant **reply_bod int notification_load_grouping_list(GVariant *parameters, GVariant **reply_body, uid_t uid); int notification_load_detail_list(GVariant *parameters, GVariant **reply_body, uid_t uid); int notification_get_setting_array(GVariant *parameters, GVariant **reply_body, uid_t uid); -int notification_get_setting_by_appid(GVariant *parameters, GVariant **reply_body, uid_t uid); +int notification_get_setting_by_app_id(GVariant *parameters, GVariant **reply_body, uid_t uid); int notification_load_system_setting(GVariant *parameters, GVariant **reply_body, uid_t uid); int notification_add_noti_template(GVariant *parameters, GVariant **reply_body, uid_t uid); int notification_get_noti_template(GVariant *parameters, GVariant **reply_body, pid_t pid, uid_t uid); @@ -47,6 +47,6 @@ int notification_send_noti_event_by_priv_id(GVariant *parameters, GVariant **rep int notification_check_event_receiver(GVariant *parameters, GVariant **reply_body); int notification_reset_event_receiver(GVariant *parameters, GVariant **reply_body, const char *sender); int notification_register_dbus_interface(); -int notification_delete_noti_by_appid(const char *appid, uid_t uid); +int notification_delete_noti_by_app_id(const char *app_id, uid_t uid); /* End of a file */ diff --git a/src/notification_service.c b/src/notification_service.c index edf1971..89c7d28 100755 --- a/src/notification_service.c +++ b/src/notification_service.c @@ -145,8 +145,8 @@ static void _noti_dbus_method_call_handler(GDBusConnection *conn, ret = notification_load_detail_list(parameters, &reply_body, uid); else if (g_strcmp0(method_name, "get_setting_array") == 0) ret = notification_get_setting_array(parameters, &reply_body, uid); - else if (g_strcmp0(method_name, "get_setting_by_appid") == 0) - ret = notification_get_setting_by_appid(parameters, &reply_body, uid); + else if (g_strcmp0(method_name, "get_setting_by_app_id") == 0) + ret = notification_get_setting_by_app_id(parameters, &reply_body, uid); else if (g_strcmp0(method_name, "load_system_setting") == 0) ret = notification_load_system_setting(parameters, &reply_body, uid); else if (g_strcmp0(method_name, "save_as_template") == 0) @@ -214,28 +214,28 @@ int notification_register_dbus_interface() " " " " - " " + " " " " " " " " " " " " - " " + " " " " " " " " " " " " - " " + " " " " " " " " " " " " - " " + " " " " " " " " @@ -249,7 +249,7 @@ int notification_register_dbus_interface() " " " " - " " + " " " " " " " " @@ -259,7 +259,7 @@ int notification_register_dbus_interface() " " " " - " " + " " " " " " " " @@ -268,7 +268,7 @@ int notification_register_dbus_interface() " " " " - " " + " " " " " " " " @@ -296,8 +296,8 @@ int notification_register_dbus_interface() " " " " - " " - " " + " " + " " " " " " " " @@ -318,13 +318,13 @@ int notification_register_dbus_interface() " " " " - " " + " " " " " " " " " " - " " + " " " " " " " " @@ -735,19 +735,19 @@ int notification_load_noti_by_tag(GVariant *parameters, GVariant **reply_body, u { int ret; char *tag = NULL; - char *pkgname = NULL; + char *app_id = NULL; notification_h noti; uid_t param_uid; noti = notification_create(NOTIFICATION_TYPE_NOTI); if (noti != NULL) { - g_variant_get(parameters, "(&s&si)", &pkgname, &tag, ¶m_uid); + g_variant_get(parameters, "(&s&si)", &app_id, &tag, ¶m_uid); ret = _validate_and_set_param_uid_with_uid(uid, ¶m_uid); if (ret != NOTIFICATION_ERROR_NONE) goto out; - DbgPrint("_load_noti_by_tag pkgname : %s, tag : %s ", pkgname, tag); - ret = notification_noti_get_by_tag(noti, pkgname, tag, param_uid); + DbgPrint("_load_noti_by_tag app_id : %s, tag : %s ", app_id, tag); + ret = notification_noti_get_by_tag(noti, app_id, tag, param_uid); if (ret != NOTIFICATION_ERROR_NONE) { ErrPrint("There is no notification that is matched tag [%s]", tag); goto out; @@ -776,18 +776,18 @@ int notification_load_noti_by_priv_id(GVariant *parameters, GVariant **reply_bod { int ret; int priv_id = NOTIFICATION_PRIV_ID_NONE; - char *pkgname = NULL; + char *app_id = NULL; notification_h noti; uid_t param_uid; noti = notification_create(NOTIFICATION_TYPE_NOTI); if (noti != NULL) { - g_variant_get(parameters, "(&sii)", &pkgname, &priv_id, ¶m_uid); + g_variant_get(parameters, "(&sii)", &app_id, &priv_id, ¶m_uid); ret = _validate_and_set_param_uid_with_uid(uid, ¶m_uid); if (ret != NOTIFICATION_ERROR_NONE) goto out; - DbgPrint("load_noti_by_priv_id pkgname : %s, priv_id : %d ", pkgname, priv_id); + DbgPrint("load_noti_by_priv_id app_id : %s, priv_id : %d ", app_id, priv_id); ret = notification_noti_get_by_priv_id(noti, priv_id); if (ret != NOTIFICATION_ERROR_NONE) goto out; @@ -895,8 +895,8 @@ int notification_get_setting_array(GVariant *parameters, GVariant **reply_body, if (temp->package_name) free(temp->package_name); - if (temp->appid) - free(temp->appid); + if (temp->app_id) + free(temp->app_id); } free(setting_array); } @@ -910,7 +910,7 @@ int notification_get_setting_array(GVariant *parameters, GVariant **reply_body, return ret; } -static bool __init_setting_handle_by_appid(const char *appid, notification_setting_h *setting, uid_t uid) +static bool __init_setting_handle_by_app_id(const char *app_id, notification_setting_h *setting, uid_t uid) { bool ret = false; int ret_pkgmgr; @@ -918,18 +918,18 @@ static bool __init_setting_handle_by_appid(const char *appid, notification_setti notification_setting_h ret_setting = NULL; pkgmgrinfo_appinfo_h handle = NULL; - if (appid == NULL || setting == NULL) + if (app_id == NULL || setting == NULL) return false; - ret_pkgmgr = pkgmgrinfo_appinfo_get_appinfo(appid, &handle); + ret_pkgmgr = pkgmgrinfo_appinfo_get_appinfo(app_id, &handle); if (ret_pkgmgr != PMINFO_R_OK) { - ErrPrint("failed to pkgmgrinfo_appinfo_get_appinfo [%s][%d]", appid, ret); + ErrPrint("failed to pkgmgrinfo_appinfo_get_appinfo [%s][%d]", app_id, ret); goto out; } ret_pkgmgr = pkgmgrinfo_appinfo_get_pkgname(handle, &pkgname); if (ret_pkgmgr != PMINFO_R_OK) { - ErrPrint("failed to pkgmgrinfo_appinfo_get_pkgname [%s][%d]", appid, ret); + ErrPrint("failed to pkgmgrinfo_appinfo_get_pkgname [%s][%d]", app_id, ret); goto out; } @@ -940,7 +940,7 @@ static bool __init_setting_handle_by_appid(const char *appid, notification_setti } ret_setting->package_name = strdup(pkgname); - ret_setting->appid = strdup(appid); + ret_setting->app_id = strdup(app_id); ret_setting->allow_to_notify = 1; ret_setting->do_not_disturb_except = 0; ret_setting->visibility_class = 0; @@ -958,25 +958,25 @@ out: return ret; } -/* get_setting_by_appid */ -int notification_get_setting_by_appid(GVariant *parameters, GVariant **reply_body, uid_t uid) +/* get_setting_by_app_id */ +int notification_get_setting_by_app_id(GVariant *parameters, GVariant **reply_body, uid_t uid) { bool err; int ret; GVariant *body; - char *appid = NULL; + char *app_id = NULL; notification_setting_h setting = NULL; uid_t param_uid; - g_variant_get(parameters, "(&si)", &appid, ¶m_uid); + g_variant_get(parameters, "(&si)", &app_id, ¶m_uid); ret = _validate_and_set_param_uid_with_uid(uid, ¶m_uid); if (ret != NOTIFICATION_ERROR_NONE) return ret; - DbgPrint("get setting by appid : %s uid : %d", appid, param_uid); + DbgPrint("get setting by app_id : %s uid : %d", app_id, param_uid); - ret = noti_setting_service_get_setting_by_appid(appid, &setting, param_uid); + ret = noti_setting_service_get_setting_by_app_id(app_id, &setting, param_uid); if (ret == NOTIFICATION_ERROR_NOT_EXIST_ID) { - err = __init_setting_handle_by_appid(appid, &setting, param_uid); + err = __init_setting_handle_by_app_id(app_id, &setting, param_uid); if (err == false) return NOTIFICATION_ERROR_IO_ERROR; ret = NOTIFICATION_ERROR_NONE; @@ -1044,20 +1044,20 @@ int notification_load_detail_list(GVariant *parameters, GVariant **reply_body, u notification_list_h get_list = NULL; notification_list_h list_iter; GVariantBuilder *builder; - char *pkgname = NULL; + char *app_id = NULL; int group_id = NOTIFICATION_GROUP_ID_NONE; int priv_id = NOTIFICATION_PRIV_ID_NONE; int count = 0; uid_t param_uid; - g_variant_get(parameters, "(&siiii)", &pkgname, &group_id, &priv_id, &count, ¶m_uid); + g_variant_get(parameters, "(&siiii)", &app_id, &group_id, &priv_id, &count, ¶m_uid); ret = _validate_and_set_param_uid_with_uid(uid, ¶m_uid); if (ret != NOTIFICATION_ERROR_NONE) return ret; - DbgPrint("load detail list pkgname : %s, group_id : %d, priv_id : %d, count : %d ", - pkgname, group_id, priv_id, count); + DbgPrint("load detail list app_id : %s, group_id : %d, priv_id : %d, count : %d ", + app_id, group_id, priv_id, count); - ret = notification_noti_get_detail_list(pkgname, group_id, priv_id, + ret = notification_noti_get_detail_list(app_id, group_id, priv_id, count, &get_list, param_uid); if (ret != NOTIFICATION_ERROR_NONE) return ret; @@ -1153,15 +1153,15 @@ int notification_del_noti_single(GVariant *parameters, GVariant **reply_body, ui int ret; int num_changes = 0; int priv_id = NOTIFICATION_PRIV_ID_NONE; - char *pkgname = NULL; + char *app_id = NULL; GVariant *body = NULL; uid_t param_uid; - g_variant_get(parameters, "(&sii)", &pkgname, &priv_id, ¶m_uid); + g_variant_get(parameters, "(&sii)", &app_id, &priv_id, ¶m_uid); ret = _validate_and_set_param_uid_with_uid(uid, ¶m_uid); if (ret != NOTIFICATION_ERROR_NONE) return ret; - ret = notification_noti_delete_by_priv_id_get_changes(pkgname, priv_id, &num_changes, param_uid); + ret = notification_noti_delete_by_priv_id_get_changes(app_id, priv_id, &num_changes, param_uid); DbgPrint("priv_id: [%d] num_delete:%d\n", priv_id, num_changes); if (ret != NOTIFICATION_ERROR_NONE) { ErrPrint("failed to delete a notification:%d %d\n", ret, num_changes); @@ -1199,7 +1199,7 @@ int notification_del_noti_single(GVariant *parameters, GVariant **reply_body, ui int notification_del_noti_multiple(GVariant *parameters, GVariant **reply_body, uid_t uid) { int ret; - char *pkgname = NULL; + char *app_id = NULL; notification_type_e type = NOTIFICATION_TYPE_NONE; int num_deleted = 0; int *list_deleted = NULL; @@ -1208,13 +1208,13 @@ int notification_del_noti_multiple(GVariant *parameters, GVariant **reply_body, int i; uid_t param_uid; - g_variant_get(parameters, "(&sii)", &pkgname, &type, ¶m_uid); - DbgPrint("pkgname: [%s] type: [%d]\n", pkgname, type); + g_variant_get(parameters, "(&sii)", &app_id, &type, ¶m_uid); + DbgPrint("app_id: [%s] type: [%d]\n", app_id, type); ret = _validate_and_set_param_uid_with_uid(uid, ¶m_uid); if (ret != NOTIFICATION_ERROR_NONE) return ret; - ret = notification_noti_delete_all(type, pkgname, &num_deleted, &list_deleted, param_uid); + ret = notification_noti_delete_all(type, app_id, &num_deleted, &list_deleted, param_uid); DbgPrint("ret: [%d] num_deleted: [%d]\n", ret, num_deleted); @@ -1264,20 +1264,20 @@ int notification_get_noti_count(GVariant *parameters, GVariant **reply_body, uid { int ret; notification_type_e type = NOTIFICATION_TYPE_NONE; - char *pkgname = NULL; + char *app_id = NULL; int group_id = NOTIFICATION_GROUP_ID_NONE; int priv_id = NOTIFICATION_PRIV_ID_NONE; int noti_count = 0; uid_t param_uid; - g_variant_get(parameters, "(i&siii)", &type, &pkgname, &group_id, &priv_id, ¶m_uid); + g_variant_get(parameters, "(i&siii)", &type, &app_id, &group_id, &priv_id, ¶m_uid); ret = _validate_and_set_param_uid_with_uid(uid, ¶m_uid); if (ret != NOTIFICATION_ERROR_NONE) { ErrPrint("_validate_uid fail ret : %d", ret); return NOTIFICATION_ERROR_IO_ERROR; } - ret = notification_noti_get_count(type, pkgname, group_id, priv_id, + ret = notification_noti_get_count(type, app_id, group_id, priv_id, ¬i_count, param_uid); if (ret != NOTIFICATION_ERROR_NONE) { ErrPrint("failed to get count : %d\n", ret); @@ -1298,7 +1298,7 @@ int notification_update_noti_setting(GVariant *parameters, GVariant **reply_body { int ret; char *pkgname = NULL; - char *appid = NULL; + char *app_id = NULL; int allow_to_notify = 0; int do_not_disturb_except = 0; int visivility_class = 0; @@ -1313,7 +1313,7 @@ int notification_update_noti_setting(GVariant *parameters, GVariant **reply_body g_variant_get(parameters, "(&s&siiiiii)", &pkgname, - &appid, + &app_id, &allow_to_notify, &do_not_disturb_except, &visivility_class, @@ -1325,10 +1325,10 @@ int notification_update_noti_setting(GVariant *parameters, GVariant **reply_body if (ret != NOTIFICATION_ERROR_NONE) return ret; - DbgPrint("package_name: [%s] appid: [%s] allow_to_notify: [%d] do_not_disturb_except: [%d] visivility_class: [%d] pop_up_notification: [%d] lock_screen_content_level: [%d]\n", - pkgname, appid, allow_to_notify, do_not_disturb_except, visivility_class, pop_up_notification, lock_screen_content_level); + DbgPrint("package_name: [%s] app_id: [%s] allow_to_notify: [%d] do_not_disturb_except: [%d] visivility_class: [%d] pop_up_notification: [%d] lock_screen_content_level: [%d]\n", + pkgname, app_id, allow_to_notify, do_not_disturb_except, visivility_class, pop_up_notification, lock_screen_content_level); - ret = notification_setting_db_update(pkgname, appid, allow_to_notify, do_not_disturb_except, visivility_class, + ret = notification_setting_db_update(pkgname, app_id, allow_to_notify, do_not_disturb_except, visivility_class, pop_up_notification, lock_screen_content_level, param_uid); if (ret != NOTIFICATION_ERROR_NONE) { ErrPrint("failed to setting db update : %d\n", ret); @@ -1737,7 +1737,7 @@ out: int notification_get_noti_template(GVariant *parameters, GVariant **reply_body, pid_t pid, uid_t uid) { int ret; - char appid[BUF_LEN] = {0, }; + char app_id[BUF_LEN] = {0, }; char *template_name = NULL; notification_h noti; @@ -1745,14 +1745,14 @@ int notification_get_noti_template(GVariant *parameters, GVariant **reply_body, if (noti != NULL) { g_variant_get(parameters, "(&s)", &template_name); - ret = aul_app_get_appid_bypid_for_uid(pid, appid, sizeof(appid), uid); + ret = aul_app_get_appid_bypid_for_uid(pid, app_id, sizeof(app_id), uid); if (ret != AUL_R_OK) { - ErrPrint("failed to get appid:%d", ret); + ErrPrint("failed to get app_id:%d", ret); ret = NOTIFICATION_ERROR_INVALID_PARAMETER; goto out; } - ret = notification_noti_get_package_template(noti, appid, template_name); + ret = notification_noti_get_package_template(noti, app_id, template_name); if (ret != NOTIFICATION_ERROR_NONE) { DbgPrint("failed to get template:%d", ret); goto out; @@ -1778,15 +1778,15 @@ out: int notification_get_noti_package_template(GVariant *parameters, GVariant **reply_body, uid_t uid) { int ret; - char *pkgname = NULL; + char *app_id = NULL; char *template_name = NULL; notification_h noti; noti = notification_create(NOTIFICATION_TYPE_NOTI); if (noti != NULL) { - g_variant_get(parameters, "(&s&s)", &pkgname, &template_name); + g_variant_get(parameters, "(&s&s)", &app_id, &template_name); - ret = notification_noti_get_package_template(noti, pkgname, template_name); + ret = notification_noti_get_package_template(noti, app_id, template_name); if (ret != NOTIFICATION_ERROR_NONE) { ErrPrint("failed to get template:%d", ret); goto out; @@ -1815,11 +1815,11 @@ int notification_get_block_state(GVariant *parameters, GVariant **reply_body, ui int dnd; int dnd_except; int allow_to_notify; - char *appid; + char *app_id; uid_t param_uid; GVariant *body = NULL; - g_variant_get(parameters, "(&si)", &appid, ¶m_uid); + g_variant_get(parameters, "(&si)", &app_id, ¶m_uid); ret = _validate_and_set_param_uid_with_uid(uid, ¶m_uid); if (ret != NOTIFICATION_ERROR_NONE) { @@ -1832,7 +1832,7 @@ int notification_get_block_state(GVariant *parameters, GVariant **reply_body, ui need_to_reload_pkginfo_for_notification = 0; } - ret = notification_get_dnd_and_allow_to_notify(appid, &dnd, &dnd_except, &allow_to_notify, param_uid); + ret = notification_get_dnd_and_allow_to_notify(app_id, &dnd, &dnd_except, &allow_to_notify, param_uid); if (ret != NOTIFICATION_ERROR_NONE) { ErrPrint("failed to get_dnd_and_allow_to_notify : %d\n", ret); return ret; @@ -2138,7 +2138,7 @@ int notification_reset_event_receiver(GVariant *parameters, GVariant **reply_bod return NOTIFICATION_ERROR_NONE; } -HAPI int notification_delete_noti_by_appid(const char *appid, uid_t uid) +HAPI int notification_delete_noti_by_app_id(const char *app_id, uid_t uid) { GVariant *deleted_noti_list; GVariantBuilder *builder; @@ -2147,7 +2147,7 @@ HAPI int notification_delete_noti_by_appid(const char *appid, uid_t uid) int ret; int i; - ret = notification_noti_delete_all(NOTIFICATION_TYPE_NONE, appid, &num_deleted, &list_deleted, uid); + ret = notification_noti_delete_all(NOTIFICATION_TYPE_NONE, app_id, &num_deleted, &list_deleted, uid); if (ret != NOTIFICATION_ERROR_NONE) { ErrPrint("failed to delete notifications:%d\n", ret); goto out; @@ -2184,7 +2184,7 @@ static void _notification_data_init(void) { int property = 0; int priv_id = 0; - char *noti_pkgname = NULL; + char *app_id = NULL; notification_h noti = NULL; notification_list_h noti_list = NULL; notification_list_h noti_list_head = NULL; @@ -2197,13 +2197,13 @@ static void _notification_data_init(void) noti = notification_list_get_data(noti_list); if (noti) { notification_get_id(noti, NULL, &priv_id); - notification_get_pkgname(noti, ¬i_pkgname); + notification_get_pkgname(noti, &app_id); notification_get_property(noti, &property); notification_get_type(noti, ¬i_type); if (noti_type == NOTIFICATION_TYPE_ONGOING || property & NOTIFICATION_PROP_VOLATILE_DISPLAY) { - notification_noti_delete_by_priv_id(noti_pkgname, priv_id); + notification_noti_delete_by_priv_id(app_id, priv_id); } } noti_list = notification_list_get_next(noti_list); diff --git a/src/service_common.c b/src/service_common.c index e57e89a..e088186 100755 --- a/src/service_common.c +++ b/src/service_common.c @@ -471,19 +471,19 @@ static int _package_uninstall_cb(uid_t uid, const char *pkgname, enum pkgmgr_sta return 0; } -static int _app_enabled_cb(uid_t uid, const char *appid, enum pkgmgr_status status, double value, void *data) +static int _app_enabled_cb(uid_t uid, const char *app_id, enum pkgmgr_status status, double value, void *data) { if (status == PKGMGR_STATUS_END) - notification_setting_db_update_app_disabled(appid, false, uid); + notification_setting_db_update_app_disabled(app_id, false, uid); return 0; } -static int _app_disabled_cb(uid_t uid, const char *appid, enum pkgmgr_status status, double value, void *data) +static int _app_disabled_cb(uid_t uid, const char *app_id, enum pkgmgr_status status, double value, void *data) { if (status == PKGMGR_STATUS_END) { - notification_delete_noti_by_appid(appid, uid); - notification_setting_db_update_app_disabled(appid, true, uid); + notification_delete_noti_by_app_id(app_id, uid); + notification_setting_db_update_app_disabled(app_id, true, uid); } return 0; -- 2.7.4 From 414f9586bd0fb973c59517efa822b6dac970a607 Mon Sep 17 00:00:00 2001 From: Seungha Son Date: Fri, 9 Jun 2017 10:41:47 +0900 Subject: [PATCH 15/16] Release version 1.4.14 Changes: - Arrange naming of pkgid and appid - Get default viewer and launch Signed-off-by: Seungha Son Change-Id: I23e672c7dc8e5c3b2b3d56d306d63d3b35f243c2 --- packaging/data-provider-master.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index 1627888..092dde0 100755 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -2,7 +2,7 @@ Name: data-provider-master Summary: Master service provider for badge, shortcut, notification -Version: 1.4.13 +Version: 1.4.14 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From 2ff590b0d8d1c970c001e4a132e24b27c277adad Mon Sep 17 00:00:00 2001 From: Seungha Son Date: Tue, 20 Jun 2017 14:23:54 +0900 Subject: [PATCH 16/16] Fix d-bus activation Signed-off-by: Seungha Son Change-Id: I1c26bb81ca4c027f77395aaf3c25448f193c92a7 --- packaging/data-provider-master.spec | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index 092dde0..d42c957 100755 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -60,9 +60,8 @@ CFLAGS="${CFLAGS} -Wall -Winline -Werror" LDFLAGS="${LDFLAGS}" make %{?jobs:-j%j %install rm -rf %{buildroot} %make_install -mkdir -p %{buildroot}%{_prefix}/lib/systemd/system/multi-user.target.wants +mkdir -p %{buildroot}%{_prefix}/lib/systemd/system install -m 0644 %SOURCE1 %{buildroot}%{_unitdir}/data-provider-master.service -ln -sf ../%{name}.service %{buildroot}%{_prefix}/lib/systemd/system/multi-user.target.wants/%{name}.service %files %manifest %{name}.manifest @@ -70,7 +69,6 @@ ln -sf ../%{name}.service %{buildroot}%{_prefix}/lib/systemd/system/multi-user.t %license LICENSE %attr(0755,root,root) %{_bindir}/data-provider-master %attr(0644,root,root) %{_unitdir}/data-provider-master.service -%{_unitdir}/multi-user.target.wants/data-provider-master.service %attr(0644,root,root) %{_datadir}/dbus-1/system-services/org.tizen.data-provider-master.service %config %{_sysconfdir}/dbus-1/system.d/data-provider-master.conf %{_prefix}/bin/%{name} -- 2.7.4