From f79bc716af77f514407a97f8a5168184b310e058 Mon Sep 17 00:00:00 2001 From: Seungha Son Date: Tue, 30 May 2017 19:39:49 +0900 Subject: Arrange naming of pkgid and appid Signed-off-by: Seungha Son Change-Id: I3160d8c89a581602e9b680c1922ce9bc5ad1e529 --- include/notification_group.h | 12 +- include/notification_internal.h | 46 ++++--- include/notification_ipc.h | 20 +-- include/notification_list.h | 21 +++- include/notification_noti.h | 18 +-- include/notification_ongoing.h | 6 +- include/notification_private.h | 10 +- include/notification_setting_internal.h | 12 +- include/notification_setting_service.h | 8 +- scripts/505.notification_upgrade.sh | 68 +++++++++-- src/notification.c | 101 ++++++++------- src/notification_db.c | 24 ++-- src/notification_group.c | 34 +++--- src/notification_internal.c | 210 ++++++++++++++++---------------- src/notification_ipc.c | 98 +++++++-------- src/notification_list.c | 10 +- src/notification_noti.c | 172 +++++++++++++------------- src/notification_ongoing.c | 27 ++-- src/notification_setting.c | 46 +++---- src/notification_setting_service.c | 44 +++---- 20 files changed, 531 insertions(+), 456 deletions(-) diff --git a/include/notification_group.h b/include/notification_group.h index 2075fef..27c326a 100644 --- a/include/notification_group.h +++ b/include/notification_group.h @@ -20,30 +20,30 @@ #include NOTIFICATION_DEPRECATED_API int notification_group_set_title( - const char *pkgname, int group_id, const char *title, + const char *app_id, int group_id, const char *title, const char *loc_title, notification_count_display_type_e count_display); NOTIFICATION_DEPRECATED_API int notification_group_get_title( - const char *pkgname, int group_id, char **ret_title, + const char *app_id, int group_id, char **ret_title, char **ret_loc_title, notification_count_display_type_e *count_display); NOTIFICATION_DEPRECATED_API int notification_group_set_content( - const char *pkgname, int group_id, const char *content, + const char *app_id, int group_id, const char *content, const char *loc_content, notification_count_display_type_e count_display); NOTIFICATION_DEPRECATED_API int notification_group_get_content( - const char *pkgname, int group_id, char **ret_content, + const char *app_id, int group_id, char **ret_content, char **ret_loc_content, notification_count_display_type_e *count_display); NOTIFICATION_DEPRECATED_API int notification_group_set_badge( - const char *pkgname, int group_id, int count); + const char *app_id, int group_id, int count); NOTIFICATION_DEPRECATED_API int notification_group_get_badge( - const char *pkgname, int group_id, int *count); + const char *app_id, int group_id, int *count); #endif /* __NOTIFICATION_GROUP_H__ */ diff --git a/include/notification_internal.h b/include/notification_internal.h index d63174c..4de273e 100755 --- a/include/notification_internal.h +++ b/include/notification_internal.h @@ -255,14 +255,14 @@ NOTIFICATION_DEPRECATED_API int notification_get_content(notification_h noti, * @see notification_set_execute_option() * */ -NOTIFICATION_DEPRECATED_API int notification_set_application(notification_h noti, const char *pkgname); /* Do not use this */ +NOTIFICATION_DEPRECATED_API int notification_set_application(notification_h noti, const char *app_id); /* Do not use this */ /** * @brief This function will be removed. * @see notification_get_execute_option() * */ -NOTIFICATION_DEPRECATED_API int notification_get_application(notification_h noti, char **pkgname); /* Do not use this */ +NOTIFICATION_DEPRECATED_API int notification_get_application(notification_h noti, char **app_id); /* Do not use this */ /** * @brief This function will be deprecated. @@ -292,7 +292,7 @@ NOTIFICATION_DEPRECATED_API int notification_get_grouping_list(notification_type * @see notification_delete_by_priv_id() * */ -NOTIFICATION_DEPRECATED_API int notification_delete_group_by_group_id(const char *pkgname, +NOTIFICATION_DEPRECATED_API int notification_delete_group_by_group_id(const char *app_id, notification_type_e type, int group_id); @@ -301,7 +301,7 @@ NOTIFICATION_DEPRECATED_API int notification_delete_group_by_group_id(const char * @see notification_delete_by_priv_id() * */ -NOTIFICATION_DEPRECATED_API int notification_delete_group_by_priv_id(const char *pkgname, +NOTIFICATION_DEPRECATED_API int notification_delete_group_by_priv_id(const char *app_id, notification_type_e type, int priv_id); /** @@ -309,7 +309,7 @@ NOTIFICATION_DEPRECATED_API int notification_delete_group_by_priv_id(const char * */ NOTIFICATION_DEPRECATED_API int notification_get_count(notification_type_e type, - const char *pkgname, + const char *app_id, int group_id, int priv_id, int *count); @@ -365,12 +365,19 @@ NOTIFICATION_DEPRECATED_API int notification_op_get_data(notification_op *noti_o notification_op_data_type_e type, void *data); + /** - * @internal * @brief This function will be deprecated. - * @details Caller_pkgname is set automatically when notification_new() is called. We do not recommend to use this API. + * @see notification_set_app_id() + */ +NOTIFICATION_DEPRECATED_API int notification_set_pkgname(notification_h noti, + const char *pkgname); + +/** + * @internal + * @details caller_app_id is set automatically when notification_create() is called. We do not recommend to use this API. * @param[in] noti Notification handle - * @param[in] pkgname Caller package name + * @param[in] app_id Caller application id * @return NOTIFICATION_ERROR_NONE on success, other value on failure * @retval NOTIFICATION_ERROR_NONE Success * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value @@ -382,12 +389,12 @@ NOTIFICATION_DEPRECATED_API int notification_op_get_data(notification_op *noti_o notification_h noti = NULL; int noti_err = NOTIFICATION_ERROR_NONE; - noti = notification_new(NOTIFICATION_TYPE_NOTI, APP_GROUP_ID, NOTIFICATION_PRIV_ID_NONE); + noti = notification_create(NOTIFICATION_TYPE_NOTI); if (noti == NULL) { return; } - noti_err = notification_set_pkgname(noti, "org.tizen.phone"); + noti_err = notification_set_app_id(noti, "org.tizen.phone"); if (noti_err != NOTIFICATION_ERROR_NONE) { notification_free(noti); return; @@ -395,14 +402,13 @@ NOTIFICATION_DEPRECATED_API int notification_op_get_data(notification_op *noti_o } * @endcode */ -NOTIFICATION_DEPRECATED_API int notification_set_pkgname(notification_h noti, - const char *pkgname); +int notification_set_app_id(notification_h noti, const char *app_id); /** * @internal * @brief This function will be deprecated. - * @details If @a pkgname is NULL, caller_pkgname is set internally. - * @param[in] pkgname Caller application package name or NULL + * @details If @a app_id is NULL, caller_app_id is set internally. + * @param[in] app_id Caller application ID or NULL * @param[in] type Notification type * @return NOTIFICATION_ERROR_NONE if success, other value if failure * @retval NOTIFICATION_ERROR_NONE Success @@ -421,14 +427,14 @@ NOTIFICATION_DEPRECATED_API int notification_set_pkgname(notification_h noti, } * @endcode */ -NOTIFICATION_DEPRECATED_API int notification_delete_all_by_type(const char *pkgname, +NOTIFICATION_DEPRECATED_API int notification_delete_all_by_type(const char *app_id, notification_type_e type); /** * @internal * @brief This function will be deprecated. - * @details If @a pkgname is NULL, caller_pkgname is set internally. - * @param[in] pkgname Caller application package name or NULL + * @details If @a app_id is NULL, caller_app_id is set internally. + * @param[in] app_id Caller application ID or NULL * @param[in] type Notification type * @param[in] priv_id Priv ID * @return NOTIFICATION_ERROR_NONE if success, other value if failure @@ -448,7 +454,7 @@ NOTIFICATION_DEPRECATED_API int notification_delete_all_by_type(const char *pkgn } * @endcode */ -NOTIFICATION_DEPRECATED_API int notification_delete_by_priv_id(const char *pkgname, +NOTIFICATION_DEPRECATED_API int notification_delete_by_priv_id(const char *app_id, notification_type_e type, int priv_id); @@ -560,7 +566,7 @@ int notification_set_priv_id(notification_h noti, int priv_id); } * @endcode */ -NOTIFICATION_DEPRECATED_API notification_h notification_load(char *pkgname, +NOTIFICATION_DEPRECATED_API notification_h notification_load(char *app_id, int priv_id); /** @@ -1327,7 +1333,7 @@ int notification_update_for_uid(notification_h noti, uid_t uid); int notification_delete_for_uid(notification_h noti, uid_t uid); int notification_delete_all_for_uid(notification_type_e type, uid_t uid); notification_h notification_load_by_tag_for_uid(const char *tag, uid_t uid); -notification_h notification_create_from_package_template(const char *pkgname, +notification_h notification_create_from_package_template(const char *app_id, const char *template_name); /** * @brief Gets a max length of text input. diff --git a/include/notification_ipc.h b/include/notification_ipc.h index bfb054f..39227f1 100755 --- a/include/notification_ipc.h +++ b/include/notification_ipc.h @@ -60,35 +60,35 @@ int notification_ipc_request_update_async(notification_h noti, void *user_data); int notification_ipc_request_refresh(uid_t uid); int notification_ipc_request_delete_multiple(notification_type_e type, - char *pkgname, uid_t uid); + char *app_id, uid_t uid); int notification_ipc_request_delete_single(notification_type_e type, - char *pkgname, int priv_id, uid_t uid); + char *app_id, int priv_id, uid_t uid); int notification_ipc_update_setting(notification_setting_h setting, uid_t uid); int notification_ipc_update_system_setting( notification_system_setting_h system_setting, uid_t uid); int notification_ipc_request_load_noti_by_tag(notification_h noti, - const char *pkgname, const char *tag, uid_t uid); + const char *app_id, const char *tag, uid_t uid); int notification_ipc_request_load_noti_grouping_list(notification_type_e type, int count, notification_list_h *list, uid_t uid); int notification_ipc_request_get_setting_array( notification_setting_h *setting_array, int *count, uid_t uid); -int notification_ipc_request_get_setting_by_appid( - const char *appid, notification_setting_h *setting, uid_t uid); +int notification_ipc_request_get_setting_by_app_id( + const char *app_id, notification_setting_h *setting, uid_t uid); int notification_ipc_request_load_system_setting( notification_system_setting_h *setting, uid_t uid); int notification_ipc_request_get_count(notification_type_e type, - const char *pkgname, int group_id, int priv_id, int *count, uid_t uid); + const char *app_id, int group_id, int priv_id, int *count, uid_t uid); int notification_ipc_request_load_noti_by_priv_id(notification_h noti, - const char *pkgname, int priv_id, uid_t uid); -int notification_ipc_request_load_noti_detail_list(const char *pkgname, + const char *app_id, int priv_id, uid_t uid); +int notification_ipc_request_load_noti_detail_list(const char *app_id, int group_id, int priv_id, int count, notification_list_h *list, uid_t uid); int notification_ipc_request_save_as_template(notification_h noti, const char *template_name); int notification_ipc_request_create_from_template(notification_h noti, const char *template_name); int notification_ipc_request_create_from_package_template(notification_h noti, - const char *pkgname, const char *template_name); -int notification_ipc_get_noti_block_state(const char *pkgname, int *do_not_disturb, int *do_not_disturb_except, + const char *app_id, const char *template_name); +int notification_ipc_get_noti_block_state(const char *app_id, int *do_not_disturb, int *do_not_disturb_except, int *allow_to_notify, uid_t uid); GVariant *notification_ipc_make_gvariant_from_dnd_allow_exception( struct notification_system_setting_dnd_allow_exception *dnd_allow_exception); diff --git a/include/notification_list.h b/include/notification_list.h index a50f1ed..ef01d26 100644 --- a/include/notification_list.h +++ b/include/notification_list.h @@ -43,6 +43,7 @@ typedef struct _notification_list *notification_list_h; /** + * @internal * @brief Returns the notification list handle. * @details If count is equal to @c -1, all notifications are returned. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif @@ -81,12 +82,13 @@ int notification_get_list_for_uid(notification_type_e type, notification_list_h *list, uid_t uid); /** + * @internal * @brief Returns the notification detail list handle of grouping data. * @details If count is equal to c -1, all notifications are returned. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/notification - * @param[in] pkgname The caller application package name + * @param[in] app_id The caller application ID * @param[in] group_id The group ID * @param[in] priv_id The private ID * @param[in] count The returned notification data number @@ -105,20 +107,20 @@ int notification_get_list_for_uid(notification_type_e type, notification_list_h noti_list = NULL; int noti_err = NOTIFICATION_ERROR_NONE; - noti_err = notification_get_detail_list(pkgname, group_id, priv_id, -1, ¬i_list); + noti_err = notification_get_detail_list(app_id, group_id, priv_id, -1, ¬i_list); if (noti_err != NOTIFICATION_ERROR_NONE) { return; } } * @endcode */ -int notification_get_detail_list(const char *pkgname, +int notification_get_detail_list(const char *app_id, int group_id, int priv_id, int count, notification_list_h *list); -int notification_get_detail_list_for_uid(const char *pkgname, +int notification_get_detail_list_for_uid(const char *app_id, int group_id, int priv_id, int count, @@ -126,6 +128,7 @@ int notification_get_detail_list_for_uid(const char *pkgname, uid_t uid); /** + * @internal * @brief Frees a notification list. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public @@ -159,6 +162,7 @@ int notification_free_list(notification_list_h list); /** + * @internal * @brief Gets the head pointer of the notification list. * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. @@ -189,6 +193,7 @@ int notification_free_list(notification_list_h list); notification_list_h notification_list_get_head(notification_list_h list); /** + * @internal * @brief Gets the tail pointer to the notification list. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. @@ -219,6 +224,7 @@ notification_list_h notification_list_get_head(notification_list_h list); notification_list_h notification_list_get_tail(notification_list_h list); /** + * @internal * @brief Gets the previous pointer of the current notification list. * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. @@ -249,6 +255,7 @@ notification_list_h notification_list_get_tail(notification_list_h list); notification_list_h notification_list_get_prev(notification_list_h list); /** + * @internal * @brief Gets the next pointer of the current notification list. * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. @@ -279,6 +286,7 @@ notification_list_h notification_list_get_prev(notification_list_h list); notification_list_h notification_list_get_next(notification_list_h list); /** + * @internal * @brief Gets the notification handle that the list has. * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. @@ -312,6 +320,7 @@ notification_h notification_list_get_data(notification_list_h list); /** + * @internal * @brief Gets a number of the notification list. * @since_tizen 3.0 * @param[in] list Notification list handle @@ -329,7 +338,7 @@ include notification_list_h noti_list = NULL; int noti_err = NOTIFICATION_ERROR_NONE; - noti_err = notification_get_detail_list(pkgname, group_id, priv_id, -1, ¬i_list); + noti_err = notification_get_detail_list(app_id, group_id, priv_id, -1, ¬i_list); if (noti_err != NOTIFICATION_ERROR_NONE) { return; } @@ -341,6 +350,7 @@ include int notification_list_get_count(notification_list_h list); /** + * @internal * @brief Appends notification data to the notification list. * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. @@ -376,6 +386,7 @@ notification_list_h notification_list_append(notification_list_h list, notification_h noti); /** + * @internal * @brief Removes notification data from the notification list. * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. diff --git a/include/notification_noti.h b/include/notification_noti.h index 3e56877..6dcb3b1 100644 --- a/include/notification_noti.h +++ b/include/notification_noti.h @@ -36,16 +36,18 @@ int notification_noti_insert(notification_h noti); int notification_noti_update(notification_h noti); -int notification_noti_delete_all(notification_type_e type, const char *pkgname, int *num_deleted, int **list_deleted_rowid, uid_t uid); +int notification_noti_delete_all(notification_type_e type, const char *app_id, + int *num_deleted, int **list_deleted_rowid, uid_t uid); int notification_noti_get_by_priv_id(notification_h noti, int priv_id); -int notification_noti_get_by_tag(notification_h noti, char *pkgname, char* tag, uid_t uid); +int notification_noti_get_by_tag(notification_h noti, char *app_id, char* tag, uid_t uid); -int notification_noti_delete_by_priv_id(const char *pkgname, int priv_id); -int notification_noti_delete_by_priv_id_get_changes(const char *pkgname, int priv_id, int *num_changes, uid_t uid); +int notification_noti_delete_by_priv_id(const char *app_id, int priv_id); +int notification_noti_delete_by_priv_id_get_changes(const char *app_id, int priv_id, + int *num_changes, uid_t uid); int notification_noti_get_count(notification_type_e type, - const char *pkgname, + const char *app_id, int group_id, int priv_id, int *count, uid_t uid); @@ -54,7 +56,7 @@ int notification_noti_get_grouping_list(notification_type_e type, notification_list_h *list, uid_t uid); -int notification_noti_get_detail_list(const char *pkgname, +int notification_noti_get_detail_list(const char *app_id, int group_id, int priv_id, int count, notification_list_h *list, @@ -64,8 +66,8 @@ int notification_noti_check_tag(notification_h noti); int notification_noti_check_count_for_template(notification_h noti, int *count); int notification_noti_add_template(notification_h noti, char *template_name); -int notification_noti_get_package_template(notification_h noti, char *pkgname, char *template_name); -int notification_noti_delete_template(const char *pkgname); +int notification_noti_get_package_template(notification_h noti, char *app_id, char *template_name); +int notification_noti_delete_template(const char *pkg_id); int notification_get_default_viewer(const char *path, char **default_viewer); int notification_launch_default_viewer(const char *default_viewer, int priv_id); diff --git a/include/notification_ongoing.h b/include/notification_ongoing.h index d6c4867..e2014ba 100644 --- a/include/notification_ongoing.h +++ b/include/notification_ongoing.h @@ -74,14 +74,14 @@ int notification_ongoing_update_cb_set(notification_ongoing_update_cb callback, */ int notification_ongoing_update_cb_unset(void); -int notification_ongoing_update_progress(const char *caller_pkgname, +int notification_ongoing_update_progress(const char *caller_app_id, int priv_id, double progress); -int notification_ongoing_update_size(const char *caller_pkgname, +int notification_ongoing_update_size(const char *caller_app_id, int priv_id, double size); -int notification_ongoing_update_content(const char *caller_pkgname, +int notification_ongoing_update_content(const char *caller_app_id, int priv_id, const char *content); /** diff --git a/include/notification_private.h b/include/notification_private.h index d17d878..44cd62f 100644 --- a/include/notification_private.h +++ b/include/notification_private.h @@ -45,8 +45,8 @@ struct _notification { int priv_id; /* Private ID */ char *pkg_id; - char *caller_pkgname; /* Caller App package name */ - char *launch_pkgname; /* Launch App package name. It will be from appsvc_set_pkgname */ + char *caller_app_id; /* Caller App ID */ + char *launch_app_id; /* Launch App ID */ bundle *args; /* Will be removed. */ bundle *group_args; /* Will be removed. */ @@ -112,8 +112,8 @@ typedef enum notification_data_type { NOTIFICATION_DATA_TYPE_INTERNAL_GROUP_ID, NOTIFICATION_DATA_TYPE_PRIV_ID, NOTIFICATION_DATA_TYPE_PKG_ID, - NOTIFICATION_DATA_TYPE_CALLER_PKGNAME, - NOTIFICATION_DATA_TYPE_LAUNCH_PKGNAME, + NOTIFICATION_DATA_TYPE_CALLER_APP_ID, + NOTIFICATION_DATA_TYPE_LAUNCH_APP_ID, NOTIFICATION_DATA_TYPE_ARGS, NOTIFICATION_DATA_TYPE_GROUP_ARGS, NOTIFICATION_DATA_TYPE_EXECUTE_OPTION, @@ -174,7 +174,7 @@ void notification_call_changed_cb_for_uid(notification_op *op_list, int op_num, 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); +char *notification_get_app_id_by_pid(void); #endif /* __NOTIFICATION_PRIVATE_H__ */ diff --git a/include/notification_setting_internal.h b/include/notification_setting_internal.h index f359559..5a38fc6 100644 --- a/include/notification_setting_internal.h +++ b/include/notification_setting_internal.h @@ -90,7 +90,7 @@ typedef enum notification_dnd_allowed_calls { /* Application setting */ struct notification_setting { char *package_name; - char *appid; + char *app_id; bool allow_to_notify; bool do_not_disturb_except; bool pop_up_notification; @@ -196,7 +196,7 @@ int notification_setting_get_setting_array_for_uid(notification_setting_h *setti * @endcode */ int notification_setting_get_setting_by_package_name(const char *package_name, notification_setting_h *setting); -int notification_setting_get_setting_by_appid_for_uid(const char *package_name, notification_setting_h *setting, uid_t uid); +int notification_setting_get_setting_by_appid_for_uid(const char *app_id, notification_setting_h *setting, uid_t uid); /* * @internal @@ -239,7 +239,7 @@ int notification_setting_get_package_name(notification_setting_h setting, char * * @brief Gets application id from notification setting handle. * @since_tizen 3.0 * @param[in] setting The notification setting handle - * @param[out] appid The application id + * @param[out] app_id The application id * @return #NOTIFICATION_ERROR_NONE on success, * otherwise any other value on failure * @retval #NOTIFICATION_ERROR_NONE Success @@ -251,12 +251,12 @@ int notification_setting_get_package_name(notification_setting_h setting, char * ... { int noti_err = 0; - char *appid = NULL; + char *app_id = NULL; notification_setting_h setting = NULL; ... - noti_err = notification_setting_get_appid(setting, &appid); + noti_err = notification_setting_get_appid(setting, &app_id); if (noti_err != NOTIFICATION_ERROR_NONE) { return; } @@ -268,7 +268,7 @@ int notification_setting_get_package_name(notification_setting_h setting, char * } * @endcode */ -int notification_setting_get_appid(notification_setting_h setting, char **appid); +int notification_setting_get_appid(notification_setting_h setting, char **app_id); /* * @internal diff --git a/include/notification_setting_service.h b/include/notification_setting_service.h index 4acc875..d948808 100644 --- a/include/notification_setting_service.h +++ b/include/notification_setting_service.h @@ -27,7 +27,7 @@ extern "C" { 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, const char *appid, int allow_to_notify, int do_not_disturb_except, int visibility_class, +int notification_setting_db_update(const char *package_name, const char *app_id, 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, @@ -36,15 +36,15 @@ int notification_setting_db_update_system_setting(int do_not_disturb, int visibi 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_appid(const char *appid, notification_setting_h *setting, uid_t uid); +int noti_setting_service_get_setting_by_app_id(const char *app_id, notification_setting_h *setting, uid_t uid); int noti_setting_get_setting_array(notification_setting_h *setting_array, int *count, uid_t uid); int noti_system_setting_load_system_setting(notification_system_setting_h *system_setting, uid_t uid); int noti_system_setting_get_do_not_disturb(int *do_not_disturb, uid_t uid); int notification_system_setting_get_dnd_schedule_enabled_uid(uid_t **uids, int *count); -int notification_get_dnd_and_allow_to_notify(const char *appid, int *do_not_disturb, int *do_not_disturb_except, int *allow_to_notify, uid_t uid); +int notification_get_dnd_and_allow_to_notify(const char *app_id, int *do_not_disturb, int *do_not_disturb_except, int *allow_to_notify, uid_t uid); int notification_system_setting_load_dnd_allow_exception(dnd_allow_exception_h *dnd_allow_exception, int *count, uid_t uid); int notification_system_setting_update_dnd_allow_exception(int type, int value, uid_t uid); -int notification_setting_db_update_app_disabled(const char *appid, bool value, uid_t uid); +int notification_setting_db_update_app_disabled(const char *app_id, bool value, uid_t uid); #ifdef __cplusplus } #endif diff --git a/scripts/505.notification_upgrade.sh b/scripts/505.notification_upgrade.sh index d75cb2c..3e39a22 100644 --- a/scripts/505.notification_upgrade.sh +++ b/scripts/505.notification_upgrade.sh @@ -16,8 +16,8 @@ DROP TABLE IF EXISTS noti_list_temp; CREATE TABLE noti_list_temp ( type INTEGER NOT NULL, layout INTEGER NOT NULL default 0, - caller_pkgname TEXT NOT NULL, - launch_pkgname TEXT, + caller_app_id TEXT NOT NULL, + launch_app_id TEXT, image_path TEXT, group_id INTEGER default 0, internal_group_id INTEGER default 0, @@ -69,24 +69,75 @@ CREATE TABLE noti_list_temp ( extension_image_size INTEGER default 0, uid INTEGER ); -INSERT INTO noti_list_temp (type, layout, caller_pkgname, launch_pkgname, image_path, group_id, internal_group_id, priv_id, title_key, b_text, b_key, tag, b_format_args, num_format_args, text_domain, text_dir, time, insert_time, args, group_args, b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, b_event_handler_click_on_button_1, b_event_handler_click_on_button_2, b_event_handler_click_on_button_3, b_event_handler_click_on_button_4, b_event_handler_click_on_button_5, b_event_handler_click_on_button_6, 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, auto_remove) \ +INSERT INTO noti_list_temp (type, layout, caller_app_id, launch_app_id, image_path, group_id, internal_group_id, priv_id, title_key, b_text, b_key, tag, b_format_args, num_format_args, text_domain, text_dir, time, insert_time, args, group_args, b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, b_event_handler_click_on_button_1, b_event_handler_click_on_button_2, b_event_handler_click_on_button_3, b_event_handler_click_on_button_4, b_event_handler_click_on_button_5, b_event_handler_click_on_button_6, 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, auto_remove) \ SELECT type, layout, caller_pkgname, launch_pkgname, image_path, group_id, internal_group_id, priv_id, title_key, b_text, b_key, tag, b_format_args, num_format_args, text_domain, text_dir, time, insert_time, args, group_args, b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, b_event_handler_click_on_button_1, b_event_handler_click_on_button_2, b_event_handler_click_on_button_3, b_event_handler_click_on_button_4, b_event_handler_click_on_button_5, b_event_handler_click_on_button_6, 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, auto_remove FROM noti_list; UPDATE noti_list_temp SET uid=5001; DROP TABLE noti_list; ALTER TABLE noti_list_temp RENAME TO noti_list; + +DROP TABLE IF EXISTS noti_group_data_temp; +CREATE TABLE noti_group_data_temp ( + caller_app_id TEXT NOT NULL, + group_id INTEGER default 0, + badge INTEGER default 0, + title TEXT, + content TEXT, + loc_title TEXT, + loc_content TEXT, + count_display_title INTEGER, + count_display_content INTEGER, + rowid INTEGER PRIMARY KEY AUTOINCREMENT, + UNIQUE (caller_app_id, group_id) +); +INSERT INTO noti_group_data_temp (caller_app_id, group_id, badge, title, content, loc_title, loc_content, count_display_title, count_display_content, rowid) \ +SELECT caller_pkgname, group_id, badge, title, content, loc_title, loc_content, count_display_title, count_display_content, rowid FROM noti_group_data; +DROP TABLE noti_group_data; +ALTER TABLE noti_group_data_temp RENAME TO noti_group_data; + + +DROP TABLE IF EXISTS ongoing_list_temp; +CREATE TABLE ongoing_list_temp ( + caller_app_id TEXT NOT NULL, + launch_app_id TEXT, + icon_path TEXT, + group_id INTEGER default 0, + internal_group_id INTEGER default 0, + priv_id INTERGER NOT NULL, + title TEXT, + content TEXT, + default_content TEXT, + loc_title TEXT, + loc_content TEXT, + loc_default_content TEXT, + text_domain TEXT, + text_dir TEXT, + args TEXT, + group_args TEXT, + flag INTEGER default 0, + progress_size DOUBLE default 0, + progress_percentage DOUBLE default 0, + rowid INTEGER PRIMARY KEY AUTOINCREMENT, + UNIQUE (caller_app_id, priv_id) +); +INSERT INFO ongoing_list_temp (caller_app_id, launch_app_id, icon_path, group_id, internal_group_id, priv_id, title, content, default_content, loc_title, loc_content, loc_default_content, text_domain, text_dir, args, group_args, flag, progress_size, progress_percentage, rowid) \ +SELECT caller_pkgname, launch_pkgname, icon_path, group_id, internal_group_id, priv_id, title, content, default_content, loc_title, loc_content, loc_default_content, text_domain, text_dir, args, group_args, flag, progress_size, progress_percentage, rowid FROM ongoing_list; +DROP_TABLE ongoing_list; +ALTER TABLE ongoing_list_temp RENAME TO ongoing_list; + + DROP TABLE IF EXISTS notification_setting; CREATE TABLE notification_setting ( uid INTEGER, package_name TEXT NOT NULL, - appid TEXT NOT NULL, + app_id TEXT NOT NULL, 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, app_disabled INTEGER DEFAULT 0, - UNIQUE (uid, package_name, appid) + UNIQUE (uid, package_name, app_id) ); @@ -110,12 +161,13 @@ UPDATE notification_system_setting_temp SET uid=5001; DROP TABLE notification_system_setting; ALTER TABLE notification_system_setting_temp RENAME TO notification_system_setting; + DROP TABLE IF EXISTS noti_template; CREATE TABLE noti_template ( type INTEGER NOT NULL, layout INTEGER NOT NULL default 0, - caller_pkgname TEXT NOT NULL, - launch_pkgname TEXT, + caller_app_id TEXT NOT NULL, + launch_app_id TEXT, image_path TEXT, group_id INTEGER default 0, internal_group_id INTEGER default 0, @@ -167,7 +219,7 @@ CREATE TABLE noti_template ( extension_image_size INTEGER default 0, uid INTEGER, template_name TEXT, - UNIQUE (caller_pkgname, template_name) + UNIQUE (caller_app_id, template_name) ); EOF diff --git a/src/notification.c b/src/notification.c index cfaa915..0ce1e28 100755 --- a/src/notification.c +++ b/src/notification.c @@ -42,21 +42,19 @@ static void (*posted_toast_message_cb)(void *data); #define NOTI_TEXT_RESULT_LEN 2048 -#define NOTI_PKGNAME_LEN 512 - #define REGULAR_UID_MIN 5000 -char *notification_get_pkgname_by_pid(void) +char *notification_get_app_id_by_pid(void) { - char pkgname[NOTI_PKGNAME_LEN + 1] = { 0, }; +#define NOTI_APP_ID_LEN 512 + char app_id[NOTI_APP_ID_LEN + 1] = { 0, }; int pid = 0, ret = AUL_R_OK; int fd; - char *dup_pkgname; - char buf[NOTI_PKGNAME_LEN + 1] = { 0, }; + char *dup_app_id; + char buf[NOTI_APP_ID_LEN + 1] = { 0, }; pid = getpid(); - - ret = aul_app_get_pkgname_bypid(pid, pkgname, sizeof(pkgname)); + ret = aul_app_get_appid_bypid(pid, app_id, sizeof(app_id)); if (ret != AUL_R_OK) { snprintf(buf, sizeof(buf), "/proc/%d/cmdline", pid); @@ -65,28 +63,28 @@ char *notification_get_pkgname_by_pid(void) if (fd < 0) return NULL; - ret = read(fd, pkgname, sizeof(pkgname) - 1); + ret = read(fd, app_id, sizeof(app_id) - 1); close(fd); if (ret <= 0) return NULL; - pkgname[ret] = '\0'; + app_id[ret] = '\0'; /*! * \NOTE - * "ret" is not able to be larger than "sizeof(pkgname) - 1", + * "ret" is not able to be larger than "sizeof(app_id) - 1", * if the system is not going wrong. */ } else { - if (strlen(pkgname) <= 0) + if (strlen(app_id) <= 0) return NULL; } - dup_pkgname = strdup(pkgname); - if (!dup_pkgname) + dup_app_id = strdup(app_id); + if (!dup_app_id) NOTIFICATION_ERR("Heap: %d\n", errno); - return dup_pkgname; + return dup_app_id; } EXPORT_API int notification_set_image(notification_h noti, @@ -160,7 +158,7 @@ EXPORT_API int notification_get_image(notification_h noti, } /* If image path is NULL and type is ICON, icon path set from AIL */ - /* order : user icon -> launch_pkgname icon -> caller_pkgname icon -> service app icon */ + /* order : user icon -> launch_app_id icon -> caller_app_id icon -> service app icon */ if (*image_path == NULL && type == NOTIFICATION_IMAGE_TYPE_ICON) { if (noti->app_icon_path != NULL) *image_path = noti->app_icon_path; @@ -523,7 +521,7 @@ EXPORT_API int notification_get_text(notification_h noti, if (ret_variable_int == NOTIFICATION_COUNT_POS_LEFT) { notification_get_count(noti->type, - noti->caller_pkgname, + noti->caller_app_id, noti->group_id, noti->priv_id, &ret_variable_int); @@ -564,7 +562,7 @@ EXPORT_API int notification_get_text(notification_h noti, NOTIFICATION_VARIABLE_TYPE_COUNT) { /* Get notification count */ notification_get_count(noti->type, - noti->caller_pkgname, + noti->caller_app_id, noti->group_id, noti->priv_id, &ret_variable_int); @@ -660,7 +658,7 @@ EXPORT_API int notification_get_text(notification_h noti, NOTIFICATION_VARIABLE_TYPE_COUNT) { /* Get notification count */ notification_get_count(noti->type, - noti->caller_pkgname, + noti->caller_app_id, noti->group_id, noti->priv_id, &ret_variable_int); @@ -757,7 +755,7 @@ EXPORT_API int notification_get_text(notification_h noti, if (ret_variable_int == NOTIFICATION_COUNT_POS_RIGHT) { notification_get_count(noti->type, - noti->caller_pkgname, + noti->caller_app_id, noti->group_id, noti->priv_id, &ret_variable_int); @@ -1326,8 +1324,8 @@ EXPORT_API int notification_get_pkgname(notification_h noti, if (noti == NULL || pkgname == NULL) return NOTIFICATION_ERROR_INVALID_PARAMETER; - if (noti->caller_pkgname) - *pkgname = noti->caller_pkgname; + if (noti->caller_app_id) + *pkgname = noti->caller_app_id; else *pkgname = NULL; @@ -1387,15 +1385,15 @@ EXPORT_API int notification_delete(notification_h noti) return notification_delete_for_uid(noti, getuid()); } -static int _notification_get_app_name(const char *appid, char **name) +static int _notification_get_app_name(const char *app_id, char **name) { char *name_token = NULL; - if (appid == NULL) + if (app_id == NULL) return -1; /* com.vendor.name -> name */ - name_token = strrchr(appid, '.'); + name_token = strrchr(app_id, '.'); if (name_token == NULL) return -1; @@ -1410,12 +1408,13 @@ static int _notification_get_app_name(const char *appid, char **name) static notification_h _notification_create(notification_type_e type) { +#define NOTI_PKG_ID_LEN 512 notification_h noti = NULL; package_info_h package_info = NULL; char *domain_name = NULL; char *app_root_path = NULL; char locale_directory[PATH_MAX] = { 0, }; /* PATH_MAX 4096 */ - char pkgid[NOTI_PKGNAME_LEN + 1] = { 0, }; + char pkg_id[NOTI_PKG_ID_LEN + 1] = { 0, }; int err; if (type <= NOTIFICATION_TYPE_NONE || type > NOTIFICATION_TYPE_MAX) { @@ -1447,33 +1446,33 @@ static notification_h _notification_create(notification_type_e type) NOTIFICATION_DISPLAY_APP_TICKER | NOTIFICATION_DISPLAY_APP_INDICATOR; noti->auto_remove = true; - noti->caller_pkgname = notification_get_pkgname_by_pid(); - if (noti->caller_pkgname == NULL) { - NOTIFICATION_ERR("get_pkgname_by_pid is failed"); + noti->caller_app_id = notification_get_app_id_by_pid(); + if (noti->caller_app_id == NULL) { + NOTIFICATION_ERR("get_app_id_by_pid is failed"); goto out; } if (getuid() < REGULAR_UID_MIN) { - noti->pkg_id = strdup(noti->caller_pkgname); + noti->pkg_id = strdup(noti->caller_app_id); } else { - err = aul_app_get_pkgid_bypid(getpid(), pkgid, sizeof(pkgid)); + err = aul_app_get_pkgid_bypid(getpid(), pkg_id, sizeof(pkg_id)); if (err != AUL_R_OK) { NOTIFICATION_ERR("get_pkgid_bypid is failed err[%d]", err); goto out; } - noti->pkg_id = strdup(pkgid); + noti->pkg_id = strdup(pkg_id); - err = _notification_get_app_name(pkgid, &domain_name); + err = _notification_get_app_name(pkg_id, &domain_name); if (err != 0 || domain_name == NULL) { NOTIFICATION_WARN("_notification_get_app_name failed err[%d] domain_name[%p]", err, domain_name); goto out; } - err = package_info_create(pkgid, &package_info); + err = package_info_create(pkg_id, &package_info); if (err != PACKAGE_MANAGER_ERROR_NONE || package_info == NULL) { - NOTIFICATION_WARN("package_info_create failed err[%d] package_info[%p] pkgid[%s]", - err, package_info, pkgid); + NOTIFICATION_WARN("package_info_create failed err[%d] package_info[%p] pkg_id[%s]", + err, package_info, pkg_id); goto out; } @@ -1543,11 +1542,11 @@ EXPORT_API int notification_clone(notification_h noti, notification_h *clone) if (noti->pkg_id != NULL) new_noti->pkg_id = strdup(noti->pkg_id); - if (noti->caller_pkgname != NULL) - new_noti->caller_pkgname = strdup(noti->caller_pkgname); + if (noti->caller_app_id != NULL) + new_noti->caller_app_id = strdup(noti->caller_app_id); - if (noti->launch_pkgname != NULL) - new_noti->launch_pkgname = strdup(noti->launch_pkgname); + if (noti->launch_app_id != NULL) + new_noti->launch_app_id = strdup(noti->launch_app_id); if (noti->args != NULL) new_noti->args = bundle_dup(noti->args); @@ -1644,11 +1643,11 @@ EXPORT_API int notification_free(notification_h noti) if (noti->pkg_id) free(noti->pkg_id); - if (noti->caller_pkgname) - free(noti->caller_pkgname); + if (noti->caller_app_id) + free(noti->caller_app_id); - if (noti->launch_pkgname) - free(noti->launch_pkgname); + if (noti->launch_app_id) + free(noti->launch_app_id); if (noti->args) bundle_free(noti->args); @@ -1852,7 +1851,7 @@ EXPORT_API notification_h notification_create_from_template(const char *template EXPORT_API int notification_get_noti_block_state(notification_block_state_e *state) { int ret; - char *pkgname; + char *app_id; int do_not_disturb; int do_not_disturb_except; int allow_to_notify; @@ -1860,13 +1859,13 @@ EXPORT_API int notification_get_noti_block_state(notification_block_state_e *sta if (state == NULL) return NOTIFICATION_ERROR_INVALID_PARAMETER; - pkgname = notification_get_pkgname_by_pid(); + app_id = notification_get_app_id_by_pid(); - ret = notification_ipc_get_noti_block_state(pkgname, &do_not_disturb, &do_not_disturb_except, &allow_to_notify, getuid()); + ret = notification_ipc_get_noti_block_state(app_id, &do_not_disturb, &do_not_disturb_except, &allow_to_notify, getuid()); if (ret != NOTIFICATION_ERROR_NONE) { - if (pkgname) - free(pkgname); + if (app_id) + free(app_id); return ret; } @@ -1878,8 +1877,8 @@ EXPORT_API int notification_get_noti_block_state(notification_block_state_e *sta *state = NOTIFICATION_BLOCK_STATE_BLOCKED; } - if (pkgname) - free(pkgname); + if (app_id) + free(app_id); return ret; } diff --git a/src/notification_db.c b/src/notification_db.c index d5bee4d..2bd1dda 100755 --- a/src/notification_db.c +++ b/src/notification_db.c @@ -36,8 +36,8 @@ create table if not exists noti_list ( \ type INTEGER NOT NULL, \ layout INTEGER NOT NULL default 0, \ pkg_id TEXT NOT NULL, \ - caller_pkgname TEXT NOT NULL, \ - launch_pkgname TEXT, \ + caller_app_id TEXT NOT NULL, \ + launch_app_id TEXT, \ image_path TEXT, \ group_id INTEGER default 0, \ internal_group_id INTEGER default 0, \ @@ -94,7 +94,7 @@ create table if not exists noti_list ( \ uid INTEGER \ ); \ create table if not exists noti_group_data ( \ - caller_pkgname TEXT NOT NULL, \ + caller_app_id TEXT NOT NULL, \ group_id INTEGER default 0, \ badge INTEGER default 0, \ title TEXT, \ @@ -104,11 +104,11 @@ create table if not exists noti_list ( \ count_display_title INTEGER, \ count_display_content INTEGER, \ rowid INTEGER PRIMARY KEY AUTOINCREMENT, \ - UNIQUE (caller_pkgname, group_id) \ + UNIQUE (caller_app_id, group_id) \ ); \ create table if not exists ongoing_list ( \ - caller_pkgname TEXT NOT NULL, \ - launch_pkgname TEXT, \ + caller_app_id TEXT NOT NULL, \ + launch_app_id TEXT, \ icon_path TEXT, \ group_id INTEGER default 0, \ internal_group_id INTEGER default 0, \ @@ -127,19 +127,19 @@ create table if not exists noti_list ( \ progress_size DOUBLE default 0, \ progress_percentage DOUBLE default 0, \ rowid INTEGER PRIMARY KEY AUTOINCREMENT, \ - UNIQUE (caller_pkgname, priv_id) \ + UNIQUE (caller_app_id, priv_id) \ ); \ CREATE TABLE IF NOT EXISTS notification_setting ( \ uid INTEGER, \ package_name TEXT NOT NULL, \ - appid TEXT NOT NULL, \ + app_id TEXT NOT NULL, \ 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, \ app_disabled INTEGER DEFAULT 0, \ - UNIQUE (uid, package_name, appid) \ + UNIQUE (uid, package_name, app_id) \ ); \ CREATE TABLE IF NOT EXISTS notification_system_setting ( \ uid INTEGER, \ @@ -164,8 +164,8 @@ create table if not exists noti_list ( \ type INTEGER NOT NULL, \ layout INTEGER NOT NULL default 0, \ pkg_id TEXT NOT NULL, \ - caller_pkgname TEXT NOT NULL, \ - launch_pkgname TEXT, \ + caller_app_id TEXT NOT NULL, \ + launch_app_id TEXT, \ image_path TEXT, \ group_id INTEGER default 0, \ internal_group_id INTEGER default 0, \ @@ -221,7 +221,7 @@ create table if not exists noti_list ( \ extension_image_size INTEGER default 0, \ uid INTEGER, \ template_name TEXT, \ - UNIQUE (caller_pkgname, template_name) \ + UNIQUE (caller_app_id, template_name) \ );" diff --git a/src/notification_group.c b/src/notification_group.c index f2f4eac..f129bac 100755 --- a/src/notification_group.c +++ b/src/notification_group.c @@ -23,7 +23,7 @@ #include /* LCOV_EXCL_START */ -static int _notification_group_check_data_inserted(const char *pkgname, +static int _notification_group_check_data_inserted(const char *app_id, int group_id, sqlite3 *db) { sqlite3_stmt *stmt = NULL; @@ -32,8 +32,8 @@ static int _notification_group_check_data_inserted(const char *pkgname, int result; snprintf(query, sizeof(query), - "select count(*) from noti_group_data where caller_pkgname = '%s' and group_id = %d", - pkgname, group_id); + "select count(*) from noti_group_data where caller_app_id = '%s' and group_id = %d", + app_id, group_id); ret = sqlite3_prepare(db, query, strlen(query), &stmt, NULL); if (ret != SQLITE_OK) { @@ -62,7 +62,7 @@ static int _notification_group_check_data_inserted(const char *pkgname, /* LCOV_EXCL_STOP */ /* LCOV_EXCL_START */ -int notification_group_set_badge(const char *pkgname, +int notification_group_set_badge(const char *app_id, int group_id, int count) { sqlite3 *db; @@ -75,20 +75,20 @@ int notification_group_set_badge(const char *pkgname, if (!db) return get_last_result(); - ret = _notification_group_check_data_inserted(pkgname, group_id, db); + ret = _notification_group_check_data_inserted(app_id, group_id, db); if (ret == NOTIFICATION_ERROR_NONE) { /* Insert if does not exist */ snprintf(query, sizeof(query), "insert into noti_group_data (" - "caller_pkgname, group_id, badge, content, loc_content) values (" - "'%s', %d, %d, '', '')", pkgname, group_id, count); + "caller_app_id, group_id, badge, content, loc_content) values (" + "'%s', %d, %d, '', '')", app_id, group_id, count); } else { /* Update if exist */ snprintf(query, sizeof(query), "update noti_group_data " "set badge = %d " - "where caller_pkgname = '%s' and group_id = %d", - count, pkgname, group_id); + "where caller_app_id = '%s' and group_id = %d", + count, app_id, group_id); } ret = sqlite3_prepare_v2(db, query, -1, &stmt, NULL); @@ -122,7 +122,7 @@ int notification_group_set_badge(const char *pkgname, /* LCOV_EXCL_STOP */ /* LCOV_EXCL_START */ -int notification_group_get_badge(const char *pkgname, +int notification_group_get_badge(const char *app_id, int group_id, int *count) { sqlite3 *db; @@ -136,26 +136,26 @@ int notification_group_get_badge(const char *pkgname, return get_last_result(); if (group_id == NOTIFICATION_GROUP_ID_NONE) { - ret = _notification_group_check_data_inserted(pkgname, group_id, db); + ret = _notification_group_check_data_inserted(app_id, group_id, db); if (ret == NOTIFICATION_ERROR_NONE) - /* Get all of pkgname count if none group id is not exist */ + /* Get all of app_id count if none group id is not exist */ snprintf(query, sizeof(query), "select sum(badge) " "from noti_group_data " - "where caller_pkgname = '%s'", pkgname); + "where caller_app_id = '%s'", app_id); else /* Get none group id count */ snprintf(query, sizeof(query), "select badge " "from noti_group_data " - "where caller_pkgname = '%s' and group_id = %d", - pkgname, group_id); + "where caller_app_id = '%s' and group_id = %d", + app_id, group_id); } else { snprintf(query, sizeof(query), "select badge " "from noti_group_data " - "where caller_pkgname = '%s' and group_id = %d", - pkgname, group_id); + "where caller_app_id = '%s' and group_id = %d", + app_id, group_id); } NOTIFICATION_INFO("Get badge : query[%s]", query); diff --git a/src/notification_internal.c b/src/notification_internal.c index 0d5a9da..c55d3e3 100755 --- a/src/notification_internal.c +++ b/src/notification_internal.c @@ -320,7 +320,7 @@ EXPORT_API int notification_update_progress(notification_h noti, int priv_id, double progress) { - char *caller_pkgname = NULL; + char *caller_app_id = NULL; int input_priv_id = 0; int ret = 0; double input_progress = 0.0; @@ -336,9 +336,9 @@ EXPORT_API int notification_update_progress(notification_h noti, } if (noti == NULL) - caller_pkgname = notification_get_pkgname_by_pid(); + caller_app_id = notification_get_app_id_by_pid(); else - caller_pkgname = strdup(noti->caller_pkgname); + caller_app_id = strdup(noti->caller_app_id); if (progress < 0.0) input_progress = 0.0; @@ -347,11 +347,11 @@ EXPORT_API int notification_update_progress(notification_h noti, else input_progress = progress; - ret = notification_ongoing_update_progress(caller_pkgname, input_priv_id, + ret = notification_ongoing_update_progress(caller_app_id, input_priv_id, input_progress); - if (caller_pkgname) - free(caller_pkgname); + if (caller_app_id) + free(caller_app_id); return ret; } @@ -360,7 +360,7 @@ EXPORT_API int notification_update_size(notification_h noti, int priv_id, double size) { - char *caller_pkgname = NULL; + char *caller_app_id = NULL; int input_priv_id = 0; int ret = 0; double input_size = 0.0; @@ -375,20 +375,20 @@ EXPORT_API int notification_update_size(notification_h noti, } if (noti == NULL) - caller_pkgname = notification_get_pkgname_by_pid(); + caller_app_id = notification_get_app_id_by_pid(); else - caller_pkgname = strdup(noti->caller_pkgname); + caller_app_id = strdup(noti->caller_app_id); if (size < 0.0) input_size = 0.0; else input_size = size; - ret = notification_ongoing_update_size(caller_pkgname, input_priv_id, + ret = notification_ongoing_update_size(caller_app_id, input_priv_id, input_size); - if (caller_pkgname) - free(caller_pkgname); + if (caller_app_id) + free(caller_app_id); return ret; } @@ -397,7 +397,7 @@ EXPORT_API int notification_update_content(notification_h noti, int priv_id, const char *content) { - char *caller_pkgname = NULL; + char *caller_app_id = NULL; int input_priv_id = 0; int ret = 0; @@ -411,15 +411,15 @@ EXPORT_API int notification_update_content(notification_h noti, } if (noti == NULL) - caller_pkgname = notification_get_pkgname_by_pid(); + caller_app_id = notification_get_app_id_by_pid(); else - caller_pkgname = strdup(noti->caller_pkgname); + caller_app_id = strdup(noti->caller_app_id); - ret = notification_ongoing_update_content(caller_pkgname, input_priv_id, + ret = notification_ongoing_update_content(caller_app_id, input_priv_id, content); - if (caller_pkgname) - free(caller_pkgname); + if (caller_app_id) + free(caller_app_id); return ret; } @@ -561,15 +561,15 @@ EXPORT_API int notification_get_content(notification_h noti, /* LCOV_EXCL_START */ EXPORT_API int notification_set_application(notification_h noti, - const char *pkgname) + const char *app_id) { - if (noti == NULL || pkgname == NULL) + if (noti == NULL || app_id == NULL) return NOTIFICATION_ERROR_INVALID_PARAMETER; - if (noti->launch_pkgname) - free(noti->launch_pkgname); + if (noti->launch_app_id) + free(noti->launch_app_id); - noti->launch_pkgname = strdup(pkgname); + noti->launch_app_id = strdup(app_id); return NOTIFICATION_ERROR_NONE; } @@ -577,15 +577,15 @@ EXPORT_API int notification_set_application(notification_h noti, /* LCOV_EXCL_START */ EXPORT_API int notification_get_application(notification_h noti, - char **pkgname) + char **app_id) { - if (noti == NULL || pkgname == NULL) + if (noti == NULL || app_id == NULL) return NOTIFICATION_ERROR_INVALID_PARAMETER; - if (noti->launch_pkgname) - *pkgname = noti->launch_pkgname; + if (noti->launch_app_id) + *app_id = noti->launch_app_id; else - *pkgname = noti->caller_pkgname; + *app_id = noti->caller_app_id; return NOTIFICATION_ERROR_NONE; } @@ -662,84 +662,84 @@ EXPORT_API int notification_get_grouping_list(notification_type_e type, int coun /* LCOV_EXCL_STOP */ /* LCOV_EXCL_START */ -EXPORT_API int notification_delete_group_by_group_id(const char *pkgname, +EXPORT_API int notification_delete_group_by_group_id(const char *app_id, notification_type_e type, int group_id) { int ret = 0; - char *caller_pkgname = NULL; + char *caller_app_id = NULL; - if (pkgname == NULL) - caller_pkgname = notification_get_pkgname_by_pid(); + if (app_id == NULL) + caller_app_id = notification_get_app_id_by_pid(); else - caller_pkgname = strdup(pkgname); + caller_app_id = strdup(app_id); - ret = notification_ipc_request_delete_multiple(type, caller_pkgname, getuid()); + ret = notification_ipc_request_delete_multiple(type, caller_app_id, getuid()); - if (caller_pkgname) - free(caller_pkgname); + if (caller_app_id) + free(caller_app_id); return ret; } /* LCOV_EXCL_STOP */ /* LCOV_EXCL_START */ -int notification_delete_group_by_priv_id_for_uid(const char *pkgname, +int notification_delete_group_by_priv_id_for_uid(const char *app_id, notification_type_e type, int priv_id, uid_t uid) { int ret = 0; - char *caller_pkgname = NULL; + char *caller_app_id = NULL; - if (pkgname == NULL) - caller_pkgname = notification_get_pkgname_by_pid(); + if (app_id == NULL) + caller_app_id = notification_get_app_id_by_pid(); else - caller_pkgname = strdup(pkgname); + caller_app_id = strdup(app_id); - ret = notification_ipc_request_delete_single(type, caller_pkgname, priv_id, uid); + ret = notification_ipc_request_delete_single(type, caller_app_id, priv_id, uid); - if (caller_pkgname) - free(caller_pkgname); + if (caller_app_id) + free(caller_app_id); return ret; } /* LCOV_EXCL_STOP */ /* LCOV_EXCL_START */ -EXPORT_API int notification_delete_group_by_priv_id(const char *pkgname, +EXPORT_API int notification_delete_group_by_priv_id(const char *app_id, notification_type_e type, int priv_id) { - return notification_delete_group_by_priv_id_for_uid(pkgname, type, priv_id, getuid()); + return notification_delete_group_by_priv_id_for_uid(app_id, type, priv_id, getuid()); } int notification_get_count_for_uid(notification_type_e type, - const char *pkgname, + const char *app_id, int group_id, int priv_id, int *count, uid_t uid) { int ret = 0; - char *caller_pkgname = NULL; + char *caller_app_id = NULL; if (count == NULL) return NOTIFICATION_ERROR_INVALID_PARAMETER; - if (pkgname == NULL) - caller_pkgname = notification_get_pkgname_by_pid(); + if (app_id == NULL) + caller_app_id = notification_get_app_id_by_pid(); else - caller_pkgname = strdup(pkgname); + caller_app_id = strdup(app_id); ret = notification_ipc_request_get_count( type, - caller_pkgname, + caller_app_id, group_id, priv_id, count, uid); - if (caller_pkgname) - free(caller_pkgname); + if (caller_app_id) + free(caller_app_id); return ret; } @@ -747,11 +747,11 @@ int notification_get_count_for_uid(notification_type_e type, /* LCOV_EXCL_START */ EXPORT_API int notification_get_count(notification_type_e type, - const char *pkgname, + const char *app_id, int group_id, int priv_id, int *count) { - return notification_get_count_for_uid(type, pkgname, group_id, priv_id, count, getuid()); + return notification_get_count_for_uid(type, app_id, group_id, priv_id, count, getuid()); } int notification_clear_for_uid(notification_type_e type, uid_t uid) @@ -804,83 +804,89 @@ EXPORT_API int notification_op_get_data(notification_op *noti_op, notification_o EXPORT_API int notification_set_pkgname(notification_h noti, const char *pkgname) { - if (noti == NULL || pkgname == NULL) + return notification_set_app_id(noti, pkgname); +} +/* LCOV_EXCL_STOP */ + +EXPORT_API int notification_set_app_id(notification_h noti, + const char *app_id) +{ + if (noti == NULL || app_id == NULL) return NOTIFICATION_ERROR_INVALID_PARAMETER; - /* Remove previous caller pkgname */ - if (noti->caller_pkgname) { - free(noti->caller_pkgname); - noti->caller_pkgname = NULL; + /* Remove previous caller app_id */ + if (noti->caller_app_id) { + free(noti->caller_app_id); + noti->caller_app_id = NULL; } - noti->caller_pkgname = strdup(pkgname); + noti->caller_app_id = strdup(app_id); return NOTIFICATION_ERROR_NONE; } -/* LCOV_EXCL_STOP */ /* LCOV_EXCL_START */ -int notification_delete_all_by_type_for_uid(const char *pkgname, +int notification_delete_all_by_type_for_uid(const char *app_id, notification_type_e type, uid_t uid) { int ret = 0; - char *caller_pkgname = NULL; + char *caller_app_id = NULL; if (type <= NOTIFICATION_TYPE_NONE || type > NOTIFICATION_TYPE_MAX) return NOTIFICATION_ERROR_INVALID_PARAMETER; - if (pkgname == NULL) - caller_pkgname = notification_get_pkgname_by_pid(); + if (app_id == NULL) + caller_app_id = notification_get_app_id_by_pid(); else - caller_pkgname = strdup(pkgname); + caller_app_id = strdup(app_id); - ret = notification_ipc_request_delete_multiple(type, caller_pkgname, uid); + ret = notification_ipc_request_delete_multiple(type, caller_app_id, uid); - if (caller_pkgname) - free(caller_pkgname); + if (caller_app_id) + free(caller_app_id); return ret; } /* LCOV_EXCL_STOP */ /* LCOV_EXCL_START */ -EXPORT_API int notification_delete_all_by_type(const char *pkgname, +EXPORT_API int notification_delete_all_by_type(const char *app_id, notification_type_e type) { - return notification_delete_all_by_type_for_uid(pkgname, type, getuid()); + return notification_delete_all_by_type_for_uid(app_id, type, getuid()); } -int notification_delete_by_priv_id_for_uid(const char *pkgname, +int notification_delete_by_priv_id_for_uid(const char *app_id, notification_type_e type, int priv_id, uid_t uid) { int ret = 0; - char *caller_pkgname = NULL; + char *caller_app_id = NULL; if (priv_id <= NOTIFICATION_PRIV_ID_NONE) return NOTIFICATION_ERROR_INVALID_PARAMETER; - if (pkgname == NULL) - caller_pkgname = notification_get_pkgname_by_pid(); + if (app_id == NULL) + caller_app_id = notification_get_app_id_by_pid(); else - caller_pkgname = strdup(pkgname); + caller_app_id = strdup(app_id); - ret = notification_ipc_request_delete_single(type, caller_pkgname, priv_id, uid); + ret = notification_ipc_request_delete_single(type, caller_app_id, priv_id, uid); - if (caller_pkgname) - free(caller_pkgname); + if (caller_app_id) + free(caller_app_id); return ret; } /* LCOV_EXCL_STOP */ /* LCOV_EXCL_START */ -EXPORT_API int notification_delete_by_priv_id(const char *pkgname, +EXPORT_API int notification_delete_by_priv_id(const char *app_id, notification_type_e type, int priv_id) { - return notification_delete_by_priv_id_for_uid(pkgname, type, priv_id, getuid()); + return notification_delete_by_priv_id_for_uid(app_id, type, priv_id, getuid()); } EXPORT_API int notification_set_execute_option(notification_h noti, @@ -996,7 +1002,7 @@ EXPORT_API int notification_set_priv_id(notification_h noti, int priv_id) } /* LCOV_EXCL_START */ -notification_h notification_load_for_uid(char *pkgname, +notification_h notification_load_for_uid(char *app_id, int priv_id, uid_t uid) { int ret = 0; @@ -1008,7 +1014,7 @@ notification_h notification_load_for_uid(char *pkgname, return NULL; } - ret = notification_ipc_request_load_noti_by_priv_id(noti, pkgname, priv_id, uid); + ret = notification_ipc_request_load_noti_by_priv_id(noti, app_id, priv_id, uid); if (ret != NOTIFICATION_ERROR_NONE) { notification_free(noti); return NULL; @@ -1019,10 +1025,10 @@ notification_h notification_load_for_uid(char *pkgname, /* LCOV_EXCL_STOP */ /* LCOV_EXCL_START */ -EXPORT_API notification_h notification_load(char *pkgname, +EXPORT_API notification_h notification_load(char *app_id, int priv_id) { - return notification_load_for_uid(pkgname, priv_id, getuid()); + return notification_load_for_uid(app_id, priv_id, getuid()); } /* LCOV_EXCL_STOP */ @@ -1349,23 +1355,23 @@ EXPORT_API int notification_delete_for_uid(notification_h noti, uid_t uid) return NOTIFICATION_ERROR_INVALID_PARAMETER; return notification_ipc_request_delete_single(NOTIFICATION_TYPE_NONE, - noti->caller_pkgname, noti->priv_id, uid); + noti->caller_app_id, noti->priv_id, uid); } EXPORT_API int notification_delete_all_for_uid(notification_type_e type, uid_t uid) { int ret = 0; - char *caller_pkgname = NULL; + char *caller_app_id = NULL; if (type <= NOTIFICATION_TYPE_NONE || type > NOTIFICATION_TYPE_MAX) return NOTIFICATION_ERROR_INVALID_PARAMETER; - caller_pkgname = notification_get_pkgname_by_pid(); + caller_app_id = notification_get_app_id_by_pid(); - ret = notification_ipc_request_delete_multiple(type, caller_pkgname, uid); + ret = notification_ipc_request_delete_multiple(type, caller_app_id, uid); - if (caller_pkgname) - free(caller_pkgname); + if (caller_app_id) + free(caller_app_id); return ret; } @@ -1374,7 +1380,7 @@ EXPORT_API notification_h notification_load_by_tag_for_uid(const char *tag, uid_ { int ret = 0; notification_h noti = NULL; - char *caller_pkgname = NULL; + char *caller_app_id = NULL; if (tag == NULL) { NOTIFICATION_ERR("Invalid parameter"); @@ -1382,8 +1388,8 @@ EXPORT_API notification_h notification_load_by_tag_for_uid(const char *tag, uid_ return NULL; } - caller_pkgname = notification_get_pkgname_by_pid(); - if (!caller_pkgname) { + caller_app_id = notification_get_app_id_by_pid(); + if (!caller_app_id) { /* LCOV_EXCL_START */ NOTIFICATION_ERR("Failed to get a package name"); set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY); @@ -1396,14 +1402,14 @@ EXPORT_API notification_h notification_load_by_tag_for_uid(const char *tag, uid_ /* LCOV_EXCL_START */ NOTIFICATION_ERR("Failed to alloc a new notification"); set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY); - free(caller_pkgname); + free(caller_app_id); return NULL; /* LCOV_EXCL_STOP */ } - ret = notification_ipc_request_load_noti_by_tag(noti, caller_pkgname, (char *)tag, uid); - free(caller_pkgname); + ret = notification_ipc_request_load_noti_by_tag(noti, caller_app_id, (char *)tag, uid); + free(caller_app_id); set_last_result(ret); if (ret != NOTIFICATION_ERROR_NONE) { @@ -1414,12 +1420,12 @@ EXPORT_API notification_h notification_load_by_tag_for_uid(const char *tag, uid_ return noti; } -EXPORT_API notification_h notification_create_from_package_template(const char *pkgname, const char *template_name) +EXPORT_API notification_h notification_create_from_package_template(const char *app_id, const char *template_name) { int ret = 0; notification_h noti = NULL; - if (pkgname == NULL || template_name == NULL) { + if (app_id == NULL || template_name == NULL) { NOTIFICATION_ERR("Invalid parameter"); set_last_result(NOTIFICATION_ERROR_INVALID_PARAMETER); return NULL; @@ -1432,7 +1438,7 @@ EXPORT_API notification_h notification_create_from_package_template(const char * return NULL; } - ret = notification_ipc_request_create_from_package_template(noti, pkgname, template_name); + ret = notification_ipc_request_create_from_package_template(noti, app_id, template_name); set_last_result(ret); if (ret != NOTIFICATION_ERROR_NONE) { diff --git a/src/notification_ipc.c b/src/notification_ipc.c index 9d96ee6..ebf80b1 100755 --- a/src/notification_ipc.c +++ b/src/notification_ipc.c @@ -71,19 +71,19 @@ static void _do_deffered_task(void); static void _print_noti(notification_h noti) { - char *pkgname = NULL; + char *app_id = NULL; char *text = NULL; char *content = NULL; const char *tag = NULL; notification_vibration_type_e vib_type = NOTIFICATION_VIBRATION_TYPE_NONE; - notification_get_pkgname(noti, &pkgname); + notification_get_pkgname(noti, &app_id); notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, &text); notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, &content); notification_get_tag(noti, &tag); notification_get_vibration(noti, &vib_type, NULL); - NOTIFICATION_DBG("client print_noti pkgname = %s ", pkgname); + NOTIFICATION_DBG("client print_noti app_id = %s ", app_id); NOTIFICATION_DBG("client print_noti title = %s ", text); NOTIFICATION_DBG("client print_noti content = %s ", content); NOTIFICATION_DBG("client print_noti tag = %s ", tag); @@ -978,7 +978,7 @@ int notification_ipc_request_refresh(uid_t uid) return result; } -int notification_ipc_request_delete_single(notification_type_e type, char *pkgname, int priv_id, uid_t uid) +int notification_ipc_request_delete_single(notification_type_e type, char *app_id, int priv_id, uid_t uid) { int result; int id; @@ -992,10 +992,10 @@ int notification_ipc_request_delete_single(notification_type_e type, char *pkgna return result; } - if (!pkgname) - pkgname = ""; + if (!app_id) + app_id = ""; - body = g_variant_new("(sii)", pkgname, priv_id, uid); + body = g_variant_new("(sii)", app_id, priv_id, uid); result = _send_sync_noti(body, &reply, "del_noti_single"); if (result == NOTIFICATION_ERROR_NONE) { @@ -1010,7 +1010,7 @@ int notification_ipc_request_delete_single(notification_type_e type, char *pkgna return result; } -int notification_ipc_request_delete_multiple(notification_type_e type, char *pkgname, uid_t uid) +int notification_ipc_request_delete_multiple(notification_type_e type, char *app_id, uid_t uid) { int result; int num_deleted; @@ -1024,10 +1024,10 @@ int notification_ipc_request_delete_multiple(notification_type_e type, char *pkg return result; } - if (!pkgname) - pkgname = ""; + if (!app_id) + app_id = ""; - body = g_variant_new("(sii)", pkgname, type, uid); + body = g_variant_new("(sii)", app_id, type, uid); result = _send_sync_noti(body, &reply, "del_noti_multiple"); if (result == NOTIFICATION_ERROR_NONE) { @@ -1042,7 +1042,7 @@ int notification_ipc_request_delete_multiple(notification_type_e type, char *pkg return result; } -int notification_ipc_request_load_noti_by_tag(notification_h noti, const char *pkgname, const char *tag, uid_t uid) +int notification_ipc_request_load_noti_by_tag(notification_h noti, const char *app_id, const char *tag, uid_t uid) { int result; GDBusMessage *reply = NULL; @@ -1056,10 +1056,10 @@ int notification_ipc_request_load_noti_by_tag(notification_h noti, const char *p return result; } - if (!pkgname) - pkgname = ""; + if (!app_id) + app_id = ""; - body = g_variant_new("(ssi)", pkgname, tag, uid); + body = g_variant_new("(ssi)", app_id, tag, uid); result = _send_sync_noti(body, &reply, "load_noti_by_tag"); if (result == NOTIFICATION_ERROR_NONE) { @@ -1080,7 +1080,7 @@ int notification_ipc_request_load_noti_by_tag(notification_h noti, const char *p } /* LCOV_EXCL_START */ -int notification_ipc_request_load_noti_by_priv_id(notification_h noti, const char *pkgname, int priv_id, uid_t uid) +int notification_ipc_request_load_noti_by_priv_id(notification_h noti, const char *app_id, int priv_id, uid_t uid) { int result; GDBusMessage *reply = NULL; @@ -1094,10 +1094,10 @@ int notification_ipc_request_load_noti_by_priv_id(notification_h noti, const cha return result; } - if (!pkgname) - pkgname = ""; + if (!app_id) + app_id = ""; - body = g_variant_new("(sii)", pkgname, priv_id, uid); + body = g_variant_new("(sii)", app_id, priv_id, uid); result = _send_sync_noti(body, &reply, "load_noti_by_priv_id"); if (result == NOTIFICATION_ERROR_NONE) { @@ -1119,7 +1119,7 @@ int notification_ipc_request_load_noti_by_priv_id(notification_h noti, const cha /* LCOV_EXCL_START */ int notification_ipc_request_get_count(notification_type_e type, - const char *pkgname, int group_id, int priv_id, int *count, uid_t uid) + const char *app_id, int group_id, int priv_id, int *count, uid_t uid) { int result; GDBusMessage *reply = NULL; @@ -1133,10 +1133,10 @@ int notification_ipc_request_get_count(notification_type_e type, return result; } - if (!pkgname) - pkgname = ""; + if (!app_id) + app_id = ""; - body = g_variant_new("(isiii)", type, pkgname, group_id, priv_id, uid); + body = g_variant_new("(isiii)", type, app_id, group_id, priv_id, uid); result = _send_sync_noti(body, &reply, "get_noti_count"); if (result == NOTIFICATION_ERROR_NONE) { @@ -1203,7 +1203,7 @@ int notification_ipc_request_load_noti_grouping_list(notification_type_e type, i return result; } -int notification_ipc_request_load_noti_detail_list(const char *pkgname, +int notification_ipc_request_load_noti_detail_list(const char *app_id, int group_id, int priv_id, int count, @@ -1225,7 +1225,7 @@ int notification_ipc_request_load_noti_detail_list(const char *pkgname, return result; } - body = g_variant_new("(siiii)", pkgname, group_id, priv_id, count, uid); + body = g_variant_new("(siiii)", app_id, group_id, priv_id, count, uid); result = _send_sync_noti(body, &reply, "load_noti_detail_list"); if (result == NOTIFICATION_ERROR_NONE) { @@ -1310,8 +1310,8 @@ int notification_ipc_request_get_setting_array( return result; } -int notification_ipc_request_get_setting_by_appid( - const char *appid, notification_setting_h *setting, uid_t uid) +int notification_ipc_request_get_setting_by_app_id( + const char *app_id, notification_setting_h *setting, uid_t uid) { int result; GDBusMessage *reply = NULL; @@ -1326,8 +1326,8 @@ int notification_ipc_request_get_setting_by_appid( return result; } - body = g_variant_new("(si)", appid, uid); - result = _send_sync_noti(body, &reply, "get_setting_by_appid"); + body = g_variant_new("(si)", app_id, uid); + result = _send_sync_noti(body, &reply, "get_setting_by_app_id"); if (result == NOTIFICATION_ERROR_NONE) { reply_body = g_dbus_message_get_body(reply); @@ -1349,7 +1349,7 @@ int notification_ipc_request_get_setting_by_appid( if (reply) g_object_unref(reply); - NOTIFICATION_DBG("notification_ipc_request_get_setting_by_package_name done [result: %d]", result); + NOTIFICATION_DBG("notification_ipc_request_get_setting_by_app_id done [result: %d]", result); return result; } @@ -1432,7 +1432,7 @@ int notification_ipc_update_setting(notification_setting_h setting, uid_t uid) body = g_variant_new("(ssiiiiii)", setting->package_name, - setting->appid, + setting->app_id, (int)(setting->allow_to_notify), (int)(setting->do_not_disturb_except), (int)(setting->visibility_class), @@ -1559,7 +1559,7 @@ int notification_ipc_request_create_from_template(notification_h noti, const cha return result; } -int notification_ipc_request_create_from_package_template(notification_h noti, const char *pkgname, const char *template_name) +int notification_ipc_request_create_from_package_template(notification_h noti, const char *app_id, const char *template_name) { int result; GDBusMessage *reply = NULL; @@ -1573,7 +1573,7 @@ int notification_ipc_request_create_from_package_template(notification_h noti, c return result; } - body = g_variant_new("(ss)", pkgname, template_name); + body = g_variant_new("(ss)", app_id, template_name); result = _send_sync_noti(body, &reply, "create_from_package_template"); if (result == NOTIFICATION_ERROR_NONE) { @@ -1593,7 +1593,7 @@ int notification_ipc_request_create_from_package_template(notification_h noti, c return result; } -int notification_ipc_get_noti_block_state(const char *pkgname, int *do_not_disturb, +int notification_ipc_get_noti_block_state(const char *app_id, int *do_not_disturb, int *do_not_disturb_except, int *allow_to_notify, uid_t uid) { @@ -1606,7 +1606,7 @@ int notification_ipc_get_noti_block_state(const char *pkgname, int *do_not_distu GVariant *reply_body; GVariant *result_body; - if (pkgname == NULL) + if (app_id == NULL) return NOTIFICATION_ERROR_INVALID_PARAMETER; ret = _dbus_init(); @@ -1615,7 +1615,7 @@ int notification_ipc_get_noti_block_state(const char *pkgname, int *do_not_distu return ret; } - body = g_variant_new("(si)", pkgname, uid); + body = g_variant_new("(si)", app_id, uid); ret = _send_sync_noti(body, &reply, "get_noti_block_state"); @@ -1743,7 +1743,7 @@ EXPORT_API GVariant *notification_ipc_make_gvariant_from_noti(notification_h not g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_INTERNAL_GROUP_ID, g_variant_new_int32(noti->internal_group_id)); g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_PRIV_ID, g_variant_new_int32(noti->priv_id)); g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_PKG_ID, g_variant_new_string((const gchar *)noti->pkg_id)); - g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_CALLER_PKGNAME, g_variant_new_string((const gchar *)noti->caller_pkgname)); + g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_CALLER_APP_ID, g_variant_new_string((const gchar *)noti->caller_app_id)); g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_DISPLAY_APPLIST, g_variant_new_int32(noti->display_applist)); if (noti->args) { @@ -1810,8 +1810,8 @@ EXPORT_API GVariant *notification_ipc_make_gvariant_from_noti(notification_h not } } - if (noti->launch_pkgname) - g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_LAUNCH_PKGNAME, g_variant_new_string((const gchar *)noti->launch_pkgname)); + if (noti->launch_app_id) + g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_LAUNCH_APP_ID, g_variant_new_string((const gchar *)noti->launch_app_id)); if (noti->domain != NULL) g_variant_builder_add(&builder, "{iv}", NOTIFICATION_DATA_TYPE_DOMAIN, g_variant_new_string((const gchar *)noti->domain)); @@ -1978,8 +1978,8 @@ EXPORT_API int notification_ipc_make_noti_from_gvariant(notification_h noti, int i; char *pkg_id = NULL; - char *caller_pkgname = NULL; - char *launch_pkgname = NULL; + char *caller_app_id = NULL; + char *launch_app_id = NULL; bundle_raw *args = NULL; bundle_raw *group_args = NULL; bundle_raw *b_execute_option = NULL; @@ -2020,8 +2020,8 @@ EXPORT_API int notification_ipc_make_noti_from_gvariant(notification_h noti, _variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_INTERNAL_GROUP_ID, "i", ¬i->internal_group_id); _variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_PRIV_ID, "i", ¬i->priv_id); _variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_PKG_ID, "&s", &pkg_id); - _variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_CALLER_PKGNAME, "&s", &caller_pkgname); - _variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_LAUNCH_PKGNAME, "&s", &launch_pkgname); + _variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_CALLER_APP_ID, "&s", &caller_app_id); + _variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_LAUNCH_APP_ID, "&s", &launch_app_id); _variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_ARGS, "&s", &args); _variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_GROUP_ARGS, "&s", &group_args); _variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_EXECUTE_OPTION, "&s", &b_execute_option); @@ -2078,8 +2078,8 @@ EXPORT_API int notification_ipc_make_noti_from_gvariant(notification_h noti, _variant_dict_lookup(dict, NOTIFICATION_DATA_TYPE_UID, "i", ¬i->uid); noti->pkg_id = _dup_string(pkg_id); - noti->caller_pkgname = _dup_string(caller_pkgname); - noti->launch_pkgname = _dup_string(launch_pkgname); + noti->caller_app_id = _dup_string(caller_app_id); + noti->launch_app_id = _dup_string(launch_app_id); noti->args = _create_bundle_from_bundle_raw(args); noti->group_args = _create_bundle_from_bundle_raw(group_args); noti->b_execute_option = _create_bundle_from_bundle_raw(b_execute_option); @@ -2182,7 +2182,7 @@ EXPORT_API GVariant *notification_ipc_make_gvariant_from_setting(struct notifica body = g_variant_new("(ssiiiiii)", noti_setting->package_name, - noti_setting->appid, + noti_setting->app_id, noti_setting->allow_to_notify, noti_setting->do_not_disturb_except, noti_setting->visibility_class, @@ -2198,7 +2198,7 @@ EXPORT_API int notification_ipc_make_setting_from_gvariant(struct notification_s { NOTIFICATION_DBG("notification_ipc_make_setting_from_gvariant !!!!"); char *pkgname; - char *appid; + char *app_id; int allow_to_notify; int do_not_disturb_except; int visibility_class; @@ -2213,7 +2213,7 @@ EXPORT_API int notification_ipc_make_setting_from_gvariant(struct notification_s g_variant_get(variant, "(&s&siiiiii)", &pkgname, - &appid, + &app_id, &allow_to_notify, &do_not_disturb_except, &visibility_class, @@ -2224,7 +2224,7 @@ EXPORT_API int notification_ipc_make_setting_from_gvariant(struct notification_s NOTIFICATION_DBG("setting from variant %s !!", pkgname); noti_setting->package_name = _dup_string(pkgname); - noti_setting->appid = _dup_string(appid); + noti_setting->app_id = _dup_string(app_id); noti_setting->allow_to_notify = allow_to_notify; noti_setting->do_not_disturb_except = do_not_disturb_except; noti_setting->visibility_class = visibility_class; diff --git a/src/notification_list.c b/src/notification_list.c index d55713c..6b773d1 100755 --- a/src/notification_list.c +++ b/src/notification_list.c @@ -275,7 +275,7 @@ EXPORT_API int notification_get_list(notification_type_e type, return notification_get_list_for_uid(type, count, list, getuid()); } -EXPORT_API int notification_get_detail_list_for_uid(const char *pkgname, +EXPORT_API int notification_get_detail_list_for_uid(const char *app_id, int group_id, int priv_id, int count, @@ -285,10 +285,10 @@ EXPORT_API int notification_get_detail_list_for_uid(const char *pkgname, notification_list_h get_list = NULL; int ret = 0; - if (list == NULL || pkgname == NULL) + if (list == NULL || app_id == NULL) return NOTIFICATION_ERROR_INVALID_PARAMETER; - ret = notification_ipc_request_load_noti_detail_list(pkgname, group_id, priv_id, count, + ret = notification_ipc_request_load_noti_detail_list(app_id, group_id, priv_id, count, &get_list, uid); if (ret != NOTIFICATION_ERROR_NONE) return ret; @@ -299,13 +299,13 @@ EXPORT_API int notification_get_detail_list_for_uid(const char *pkgname, return NOTIFICATION_ERROR_NONE; } -EXPORT_API int notification_get_detail_list(const char *pkgname, +EXPORT_API int notification_get_detail_list(const char *app_id, int group_id, int priv_id, int count, notification_list_h *list) { - return notification_get_detail_list_for_uid(pkgname, group_id, + return notification_get_detail_list_for_uid(app_id, group_id, priv_id, count, list, getuid()); } diff --git a/src/notification_noti.c b/src/notification_noti.c index a722d56..82bf7fc 100755 --- a/src/notification_noti.c +++ b/src/notification_noti.c @@ -101,8 +101,8 @@ static int _notification_noti_check_priv_id(notification_h noti, sqlite3 *db) sqlite3_stmt *stmt = NULL; /* Make query to check priv_id exist */ - query = sqlite3_mprintf("SELECT count(*) FROM noti_list WHERE caller_pkgname = '%s' AND priv_id = %d", - noti->caller_pkgname, noti->priv_id); + query = sqlite3_mprintf("SELECT count(*) FROM noti_list WHERE caller_app_id = '%s' AND priv_id = %d", + noti->caller_app_id, noti->priv_id); if (query == NULL) { ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto err; @@ -135,7 +135,7 @@ err: return ret; } -static int _notification_noti_get_internal_group_id_by_priv_id(const char *pkgname, +static int _notification_noti_get_internal_group_id_by_priv_id(const char *app_id, int priv_id, sqlite3 *db) { @@ -143,8 +143,8 @@ static int _notification_noti_get_internal_group_id_by_priv_id(const char *pkgna sqlite3_stmt *stmt = NULL; int ret = NOTIFICATION_ERROR_NONE, result = 0; - query = sqlite3_mprintf("SELECT internal_group_id FROM noti_list WHERE caller_pkgname = '%s' AND priv_id = %d", - pkgname, priv_id); + query = sqlite3_mprintf("SELECT internal_group_id FROM noti_list WHERE caller_app_id = '%s' AND priv_id = %d", + app_id, priv_id); if (query == NULL) { ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto err; @@ -249,7 +249,7 @@ static int _insertion_query_create(notification_h noti, char **query) *query = sqlite3_mprintf("INSERT INTO noti_list (" "type, " "layout, " - "pkg_id, caller_pkgname, launch_pkgname, " + "pkg_id, caller_app_id, launch_app_id, " "image_path, " "group_id, internal_group_id," "title_key, " @@ -291,8 +291,8 @@ static int _insertion_query_create(notification_h noti, char **query) noti->type, noti->layout, NOTIFICATION_CHECK_STR(noti->pkg_id), - NOTIFICATION_CHECK_STR(noti->caller_pkgname), - NOTIFICATION_CHECK_STR(noti->launch_pkgname), + NOTIFICATION_CHECK_STR(noti->caller_app_id), + NOTIFICATION_CHECK_STR(noti->launch_app_id), NOTIFICATION_CHECK_STR(b_image_path), noti->group_id, noti->internal_group_id, NOTIFICATION_CHECK_STR(b_text), NOTIFICATION_CHECK_STR(b_key), @@ -448,7 +448,7 @@ static int _update_query_create(notification_h noti, char **query) *query = sqlite3_mprintf("UPDATE noti_list SET " "type = %d, " "layout = %d, " - "launch_pkgname = '%s', " + "launch_app_id = '%s', " "image_path = '%s', " "b_text = '%s', b_key = '%s', tag = $tag, " "b_format_args = '%s', num_format_args = %d, " @@ -481,7 +481,7 @@ static int _update_query_create(notification_h noti, char **query) "where priv_id = %d ", noti->type, noti->layout, - NOTIFICATION_CHECK_STR(noti->launch_pkgname), + NOTIFICATION_CHECK_STR(noti->launch_app_id), NOTIFICATION_CHECK_STR(b_image_path), NOTIFICATION_CHECK_STR(b_text), NOTIFICATION_CHECK_STR(b_key), NOTIFICATION_CHECK_STR(b_format_args), noti->num_format_args, @@ -569,8 +569,8 @@ static void _notification_noti_populate_from_stmt(sqlite3_stmt *stmt, notificati noti->type = sqlite3_column_int(stmt, col++); noti->layout = sqlite3_column_int(stmt, col++); __free_and_set((void **)&(noti->pkg_id), notification_db_column_text(stmt, col++)); - __free_and_set((void **)&(noti->caller_pkgname), notification_db_column_text(stmt, col++)); - __free_and_set((void **)&(noti->launch_pkgname), notification_db_column_text(stmt, col++)); + __free_and_set((void **)&(noti->caller_app_id), notification_db_column_text(stmt, col++)); + __free_and_set((void **)&(noti->launch_app_id), notification_db_column_text(stmt, col++)); noti->b_image_path = notification_db_column_bundle(stmt, col++); noti->group_id = sqlite3_column_int(stmt, col++); noti->internal_group_id = 0; @@ -737,9 +737,9 @@ static int __get_setting_from_app_control(notification_h noti, notification_sett goto out; } - ret = noti_setting_service_get_setting_by_appid(app_id, &setting_new, noti->uid); + ret = noti_setting_service_get_setting_by_app_id(app_id, &setting_new, noti->uid); if (ret != APP_CONTROL_ERROR_NONE || setting == NULL) { - NOTIFICATION_ERR("noti_setting_service_get_setting_by_appid failed [%x]", ret); + NOTIFICATION_ERR("noti_setting_service_get_setting_by_app_id failed [%x]", ret); goto out; } @@ -764,7 +764,7 @@ static bool _is_allowed_to_notify(notification_h noti) bool ret = true; int err; - err = noti_setting_service_get_setting_by_appid(noti->caller_pkgname, &setting, noti->uid); + err = noti_setting_service_get_setting_by_app_id(noti->caller_app_id, &setting, noti->uid); if (err != NOTIFICATION_ERROR_NONE) { err = __get_setting_from_app_control(noti, &setting); if (err != NOTIFICATION_ERROR_NONE) @@ -822,10 +822,10 @@ static int _handle_do_not_disturb_option(notification_h noti) NOTIFICATION_DBG("do_not_disturb [%d]", do_not_disturb); if (do_not_disturb) { - /* Check exception option of the caller package */ - err = noti_setting_service_get_setting_by_appid(noti->caller_pkgname, &setting, noti->uid); + /* Check exception option of the caller app_id */ + err = noti_setting_service_get_setting_by_app_id(noti->caller_app_id, &setting, noti->uid); if (err != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("_get_setting_by_package_name failed [%d]", err); + NOTIFICATION_ERR("_get_setting_by_app_id failed [%d]", err); goto out; } @@ -861,15 +861,15 @@ out: return err; } -static bool _is_pop_up_notification(const char *appid, uid_t uid) +static bool _is_pop_up_notification(const char *app_id, uid_t uid) { int err; bool ret = true; notification_setting_h setting = NULL; - err = noti_setting_service_get_setting_by_appid(appid, &setting, uid); + err = noti_setting_service_get_setting_by_app_id(app_id, &setting, uid); if (err != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_WARN("Can't get the setting for %s [%x]", appid, err); + NOTIFICATION_WARN("Can't get the setting for %s [%x]", app_id, err); goto out; } @@ -880,7 +880,7 @@ static bool _is_pop_up_notification(const char *appid, uid_t uid) } if (ret != true) - NOTIFICATION_DBG("[%s] is not allowed Pop-up notification", appid); + NOTIFICATION_DBG("[%s] is not allowed Pop-up notification", app_id); out: if (setting) @@ -922,16 +922,16 @@ EXPORT_API int notification_noti_insert(notification_h noti) } if (_is_allowed_to_notify(noti) == false) { - NOTIFICATION_DBG("[%s] is not allowed to notify", noti->caller_pkgname); + NOTIFICATION_DBG("[%s] is not allowed to notify", noti->caller_app_id); return NOTIFICATION_ERROR_PERMISSION_DENIED; } 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) { + if (_is_pop_up_notification((const char *)noti->caller_app_id, 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); + NOTIFICATION_DBG("notification display applist - app_id [%s], applist [%d]", noti->caller_app_id, noti->display_applist); } if (_check_text_input(noti) != NOTIFICATION_ERROR_NONE) @@ -974,7 +974,7 @@ EXPORT_API int notification_noti_insert(notification_h noti) } if (title_key == NULL) - title_key = noti->caller_pkgname; + title_key = noti->caller_app_id; /* Bind query */ ret = _notification_noti_bind_query_text(stmt, "$tag", noti->tag); @@ -1037,7 +1037,7 @@ EXPORT_API int notification_noti_get_by_priv_id(notification_h noti, int priv_id return get_last_result(); char *base_query = "select " - "type, layout, pkg_id, caller_pkgname, launch_pkgname, image_path, group_id, priv_id, " + "type, layout, pkg_id, caller_app_id, launch_app_id, image_path, group_id, priv_id, " "tag, b_text, b_key, b_format_args, num_format_args, " "text_domain, text_dir, time, insert_time, args, group_args, " "b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, " @@ -1088,7 +1088,7 @@ err: } /* LCOV_EXCL_STOP */ -EXPORT_API int notification_noti_get_by_tag(notification_h noti, char *pkgname, char *tag, uid_t uid) +EXPORT_API int notification_noti_get_by_tag(notification_h noti, char *app_id, char *tag, uid_t uid) { int ret = 0; sqlite3 *db = NULL; @@ -1103,9 +1103,9 @@ EXPORT_API int notification_noti_get_by_tag(notification_h noti, char *pkgname, if (!db) return get_last_result(); - if (pkgname != NULL && strlen(pkgname) != 0) { + if (app_id != NULL && strlen(app_id) != 0) { ret = sqlite3_prepare_v2(db, "select " - "type, layout, pkg_id, caller_pkgname, launch_pkgname, image_path, group_id, priv_id, " + "type, layout, pkg_id, caller_app_id, launch_app_id, image_path, group_id, priv_id, " "tag, b_text, b_key, b_format_args, num_format_args, " "text_domain, text_dir, time, insert_time, args, group_args, " "b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, " @@ -1116,14 +1116,14 @@ EXPORT_API int notification_noti_get_by_tag(notification_h noti, char *pkgname, "flags_for_property, display_applist, progress_size, progress_percentage, ongoing_flag, ongoing_value_type, " "ongoing_current, ongoing_duration, auto_remove, default_button_index, hide_timeout, delete_timeout, " "text_input_max_length, event_flag, extension_image_size, uid " - "from noti_list where caller_pkgname = ? and tag = ? and uid = ?", -1, &stmt, NULL); + "from noti_list where caller_app_id = ? and tag = ? and uid = ?", -1, &stmt, NULL); if (ret != SQLITE_OK) { NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db)); ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; goto err; } - ret = sqlite3_bind_text(stmt, 1, pkgname, -1, SQLITE_TRANSIENT); + ret = sqlite3_bind_text(stmt, 1, app_id, -1, SQLITE_TRANSIENT); if (ret != SQLITE_OK) { NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db)); goto err; @@ -1143,7 +1143,7 @@ EXPORT_API int notification_noti_get_by_tag(notification_h noti, char *pkgname, } else { ret = sqlite3_prepare_v2(db, "select " - "type, layout, pkg_id, caller_pkgname, launch_pkgname, image_path, group_id, priv_id, " + "type, layout, pkg_id, caller_app_id, launch_app_id, image_path, group_id, priv_id, " "tag, b_text, b_key, b_format_args, num_format_args, " "text_domain, text_dir, time, insert_time, args, group_args, " "b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, " @@ -1206,16 +1206,16 @@ EXPORT_API int notification_noti_update(notification_h noti) } if (_is_allowed_to_notify(noti) == false) { - NOTIFICATION_DBG("[%s] is not allowed to notify", noti->caller_pkgname); + NOTIFICATION_DBG("[%s] is not allowed to notify", noti->caller_app_id); return NOTIFICATION_ERROR_PERMISSION_DENIED; } 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) { + if (_is_pop_up_notification((const char *)noti->caller_app_id, 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); + NOTIFICATION_DBG("notification display applist - app_id [%s], applist [%d]", noti->caller_app_id, noti->display_applist); } db = notification_db_open(DBPATH); @@ -1280,7 +1280,7 @@ err: return ret; } -EXPORT_API int notification_noti_delete_all(notification_type_e type, const char *pkgname, int *num_deleted, int **list_deleted_rowid, uid_t uid) +EXPORT_API int notification_noti_delete_all(notification_type_e type, const char *app_id, int *num_deleted, int **list_deleted_rowid, uid_t uid) { int ret = NOTIFICATION_ERROR_NONE; int ret_tmp = NOTIFICATION_ERROR_NONE; @@ -1298,18 +1298,18 @@ EXPORT_API int notification_noti_delete_all(notification_type_e type, const char if (!db) return get_last_result(); - if (pkgname == NULL || strlen(pkgname) == 0) { + if (app_id == NULL || strlen(app_id) == 0) { if (type != NOTIFICATION_TYPE_NONE) snprintf(query_where, sizeof(query_where), "where type = %d and uid = %d", type, uid); } else { if (type == NOTIFICATION_TYPE_NONE) snprintf(query_where, sizeof(query_where), - "where caller_pkgname = '%s' and uid = %d", pkgname, uid); + "where caller_app_id = '%s' and uid = %d", app_id, uid); else snprintf(query_where, sizeof(query_where), - "where caller_pkgname = '%s' and type = %d and uid = %d", - pkgname, type, uid); + "where caller_app_id = '%s' and type = %d and uid = %d", + app_id, type, uid); } if (num_deleted != NULL) @@ -1407,13 +1407,13 @@ err: } /* LCOV_EXCL_START */ -EXPORT_API int notification_noti_delete_by_priv_id(const char *pkgname, int priv_id) +EXPORT_API int notification_noti_delete_by_priv_id(const char *app_id, int priv_id) { sqlite3 *db = NULL; char query[NOTIFICATION_QUERY_MAX] = { 0, }; int ret; - if (pkgname == NULL) + if (app_id == NULL) return NOTIFICATION_ERROR_INVALID_PARAMETER; db = notification_db_open(DBPATH); @@ -1421,7 +1421,7 @@ EXPORT_API int notification_noti_delete_by_priv_id(const char *pkgname, int priv return get_last_result(); snprintf(query, sizeof(query), "delete from noti_list " - "where caller_pkgname = '%s' and priv_id = %d", pkgname, + "where caller_app_id = '%s' and priv_id = %d", app_id, priv_id); ret = notification_db_exec(db, query, NULL); @@ -1433,7 +1433,7 @@ EXPORT_API int notification_noti_delete_by_priv_id(const char *pkgname, int priv } /* LCOV_EXCL_STOP */ -EXPORT_API int notification_noti_delete_by_priv_id_get_changes(const char *pkgname, int priv_id, int *num_changes, uid_t uid) +EXPORT_API int notification_noti_delete_by_priv_id_get_changes(const char *app_id, int priv_id, int *num_changes, uid_t uid) { sqlite3 *db = NULL; char query[NOTIFICATION_QUERY_MAX] = { 0, }; @@ -1443,13 +1443,13 @@ EXPORT_API int notification_noti_delete_by_priv_id_get_changes(const char *pkgna if (!db) return get_last_result(); - if (pkgname == NULL || strlen(pkgname) == 0) { + if (app_id == NULL || strlen(app_id) == 0) { snprintf(query, sizeof(query), "delete from noti_list " "where priv_id = %d and uid = %d", priv_id, uid); } else { snprintf(query, sizeof(query), "delete from noti_list " - "where caller_pkgname = '%s' and priv_id = %d and uid = %d", - pkgname, priv_id, uid); + "where caller_app_id = '%s' and priv_id = %d and uid = %d", + app_id, priv_id, uid); } ret = notification_db_exec(db, query, num_changes); @@ -1466,7 +1466,7 @@ EXPORT_API int notification_noti_delete_by_priv_id_get_changes(const char *pkgna /* todo refactoring */ /* LCOV_EXCL_START */ EXPORT_API int notification_noti_get_count(notification_type_e type, - const char *pkgname, + const char *app_id, int group_id, int priv_id, int *count, uid_t uid) { @@ -1492,32 +1492,32 @@ EXPORT_API int notification_noti_get_count(notification_type_e type, snprintf(query_base, sizeof(query_base), "select count(*) from noti_list "); - if (pkgname != NULL && strlen(pkgname) != 0) { + if (app_id != NULL && strlen(app_id) != 0) { if (group_id == NOTIFICATION_GROUP_ID_NONE) { if (priv_id == NOTIFICATION_PRIV_ID_NONE) { snprintf(query_where, sizeof(query_where), - "where caller_pkgname = '%s' and uid = %d ", - pkgname, uid); + "where caller_app_id = '%s' and uid = %d ", + app_id, uid); } else { internal_group_id = _notification_noti_get_internal_group_id_by_priv_id - (pkgname, priv_id, db); + (app_id, priv_id, db); snprintf(query_where, sizeof(query_where), - "where caller_pkgname = '%s' and internal_group_id = %d and uid = %d ", - pkgname, internal_group_id, uid); + "where caller_app_id = '%s' and internal_group_id = %d and uid = %d ", + app_id, internal_group_id, uid); } } else { if (priv_id == NOTIFICATION_PRIV_ID_NONE) { snprintf(query_where, sizeof(query_where), - "where caller_pkgname = '%s' and group_id = %d and uid = %d ", - pkgname, group_id, uid); + "where caller_app_id = '%s' and group_id = %d and uid = %d ", + app_id, group_id, uid); } else { internal_group_id = _notification_noti_get_internal_group_id_by_priv_id - (pkgname, priv_id, db); + (app_id, priv_id, db); snprintf(query_where, sizeof(query_where), - "where caller_pkgname = '%s' and internal_group_id = %d and uid = %d ", - pkgname, internal_group_id, uid); + "where caller_app_id = '%s' and internal_group_id = %d and uid = %d ", + app_id, internal_group_id, uid); } } } else { @@ -1605,7 +1605,7 @@ EXPORT_API int notification_noti_get_grouping_list(notification_type_e type, ret = vconf_get_int(VCONFKEY_TELEPHONY_SIM_SLOT, &status); snprintf(query_base, sizeof(query_base), "select " - "type, layout, pkg_id, caller_pkgname, launch_pkgname, image_path, group_id, priv_id, " + "type, layout, pkg_id, caller_app_id, launch_app_id, image_path, group_id, priv_id, " "tag, b_text, b_key, b_format_args, num_format_args, " "text_domain, text_dir, time, insert_time, args, group_args, " "b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, " @@ -1680,7 +1680,7 @@ err: return ret; } -EXPORT_API int notification_noti_get_detail_list(const char *pkgname, +EXPORT_API int notification_noti_get_detail_list(const char *app_id, int group_id, int priv_id, int count, notification_list_h *list, @@ -1707,7 +1707,7 @@ EXPORT_API int notification_noti_get_detail_list(const char *pkgname, ret = vconf_get_int(VCONFKEY_TELEPHONY_SIM_SLOT, &status); snprintf(query_base, sizeof(query_base), "select " - "type, layout, pkg_id, caller_pkgname, launch_pkgname, image_path, group_id, priv_id, " + "type, layout, pkg_id, caller_app_id, launch_app_id, image_path, group_id, priv_id, " "tag, b_text, b_key, b_format_args, num_format_args, " "text_domain, text_dir, time, insert_time, args, group_args, " "b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, " @@ -1723,24 +1723,24 @@ EXPORT_API int notification_noti_get_detail_list(const char *pkgname, if (priv_id == NOTIFICATION_PRIV_ID_NONE && group_id == NOTIFICATION_GROUP_ID_NONE) { if (status == VCONFKEY_TELEPHONY_SIM_INSERTED) snprintf(query_where, sizeof(query_where), - "where caller_pkgname = '%s' and uid = %d ", pkgname, uid); + "where caller_app_id = '%s' and uid = %d ", app_id, uid); else snprintf(query_where, sizeof(query_where), - "where caller_pkgname = '%s' and flag_simmode = 0 and uid = %d ", pkgname, uid); + "where caller_app_id = '%s' and flag_simmode = 0 and uid = %d ", app_id, uid); } else { internal_group_id = - _notification_noti_get_internal_group_id_by_priv_id(pkgname, + _notification_noti_get_internal_group_id_by_priv_id(app_id, priv_id, db); if (status == VCONFKEY_TELEPHONY_SIM_INSERTED) snprintf(query_where, sizeof(query_where), - "where caller_pkgname = '%s' and internal_group_id = %d and uid = %d ", - pkgname, internal_group_id, uid); + "where caller_app_id = '%s' and internal_group_id = %d and uid = %d ", + app_id, internal_group_id, uid); else snprintf(query_where, sizeof(query_where), - "where caller_pkgname = '%s' and internal_group_id = %d and flag_simmode = 0 and uid = %d ", - pkgname, internal_group_id, uid); + "where caller_app_id = '%s' and internal_group_id = %d and flag_simmode = 0 and uid = %d ", + app_id, internal_group_id, uid); } snprintf(query, sizeof(query), @@ -1803,7 +1803,7 @@ EXPORT_API int notification_noti_check_tag(notification_h noti) if (!db) return get_last_result(); - ret = sqlite3_prepare_v2(db, "SELECT priv_id FROM noti_list WHERE caller_pkgname = ? and tag = ?", -1, &stmt, NULL); + ret = sqlite3_prepare_v2(db, "SELECT priv_id FROM noti_list WHERE caller_app_id = ? and tag = ?", -1, &stmt, NULL); if (ret != SQLITE_OK) { NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db)); if (db) @@ -1811,7 +1811,7 @@ EXPORT_API int notification_noti_check_tag(notification_h noti) return NOTIFICATION_ERROR_OUT_OF_MEMORY; } - ret = sqlite3_bind_text(stmt, 1, noti->caller_pkgname, -1, SQLITE_TRANSIENT); + ret = sqlite3_bind_text(stmt, 1, noti->caller_app_id, -1, SQLITE_TRANSIENT); if (ret != SQLITE_OK) { NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db)); goto err; @@ -1861,7 +1861,7 @@ EXPORT_API int notification_noti_check_count_for_template(notification_h noti, i if (!db) return get_last_result(); - ret = sqlite3_prepare_v2(db, "SELECT COUNT(caller_pkgname) FROM noti_template WHERE caller_pkgname = ?", -1, &stmt, NULL); + ret = sqlite3_prepare_v2(db, "SELECT COUNT(caller_app_id) FROM noti_template WHERE caller_app_id = ?", -1, &stmt, NULL); if (ret != SQLITE_OK) { NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db)); if (db) @@ -1869,7 +1869,7 @@ EXPORT_API int notification_noti_check_count_for_template(notification_h noti, i return NOTIFICATION_ERROR_OUT_OF_MEMORY; } - ret = sqlite3_bind_text(stmt, 1, noti->caller_pkgname, -1, SQLITE_TRANSIENT); + ret = sqlite3_bind_text(stmt, 1, noti->caller_app_id, -1, SQLITE_TRANSIENT); if (ret != SQLITE_OK) { NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db)); goto err; @@ -1964,7 +1964,7 @@ static int _template_query_create(notification_h noti, char *template_name, char *query = sqlite3_mprintf("INSERT OR REPLACE INTO noti_template (" "type, " "layout, " - "pkg_id, caller_pkgname, launch_pkgname, " + "pkg_id, caller_app_id, launch_app_id, " "image_path, " "group_id, internal_group_id," "title_key, " @@ -2005,8 +2005,8 @@ static int _template_query_create(notification_h noti, char *template_name, char noti->type, noti->layout, NOTIFICATION_CHECK_STR(noti->pkg_id), - NOTIFICATION_CHECK_STR(noti->caller_pkgname), - NOTIFICATION_CHECK_STR(noti->launch_pkgname), + NOTIFICATION_CHECK_STR(noti->caller_app_id), + NOTIFICATION_CHECK_STR(noti->launch_app_id), NOTIFICATION_CHECK_STR(b_image_path), noti->group_id, noti->internal_group_id, NOTIFICATION_CHECK_STR(b_text), NOTIFICATION_CHECK_STR(b_key), @@ -2143,7 +2143,7 @@ EXPORT_API int notification_noti_add_template(notification_h noti, char *templat } if (title_key == NULL) - title_key = noti->caller_pkgname; + title_key = noti->caller_app_id; /* Bind query */ ret = _notification_noti_bind_query_text(stmt, "$tag", noti->tag); @@ -2186,13 +2186,13 @@ err: return ret; } -EXPORT_API int notification_noti_get_package_template(notification_h noti, char *pkgname, char *template_name) +EXPORT_API int notification_noti_get_package_template(notification_h noti, char *app_id, char *template_name) { int ret = 0; sqlite3 *db = NULL; sqlite3_stmt *stmt = NULL; - if (noti == NULL || pkgname == NULL || template_name == NULL) { + if (noti == NULL || app_id == NULL || template_name == NULL) { NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); return NOTIFICATION_ERROR_INVALID_PARAMETER; } @@ -2202,7 +2202,7 @@ EXPORT_API int notification_noti_get_package_template(notification_h noti, char return get_last_result(); ret = sqlite3_prepare_v2(db, "select " - "type, layout, pkg_id, caller_pkgname, launch_pkgname, image_path, group_id, priv_id, " + "type, layout, pkg_id, caller_app_id, launch_app_id, image_path, group_id, priv_id, " "tag, b_text, b_key, b_format_args, num_format_args, " "text_domain, text_dir, time, insert_time, args, group_args, " "b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, " @@ -2213,13 +2213,13 @@ EXPORT_API int notification_noti_get_package_template(notification_h noti, char "flags_for_property, display_applist, progress_size, progress_percentage, ongoing_flag, ongoing_value_type, " "ongoing_current, ongoing_duration, auto_remove, default_button_index, hide_timeout, delete_timeout, " "text_input_max_length, event_flag, extension_image_size, uid " - "from noti_template where caller_pkgname = ? and template_name = ?", -1, &stmt, NULL); + "from noti_template where caller_app_id = ? and template_name = ?", -1, &stmt, NULL); if (ret != SQLITE_OK) { NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db)); return NOTIFICATION_ERROR_OUT_OF_MEMORY; } - ret = sqlite3_bind_text(stmt, 1, pkgname, -1, SQLITE_TRANSIENT); + ret = sqlite3_bind_text(stmt, 1, app_id, -1, SQLITE_TRANSIENT); if (ret != SQLITE_OK) { NOTIFICATION_ERR("Error: %s\n", sqlite3_errmsg(db)); goto err; @@ -2251,13 +2251,13 @@ err: return ret; } -EXPORT_API int notification_noti_delete_template(const char *pkgname) +EXPORT_API int notification_noti_delete_template(const char *pkg_id) { sqlite3 *db = NULL; char query[NOTIFICATION_QUERY_MAX] = { 0, }; int ret; - if (pkgname == NULL) + if (pkg_id == NULL) return NOTIFICATION_ERROR_INVALID_PARAMETER; db = notification_db_open(DBPATH); @@ -2265,7 +2265,7 @@ EXPORT_API int notification_noti_delete_template(const char *pkgname) return get_last_result(); snprintf(query, sizeof(query), "delete from noti_template " - "where pkg_id = '%s'", pkgname); + "where pkg_id = '%s'", pkg_id); ret = notification_db_exec(db, query, NULL); diff --git a/src/notification_ongoing.c b/src/notification_ongoing.c index 0bf79c8..b9f58f0 100755 --- a/src/notification_ongoing.c +++ b/src/notification_ongoing.c @@ -50,7 +50,7 @@ static void __notification_ongoing_update_callback(GDBusConnection *connection, gpointer user_data) { struct ongoing_info_s *info; - char *pkgname = NULL; + char *app_id = NULL; int priv_id = 0; double progress = 0; double size = 0; @@ -65,26 +65,25 @@ static void __notification_ongoing_update_callback(GDBusConnection *connection, } if (g_strcmp0(signal_name, MEMBER_PROGRESS) == 0) { - g_variant_get(parameters, "(&sid)", &pkgname, &priv_id, &progress); + g_variant_get(parameters, "(&sid)", &app_id, &priv_id, &progress); info->type = ONGOING_TYPE_PROGRESS; } else if (g_strcmp0(signal_name, MEMBER_SIZE) == 0) { - g_variant_get(parameters, "(&sid)", &pkgname, &priv_id, &size); + g_variant_get(parameters, "(&sid)", &app_id, &priv_id, &size); info->type = ONGOING_TYPE_SIZE; - } else if (g_strcmp0(signal_name, MEMBER_CONTENT) == 0) { - g_variant_get(parameters, "(&si&s)", &pkgname, &priv_id, &content); + g_variant_get(parameters, "(&si&s)", &app_id, &priv_id, &content); info->type = ONGOING_TYPE_CONTENT; } - if (pkgname == NULL) { + if (app_id == NULL) { /* LCOV_EXCL_START */ - NOTIFICATION_ERR("pkgname is null"); + NOTIFICATION_ERR("app_id is null"); free(info); return; /* LCOV_EXCL_STOP */ } - info->pkgname = pkgname; + info->pkgname = app_id; info->priv_id = priv_id; info->progress = progress; info->size = size; @@ -215,13 +214,13 @@ int notification_ongoing_update_cb_unset(void) return NOTIFICATION_ERROR_NONE; } -int notification_ongoing_update_progress(const char *caller_pkgname, +int notification_ongoing_update_progress(const char *caller_app_id, int priv_id, double progress) { GVariant *param; int ret; - param = g_variant_new("(sid)", caller_pkgname, priv_id, progress); + param = g_variant_new("(sid)", caller_app_id, priv_id, progress); ret = __send_ongoing_update_signal(MEMBER_PROGRESS, param); if (ret != NOTIFICATION_ERROR_NONE) { @@ -235,13 +234,13 @@ int notification_ongoing_update_progress(const char *caller_pkgname, return NOTIFICATION_ERROR_NONE; } -int notification_ongoing_update_size(const char *caller_pkgname, +int notification_ongoing_update_size(const char *caller_app_id, int priv_id, double size) { GVariant *param; int ret; - param = g_variant_new("(sid)", caller_pkgname, priv_id, size); + param = g_variant_new("(sid)", caller_app_id, priv_id, size); ret = __send_ongoing_update_signal(MEMBER_SIZE, param); if (ret != NOTIFICATION_ERROR_NONE) { @@ -255,13 +254,13 @@ int notification_ongoing_update_size(const char *caller_pkgname, return NOTIFICATION_ERROR_NONE; } -int notification_ongoing_update_content(const char *caller_pkgname, +int notification_ongoing_update_content(const char *caller_app_id, int priv_id, const char *content) { GVariant *param; int ret; - param = g_variant_new("(sis)", caller_pkgname, priv_id, content); + param = g_variant_new("(sis)", caller_app_id, priv_id, content); ret = __send_ongoing_update_signal(MEMBER_CONTENT, param); if (ret != NOTIFICATION_ERROR_NONE) { diff --git a/src/notification_setting.c b/src/notification_setting.c index db6cb27..385f887 100755 --- a/src/notification_setting.c +++ b/src/notification_setting.c @@ -64,14 +64,14 @@ EXPORT_API int notification_setting_get_setting_array(notification_setting_h *se return notification_setting_get_setting_array_for_uid(setting_array, count, getuid()); } -EXPORT_API int notification_setting_get_setting_by_appid_for_uid(const char *appid, notification_setting_h *setting, uid_t uid) +EXPORT_API int notification_setting_get_setting_by_appid_for_uid(const char *app_id, notification_setting_h *setting, uid_t uid) { - if (appid == NULL || setting == NULL) { + if (app_id == NULL || setting == NULL) { NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); return NOTIFICATION_ERROR_INVALID_PARAMETER; } - return notification_ipc_request_get_setting_by_appid(appid, setting, uid); + return notification_ipc_request_get_setting_by_app_id(app_id, setting, uid); } /* LCOV_EXCL_START */ @@ -87,7 +87,7 @@ EXPORT_API int notification_setting_get_setting(notification_setting_h *setting) int ret; char *package_name = NULL; - package_name = notification_get_pkgname_by_pid(); + package_name = notification_get_app_id_by_pid(); if (package_name == NULL) return NOTIFICATION_ERROR_NOT_EXIST_ID; @@ -117,19 +117,19 @@ EXPORT_API int notification_setting_get_package_name(notification_setting_h sett return NOTIFICATION_ERROR_NONE; } -EXPORT_API int notification_setting_get_appid(notification_setting_h setting, char **appid) +EXPORT_API int notification_setting_get_appid(notification_setting_h setting, char **app_id) { - if (setting == NULL || appid == NULL) { + if (setting == NULL || app_id == NULL) { NOTIFICATION_ERR("Invalid parameter"); return NOTIFICATION_ERROR_INVALID_PARAMETER; } - if (setting->appid == NULL) { - NOTIFICATION_ERR("setting->appid is null"); + if (setting->app_id == NULL) { + NOTIFICATION_ERR("setting->app_id is null"); return NOTIFICATION_ERROR_NOT_EXIST_ID; } - *appid = SAFE_STRDUP(setting->appid); + *app_id = SAFE_STRDUP(setting->app_id); return NOTIFICATION_ERROR_NONE; } @@ -287,7 +287,7 @@ EXPORT_API int notification_setting_free_notification(notification_setting_h set } SAFE_FREE(setting->package_name); - SAFE_FREE(setting->appid); + SAFE_FREE(setting->app_id); /* add codes to free all properties */ @@ -296,15 +296,15 @@ EXPORT_API int notification_setting_free_notification(notification_setting_h set return NOTIFICATION_ERROR_NONE; } -static bool _is_package_in_setting_table(sqlite3 *db, const char *package_name, const char* appid, uid_t uid) +static bool _is_package_in_setting_table(sqlite3 *db, const char *package_name, const char* app_id, uid_t uid) { sqlite3_stmt *db_statement = NULL; int sqlite3_ret = SQLITE_OK; bool err = true; int field_index = 1; - if (appid != NULL) - sqlite3_ret = sqlite3_prepare_v2(db, "SELECT appid FROM notification_setting WHERE uid = ? AND package_name = ? AND appid = ?", -1, &db_statement, NULL); + if (app_id != NULL) + sqlite3_ret = sqlite3_prepare_v2(db, "SELECT app_id FROM notification_setting WHERE uid = ? AND package_name = ? AND app_id = ?", -1, &db_statement, NULL); else sqlite3_ret = sqlite3_prepare_v2(db, "SELECT package_name FROM notification_setting WHERE uid = ? AND package_name = ?", -1, &db_statement, NULL); @@ -316,12 +316,12 @@ static bool _is_package_in_setting_table(sqlite3 *db, const char *package_name, sqlite3_bind_int(db_statement, field_index++, uid); sqlite3_bind_text(db_statement, field_index++, package_name, -1, SQLITE_TRANSIENT); - if (appid != NULL) - sqlite3_bind_text(db_statement, field_index++, appid, -1, SQLITE_TRANSIENT); + if (app_id != NULL) + sqlite3_bind_text(db_statement, field_index++, app_id, -1, SQLITE_TRANSIENT); sqlite3_ret = sqlite3_step(db_statement); if (sqlite3_ret == SQLITE_DONE) { - NOTIFICATION_INFO("no matched appid from package_name found[%s][%s][%d]", package_name, appid, sqlite3_ret); + NOTIFICATION_INFO("no matched app_id from package_name found[%s][%s][%d]", package_name, app_id, sqlite3_ret); err = false; goto out; } @@ -347,10 +347,10 @@ static int foreach_app_info_callback(const pkgmgrinfo_appinfo_h handle, void *us int err = true; int field_index = 1; int sqlite3_ret = SQLITE_OK; - char *appid = NULL; + char *app_id = NULL; char *package_name = NULL; - pkgmgr_ret = pkgmgrinfo_appinfo_get_appid(handle, &appid); + pkgmgr_ret = pkgmgrinfo_appinfo_get_appid(handle, &app_id); if (pkgmgr_ret != PACKAGE_MANAGER_ERROR_NONE) { NOTIFICATION_ERR("pkgmgrinfo_appinfo_get_appid failed [%d]", pkgmgr_ret); err = false; @@ -363,14 +363,14 @@ static int foreach_app_info_callback(const pkgmgrinfo_appinfo_h handle, void *us goto out; } - if (_is_package_in_setting_table(db, package_name, appid, info->uid) == true) { - NOTIFICATION_INFO("uid %d [%s] is exist", info->uid, appid); + if (_is_package_in_setting_table(db, package_name, app_id, info->uid) == true) { + NOTIFICATION_INFO("uid %d [%s] is exist", info->uid, app_id); err = false; goto out; } - NOTIFICATION_INFO("uid %d package_name %s [%s] will be inserted", info->uid, package_name, appid); - sqlite3_ret = sqlite3_prepare_v2(db, "INSERT INTO notification_setting (uid, package_name, appid) " + NOTIFICATION_INFO("uid %d package_name %s [%s] will be inserted", info->uid, package_name, app_id); + sqlite3_ret = sqlite3_prepare_v2(db, "INSERT INTO notification_setting (uid, package_name, app_id) " "VALUES (?, ?, ?) ", -1, &db_statement, NULL); if (sqlite3_ret != SQLITE_OK) { @@ -381,7 +381,7 @@ static int foreach_app_info_callback(const pkgmgrinfo_appinfo_h handle, void *us sqlite3_bind_int(db_statement, field_index++, info->uid); sqlite3_bind_text(db_statement, field_index++, package_name, -1, SQLITE_TRANSIENT); - sqlite3_bind_text(db_statement, field_index++, appid, -1, SQLITE_TRANSIENT); + sqlite3_bind_text(db_statement, field_index++, app_id, -1, SQLITE_TRANSIENT); sqlite3_ret = sqlite3_step(db_statement); diff --git a/src/notification_setting_service.c b/src/notification_setting_service.c index 1a6ec11..835b72c 100644 --- a/src/notification_setting_service.c +++ b/src/notification_setting_service.c @@ -91,7 +91,7 @@ out: } EXPORT_API -int noti_setting_service_get_setting_by_appid(const char *appid, notification_setting_h *setting, uid_t uid) +int noti_setting_service_get_setting_by_app_id(const char *app_id, notification_setting_h *setting, uid_t uid) { int err = NOTIFICATION_ERROR_NONE; sqlite3 *local_db_handle = NULL; @@ -104,7 +104,7 @@ int noti_setting_service_get_setting_by_appid(const char *appid, notification_se int col_index = 0; notification_setting_h result_setting_array = NULL; - if (appid == NULL || setting == NULL) { + if (app_id == NULL || setting == NULL) { NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); /* LCOV_EXCL_LINE */ err = NOTIFICATION_ERROR_INVALID_PARAMETER; goto out; @@ -118,9 +118,9 @@ int noti_setting_service_get_setting_by_appid(const char *appid, notification_se goto out; } - sql_query = sqlite3_mprintf("SELECT package_name, appid, allow_to_notify, do_not_disturb_except, visibility_class, " + sql_query = sqlite3_mprintf("SELECT package_name, app_id, allow_to_notify, do_not_disturb_except, visibility_class, " "pop_up_notification, lock_screen_content_level, app_disabled FROM %s " - "WHERE appid = %Q AND uid = %d", NOTIFICATION_SETTING_DB_TABLE, appid, uid); + "WHERE app_id = %Q AND uid = %d", NOTIFICATION_SETTING_DB_TABLE, app_id, uid); if (!sql_query) { NOTIFICATION_ERR("fail to alloc query"); /* LCOV_EXCL_LINE */ @@ -136,7 +136,7 @@ int noti_setting_service_get_setting_by_appid(const char *appid, notification_se } if (!row_count) { - NOTIFICATION_DBG("No setting found for [%s]", appid); /* LCOV_EXCL_LINE */ + NOTIFICATION_DBG("No setting found for [%s]", app_id); /* LCOV_EXCL_LINE */ err = NOTIFICATION_ERROR_NOT_EXIST_ID; goto out; } @@ -154,7 +154,7 @@ int noti_setting_service_get_setting_by_appid(const char *appid, notification_se col_index = column_count; _get_table_field_data_string(query_result, &(result_setting_array[i].package_name), 1, col_index++); - _get_table_field_data_string(query_result, &(result_setting_array[i].appid), 1, col_index++); + _get_table_field_data_string(query_result, &(result_setting_array[i].app_id), 1, col_index++); _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++); @@ -208,9 +208,9 @@ int noti_setting_get_setting_array(notification_setting_h *setting_array, int *c goto out; } - sql_query = sqlite3_mprintf("SELECT package_name, appid, allow_to_notify, do_not_disturb_except, visibility_class, " + sql_query = sqlite3_mprintf("SELECT package_name, app_id, allow_to_notify, do_not_disturb_except, visibility_class, " "pop_up_notification, lock_screen_content_level, app_disabled FROM %s WHERE uid = %d AND app_disabled = %d " - "ORDER BY package_name, appid ", NOTIFICATION_SETTING_DB_TABLE, uid, 0); + "ORDER BY package_name, app_id ", NOTIFICATION_SETTING_DB_TABLE, uid, 0); if (!sql_query) { NOTIFICATION_ERR("fail to alloc query"); /* LCOV_EXCL_LINE */ @@ -243,7 +243,7 @@ int noti_setting_get_setting_array(notification_setting_h *setting_array, int *c for (i = 0; i < row_count; i++) { _get_table_field_data_string(query_result, &(result_setting_array[i].package_name), 1, col_index++); - _get_table_field_data_string(query_result, &(result_setting_array[i].appid), 1, col_index++); + _get_table_field_data_string(query_result, &(result_setting_array[i].app_id), 1, col_index++); _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, (int *)&(result_setting_array[i].visibility_class), col_index++); @@ -373,7 +373,7 @@ out: } EXPORT_API -int notification_setting_db_update(const char *package_name, const char *appid, +int notification_setting_db_update(const char *package_name, const char *app_id, int allow_to_notify, int do_not_disturb_except, int visibility_class, int pop_up_notification, int lock_screen_content_level, uid_t uid) @@ -384,7 +384,7 @@ int notification_setting_db_update(const char *package_name, const char *appid, int sqlret; if (package_name == NULL || strlen(package_name) == 0 - || appid == NULL || strlen(appid) == 0) + || app_id == NULL || strlen(app_id) == 0) return NOTIFICATION_ERROR_INVALID_PARAMETER; sqlret = db_util_open(DBPATH, &db, 0); @@ -395,9 +395,9 @@ int notification_setting_db_update(const char *package_name, const char *appid, 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 appid = %Q AND package_name = %Q AND uid = %d", + "WHERE app_id = %Q AND package_name = %Q AND uid = %d", NOTIFICATION_SETTING_DB_TABLE, allow_to_notify, do_not_disturb_except, visibility_class, - pop_up_notification, lock_screen_content_level, appid, package_name, uid); + pop_up_notification, lock_screen_content_level, app_id, package_name, uid); if (!sqlbuf) { NOTIFICATION_ERR("fail to alloc query"); err = NOTIFICATION_ERROR_OUT_OF_MEMORY; @@ -589,7 +589,7 @@ err: return ret; } -EXPORT_API int notification_get_dnd_and_allow_to_notify(const char *appid, +EXPORT_API int notification_get_dnd_and_allow_to_notify(const char *app_id, int *do_not_disturb, int *do_not_disturb_except, int *allow_to_notify, @@ -606,7 +606,7 @@ EXPORT_API int notification_get_dnd_and_allow_to_notify(const char *appid, char *query_system_setting = NULL; char **query_system_setting_result = NULL; - if (appid == NULL) + if (app_id == NULL) return NOTIFICATION_ERROR_INVALID_PARAMETER; db = notification_db_open(DBPATH); @@ -614,9 +614,9 @@ EXPORT_API int notification_get_dnd_and_allow_to_notify(const char *appid, return get_last_result(); query_setting = sqlite3_mprintf("SELECT allow_to_notify, do_not_disturb_except " \ - "FROM %s WHERE appid = %Q AND (uid = %d OR uid = %d) " \ + "FROM %s WHERE app_id = %Q AND (uid = %d OR uid = %d) " \ "ORDER BY uid DESC;", - NOTIFICATION_SETTING_DB_TABLE, appid, + NOTIFICATION_SETTING_DB_TABLE, app_id, uid, tzplatform_getuid(TZ_SYS_GLOBALAPP_USER)); if (query_setting == NULL) { NOTIFICATION_ERR("fail to alloc query"); @@ -640,7 +640,7 @@ EXPORT_API int notification_get_dnd_and_allow_to_notify(const char *appid, goto out; } if (row_count == 0) { - NOTIFICATION_ERR("Invalid uid [%d] or app id [%s]", uid, appid); + NOTIFICATION_ERR("Invalid uid [%d] or app id [%s]", uid, app_id); ret = NOTIFICATION_ERROR_INVALID_PARAMETER; goto out; } @@ -861,14 +861,14 @@ out: } /* LCOV_EXCL_START */ -EXPORT_API int notification_setting_db_update_app_disabled(const char *appid, bool value, uid_t uid) +EXPORT_API int notification_setting_db_update_app_disabled(const char *app_id, bool value, uid_t uid) { int err = NOTIFICATION_ERROR_NONE; int sqlret; sqlite3 *db = NULL; char *sqlbuf = NULL; - if (appid == NULL) + if (app_id == NULL) return NOTIFICATION_ERROR_INVALID_PARAMETER; sqlret = db_util_open(DBPATH, &db, 0); @@ -878,8 +878,8 @@ EXPORT_API int notification_setting_db_update_app_disabled(const char *appid, bo } sqlbuf = sqlite3_mprintf("UPDATE notification_setting SET " \ - "app_disabled = %d WHERE appid = %Q AND uid = %d", - value, appid, uid); + "app_disabled = %d WHERE app_id = %Q AND uid = %d", + value, app_id, uid); if (!sqlbuf) { NOTIFICATION_ERR("fail to alloc query"); err = NOTIFICATION_ERROR_OUT_OF_MEMORY; -- cgit v1.2.3