char *package_name;
bool allow_to_notify;
bool do_not_disturb_except;
+ bool pop_up_notification;
int visibility_class;
+ lock_screen_content_level_e lock_screen_content_level;
};
/* System setting */
/*
* @internal
* @brief Sets value which whether allow notification from individual applications.
- * @details After notification_setting_update_setting() call, the allow_to_notify is not updated.
+ * @details After notification_setting_update_setting() call, the allow_to_notify is updated.
* @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif
* @param[in] setting The notification setting handle
* @param[in] value The value whether allow to notification
/*
* @internal
* @brief Sets value which whether do not disturb notification or not.
- * @details After notification_setting_update_setting() call, the do_not_disturb value is not updated.
+ * @details After notification_setting_update_setting() call, the do_not_disturb value is updated.
* @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif
* @param[in] setting The notification setting handle
* @param[in] value The value which do not disturb notification or not
- *
* @return #NOTIFICATION_ERROR_NONE on success,
* otherwise any other value on failure
* @retval #NOTIFICATION_ERROR_NONE Success
/*
* @internal
+ * @brief Gets value whether Pop up notification is allowed or not.
+ * @since_tizen 3.0
+ * @param[in] setting The notification setting handle
+ * @param[in] value The value
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par sample code:
+ * @code
+#include <notification_setting_internal.h>
+...
+{
+ int noti_err = 0;
+ bool value;
+ notification_setting_h setting = NULL;
+
+ ...
+
+ value = true; // or false
+
+ noti_err = notifiacation_setting_get_pop_up_notification(setting, value);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+
+ notification_setting_free_notification(setting);
+
+ return 0;
+
+}
+ * @endcode
+ */
+int notification_setting_get_pop_up_notification(notification_setting_h setting, bool *value);
+
+/*
+ * @internal
+ * @brief Sets value which Pop up notification allow or block.
+ * @details After notification_setting_update_setting() call, the pop_up_notification value is updated.
+ * @since_tizen 3.0
+ * @param[in] setting The notification setting handle
+ * @param[in] value The value
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @par sample code:
+ * @code
+#include <notification_setting_internal.h>
+...
+{
+ int noti_err = 0;
+ bool value;
+ notification_setting_h setting = NULL;
+
+ ...
+
+ value = true; // or false
+
+ noti_err = notifiacation_setting_get_pop_up_notification(setting, value);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+
+ notification_setting_free_notification(setting);
+
+ return 0;
+
+}
+ * @endcode
+ */
+int notification_setting_set_pop_up_notification(notification_setting_h setting, bool value);
+
+/*
+ * @internal
+ * @brief Gets displaying level that notification's information on lock screen from individual application.
+ * @since_tizen 3.0
+ * @param[in] setting The notification setting handle
+ * @param[out] level The displaying level of notification's information on lock screen
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see #lock_screen_content_level_e
+ * @par sample code:
+ * @code
+#include <notification_setting_internal.h>
+...
+{
+ int noti_err = 0;
+ notification_setting_h setting = NULL;
+ lock_screen_content_level_e level;
+
+ ...
+
+ noti_err = notifiacation_setting_get_lock_screen_content(setting, &level);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+
+ notification_setting_free_notification(setting);
+
+ return 0;
+
+}
+ * @endcode
+ */
+int notification_setting_get_lock_screen_content(notification_setting_h setting, lock_screen_content_level_e *level);
+
+/*
+ * @internal
+ * @brief Sets displaying level that notification's information on lock screen from individual application.
+ * @details After notification_setting_update_setting() call, the lock_screen_content_level value is updated.
+ * @since_tizen 3.0
+ * @param[in] setting The notification setting handle
+ * @param[out] level The displaying level of notification's information on lock screen
+ * @return #NOTIFICATION_ERROR_NONE on success,
+ * otherwise any other value on failure
+ * @retval #NOTIFICATION_ERROR_NONE Success
+ * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see #lock_screen_content_level_e
+ * @par sample code:
+ * @code
+#include <notification_setting_internal.h>
+...
+{
+ int noti_err = 0;
+ notification_setting_h setting = NULL;
+ lock_screen_content_level_e level;
+
+ ...
+
+ level = SHOW_ALL_CONTENT; // or HIDE_SENSITIVE_CONTENT or DO_NOT_SHOW_NOTIFICATIONS;
+
+ noti_err = notifiacation_setting_get_lock_screen_content(setting, level);
+ if(noti_err != NOTIFICATION_ERROR_NONE) {
+ return;
+ }
+
+ notification_setting_free_notification(setting);
+
+ return 0;
+
+}
+ * @endcode
+ */
+int notification_setting_set_lock_screen_content(notification_setting_h setting, lock_screen_content_level_e level);
+
+/*
+ * @internal
* @brief Gets the notification system setting handle.
* @since_tizen @if wearable 2.3.1 @elseif mobile 2.3 @endif
* @privlevel public
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, uid_t uid);
+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_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,
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) \
); \
CREATE TABLE IF NOT EXISTS notification_system_setting ( \
return result;
}
- body = g_variant_new("(siiii)",
+ body = g_variant_new("(siiiiii)",
setting->package_name,
(int)(setting->allow_to_notify),
(int)(setting->do_not_disturb_except),
(int)(setting->visibility_class),
+ (int)(setting->pop_up_notification),
+ (int)(setting->lock_screen_content_level),
uid);
result = _send_sync_noti(body, &reply, "update_noti_setting");
{
GVariant *body = NULL;
- body = g_variant_new("(siii)",
+ body = g_variant_new("(siiiii)",
noti_setting->package_name,
noti_setting->allow_to_notify,
noti_setting->do_not_disturb_except,
- noti_setting->visibility_class);
+ noti_setting->visibility_class,
+ noti_setting->pop_up_notification,
+ noti_setting->lock_screen_content_level);
return body;
}
int allow_to_notify;
int do_not_disturb_except;
int visibility_class;
+ int pop_up_notification;
+ int lock_screen_content_level;
if (noti_setting == NULL || variant == NULL) {
NOTIFICATION_ERR("invalid data");
return NOTIFICATION_ERROR_INVALID_PARAMETER;
}
g_variant_get(variant,
- "(&siii)",
+ "(&siiiii)",
&pkgname,
&allow_to_notify,
&do_not_disturb_except,
- &visibility_class);
+ &visibility_class,
+ &pop_up_notification,
+ &lock_screen_content_level);
NOTIFICATION_DBG("setting from variant %s !!", pkgname);
noti_setting->allow_to_notify = allow_to_notify;
noti_setting->do_not_disturb_except = do_not_disturb_except;
noti_setting->visibility_class = visibility_class;
+ noti_setting->pop_up_notification = pop_up_notification;
+ noti_setting->lock_screen_content_level = lock_screen_content_level;
NOTIFICATION_DBG("setting from variant %s, %s",
noti_setting->package_name, pkgname);
return err;
}
+static bool _is_pop_up_notification(const char *caller_package_name, uid_t uid)
+{
+ int err;
+ char *package_id = NULL;
+ bool ret = true;
+ notification_setting_h setting = NULL;
+
+ err = noti_setting_service_get_setting_by_package_name(caller_package_name, &setting, uid);
+ if (err != NOTIFICATION_ERROR_NONE) {
+ NOTIFICATION_ERR("noti_setting_service_get_setting_by_package_name failed [%d]", err);
+ goto out;
+ }
+
+ err = notification_setting_get_pop_up_notification(setting, &ret);
+ if (err != NOTIFICATION_ERROR_NONE) {
+ NOTIFICATION_ERR("notification_setting_get_pop_up_notification failed");
+ goto out;
+ }
+
+ if (ret != true)
+ NOTIFICATION_DBG("[%s] is not allowed Pop-up notification", caller_package_name);
+
+out:
+ if (package_id)
+ free(package_id);
+ if (setting)
+ notification_setting_free_notification(setting);
+
+ return ret;
+}
+
EXPORT_API int notification_noti_insert(notification_h noti)
{
int ret = 0;
if (_handle_do_not_disturb_option(noti) != NOTIFICATION_ERROR_NONE)
NOTIFICATION_WARN("_handle_do_not_disturb_option failed");
+ if (_is_pop_up_notification((const char *)noti->caller_pkgname, noti->uid) == false) {
+ noti->display_applist = (noti->display_applist & (~NOTIFICATION_DISPLAY_APP_ACTIVE));
+ NOTIFICATION_DBG("notification display applist - pkgname [%s], applist [%d]", noti->caller_pkgname, noti->display_applist);
+ }
db = notification_db_open(DBPATH);
if (!db)
if (_handle_do_not_disturb_option(noti) != NOTIFICATION_ERROR_NONE)
NOTIFICATION_WARN("_handle_do_not_disturb_option failed");
+ if (_is_pop_up_notification((const char *)noti->caller_pkgname, noti->uid) == false) {
+ noti->display_applist = (noti->display_applist & (~NOTIFICATION_DISPLAY_APP_ACTIVE));
+ NOTIFICATION_DBG("notification display applist - pkgname [%s], applist [%d]", noti->caller_pkgname, noti->display_applist);
+ }
+
/* Check private ID is exist */
ret = _notification_noti_check_priv_id(noti, db);
if (ret != NOTIFICATION_ERROR_ALREADY_EXIST_ID) {
return NOTIFICATION_ERROR_NONE;
}
+EXPORT_API int notification_setting_get_pop_up_notification(notification_setting_h setting, bool *value)
+{
+ if (setting == NULL || value == NULL) {
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ *value = setting->pop_up_notification;
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_setting_set_pop_up_notification(notification_setting_h setting, bool value)
+{
+ if (setting == NULL) {
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ setting->pop_up_notification = value;
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_setting_get_lock_screen_content(notification_setting_h setting, lock_screen_content_level_e *level)
+{
+ if (setting == NULL || level == NULL) {
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ *level = setting->lock_screen_content_level;
+ return NOTIFICATION_ERROR_NONE;
+}
+
+EXPORT_API int notification_setting_set_lock_screen_content(notification_setting_h setting, lock_screen_content_level_e level)
+{
+ if (setting == NULL) {
+ NOTIFICATION_ERR("Invalid parameter");
+ return NOTIFICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ setting->lock_screen_content_level = level;
+ return NOTIFICATION_ERROR_NONE;
+}
+
EXPORT_API int notification_setting_update_setting_for_uid(notification_setting_h setting, uid_t uid)
{
if (setting == NULL) {
goto out;
}
- sql_query = sqlite3_mprintf("SELECT package_name, allow_to_notify, do_not_disturb_except, visibility_class "
- "FROM %s "
- "WHERE package_name = %Q AND uid = %d", NOTIFICATION_SETTING_DB_TABLE, package_name, uid);
+ sql_query = sqlite3_mprintf("SELECT package_name, 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);
if (!sql_query) {
NOTIFICATION_ERR("fail to alloc query"); /* LCOV_EXCL_LINE */
_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].pop_up_notification), col_index++);
+ _get_table_field_data_int(query_result, (int *)&(result_setting_array[i].lock_screen_content_level), col_index++);
*setting = result_setting_array;
goto out;
}
- sql_query = sqlite3_mprintf("SELECT package_name, allow_to_notify, do_not_disturb_except, visibility_class "
- "FROM %s WHERE uid = %d "
- "ORDER BY package_name", NOTIFICATION_SETTING_DB_TABLE, uid);
+ sql_query = sqlite3_mprintf("SELECT package_name, 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);
if (!sql_query) {
NOTIFICATION_ERR("fail to alloc query"); /* LCOV_EXCL_LINE */
_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].pop_up_notification), col_index++);
+ _get_table_field_data_int(query_result, (int *)&(result_setting_array[i].lock_screen_content_level), col_index++);
}
*setting_array = result_setting_array;
out:
if (query_result)
- sqlite3_free_table(query_result);
+ sqlite3_free_table(query_result);
if (sql_query)
sqlite3_free(sql_query);
}
EXPORT_API
-int notification_setting_db_update(const char *package_name, int allow_to_notify, int do_not_disturb_except, int visibility_class, uid_t uid)
+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 err = NOTIFICATION_ERROR_NONE;
sqlite3 *db = NULL;
return NOTIFICATION_ERROR_FROM_DB;
}
- sqlbuf = sqlite3_mprintf("UPDATE %s SET allow_to_notify = %d, do_not_disturb_except = %d, visibility_class = %d " \
+ 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",
- NOTIFICATION_SETTING_DB_TABLE, allow_to_notify, do_not_disturb_except, visibility_class, package_name, uid);
+ NOTIFICATION_SETTING_DB_TABLE, allow_to_notify, do_not_disturb_except, visibility_class,
+ pop_up_notification, lock_screen_content_level, package_name, uid);
if (!sqlbuf) {
NOTIFICATION_ERR("fail to alloc query");
err = NOTIFICATION_ERROR_OUT_OF_MEMORY;
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_get_setting_array(&setting_array, &count);
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);
-
- testapp_print("[%d] : package_name[%s], allow_to_notify[%d], do_not_disturb_except[%d], visibility_class[%d]\n"
- , i, package_name, allow_to_notify, do_not_disturb_except, 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);
free(package_name);
}