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,
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;
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);
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;
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);
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) \
);"
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),
(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");
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,
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;
}
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");
}
g_variant_get(variant,
- "(iiiiiiii)",
+ "(iiiiiiiii)",
&do_not_disturb,
&visibility_class,
&dnd_schedule_enabled,
&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;
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;
}
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;
+}
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) {
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;
_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 */
}
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;
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));
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) {
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);
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) {