summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMyungki Lee <mk5004.lee@samsung.com>2016-07-06 21:17:26 +0900
committerMyungki Lee <mk5004.lee@samsung.com>2016-07-06 21:17:26 +0900
commitc672586db4a03755fc90a64b9e52214ca60a8399 (patch)
tree7fbf2163dabefe1c7e3b829f421dd034534995f3
parent66555081a205f928dd9487967ec365fafd43f51b (diff)
downloadnotification-c672586db4a03755fc90a64b9e52214ca60a8399.tar.gz
notification-c672586db4a03755fc90a64b9e52214ca60a8399.tar.bz2
notification-c672586db4a03755fc90a64b9e52214ca60a8399.zip
- show all content - hide sensitive content - don't show notifications Change-Id: Ib2b86838a8b9018f704561f0bea68e58084cfe32 Signed-off-by: Myungki Lee <mk5004.lee@samsung.com>
-rw-r--r--include/notification_private.h11
-rw-r--r--include/notification_setting_internal.h25
-rw-r--r--include/notification_setting_service.h3
-rwxr-xr-xsrc/notification_db.c1
-rwxr-xr-xsrc/notification_ipc.c28
-rwxr-xr-xsrc/notification_setting.c32
-rw-r--r--src/notification_setting_service.c11
-rwxr-xr-xtest-app/main.c11
8 files changed, 93 insertions, 29 deletions
diff --git a/include/notification_private.h b/include/notification_private.h
index 50c59e9..935fdf8 100644
--- a/include/notification_private.h
+++ b/include/notification_private.h
@@ -92,17 +92,6 @@ struct _notification {
uid_t uid;
};
-struct notification_system_setting {
- bool do_not_disturb;
- int visibility_class;
- bool dnd_schedule_enabled;
- int dnd_schedule_day;
- int dnd_start_hour;
- int dnd_start_min;
- int dnd_end_hour;
- int dnd_end_min;
-};
-
typedef enum notification_data_type {
NOTIFICATION_DATA_TYPE_NOTI_TYPE = 1,
NOTIFICATION_DATA_TYPE_LAYOUT,
diff --git a/include/notification_setting_internal.h b/include/notification_setting_internal.h
index 9c84a30..c22019b 100644
--- a/include/notification_setting_internal.h
+++ b/include/notification_setting_internal.h
@@ -40,6 +40,16 @@ typedef enum {
DND_SCHEDULE_WEEK_FLAG_SATURDAY = 0x40, /**< Saturday */
} dnd_schedule_week_flag_e;
+/**
+* @brief Enumeration for lock screen content.
+* @since_tizen 3.0
+*/
+typedef enum lock_screen_content_level {
+ SHOW_ALL_CONTENT = 0,
+ HIDE_SENSITIVE_CONTENT,
+ DO_NOT_SHOW_NOTIFICATIONS,
+} lock_screen_content_level_e;
+
/* Application setting */
struct notification_setting {
char *package_name;
@@ -48,6 +58,18 @@ struct notification_setting {
int visibility_class;
};
+struct notification_system_setting {
+ bool do_not_disturb;
+ int visibility_class;
+ bool dnd_schedule_enabled;
+ int dnd_schedule_day;
+ int dnd_start_hour;
+ int dnd_start_min;
+ int dnd_end_hour;
+ int dnd_end_min;
+ lock_screen_content_level_e lock_screen_content_level;
+};
+
int notification_setting_get_setting_array(notification_setting_h *setting_array, int *count);
int notification_setting_get_setting_array_for_uid(notification_setting_h *setting_array, int *count, uid_t uid);
@@ -97,6 +119,9 @@ int notification_system_setting_dnd_schedule_set_start_time(notification_system_
int notification_system_setting_dnd_schedule_get_end_time(notification_system_setting_h system_setting, int *hour, int *min);
int notification_system_setting_dnd_schedule_set_end_time(notification_system_setting_h system_setting, int hour, int min);
+int notification_system_setting_set_lock_screen_content(notification_system_setting_h system_setting, lock_screen_content_level_e level);
+int notification_system_setting_get_lock_screen_content(notification_system_setting_h system_setting, lock_screen_content_level_e *level);
+
/* OLD IMPLEMENTATION */
int notification_setting_property_set(const char *pkgname, const char *property, const char *value) NOTIFICATION_DEPRECATED_API;
int notification_setting_property_get(const char *pkgname, const char *property, char **value) NOTIFICATION_DEPRECATED_API;
diff --git a/include/notification_setting_service.h b/include/notification_setting_service.h
index 7dabc5b..b9483da 100644
--- a/include/notification_setting_service.h
+++ b/include/notification_setting_service.h
@@ -32,7 +32,8 @@ int notification_setting_db_update(const char *package_name, int allow_to_notify
int notification_setting_db_update_system_setting(int do_not_disturb, int visibility_class,
int dnd_schedule_enabled, int dnd_schedule_day,
int dnd_start_hour, int dnd_start_min,
- int dnd_end_hour, int dnd_end_min, uid_t uid);
+ int dnd_end_hour, int dnd_end_min,
+ 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);
diff --git a/src/notification_db.c b/src/notification_db.c
index cf90595..0a0e4d7 100755
--- a/src/notification_db.c
+++ b/src/notification_db.c
@@ -136,6 +136,7 @@ create table if not exists noti_list ( \
dnd_start_min INTEGER DEFAULT 0, \
dnd_end_hour INTEGER DEFAULT 0, \
dnd_end_min INTEGER DEFAULT 0, \
+ lock_screen_content_level INTEGER DEFAULT 0, \
UNIQUE (uid) \
);"
diff --git a/src/notification_ipc.c b/src/notification_ipc.c
index a758897..1afb44e 100755
--- a/src/notification_ipc.c
+++ b/src/notification_ipc.c
@@ -1293,7 +1293,7 @@ int notification_ipc_update_system_setting(notification_system_setting_h system_
return result;
}
- body = g_variant_new("(iiiiiiiii)",
+ body = g_variant_new("(iiiiiiiiii)",
(int)(system_setting->do_not_disturb),
(int)(system_setting->visibility_class),
(int)(system_setting->dnd_schedule_enabled),
@@ -1302,6 +1302,7 @@ int notification_ipc_update_system_setting(notification_system_setting_h system_
(int)(system_setting->dnd_start_min),
(int)(system_setting->dnd_end_hour),
(int)(system_setting->dnd_end_min),
+ (int)(system_setting->lock_screen_content_level),
uid);
result = _send_sync_noti(body, &reply, "update_noti_sys_setting");
@@ -1693,7 +1694,7 @@ EXPORT_API int notification_ipc_make_noti_from_gvariant(notification_h noti,
EXPORT_API GVariant *notification_ipc_make_gvariant_from_system_setting(struct notification_system_setting *noti_setting)
{
GVariant *body = NULL;
- body = g_variant_new("(iiiiiiii)",
+ body = g_variant_new("(iiiiiiiii)",
noti_setting->do_not_disturb,
noti_setting->visibility_class,
noti_setting->dnd_schedule_enabled,
@@ -1701,7 +1702,8 @@ EXPORT_API GVariant *notification_ipc_make_gvariant_from_system_setting(struct n
noti_setting->dnd_start_hour,
noti_setting->dnd_start_min,
noti_setting->dnd_end_hour,
- noti_setting->dnd_end_min);
+ noti_setting->dnd_end_min,
+ noti_setting->lock_screen_content_level);
return body;
}
@@ -1716,6 +1718,7 @@ EXPORT_API int notification_ipc_make_system_setting_from_gvariant(struct notific
int dnd_start_min;
int dnd_end_hour;
int dnd_end_min;
+ int lock_screen_content_level;
if (noti_setting == NULL) {
NOTIFICATION_ERR("invalid data");
@@ -1723,7 +1726,7 @@ EXPORT_API int notification_ipc_make_system_setting_from_gvariant(struct notific
}
g_variant_get(variant,
- "(iiiiiiii)",
+ "(iiiiiiiii)",
&do_not_disturb,
&visibility_class,
&dnd_schedule_enabled,
@@ -1731,12 +1734,13 @@ EXPORT_API int notification_ipc_make_system_setting_from_gvariant(struct notific
&dnd_start_hour,
&dnd_start_min,
&dnd_end_hour,
- &dnd_end_min);
+ &dnd_end_min,
+ &lock_screen_content_level);
- NOTIFICATION_DBG("system setting #### %d, %d, %d, %d, [%d:%d] [%d:%d]",
- do_not_disturb, visibility_class,
- dnd_schedule_enabled, dnd_schedule_day,
- dnd_start_hour, dnd_start_min, dnd_end_hour, dnd_end_min);
+ NOTIFICATION_DBG("system setting #### %d, %d, %d, %d, [%d:%d] [%d:%d], %d",
+ do_not_disturb, visibility_class, dnd_schedule_enabled,
+ dnd_schedule_day, dnd_start_hour, dnd_start_min,
+ dnd_end_hour, dnd_end_min, lock_screen_content_level);
noti_setting->do_not_disturb = do_not_disturb;
noti_setting->visibility_class = visibility_class;
@@ -1746,11 +1750,7 @@ EXPORT_API int notification_ipc_make_system_setting_from_gvariant(struct notific
noti_setting->dnd_start_min = dnd_start_min;
noti_setting->dnd_end_hour = dnd_end_hour;
noti_setting->dnd_end_min = dnd_end_min;
-
- NOTIFICATION_DBG("system setting2 #### %d, %d, %d",
- noti_setting->do_not_disturb,
- noti_setting->visibility_class,
- noti_setting->dnd_schedule_enabled);
+ noti_setting->lock_screen_content_level = lock_screen_content_level;
return NOTIFICATION_ERROR_NONE;
}
diff --git a/src/notification_setting.c b/src/notification_setting.c
index e2e290b..fbe2cdc 100755
--- a/src/notification_setting.c
+++ b/src/notification_setting.c
@@ -806,3 +806,35 @@ EXPORT_API int notification_system_setting_dnd_schedule_set_end_time(notificatio
out:
return err;
}
+
+EXPORT_API int notification_system_setting_get_lock_screen_content(notification_system_setting_h system_setting, lock_screen_content_level_e *level)
+{
+ int err = NOTIFICATION_ERROR_NONE;
+
+ if (system_setting == NULL || level == NULL) {
+ NOTIFICATION_ERR("Invalid parameter\n");
+ err = NOTIFICATION_ERROR_INVALID_PARAMETER;
+ goto out;
+ }
+
+ *level = system_setting->lock_screen_content_level;
+
+out:
+ return err;
+}
+
+EXPORT_API int notification_system_setting_set_lock_screen_content(notification_system_setting_h system_setting, lock_screen_content_level_e level)
+{
+ int err = NOTIFICATION_ERROR_NONE;
+
+ if (system_setting == NULL) {
+ NOTIFICATION_ERR("Invalid parameter\n");
+ err = NOTIFICATION_ERROR_INVALID_PARAMETER;
+ goto out;
+ }
+
+ system_setting->lock_screen_content_level = level;
+
+out:
+ return err;
+}
diff --git a/src/notification_setting_service.c b/src/notification_setting_service.c
index 1817dda..e5a3a32 100644
--- a/src/notification_setting_service.c
+++ b/src/notification_setting_service.c
@@ -308,7 +308,8 @@ int noti_system_setting_load_system_setting(notification_system_setting_h *syste
sql_query = sqlite3_mprintf("SELECT do_not_disturb, visibility_class, "
"dnd_schedule_enabled, dnd_schedule_day, "
- "dnd_start_hour, dnd_start_min, dnd_end_hour, dnd_end_min "
+ "dnd_start_hour, dnd_start_min, dnd_end_hour, dnd_end_min, "
+ "lock_screen_content_level "
"FROM %s WHERE uid = %d", NOTIFICATION_SYSTEM_SETTING_DB_TABLE, uid);
if (!sql_query) {
@@ -343,6 +344,7 @@ int noti_system_setting_load_system_setting(notification_system_setting_h *syste
result_system_setting->dnd_start_min = 0;
result_system_setting->dnd_end_hour = 0;
result_system_setting->dnd_end_min = 0;
+ result_system_setting->lock_screen_content_level = 0;
} else {
/* LCOV_EXCL_START */
col_index = column_count;
@@ -354,6 +356,7 @@ int noti_system_setting_load_system_setting(notification_system_setting_h *syste
_get_table_field_data_int(query_result, &(result_system_setting->dnd_start_min), col_index++);
_get_table_field_data_int(query_result, &(result_system_setting->dnd_end_hour), col_index++);
_get_table_field_data_int(query_result, &(result_system_setting->dnd_end_min), col_index++);
+ _get_table_field_data_int(query_result, &(result_system_setting->lock_screen_content_level), col_index++);
/* LCOV_EXCL_STOP */
}
@@ -417,7 +420,8 @@ EXPORT_API
int notification_setting_db_update_system_setting(int do_not_disturb, int visibility_class,
int dnd_schedule_enabled, int dnd_schedule_day,
int dnd_start_hour, int dnd_start_min,
- int dnd_end_hour, int dnd_end_min, uid_t uid)
+ int dnd_end_hour, int dnd_end_min,
+ int lock_screen_content_level, uid_t uid)
{
int err = NOTIFICATION_ERROR_NONE;
int sqlret;
@@ -435,7 +439,7 @@ int notification_setting_db_update_system_setting(int do_not_disturb, int visibi
sqlite3_exec(db, "BEGIN immediate;", NULL, NULL, NULL);
- sqlret = sqlite3_prepare_v2(db, "INSERT OR REPLACE INTO notification_system_setting (uid, do_not_disturb, visibility_class, dnd_schedule_enabled, dnd_schedule_day, dnd_start_hour, dnd_start_min, dnd_end_hour, dnd_end_min) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?) ", -1, &db_statement, NULL);
+ sqlret = sqlite3_prepare_v2(db, "INSERT OR REPLACE INTO notification_system_setting (uid, do_not_disturb, visibility_class, dnd_schedule_enabled, dnd_schedule_day, dnd_start_hour, dnd_start_min, dnd_end_hour, dnd_end_min, lock_screen_content_level) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ", -1, &db_statement, NULL);
if (sqlret != SQLITE_OK) {
NOTIFICATION_ERR("sqlite3_prepare_v2 failed [%d][%s]", sqlret, sqlite3_errmsg(db));
@@ -452,6 +456,7 @@ int notification_setting_db_update_system_setting(int do_not_disturb, int visibi
sqlite3_bind_int(db_statement, field_index++, dnd_start_min);
sqlite3_bind_int(db_statement, field_index++, dnd_end_hour);
sqlite3_bind_int(db_statement, field_index++, dnd_end_min);
+ sqlite3_bind_int(db_statement, field_index++, lock_screen_content_level);
sqlret = sqlite3_step(db_statement);
if (sqlret != SQLITE_OK && sqlret != SQLITE_DONE) {
diff --git a/test-app/main.c b/test-app/main.c
index 3f6e04d..b0457bd 100755
--- a/test-app/main.c
+++ b/test-app/main.c
@@ -722,6 +722,8 @@ static int testapp_test_update_system_setting()
int err = NOTIFICATION_ERROR_NONE;
bool do_not_disturb;
int visibility_class;
+ bool dnd_schedule_enabled;
+ lock_screen_content_level_e lock_screen_content_level = SHOW_ALL_CONTENT;
notification_system_setting_h system_setting = NULL;
err = notification_system_setting_load_system_setting(&system_setting);
@@ -741,6 +743,15 @@ static int testapp_test_update_system_setting()
visibility_class = !visibility_class;
notification_system_setting_set_visibility_class(system_setting, visibility_class);
+ notification_system_setting_dnd_schedule_get_enabled(system_setting, &dnd_schedule_enabled);
+ testapp_print("dnd_schedule_enabled [%d]\n", dnd_schedule_enabled);
+ dnd_schedule_enabled = !dnd_schedule_enabled;
+ notification_system_setting_dnd_schedule_set_enabled(system_setting, dnd_schedule_enabled);
+
+ notification_system_setting_get_lock_screen_content(system_setting, &lock_screen_content_level);
+ testapp_print("lock_screen_content_level [%d]\n", lock_screen_content_level);
+ lock_screen_content_level = !lock_screen_content_level;
+ notification_system_setting_set_lock_screen_content(system_setting, lock_screen_content_level);
err = notification_system_setting_update_system_setting(system_setting);
if (err != NOTIFICATION_ERROR_NONE || system_setting == NULL) {