diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/notification_db.c | 1 | ||||
-rwxr-xr-x | src/notification_ipc.c | 28 | ||||
-rwxr-xr-x | src/notification_setting.c | 32 | ||||
-rw-r--r-- | src/notification_setting_service.c | 11 |
4 files changed, 55 insertions, 17 deletions
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) { |