From 112fcd8998329ca502bcf989219cf47a3eeca0c9 Mon Sep 17 00:00:00 2001 From: "seungha.son" Date: Tue, 20 Sep 2016 11:42:19 +0900 Subject: [PATCH] Add apis for notification post with event handler callback - notification_post_with_event_cb() API provide one event callback and distinguish the event by parameter. - notification_send_event() API is for sending event to daemon or app. Signed-off-by: seungha.son Change-Id: I4232568eb7bb02994f049f81685ae0310327dc69 --- include/notification_internal.h | 137 ++++++++++++++++++++++++++++ include/notification_ipc.h | 3 +- include/notification_private.h | 4 + src/notification.c | 2 + src/notification_db.c | 2 + src/notification_internal.c | 157 ++++++++++++++++++++++++++++++++ src/notification_ipc.c | 131 ++++++++++++++++++++++++++ src/notification_noti.c | 29 +++--- 8 files changed, 452 insertions(+), 13 deletions(-) diff --git a/include/notification_internal.h b/include/notification_internal.h index 0b4d31d5..e5ad7b93 100644 --- a/include/notification_internal.h +++ b/include/notification_internal.h @@ -1038,6 +1038,143 @@ int notification_get_hide_timeout(notification_h noti, int *timeout); */ int notification_set_hide_timeout(notification_h noti, int timeout); +typedef void (*event_handler_cb)(notification_h noti, int event_type, void *userdata); + +/** + * @brief Posts a notification with event handler callback. + * @details The registered callback could be called when take notification event + * and the callback is automatically deleted when notification you posted is deleted. + * @since_tizen 3.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @remarks Providing one event callback for each notification handle and distinguish the event by parameter. + * @param[in] noti The notification handle + * @param[in] cb The event handler callback function + * @param[in] userdata The user data + * @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_IO_ERROR I/O Error + * @retval #NOTIFICATION_PERMISSION_DENIED Permission denied + * @pre Notification handle should be created by notification_create(). + * @par Sample code: + * @code +#include + +static void event_callback(notification noti, int event_type, void *userdata) +{ + ... +} + +... +{ + notification_h noti = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) { + return; + } + + noti_err = notification_post_with_event_cb(noti, event_callback, NULL); + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } + + ... + + notification_free(noti); +} + * @endcode + */ +int notification_post_with_event_cb(notification_h noti, event_handler_cb cb, void *userdata); +int notification_post_with_event_cb_for_uid(notification_h noti, event_handler_cb cb, + void *userdata, uid_t uid); + +/** + * @brief Sends a event type to an application that posted notification. + * @details Sends occured event from viewer application to an application. + * @since_tizen 3.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/notification + * @param[in] noti The notification handle + * @param[in] event_type The event type + * @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_IO_ERROR I/O Error + * @retval #NOTIFICATION_PERMISSION_DENIED Permission denied + * @see #notification_event_type_e + * @see #notification_event_type_extension_e + * @par Sample code: + * @code +#include +... +{ + int noti_err; + int event_type; + + ... + + event_type = NOTIFICATION_EVENT_TYPE_HIDDEN_BY_USER; + + noti_err = notification_send_event(noti, event_type); + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } +} + * @endcode + */ +int notification_send_event(notification_h noti, int event_type); + +/** + * @brief Gets the event flag. + * @details When you create a notification handle, a default value of event flag is false. + * The flag automatically set true when post a notification using notification_post_with_event_cb(). + * The viewer application for showing the notifications can use this API to check if it needs to call + * notification_send_event() to sends event of notification for making the callback of the processes + * that have posted notification to be called. Call notification_send_event() + * when the notification_get_event_flag() tells that the @event_flag is true. + * @since_tizen 3.0 + * @param[in] noti The notification handle + * @param[out] event_flag The event flag + * @return #NOTIFICATION_ERROR_NONE on success, + * otherwise any other value on failure + * @retval #NOTIFICATION_ERROR_NONE Success + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @pre Notification handle should be created by notification_create(). + * @par Sample code: + * @code +#include +... +{ + notification_h noti = NULL; + int noti_err; + bool event_flag; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) { + return; + } + + noti_err = notification_get_event_flag(noti, &event_flag); + if (noti_err != NOTIFICATION_ERROR_NONE) { + notification_free(noti); + return; + } + + ... + + notification_free(noti); +} + * @endcode + */ +int notification_get_event_flag(notification_h noti, bool *event_flag); + /** * @brief This function translate localized texts * @param[in] noti The notification handle that is created by notification_create() diff --git a/include/notification_ipc.h b/include/notification_ipc.h index dc3df5bf..2a65fe38 100755 --- a/include/notification_ipc.h +++ b/include/notification_ipc.h @@ -47,6 +47,7 @@ int notification_ipc_make_system_setting_from_gvariant( int notification_dbus_init(); int notification_ipc_monitor_init(uid_t uid); int notification_ipc_monitor_fini(void); +void notification_ipc_event_monitor_fini(void); int notification_ipc_is_master_ready(void); int notification_ipc_add_deffered_task(void (*deferred_task_cb)(void *data), @@ -94,7 +95,7 @@ GVariant *notification_ipc_make_gvariant_from_dnd_allow_exception( int notification_ipc_make_dnd_allow_exception_from_gvariant( struct notification_system_setting_dnd_allow_exception *dnd_allow_exception, GVariant *variant); - +int notification_ipc_send_event(notification_h noti, int event_type); #ifdef __cplusplus } #endif diff --git a/include/notification_private.h b/include/notification_private.h index e7ac1195..116c0c76 100644 --- a/include/notification_private.h +++ b/include/notification_private.h @@ -96,6 +96,7 @@ struct _notification { notification_button_index_e default_button_index; int timeout; int text_input_max_length; + bool event_flag; uid_t uid; }; @@ -155,11 +156,14 @@ typedef enum notification_data_type { NOTIFICATION_DATA_TYPE_DEFAULT_BUTTON, NOTIFICATION_DATA_TYPE_TIMEOUT, NOTIFICATION_DATA_TYPE_TEXT_INPUT_MAX_LENGTH, + NOTIFICATION_DATA_TYPE_EVENT_FLAG, NOTIFICATION_DATA_TYPE_UID, } notification_data_type_e; void notification_call_changed_cb_for_uid(notification_op *op_list, int op_num, uid_t uid); void notification_call_dnd_changed_cb_for_uid(int do_not_disturb, uid_t uid); +void notification_call_event_handler_cb(notification_h noti, int event_type); +void notification_delete_event_handler_cb(int priv_id); char *notification_get_pkgname_by_pid(void); #endif /* __NOTIFICATION_PRIVATE_H__ */ diff --git a/src/notification.c b/src/notification.c index b1d84fd9..ccb3b62c 100755 --- a/src/notification.c +++ b/src/notification.c @@ -1431,6 +1431,7 @@ static notification_h _notification_create(notification_type_e type) noti->default_button_index = 0; noti->type = NOTIFICATION_ONGOING_VALUE_TYPE_PERCENT; noti->timeout = 0; + noti->event_flag = false; if (getuid() >= REGULAR_UID_MIN) { noti->caller_pkgname = notification_get_pkgname_by_pid(); @@ -1646,6 +1647,7 @@ EXPORT_API int notification_clone(notification_h noti, notification_h *clone) new_noti->default_button_index = noti->default_button_index; new_noti->timeout = noti->timeout; new_noti->text_input_max_length = noti->text_input_max_length; + new_noti->event_flag = noti->event_flag; new_noti->uid = noti->uid; new_noti->app_icon_path = NULL; diff --git a/src/notification_db.c b/src/notification_db.c index b1dc9a93..3b5c2c99 100755 --- a/src/notification_db.c +++ b/src/notification_db.c @@ -86,6 +86,7 @@ create table if not exists noti_list ( \ default_button_index INTEGER default 0, \ timeout INTEGER default 0, \ text_input_max_length INTEGER default 0, \ + event_flag INTEGER default 0, \ uid INTEGER \ ); \ create table if not exists noti_group_data ( \ @@ -207,6 +208,7 @@ create table if not exists noti_list ( \ default_button_index INTEGER default 0, \ timeout INTEGER default 0, \ text_input_max_length INTEGER default 0, \ + event_flag INTEGER default 0, \ uid INTEGER, \ template_name TEXT, \ UNIQUE (caller_pkgname, template_name) \ diff --git a/src/notification_internal.c b/src/notification_internal.c index d1b8344f..fe8ccd75 100755 --- a/src/notification_internal.c +++ b/src/notification_internal.c @@ -43,6 +43,7 @@ #include typedef struct _notification_cb_info notification_cb_info_s; +typedef struct _notification_event_cb_info notification_event_cb_info_s; typedef enum __notification_cb_type { NOTIFICATION_CB_NORMAL = 1, @@ -56,7 +57,14 @@ struct _notification_cb_info { void *data; }; +struct _notification_event_cb_info { + int priv_id; + event_handler_cb cb; + void *userdata; +}; + static GHashTable *_noti_cb_hash = NULL; +static GList *__noti_event_cb_list = NULL; /* LCOV_EXCL_START */ static void __free_changed_cb_info(gpointer data) @@ -111,6 +119,70 @@ void notification_call_changed_cb_for_uid(notification_op *op_list, int op_num, } } +static gint __priv_id_compare(gconstpointer a, gconstpointer b) +{ + const notification_event_cb_info_s *info = NULL; + + if (!a) + return -1; + + info = (notification_event_cb_info_s *)a; + + if (info->priv_id == GPOINTER_TO_UINT(b)) + return 0; + + return 1; +} + +void notification_call_event_handler_cb(notification_h noti, int event_type) +{ + int ret; + int priv_id; + GList *find_list; + notification_event_cb_info_s *info; + + if (__noti_event_cb_list == NULL) + return; + + ret = notification_get_id(noti, NULL, &priv_id); + if (ret != NOTIFICATION_ERROR_NONE) + return; + + __noti_event_cb_list = g_list_first(__noti_event_cb_list); + find_list = g_list_find_custom(__noti_event_cb_list, GUINT_TO_POINTER(priv_id), + (GCompareFunc)__priv_id_compare); + if (find_list == NULL) + return; + + info = g_list_nth_data(find_list, 0); + info->cb(noti, event_type, info->userdata); +} + +void notification_delete_event_handler_cb(int priv_id) +{ + GList *delete_list; + notification_event_cb_info_s *info = NULL; + + if (__noti_event_cb_list == NULL) + return; + + __noti_event_cb_list = g_list_first(__noti_event_cb_list); + delete_list = g_list_find_custom(__noti_event_cb_list, GUINT_TO_POINTER(priv_id), + (GCompareFunc)__priv_id_compare); + + if (delete_list == NULL) + return; + + info = g_list_nth_data(delete_list, 0); + __noti_event_cb_list = g_list_remove(g_list_first(__noti_event_cb_list), info); + + if (info) + free(info); + + if (__noti_event_cb_list == NULL) + notification_ipc_event_monitor_fini(); +} + EXPORT_API int notification_add_deferred_task( void (*deferred_task_cb)(void *data), void *user_data) { @@ -1411,3 +1483,88 @@ EXPORT_API int notification_get_text_input_max_length(notification_h noti, int * return NOTIFICATION_ERROR_NONE; } + +EXPORT_API int notification_post_with_event_cb_for_uid(notification_h noti, event_handler_cb cb, + void *userdata, uid_t uid) +{ + int ret; + int priv_id; + notification_event_cb_info_s *info = NULL; + GList *find_list; + + if (noti == NULL || cb == NULL) + return NOTIFICATION_ERROR_INVALID_PARAMETER; + + if (noti->type <= NOTIFICATION_TYPE_NONE || noti->type >= NOTIFICATION_TYPE_MAX) + return NOTIFICATION_ERROR_INVALID_PARAMETER; + + noti->insert_time = time(NULL); + noti->event_flag = true; + noti->uid = uid; + + ret = notification_ipc_request_insert(noti, &priv_id); + if (ret != NOTIFICATION_ERROR_NONE) + return ret; + + noti->priv_id = priv_id; + + __noti_event_cb_list = g_list_first(__noti_event_cb_list); + find_list = g_list_find_custom(__noti_event_cb_list, GUINT_TO_POINTER(priv_id), + (GCompareFunc)__priv_id_compare); + + if (find_list) { + info = g_list_nth_data(find_list, 0); + info->cb = cb; + info->userdata = userdata; + } else { + info = (notification_event_cb_info_s *)malloc(sizeof(notification_cb_info_s)); + if (info == NULL) { + NOTIFICATION_ERR("malloc failed"); + return NOTIFICATION_ERROR_OUT_OF_MEMORY; + } + info->priv_id = priv_id; + info->cb = cb; + info->userdata = userdata; + __noti_event_cb_list = g_list_append(__noti_event_cb_list, info); + } + + return ret; +} + +EXPORT_API int notification_post_with_event_cb(notification_h noti, event_handler_cb cb, void *userdata) +{ + return notification_post_with_event_cb_for_uid(noti, cb, userdata, getuid()); +} + +EXPORT_API int notification_send_event(notification_h noti, int event_type) +{ + int ret; + bool event_flag; + + if (noti == NULL) + return NOTIFICATION_ERROR_INVALID_PARAMETER; + + if (!((event_type >= NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1 + && event_type < NOTIFICATION_EVENT_TYPE_MAX) + || (event_type >= NOTIFICATION_EVENT_TYPE_HIDDEN_BY_USER + && event_type <= NOTIFICATION_EVENT_TYPE_HIDDEN_BY_TIMEOUT))) + return NOTIFICATION_ERROR_INVALID_PARAMETER; + + ret = notification_get_event_flag(noti, &event_flag); + if (ret != NOTIFICATION_ERROR_NONE || event_flag == false) + return NOTIFICATION_ERROR_INVALID_PARAMETER; + + ret = notification_ipc_send_event(noti, event_type); + + return ret; +} + +EXPORT_API int notification_get_event_flag(notification_h noti, bool *flag) +{ + if (noti == NULL || flag == NULL) + return NOTIFICATION_ERROR_INVALID_PARAMETER; + + *flag = noti->event_flag; + + return NOTIFICATION_ERROR_NONE; +} diff --git a/src/notification_ipc.c b/src/notification_ipc.c index 1f8d9ed5..120e3a7e 100755 --- a/src/notification_ipc.c +++ b/src/notification_ipc.c @@ -35,6 +35,7 @@ #define PROVIDER_BUS_NAME "org.tizen.data_provider_service" #define PROVIDER_OBJECT_PATH "/org/tizen/data_provider_service" #define PROVIDER_NOTI_INTERFACE_NAME "org.tizen.data_provider_noti_service" +#define PROVIDER_NOTI_EVENT_INTERFACE_NAME "org.tizen.data_provider_noti_event_service" #define DBUS_SERVICE_DBUS "org.freedesktop.DBus" #define DBUS_PATH_DBUS "/org/freedesktop/DBus" @@ -44,6 +45,7 @@ static const gchar *_bus_name = NULL; static GDBusConnection *_gdbus_conn = NULL; static int monitor_id = 0; +static int event_monitor_id = 0; static int provider_monitor_id = 0; static int is_master_started = 0; @@ -509,6 +511,88 @@ static void _handle_noti_notify(GDBusConnection *connection, } /* LCOV_EXCL_STOP */ +static void _send_event(GVariant *parameters) +{ + int ret; + int event_type; + notification_h noti; + GVariant *coupled_body; + GVariant *body; + + noti = notification_create(NOTIFICATION_TYPE_NOTI); + if (noti == NULL) { + NOTIFICATION_ERR("failed to create a notification"); + return; + } + + g_variant_get(parameters, "(vi)", &coupled_body, &event_type); + g_variant_get(coupled_body, "(v)", &body); + + ret = notification_ipc_make_noti_from_gvariant(noti, body); + g_variant_unref(coupled_body); + g_variant_unref(body); + if (ret != NOTIFICATION_ERROR_NONE) { + NOTIFICATION_ERR("failed to make notification handle from gvariant"); + return; + } + + notification_call_event_handler_cb(noti, event_type); +} + +static void _delete_event(GVariant *parameters) +{ + int priv_id; + + g_variant_get(parameters, "(i)", &priv_id); + notification_delete_event_handler_cb(priv_id); +} + +static void _handle_noti_event_handler_notify(GDBusConnection *connection, + const gchar *sender_name, + const gchar *object_path, + const gchar *interface_name, + const gchar *signal_name, + GVariant *parameters, + gpointer user_data) +{ + NOTIFICATION_DBG("own_name : %s signal_name: %s", + g_dbus_connection_get_unique_name(connection), signal_name); + + if (g_strcmp0(signal_name, "send_event") == 0) + _send_event(parameters); + else if (g_strcmp0(signal_name, "delete_noti") == 0) + _delete_event(parameters); +} + +static int _dbus_event_handler_signal_init(void) +{ + int id; + int ret = NOTIFICATION_ERROR_NONE; + + if (event_monitor_id == 0) { + id = g_dbus_connection_signal_subscribe(_gdbus_conn, + PROVIDER_BUS_NAME, + PROVIDER_NOTI_EVENT_INTERFACE_NAME, /* interface */ + NULL, /* member */ + PROVIDER_OBJECT_PATH, /* path */ + NULL, /* arg0 */ + G_DBUS_SIGNAL_FLAGS_NONE, + _handle_noti_event_handler_notify, + NULL, + NULL); + + NOTIFICATION_DBG("subscribe id : %d", id); + if (id == 0) { + ret = NOTIFICATION_ERROR_IO_ERROR; + NOTIFICATION_ERR("Failed to subscribe _dbus_event_handler_signal"); + } else { + event_monitor_id = id; + } + } + + return ret; +} + static int _dbus_signal_init() { int id; @@ -702,6 +786,7 @@ int notification_ipc_request_insert(notification_h noti, int *priv_id) { int result; int id = NOTIFICATION_PRIV_ID_NONE; + bool event_flag; GDBusMessage *reply = NULL; GVariant *body; GVariant *reply_body; @@ -712,6 +797,16 @@ int notification_ipc_request_insert(notification_h noti, int *priv_id) return result; } + result = notification_get_event_flag(noti, &event_flag); + if (result != NOTIFICATION_ERROR_NONE) + return result; + + if (event_flag == true && event_monitor_id == 0) { + result = _dbus_event_handler_signal_init(); + if (result != NOTIFICATION_ERROR_NONE) + return result; + } + /* Initialize private ID */ noti->group_id = NOTIFICATION_GROUP_ID_NONE; noti->internal_group_id = NOTIFICATION_GROUP_ID_NONE; @@ -1516,6 +1611,32 @@ int notification_ipc_get_noti_block_state(const char *pkgname, int *do_not_distu return ret; } +int notification_ipc_send_event(notification_h noti, int event_type) +{ + int ret; + GVariant *body = NULL; + GDBusMessage *reply = NULL; + + ret = _dbus_init(); + if (ret != NOTIFICATION_ERROR_NONE) { + NOTIFICATION_ERR("Can't init dbus %d", ret); + return ret; + } + + body = notification_ipc_make_gvariant_from_noti(noti, false); + if (body == NULL) { + NOTIFICATION_ERR("Can't make gvariant to noti"); + return NOTIFICATION_ERROR_OUT_OF_MEMORY; + } + + ret = _send_sync_noti(g_variant_new("(vi)", body, event_type), &reply, "send_noti_event"); + + if (reply) + g_object_unref(reply); + + return ret; +} + EXPORT_API GVariant *notification_ipc_make_gvariant_from_noti(notification_h noti, bool translate) { NOTIFICATION_DBG("make gvariant from noti"); @@ -1714,6 +1835,7 @@ EXPORT_API GVariant *notification_ipc_make_gvariant_from_noti(notification_h not g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_AUTO_REMOVE, g_variant_new_int32(noti->auto_remove)); g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_DEFAULT_BUTTON, g_variant_new_int32(noti->default_button_index)); g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_TIMEOUT, g_variant_new_int32(noti->timeout)); + g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_EVENT_FLAG, g_variant_new_int32(noti->event_flag)); g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_UID, g_variant_new_int32(noti->uid)); result_body = g_variant_builder_end(&builder); @@ -1866,6 +1988,7 @@ EXPORT_API int notification_ipc_make_noti_from_gvariant(notification_h noti, _variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_AUTO_REMOVE, "i", ¬i->auto_remove); _variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_DEFAULT_BUTTON, "i", ¬i->default_button_index); _variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_TIMEOUT, "i", ¬i->timeout); + _variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_EVENT_FLAG, "i", ¬i->event_flag); _variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_UID, "i", ¬i->uid); noti->caller_pkgname = _dup_string(caller_pkgname); @@ -2175,3 +2298,11 @@ int notification_ipc_monitor_fini(void) return _ipc_monitor_deregister(); } +void notification_ipc_event_monitor_fini(void) +{ + if (event_monitor_id == 0) + return; + + g_dbus_connection_signal_unsubscribe(_gdbus_conn, event_monitor_id); + event_monitor_id = 0; +} diff --git a/src/notification_noti.c b/src/notification_noti.c index 186bb3fa..edfeec85 100755 --- a/src/notification_noti.c +++ b/src/notification_noti.c @@ -263,7 +263,7 @@ static int _insertion_query_create(notification_h noti, char **query) "flags_for_property, flag_simmode, display_applist, " "progress_size, progress_percentage, " "ongoing_flag, ongoing_value_type, ongoing_current, ongoing_duration, " - "auto_remove, default_button_index, timeout, text_input_max_length, uid) values (" + "auto_remove, default_button_index, timeout, text_input_max_length, event_flag, uid) values (" "%d, " "%d, " "'%s', '%s', " @@ -282,7 +282,7 @@ static int _insertion_query_create(notification_h noti, char **query) "%d, '%s', %d, '%s', %d, %d, %d, %d," "%d, %d, %d, " "$progress_size, $progress_percentage, " - "%d, %d, %d, %d, %d, %d, %d, %d, %d)", + "%d, %d, %d, %d, %d, %d, %d, %d, %d, %d)", noti->type, noti->layout, NOTIFICATION_CHECK_STR(noti->caller_pkgname), @@ -323,6 +323,7 @@ static int _insertion_query_create(notification_h noti, char **query) noti->default_button_index, noti->timeout, noti->text_input_max_length, + noti->event_flag, noti->uid); /* Free decoded data */ @@ -460,7 +461,7 @@ static int _update_query_create(notification_h noti, char **query) "display_applist = %d, " "progress_size = $progress_size, progress_percentage = $progress_percentage, " "ongoing_flag = %d, ongoing_value_type = %d, ongoing_current = %d, ongoing_duration = %d, " - "auto_remove = %d, default_button_index = %d, timeout = %d, text_input_max_length = %d " + "auto_remove = %d, default_button_index = %d, timeout = %d, text_input_max_length = %d, event_flag = %d " "where priv_id = %d ", noti->type, noti->layout, @@ -494,8 +495,8 @@ static int _update_query_create(notification_h noti, char **query) noti->flags_for_property, flag_simmode, noti->display_applist, noti->ongoing_flag, noti->ongoing_value_type, noti->ongoing_current, noti->ongoing_duration, - noti->auto_remove, noti->default_button_index, - noti->timeout, noti->text_input_max_length, noti->priv_id); + noti->auto_remove, noti->default_button_index, noti->timeout, + noti->text_input_max_length, noti->event_flag, noti->priv_id); /* Free decoded data */ if (args) @@ -596,6 +597,8 @@ static void _notification_noti_populate_from_stmt(sqlite3_stmt *stmt, notificati noti->auto_remove = sqlite3_column_int(stmt, col++); noti->default_button_index = sqlite3_column_int(stmt, col++); noti->timeout = sqlite3_column_int(stmt, col++); + noti->text_input_max_length = sqlite3_column_int(stmt, col++); + noti->event_flag = sqlite3_column_int(stmt, col++); noti->app_icon_path = NULL; noti->app_name = NULL; @@ -1057,7 +1060,7 @@ EXPORT_API int notification_noti_get_by_priv_id(notification_h noti, char *pkgna "b_event_handler_click_on_icon, b_event_handler_click_on_thumbnail, " "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, " "flags_for_property, display_applist, progress_size, progress_percentage, ongoing_flag, ongoing_value_type, " - "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout, text_input_max_length " + "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout, text_input_max_length, event_flag " "from noti_list "; if (pkgname != NULL && strlen(pkgname) != 0) @@ -1128,7 +1131,7 @@ EXPORT_API int notification_noti_get_by_tag(notification_h noti, char *pkgname, "b_event_handler_click_on_icon, b_event_handler_click_on_thumbnail, " "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, " "flags_for_property, display_applist, progress_size, progress_percentage, ongoing_flag, ongoing_value_type, " - "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout, text_input_max_length " + "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout, text_input_max_length, event_flag " "from noti_list where caller_pkgname = ? and tag = ? and uid = ?", -1, &stmt, NULL); if (ret != SQLITE_OK) { NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db)); @@ -1164,7 +1167,7 @@ EXPORT_API int notification_noti_get_by_tag(notification_h noti, char *pkgname, "b_event_handler_click_on_icon, b_event_handler_click_on_thumbnail, " "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, " "flags_for_property, display_applist, progress_size, progress_percentage, ongoing_flag, ongoing_value_type, " - "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout, text_input_max_length " + "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout, text_input_max_length, event_flag " "from noti_list where tag = ? and uid = ?", -1, &stmt, NULL); if (ret != SQLITE_OK) { NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db)); @@ -1623,7 +1626,7 @@ EXPORT_API int notification_noti_get_grouping_list(notification_type_e type, "b_event_handler_click_on_icon, b_event_handler_click_on_thumbnail, " "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, " "flags_for_property, display_applist, progress_size, progress_percentage, ongoing_flag, ongoing_value_type, " - "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout, text_input_max_length " + "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout, text_input_max_length, event_flag " "from noti_list where 1 > 0 "); if (status == VCONFKEY_TELEPHONY_SIM_INSERTED) { @@ -1725,7 +1728,7 @@ EXPORT_API int notification_noti_get_detail_list(const char *pkgname, "b_event_handler_click_on_icon, b_event_handler_click_on_thumbnail, " "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, " "flags_for_property, display_applist, progress_size, progress_percentage, ongoing_flag, ongoing_value_type, " - "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout, text_input_max_length " + "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout, text_input_max_length, event_flag " "from noti_list "); if (priv_id == NOTIFICATION_PRIV_ID_NONE && group_id == NOTIFICATION_GROUP_ID_NONE) { @@ -1985,7 +1988,8 @@ static int _template_query_create(notification_h noti, char *template_name, char "b_event_handler_click_on_icon, b_event_handler_click_on_thumbnail, " "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, " "flags_for_property, flag_simmode, display_applist, progress_size, progress_percentage, ongoing_flag, ongoing_value_type, " - "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout, text_input_max_length, uid, template_name) values (" + "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout, text_input_max_length, " + "event_flag, uid, template_name) values (" "%d, " "%d, " "'%s', '%s', " @@ -2045,6 +2049,7 @@ static int _template_query_create(notification_h noti, char *template_name, char noti->default_button_index, noti->timeout, noti->text_input_max_length, + noti->event_flag, noti->uid, template_name); @@ -2210,7 +2215,7 @@ EXPORT_API int notification_noti_get_package_template(notification_h noti, char "b_event_handler_click_on_icon, b_event_handler_click_on_thumbnail, " "sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, " "flags_for_property, display_applist, progress_size, progress_percentage, ongoing_flag, ongoing_value_type, " - "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout, text_input_max_length " + "ongoing_current, ongoing_duration, auto_remove, default_button_index, timeout, text_input_max_length, event_flag " "from noti_template where caller_pkgname = ? and template_name = ?", -1, &stmt, NULL); if (ret != SQLITE_OK) { NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db)); -- 2.34.1