summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseungha.son <seungha.son@samsung.com>2016-11-04 15:57:18 +0900
committerseungha.son <seungha.son@samsung.com>2016-11-10 18:50:23 +0900
commit4eb618bf5748d20a28fb6e5a4f9f502bb161b5b1 (patch)
tree05f62b8fbd284529cd556de71ec79663dbcd889a
parent0bcbe5db3b3267eee52ff32cf7540aeff1dd345f (diff)
downloadnotification-accepted/tizen/3.0/common/20161116.143503.tar.gz
notification-accepted/tizen/3.0/common/20161116.143503.tar.bz2
notification-accepted/tizen/3.0/common/20161116.143503.zip
- Change notification setting from package base to app_id base - Modify FOTA upgrade scripts Signed-off-by: seungha.son <seungha.son@samsung.com> Change-Id: I04f6d3cde07107f838e878065bf816c913dea353
-rwxr-xr-xinclude/notification_ipc.h4
-rw-r--r--include/notification_setting_internal.h43
-rw-r--r--include/notification_setting_service.h6
-rw-r--r--scripts/105.notification_upgrade.sh12
-rwxr-xr-xsrc/notification_db.c3
-rwxr-xr-xsrc/notification_ipc.c19
-rwxr-xr-xsrc/notification_noti.c95
-rwxr-xr-xsrc/notification_setting.c259
-rw-r--r--src/notification_setting_service.c44
-rwxr-xr-xtest-app/main.c21
10 files changed, 300 insertions, 206 deletions
diff --git a/include/notification_ipc.h b/include/notification_ipc.h
index 2a65fe3..1eb6571 100755
--- a/include/notification_ipc.h
+++ b/include/notification_ipc.h
@@ -73,8 +73,8 @@ int notification_ipc_request_load_noti_grouping_list(notification_type_e type,
notification_list_h *list, uid_t uid);
int notification_ipc_request_get_setting_array(
notification_setting_h *setting_array, int *count, uid_t uid);
-int notification_ipc_request_get_setting_by_package_name(
- const char *package_name, notification_setting_h *setting, uid_t uid);
+int notification_ipc_request_get_setting_by_appid(
+ const char *appid, notification_setting_h *setting, uid_t uid);
int notification_ipc_request_load_system_setting(
notification_system_setting_h *setting, uid_t uid);
int notification_ipc_request_get_count(notification_type_e type,
diff --git a/include/notification_setting_internal.h b/include/notification_setting_internal.h
index f3bd201..fcc9df6 100644
--- a/include/notification_setting_internal.h
+++ b/include/notification_setting_internal.h
@@ -82,6 +82,7 @@ typedef enum notification_dnd_allowed_calls {
/* Application setting */
struct notification_setting {
char *package_name;
+ char *appid;
bool allow_to_notify;
bool do_not_disturb_except;
bool pop_up_notification;
@@ -186,7 +187,7 @@ int notification_setting_get_setting_array_for_uid(notification_setting_h *setti
* @endcode
*/
int notification_setting_get_setting_by_package_name(const char *package_name, notification_setting_h *setting);
-int notification_setting_get_setting_by_package_name_for_uid(const char *package_name, notification_setting_h *setting, uid_t uid);
+int notification_setting_get_setting_by_appid_for_uid(const char *package_name, notification_setting_h *setting, uid_t uid);
/*
* @internal
@@ -226,6 +227,42 @@ int notification_setting_get_package_name(notification_setting_h setting, char *
/*
* @internal
+ * @brief Gets application id from notification setting handle.
+ * @since_tizen 3.0
+ * @param[in] setting The notification setting handle
+ * @param[out] appid The application id
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #NOTIFICATION_ERROR_NOT_EXIST_ID Already exist private ID
+ * @par sample code:
+ * @code
+#include <notification_setting_internal.h>
+...
+{
+ int noti_err = 0;
+ char *appid = NULL;
+ notification_setting_h setting = NULL;
+
+ ...
+
+ noti_err = notification_setting_get_appid(setting, &appid);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+
+ notification_setting_free_notification(setting);
+
+ return 0;
+
+}
+ * @endcode
+ */
+int notification_setting_get_appid(notification_setting_h setting, char **appid);
+
+/*
+ * @internal
* @brief Gets value which whether allow notification from individual applications.
* @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif
* @param[in] setting The notification setting handle
@@ -1315,8 +1352,8 @@ static void changed_cb(void *user_data, int do_not_disturb)
int notification_unregister_system_setting_dnd_changed_cb(dnd_changed_cb callback);
int notification_unregister_system_setting_dnd_changed_cb_for_uid(dnd_changed_cb callback, uid_t uid);
-int notification_setting_insert_package_for_uid(const char *package_id, uid_t uid);
-int notification_setting_delete_package_for_uid(const char *package_id, uid_t uid);
+int notification_setting_insert_package_for_uid(const char *package_name, uid_t uid);
+int notification_setting_delete_package_for_uid(const char *package_name, uid_t uid);
int notification_setting_update_setting_for_uid(notification_setting_h setting, uid_t uid);
/* OLD IMPLEMENTATION */
diff --git a/include/notification_setting_service.h b/include/notification_setting_service.h
index 84a44f1..b146141 100644
--- a/include/notification_setting_service.h
+++ b/include/notification_setting_service.h
@@ -27,7 +27,7 @@ extern "C" {
int notification_setting_db_set(const char *pkgname, const char *property, const char *value);
int notification_setting_db_get(const char *pkgname, const char *property, char **value);
-int notification_setting_db_update(const char *package_name, int allow_to_notify, int do_not_disturb_except, int visibility_class,
+int notification_setting_db_update(const char *package_name, const char *appid, int allow_to_notify, int do_not_disturb_except, int visibility_class,
int pop_up_notification, int lock_screen_content_level, uid_t uid);
int notification_setting_db_update_system_setting(int do_not_disturb, int visibility_class,
int dnd_schedule_enabled, int dnd_schedule_day,
@@ -36,12 +36,12 @@ int notification_setting_db_update_system_setting(int do_not_disturb, int visibi
int lock_screen_content_level, uid_t uid);
int notification_setting_db_update_do_not_disturb(int do_not_disturb, uid_t uid);
-int noti_setting_service_get_setting_by_package_name(const char *package_name, notification_setting_h *setting, uid_t uid);
+int noti_setting_service_get_setting_by_appid(const char *appid, notification_setting_h *setting, uid_t uid);
int noti_setting_get_setting_array(notification_setting_h *setting_array, int *count, uid_t uid);
int noti_system_setting_load_system_setting(notification_system_setting_h *system_setting, uid_t uid);
int noti_system_setting_get_do_not_disturb(int *do_not_disturb, uid_t uid);
int notification_system_setting_get_dnd_schedule_enabled_uid(uid_t **uids, int *count);
-int notification_get_dnd_and_allow_to_notify(const char *pkgname, int *do_not_disturb, int *do_not_disturb_except, int *allow_to_notify, uid_t uid);
+int notification_get_dnd_and_allow_to_notify(const char *appid, int *do_not_disturb, int *do_not_disturb_except, int *allow_to_notify, uid_t uid);
int notification_system_setting_load_dnd_allow_exception(dnd_allow_exception_h *dnd_allow_exception, int *count, uid_t uid);
int notification_system_setting_update_dnd_allow_exception(int type, int value, uid_t uid);
#ifdef __cplusplus
diff --git a/scripts/105.notification_upgrade.sh b/scripts/105.notification_upgrade.sh
index e072d78..17ea26c 100644
--- a/scripts/105.notification_upgrade.sh
+++ b/scripts/105.notification_upgrade.sh
@@ -69,22 +69,18 @@ UPDATE noti_list_temp SET uid=5001;
DROP TABLE noti_list;
ALTER TABLE noti_list_temp RENAME TO noti_list;
-DROP TABLE IF EXISTS notification_setting_temp;
-CREATE TABLE notification_setting_temp (
+DROP TABLE IF EXISTS notification_setting;
+CREATE TABLE notification_setting (
uid INTEGER,
package_name TEXT NOT NULL,
+ appid TEXT NOT NULL,
allow_to_notify INTEGER DEFAULT 1,
do_not_disturb_except INTEGER DEFAULT 0,
visibility_class INTEGER DEFAULT 0,
pop_up_notification INTEGER DEFAULT 1,
lock_screen_content_level INTEGER DEFAULT 0,
- UNIQUE (uid, package_name)
+ UNIQUE (uid, package_name, appid)
);
-INSERT INTO notification_setting_temp (package_name, allow_to_notify, do_not_disturb_except, visibility_class) \
-SELECT package_name, allow_to_notify, do_not_disturb_except, visibility_class FROM notification_setting;
-UPDATE notification_setting_temp SET uid=5001;
-DROP TABLE notification_setting;
-ALTER TABLE notification_setting_temp RENAME TO notification_setting;
DROP TABLE IF EXISTS notification_system_setting_temp;
diff --git a/src/notification_db.c b/src/notification_db.c
index 4e9214d..ea002ff 100755
--- a/src/notification_db.c
+++ b/src/notification_db.c
@@ -129,12 +129,13 @@ create table if not exists noti_list ( \
CREATE TABLE IF NOT EXISTS notification_setting ( \
uid INTEGER, \
package_name TEXT NOT NULL, \
+ appid TEXT NOT NULL, \
allow_to_notify INTEGER DEFAULT 1, \
do_not_disturb_except INTEGER DEFAULT 0, \
visibility_class INTEGER DEFAULT 0, \
pop_up_notification INTEGER DEFAULT 1, \
lock_screen_content_level INTEGER DEFAULT 0, \
- UNIQUE (uid, package_name) \
+ UNIQUE (uid, package_name, appid) \
); \
CREATE TABLE IF NOT EXISTS notification_system_setting ( \
uid INTEGER, \
diff --git a/src/notification_ipc.c b/src/notification_ipc.c
index 8c453e6..26a06c4 100755
--- a/src/notification_ipc.c
+++ b/src/notification_ipc.c
@@ -1274,8 +1274,8 @@ int notification_ipc_request_get_setting_array(
return result;
}
-int notification_ipc_request_get_setting_by_package_name(
- const char *package_name, notification_setting_h *setting, uid_t uid)
+int notification_ipc_request_get_setting_by_appid(
+ const char *appid, notification_setting_h *setting, uid_t uid)
{
int result;
GDBusMessage *reply = NULL;
@@ -1290,8 +1290,8 @@ int notification_ipc_request_get_setting_by_package_name(
return result;
}
- body = g_variant_new("(si)", package_name, uid);
- result = _send_sync_noti(body, &reply, "get_setting_by_package_name");
+ body = g_variant_new("(si)", appid, uid);
+ result = _send_sync_noti(body, &reply, "get_setting_by_appid");
if (result == NOTIFICATION_ERROR_NONE) {
reply_body = g_dbus_message_get_body(reply);
@@ -1397,8 +1397,9 @@ int notification_ipc_update_setting(notification_setting_h setting, uid_t uid)
return result;
}
- body = g_variant_new("(siiiiii)",
+ body = g_variant_new("(ssiiiiii)",
setting->package_name,
+ setting->appid,
(int)(setting->allow_to_notify),
(int)(setting->do_not_disturb_except),
(int)(setting->visibility_class),
@@ -2094,8 +2095,9 @@ EXPORT_API GVariant *notification_ipc_make_gvariant_from_setting(struct notifica
{
GVariant *body = NULL;
- body = g_variant_new("(siiiii)",
+ body = g_variant_new("(ssiiiii)",
noti_setting->package_name,
+ noti_setting->appid,
noti_setting->allow_to_notify,
noti_setting->do_not_disturb_except,
noti_setting->visibility_class,
@@ -2110,6 +2112,7 @@ EXPORT_API int notification_ipc_make_setting_from_gvariant(struct notification_s
{
NOTIFICATION_DBG("notification_ipc_make_setting_from_gvariant !!!!");
char *pkgname;
+ char *appid;
int allow_to_notify;
int do_not_disturb_except;
int visibility_class;
@@ -2121,8 +2124,9 @@ EXPORT_API int notification_ipc_make_setting_from_gvariant(struct notification_s
return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
g_variant_get(variant,
- "(&siiiii)",
+ "(&s&siiiii)",
&pkgname,
+ &appid,
&allow_to_notify,
&do_not_disturb_except,
&visibility_class,
@@ -2132,6 +2136,7 @@ EXPORT_API int notification_ipc_make_setting_from_gvariant(struct notification_s
NOTIFICATION_DBG("setting from variant %s !!", pkgname);
noti_setting->package_name = _dup_string(pkgname);
+ noti_setting->appid = _dup_string(appid);
noti_setting->allow_to_notify = allow_to_notify;
noti_setting->do_not_disturb_except = do_not_disturb_except;
noti_setting->visibility_class = visibility_class;
diff --git a/src/notification_noti.c b/src/notification_noti.c
index aacb598..8b89f1e 100755
--- a/src/notification_noti.c
+++ b/src/notification_noti.c
@@ -706,71 +706,16 @@ err:
return ret;
}
-
-static int _get_package_id_by_app_id(const char *app_id, char **package_id)
-{
- int err = NOTIFICATION_ERROR_NONE;
- int retval;
- char *pkg_id = NULL;
- char *pkg_id_dup = NULL;
- pkgmgrinfo_appinfo_h pkgmgrinfo_appinfo = NULL;
-
- if (app_id == NULL || package_id == NULL) {
- NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER");
- return NOTIFICATION_ERROR_INVALID_PARAMETER;
- }
-
- if ((retval = pkgmgrinfo_appinfo_get_appinfo(app_id, &pkgmgrinfo_appinfo)) != PMINFO_R_OK) {
- NOTIFICATION_ERR("pkgmgrinfo_appinfo_get_appinfo failed [%d]", retval);
- err = NOTIFICATION_ERROR_INVALID_OPERATION;
- goto out;
- }
-
- if ((retval = pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo, &pkg_id)) != PMINFO_R_OK || pkg_id == NULL) {
- NOTIFICATION_ERR("pkgmgrinfo_appinfo_get_pkgname failed [%d]", retval);
- err = NOTIFICATION_ERROR_INVALID_OPERATION;
- goto out;
- }
-
- pkg_id_dup = strdup(pkg_id);
-
- if (pkg_id_dup == NULL) {
- NOTIFICATION_ERR("strdup failed");
- err = NOTIFICATION_ERROR_OUT_OF_MEMORY;
- goto out;
- }
-
- *package_id = pkg_id_dup;
-
-out:
- if (pkgmgrinfo_appinfo)
- pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
-
- return err;
-}
-
-static bool _is_allowed_to_notify(const char *caller_package_name, uid_t uid)
+static bool _is_allowed_to_notify(const char *appid, uid_t uid)
{
notification_setting_h setting = NULL;
int err;
- char *package_id = NULL;
bool ret = true;
- err = noti_setting_service_get_setting_by_package_name(caller_package_name, &setting, uid);
+ err = noti_setting_service_get_setting_by_appid(appid, &setting, uid);
if (err != NOTIFICATION_ERROR_NONE) {
- /* Retry with package id */
- err = _get_package_id_by_app_id(caller_package_name, &package_id);
-
- if (err != NOTIFICATION_ERROR_NONE || package_id == NULL) {
- NOTIFICATION_ERR("_get_package_id_by_app_id failed [%d]", err);
- goto out;
- } else {
- err = noti_setting_service_get_setting_by_package_name(package_id, &setting, uid);
- if (err != NOTIFICATION_ERROR_NONE) {
- NOTIFICATION_ERR("noti_setting_service_get_setting_by_package_name failed [%d]", err);
- goto out;
- }
- }
+ NOTIFICATION_ERR("noti_setting_service_get_setting_by_appid failed [%d]", err);
+ goto out;
}
err = notification_setting_get_allow_to_notify(setting, &ret);
@@ -780,12 +725,9 @@ static bool _is_allowed_to_notify(const char *caller_package_name, uid_t uid)
}
if (ret != true)
- NOTIFICATION_DBG("[%s] is not allowed to notify", caller_package_name);
+ NOTIFICATION_DBG("[%s] is not allowed to notify", appid);
out:
- if (package_id)
- free(package_id);
-
if (setting)
notification_setting_free_notification(setting);
@@ -797,7 +739,6 @@ static int _handle_do_not_disturb_option(notification_h noti)
int err = NOTIFICATION_ERROR_NONE;
bool do_not_disturb = false;
bool do_not_disturb_exception = false;
- char *package_id = NULL;
notification_setting_h setting = NULL;
notification_system_setting_h system_setting = NULL;
@@ -823,20 +764,10 @@ static int _handle_do_not_disturb_option(notification_h noti)
if (do_not_disturb) {
/* Check exception option of the caller package */
- err = noti_setting_service_get_setting_by_package_name(noti->caller_pkgname, &setting, noti->uid);
+ err = noti_setting_service_get_setting_by_appid(noti->caller_pkgname, &setting, noti->uid);
if (err != NOTIFICATION_ERROR_NONE) {
- /* Retry with package id */
- err = _get_package_id_by_app_id(noti->caller_pkgname, &package_id);
- if (err != NOTIFICATION_ERROR_NONE || package_id == NULL) {
- NOTIFICATION_ERR("_get_package_id_by_app_id failed [%d]", err);
- goto out;
- } else {
- err = noti_setting_service_get_setting_by_package_name(package_id, &setting, noti->uid);
- if (err != NOTIFICATION_ERROR_NONE) {
- NOTIFICATION_ERR("_get_setting_by_package_name failed [%d]", err);
- goto out;
- }
- }
+ NOTIFICATION_ERR("_get_setting_by_package_name failed [%d]", err);
+ goto out;
}
err = notification_setting_get_do_not_disturb_except(setting, &do_not_disturb_exception);
@@ -862,8 +793,6 @@ static int _handle_do_not_disturb_option(notification_h noti)
}
out:
- SAFE_FREE(package_id);
-
if (system_setting)
notification_system_setting_free_system_setting(system_setting);
@@ -873,15 +802,15 @@ out:
return err;
}
-static bool _is_pop_up_notification(const char *caller_package_name, uid_t uid)
+static bool _is_pop_up_notification(const char *appid, uid_t uid)
{
int err;
bool ret = true;
notification_setting_h setting = NULL;
- err = noti_setting_service_get_setting_by_package_name(caller_package_name, &setting, uid);
+ err = noti_setting_service_get_setting_by_appid(appid, &setting, uid);
if (err != NOTIFICATION_ERROR_NONE) {
- NOTIFICATION_ERR("noti_setting_service_get_setting_by_package_name failed [%d]", err);
+ NOTIFICATION_ERR("noti_setting_service_get_setting_by_appid failed [%d]", err);
goto out;
}
@@ -892,7 +821,7 @@ static bool _is_pop_up_notification(const char *caller_package_name, uid_t uid)
}
if (ret != true)
- NOTIFICATION_DBG("[%s] is not allowed Pop-up notification", caller_package_name);
+ NOTIFICATION_DBG("[%s] is not allowed Pop-up notification", appid);
out:
if (setting)
diff --git a/src/notification_setting.c b/src/notification_setting.c
index 6116e7b..1aec2ce 100755
--- a/src/notification_setting.c
+++ b/src/notification_setting.c
@@ -63,20 +63,21 @@ EXPORT_API int notification_setting_get_setting_array(notification_setting_h *se
{
return notification_setting_get_setting_array_for_uid(setting_array, count, getuid());
}
-EXPORT_API int notification_setting_get_setting_by_package_name_for_uid(const char *package_name, notification_setting_h *setting, uid_t uid)
+
+EXPORT_API int notification_setting_get_setting_by_appid_for_uid(const char *appid, notification_setting_h *setting, uid_t uid)
{
- if (package_name == NULL || setting == NULL) {
+ if (appid == NULL || setting == NULL) {
NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER");
return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
- return notification_ipc_request_get_setting_by_package_name(package_name, setting, uid);
+ return notification_ipc_request_get_setting_by_appid(appid, setting, uid);
}
/* LCOV_EXCL_START */
EXPORT_API int notification_setting_get_setting_by_package_name(const char *package_name, notification_setting_h *setting)
{
- return notification_setting_get_setting_by_package_name_for_uid(package_name, setting, getuid());
+ return notification_setting_get_setting_by_appid_for_uid(package_name, setting, getuid());
}
/* LCOV_EXCL_STOP */
@@ -101,7 +102,6 @@ EXPORT_API int notification_setting_get_setting(notification_setting_h *setting)
EXPORT_API int notification_setting_get_package_name(notification_setting_h setting, char **value)
{
-
if (setting == NULL || value == NULL) {
NOTIFICATION_ERR("Invalid parameter");
return NOTIFICATION_ERROR_INVALID_PARAMETER;
@@ -117,6 +117,23 @@ EXPORT_API int notification_setting_get_package_name(notification_setting_h sett
return NOTIFICATION_ERROR_NONE;
}
+EXPORT_API int notification_setting_get_appid(notification_setting_h setting, char **appid)
+{
+ if (setting == NULL || appid == NULL) {
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (setting->appid == NULL) {
+ NOTIFICATION_ERR("setting->appid is null");
+ return NOTIFICATION_ERROR_NOT_EXIST_ID;
+ }
+
+ *appid = SAFE_STRDUP(setting->appid);
+
+ return NOTIFICATION_ERROR_NONE;
+}
+
EXPORT_API int notification_setting_get_allow_to_notify(notification_setting_h setting, bool *value)
{
if (setting == NULL || value == NULL) {
@@ -256,6 +273,7 @@ EXPORT_API int notification_setting_free_notification(notification_setting_h set
}
SAFE_FREE(setting->package_name);
+ SAFE_FREE(setting->appid);
/* add codes to free all properties */
@@ -264,14 +282,17 @@ EXPORT_API int notification_setting_free_notification(notification_setting_h set
return NOTIFICATION_ERROR_NONE;
}
-static bool _is_package_in_setting_table(sqlite3 *db, const char *package_name, uid_t uid)
+static bool _is_package_in_setting_table(sqlite3 *db, const char *package_name, const char* appid, uid_t uid)
{
sqlite3_stmt *db_statement = NULL;
int sqlite3_ret = SQLITE_OK;
bool err = true;
int field_index = 1;
- sqlite3_ret = sqlite3_prepare_v2(db, "SELECT package_name FROM notification_setting WHERE uid = ? AND package_name = ?", -1, &db_statement, NULL);
+ if (appid != NULL)
+ sqlite3_ret = sqlite3_prepare_v2(db, "SELECT appid FROM notification_setting WHERE uid = ? AND package_name = ? AND appid = ?", -1, &db_statement, NULL);
+ else
+ sqlite3_ret = sqlite3_prepare_v2(db, "SELECT package_name FROM notification_setting WHERE uid = ? AND package_name = ?", -1, &db_statement, NULL);
if (sqlite3_ret != SQLITE_OK) {
NOTIFICATION_ERR("sqlite3_prepare_v2 failed [%d][%s]", sqlite3_ret, sqlite3_errmsg(db));
@@ -281,11 +302,12 @@ static bool _is_package_in_setting_table(sqlite3 *db, const char *package_name,
sqlite3_bind_int(db_statement, field_index++, uid);
sqlite3_bind_text(db_statement, field_index++, package_name, -1, SQLITE_TRANSIENT);
+ if (appid != NULL)
+ sqlite3_bind_text(db_statement, field_index++, appid, -1, SQLITE_TRANSIENT);
sqlite3_ret = sqlite3_step(db_statement);
-
if (sqlite3_ret == SQLITE_DONE) {
- NOTIFICATION_INFO("no matched package_name found[%s][%d]", package_name, sqlite3_ret);
+ NOTIFICATION_INFO("no matched appid from package_name found[%s][%s][%d]", package_name, appid, sqlite3_ret);
err = false;
goto out;
}
@@ -302,30 +324,40 @@ out:
return err;
}
-static int foreach_package_info_callback(const pkgmgrinfo_pkginfo_h package_info, void *user_data)
+static int foreach_app_info_callback(const pkgmgrinfo_appinfo_h handle, void *user_data)
{
setting_local_info *info = (setting_local_info *)user_data;
sqlite3 *db = info->db;
sqlite3_stmt *db_statement = NULL;
- char *package_name = NULL;
int pkgmgr_ret = PACKAGE_MANAGER_ERROR_NONE;
- int sqlite3_ret = SQLITE_OK;
- int field_index = 1;
int err = true;
+ int field_index = 1;
+ int sqlite3_ret = SQLITE_OK;
+ char *appid = NULL;
+ char *package_name = NULL;
- if ((pkgmgr_ret = pkgmgrinfo_pkginfo_get_pkgname(package_info, &package_name)) != PACKAGE_MANAGER_ERROR_NONE) {
- NOTIFICATION_ERR("package_info_get_package failed [%d]", pkgmgr_ret);
+ pkgmgr_ret = pkgmgrinfo_appinfo_get_appid(handle, &appid);
+ if (pkgmgr_ret != PACKAGE_MANAGER_ERROR_NONE) {
+ NOTIFICATION_ERR("pkgmgrinfo_appinfo_get_appid failed [%d]", pkgmgr_ret);
err = false;
goto out;
}
- if (_is_package_in_setting_table(db, package_name, info->uid) == true) {
- NOTIFICATION_INFO("uid %d [%s] is exist", info->uid, package_name);
+ pkgmgr_ret = pkgmgrinfo_appinfo_get_pkgname(handle, &package_name);
+ if (pkgmgr_ret != PACKAGE_MANAGER_ERROR_NONE) {
+ NOTIFICATION_ERR("pkgmgrinfo_appinfo_get_pkgname failed [%d]", pkgmgr_ret);
+ goto out;
+ }
+
+ if (_is_package_in_setting_table(db, package_name, appid, info->uid) == true) {
+ NOTIFICATION_INFO("uid %d [%s] is exist", info->uid, appid);
+ err = false;
goto out;
}
- NOTIFICATION_INFO("uid %d [%s] will be inserted", info->uid, package_name);
- sqlite3_ret = sqlite3_prepare_v2(db, "INSERT INTO notification_setting (uid, package_name) VALUES (?, ?) ", -1, &db_statement, NULL);
+ NOTIFICATION_INFO("uid %d package_name %s [%s] will be inserted", info->uid, package_name, appid);
+ sqlite3_ret = sqlite3_prepare_v2(db, "INSERT INTO notification_setting (uid, package_name, appid) "
+ "VALUES (?, ?, ?) ", -1, &db_statement, NULL);
if (sqlite3_ret != SQLITE_OK) {
NOTIFICATION_ERR("sqlite3_prepare_v2 failed [%d][%s]", sqlite3_ret, sqlite3_errmsg(db));
@@ -335,6 +367,7 @@ static int foreach_package_info_callback(const pkgmgrinfo_pkginfo_h package_info
sqlite3_bind_int(db_statement, field_index++, info->uid);
sqlite3_bind_text(db_statement, field_index++, package_name, -1, SQLITE_TRANSIENT);
+ sqlite3_bind_text(db_statement, field_index++, appid, -1, SQLITE_TRANSIENT);
sqlite3_ret = sqlite3_step(db_statement);
@@ -352,13 +385,62 @@ out:
return err;
}
+static int foreach_package_info_callback(const pkgmgrinfo_pkginfo_h package_info, void *user_data)
+{
+ char *package_name = NULL;
+ int pkgmgr_ret = PACKAGE_MANAGER_ERROR_NONE;
+ int err = true;
+ pkgmgrinfo_appinfo_filter_h handle = NULL;
+ setting_local_info *info = (setting_local_info *)user_data;
+
+ pkgmgr_ret = pkgmgrinfo_pkginfo_get_pkgname(package_info, &package_name);
+ if (pkgmgr_ret != PACKAGE_MANAGER_ERROR_NONE) {
+ NOTIFICATION_ERR("package_info_get_package failed [%d]", pkgmgr_ret);
+ err = false;
+ goto out;
+ }
+
+ pkgmgr_ret = pkgmgrinfo_appinfo_filter_create(&handle);
+ if (pkgmgr_ret != PMINFO_R_OK) {
+ NOTIFICATION_ERR("pkgmgrinfo_appinfo_filter_create failed [%d]", pkgmgr_ret);
+ err = false;
+ goto out;
+ }
+
+ pkgmgr_ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_PACKAGE, package_name);
+ if (pkgmgr_ret != PMINFO_R_OK) {
+ NOTIFICATION_ERR("pkgmgrinfo_appinfo_filter_add_string failed [%d]", pkgmgr_ret);
+ err = false;
+ goto out;
+ }
+
+ pkgmgr_ret = pkgmgrinfo_appinfo_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_NODISPLAY, false);
+ if (pkgmgr_ret != PMINFO_R_OK) {
+ NOTIFICATION_ERR("pkgmgrinfo_appinfo_filter_add_bool failed [%d]", pkgmgr_ret);
+ err = false;
+ goto out;
+ }
+
+ pkgmgr_ret = pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(handle, foreach_app_info_callback, info, info->uid);
+ if (pkgmgr_ret != PMINFO_R_OK) {
+ NOTIFICATION_ERR("pkgmgrinfo_pkginfo_filter_foreach_appinfo failed [%d]", pkgmgr_ret);
+ err = false;
+ goto out;
+ }
+out:
+ if (handle)
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+
+ return err;
+}
+
EXPORT_API int notification_setting_refresh_setting_table(uid_t uid)
{
int err = NOTIFICATION_ERROR_NONE;
sqlite3 *db = NULL;
int sqlite3_ret = SQLITE_OK;
int pkgmgr_ret = PACKAGE_MANAGER_ERROR_NONE;
- pkgmgrinfo_pkginfo_filter_h filter;
+ pkgmgrinfo_pkginfo_filter_h filter = NULL;
setting_local_info info;
NOTIFICATION_INFO("refresh setting table [%d]", uid);
@@ -394,10 +476,9 @@ EXPORT_API int notification_setting_refresh_setting_table(uid_t uid)
goto out;
}
- pkgmgrinfo_pkginfo_filter_destroy(filter);
-
out:
-
+ if (filter)
+ pkgmgrinfo_pkginfo_filter_destroy(filter);
if (db) {
if (err == NOTIFICATION_ERROR_NONE)
sqlite3_exec(db, "END;", NULL, NULL, NULL);
@@ -411,57 +492,100 @@ out:
return err;
}
-typedef enum {
- OPERATION_TYPE_INSERT_RECORD = 0,
- OPERATION_TYPE_DELETE_RECORD = 1,
-} notification_setting_operation_type;
-static int _notification_setting_alter_package_list(notification_setting_operation_type operation_type, const char *package_name, uid_t uid)
+
+static int _install_and_update_package(const char *package_name, uid_t uid)
{
- sqlite3 *db = NULL;
- sqlite3_stmt *db_statement = NULL;
+ sqlite3 *db;
+ int ret = NOTIFICATION_ERROR_NONE;
int sqlite3_ret = SQLITE_OK;
- int field_index = 1;
- bool is_package_in_setting_table = false;
- int err = NOTIFICATION_ERROR_NONE;
-
- sqlite3_ret = db_util_open(DBPATH, &db, 0);
+ int pkgmgr_ret = PACKAGE_MANAGER_ERROR_NONE;
+ setting_local_info info;
+ pkgmgrinfo_pkginfo_filter_h handle = NULL;
+ sqlite3_ret = sqlite3_open_v2(DBPATH, &db, SQLITE_OPEN_READWRITE, NULL);
if (sqlite3_ret != SQLITE_OK || db == NULL) {
NOTIFICATION_ERR("db_util_open failed [%s][%d]", DBPATH, sqlite3_ret);
- err = NOTIFICATION_ERROR_FROM_DB;
+ ret = NOTIFICATION_ERROR_FROM_DB;
goto out;
}
sqlite3_exec(db, "BEGIN immediate;", NULL, NULL, NULL);
- is_package_in_setting_table = _is_package_in_setting_table(db, package_name, uid);
+ pkgmgr_ret = pkgmgrinfo_pkginfo_filter_create(&handle);
+ if (pkgmgr_ret != PMINFO_R_OK) {
+ NOTIFICATION_ERR("pkgmgrinfo_pkginfo_filter_create failed [%d]", pkgmgr_ret);
+ ret = NOTIFICATION_ERROR_FROM_DB;
+ goto out;
+ }
- switch (operation_type) {
- case OPERATION_TYPE_INSERT_RECORD:
- if (is_package_in_setting_table == true) {
- NOTIFICATION_INFO("[%s] is already exist", package_name);
- goto out;
- }
- NOTIFICATION_INFO("[%s] will be inserted", package_name);
- sqlite3_ret = sqlite3_prepare_v2(db, "INSERT INTO notification_setting (uid, package_name) VALUES (?, ?) ", -1, &db_statement, NULL);
- break;
+ pkgmgr_ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_PRIVILEGE, NOTIFICATION_PRIVILEGE);
+ if (pkgmgr_ret != PMINFO_R_OK) {
+ NOTIFICATION_ERR("pkgmgrinfo_pkginfo_filter_add_string failed [%d]", pkgmgr_ret);
+ ret = NOTIFICATION_ERROR_FROM_DB;
+ goto out;
+ }
- case OPERATION_TYPE_DELETE_RECORD:
- if (is_package_in_setting_table == false) {
- NOTIFICATION_INFO("[%s] is not exist", package_name);
- goto out;
- }
- NOTIFICATION_INFO("[%s] will be removed", package_name);
- sqlite3_ret = sqlite3_prepare_v2(db, "DELETE FROM notification_setting WHERE uid = ? AND package_name = ? ", -1, &db_statement, NULL);
- break;
- default:
- break;
+ pkgmgr_ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_ID, package_name);
+ if (pkgmgr_ret != PMINFO_R_OK) {
+ NOTIFICATION_ERR("pkgmgrinfo_pkginfo_filter_add_string failed [%d]", pkgmgr_ret);
+ ret = NOTIFICATION_ERROR_FROM_DB;
+ goto out;
}
+ info.db = db;
+ info.uid = uid;
+ pkgmgr_ret = pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo(handle, foreach_package_info_callback, &info, uid);
+ if (pkgmgr_ret != PMINFO_R_OK) {
+ NOTIFICATION_ERR("pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo failed [%d]", pkgmgr_ret);
+ ret = NOTIFICATION_ERROR_FROM_DB;
+ goto out;
+ }
+
+out:
+ if (handle)
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ if (db) {
+ if (ret == NOTIFICATION_ERROR_NONE)
+ sqlite3_exec(db, "END;", NULL, NULL, NULL);
+ else
+ sqlite3_exec(db, "ROLLBACK;", NULL, NULL, NULL);
+
+ if ((sqlite3_ret = db_util_close(db)) != SQLITE_OK)
+ NOTIFICATION_WARN("db_util_close failed [%d]", sqlite3_ret);
+ }
+
+ return ret;
+}
+
+static int _delete_package_from_setting_db(const char *package_name, uid_t uid)
+{
+ sqlite3 *db = NULL;
+ sqlite3_stmt *db_statement = NULL;
+ int ret = NOTIFICATION_ERROR_NONE;
+ int sqlite3_ret = SQLITE_OK;
+ int field_index = 1;
+ bool is_package_in_setting_table = false;
+
+ sqlite3_ret = sqlite3_open_v2(DBPATH, &db, SQLITE_OPEN_READWRITE, NULL);
+ if (sqlite3_ret != SQLITE_OK || db == NULL) {
+ NOTIFICATION_ERR("db_util_open failed [%s][%d]", DBPATH, sqlite3_ret);
+ ret = NOTIFICATION_ERROR_FROM_DB;
+ goto out;
+ }
+
+ is_package_in_setting_table = _is_package_in_setting_table(db, package_name, NULL, uid);
+ if (is_package_in_setting_table == false) {
+ NOTIFICATION_INFO("[%s] is not exist", package_name);
+ goto out;
+ }
+
+ sqlite3_exec(db, "BEGIN immediate;", NULL, NULL, NULL);
+
+ sqlite3_ret = sqlite3_prepare_v2(db, "DELETE FROM notification_setting WHERE uid = ? AND package_name = ? ", -1, &db_statement, NULL);
if (sqlite3_ret != SQLITE_OK) {
NOTIFICATION_ERR("sqlite3_prepare_v2 failed [%d][%s]", sqlite3_ret, sqlite3_errmsg(db));
- err = NOTIFICATION_ERROR_FROM_DB;
+ ret = NOTIFICATION_ERROR_FROM_DB;
goto out;
}
@@ -469,40 +593,35 @@ static int _notification_setting_alter_package_list(notification_setting_operati
sqlite3_bind_text(db_statement, field_index++, package_name, -1, SQLITE_TRANSIENT);
sqlite3_ret = sqlite3_step(db_statement);
-
if (sqlite3_ret != SQLITE_OK && sqlite3_ret != SQLITE_DONE) {
NOTIFICATION_ERR("sqlite3_step failed [%d][%s]", sqlite3_ret, sqlite3_errmsg(db));
- err = NOTIFICATION_ERROR_FROM_DB;
+ ret = NOTIFICATION_ERROR_FROM_DB;
}
out:
if (db_statement)
sqlite3_finalize(db_statement);
-
if (db) {
- NOTIFICATION_INFO("err [%d]", err);
- if (err == NOTIFICATION_ERROR_NONE)
+ if (ret == NOTIFICATION_ERROR_NONE)
sqlite3_exec(db, "END;", NULL, NULL, NULL);
else
sqlite3_exec(db, "ROLLBACK;", NULL, NULL, NULL);
-
if ((sqlite3_ret = db_util_close(db)) != SQLITE_OK)
- NOTIFICATION_WARN("fail to db_util_close - [%d]", sqlite3_ret);
-
+ NOTIFICATION_WARN("db_util_close failed [%d]", sqlite3_ret);
}
- return err;
+ return ret;
}
-EXPORT_API int notification_setting_insert_package_for_uid(const char *package_id, uid_t uid)
+EXPORT_API int notification_setting_insert_package_for_uid(const char *package_name, uid_t uid)
{
- return _notification_setting_alter_package_list(OPERATION_TYPE_INSERT_RECORD, package_id, uid);
+ return _install_and_update_package(package_name, uid);
}
-EXPORT_API int notification_setting_delete_package_for_uid(const char *package_id, uid_t uid)
+EXPORT_API int notification_setting_delete_package_for_uid(const char *package_name, uid_t uid)
{
- return _notification_setting_alter_package_list(OPERATION_TYPE_DELETE_RECORD, package_id, uid);
+ return _delete_package_from_setting_db(package_name, uid);
}
EXPORT_API int notification_system_setting_load_system_setting_for_uid(notification_system_setting_h *system_setting, uid_t uid)
diff --git a/src/notification_setting_service.c b/src/notification_setting_service.c
index e9adcc3..d7f7fd2 100644
--- a/src/notification_setting_service.c
+++ b/src/notification_setting_service.c
@@ -89,7 +89,7 @@ out:
}
EXPORT_API
-int noti_setting_service_get_setting_by_package_name(const char *package_name, notification_setting_h *setting, uid_t uid)
+int noti_setting_service_get_setting_by_appid(const char *appid, notification_setting_h *setting, uid_t uid)
{
int err = NOTIFICATION_ERROR_NONE;
sqlite3 *local_db_handle = NULL;
@@ -102,7 +102,7 @@ int noti_setting_service_get_setting_by_package_name(const char *package_name, n
int col_index = 0;
notification_setting_h result_setting_array = NULL;
- if (package_name == NULL || setting == NULL) {
+ if (appid == NULL || setting == NULL) {
NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); /* LCOV_EXCL_LINE */
err = NOTIFICATION_ERROR_INVALID_PARAMETER;
goto out;
@@ -116,9 +116,9 @@ int noti_setting_service_get_setting_by_package_name(const char *package_name, n
goto out;
}
- sql_query = sqlite3_mprintf("SELECT package_name, allow_to_notify, do_not_disturb_except, visibility_class, "
+ sql_query = sqlite3_mprintf("SELECT package_name, appid, allow_to_notify, do_not_disturb_except, visibility_class, "
"pop_up_notification, lock_screen_content_level FROM %s "
- "WHERE package_name = %Q AND uid = %d", NOTIFICATION_SETTING_DB_TABLE, package_name, uid);
+ "WHERE appid = %Q AND uid = %d", NOTIFICATION_SETTING_DB_TABLE, appid, uid);
if (!sql_query) {
NOTIFICATION_ERR("fail to alloc query"); /* LCOV_EXCL_LINE */
@@ -127,7 +127,6 @@ int noti_setting_service_get_setting_by_package_name(const char *package_name, n
}
sql_return = sqlite3_get_table(local_db_handle, sql_query, &query_result, &row_count, &column_count, NULL);
-
if (sql_return != SQLITE_OK && sql_return != -1) {
NOTIFICATION_ERR("sqlite3_get_table failed [%d][%s]", sql_return, sql_query); /* LCOV_EXCL_LINE */
err = NOTIFICATION_ERROR_FROM_DB;
@@ -135,7 +134,7 @@ int noti_setting_service_get_setting_by_package_name(const char *package_name, n
}
if (!row_count) {
- NOTIFICATION_DBG("No setting found for [%s]", package_name); /* LCOV_EXCL_LINE */
+ NOTIFICATION_DBG("No setting found for [%s]", appid); /* LCOV_EXCL_LINE */
err = NOTIFICATION_ERROR_NOT_EXIST_ID;
goto out;
}
@@ -153,6 +152,7 @@ int noti_setting_service_get_setting_by_package_name(const char *package_name, n
col_index = column_count;
_get_table_field_data_string(query_result, &(result_setting_array[i].package_name), 1, col_index++);
+ _get_table_field_data_string(query_result, &(result_setting_array[i].appid), 1, col_index++);
_get_table_field_data_int(query_result, (int *)&(result_setting_array[i].allow_to_notify), col_index++);
_get_table_field_data_int(query_result, (int *)&(result_setting_array[i].do_not_disturb_except), col_index++);
_get_table_field_data_int(query_result, &(result_setting_array[i].visibility_class), col_index++);
@@ -205,9 +205,9 @@ int noti_setting_get_setting_array(notification_setting_h *setting_array, int *c
goto out;
}
- sql_query = sqlite3_mprintf("SELECT package_name, allow_to_notify, do_not_disturb_except, visibility_class, "
+ sql_query = sqlite3_mprintf("SELECT package_name, appid, allow_to_notify, do_not_disturb_except, visibility_class, "
"pop_up_notification, lock_screen_content_level FROM %s WHERE uid = %d "
- "ORDER BY package_name", NOTIFICATION_SETTING_DB_TABLE, uid);
+ "ORDER BY package_name, appid ", NOTIFICATION_SETTING_DB_TABLE, uid);
if (!sql_query) {
NOTIFICATION_ERR("fail to alloc query"); /* LCOV_EXCL_LINE */
@@ -240,9 +240,10 @@ int noti_setting_get_setting_array(notification_setting_h *setting_array, int *c
for (i = 0; i < row_count; i++) {
_get_table_field_data_string(query_result, &(result_setting_array[i].package_name), 1, col_index++);
+ _get_table_field_data_string(query_result, &(result_setting_array[i].appid), 1, col_index++);
_get_table_field_data_int(query_result, (int *)&(result_setting_array[i].allow_to_notify), col_index++);
_get_table_field_data_int(query_result, (int *)&(result_setting_array[i].do_not_disturb_except), col_index++);
- _get_table_field_data_int(query_result, &(result_setting_array[i].visibility_class), col_index++);
+ _get_table_field_data_int(query_result, (int *)&(result_setting_array[i].visibility_class), col_index++);
_get_table_field_data_int(query_result, (int *)&(result_setting_array[i].pop_up_notification), col_index++);
_get_table_field_data_int(query_result, (int *)&(result_setting_array[i].lock_screen_content_level), col_index++);
}
@@ -368,17 +369,18 @@ out:
}
EXPORT_API
-int notification_setting_db_update(const char *package_name, int allow_to_notify,
- int do_not_disturb_except, int visibility_class,
- int pop_up_notification, int lock_screen_content_level,
- uid_t uid)
+int notification_setting_db_update(const char *package_name, const char *appid,
+ int allow_to_notify, int do_not_disturb_except,
+ int visibility_class, int pop_up_notification,
+ int lock_screen_content_level, uid_t uid)
{
int err = NOTIFICATION_ERROR_NONE;
sqlite3 *db = NULL;
char *sqlbuf = NULL;
int sqlret;
- if (package_name == NULL || strlen(package_name) == 0)
+ if (package_name == NULL || strlen(package_name) == 0
+ || appid == NULL || strlen(appid) == 0)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
sqlret = db_util_open(DBPATH, &db, 0);
@@ -389,9 +391,9 @@ int notification_setting_db_update(const char *package_name, int allow_to_notify
sqlbuf = sqlite3_mprintf("UPDATE %s SET allow_to_notify = %d, do_not_disturb_except = %d, visibility_class = %d, " \
"pop_up_notification = %d, lock_screen_content_level = %d " \
- "WHERE package_name = %Q AND uid = %d",
+ "WHERE appid = %Q AND package_name = %Q AND uid = %d",
NOTIFICATION_SETTING_DB_TABLE, allow_to_notify, do_not_disturb_except, visibility_class,
- pop_up_notification, lock_screen_content_level, package_name, uid);
+ pop_up_notification, lock_screen_content_level, appid, package_name, uid);
if (!sqlbuf) {
NOTIFICATION_ERR("fail to alloc query");
err = NOTIFICATION_ERROR_OUT_OF_MEMORY;
@@ -584,7 +586,7 @@ err:
return ret;
}
-EXPORT_API int notification_get_dnd_and_allow_to_notify(const char *pkgname,
+EXPORT_API int notification_get_dnd_and_allow_to_notify(const char *appid,
int *do_not_disturb,
int *do_not_disturb_except,
int *allow_to_notify,
@@ -601,7 +603,7 @@ EXPORT_API int notification_get_dnd_and_allow_to_notify(const char *pkgname,
char *query_system_setting = NULL;
char **query_system_setting_result = NULL;
- if (pkgname == NULL)
+ if (appid == NULL)
return NOTIFICATION_ERROR_INVALID_PARAMETER;
db = notification_db_open(DBPATH);
@@ -609,8 +611,8 @@ EXPORT_API int notification_get_dnd_and_allow_to_notify(const char *pkgname,
return get_last_result();
query_setting = sqlite3_mprintf("SELECT allow_to_notify, do_not_disturb_except "
- "FROM %s WHERE package_name = %Q AND uid = %d",
- NOTIFICATION_SETTING_DB_TABLE, pkgname, uid);
+ "FROM %s WHERE appid = %Q AND uid = %d",
+ NOTIFICATION_SETTING_DB_TABLE, appid, uid);
if (query_setting == NULL) {
NOTIFICATION_ERR("fail to alloc query");
ret = NOTIFICATION_ERROR_OUT_OF_MEMORY;
@@ -633,7 +635,7 @@ EXPORT_API int notification_get_dnd_and_allow_to_notify(const char *pkgname,
goto out;
}
if (row_count == 0) {
- NOTIFICATION_ERR("Invalid uid [%d] or package name [%s]", uid, pkgname);
+ NOTIFICATION_ERR("Invalid uid [%d] or app id [%s]", uid, appid);
ret = NOTIFICATION_ERROR_INVALID_PARAMETER;
goto out;
}
diff --git a/test-app/main.c b/test-app/main.c
index f47c2a5..4eb26ad 100755
--- a/test-app/main.c
+++ b/test-app/main.c
@@ -671,27 +671,32 @@ static int testapp_test_get_setting_list()
int i = 0;
int count = 0;
char *package_name = NULL;
+ char *appid = NULL;
bool allow_to_notify = false;
bool do_not_disturb_except = false;
int visibility_class = false;
bool pop_up_notification = false;
lock_screen_content_level_e level = 0;
notification_setting_h setting_array = NULL;
+ notification_setting_h tmp = NULL;
notification_setting_get_setting_array(&setting_array, &count);
testapp_print("count [%d]\n", count);
for (i = 0; i < count; i++) {
- notification_setting_get_package_name(setting_array + i, &package_name);
- notification_setting_get_allow_to_notify(setting_array + i, &allow_to_notify);
- notification_setting_get_do_not_disturb_except(setting_array + i, &do_not_disturb_except);
- notification_setting_get_visibility_class(setting_array + i, &visibility_class);
- notification_setting_get_pop_up_notification(setting_array + i, &pop_up_notification);
- notification_setting_get_lock_screen_content(setting_array + i, &level);
- testapp_print("[%d] : package_name[%s], allow_to_notify[%d], do_not_disturb_except[%d], visibility_class[%d], notification_pop_up[%d], lock_content_level[%d]\n"
- , i, package_name, allow_to_notify, do_not_disturb_except, visibility_class, pop_up_notification, level);
+ tmp = setting_array + i;
+ notification_setting_get_package_name(tmp, &package_name);
+ notification_setting_get_appid(tmp, &appid);
+ notification_setting_get_allow_to_notify(tmp, &allow_to_notify);
+ notification_setting_get_do_not_disturb_except(tmp, &do_not_disturb_except);
+ notification_setting_get_visibility_class(tmp, &visibility_class);
+ notification_setting_get_pop_up_notification(tmp, &pop_up_notification);
+ notification_setting_get_lock_screen_content(tmp, &level);
+ testapp_print("[%d] : package_name[%s], appid [%s], allow_to_notify[%d], do_not_disturb_except[%d] visibility_class[%d] pop_up_notification[%d] level[%d]\n",
+ i, package_name, appid, allow_to_notify, do_not_disturb_except, visibility_class, pop_up_notification, level);
free(package_name);
+ free(appid);
}
notification_setting_free_notification(setting_array);