diff options
author | Kyuho Jo <kyuho.jo@samsung.com> | 2015-08-19 17:12:14 +0900 |
---|---|---|
committer | Kyuho Jo <kyuho.jo@samsung.com> | 2015-08-19 22:05:21 +0900 |
commit | ba887a84aa3aa90d5eaf6e324746ec1613d54256 (patch) | |
tree | 65b8851b4b2b6fd77a4a2b99cfa6a27395047a8f | |
parent | b40e50b468f1cb442cb1c01d238b1e313461eb49 (diff) | |
download | notification-ba887a84aa3aa90d5eaf6e324746ec1613d54256.tar.gz notification-ba887a84aa3aa90d5eaf6e324746ec1613d54256.tar.bz2 notification-ba887a84aa3aa90d5eaf6e324746ec1613d54256.zip |
1. Merge latest code from tizen 2.4submit/tizen/20150820.023311
2. Move db file to /usr/dbspace
3. Remove redundant files
Change-Id: I62f24661ea645cd28099821cd0c25552e0d3c9f3
Signed-off-by: Kyuho Jo <kyuho.jo@samsung.com>
39 files changed, 588 insertions, 5318 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 605237d..8dad647 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ SET(LIBDIR ${LIB_INSTALL_DIR}) SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}") SET(ICONDIR "${PREFIX}/share/${PROJECT_NAME}") SET(RESDIR "${PREFIX}/share/${PROJECT_NAME}") -SET(DBDIR "/opt/dbspace") +SET(DBDIR "/usr/dbspace") SET(IMGDIR "${RESDIR}/images") SET(DBFILE ".notification.db") SET(MAJOR_VER 0) @@ -25,6 +25,7 @@ SET(SRCS ./src/notification_status.c ./src/notification_ipc.c ./src/notification_setting.c + ./src/notification_internal.c ./src/notification_old.c) SET(HEADERS-DEVEL ./include/notification.h @@ -58,8 +59,11 @@ pkg_check_modules(pkgs REQUIRED dbus-1 dbus-glib-1 com-core + appcore-common capi-appfw-application + capi-appfw-app-manager capi-appfw-package-manager + pkgmgr-info edbus elementary ecore diff --git a/TC/_export_env.sh b/TC/_export_env.sh deleted file mode 100644 index 7a317f8..0000000 --- a/TC/_export_env.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -source ./config - -export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path -#export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-simulator # tetware target path -export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path -export PATH=$TET_TARGET_PATH/bin:$PATH -export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH -export TET_ROOT=$TET_TARGET_PATH diff --git a/TC/_export_target_env.sh b/TC/_export_target_env.sh deleted file mode 100644 index 5e005cf..0000000 --- a/TC/_export_target_env.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -. ./config - -export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path -#export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-simulator -export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target -export PATH=$TET_TARGET_PATH/bin:$PATH -export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH -export TET_ROOT=$TET_TARGET_PATH diff --git a/TC/build.sh b/TC/build.sh deleted file mode 100644 index 72aad6c..0000000 --- a/TC/build.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -. ./_export_env.sh # setting environment variables - -export TET_SUITE_ROOT=`pwd` -FILE_NAME_EXTENSION=`date +%s` - -RESULT_DIR=results -HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html -JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal - -mkdir -p $RESULT_DIR - -tcc -c -p ./ -tcc -b -j $JOURNAL_RESULT -p ./ -grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/clean.sh b/TC/clean.sh deleted file mode 100644 index 29743e0..0000000 --- a/TC/clean.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -. ./_export_env.sh # setting environment variables - -export TET_SUITE_ROOT=`pwd` -RESULT_DIR=results - -tcc -c -p ./ # executing tcc, with clean option (-c) -rm -r $RESULT_DIR -rm -r tet_tmp_dir -rm testcase/tet_captured diff --git a/TC/config b/TC/config deleted file mode 100644 index e3b6f33..0000000 --- a/TC/config +++ /dev/null @@ -1,3 +0,0 @@ -PKG_NAME=notification -TET_INSTALL_HOST_PATH=/var/tmp/dts_fw/TC/TETware -TET_INSTALL_TARGET_PATH=/opt/home/$PKG_NAME/TETware diff --git a/TC/push.sh b/TC/push.sh deleted file mode 100644 index 5eb9510..0000000 --- a/TC/push.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -. ./config - -TC_PATH=/opt/home/$PKG_NAME - -echo $TC_PATH - -sdb shell "mkdir -p $TC_PATH" - -sdb push . $TC_PATH - - diff --git a/TC/run.sh b/TC/run.sh deleted file mode 100644 index cec5778..0000000 --- a/TC/run.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -source ./_export_target_env.sh - -export TET_SUITE_ROOT=`pwd` -FILE_NAME_EXTENSION=`date +%s` - -RESULT_DIR=results -HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html -JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal - -mkdir -p $RESULT_DIR - -tcc -e -j $JOURNAL_RESULT -p ./ -grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/testcase/Makefile b/TC/testcase/Makefile deleted file mode 100644 index 2f5ca3d..0000000 --- a/TC/testcase/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -include ../config - -CC ?= gcc - -C_FILES = $(shell ls *.c) - -PKGS = $(PKG_NAME) -PKGS += glib-2.0 -LDFLAGS = `pkg-config --libs $(PKGS)` -LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o -LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s -LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s - -CFLAGS = -I. `pkg-config --cflags $(PKGS)` -CFLAGS += -I$(TET_ROOT)/inc/tet3 -CFLAGS += -Wall - -TCS := $(shell ls -1 *.c | cut -d. -f1) - -all: $(TCS) - -%: %.c - $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) - -clean: - rm -f $(TCS) diff --git a/TC/testcase/tslist b/TC/testcase/tslist deleted file mode 100644 index 90e5298..0000000 --- a/TC/testcase/tslist +++ /dev/null @@ -1,4 +0,0 @@ -/testcase/utc_notification -/testcase/utc_notification_list -/testcase/utc_notification_setting -/testcase/utc_notification_status
\ No newline at end of file diff --git a/TC/testcase/utc_notification.c b/TC/testcase/utc_notification.c deleted file mode 100644 index 527a11f..0000000 --- a/TC/testcase/utc_notification.c +++ /dev/null @@ -1,2369 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <fcntl.h> -#include <libintl.h> -#include <tet_api.h> -#include <notification.h> - -#define TEST_PKG "org.tizen.tetware" - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -static void startup(void); -static void cleanup(void); - -static void utc_notification_create_1_n(void); -static void utc_notification_create_2_n(void); -static void utc_notification_create_1_p(void); -static void utc_notification_create_2_p(void); -static void utc_notification_set_image_n(void); -static void utc_notification_set_image_p(void); -static void utc_notification_get_image_n(void); -static void utc_notification_get_image_p(void); -static void utc_notification_set_time_n(void); -static void utc_notification_set_time_p(void); -static void utc_notification_get_time_n(void); -static void utc_notification_get_time_p(void); -static void utc_notification_get_insert_time_n(void); -static void utc_notification_get_insert_time_p(void); -static void utc_notification_set_text_n(void); -static void utc_notification_set_text_p(void); -static void utc_notification_get_text_n(void); -static void utc_notification_get_text_p(void); -static void utc_notification_set_text_domain_n(void); -static void utc_notification_set_text_domain_p(void); -static void utc_notification_get_text_domain_n(void); -static void utc_notification_get_text_domain_p(void); -static void utc_notification_set_time_to_text_n(void); -static void utc_notification_set_time_to_text_p(void); -static void utc_notification_get_time_from_text_n(void); -static void utc_notification_get_time_from_text_p(void); -static void utc_notification_set_sound_n(void); -static void utc_notification_set_sound_p(void); -static void utc_notification_get_sound_n(void); -static void utc_notification_get_sound_p(void); -static void utc_notification_set_vibration_n(void); -static void utc_notification_set_vibration_p(void); -static void utc_notification_get_vibration_n(void); -static void utc_notification_get_vibration_p(void); -static void utc_notification_set_led_n(void); -static void utc_notification_set_led_p(void); -static void utc_notification_get_led_n(void); -static void utc_notification_get_led_p(void); -static void utc_notification_set_led_time_period_n(void); -static void utc_notification_set_led_time_period_p(void); -static void utc_notification_get_led_time_period_n(void); -static void utc_notification_get_led_time_period_p(void); -static void utc_notification_set_application_n(void); -static void utc_notification_set_application_p(void); -static void utc_notification_get_application_n(void); -static void utc_notification_get_application_p(void); -static void utc_notification_set_launch_option_n(void); -static void utc_notification_set_launch_option_p(void); -static void utc_notification_get_launch_option_n(void); -static void utc_notification_get_launch_option_p(void); -static void utc_notification_set_execute_option_n(void); -static void utc_notification_set_execute_option_p(void); -static void utc_notification_get_execute_option_n(void); -static void utc_notification_get_execute_option_p(void); -static void utc_notification_set_property_n(void); -static void utc_notification_set_property_p(void); -static void utc_notification_get_property_n(void); -static void utc_notification_get_property_p(void); -static void utc_notification_set_display_applist_n(void); -static void utc_notification_set_display_applist_p(void); -static void utc_notification_get_display_applist_n(void); -static void utc_notification_get_display_applist_p(void); -static void utc_notification_set_size_n(void); -static void utc_notification_set_size_p(void); -static void utc_notification_get_size_n(void); -static void utc_notification_get_size_p(void); -static void utc_notification_set_progress_n(void); -static void utc_notification_set_progress_p(void); -static void utc_notification_get_progress_n(void); -static void utc_notification_get_progress_p(void); -static void utc_notification_set_pkgname_n(void); -static void utc_notification_set_pkgname_p(void); -static void utc_notification_get_pkgname_n(void); -static void utc_notification_get_pkgname_p(void); -static void utc_notification_set_layout_n(void); -static void utc_notification_set_layout_p(void); -static void utc_notification_get_layout_n(void); -static void utc_notification_get_layout_p(void); -static void utc_notification_get_id_n(void); -static void utc_notification_get_id_p(void); -static void utc_notification_get_type_n(void); -static void utc_notification_get_type_p(void); -static void utc_notification_insert_n(void); -static void utc_notification_insert_p(void); -static void utc_notification_clear_n(void); -static void utc_notification_clear_p(void); -static void utc_notification_update_n(void); -static void utc_notification_update_p(void); -static void utc_notification_delete_all_by_type_n(void); -static void utc_notification_delete_all_by_type_p(void); -static void utc_notification_delete_by_priv_id_n(void); -static void utc_notification_delete_by_priv_id_p(void); -static void utc_notification_delete_n(void); -static void utc_notification_delete_p(void); -static void utc_notification_update_progress_n(void); -static void utc_notification_update_progress_p(void); -static void utc_notification_update_size_n(void); -static void utc_notification_update_size_p(void); -static void utc_notification_update_content_n(void); -static void utc_notification_update_content_p(void); -static void utc_notification_new_1_n(void); -static void utc_notification_new_2_n(void); -static void utc_notification_new_1_p(void); -static void utc_notification_new_2_p(void); -static void utc_notification_load_n(void); -static void utc_notification_load_p(void); -static void utc_notification_clone_n(void); -static void utc_notification_clone_p(void); -static void utc_notification_free_n(void); -static void utc_notification_free_p(void); -static void utc_notification_resister_changed_cb_n(void); -static void utc_notification_resister_changed_cb_p(void); -static void utc_notification_unresister_changed_cb_n(void); -static void utc_notification_unresister_changed_cb_p(void); -static void utc_notification_register_detailed_changed_cb_n(void); -static void utc_notification_register_detailed_changed_cb_p(void); -static void utc_notification_unregister_detailed_changed_cb_n(void); -static void utc_notification_unregister_detailed_changed_cb_p(void); -static void utc_notification_get_count_n(void); -static void utc_notification_get_count_p(void); -static void utc_notification_get_list_n(void); -static void utc_notification_get_list_p(void); -static void utc_notification_get_grouping_list_n(void); -static void utc_notification_get_grouping_list_p(void); -static void utc_notification_get_detail_list_n(void); -static void utc_notification_get_detail_list_p(void); -static void utc_notification_free_list_n(void); -static void utc_notification_free_list_p(void); -static void utc_notification_op_get_data_n(void); -static void utc_notification_op_get_data_p(void); -static void utc_notification_is_service_ready_p(void); -static void utc_notification_add_deferred_task_n(void); -static void utc_notification_add_deferred_task_p(void); -static void utc_notification_del_deferred_task_n(void); -static void utc_notification_del_deferred_task_p(void); - -void (*tet_startup)(void) = startup; -void (*tet_cleanup)(void) = cleanup; - -struct tet_testlist tet_testlist[] = { - {utc_notification_create_1_n, NEGATIVE_TC_IDX}, - {utc_notification_create_2_n, NEGATIVE_TC_IDX}, - {utc_notification_create_1_p, POSITIVE_TC_IDX}, - {utc_notification_create_2_p, POSITIVE_TC_IDX}, - {utc_notification_set_image_n, NEGATIVE_TC_IDX}, - {utc_notification_set_image_p, POSITIVE_TC_IDX}, - {utc_notification_get_image_n, NEGATIVE_TC_IDX}, - {utc_notification_get_image_p, POSITIVE_TC_IDX}, - {utc_notification_set_time_n, NEGATIVE_TC_IDX}, - {utc_notification_set_time_p, POSITIVE_TC_IDX}, - {utc_notification_get_time_n, NEGATIVE_TC_IDX}, - {utc_notification_get_time_p, POSITIVE_TC_IDX}, - {utc_notification_get_insert_time_n, NEGATIVE_TC_IDX}, - {utc_notification_get_insert_time_p, POSITIVE_TC_IDX}, - {utc_notification_set_text_n, NEGATIVE_TC_IDX}, - {utc_notification_set_text_p, POSITIVE_TC_IDX}, - {utc_notification_get_text_n, NEGATIVE_TC_IDX}, - {utc_notification_get_text_p, POSITIVE_TC_IDX}, - {utc_notification_set_text_domain_n, NEGATIVE_TC_IDX}, - {utc_notification_set_text_domain_p, POSITIVE_TC_IDX}, - {utc_notification_get_text_domain_n, NEGATIVE_TC_IDX}, - {utc_notification_get_text_domain_p, POSITIVE_TC_IDX}, - {utc_notification_set_time_to_text_n, NEGATIVE_TC_IDX}, - {utc_notification_set_time_to_text_p, POSITIVE_TC_IDX}, - {utc_notification_get_time_from_text_n, NEGATIVE_TC_IDX}, - {utc_notification_get_time_from_text_p, POSITIVE_TC_IDX}, - {utc_notification_set_sound_n, NEGATIVE_TC_IDX}, - {utc_notification_set_sound_p, POSITIVE_TC_IDX}, - {utc_notification_get_sound_n, NEGATIVE_TC_IDX}, - {utc_notification_get_sound_p, POSITIVE_TC_IDX}, - {utc_notification_set_vibration_n, NEGATIVE_TC_IDX}, - {utc_notification_set_vibration_p, POSITIVE_TC_IDX}, - {utc_notification_get_vibration_n, NEGATIVE_TC_IDX}, - {utc_notification_get_vibration_p, POSITIVE_TC_IDX}, - {utc_notification_set_led_n, NEGATIVE_TC_IDX}, - {utc_notification_set_led_p, POSITIVE_TC_IDX}, - {utc_notification_get_led_n, NEGATIVE_TC_IDX}, - {utc_notification_get_led_p, POSITIVE_TC_IDX}, - {utc_notification_set_led_time_period_n, NEGATIVE_TC_IDX}, - {utc_notification_set_led_time_period_p, POSITIVE_TC_IDX}, - {utc_notification_get_led_time_period_n, NEGATIVE_TC_IDX}, - {utc_notification_get_led_time_period_p, POSITIVE_TC_IDX}, - {utc_notification_set_application_n, NEGATIVE_TC_IDX}, - {utc_notification_set_application_p, POSITIVE_TC_IDX}, - {utc_notification_get_application_n, NEGATIVE_TC_IDX}, - {utc_notification_get_application_p, POSITIVE_TC_IDX}, - {utc_notification_set_launch_option_n, NEGATIVE_TC_IDX}, - {utc_notification_set_launch_option_p, POSITIVE_TC_IDX}, - {utc_notification_get_launch_option_n, NEGATIVE_TC_IDX}, - {utc_notification_get_launch_option_p, POSITIVE_TC_IDX}, - {utc_notification_set_execute_option_n, NEGATIVE_TC_IDX}, - {utc_notification_set_execute_option_p, POSITIVE_TC_IDX}, - {utc_notification_get_execute_option_n, NEGATIVE_TC_IDX}, - {utc_notification_get_execute_option_p, POSITIVE_TC_IDX}, - {utc_notification_set_property_n, NEGATIVE_TC_IDX}, - {utc_notification_set_property_p, POSITIVE_TC_IDX}, - {utc_notification_get_property_n, NEGATIVE_TC_IDX}, - {utc_notification_get_property_p, POSITIVE_TC_IDX}, - {utc_notification_set_display_applist_n, NEGATIVE_TC_IDX}, - {utc_notification_set_display_applist_p, POSITIVE_TC_IDX}, - {utc_notification_get_display_applist_n, NEGATIVE_TC_IDX}, - {utc_notification_get_display_applist_p, POSITIVE_TC_IDX}, - {utc_notification_set_size_n, NEGATIVE_TC_IDX}, - {utc_notification_set_size_p, POSITIVE_TC_IDX}, - {utc_notification_get_size_n, NEGATIVE_TC_IDX}, - {utc_notification_get_size_p, POSITIVE_TC_IDX}, - {utc_notification_set_progress_n, NEGATIVE_TC_IDX}, - {utc_notification_set_progress_p, POSITIVE_TC_IDX}, - {utc_notification_get_progress_n, NEGATIVE_TC_IDX}, - {utc_notification_get_progress_p, POSITIVE_TC_IDX}, - {utc_notification_set_pkgname_n, NEGATIVE_TC_IDX}, - {utc_notification_set_pkgname_p, POSITIVE_TC_IDX}, - {utc_notification_get_pkgname_n, NEGATIVE_TC_IDX}, - {utc_notification_get_pkgname_p, POSITIVE_TC_IDX}, - {utc_notification_set_layout_n, NEGATIVE_TC_IDX}, - {utc_notification_set_layout_p, POSITIVE_TC_IDX}, - {utc_notification_get_layout_n, NEGATIVE_TC_IDX}, - {utc_notification_get_layout_p, POSITIVE_TC_IDX}, - {utc_notification_get_id_n, NEGATIVE_TC_IDX}, - {utc_notification_get_id_p, POSITIVE_TC_IDX}, - {utc_notification_get_type_n, NEGATIVE_TC_IDX}, - {utc_notification_get_type_p, POSITIVE_TC_IDX}, - {utc_notification_insert_n, NEGATIVE_TC_IDX}, - {utc_notification_insert_p, POSITIVE_TC_IDX}, - {utc_notification_clear_n, NEGATIVE_TC_IDX}, - {utc_notification_clear_p, POSITIVE_TC_IDX}, - {utc_notification_update_n, NEGATIVE_TC_IDX}, - {utc_notification_update_p, POSITIVE_TC_IDX}, - {utc_notification_delete_all_by_type_n, NEGATIVE_TC_IDX}, - {utc_notification_delete_all_by_type_p, POSITIVE_TC_IDX}, - {utc_notification_delete_by_priv_id_n, NEGATIVE_TC_IDX}, - {utc_notification_delete_by_priv_id_p, POSITIVE_TC_IDX}, - {utc_notification_delete_n, NEGATIVE_TC_IDX}, - {utc_notification_delete_p, POSITIVE_TC_IDX}, - {utc_notification_update_progress_n, NEGATIVE_TC_IDX}, - {utc_notification_update_progress_p, POSITIVE_TC_IDX}, - {utc_notification_update_size_n, NEGATIVE_TC_IDX}, - {utc_notification_update_size_p, POSITIVE_TC_IDX}, - {utc_notification_update_content_n, NEGATIVE_TC_IDX}, - {utc_notification_update_content_p, POSITIVE_TC_IDX}, - {utc_notification_new_1_n, NEGATIVE_TC_IDX}, - {utc_notification_new_2_n, NEGATIVE_TC_IDX}, - {utc_notification_new_1_p, POSITIVE_TC_IDX}, - {utc_notification_new_2_p, POSITIVE_TC_IDX}, - {utc_notification_load_n, NEGATIVE_TC_IDX}, - {utc_notification_load_p, POSITIVE_TC_IDX}, - {utc_notification_clone_n, NEGATIVE_TC_IDX}, - {utc_notification_clone_p, POSITIVE_TC_IDX}, - {utc_notification_free_n, NEGATIVE_TC_IDX}, - {utc_notification_free_p, POSITIVE_TC_IDX}, - {utc_notification_resister_changed_cb_n, NEGATIVE_TC_IDX}, - {utc_notification_resister_changed_cb_p, POSITIVE_TC_IDX}, - {utc_notification_unresister_changed_cb_n, NEGATIVE_TC_IDX}, - {utc_notification_unresister_changed_cb_p, POSITIVE_TC_IDX}, - {utc_notification_register_detailed_changed_cb_n, NEGATIVE_TC_IDX}, - {utc_notification_register_detailed_changed_cb_p, POSITIVE_TC_IDX}, - {utc_notification_unregister_detailed_changed_cb_n, NEGATIVE_TC_IDX}, - {utc_notification_unregister_detailed_changed_cb_p, POSITIVE_TC_IDX}, - {utc_notification_get_count_n, NEGATIVE_TC_IDX}, - {utc_notification_get_count_p, POSITIVE_TC_IDX}, - {utc_notification_get_list_n, NEGATIVE_TC_IDX}, - {utc_notification_get_list_p, POSITIVE_TC_IDX}, - {utc_notification_get_grouping_list_n, NEGATIVE_TC_IDX}, - {utc_notification_get_grouping_list_p, POSITIVE_TC_IDX}, - {utc_notification_get_detail_list_n, NEGATIVE_TC_IDX}, - {utc_notification_get_detail_list_p, POSITIVE_TC_IDX}, - {utc_notification_free_list_n, NEGATIVE_TC_IDX}, - {utc_notification_free_list_p, POSITIVE_TC_IDX}, - {utc_notification_op_get_data_n, NEGATIVE_TC_IDX}, - {utc_notification_op_get_data_p, POSITIVE_TC_IDX}, - {utc_notification_is_service_ready_p, POSITIVE_TC_IDX}, - {utc_notification_add_deferred_task_n, NEGATIVE_TC_IDX}, - {utc_notification_add_deferred_task_p, POSITIVE_TC_IDX}, - {utc_notification_del_deferred_task_n, NEGATIVE_TC_IDX}, - {utc_notification_del_deferred_task_p, POSITIVE_TC_IDX}, - { NULL, 0 }, -}; - -static void startup(void) -{ - /* start of TC */ - notification_clear(NOTIFICATION_TYPE_NONE); - tet_printf("\n TC start"); -} - - -static void cleanup(void) -{ - /* end of TC */ - tet_printf("\n TC end"); -} - -static void _changed_cb(void *data, notification_type_e type) -{ -} - -static void _detailed_changed_cb(void *data, notification_type_e type, notification_op *op_list, int num_op) -{ -} - -static void _deffered_job_cb(void *data) -{ -} - -/** - * @brief Negative test case of notification_create() - */ -static void utc_notification_create_1_n(void) -{ - notification_h notification = NULL; - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NONE); - dts_check_eq("notification_create", notification, NULL, - "Must return NULL in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_create() - */ -static void utc_notification_create_2_n(void) -{ - notification_h notification = NULL; - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_MAX); - dts_check_eq("notification_create", notification, NULL, - "Must return NULL in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_create() - */ -static void utc_notification_create_1_p(void) -{ - notification_h notification = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - dts_check_ne("notification_create", notification, NULL, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_create() - */ -static void utc_notification_create_2_p(void) -{ - notification_h notification = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_ONGOING); - dts_check_ne("notification_create", notification, NULL, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_set_image() - */ -static void utc_notification_set_image_n(void) -{ - int ret = 0; - - ret = notification_set_image(NULL, NOTIFICATION_IMAGE_TYPE_ICON, NULL); - - dts_check_eq("notification_set_image", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_set_image() - */ -static void utc_notification_set_image_p(void) -{ - int ret = 0; - notification_h notification = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_set_image(notification, NOTIFICATION_IMAGE_TYPE_ICON, "test.png"); - - dts_check_eq("notification_set_image", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_get_image() - */ -static void utc_notification_get_image_n(void) -{ - int ret = 0; - - ret = notification_get_image(NULL, NOTIFICATION_IMAGE_TYPE_ICON, NULL); - - dts_check_eq("notification_get_image", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_image() - */ -static void utc_notification_get_image_p(void) -{ - int ret = 0; - notification_h notification = NULL; - char *image = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_get_image(notification, NOTIFICATION_IMAGE_TYPE_ICON, &image); - - dts_check_eq("notification_get_image", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_set_time() - */ -static void utc_notification_set_time_n(void) -{ - int ret = 0; - - ret = notification_set_time(NULL, 0); - - dts_check_eq("notification_set_time", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_set_time() - */ -static void utc_notification_set_time_p(void) -{ - int ret = 0; - notification_h notification = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_set_time(notification, 0xFFFFFFF); - - dts_check_eq("notification_set_time", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_get_time() - */ -static void utc_notification_get_time_n(void) -{ - int ret = 0; - - ret = notification_get_time(NULL, NULL); - - dts_check_eq("notification_get_time", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_time() - */ -static void utc_notification_get_time_p(void) -{ - int ret = 0; - notification_h notification = NULL; - time_t t = 0; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_get_time(notification, &t); - - dts_check_eq("notification_get_time", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_get_insert_time() - */ -static void utc_notification_get_insert_time_n(void) -{ - int ret = 0; - - ret = notification_get_insert_time(NULL, NULL); - - dts_check_eq("notification_get_insert_time", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_insert_time() - */ -static void utc_notification_get_insert_time_p(void) -{ - int ret = 0; - notification_h notification = NULL; - time_t t = 0; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_get_insert_time(notification, &t); - - dts_check_eq("notification_get_insert_time", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_set_text() - */ -static void utc_notification_set_text_n(void) -{ - int ret = 0; - - ret = notification_set_text(NULL, NOTIFICATION_TEXT_TYPE_NONE, NULL, NULL, NOTIFICATION_VARIABLE_TYPE_NONE); - - dts_check_eq("notification_set_text", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_set_text() - */ -static void utc_notification_set_text_p(void) -{ - int ret = 0; - notification_h notification = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "test", NULL, NOTIFICATION_VARIABLE_TYPE_NONE); - - dts_check_eq("notification_set_text", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_get_text() - */ -static void utc_notification_get_text_n(void) -{ - int ret = 0; - - ret = notification_get_text(NULL, NOTIFICATION_TEXT_TYPE_TITLE, NULL); - - dts_check_eq("notification_get_text", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_text() - */ -static void utc_notification_get_text_p(void) -{ - int ret = 0; - notification_h notification = NULL; - char *value = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_get_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, &value); - - dts_check_eq("notification_get_text", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_set_text_domain() - */ -static void utc_notification_set_text_domain_n(void) -{ - int ret = 0; - - ret = notification_set_text_domain(NULL, NULL, NULL); - - dts_check_eq("notification_set_text_domain", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_set_text_domain() - */ -static void utc_notification_set_text_domain_p(void) -{ - int ret = 0; - notification_h notification = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_set_text_domain(notification, "domain", "domain.po"); - - dts_check_eq("notification_set_text_domain", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_get_text_domain() - */ -static void utc_notification_get_text_domain_n(void) -{ - int ret = 0; - - ret = notification_get_text_domain(NULL, NULL, NULL); - - dts_check_eq("notification_get_text_domain", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_text_domain() - */ -static void utc_notification_get_text_domain_p(void) -{ - int ret = 0; - notification_h notification = NULL; - char *value1 = NULL; - char *value2 = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_get_text_domain(notification, &value1, &value2); - - dts_check_eq("notification_get_text_domain", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_set_time_to_text() - */ -static void utc_notification_set_time_to_text_n(void) -{ - int ret = 0; - - ret = notification_set_time_to_text(NULL, NOTIFICATION_TEXT_TYPE_NONE, 0); - - dts_check_eq("notification_set_time_to_text", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_set_time_to_text() - */ -static void utc_notification_set_time_to_text_p(void) -{ - int ret = 0; - notification_h notification = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_set_time_to_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, time(NULL)); - - dts_check_eq("notification_set_time_to_text", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_get_time_from_text() - */ -static void utc_notification_get_time_from_text_n(void) -{ - int ret = 0; - - ret = notification_get_time_from_text(NULL, NOTIFICATION_TEXT_TYPE_TITLE, NULL); - - dts_check_eq("notification_get_time_from_text", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_time_from_text() - */ -static void utc_notification_get_time_from_text_p(void) -{ - int ret = 0; - notification_h notification = NULL; - time_t t = 0; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - notification_set_time_to_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, time(NULL)); - ret = notification_get_time_from_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, &t); - - dts_check_eq("notification_get_time_from_text", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_set_sound() - */ -static void utc_notification_set_sound_n(void) -{ - int ret = 0; - - ret = notification_set_sound(NULL, NOTIFICATION_SOUND_TYPE_MAX, NULL); - - dts_check_eq("notification_set_sound", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_set_sound() - */ -static void utc_notification_set_sound_p(void) -{ - int ret = 0; - notification_h notification = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_set_sound(notification, NOTIFICATION_SOUND_TYPE_DEFAULT, "path"); - - dts_check_eq("notification_set_sound", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_get_sound() - */ -static void utc_notification_get_sound_n(void) -{ - int ret = 0; - - ret = notification_get_sound(NULL, NULL, NULL); - - dts_check_eq("notification_get_sound", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_sound() - */ -static void utc_notification_get_sound_p(void) -{ - int ret = 0; - notification_h notification = NULL; - notification_sound_type_e type; - const char *value = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_get_sound(notification, &type, &value); - - dts_check_eq("notification_get_sound", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_set_vibration() - */ -static void utc_notification_set_vibration_n(void) -{ - int ret = 0; - - ret = notification_set_vibration(NULL, NOTIFICATION_VIBRATION_TYPE_MAX, NULL); - - dts_check_eq("notification_set_vibration", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_set_vibration() - */ -static void utc_notification_set_vibration_p(void) -{ - int ret = 0; - notification_h notification = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_set_vibration(notification, NOTIFICATION_VIBRATION_TYPE_DEFAULT, "path"); - - dts_check_eq("notification_set_vibration", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_get_vibration() - */ -static void utc_notification_get_vibration_n(void) -{ - int ret = 0; - - ret = notification_get_vibration(NULL, NULL, NULL); - - dts_check_eq("notification_get_vibration", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_vibration() - */ -static void utc_notification_get_vibration_p(void) -{ - int ret = 0; - notification_h notification = NULL; - notification_vibration_type_e type; - const char *value = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_get_vibration(notification, &type, &value); - - dts_check_eq("notification_get_vibration", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_set_led() - */ -static void utc_notification_set_led_n(void) -{ - int ret = 0; - - ret = notification_set_led(NULL, NOTIFICATION_LED_OP_MAX, 0); - - dts_check_eq("notification_set_led", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_set_led() - */ -static void utc_notification_set_led_p(void) -{ - int ret = 0; - notification_h notification = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_set_led(notification, NOTIFICATION_LED_OP_ON, 0); - - dts_check_eq("notification_set_led", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_get_led() - */ -static void utc_notification_get_led_n(void) -{ - int ret = 0; - - ret = notification_get_led(NULL, NULL, NULL); - - dts_check_eq("notification_get_led", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_led() - */ -static void utc_notification_get_led_p(void) -{ - int ret = 0; - notification_h notification = NULL; - notification_led_op_e type; - int value = 0; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_get_led(notification, &type, &value); - - dts_check_eq("notification_get_led", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_set_led_time_period() - */ -static void utc_notification_set_led_time_period_n(void) -{ - int ret = 0; - - ret = notification_set_led_time_period(NULL, 0, 0); - - dts_check_eq("notification_set_led_time_period", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_set_led_time_period() - */ -static void utc_notification_set_led_time_period_p(void) -{ - int ret = 0; - notification_h notification = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_set_led_time_period(notification, 10, 10); - - dts_check_eq("notification_set_led_time_period", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_get_led_time_period() - */ -static void utc_notification_get_led_time_period_n(void) -{ - int ret = 0; - - ret = notification_get_led_time_period(NULL, NULL, NULL); - - dts_check_eq("notification_get_led_time_period", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_led_time_period() - */ -static void utc_notification_get_led_time_period_p(void) -{ - int ret = 0; - notification_h notification = NULL; - int value1 = 0; - int value2 = 0; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_get_led_time_period(notification, &value1, &value2); - - dts_check_eq("notification_get_led_time_period", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_set_application() - */ -static void utc_notification_set_application_n(void) -{ - int ret = 0; - - ret = notification_set_application(NULL, NULL); - - dts_check_eq("notification_set_application", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_set_application() - */ -static void utc_notification_set_application_p(void) -{ - int ret = 0; - notification_h notification = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_set_application(notification, "org.tizen.quickpanel"); - - dts_check_eq("notification_set_application", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_get_application() - */ -static void utc_notification_get_application_n(void) -{ - int ret = 0; - - ret = notification_get_application(NULL, NULL); - - dts_check_eq("notification_get_application", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_application() - */ -static void utc_notification_get_application_p(void) -{ - int ret = 0; - notification_h notification = NULL; - char *value = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_get_application(notification, &value); - - dts_check_eq("notification_get_application", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_set_launch() - */ -static void utc_notification_set_launch_option_n(void) -{ - int ret = 0; - - ret = notification_set_launch_option(NULL, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, NULL); - - dts_check_eq("notification_set_launch_option", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_set_launch_option() - */ -static void utc_notification_set_launch_option_p(void) -{ - int ret = 0; - notification_h notification = NULL; - app_control_h app_control = NULL; - bundle *b = NULL; - - app_control_create(&app_control); - app_control_set_app_id(app_control, "org.tizen.app"); - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_set_launch_option(notification, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, app_control); - app_control_destroy(app_control); - - dts_check_eq("notification_set_launch_option", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_get_launch_option() - */ -static void utc_notification_get_launch_option_n(void) -{ - int ret = 0; - app_control_h app_control = NULL; - - ret = notification_get_launch_option(NULL, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, NULL); - - dts_check_eq("notification_get_launch_option", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_launch_option() - */ -static void utc_notification_get_launch_option_p(void) -{ - int ret = 0; - notification_h notification = NULL; - app_control_h app_control = NULL; - - app_control_create(&app_control); - app_control_set_app_id(app_control, "org.tizen.app"); - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_set_launch_option(notification, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, app_control); - app_control_destroy(app_control); - app_control = NULL; - - ret = notification_get_launch_option(notification, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, &app_control); - notification_free(notification); - - dts_check_eq("notification_get_launch_option", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_set_execute_option() - */ -static void utc_notification_set_execute_option_n(void) -{ - int ret = 0; - - ret = notification_set_execute_option(NULL, NOTIFICATION_EXECUTE_TYPE_NONE, NULL, NULL, NULL); - - dts_check_eq("notification_set_execute_option", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_set_execute_option() - */ -static void utc_notification_set_execute_option_p(void) -{ - int ret = 0; - notification_h notification = NULL; - bundle *b = NULL; - - b = bundle_create(); - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_set_execute_option(notification, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, b); - - dts_check_eq("notification_set_execute_option", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_get_execute_option() - */ -static void utc_notification_get_execute_option_n(void) -{ - int ret = 0; - - ret = notification_get_execute_option(NULL, NOTIFICATION_EXECUTE_TYPE_NONE, NULL, NULL); - - dts_check_eq("notification_get_execute_option", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_execute_option() - */ -static void utc_notification_get_execute_option_p(void) -{ - int ret = 0; - notification_h notification = NULL; - bundle *b = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_get_execute_option(notification, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, &b); - - dts_check_eq("notification_get_execute_option", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_set_property() - */ -static void utc_notification_set_property_n(void) -{ - int ret = 0; - - ret = notification_set_property(NULL, 0); - - dts_check_eq("notification_set_property", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_set_property() - */ -static void utc_notification_set_property_p(void) -{ - int ret = 0; - notification_h notification = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_set_property(notification, NOTIFICATION_PROP_DISABLE_AUTO_DELETE); - - dts_check_eq("notification_set_property", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_get_property() - */ -static void utc_notification_get_property_n(void) -{ - int ret = 0; - - ret = notification_get_property(NULL, NULL); - - dts_check_eq("notification_get_property", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_property() - */ -static void utc_notification_get_property_p(void) -{ - int ret = 0; - notification_h notification = NULL; - int value = 0; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_get_property(notification, &value); - - dts_check_eq("notification_get_property", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_set_display_applist() - */ -static void utc_notification_set_display_applist_n(void) -{ - int ret = 0; - - ret = notification_set_display_applist(NULL, 0); - - dts_check_eq("notification_set_display_applist", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_set_display_applist() - */ -static void utc_notification_set_display_applist_p(void) -{ - int ret = 0; - notification_h notification = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_set_display_applist(notification, NOTIFICATION_DISPLAY_APP_ALL); - - dts_check_eq("notification_set_display_applist", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_get_display_applist() - */ -static void utc_notification_get_display_applist_n(void) -{ - int ret = 0; - - ret = notification_get_display_applist(NULL, NULL); - - dts_check_eq("notification_get_display_applist", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_display_applist() - */ -static void utc_notification_get_display_applist_p(void) -{ - int ret = 0; - notification_h notification = NULL; - int value = 0; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_get_display_applist(notification, &value); - - dts_check_eq("notification_get_display_applist", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_set_size() - */ -static void utc_notification_set_size_n(void) -{ - int ret = 0; - - ret = notification_set_size(NULL, 0.0); - - dts_check_eq("notification_set_size", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_set_size() - */ -static void utc_notification_set_size_p(void) -{ - int ret = 0; - notification_h notification = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_set_size(notification, 0.5); - - dts_check_eq("notification_set_size", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_get_size() - */ -static void utc_notification_get_size_n(void) -{ - int ret = 0; - - ret = notification_get_size(NULL, NULL); - - dts_check_eq("notification_get_size", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_size() - */ -static void utc_notification_get_size_p(void) -{ - int ret = 0; - notification_h notification = NULL; - double value = 0.0; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_get_size(notification, &value); - - dts_check_eq("notification_get_size", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_set_progress() - */ -static void utc_notification_set_progress_n(void) -{ - int ret = 0; - - ret = notification_set_progress(NULL, 0.0); - - dts_check_eq("notification_set_progress", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_set_progress() - */ -static void utc_notification_set_progress_p(void) -{ - int ret = 0; - notification_h notification = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_set_progress(notification, 0.5); - - dts_check_eq("notification_set_progress", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_get_progress() - */ -static void utc_notification_get_progress_n(void) -{ - int ret = 0; - - ret = notification_get_progress(NULL, NULL); - - dts_check_eq("notification_get_progress", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_progress() - */ -static void utc_notification_get_progress_p(void) -{ - int ret = 0; - notification_h notification = NULL; - double value = 0.0; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_get_progress(notification, &value); - - dts_check_eq("notification_get_progress", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_set_pkgname() - */ -static void utc_notification_set_pkgname_n(void) -{ - int ret = 0; - - ret = notification_set_pkgname(NULL, NULL); - - dts_check_eq("notification_set_pkgname", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_set_pkgname() - */ -static void utc_notification_set_pkgname_p(void) -{ - int ret = 0; - notification_h notification = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_set_pkgname(notification, "org.tizen.quickpanel"); - - dts_check_eq("notification_set_pkgname", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_get_pkgname() - */ -static void utc_notification_get_pkgname_n(void) -{ - int ret = 0; - - ret = notification_get_pkgname(NULL, NULL); - - dts_check_eq("notification_get_pkgname", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_pkgname() - */ -static void utc_notification_get_pkgname_p(void) -{ - int ret = 0; - notification_h notification = NULL; - char *value = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_get_pkgname(notification, &value); - - dts_check_eq("notification_get_pkgname", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_set_layout() - */ -static void utc_notification_set_layout_n(void) -{ - int ret = 0; - - ret = notification_set_layout(NULL, NOTIFICATION_LY_NONE); - - dts_check_eq("notification_set_layout", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_set_layout() - */ -static void utc_notification_set_layout_p(void) -{ - int ret = 0; - notification_h notification = NULL; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_set_layout(notification, NOTIFICATION_LY_NOTI_EVENT_SINGLE); - - dts_check_eq("notification_set_layout", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_get_layout() - */ -static void utc_notification_get_layout_n(void) -{ - int ret = 0; - - ret = notification_get_layout(NULL, NULL); - - dts_check_eq("notification_get_layout", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_layout() - */ -static void utc_notification_get_layout_p(void) -{ - int ret = 0; - notification_h notification = NULL; - notification_ly_type_e type; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_get_layout(notification, &type); - - dts_check_eq("notification_get_layout", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_get_id() - */ -static void utc_notification_get_id_n(void) -{ - int ret = 0; - - ret = notification_get_id(NULL, NULL, NULL); - - dts_check_eq("notification_get_id", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_id() - */ -static void utc_notification_get_id_p(void) -{ - int ret = 0; - notification_h notification = NULL; - int value = 0; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_get_id(notification, NULL, &value); - - dts_check_eq("notification_get_id", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_get_type() - */ -static void utc_notification_get_type_n(void) -{ - int ret = 0; - - ret = notification_get_type(NULL, NULL); - - dts_check_eq("notification_get_type", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_type() - */ -static void utc_notification_get_type_p(void) -{ - int ret = 0; - notification_h notification = NULL; - notification_type_e type; - - /*Invalid parameter test*/ - notification = notification_create(NOTIFICATION_TYPE_NOTI); - ret = notification_get_type(notification, &type); - - dts_check_eq("notification_get_type", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_insert() - */ -static void utc_notification_insert_n(void) -{ - int ret = 0; - notification_h notification = NULL; - - notification = notification_create(NOTIFICATION_TYPE_NOTI); - notification_set_pkgname(notification, TEST_PKG); - notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "test", NULL, NOTIFICATION_VARIABLE_TYPE_NONE); - ret = notification_insert(NULL, NULL); - - dts_check_eq("notification_insert", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_insert() - */ -static void utc_notification_insert_p(void) -{ - int ret = 0; - notification_h notification = NULL; - - notification = notification_create(NOTIFICATION_TYPE_NOTI); - notification_set_pkgname(notification, TEST_PKG); - notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "test", NULL, NOTIFICATION_VARIABLE_TYPE_NONE); - ret = notification_insert(notification, NULL); - - dts_check_eq("notification_insert", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_clear() - */ -static void utc_notification_clear_n(void) -{ - int ret = 0; - - ret = notification_clear(NOTIFICATION_TYPE_MAX); - dts_check_eq("notification_clear", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_clear() - */ -static void utc_notification_clear_p(void) -{ - int ret = 0; - - ret = notification_clear(NOTIFICATION_TYPE_NOTI); - dts_check_eq("notification_clear", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_update() - */ -static void utc_notification_update_n(void) -{ - int ret = 0; - notification_h notification = NULL; - - notification = notification_create(NOTIFICATION_TYPE_NOTI); - notification_set_pkgname(notification, TEST_PKG); - notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "test", NULL, NOTIFICATION_VARIABLE_TYPE_NONE); - notification_insert(notification, NULL); - notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "updated", NULL, NOTIFICATION_VARIABLE_TYPE_NONE); - ret = notification_update(NULL); - - dts_check_eq("notification_update", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_update() - */ -static void utc_notification_update_p(void) -{ - int ret = 0; - notification_h notification = NULL; - - notification = notification_create(NOTIFICATION_TYPE_NOTI); - notification_set_pkgname(notification, TEST_PKG); - notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "test", NULL, NOTIFICATION_VARIABLE_TYPE_NONE); - notification_insert(notification, NULL); - notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "updated", NULL, NOTIFICATION_VARIABLE_TYPE_NONE); - ret = notification_update(notification); - - dts_check_eq("notification_update", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_delete_all_by_type() - */ -static void utc_notification_delete_all_by_type_n(void) -{ - int ret = 0; - - ret = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_MAX); - dts_check_eq("notification_delete_all_by_type", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_delete_all_by_type() - */ -static void utc_notification_delete_all_by_type_p(void) -{ - int ret = 0; - - ret = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_NOTI); - dts_check_eq("notification_delete_all_by_type", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_delete_by_priv_id() - */ -static void utc_notification_delete_by_priv_id_n(void) -{ - int ret = 0; - int priv_id = 0; - notification_h notification = NULL; - - notification = notification_create(NOTIFICATION_TYPE_NOTI); - notification_set_pkgname(notification, TEST_PKG); - notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "privid_delete", NULL, NOTIFICATION_VARIABLE_TYPE_NONE); - notification_insert(notification, &priv_id); - - ret = notification_delete_by_priv_id(TEST_PKG, NOTIFICATION_TYPE_NOTI, NOTIFICATION_PRIV_ID_NONE); - dts_check_eq("notification_delete_by_priv_id", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_delete_by_priv_id() - */ -static void utc_notification_delete_by_priv_id_p(void) -{ - int ret = 0; - int priv_id = 0; - notification_h notification = NULL; - - notification = notification_create(NOTIFICATION_TYPE_NOTI); - notification_set_pkgname(notification, TEST_PKG); - notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "privid_delete", NULL, NOTIFICATION_VARIABLE_TYPE_NONE); - notification_insert(notification, &priv_id); - - ret = notification_delete_by_priv_id(TEST_PKG, NOTIFICATION_TYPE_NOTI, priv_id); - dts_check_eq("notification_delete_by_priv_id", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_delete() - */ -static void utc_notification_delete_n(void) -{ - int ret = 0; - int priv_id = 0; - notification_h notification = NULL; - - notification = notification_create(NOTIFICATION_TYPE_NOTI); - notification_set_pkgname(notification, TEST_PKG); - notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "privid_delete", NULL, NOTIFICATION_VARIABLE_TYPE_NONE); - notification_insert(notification, &priv_id); - - ret = notification_delete(NULL); - dts_check_eq("notification_delete", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_delete() - */ -static void utc_notification_delete_p(void) -{ - int ret = 0; - int priv_id = 0; - notification_h notification = NULL; - - notification = notification_create(NOTIFICATION_TYPE_NOTI); - notification_set_pkgname(notification, TEST_PKG); - notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "privid_delete", NULL, NOTIFICATION_VARIABLE_TYPE_NONE); - notification_insert(notification, &priv_id); - - ret = notification_delete(notification); - dts_check_eq("notification_delete", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_update_progress() - */ -static void utc_notification_update_progress_n(void) -{ - int ret = 0; - int priv_id = 0; - notification_h notification = NULL; - - notification = notification_create(NOTIFICATION_TYPE_ONGOING); - notification_set_pkgname(notification, TEST_PKG); - notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "progress_test-N", NULL, NOTIFICATION_VARIABLE_TYPE_NONE); - notification_set_progress(notification, 0.1); - notification_insert(notification, &priv_id); - - sleep(3); - - ret = notification_update_progress(NULL, NOTIFICATION_PRIV_ID_NONE, 0.9); - dts_check_eq("notification_update_progress", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_update_progress() - */ -static void utc_notification_update_progress_p(void) -{ - int ret = 0; - int priv_id = 0; - notification_h notification = NULL; - - notification = notification_create(NOTIFICATION_TYPE_ONGOING); - notification_set_pkgname(notification, TEST_PKG); - notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "progress_test-P", NULL, NOTIFICATION_VARIABLE_TYPE_NONE); - notification_set_progress(notification, 0.1); - notification_insert(notification, &priv_id); - - sleep(3); - - ret = notification_update_progress(notification, priv_id, 0.9); - dts_check_eq("notification_update_progress", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_update_size() - */ -static void utc_notification_update_size_n(void) -{ - int ret = 0; - int priv_id = 0; - notification_h notification = NULL; - - notification = notification_create(NOTIFICATION_TYPE_ONGOING); - notification_set_pkgname(notification, TEST_PKG); - notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "size_test-N", NULL, NOTIFICATION_VARIABLE_TYPE_NONE); - notification_set_size(notification, 1000); - notification_insert(notification, &priv_id); - - sleep(3); - - ret = notification_update_size(NULL, NOTIFICATION_PRIV_ID_NONE, 10000000); - dts_check_eq("notification_update_size", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_update_size() - */ -static void utc_notification_update_size_p(void) -{ - int ret = 0; - int priv_id = 0; - notification_h notification = NULL; - - notification = notification_create(NOTIFICATION_TYPE_ONGOING); - notification_set_pkgname(notification, TEST_PKG); - notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, "size_test-P", NULL, NOTIFICATION_VARIABLE_TYPE_NONE); - notification_set_size(notification, 1000); - notification_insert(notification, &priv_id); - - sleep(3); - - ret = notification_update_size(notification, priv_id, 10000000); - dts_check_eq("notification_update_size", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_update_content() - */ -static void utc_notification_update_content_n(void) -{ - int ret = 0; - int priv_id = 0; - notification_h notification = NULL; - - notification = notification_create(NOTIFICATION_TYPE_ONGOING); - notification_set_pkgname(notification, TEST_PKG); - notification_set_text(notification, NOTIFICATION_TEXT_TYPE_CONTENT, "contents_test-N", NULL, NOTIFICATION_VARIABLE_TYPE_NONE); - notification_insert(notification, &priv_id); - - sleep(3); - - ret = notification_update_content(NULL, NOTIFICATION_PRIV_ID_NONE, NULL); - dts_check_eq("notification_update_content", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_update_content() - */ -static void utc_notification_update_content_p(void) -{ - int ret = 0; - int priv_id = 0; - notification_h notification = NULL; - - notification = notification_create(NOTIFICATION_TYPE_ONGOING); - notification_set_pkgname(notification, TEST_PKG); - notification_set_text(notification, NOTIFICATION_TEXT_TYPE_CONTENT, "contents_test-P", NULL, NOTIFICATION_VARIABLE_TYPE_NONE); - notification_insert(notification, &priv_id); - - sleep(3); - - ret = notification_update_content(notification, priv_id, "contents_test-P-done"); - dts_check_eq("notification_update_content", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_new() - */ -static void utc_notification_new_1_n(void) -{ - notification_h notification = NULL; - /*Invalid parameter test*/ - notification = notification_new(NOTIFICATION_TYPE_NONE, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE); - dts_check_eq("notification_new", notification, NULL, - "Must return NULL in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_new() - */ -static void utc_notification_new_2_n(void) -{ - notification_h notification = NULL; - /*Invalid parameter test*/ - notification = notification_new(NOTIFICATION_TYPE_MAX, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE); - dts_check_eq("notification_new", notification, NULL, - "Must return NULL in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_new() - */ -static void utc_notification_new_1_p(void) -{ - notification_h notification = NULL; - - /*Invalid parameter test*/ - notification = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE); - dts_check_ne("notification_new", notification, NULL, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_new() - */ -static void utc_notification_new_2_p(void) -{ - notification_h notification = NULL; - - /*Invalid parameter test*/ - notification = notification_new(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE); - dts_check_ne("notification_new", notification, NULL, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_load() - */ -static void utc_notification_load_n(void) -{ - int priv_id = 0; - notification_h notification = NULL; - - notification = notification_create(NOTIFICATION_TYPE_ONGOING); - notification_set_pkgname(notification, TEST_PKG); - notification_set_text(notification, NOTIFICATION_TEXT_TYPE_CONTENT, "contents_test-P", NULL, NOTIFICATION_VARIABLE_TYPE_NONE); - notification_insert(notification, &priv_id); - - sleep(1); - - /*Invalid parameter test*/ - notification = notification_load(NULL, NOTIFICATION_PRIV_ID_NONE); - dts_check_eq("notification_load", notification, NULL, - "Must return NULL in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_load() - */ -static void utc_notification_load_p(void) -{ - int priv_id = 0; - notification_h notification = NULL; - - notification = notification_create(NOTIFICATION_TYPE_ONGOING); - notification_set_pkgname(notification, TEST_PKG); - notification_set_text(notification, NOTIFICATION_TEXT_TYPE_CONTENT, "contents_test-P", NULL, NOTIFICATION_VARIABLE_TYPE_NONE); - notification_insert(notification, &priv_id); - - sleep(1); - - /*Invalid parameter test*/ - notification = notification_load(TEST_PKG, priv_id); - dts_check_ne("notification_load", notification, NULL, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_clone() - */ -static void utc_notification_clone_n(void) -{ - int ret = 0; - notification_h notification = NULL; - - notification = notification_create(NOTIFICATION_TYPE_ONGOING); - ret = notification_clone(NULL, NULL); - - dts_check_eq("notification_update_content", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_clone() - */ -static void utc_notification_clone_p(void) -{ - int ret = 0; - notification_h notification = NULL; - notification_h notification_cloned = NULL; - - notification = notification_create(NOTIFICATION_TYPE_ONGOING); - ret = notification_clone(notification, ¬ification_cloned); - - dts_check_eq("notification_update_content", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_free() - */ -static void utc_notification_free_n(void) -{ - int ret = 0; - notification_h notification = NULL; - - notification = notification_create(NOTIFICATION_TYPE_ONGOING); - ret = notification_free(NULL); - - dts_check_eq("notification_update_content", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_free() - */ -static void utc_notification_free_p(void) -{ - int ret = 0; - notification_h notification = NULL; - - notification = notification_create(NOTIFICATION_TYPE_ONGOING); - ret = notification_free(notification); - - dts_check_eq("notification_update_content", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_resister_changed_cb() - */ -static void utc_notification_resister_changed_cb_n(void) -{ - int ret = 0; - - ret = notification_resister_changed_cb(NULL, NULL); - dts_check_eq("notification_resister_changed_cb", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_resister_changed_cb() - */ -static void utc_notification_resister_changed_cb_p(void) -{ - int ret = 0; - - ret = notification_resister_changed_cb(_changed_cb, NULL); - notification_unresister_changed_cb(_changed_cb); - dts_check_eq("notification_resister_changed_cb", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_unresister_changed_cb() - */ -static void utc_notification_unresister_changed_cb_n(void) -{ - int ret = 0; - - ret = notification_unresister_changed_cb(NULL); - dts_check_eq("notification_unresister_changed_cb", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_unresister_changed_cb() - */ -static void utc_notification_unresister_changed_cb_p(void) -{ - int ret = 0; - - notification_resister_changed_cb(_changed_cb, NULL); - ret = notification_unresister_changed_cb(_changed_cb); - dts_check_eq("notification_unresister_changed_cb", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_register_detailed_changed_cb() - */ -static void utc_notification_register_detailed_changed_cb_n(void) -{ - int ret = 0; - - ret = notification_register_detailed_changed_cb(NULL, NULL); - dts_check_eq("notification_register_detailed_changed_cb", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_register_detailed_changed_cb() - */ -static void utc_notification_register_detailed_changed_cb_p(void) -{ - int ret = 0; - - ret = notification_register_detailed_changed_cb(_detailed_changed_cb, NULL); - notification_unregister_detailed_changed_cb(_detailed_changed_cb, NULL); - dts_check_eq("notification_register_detailed_changed_cb", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_unregister_detailed_changed_cb() - */ -static void utc_notification_unregister_detailed_changed_cb_n(void) -{ - int ret = 0; - - ret = notification_unregister_detailed_changed_cb(NULL, NULL); - dts_check_eq("notification_unregister_detailed_changed_cb", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_unregister_detailed_changed_cb() - */ -static void utc_notification_unregister_detailed_changed_cb_p(void) -{ - int ret = 0; - - notification_register_detailed_changed_cb(_detailed_changed_cb, NULL); - ret = notification_unregister_detailed_changed_cb(_detailed_changed_cb, NULL); - dts_check_eq("notification_unregister_detailed_changed_cb", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_get_count() - */ -static void utc_notification_get_count_n(void) -{ - int ret = 0; - - ret = notification_get_count(NOTIFICATION_TYPE_NONE, NULL, - NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE - ,NULL); - dts_check_eq("notification_get_count", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_count() - */ -static void utc_notification_get_count_p(void) -{ - int ret = 0; - int value = 0; - - ret = notification_get_count(NOTIFICATION_TYPE_NONE, TEST_PKG, - NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE - , &value); - dts_check_eq("notification_get_count", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_get_list() - */ -static void utc_notification_get_list_n(void) -{ - int ret = 0; - - ret = notification_get_list(NOTIFICATION_TYPE_NONE, -1, NULL); - dts_check_eq("notification_get_list", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_list() - */ -static void utc_notification_get_list_p(void) -{ - int ret = 0; - notification_list_h list; - - ret = notification_get_list(NOTIFICATION_TYPE_NOTI, -1, &list); - dts_check_eq("notification_get_list", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_get_grouping_list() - */ -static void utc_notification_get_grouping_list_n(void) -{ - int ret = 0; - - ret = notification_get_grouping_list(NOTIFICATION_TYPE_NONE, -1, NULL); - dts_check_eq("notification_get_grouping_list", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_grouping_list() - */ -static void utc_notification_get_grouping_list_p(void) -{ - int ret = 0; - notification_list_h list; - - ret = notification_get_grouping_list(NOTIFICATION_TYPE_NOTI, -1, &list); - dts_check_eq("notification_get_grouping_list", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_get_detail_list() - */ -static void utc_notification_get_detail_list_n(void) -{ - int ret = 0; - - ret = notification_get_detail_list(TEST_PKG, - NOTIFICATION_GROUP_ID_NONE, - NOTIFICATION_PRIV_ID_NONE, - -1, NULL); - dts_check_eq("notification_get_detail_list", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_get_detail_list() - */ -static void utc_notification_get_detail_list_p(void) -{ - int ret = 0; - notification_list_h list; - - ret = notification_get_detail_list(TEST_PKG, - NOTIFICATION_GROUP_ID_NONE, - NOTIFICATION_PRIV_ID_NONE, - -1, &list); - dts_check_eq("notification_get_detail_list", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_free_list() - */ -static void utc_notification_free_list_n(void) -{ - int ret = 0; - - ret = notification_free_list(NULL); - dts_check_eq("notification_free_list", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_free_list() - */ -static void utc_notification_free_list_p(void) -{ - int ret = 0; - notification_list_h list; - - ret = notification_get_detail_list(TEST_PKG, - NOTIFICATION_GROUP_ID_NONE, - NOTIFICATION_PRIV_ID_NONE, - -1, &list); - - ret = notification_free_list(list); - dts_check_eq("notification_free_list", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_op_get_data() - */ -static void utc_notification_op_get_data_n(void) -{ - int ret = 0; - - ret = notification_op_get_data(NULL, NOTIFICATION_OP_DATA_MIN, NULL); - dts_check_eq("notification_op_get_data", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_op_get_data() - */ -static void utc_notification_op_get_data_p(void) -{ - int ret = 0; - int value = 0; - notification_op noti_op; - noti_op.type = NOTIFICATION_OP_INSERT; - noti_op.priv_id = 1; - - ret = notification_op_get_data(¬i_op, NOTIFICATION_OP_DATA_PRIV_ID, &value); - dts_check_eq("notification_op_get_data", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_is_service_ready() - */ -static void utc_notification_is_service_ready_p(void) -{ - int value = 0; - - value = notification_is_service_ready(); - dts_check_eq("notification_is_service_ready", value, 1, - "Must return 1 in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_add_deferred_task() - */ -static void utc_notification_add_deferred_task_n(void) -{ - int ret = 0; - - ret = notification_add_deferred_task(NULL, NULL); - dts_check_eq("notification_add_deferred_task", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_add_deferred_task() - */ -static void utc_notification_add_deferred_task_p(void) -{ - int ret = 0; - - ret = notification_add_deferred_task(_deffered_job_cb, NULL); - notification_del_deferred_task(_deffered_job_cb); - dts_check_eq("notification_add_deferred_task", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_del_deferred_task() - */ -static void utc_notification_del_deferred_task_n(void) -{ - int ret = 0; - - ret = notification_del_deferred_task(NULL); - dts_check_eq("notification_del_deferred_task", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_del_deferred_task() - */ -static void utc_notification_del_deferred_task_p(void) -{ - int ret = 0; - - ret = notification_add_deferred_task(_deffered_job_cb, NULL); - ret = notification_del_deferred_task(_deffered_job_cb); - dts_check_eq("notification_del_deferred_task", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of invalid parameter"); -} diff --git a/TC/testcase/utc_notification_list.c b/TC/testcase/utc_notification_list.c deleted file mode 100644 index 32ac3da..0000000 --- a/TC/testcase/utc_notification_list.c +++ /dev/null @@ -1,441 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <fcntl.h> -#include <libintl.h> -#include <tet_api.h> -#include <notification.h> - -#define TEST_PKG "org.tizen.tetware" - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -static void startup(void); -static void cleanup(void); - -static void utc_notification_list_get_head_n(void); -static void utc_notification_list_get_head_p(void); -static void utc_notification_list_get_tail_n(void); -static void utc_notification_list_get_tail_p(void); -static void utc_notification_list_get_prev_n(void); -static void utc_notification_list_get_prev_p(void); -static void utc_notification_list_get_next_n(void); -static void utc_notification_list_get_next_p(void); -static void utc_notification_list_get_data_n(void); -static void utc_notification_list_get_data_p(void); -static void utc_notification_list_append_n(void); -static void utc_notification_list_append_p(void); -static void utc_notification_list_remove_n(void); -static void utc_notification_list_remove_p(void); - -void (*tet_startup)(void) = startup; -void (*tet_cleanup)(void) = cleanup; - -struct tet_testlist tet_testlist[] = { - {utc_notification_list_get_head_n, NEGATIVE_TC_IDX}, - {utc_notification_list_get_head_p, POSITIVE_TC_IDX}, - {utc_notification_list_get_tail_n, NEGATIVE_TC_IDX}, - {utc_notification_list_get_tail_p, POSITIVE_TC_IDX}, - {utc_notification_list_get_prev_n, NEGATIVE_TC_IDX}, - {utc_notification_list_get_prev_p, POSITIVE_TC_IDX}, - {utc_notification_list_get_next_n, NEGATIVE_TC_IDX}, - {utc_notification_list_get_next_p, POSITIVE_TC_IDX}, - {utc_notification_list_get_data_n, NEGATIVE_TC_IDX}, - {utc_notification_list_get_data_p, POSITIVE_TC_IDX}, - {utc_notification_list_append_n, NEGATIVE_TC_IDX}, - {utc_notification_list_append_p, POSITIVE_TC_IDX}, - {utc_notification_list_remove_n, NEGATIVE_TC_IDX}, - {utc_notification_list_remove_p, POSITIVE_TC_IDX}, - { NULL, 0 }, -}; - -static void startup(void) -{ - /* start of TC */ - notification_clear(NOTIFICATION_TYPE_NONE); - tet_printf("\n TC start"); -} - - -static void cleanup(void) -{ - /* end of TC */ - tet_printf("\n TC end"); -} - -/** - * @brief Negative test case of notification_list_get_head() - */ -static void utc_notification_list_get_head_n(void) -{ - notification_list_h list = NULL; - notification_list_h list_value = NULL; - notification_h notification_1 = NULL; - notification_h notification_2 = NULL; - notification_h notification_3 = NULL; - notification_h notification_4 = NULL; - - notification_1 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_2 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_3 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_4 = notification_create(NOTIFICATION_TYPE_NOTI); - list = notification_list_append(list, notification_1); - list = notification_list_append(list, notification_2); - list = notification_list_append(list, notification_3); - list = notification_list_append(list, notification_4); - - list_value = notification_list_get_head(NULL); - dts_check_eq("notification_list_get_head", list_value, NULL, - "Must return NULL in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_list_get_head() - */ -static void utc_notification_list_get_head_p(void) -{ - notification_list_h list = NULL; - notification_list_h list_value = NULL; - notification_h notification_1 = NULL; - notification_h notification_2 = NULL; - notification_h notification_3 = NULL; - notification_h notification_4 = NULL; - - notification_1 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_2 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_3 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_4 = notification_create(NOTIFICATION_TYPE_NOTI); - list = notification_list_append(list, notification_1); - list = notification_list_append(list, notification_2); - list = notification_list_append(list, notification_3); - list = notification_list_append(list, notification_4); - - /*Invalid parameter test*/ - list_value = notification_list_get_head(list); - dts_check_ne("notification_list_get_head", list_value, NULL, - "Must return valid pointer in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_list_get_tail() - */ -static void utc_notification_list_get_tail_n(void) -{ - notification_list_h list = NULL; - notification_list_h list_value = NULL; - notification_h notification_1 = NULL; - notification_h notification_2 = NULL; - notification_h notification_3 = NULL; - notification_h notification_4 = NULL; - - notification_1 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_2 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_3 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_4 = notification_create(NOTIFICATION_TYPE_NOTI); - list = notification_list_append(list, notification_1); - list = notification_list_append(list, notification_2); - list = notification_list_append(list, notification_3); - list = notification_list_append(list, notification_4); - - list_value = notification_list_get_tail(NULL); - dts_check_eq("notification_list_get_tail", list_value, NULL, - "Must return NULL in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_list_get_tail() - */ -static void utc_notification_list_get_tail_p(void) -{ - notification_list_h list = NULL; - notification_list_h list_value = NULL; - notification_h notification_1 = NULL; - notification_h notification_2 = NULL; - notification_h notification_3 = NULL; - notification_h notification_4 = NULL; - - notification_1 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_2 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_3 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_4 = notification_create(NOTIFICATION_TYPE_NOTI); - list = notification_list_append(list, notification_1); - list = notification_list_append(list, notification_2); - list = notification_list_append(list, notification_3); - list = notification_list_append(list, notification_4); - - /*Invalid parameter test*/ - list_value = notification_list_get_tail(list); - dts_check_ne("notification_list_get_tail", list_value, NULL, - "Must return valid pointer in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_list_get_prev() - */ -static void utc_notification_list_get_prev_n(void) -{ - notification_list_h list = NULL; - notification_list_h list_value = NULL; - notification_h notification_1 = NULL; - notification_h notification_2 = NULL; - notification_h notification_3 = NULL; - notification_h notification_4 = NULL; - - notification_1 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_2 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_3 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_4 = notification_create(NOTIFICATION_TYPE_NOTI); - list = notification_list_append(list, notification_1); - list = notification_list_append(list, notification_2); - list = notification_list_append(list, notification_3); - list = notification_list_append(list, notification_4); - - list_value = notification_list_get_prev(NULL); - dts_check_eq("notification_list_get_prev", list_value, NULL, - "Must return NULL in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_list_get_prev() - */ -static void utc_notification_list_get_prev_p(void) -{ - notification_list_h list = NULL; - notification_list_h list_value = NULL; - notification_h notification_1 = NULL; - notification_h notification_2 = NULL; - notification_h notification_3 = NULL; - notification_h notification_4 = NULL; - - notification_1 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_2 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_3 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_4 = notification_create(NOTIFICATION_TYPE_NOTI); - list = notification_list_append(list, notification_1); - list = notification_list_append(list, notification_2); - list = notification_list_append(list, notification_3); - list = notification_list_append(list, notification_4); - - /*Invalid parameter test*/ - list = notification_list_get_tail(list); - list_value = notification_list_get_prev(list); - dts_check_ne("notification_list_get_prev", list_value, NULL, - "Must return valid pointer in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_list_get_next() - */ -static void utc_notification_list_get_next_n(void) -{ - notification_list_h list = NULL; - notification_list_h list_value = NULL; - notification_h notification_1 = NULL; - notification_h notification_2 = NULL; - notification_h notification_3 = NULL; - notification_h notification_4 = NULL; - - notification_1 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_2 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_3 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_4 = notification_create(NOTIFICATION_TYPE_NOTI); - list = notification_list_append(list, notification_1); - list = notification_list_append(list, notification_2); - list = notification_list_append(list, notification_3); - list = notification_list_append(list, notification_4); - - list_value = notification_list_get_next(NULL); - dts_check_eq("notification_list_get_next", list_value, NULL, - "Must return NULL in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_list_get_next() - */ -static void utc_notification_list_get_next_p(void) -{ - notification_list_h list = NULL; - notification_list_h list_value = NULL; - notification_h notification_1 = NULL; - notification_h notification_2 = NULL; - notification_h notification_3 = NULL; - notification_h notification_4 = NULL; - - notification_1 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_2 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_3 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_4 = notification_create(NOTIFICATION_TYPE_NOTI); - list = notification_list_append(list, notification_1); - list = notification_list_append(list, notification_2); - list = notification_list_append(list, notification_3); - list = notification_list_append(list, notification_4); - - /*Invalid parameter test*/ - list = notification_list_get_head(list); - list_value = notification_list_get_next(list); - dts_check_ne("notification_list_get_next", list_value, NULL, - "Must return valid pointer in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_list_get_data() - */ -static void utc_notification_list_get_data_n(void) -{ - notification_list_h list = NULL; - notification_h value = NULL; - notification_h notification_1 = NULL; - notification_h notification_2 = NULL; - notification_h notification_3 = NULL; - notification_h notification_4 = NULL; - - notification_1 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_2 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_3 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_4 = notification_create(NOTIFICATION_TYPE_NOTI); - list = notification_list_append(list, notification_1); - list = notification_list_append(list, notification_2); - list = notification_list_append(list, notification_3); - list = notification_list_append(list, notification_4); - - value = notification_list_get_data(NULL); - dts_check_eq("notification_list_get_data", value, NULL, - "Must return NULL in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_list_get_data() - */ -static void utc_notification_list_get_data_p(void) -{ - notification_list_h list = NULL; - notification_h value = NULL; - notification_h notification_1 = NULL; - notification_h notification_2 = NULL; - notification_h notification_3 = NULL; - notification_h notification_4 = NULL; - - notification_1 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_2 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_3 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_4 = notification_create(NOTIFICATION_TYPE_NOTI); - list = notification_list_append(list, notification_1); - list = notification_list_append(list, notification_2); - list = notification_list_append(list, notification_3); - list = notification_list_append(list, notification_4); - - /*Invalid parameter test*/ - value = notification_list_get_data(list); - dts_check_ne("notification_list_get_data", value, NULL, - "Must return valid pointer in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_list_append() - */ -static void utc_notification_list_append_n(void) -{ - notification_list_h list = NULL; - notification_h notification_1 = NULL; - notification_h notification_2 = NULL; - notification_h notification_3 = NULL; - notification_h notification_4 = NULL; - - notification_1 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_2 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_3 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_4 = notification_create(NOTIFICATION_TYPE_NOTI); - list = notification_list_append(list, NULL); - dts_check_eq("notification_list_append", list, NULL, - "Must return NULL in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_list_append() - */ -static void utc_notification_list_append_p(void) -{ - notification_list_h list = NULL; - notification_h notification_1 = NULL; - notification_h notification_2 = NULL; - notification_h notification_3 = NULL; - notification_h notification_4 = NULL; - - notification_1 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_2 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_3 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_4 = notification_create(NOTIFICATION_TYPE_NOTI); - list = notification_list_append(list, notification_1); - dts_check_ne("notification_list_append", list, NULL, - "Must return valid pointer in case of invalid parameter"); -} - -/** - * @brief Negative test case of notification_list_remove() - */ -static void utc_notification_list_remove_n(void) -{ - notification_list_h list = NULL; - notification_h notification_1 = NULL; - notification_h notification_2 = NULL; - notification_h notification_3 = NULL; - notification_h notification_4 = NULL; - - notification_1 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_2 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_3 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_4 = notification_create(NOTIFICATION_TYPE_NOTI); - list = notification_list_append(list, notification_1); - list = notification_list_append(list, notification_2); - list = notification_list_append(list, notification_3); - list = notification_list_append(list, notification_4); - - list = notification_list_remove(NULL, NULL); - dts_check_eq("notification_list_remove", list, NULL, - "Must return NULL in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_list_remove() - */ -static void utc_notification_list_remove_p(void) -{ - notification_list_h list = NULL; - notification_h notification_1 = NULL; - notification_h notification_2 = NULL; - notification_h notification_3 = NULL; - notification_h notification_4 = NULL; - - notification_1 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_2 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_3 = notification_create(NOTIFICATION_TYPE_NOTI); - notification_4 = notification_create(NOTIFICATION_TYPE_NOTI); - list = notification_list_append(list, notification_1); - list = notification_list_append(list, notification_2); - list = notification_list_append(list, notification_3); - list = notification_list_append(list, notification_4); - - list = notification_list_remove(list, notification_1); - dts_check_ne("notification_list_remove", list, NULL, - "Must return valid pointer in case of invalid parameter"); -} diff --git a/TC/testcase/utc_notification_setting.c b/TC/testcase/utc_notification_setting.c deleted file mode 100644 index 8dc13db..0000000 --- a/TC/testcase/utc_notification_setting.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <fcntl.h> -#include <libintl.h> -#include <tet_api.h> -#include <notification.h> - -#define TEST_PKG "org.tizen.tetware" - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -static void startup(void); -static void cleanup(void); - -static void utc_notification_setting_property_set_n(void); -static void utc_notification_setting_property_set_p(void); -static void utc_notification_setting_property_get_n(void); -static void utc_notification_setting_property_get_p(void); - -void (*tet_startup)(void) = startup; -void (*tet_cleanup)(void) = cleanup; - -struct tet_testlist tet_testlist[] = { - {utc_notification_setting_property_set_n, NEGATIVE_TC_IDX}, - {utc_notification_setting_property_set_p, POSITIVE_TC_IDX}, - {utc_notification_setting_property_get_n, NEGATIVE_TC_IDX}, - {utc_notification_setting_property_get_p, POSITIVE_TC_IDX}, - { NULL, 0 }, -}; - -static void startup(void) -{ - /* start of TC */ - notification_clear(NOTIFICATION_TYPE_NONE); - tet_printf("\n TC start"); -} - - -static void cleanup(void) -{ - /* end of TC */ - tet_printf("\n TC end"); -} - -/** - * @brief Negative test case of notification_setting_property_set() - */ -static void utc_notification_setting_property_set_n(void) -{ - int ret; - - ret = notification_setting_property_set(NULL, NULL, NULL); - dts_check_eq("notification_setting_property_set", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_setting_property_set() - */ -static void utc_notification_setting_property_set_p(void) -{ - int ret; - - ret = notification_setting_property_set(TEST_PKG, "OPT_NOTIFICATION", "ON"); - /*Invalid parameter test*/ - dts_check_ne("notification_setting_property_set", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_setting_property_get() - */ -static void utc_notification_setting_property_get_n(void) -{ - int ret; - - ret = notification_setting_property_get(NULL, NULL, NULL); - dts_check_eq("notification_setting_property_get", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_setting_property_get() - */ -static void utc_notification_setting_property_get_p(void) -{ - int ret; - char *value = NULL; - - ret = notification_setting_property_get(TEST_PKG, "OPT_NOTIFICATION", &value); - dts_check_ne("notification_setting_property_get", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} diff --git a/TC/testcase/utc_notification_status.c b/TC/testcase/utc_notification_status.c deleted file mode 100644 index 0ff9a63..0000000 --- a/TC/testcase/utc_notification_status.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <fcntl.h> -#include <libintl.h> -#include <tet_api.h> -#include <notification.h> - -#define TEST_PKG "org.tizen.tetware" - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -static void startup(void); -static void cleanup(void); - -static void utc_notification_status_message_post_n(void); -static void utc_notification_status_message_post_p(void); -static void utc_notification_status_monitor_message_cb_set_n(void); -static void utc_notification_status_monitor_message_cb_set_p(void); -static void utc_notification_status_monitor_message_cb_unset_p(void); - -void (*tet_startup)(void) = startup; -void (*tet_cleanup)(void) = cleanup; - -struct tet_testlist tet_testlist[] = { - {utc_notification_status_message_post_n, NEGATIVE_TC_IDX}, - {utc_notification_status_message_post_p, POSITIVE_TC_IDX}, - {utc_notification_status_monitor_message_cb_set_n, NEGATIVE_TC_IDX}, - {utc_notification_status_monitor_message_cb_set_p, POSITIVE_TC_IDX}, - {utc_notification_status_monitor_message_cb_unset_p, POSITIVE_TC_IDX}, - { NULL, 0 }, -}; - -static void startup(void) -{ - /* start of TC */ - notification_clear(NOTIFICATION_TYPE_NONE); - tet_printf("\n TC start"); -} - - -static void cleanup(void) -{ - /* end of TC */ - tet_printf("\n TC end"); -} - -static void _message_callback(const char *message, void *data) -{ -} - -/** - * @brief Negative test case of notification_status_message_post() - */ -static void utc_notification_status_message_post_n(void) -{ - int ret; - - ret = notification_status_message_post(NULL); - dts_check_eq("notification_status_message_post", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_status_message_post() - */ -static void utc_notification_status_message_post_p(void) -{ - int ret; - - ret = notification_status_message_post("TETWARE-P"); - /*Invalid parameter test*/ - dts_check_eq("notification_status_message_post", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Negative test case of notification_status_monitor_message_cb_set() - */ -static void utc_notification_status_monitor_message_cb_set_n(void) -{ - int ret; - - ret = notification_status_monitor_message_cb_set(NULL, NULL); - dts_check_eq("notification_status_message_post", ret, NOTIFICATION_ERROR_INVALID_DATA, - "Must return NOTIFICATION_ERROR_INVALID_DATA in case of invalid parameter"); -} - -/** - * @brief Positive test case of notification_status_monitor_message_cb_set() - */ -static void utc_notification_status_monitor_message_cb_set_p(void) -{ - int ret; - - ret = notification_status_monitor_message_cb_set(_message_callback, NULL); - dts_check_eq("notification_status_monitor_message_cb_set", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} - -/** - * @brief Positive test case of notification_status_monitor_message_cb_unset() - */ -static void utc_notification_status_monitor_message_cb_unset_p(void) -{ - int ret; - - ret = notification_status_monitor_message_cb_unset(); - dts_check_eq("notification_status_monitor_message_cb_unset", ret, NOTIFICATION_ERROR_NONE, - "Must return NOTIFICATION_ERROR_NONE in case of valid parameter"); -} diff --git a/TC/tet_scen b/TC/tet_scen deleted file mode 100644 index 03f029a..0000000 --- a/TC/tet_scen +++ /dev/null @@ -1,7 +0,0 @@ -all - ^TEST -##### Scenarios for TEST ##### - -# Test scenario -TEST - :include:/testcase/tslist diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg deleted file mode 100644 index f7eda55..0000000 --- a/TC/tetbuild.cfg +++ /dev/null @@ -1,5 +0,0 @@ -TET_OUTPUT_CAPTURE=True # capture option for build operation checking -TET_BUILD_TOOL=make # build with using make command -TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build -TET_API_COMPLIANT=True # use TET API in Test Case ? -TET_PASS_TC_NAME=True # report passed TC name in Journal file? diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg deleted file mode 100644 index 2a0477a..0000000 --- a/TC/tetclean.cfg +++ /dev/null @@ -1,5 +0,0 @@ -TET_OUTPUT_CAPTURE=True # capture option -TET_CLEAN_TOOL= make clean # clean tool -TET_CLEAN_FILE= Makefile # file for clean -TET_API_COMPLIANT=True # TET API useage -TET_PASS_TC_NAME=True # showing name , passed TC diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg deleted file mode 100644 index ef3e452..0000000 --- a/TC/tetexec.cfg +++ /dev/null @@ -1,5 +0,0 @@ -TET_OUTPUT_CAPTURE=True # capturing execution or not -TET_EXEC_TOOL= # ex) exec : execution tool set up/ Optional -TET_EXEC_FILE= # ex) exectool : execution file/ Optional -TET_API_COMPLIANT=True # Test case or Tool usesTET API? -TET_PASS_TC_NAME=True # showing Passed TC name ? diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index eb18b37..0000000 --- a/debian/changelog +++ /dev/null @@ -1,183 +0,0 @@ -libnotification (0.1.1-14) unstable; urgency=low - - * remove VCONFKEY_SETAPPL_STATE_TICKER_NOTI_DISPLAY_CONTENT_BOOL - * Git: slp/pkgs/n/notification - * Tag: libnotification_0.1.1-14 - - -- Jeonghoon Park <jh1979.park@samsung.com> Tue, 17 Apr 2012 11:24:34 +0900 - -libnotification (0.1.1-13) unstable; urgency=low - - * add bundle package dependency for dev package - * Git: slp/pkgs/n/notification - * Tag: libnotification_0.1.1-13 - - -- Jeonghoon Park <jh1979.park@samsung.comp> Mon, 09 Apr 2012 16:34:18 +0900 - -libnotification (0.1.1-12) unstable; urgency=low - - * fix bugs on dbus connection (the applictions will exit if they unregisters their changed callback) - * Git: slp/pkgs/n/notification - * Tag: libnotification_0.1.1-12 - - -- Jeonghoon Park <jh1979.park@samsung.com> Tue, 20 Mar 2012 13:19:27 +0900 - -libnotification (0.1.1-11) unstable; urgency=low - - * fix pkgconfig file - * Git: slp/pkgs/n/notification - * Tag: libnotification_0.1.1-11 - - -- Jeonghoon Park <jh1979.park@samsung.com> Thu, 15 Mar 2012 23:48:41 +0900 - -libnotification (0.1.1-10) unstable; urgency=low - - * replace heynoti publish to dbus signal - * Git: slp/pkgs/n/notification - * Tag: libnotification_0.1.1-10 - - -- Jeonghoon Park <jh1979.park@samsung.com> Thu, 15 Mar 2012 19:57:19 +0900 - -libnotification (0.1.1-9) unstable; urgency=low - - * Add content update API - * Git: slp/pkgs/n/notification - * Tag: libnotification_0.1.1-9 - - -- Mi-Ju Lee <miju52.lee@samsung.com> Wed, 25 Jan 2012 21:32:38 +0900 - -libnotification (0.1.1-8) unstable; urgency=low - - * Remove deprecated API - * Git: slp/pkgs/n/notification - * Tag: libnotification_0.1.1-8 - - -- Mi-Ju Lee <miju52.lee@samsung.com> Thu, 12 Jan 2012 16:32:56 +0900 - -libnotification (0.1.1-7) unstable; urgency=low - - * Deprecate some of the unused API - * Git: slp/pkgs/n/notification - * Tag: libnotification_0.1.1-7 - - -- Mi-Ju Lee <miju52.lee@samsung.com> Wed, 04 Jan 2012 18:54:12 +0900 - -libnotification (0.1.1-6) unstable; urgency=low - - * Add Error type for update API - * Git: slp/pkgs/n/notification - * Tag: libnotification_0.1.1-6 - - -- Mi-Ju Lee <miju52.lee@samsung.com> Wed, 04 Jan 2012 15:47:28 +0900 - -libnotification (0.1.1-5) unstable; urgency=low - - * Add notification update function - * Git: slp/pkgs/n/notification - * Tag: libnotification_0.1.1-5 - - -- Mi-Ju Lee <miju52.lee@samsung.com> Mon, 26 Dec 2011 17:54:37 +0900 - -libnotification (0.1.1-4) unstable; urgency=low - - * Remove ip from changelog - * Git: slp/pkgs/n/notification - * Tag: libnotification_0.1.1-4 - - -- Mi-Ju Lee <miju52.lee@samsung.com> Mon, 19 Dec 2011 15:24:01 +0900 - -libnotification (0.1.1-3) unstable; urgency=low - - * Update boilerplate - * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification - * Tag: libnotification_0.1.1-3 - - -- Mi-Ju Lee <miju52.lee@samsung.com> Tue, 06 Dec 2011 21:41:59 +0900 - -libnotification (0.1.1-2) unstable; urgency=low - - * Fix DB query to bind title key string - * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification - * Tag: libnotification_0.1.1-2 - - -- Mi-Ju Lee <miju52.lee@samsung.com> Thu, 17 Nov 2011 11:11:48 +0900 - -libnotification (0.1.1-1) unstable; urgency=low - - * Update API(ver.0.1.1) - * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification - * Tag: libnotification_0.1.1-1 - - -- Mi-Ju Lee <miju52.lee@samsung.com> Mon, 14 Nov 2011 18:10:11 +0900 - -libnotification (0.1.0-9) unstable; urgency=low - - * Apply Boilerplate - * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification - * Tag: libnotification_0.1.0-9 - - -- Mi-Ju Lee <miju52.lee@samsung.com> Thu, 03 Nov 2011 17:29:12 +0900 - -libnotification (0.1.0-8) unstable; urgency=low - - * Add volatile property - * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification - * Tag: libnotification_0.1.0-8 - - -- Mi-Ju Lee <miju52.lee@samsung.com> Thu, 20 Oct 2011 18:11:14 +0900 - -libnotification (0.1.0-7) unstable; urgency=low - - * Remove eina from pc file - * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification - * Tag: libnotification_0.1.0-7 - - -- Mi-Ju Lee <miju52.lee@samsung.com> Tue, 18 Oct 2011 16:45:27 +0900 - -libnotification (0.1.0-6) unstable; urgency=low - - * Add API to select display app, Fix DB query error - * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification - * Tag: libnotification_0.1.0-6 - - -- Mi-Ju Lee <miju52.lee@samsung.com> Mon, 17 Oct 2011 20:52:38 +0900 - -libnotification (0.1.0-5) unstable; urgency=low - - * Add New API for tigen UX, Merge noti and ongoing DB - * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification - * Tag: libnotification_0.1.0-5 - - -- Mi-Ju Lee <miju52.lee@samsung.com> Mon, 10 Oct 2011 19:39:17 +0900 - -libnotification (0.1.0-4) unstable; urgency=low - - * Add caller pkgname set API - * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification - * Tag: libnotification_0.1.0-4 - - -- Mi-Ju Lee <miju52.lee@samsung.com> Fri, 16 Sep 2011 13:16:18 +0900 - -libnotification (0.1.0-3) unstable; urgency=low - - * Fix prevent defect, bind query for insert error. - * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification - * Tag: libnotification_0.1.0-3 - - -- Mi-Ju Lee <miju52.lee@samsung.com> Wed, 14 Sep 2011 22:30:35 +0900 - -libnotification (0.1.0-2) unstable; urgency=low - - * Add property for tickernoti, Remove content display option - * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification - * Tag: libnotification_0.1.0-2 - - -- Mi-Ju Lee <miju52.lee@samsung.com> Wed, 07 Sep 2011 23:15:25 +0900 - -libnotification (0.1.0-1) unstable; urgency=low - - * Initial Release - * Git: slp-source.sec.samsung.net:slp/pkgs/n/notification - * Tag: libnotification_0.1.0-1 - - -- Mi-Ju Lee <miju52.lee@samsung.com> Tue, 30 Aug 2011 14:44:14 +0900 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index 7ed6ff8..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/debian/control b/debian/control deleted file mode 100644 index ebff257..0000000 --- a/debian/control +++ /dev/null @@ -1,27 +0,0 @@ -Source: libnotification -Section: libs -Priority: optional -Maintainer: Jeonghoon Park <jh1979.park@samsung.com>, Youngjoo Park <yjoo93.park@samsung.com> -Build-Depends: debhelper (>= 5), libsqlite3-dev, libslp-db-util-dev, libvconf-dev, libbundle-dev, libdbus-1-dev, dlog-dev, libail-0-dev, libaul-1-dev, libappsvc-dev, libdbus-glib-1-dev -Standards-Version: 3.7.2 - -Package: libnotification-dev -Section: libdevel -Architecture: any -Depends: libnotification-0 (= ${Source-Version}), libbundle-dev -Description: Notification library - This package contains devel content. - -Package: libnotification-0 -Section: libs -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Notification library - This package contains notification library. - -Package: libnotification-dbg -Section: debug -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, libnotification-0 (= ${Source-Version}) -Description: Notification library - This package is for debug diff --git a/debian/libnotification-0.install.in b/debian/libnotification-0.install.in deleted file mode 100644 index bf766f0..0000000 --- a/debian/libnotification-0.install.in +++ /dev/null @@ -1 +0,0 @@ -@PREFIX@/lib/*.so* diff --git a/debian/libnotification-0.postinst.in b/debian/libnotification-0.postinst.in deleted file mode 100644 index fcf05fb..0000000 --- a/debian/libnotification-0.postinst.in +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/sh - - -if [ ! -d @DATADIR@/dbspace ] -then - mkdir @DATADIR@/dbspace -fi - -if [ ! -f @DATADIR@/dbspace/.notification.db ] -then - sqlite3 @DATADIR@/dbspace/.notification.db 'PRAGMA journal_mode = PERSIST; - create table if not exists noti_list ( - type INTEGER NOT NULL, - caller_pkgname TEXT NOT NULL, - launch_pkgname TEXT, - image_path TEXT, - group_id INTEGER default 0, - internal_group_id INTEGER default 0, - priv_id INTERGER NOT NULL, - title_key TEXT, - b_text TEXT, - b_key TEXT, - b_format_args TEXT, - num_format_args INTEGER default 0, - text_domain TEXT, - text_dir TEXT, - time INTEGER default 0, - insert_time INTEGER default 0, - args TEXT, - group_args TEXT, - b_execute_option TEXT, - b_service_responding TEXT, - b_service_single_launch TEXT, - b_service_multi_launch TEXT, - sound_type INTEGER default 0, - sound_path TEXT, - vibration_type INTEGER default 0, - vibration_path TEXT, - flags_for_property INTEGER default 0, - flag_simmode INTEGER default 0, - display_applist INTEGER, - progress_size DOUBLE default 0, - progress_percentage DOUBLE default 0, - rowid INTEGER PRIMARY KEY AUTOINCREMENT, - UNIQUE (caller_pkgname, priv_id) - ); - create table if not exists noti_group_data ( - caller_pkgname 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_pkgname, group_id) - ); - create table if not exists ongoing_list ( - caller_pkgname TEXT NOT NULL, - launch_pkgname 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_pkgname, priv_id) - ); - ' -fi - -if [ ${USER} = "root" ] -then - chown root:5000 @DATADIR@/dbspace/.notification.db - chown root:5000 @DATADIR@/dbspace/.notification.db-journal -fi -chmod 660 @DATADIR@/dbspace/.notification.db -chmod 660 @DATADIR@/dbspace/.notification.db-journal diff --git a/debian/libnotification-dev.install.in b/debian/libnotification-dev.install.in deleted file mode 100644 index 0f2a4da..0000000 --- a/debian/libnotification-dev.install.in +++ /dev/null @@ -1,2 +0,0 @@ -@PREFIX@/include/* -@PREFIX@/lib/pkgconfig/*.pc diff --git a/debian/rules b/debian/rules deleted file mode 100644 index 8cd299e..0000000 --- a/debian/rules +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -CFLAGS ?= -Wall -g -CXXFLAGS ?= -Wall -g -LDFLAGS ?= -PREFIX ?= /usr -DATADIR ?= /opt - -ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) - CFLAGS += -O0 - CXXFLAGS += -O0 -else - CFLAGS += -O2 - CXXFLAGS += -O2 -endif - -LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed - -CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp - -configure: configure-stamp -configure-stamp: - dh_testdir - # Add here commands to configure the package. - mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && \ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" cmake .. -DCMAKE_INSTALL_PREFIX=$(PREFIX) - - touch configure-stamp - -build: build-stamp - -build-stamp: configure-stamp - dh_testdir - - # Add here commands to compile the package. - cd $(CMAKE_BUILD_DIR) && $(MAKE) - - #docbook-to-man debian/wavplayer.sgml > wavplayer.1 - - for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ - cat $$f > $${f%.in}; \ - sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \ - sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \ - done - - touch $@ - -clean: - dh_testdir - dh_testroot - rm -f build-stamp configure-stamp - - rm -rf $(CMAKE_BUILD_DIR) - - for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ - rm -f $${f%.in}; \ - done - - dh_clean - -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - - # Add here commands to install the package into debian/wavplayer. - cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install - - -# Build architecture-independent files here. -binary-indep: build install -# We have nothing to do by default. - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir - dh_testroot - dh_installchangelogs - dh_installdocs - dh_installexamples - dh_install --sourcedir=debian/tmp -# dh_installmenu -# dh_installdebconf -# dh_installlogrotate -# dh_installemacsen -# dh_installpam -# dh_installmime -# dh_python -# dh_installinit -# dh_installcron -# dh_installinfo - dh_installman - dh_link - dh_strip --dbg-package=libnotification-dbg - dh_compress - dh_fixperms -# dh_perl - dh_makeshlibs - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/include/notification.h b/include/notification.h index 827f378..7855e92 100644 --- a/include/notification.h +++ b/include/notification.h @@ -28,7 +28,6 @@ #include <notification_error.h> #include <notification_type.h> -#include <notification_list.h> #include <notification_status.h> #ifdef __cplusplus @@ -1317,19 +1316,13 @@ int notification_delete_all(notification_type_e type); int notification_post(notification_h noti); /** - * @brief Sets permission to application for updating or deleting the notification + * @brief Gets the package name of the notification * @since_tizen 2.4 - * @privlevel public - * @privilege %http://tizen.org/privilege/notification * @param[in] noti Notification handle - * @param[in] permission_type permission type - * @param[in] app_id target application id - * @return #NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method - * @see #notification_get_permission - * @see #notification_permission_type_e - * @see #notification_h + * @param[out] pkgname The package name of the notification + * @return #NOTIFICATION_ERROR_NONE on success, otherwise a negative error value + * @retval NOTIFICATION_ERROR_NONE Success + * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value * @par Sample code: * @code #include <notification.h> @@ -1337,14 +1330,12 @@ int notification_post(notification_h noti); { notification_h noti = NULL; int noti_err = NOTIFICATION_ERROR_NONE; + char *pkgname = NULL; - noti = notification_create(NOTIFICATION_TYPE_NOTI); - if(noti == NULL) { - return; - } ... - noti_err = notification_set_permission(noti, NOTIFICATION_PERMISSION_TYPE_DELETE, "org.tizen.xxx"); + noti_err = notification_get_pkgname(noti, &pkgname); + if(noti_err != NOTIFICATION_ERROR_NONE) { notification_free(noti); return; @@ -1352,35 +1343,29 @@ int notification_post(notification_h noti); } * @endcode */ -int notification_set_permission(notification_h noti, notification_permission_type_e permission_type, const char *app_id); +int notification_get_pkgname(notification_h noti, char **pkgname); /** - * @brief Gets permission of the notification - * @remarks @a app_id must be freed with notification_free() function. + * @brief Adds a button on the notification * @since_tizen 2.4 - * @privlevel public - * @privilege %http://tizen.org/privilege/notification * @param[in] noti Notification handle - * @param[out] permission_type permission type - * @param[out] app_id target application id - * @return #NOTIFICATION_ERROR_NONE if success, other value if failure - * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method - * @see #notification_set_permission - * @see #notification_permission_type_e - * @see #notification_h + * @param[in] button_index Button index + * @return #NOTIFICATION_ERROR_NONE on success, otherwise a negative error value + * @retval NOTIFICATION_ERROR_NONE Success + * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value * @par Sample code: * @code #include <notification.h> ... { + notification_h noti = NULL; int noti_err = NOTIFICATION_ERROR_NONE; - notification_permission_type_e permission_type; - const char *app_id = NULL; + char *pkgname = NULL; ... - noti_err = notification_get_permission(noti, &permission_type, &app_id); + noti_err = notification_add_button(noti, NOTIFICATION_BUTTON_1); + if(noti_err != NOTIFICATION_ERROR_NONE) { notification_free(noti); return; @@ -1388,13 +1373,13 @@ int notification_set_permission(notification_h noti, notification_permission_typ } * @endcode */ -int notification_get_permission(notification_h noti, notification_permission_type_e *permission_type, const char **app_id); +int notification_add_button(notification_h noti, notification_button_index_e button_index); /** - * @brief Gets the package name of the notification + * @brief Removes a button on the notification * @since_tizen 2.4 * @param[in] noti Notification handle - * @param[out] pkgname The package name of the notification + * @param[in] button_index Button index * @return #NOTIFICATION_ERROR_NONE on success, otherwise a negative error value * @retval NOTIFICATION_ERROR_NONE Success * @retval NOTIFICATION_ERROR_INVALID_PARAMETER Invalid input value @@ -1409,7 +1394,7 @@ int notification_get_permission(notification_h noti, notification_permission_typ ... - noti_err = notification_get_pkgname(noti, &pkgname); + noti_err = notification_remove_button(noti, NOTIFICATION_BUTTON_1); if(noti_err != NOTIFICATION_ERROR_NONE) { notification_free(noti); @@ -1418,8 +1403,67 @@ int notification_get_permission(notification_h noti, notification_permission_typ } * @endcode */ -int notification_get_pkgname(notification_h noti, char **pkgname); +int notification_remove_button(notification_h noti, notification_button_index_e button_index); +/** + * @brief Sets the 'auto remove' option of the active notification + * @details The 'auto remove' option let the active notification be removed in several seconds after it shows. Default value is true. + * @remarks When 'auto_remove' is set as false, the active notification will not be removed + as long as the user removes the active notification or the app which posted the active notification removes the active notification. + * @since_tizen 2.4 + * @param[in] noti Notification handle + * @param[in] auto_remove Auto remove option + * @return #NOTIFICATION_ERROR_NONE On success, other value if failure + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @see #notification_h + * @see #notification_get_auto_remove + * @par Sample code: + * @code +#include <notification.h> +... +{ + notification_h noti = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + ... + + noti_err = notification_set_auto_remove(noti, false); + if(noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +int notification_set_auto_remove(notification_h noti, bool auto_remove); + +/** + * @brief Gets the 'auto remove' option of the active notification + * @details The 'auto remove' option let the active notification be removed in several seconds after it shows. Default value is true. + * @since_tizen 2.4 + * @param[in] noti Notification handle + * @param[out] auto_remove Auto remove option + * @return #NOTIFICATION_ERROR_NONE On success, other value on failure + * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter + * @see #notification_h + * @see #notification_get_auto_remove + * @par Sample code: + * @code +#include <notification.h> +... +{ + int noti_err = NOTIFICATION_ERROR_NONE; + bool auto_remove; + + ... + + noti_err = notification_get_auto_remove(noti, &auto_remove); + if(noti_err != NOTIFICATION_ERROR_NONE) { + return; + } +} + * @endcode + */ +int notification_get_auto_remove(notification_h noti, bool *auto_remove); /* For backward compatibility */ /** diff --git a/include/notification_internal.h b/include/notification_internal.h index be1516d..4c55040 100644 --- a/include/notification_internal.h +++ b/include/notification_internal.h @@ -35,6 +35,8 @@ extern "C" { * @{ */ +#define NOTIFICATION_DISPLAY_APP_HEADS_UP NOTIFICATION_DISPLAY_APP_ACTIVE /* To avoid build error */ + /** * @brief This function add deferred task. the registered task will be executed when notification service become ready * @param[in] deferred_task_cb The callback function diff --git a/include/notification_noti.h b/include/notification_noti.h index 733acff..0d04c0b 100644 --- a/include/notification_noti.h +++ b/include/notification_noti.h @@ -23,6 +23,7 @@ #define __NOTIFICATION_NOTI_H__ #include <notification.h> +#include <notification_list.h> #define TAG_TIME "TIME" #define TAG_TYPE_INVALID -1 diff --git a/include/notification_private.h b/include/notification_private.h index f5ddf9c..2e0e96a 100644 --- a/include/notification_private.h +++ b/include/notification_private.h @@ -96,6 +96,8 @@ struct _notification { char *temp_title; char *temp_content; char *tag; + bool ongoing_flag; + bool auto_remove; }; struct notification_system_setting { diff --git a/include/notification_status.h b/include/notification_status.h index 1fc7bf1..356577e 100644 --- a/include/notification_status.h +++ b/include/notification_status.h @@ -36,17 +36,14 @@ extern "C" { */ /** - * @brief Sends a string (message) to the notification status monitor. + * @brief Shows a toast popup window with given messaege * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif * @privlevel public - * @privilege %http://tizen.org/privilege/notification * @param[in] message The messages to be posted - * @return #NOTIFICATION_ERROR_NONE on success, * otherwise any other value on failure * @retval #NOTIFICATION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #NOTIFICATION_ERROR_FROM_DBUS Error from DBus - * @retval #NOTIFICATION_ERROR_PERMISSION_DENIED The application does not have the privilege to call this method * @see #notification_error_e */ int notification_status_message_post(const char *message); diff --git a/include/notification_type.h b/include/notification_type.h index 93a1ac1..cddd779 100644 --- a/include/notification_type.h +++ b/include/notification_type.h @@ -144,6 +144,19 @@ typedef enum _notification_count_display_type { } notification_count_display_type_e; /** + * @brief Enumeration for button + * @since_tizen 2.4 + */ +typedef enum _notification_button_index { + NOTIFICATION_BUTTON_1 = 1, /**< button 1 */ + NOTIFICATION_BUTTON_2 = 2, /**< button 2 */ + NOTIFICATION_BUTTON_3 = 3, /**< button 3 */ + NOTIFICATION_BUTTON_4 = 4, /**< button 4 */ + NOTIFICATION_BUTTON_5 = 5, /**< button 5 */ + NOTIFICATION_BUTTON_6 = 6, /**< button 6 */ +} notification_button_index_e; + +/** * @brief Enumeration for notification text type. * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif */ @@ -312,15 +325,12 @@ enum _notification_property { * @since_tizen @if WEARABLE 2.3.1 @elseif MOBILE 2.3 @endif */ enum _notificaton_display_applist { - NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY = 0x00000001,/**< Notification Tray(Quickpanel) */ - NOTIFICATION_DISPLAY_APP_TICKER = 0x00000002, - /**< Ticker notification */ - NOTIFICATION_DISPLAY_APP_LOCK = 0x00000004, - /**< Lock screen */ + NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY = 0x00000001, /**< Notification Tray(Quickpanel) */ + NOTIFICATION_DISPLAY_APP_TICKER = 0x00000002, /**< Ticker notification */ + NOTIFICATION_DISPLAY_APP_LOCK = 0x00000004, /**< Lock screen */ NOTIFICATION_DISPLAY_APP_INDICATOR = 0x00000008,/**< Indicator */ - NOTIFICATION_DISPLAY_APP_HEADS_UP = 0x00000010,/**< Heads-up notification */ - NOTIFICATION_DISPLAY_APP_ALL = 0xffffffff, - /**< All display application */ + NOTIFICATION_DISPLAY_APP_ACTIVE = 0x00000010,/**< Active notification */ + NOTIFICATION_DISPLAY_APP_ALL = 0x0000000f, /**< All display application except active notification*/ }; /** diff --git a/packaging/notification.spec b/packaging/notification.spec index cb729d3..0863c1c 100644 --- a/packaging/notification.spec +++ b/packaging/notification.spec @@ -17,8 +17,11 @@ BuildRequires: pkgconfig(aul) BuildRequires: pkgconfig(appsvc) BuildRequires: pkgconfig(dbus-glib-1) BuildRequires: pkgconfig(com-core) +BuildRequires: pkgconfig(appcore-common) BuildRequires: pkgconfig(capi-appfw-application) +BuildRequires: pkgconfig(capi-appfw-app-manager) BuildRequires: pkgconfig(capi-appfw-package-manager) +BuildRequires: pkgconfig(pkgmgr-info) BuildRequires: pkgconfig(edbus) BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(ecore) @@ -76,14 +79,14 @@ rm -rf %{buildroot} %post /sbin/ldconfig -if [ ! -d /opt/dbspace ] +if [ ! -d /usr/dbspace ] then - mkdir /opt/dbspace + mkdir /usr/dbspace fi -if [ ! -f /opt/dbspace/.notification.db ] +if [ ! -f /usr/dbspace/.notification.db ] then - sqlite3 /opt/dbspace/.notification.db 'PRAGMA journal_mode = PERSIST; + sqlite3 /usr/dbspace/.notification.db 'PRAGMA journal_mode = PERSIST; create table if not exists noti_list ( type INTEGER NOT NULL, layout INTEGER NOT NULL default 0, @@ -190,10 +193,10 @@ then ' fi -chown :5000 /opt/dbspace/.notification.db -chown :5000 /opt/dbspace/.notification.db-journal -chmod 644 /opt/dbspace/.notification.db -chmod 644 /opt/dbspace/.notification.db-journal +chown :5000 /usr/dbspace/.notification.db +chown :5000 /usr/dbspace/.notification.db-journal +chmod 644 /usr/dbspace/.notification.db +chmod 644 /usr/dbspace/.notification.db-journal %postun -p /sbin/ldconfig diff --git a/src/notification.c b/src/notification.c index 4199bf9..18b19f0 100644 --- a/src/notification.c +++ b/src/notification.c @@ -29,7 +29,10 @@ #include <dbus/dbus-glib-lowlevel.h> #include <app.h> +#include <app_internal.h> +#include <app_manager.h> #include <app_control_internal.h> +#include <package_manager.h> #include <aul.h> #include <ail.h> #include <appsvc.h> @@ -47,25 +50,6 @@ #include <notification_ipc.h> #include <notification_internal.h> -typedef struct _notification_cb_list notification_cb_list_s; - -typedef enum __notification_cb_type { - NOTIFICATION_CB_NORMAL = 1, - NOTIFICATION_CB_DETAILED, -} _notification_cb_type_e; - -struct _notification_cb_list { - notification_cb_list_s *prev; - notification_cb_list_s *next; - - _notification_cb_type_e cb_type; - void (*changed_cb) (void *data, notification_type_e type); - void (*detailed_changed_cb) (void *data, notification_type_e type, notification_op *op_list, int num_op); - void *data; -}; - -static notification_cb_list_s *g_notification_cb_list = NULL; - static void (*posted_toast_message_cb) (void *data); #define NOTI_TEXT_RESULT_LEN 2048 @@ -117,24 +101,13 @@ char *notification_get_pkgname_by_pid(void) return dup_pkgname; } -static void _notification_get_text_domain(notification_h noti) -{ - if (noti->domain != NULL) { - - } - - if (noti->dir != NULL) { - - } -} - EXPORT_API int notification_set_image(notification_h noti, notification_image_type_e type, const char *image_path) { bundle *b = NULL; char buf_key[32] = { 0, }; - const char *ret_val = NULL; + char *ret_val = NULL; /* Check noti and image_path are valid data */ if (noti == NULL || image_path == NULL) { @@ -156,14 +129,14 @@ EXPORT_API int notification_set_image(notification_h noti, snprintf(buf_key, sizeof(buf_key), "%d", type); /* Get value using key */ - ret_val = bundle_get_val(b, buf_key); + bundle_get_str(b, buf_key, &ret_val); if (ret_val != NULL) { /* If key is exist, remove this value to store new image path */ bundle_del(b, buf_key); } /* Add new image path with type key */ - bundle_add(b, buf_key, image_path); + bundle_add_str(b, buf_key, image_path); } else { /* If image path bundle is not exist, create new one */ b = bundle_create(); @@ -172,7 +145,7 @@ EXPORT_API int notification_set_image(notification_h noti, snprintf(buf_key, sizeof(buf_key), "%d", type); /* Add new image path with type key */ - bundle_add(b, buf_key, image_path); + bundle_add_str(b, buf_key, image_path); /* Save to image path bundle */ noti->b_image_path = b; @@ -187,7 +160,7 @@ EXPORT_API int notification_get_image(notification_h noti, { bundle *b = NULL; char buf_key[32] = { 0, }; - const char *ret_val = NULL; + char *ret_val = NULL; /* Check noti and image_path is valid data */ if (noti == NULL || image_path == NULL) { @@ -209,9 +182,9 @@ EXPORT_API int notification_get_image(notification_h noti, snprintf(buf_key, sizeof(buf_key), "%d", type); /* Get value of key */ - ret_val = bundle_get_val(b, buf_key); + bundle_get_str(b, buf_key, &ret_val); - *image_path = (char *)ret_val; + *image_path = ret_val; } else { /* If image path bundle does not exist, image path is NULL */ *image_path = NULL; @@ -288,7 +261,7 @@ EXPORT_API int notification_set_text(notification_h noti, bundle *b = NULL; char buf_key[32] = { 0, }; char buf_val[1024] = { 0, }; - const char *ret_val = NULL; + char *ret_val = NULL; va_list var_args; notification_variable_type_e var_type; int num_args = 0; @@ -320,7 +293,7 @@ EXPORT_API int notification_set_text(notification_h noti, snprintf(buf_key, sizeof(buf_key), "%d", type); /* Get value using type key */ - ret_val = bundle_get_val(b, buf_key); + bundle_get_str(b, buf_key, &ret_val); if (ret_val != NULL) { /* If value exist, remove this to add new value */ bundle_del(b, buf_key); @@ -329,7 +302,7 @@ EXPORT_API int notification_set_text(notification_h noti, snprintf(buf_val, sizeof(buf_val), "%s", text); /* Add new text value */ - bundle_add(b, buf_key, buf_val); + bundle_add_str(b, buf_key, buf_val); } else { /* If text bundle does not exist, create new one */ b = bundle_create(); @@ -340,7 +313,7 @@ EXPORT_API int notification_set_text(notification_h noti, snprintf(buf_val, sizeof(buf_val), "%s", text); /* Add new text value */ - bundle_add(b, buf_key, buf_val); + bundle_add_str(b, buf_key, buf_val); /* Save text bundle */ noti->b_text = b; @@ -355,7 +328,7 @@ EXPORT_API int notification_set_text(notification_h noti, snprintf(buf_key, sizeof(buf_key), "%d", type); /* Get value using type key */ - ret_val = bundle_get_val(b, buf_key); + bundle_get_str(b, buf_key, &ret_val); if (ret_val != NULL) { /* If value exist, remove this */ bundle_del(b, buf_key); @@ -374,7 +347,7 @@ EXPORT_API int notification_set_text(notification_h noti, snprintf(buf_key, sizeof(buf_key), "%d", type); /* Get value using type key */ - ret_val = bundle_get_val(b, buf_key); + bundle_get_str(b, buf_key, &ret_val); if (ret_val != NULL) { /* If value exist, remove this to add new value */ bundle_del(b, buf_key); @@ -383,7 +356,7 @@ EXPORT_API int notification_set_text(notification_h noti, snprintf(buf_val, sizeof(buf_val), "%s", key); /* Add new key value */ - bundle_add(b, buf_key, buf_val); + bundle_add_str(b, buf_key, buf_val); } else { /* If key bundle does not exist, create new one */ b = bundle_create(); @@ -394,7 +367,7 @@ EXPORT_API int notification_set_text(notification_h noti, snprintf(buf_val, sizeof(buf_val), "%s", key); /* Add new key value */ - bundle_add(b, buf_key, buf_val); + bundle_add_str(b, buf_key, buf_val); /* Save key bundle */ noti->b_key = b; @@ -409,7 +382,7 @@ EXPORT_API int notification_set_text(notification_h noti, snprintf(buf_key, sizeof(buf_key), "%d", type); /* Get value using type key */ - ret_val = bundle_get_val(b, buf_key); + bundle_get_str(b, buf_key, &ret_val); if (ret_val != NULL) { /* If value exist, remove this */ bundle_del(b, buf_key); @@ -433,12 +406,12 @@ EXPORT_API int notification_set_text(notification_h noti, snprintf(buf_key, sizeof(buf_key), "%dtype%d", type, num_args); snprintf(buf_val, sizeof(buf_val), "%d", var_type); - ret_val = bundle_get_val(b, buf_key); + bundle_get_str(b, buf_key, &ret_val); if (ret_val != NULL) { bundle_del(b, buf_key); } - bundle_add(b, buf_key, buf_val); + bundle_add_str(b, buf_key, buf_val); switch (var_type) { case NOTIFICATION_VARIABLE_TYPE_INT: @@ -449,12 +422,12 @@ EXPORT_API int notification_set_text(notification_h noti, num_args); snprintf(buf_val, sizeof(buf_val), "%d", var_value_int); - ret_val = bundle_get_val(b, buf_key); + bundle_get_str(b, buf_key, &ret_val); if (ret_val != NULL) { bundle_del(b, buf_key); } - bundle_add(b, buf_key, buf_val); + bundle_add_str(b, buf_key, buf_val); break; case NOTIFICATION_VARIABLE_TYPE_DOUBLE: var_value_double = va_arg(var_args, double); @@ -465,12 +438,12 @@ EXPORT_API int notification_set_text(notification_h noti, snprintf(buf_val, sizeof(buf_val), "%.2f", var_value_double); - ret_val = bundle_get_val(b, buf_key); + bundle_get_str(b, buf_key, &ret_val); if (ret_val != NULL) { bundle_del(b, buf_key); } - bundle_add(b, buf_key, buf_val); + bundle_add_str(b, buf_key, buf_val); break; case NOTIFICATION_VARIABLE_TYPE_STRING: var_value_string = va_arg(var_args, char *); @@ -481,12 +454,12 @@ EXPORT_API int notification_set_text(notification_h noti, snprintf(buf_val, sizeof(buf_val), "%s", var_value_string); - ret_val = bundle_get_val(b, buf_key); + bundle_get_str(b, buf_key, &ret_val); if (ret_val != NULL) { bundle_del(b, buf_key); } - bundle_add(b, buf_key, buf_val); + bundle_add_str(b, buf_key, buf_val); break; case NOTIFICATION_VARIABLE_TYPE_COUNT: var_value_count = @@ -498,12 +471,12 @@ EXPORT_API int notification_set_text(notification_h noti, snprintf(buf_val, sizeof(buf_val), "%d", var_value_count); - ret_val = bundle_get_val(b, buf_key); + bundle_get_str(b, buf_key, &ret_val); if (ret_val != NULL) { bundle_del(b, buf_key); } - bundle_add(b, buf_key, buf_val); + bundle_add_str(b, buf_key, buf_val); break; default: NOTIFICATION_ERR("Error. invalid variable type. : %d", @@ -526,12 +499,12 @@ EXPORT_API int notification_set_text(notification_h noti, snprintf(buf_key, sizeof(buf_key), "num%d", type); snprintf(buf_val, sizeof(buf_val), "%d", noti->num_format_args); - ret_val = bundle_get_val(b, buf_key); + bundle_get_str(b, buf_key, &ret_val); if (ret_val != NULL) { bundle_del(b, buf_key); } - bundle_add(b, buf_key, buf_val); + bundle_add_str(b, buf_key, buf_val); noti->b_format_args = b; @@ -544,8 +517,8 @@ EXPORT_API int notification_get_text(notification_h noti, { bundle *b = NULL; char buf_key[32] = { 0, }; - const char *ret_val = NULL; - const char *get_str = NULL; + char *ret_val = NULL; + char *get_str = NULL; notification_text_type_e check_type = NOTIFICATION_TEXT_TYPE_NONE; //int display_option_flag = 0; @@ -578,7 +551,7 @@ EXPORT_API int notification_get_text(notification_h noti, snprintf(buf_key, sizeof(buf_key), "%d", type); - ret_val = bundle_get_val(b, buf_key); + bundle_get_str(b, buf_key, &ret_val); if (ret_val != NULL && noti->domain != NULL && noti->dir != NULL) { /* Get application string */ @@ -598,72 +571,11 @@ EXPORT_API int notification_get_text(notification_h noti, /* Get basic text */ snprintf(buf_key, sizeof(buf_key), "%d", type); - get_str = bundle_get_val(b, buf_key); + bundle_get_str(b, buf_key, &get_str); } check_type = type; - /* Set display option is off type when option is off, type is noti */ - /*if (get_str != NULL && display_option_flag == 1 - && noti->type == NOTIFICATION_TYPE_NOTI) { - if (type == NOTIFICATION_TEXT_TYPE_CONTENT - || type == NOTIFICATION_TEXT_TYPE_GROUP_CONTENT) { - // Set check_type to option content string - if (type == NOTIFICATION_TEXT_TYPE_CONTENT) { - check_type = - NOTIFICATION_TEXT_TYPE_CONTENT_FOR_DISPLAY_OPTION_IS_OFF; - } else if (type == NOTIFICATION_TEXT_TYPE_GROUP_CONTENT) { - check_type = - NOTIFICATION_TEXT_TYPE_GROUP_CONTENT_FOR_DISPLAY_OPTION_IS_OFF; - } - - // Check key - if (noti->b_key != NULL) { - b = noti->b_key; - - // Get text domain and dir - _notification_get_text_domain(noti); - - snprintf(buf_key, sizeof(buf_key), "%d", - check_type); - - ret_val = bundle_get_val(b, buf_key); - if (ret_val != NULL && noti->domain != NULL - && noti->dir != NULL) { - // Get application string - bindtextdomain(noti->domain, noti->dir); - - get_check_type_str = - dgettext(noti->domain, ret_val); - } else if (ret_val != NULL) { - // Get system string - get_check_type_str = - dgettext("sys_string", ret_val); - } else { - get_check_type_str = NULL; - } - } - - if (get_check_type_str == NULL && noti->b_text != NULL) { - b = noti->b_text; - // Get basic text - snprintf(buf_key, sizeof(buf_key), "%d", - check_type); - - get_check_type_str = bundle_get_val(b, buf_key); - } - } - - if (get_check_type_str != NULL) { - // Replace option off type string - get_str = get_check_type_str; - } else { - // Set default string - get_str = - dgettext("sys_string", "IDS_COM_POP_MISSED_EVENT"); - } - }*/ - if (get_str != NULL) { /* Get number format args */ b = noti->b_format_args; @@ -671,7 +583,7 @@ EXPORT_API int notification_get_text(notification_h noti, if (b != NULL) { snprintf(buf_key, sizeof(buf_key), "num%d", check_type); - ret_val = bundle_get_val(b, buf_key); + bundle_get_str(b, buf_key, &ret_val); if (ret_val != NULL) { noti->num_format_args = atoi(ret_val); } @@ -683,15 +595,19 @@ EXPORT_API int notification_get_text(notification_h noti, /* Check first variable is count, LEFT pos */ snprintf(buf_key, sizeof(buf_key), "%dtype%d", check_type, num_args); - ret_val = bundle_get_val(b, buf_key); - ret_var_type = atoi(ret_val); + bundle_get_str(b, buf_key, &ret_val); + if (ret_val != NULL) { + ret_var_type = atoi(ret_val); + } if (ret_var_type == NOTIFICATION_VARIABLE_TYPE_COUNT) { /* Get var Value */ snprintf(buf_key, sizeof(buf_key), "%dvalue%d", check_type, num_args); - ret_val = bundle_get_val(b, buf_key); - ret_variable_int = atoi(ret_val); + bundle_get_str(b, buf_key, &ret_val); + if (ret_val != NULL) { + ret_variable_int = atoi(ret_val); + } if (ret_variable_int == NOTIFICATION_COUNT_POS_LEFT) { @@ -729,9 +645,10 @@ EXPORT_API int notification_get_text(notification_h noti, sizeof(buf_key), "%dtype%d", check_type, num_args); - ret_val = - bundle_get_val(b, buf_key); - ret_var_type = atoi(ret_val); + bundle_get_str(b, buf_key, &ret_val); + if (ret_val != NULL) { + ret_var_type = atoi(ret_val); + } if (ret_var_type == NOTIFICATION_VARIABLE_TYPE_COUNT) { @@ -745,16 +662,14 @@ EXPORT_API int notification_get_text(notification_h noti, } else { /* Get var Value */ snprintf(buf_key, - sizeof - (buf_key), + sizeof(buf_key), "%dvalue%d", check_type, num_args); - ret_val = - bundle_get_val(b, - buf_key); - ret_variable_int = - atoi(ret_val); + bundle_get_str(b, buf_key, &ret_val); + if (ret_val != NULL) { + ret_variable_int = atoi(ret_val); + } } snprintf(buf_str, @@ -776,8 +691,7 @@ EXPORT_API int notification_get_text(notification_h noti, sizeof(buf_key), "%dvalue%d", check_type, num_args); - ret_val = - bundle_get_val(b, buf_key); + bundle_get_str(b, buf_key, &ret_val); if (ret_val != NULL && noti->domain != NULL && noti->dir != NULL) { /* Get application string */ @@ -792,7 +706,7 @@ EXPORT_API int notification_get_text(notification_h noti, translated_str = NULL; } - strncpy(buf_str, translated_str, sizeof(buf_str)); + strncpy(buf_str, translated_str, sizeof(buf_str) - 1); int src_len = strlen(result_str); int max_len = NOTI_TEXT_RESULT_LEN - src_len - 1; @@ -809,10 +723,10 @@ EXPORT_API int notification_get_text(notification_h noti, sizeof(buf_key), "%dvalue%d", check_type, num_args); - ret_val = - bundle_get_val(b, buf_key); - ret_variable_double = - atof(ret_val); + bundle_get_str(b, buf_key, &ret_val); + if (ret_val != NULL) { + ret_variable_double = atof(ret_val); + } snprintf(buf_str, sizeof(buf_str), @@ -837,9 +751,10 @@ EXPORT_API int notification_get_text(notification_h noti, sizeof(buf_key), "%dtype%d", check_type, num_args + *(temp_str + 1) - 49); - ret_val = - bundle_get_val(b, buf_key); - ret_var_type = atoi(ret_val); + bundle_get_str(b, buf_key, &ret_val); + if (ret_val != NULL) { + ret_var_type = atoi(ret_val); + } if (ret_var_type == NOTIFICATION_VARIABLE_TYPE_COUNT) { @@ -858,11 +773,10 @@ EXPORT_API int notification_get_text(notification_h noti, "%dvalue%d", check_type, num_args + *(temp_str + 1) - 49); - ret_val = - bundle_get_val(b, - buf_key); - ret_variable_int = - atoi(ret_val); + bundle_get_str(b, buf_key, &ret_val); + if (ret_val != NULL) { + ret_variable_int = atoi(ret_val); + } } snprintf(buf_str, @@ -882,8 +796,7 @@ EXPORT_API int notification_get_text(notification_h noti, sizeof(buf_key), "%dvalue%d", check_type, num_args + *(temp_str + 1) - 49); - ret_val = - bundle_get_val(b, buf_key); + bundle_get_str(b, buf_key, &ret_val); snprintf(buf_str, sizeof(buf_str), "%s", @@ -902,10 +815,10 @@ EXPORT_API int notification_get_text(notification_h noti, sizeof(buf_key), "%dvalue%d", check_type, num_args + *(temp_str + 1) - 49); - ret_val = - bundle_get_val(b, buf_key); - ret_variable_double = - atof(ret_val); + bundle_get_str(b, buf_key, &ret_val); + if (ret_val != NULL) { + ret_variable_double = atof(ret_val); + } snprintf(buf_str, sizeof(buf_str), @@ -929,16 +842,21 @@ EXPORT_API int notification_get_text(notification_h noti, if (num_args < noti->num_format_args) { snprintf(buf_key, sizeof(buf_key), "%dtype%d", check_type, num_args); - ret_val = bundle_get_val(b, buf_key); - ret_var_type = atoi(ret_val); + bundle_get_str(b, buf_key, &ret_val); + if (ret_val != NULL) { + ret_var_type = atoi(ret_val); + } + if (ret_var_type == NOTIFICATION_VARIABLE_TYPE_COUNT) { /* Get var Value */ snprintf(buf_key, sizeof(buf_key), "%dvalue%d", check_type, num_args); - ret_val = bundle_get_val(b, buf_key); - ret_variable_int = atoi(ret_val); + bundle_get_str(b, buf_key, &ret_val); + if (ret_val != NULL) { + ret_variable_int = atoi(ret_val); + } if (ret_variable_int == NOTIFICATION_COUNT_POS_RIGHT) { @@ -996,8 +914,6 @@ EXPORT_API int notification_get_text(notification_h noti, *text = NULL; } - NOTIFICATION_INFO("text[%s]", *text); - return NOTIFICATION_ERROR_NONE; } @@ -1318,64 +1234,32 @@ EXPORT_API int notification_get_led_time_period(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API int notification_set_application(notification_h noti, - const char *pkgname) -{ - if (noti == NULL || pkgname == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - if (noti->launch_pkgname) { - free(noti->launch_pkgname); - } - - noti->launch_pkgname = strdup(pkgname); - - return NOTIFICATION_ERROR_NONE; -} - -EXPORT_API int notification_get_application(notification_h noti, - char **pkgname) -{ - if (noti == NULL || pkgname == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - if (noti->launch_pkgname) { - *pkgname = noti->launch_pkgname; - } else { - *pkgname = noti->caller_pkgname; - } - - return NOTIFICATION_ERROR_NONE; -} - EXPORT_API int notification_set_launch_option(notification_h noti, notification_launch_option_type type, void *option) { + int err = NOTIFICATION_ERROR_NONE; int ret = 0; bundle *b = NULL; app_control_h app_control = option; - if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - if (app_control == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - if (type != NOTIFICATION_LAUNCH_OPTION_APP_CONTROL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; + if (noti == NULL || app_control == NULL || type != NOTIFICATION_LAUNCH_OPTION_APP_CONTROL) { + err = NOTIFICATION_ERROR_INVALID_PARAMETER; + goto out; } - if ((ret = app_control_export_as_bundle(app_control, &b)) == APP_CONTROL_ERROR_NONE) { - return notification_set_execute_option(noti, - NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, - NULL, NULL, - b); - } else { + if ((ret = app_control_export_as_bundle(app_control, &b)) != APP_CONTROL_ERROR_NONE) { NOTIFICATION_ERR("Failed to convert appcontrol to bundle:%d", ret); - return NOTIFICATION_ERROR_INVALID_PARAMETER; + err = NOTIFICATION_ERROR_INVALID_PARAMETER; + goto out; } + + err = notification_set_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, b); + +out: + if (b) + bundle_free(b); + + return err; } EXPORT_API int notification_get_launch_option(notification_h noti, @@ -1431,7 +1315,7 @@ EXPORT_API int notification_set_event_handler(notification_h noti, notification_ if (noti == NULL) { err = NOTIFICATION_ERROR_INVALID_PARAMETER; NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); - err = NOTIFICATION_ERROR_INVALID_PARAMETER; + goto out; } if (event_type < NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1 @@ -1500,6 +1384,7 @@ EXPORT_API int notification_get_event_handler(notification_h noti, notification_ } else { app_control_destroy(app_control_new); + app_control_new = NULL; NOTIFICATION_ERR("Failed to import app control from bundle [%d]", err); err = NOTIFICATION_ERROR_IO_ERROR; goto out; @@ -1512,184 +1397,9 @@ out: return err; } -EXPORT_API int notification_set_execute_option(notification_h noti, - notification_execute_type_e type, - const char *text, - const char *key, - bundle *service_handle) -{ - char buf_key[32] = { 0, }; - const char *ret_val = NULL; - bundle *b = NULL; - - if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - if (type <= NOTIFICATION_EXECUTE_TYPE_NONE - || type >= NOTIFICATION_EXECUTE_TYPE_MAX) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - /* Create execute option bundle if does not exist */ - if (noti->b_execute_option == NULL) { - noti->b_execute_option = bundle_create(); - } - - b = noti->b_execute_option; - - /* Save text */ - if (text != NULL) { - /* Make text key */ - snprintf(buf_key, sizeof(buf_key), "text%d", type); - - /* Check text key exist */ - ret_val = bundle_get_val(b, buf_key); - if (ret_val != NULL) { - /* Remove previous data */ - bundle_del(b, buf_key); - } - - /* Add text data */ - bundle_add(b, buf_key, text); - } - - /* Save key */ - if (key != NULL) { - /* Make key key */ - snprintf(buf_key, sizeof(buf_key), "key%d", type); - - /* Check key key exist */ - ret_val = bundle_get_val(b, buf_key); - if (ret_val != NULL) { - /* Remove previous data */ - bundle_del(b, buf_key); - } - - /* Add text data */ - bundle_add(b, buf_key, key); - } - - switch ((int)type) { - case NOTIFICATION_EXECUTE_TYPE_RESPONDING: - /* Remove previous data if exist */ - if (noti->b_service_responding != NULL) { - bundle_free(noti->b_service_responding); - noti->b_service_responding = NULL; - } - - /* Save service handle */ - if (service_handle != NULL) { - noti->b_service_responding = bundle_dup(service_handle); - } - break; - case NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH: - /* Remove previous data if exist */ - if (noti->b_service_single_launch != NULL) { - bundle_free(noti->b_service_single_launch); - noti->b_service_single_launch = NULL; - } - - /* Save service handle */ - if (service_handle != NULL) { - noti->b_service_single_launch = - bundle_dup(service_handle); - } - break; - case NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH: - /* Remove previous data if exist */ - if (noti->b_service_multi_launch != NULL) { - bundle_free(noti->b_service_multi_launch); - noti->b_service_multi_launch = NULL; - } - - /* Save service handle */ - if (service_handle != NULL) { - noti->b_service_multi_launch = - bundle_dup(service_handle); - } - break; - } - - return NOTIFICATION_ERROR_NONE; -} - -EXPORT_API int notification_get_execute_option(notification_h noti, - notification_execute_type_e type, - const char **text, - bundle **service_handle) -{ - char buf_key[32] = { 0, }; - const char *ret_val = NULL; - char *get_str = NULL; - bundle *b = NULL; - - if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - if (type <= NOTIFICATION_EXECUTE_TYPE_NONE - || type >= NOTIFICATION_EXECUTE_TYPE_MAX) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - switch (type) { - case NOTIFICATION_EXECUTE_TYPE_RESPONDING: - b = noti->b_service_responding; - break; - case NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH: - b = noti->b_service_single_launch; - break; - case NOTIFICATION_EXECUTE_TYPE_MULTI_LAUNCH: - b = noti->b_service_multi_launch; - default: - break; - } - - if (b != NULL) { - // Return text - if (text != NULL) { - // Get text domain and dir - if (noti->domain == NULL || noti->dir == NULL) { - _notification_get_text_domain(noti); - } - - /* Make key */ - snprintf(buf_key, sizeof(buf_key), "key%d", type); - - /* Check key key exist */ - ret_val = bundle_get_val(b, buf_key); - if (ret_val != NULL && noti->domain != NULL - && noti->dir != NULL) { - /* Get application string */ - bindtextdomain(noti->domain, noti->dir); - - get_str = dgettext(noti->domain, ret_val); - *text = get_str; - } else if (ret_val != NULL) { - /* Get system string */ - get_str = dgettext("sys_string", ret_val); - - *text = get_str; - } else { - /* Get basic text */ - snprintf(buf_key, sizeof(buf_key), "text%d", - type); - - ret_val = bundle_get_val(b, buf_key); - - *text = ret_val; - } - } - } - if (service_handle != NULL) { - *service_handle = b; - } - return NOTIFICATION_ERROR_NONE; -} EXPORT_API int notification_set_property(notification_h noti, int flags) @@ -1728,6 +1438,9 @@ EXPORT_API int notification_set_display_applist(notification_h noti, } /* Set app list */ + if (applist == 0xffffffff) { /* 0xffffffff means old NOTIFICATION_DISPLAY_APP_ALL */ + applist = NOTIFICATION_DISPLAY_APP_ALL; + } noti->display_applist = applist; return NOTIFICATION_ERROR_NONE; @@ -1803,25 +1516,6 @@ EXPORT_API int notification_get_progress(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API int notification_set_pkgname(notification_h noti, - const char *pkgname) -{ - /* check noti and pkgname are valid data */ - if (noti == NULL || pkgname == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - /* Remove previous caller pkgname */ - if (noti->caller_pkgname) { - free(noti->caller_pkgname); - noti->caller_pkgname = NULL; - } - - noti->caller_pkgname = strdup(pkgname); - - return NOTIFICATION_ERROR_NONE; -} - EXPORT_API int notification_get_pkgname(notification_h noti, char **pkgname) { @@ -1866,32 +1560,7 @@ EXPORT_API int notification_get_layout(notification_h noti, return NOTIFICATION_ERROR_NONE; } -EXPORT_API int notification_get_id(notification_h noti, - int *group_id, int *priv_id) -{ - /* check noti is valid data */ - if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - /* Check group_id is valid data */ - if (group_id) { - /* Set group id */ - if (noti->group_id < NOTIFICATION_GROUP_ID_NONE) { - *group_id = NOTIFICATION_GROUP_ID_NONE; - } else { - *group_id = noti->group_id; - } - } - /* Check priv_id is valid data */ - if (priv_id) { - /* Set priv_id */ - *priv_id = noti->priv_id; - } - - return NOTIFICATION_ERROR_NONE; -} EXPORT_API int notification_get_type(notification_h noti, notification_type_e *type) @@ -1936,39 +1605,7 @@ EXPORT_API int notification_post(notification_h noti) return NOTIFICATION_ERROR_NONE; } -EXPORT_API int notification_insert(notification_h noti, - int *priv_id) -{ - int ret = 0; - int id = 0; - - /* Check noti is vaild data */ - if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - /* Check noti type is valid type */ - if (noti->type <= NOTIFICATION_TYPE_NONE - || noti->type >= NOTIFICATION_TYPE_MAX) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - /* Save insert time */ - noti->insert_time = time(NULL); - ret = notification_ipc_request_insert(noti, &id); - if (ret != NOTIFICATION_ERROR_NONE) { - return ret; - } - noti->priv_id = id; - NOTIFICATION_DBG("from master:%d", id); - - /* If priv_id is valid data, set priv_id */ - if (priv_id != NULL) { - *priv_id = noti->priv_id; - } - return NOTIFICATION_ERROR_NONE; -} EXPORT_API int notification_update(notification_h noti) { @@ -1986,48 +1623,6 @@ EXPORT_API int notification_update(notification_h noti) return ret; } -EXPORT_API int notification_update_async(notification_h noti, - void (*result_cb)(int priv_id, int result, void *data), void *user_data) -{ - int ret = 0; - - if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - /* Update insert time ? */ - noti->insert_time = time(NULL); - ret = notification_ipc_request_update_async(noti, result_cb, user_data); - - return ret; -} - -EXPORT_API int notifiation_clear(notification_type_e type) -{ - int ret = 0; - - if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - ret = notification_ipc_request_delete_multiple(type, NULL); - - return ret; -} - -EXPORT_API int notification_clear(notification_type_e type) -{ - int ret = 0; - - if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - ret = notification_ipc_request_delete_multiple(type, NULL); - - return ret; -} - EXPORT_API int notification_delete_all(notification_type_e type) { int ret = 0; @@ -2048,57 +1643,6 @@ EXPORT_API int notification_delete_all(notification_type_e type) return ret; } -EXPORT_API int notification_delete_all_by_type(const char *pkgname, - notification_type_e type) -{ - int ret = 0; - char *caller_pkgname = 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(); - } else { - caller_pkgname = strdup(pkgname); - } - - ret = notification_ipc_request_delete_multiple(type, caller_pkgname); - - if (caller_pkgname) { - free(caller_pkgname); - } - - return ret; -} - -EXPORT_API int notification_delete_by_priv_id(const char *pkgname, - notification_type_e type, - int priv_id) -{ - int ret = 0; - char *caller_pkgname = NULL; - - if (priv_id <= NOTIFICATION_PRIV_ID_NONE) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - if (pkgname == NULL) { - caller_pkgname = notification_get_pkgname_by_pid(); - } else { - caller_pkgname = strdup(pkgname); - } - - ret = notification_ipc_request_delete_single(type, caller_pkgname, priv_id); - - if (caller_pkgname) { - free(caller_pkgname); - } - - return ret; -} - EXPORT_API int notification_delete(notification_h noti) { int ret = 0; @@ -2112,127 +1656,15 @@ EXPORT_API int notification_delete(notification_h noti) return ret; } -EXPORT_API int notification_update_progress(notification_h noti, - int priv_id, - double progress) -{ - char *caller_pkgname = NULL; - int input_priv_id = 0; - int ret = 0; - double input_progress = 0.0; - - if (priv_id <= NOTIFICATION_PRIV_ID_NONE) { - if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } else { - input_priv_id = noti->priv_id; - } - } else { - input_priv_id = priv_id; - } - - if (noti == NULL) { - caller_pkgname = notification_get_pkgname_by_pid(); - } else { - caller_pkgname = strdup(noti->caller_pkgname); - } - - if (progress < 0.0) { - input_progress = 0.0; - } else if (progress > 1.0) { - input_progress = 1.0; - } else { - input_progress = progress; - } - - ret = notification_ongoing_update_progress(caller_pkgname, input_priv_id, - input_progress); - - if (caller_pkgname) { - free(caller_pkgname); - } - - return ret; -} - -EXPORT_API int notification_update_size(notification_h noti, - int priv_id, - double size) -{ - char *caller_pkgname = NULL; - int input_priv_id = 0; - int ret = 0; - double input_size = 0.0; - - if (priv_id <= NOTIFICATION_PRIV_ID_NONE) { - if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } else { - input_priv_id = noti->priv_id; - } - } else { - input_priv_id = priv_id; - } - - if (noti == NULL) { - caller_pkgname = notification_get_pkgname_by_pid(); - } else { - caller_pkgname = strdup(noti->caller_pkgname); - } - - if (size < 0.0) { - input_size = 0.0; - } else { - input_size = size; - } - - ret = notification_ongoing_update_size(caller_pkgname, input_priv_id, - input_size); - - if (caller_pkgname) { - free(caller_pkgname); - } - - return ret; -} - -EXPORT_API int notification_update_content(notification_h noti, - int priv_id, - const char *content) -{ - char *caller_pkgname = NULL; - int input_priv_id = 0; - int ret = 0; - - if (priv_id <= NOTIFICATION_PRIV_ID_NONE) { - if (noti == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } else { - input_priv_id = noti->priv_id; - } - } else { - input_priv_id = priv_id; - } - - if (noti == NULL) { - caller_pkgname = notification_get_pkgname_by_pid(); - } else { - caller_pkgname = strdup(noti->caller_pkgname); - } - - ret = notification_ongoing_update_content(caller_pkgname, input_priv_id, - content); - - if (caller_pkgname) { - free(caller_pkgname); - } - - return ret; -} - static notification_h _notification_create(notification_type_e type) { notification_h noti = NULL; + package_info_h package_info = NULL; + char *app_id = NULL; + char *domain_name = NULL; + char *app_root_path = NULL; + char locale_directory[PATH_MAX] = { 0, }; /* PATH_MAX 4096 */ + int err_app_manager = APP_MANAGER_ERROR_NONE; if (type <= NOTIFICATION_TYPE_NONE || type >= NOTIFICATION_TYPE_MAX) { NOTIFICATION_ERR("INVALID TYPE : %d", type); @@ -2261,6 +1693,59 @@ static notification_h _notification_create(notification_type_e type) noti->vibration_type = NOTIFICATION_VIBRATION_TYPE_NONE; noti->led_operation = NOTIFICATION_LED_OP_OFF; noti->display_applist = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_TICKER | NOTIFICATION_DISPLAY_APP_INDICATOR; + + + err_app_manager = app_manager_get_app_id(getpid(), &app_id); + if (err_app_manager != APP_MANAGER_ERROR_NONE || app_id == NULL) { + NOTIFICATION_WARN("app_manager_get_app_id failed err[%d] app_id[%p]", err_app_manager, app_id); + goto out; + } + + /* app name is used as domain name */ + /* domain_name is allocated by app_get_package_app_name */ + err_app_manager = app_get_package_app_name(app_id, &domain_name); + + if (err_app_manager != APP_ERROR_NONE || domain_name == NULL) { + NOTIFICATION_WARN("app_get_package_app_name failed err[%d] domain_name[%p]", err_app_manager, domain_name); + goto out; + } + + err_app_manager = package_info_create(noti->caller_pkgname, &package_info); + + if (err_app_manager != PACKAGE_MANAGER_ERROR_NONE || package_info == NULL) { + NOTIFICATION_WARN("package_info_create failed err[%d] package_info[%p]", err_app_manager, package_info); + goto out; + } + + err_app_manager = package_info_get_root_path(package_info, &app_root_path); + + if (err_app_manager != PACKAGE_MANAGER_ERROR_NONE || app_root_path == NULL) { + NOTIFICATION_WARN("package_info_get_root_path failed err[%d] app_root_path[%p]", err_app_manager, app_root_path); + goto out; + } + + snprintf(locale_directory, PATH_MAX, "%s/res/locale", app_root_path); + + noti->domain = strdup(domain_name); + noti->dir = strdup(locale_directory); + +out: + if (domain_name) { + free(domain_name); + } + + if (app_id) { + free(app_id); + } + + if (app_root_path) { + free(app_root_path); + } + + if (package_info) { + package_info_destroy(package_info); + } + /*! * \NOTE * Other fields are already initialized with ZERO. @@ -2269,38 +1754,11 @@ static notification_h _notification_create(notification_type_e type) return noti; } -EXPORT_API notification_h notification_new(notification_type_e type, - int group_id, int priv_id) -{ - return _notification_create(type); -} - EXPORT_API notification_h notification_create(notification_type_e type) { return _notification_create(type); } -EXPORT_API notification_h notification_load(char *pkgname, - int priv_id) -{ - int ret = 0; - notification_h noti = NULL; - - noti = (notification_h) calloc(1, sizeof(struct _notification)); - if (noti == NULL) { - NOTIFICATION_ERR("NO MEMORY : noti == NULL"); - return NULL; - } - - ret = notification_noti_get_by_priv_id(noti, pkgname, priv_id); - if (ret != NOTIFICATION_ERROR_NONE) { - notification_free(noti); - return NULL; - } - - return noti; -} - EXPORT_API notification_h notification_load_by_tag(const char *tag) { int ret = 0; @@ -2317,7 +1775,6 @@ EXPORT_API notification_h notification_load_by_tag(const char *tag) if (!caller_pkgname) { NOTIFICATION_ERR("Failed to get a package name"); set_last_result(NOTIFICATION_ERROR_OUT_OF_MEMORY); - return NULL; } @@ -2330,7 +1787,7 @@ EXPORT_API notification_h notification_load_by_tag(const char *tag) return NULL; } - ret = notification_ipc_request_load_noti_by_tag(noti, caller_pkgname, tag); + ret = notification_noti_get_by_tag(noti, caller_pkgname, (char*)tag); free(caller_pkgname); @@ -2578,699 +2035,101 @@ EXPORT_API int notification_free(notification_h noti) return NOTIFICATION_ERROR_NONE; } -EXPORT_API int -notification_resister_changed_cb(void (*changed_cb) - (void *data, notification_type_e type), - void *user_data) -{ - notification_cb_list_s *noti_cb_list_new = NULL; - notification_cb_list_s *noti_cb_list = NULL; - - if (changed_cb == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - if (notification_ipc_monitor_init() != NOTIFICATION_ERROR_NONE) { - return NOTIFICATION_ERROR_IO_ERROR; - } - - noti_cb_list_new = - (notification_cb_list_s *) malloc(sizeof(notification_cb_list_s)); - - if (noti_cb_list_new == NULL) { - return NOTIFICATION_ERROR_OUT_OF_MEMORY; - } - - noti_cb_list_new->next = NULL; - noti_cb_list_new->prev = NULL; - - noti_cb_list_new->cb_type = NOTIFICATION_CB_NORMAL; - noti_cb_list_new->changed_cb = changed_cb; - noti_cb_list_new->detailed_changed_cb = NULL; - noti_cb_list_new->data = user_data; - - if (g_notification_cb_list == NULL) { - g_notification_cb_list = noti_cb_list_new; - } else { - noti_cb_list = g_notification_cb_list; - - while (noti_cb_list->next != NULL) { - noti_cb_list = noti_cb_list->next; - } - - noti_cb_list->next = noti_cb_list_new; - noti_cb_list_new->prev = noti_cb_list; - } - return NOTIFICATION_ERROR_NONE; -} - -EXPORT_API int -notification_unresister_changed_cb(void (*changed_cb) - (void *data, notification_type_e type)) -{ - notification_cb_list_s *noti_cb_list = NULL; - notification_cb_list_s *noti_cb_list_prev = NULL; - notification_cb_list_s *noti_cb_list_next = NULL; - - noti_cb_list = g_notification_cb_list; - - if (changed_cb == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - if (noti_cb_list == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - while (noti_cb_list->prev != NULL) { - noti_cb_list = noti_cb_list->prev; - } - - do { - if (noti_cb_list->changed_cb == changed_cb) { - noti_cb_list_prev = noti_cb_list->prev; - noti_cb_list_next = noti_cb_list->next; - - if (noti_cb_list_prev == NULL) { - g_notification_cb_list = noti_cb_list_next; - } else { - noti_cb_list_prev->next = noti_cb_list_next; - } - - if (noti_cb_list_next == NULL) { - if (noti_cb_list_prev != NULL) { - noti_cb_list_prev->next = NULL; - } - } else { - noti_cb_list_next->prev = noti_cb_list_prev; - } - - free(noti_cb_list); - - if (g_notification_cb_list == NULL) - notification_ipc_monitor_fini(); - - return NOTIFICATION_ERROR_NONE; - } - noti_cb_list = noti_cb_list->next; - } while (noti_cb_list != NULL); - - return NOTIFICATION_ERROR_INVALID_PARAMETER; -} - -EXPORT_API int -notification_register_detailed_changed_cb( - void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op), - void *user_data) -{ - notification_cb_list_s *noti_cb_list_new = NULL; - notification_cb_list_s *noti_cb_list = NULL; - - if (detailed_changed_cb == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - if (notification_ipc_monitor_init() != NOTIFICATION_ERROR_NONE) { - return NOTIFICATION_ERROR_IO_ERROR; - } - - noti_cb_list_new = - (notification_cb_list_s *) malloc(sizeof(notification_cb_list_s)); - - if (noti_cb_list_new == NULL) { - return NOTIFICATION_ERROR_OUT_OF_MEMORY; - } - - noti_cb_list_new->next = NULL; - noti_cb_list_new->prev = NULL; - - noti_cb_list_new->cb_type = NOTIFICATION_CB_DETAILED; - noti_cb_list_new->changed_cb = NULL; - noti_cb_list_new->detailed_changed_cb = detailed_changed_cb; - noti_cb_list_new->data = user_data; - - if (g_notification_cb_list == NULL) { - g_notification_cb_list = noti_cb_list_new; - } else { - noti_cb_list = g_notification_cb_list; - - while (noti_cb_list->next != NULL) { - noti_cb_list = noti_cb_list->next; - } - - noti_cb_list->next = noti_cb_list_new; - noti_cb_list_new->prev = noti_cb_list; - } - return NOTIFICATION_ERROR_NONE; -} - -EXPORT_API int -notification_unregister_detailed_changed_cb( - void (*detailed_changed_cb)(void *data, notification_type_e type, notification_op *op_list, int num_op), - void *user_data) +EXPORT_API int notification_set_tag(notification_h noti, const char *tag) { - notification_cb_list_s *noti_cb_list = NULL; - notification_cb_list_s *noti_cb_list_prev = NULL; - notification_cb_list_s *noti_cb_list_next = NULL; - - noti_cb_list = g_notification_cb_list; - - if (detailed_changed_cb == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - if (noti_cb_list == NULL) { + /* Check noti is valid data */ + if (noti == NULL) { return NOTIFICATION_ERROR_INVALID_PARAMETER; } - while (noti_cb_list->prev != NULL) { - noti_cb_list = noti_cb_list->prev; - } - - do { - if (noti_cb_list->detailed_changed_cb == detailed_changed_cb) { - noti_cb_list_prev = noti_cb_list->prev; - noti_cb_list_next = noti_cb_list->next; - - if (noti_cb_list_prev == NULL) { - g_notification_cb_list = noti_cb_list_next; - } else { - noti_cb_list_prev->next = noti_cb_list_next; - } - - if (noti_cb_list_next == NULL) { - if (noti_cb_list_prev != NULL) { - noti_cb_list_prev->next = NULL; - } - } else { - noti_cb_list_next->prev = noti_cb_list_prev; - } - - free(noti_cb_list); - - if (g_notification_cb_list == NULL) - notification_ipc_monitor_fini(); - - return NOTIFICATION_ERROR_NONE; + if (tag != NULL) { + /* save input TAG */ + if (noti->tag != NULL) { + free(noti->tag); } - noti_cb_list = noti_cb_list->next; - } while (noti_cb_list != NULL); - - return NOTIFICATION_ERROR_INVALID_PARAMETER; -} - -EXPORT_API int notification_get_count(notification_type_e type, - const char *pkgname, - int group_id, - int priv_id, int *count) -{ - int ret = 0; - int noti_count = 0; - - if (count == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - ret = - notification_noti_get_count(type, pkgname, group_id, priv_id, - ¬i_count); - if (ret != NOTIFICATION_ERROR_NONE) { - return ret; + noti->tag = strdup(tag); } - *count = noti_count; - return NOTIFICATION_ERROR_NONE; -} - -EXPORT_API int notification_get_list(notification_type_e type, - int count, - notification_list_h *list) -{ - notification_list_h get_list = NULL; - int ret = 0; - - if (list == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - ret = notification_noti_get_grouping_list(type, count, &get_list); - if (ret != NOTIFICATION_ERROR_NONE) { - return ret; - } - *list = get_list; - - return NOTIFICATION_ERROR_NONE; } -EXPORT_API int -notification_get_grouping_list(notification_type_e type, int count, - notification_list_h * list) +EXPORT_API int notification_get_tag(notification_h noti, const char **tag) { - notification_list_h get_list = NULL; - int ret = 0; - - if (list == NULL) { + /* Check noti is valid data */ + if (noti == NULL) { return NOTIFICATION_ERROR_INVALID_PARAMETER; } - ret = notification_noti_get_grouping_list(type, count, &get_list); - if (ret != NOTIFICATION_ERROR_NONE) { - return ret; - } - - *list = get_list; - + *tag = noti->tag; return NOTIFICATION_ERROR_NONE; } -EXPORT_API int notification_get_detail_list(const char *pkgname, - int group_id, - int priv_id, - int count, - notification_list_h *list) +void notification_call_posted_toast_cb(const char *message) { - notification_list_h get_list = NULL; - int ret = 0; - - if (list == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - ret = - notification_noti_get_detail_list(pkgname, group_id, priv_id, count, - &get_list); - if (ret != NOTIFICATION_ERROR_NONE) { - return ret; + if (posted_toast_message_cb != NULL) { + posted_toast_message_cb((void*)message); } - - *list = get_list; - - return NOTIFICATION_ERROR_NONE; } -EXPORT_API int notification_free_list(notification_list_h list) +EXPORT_API int notification_set_ongoing_flag(notification_h noti, bool ongoing_flag) { - notification_list_h cur_list = NULL; - notification_h noti = NULL; - - if (list == NULL) { + if (noti == NULL) return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - cur_list = notification_list_get_head(list); - - while (cur_list != NULL) { - noti = notification_list_get_data(cur_list); - cur_list = notification_list_remove(cur_list, noti); - - notification_free(noti); - } + noti->ongoing_flag = ongoing_flag; return NOTIFICATION_ERROR_NONE; } -EXPORT_API int notification_op_get_data(notification_op *noti_op, notification_op_data_type_e type, - void *data) +EXPORT_API int notification_get_ongoing_flag(notification_h noti, bool *ongoing_flag) { - if (noti_op == NULL || data == NULL) { + if (noti == NULL || ongoing_flag == NULL) return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - switch (type) { - case NOTIFICATION_OP_DATA_TYPE: - *((int*)data) = noti_op->type; - break; - case NOTIFICATION_OP_DATA_PRIV_ID: - *((int*)data) = noti_op->priv_id; - break; - case NOTIFICATION_OP_DATA_NOTI: - *((notification_h *)data) = noti_op->noti; - break; - case NOTIFICATION_OP_DATA_EXTRA_INFO_1: - *((int*)data) = noti_op->extra_info_1; - break; - case NOTIFICATION_OP_DATA_EXTRA_INFO_2: - *((int*)data) = noti_op->extra_info_2; - break; - default: - return NOTIFICATION_ERROR_INVALID_PARAMETER; - break; - } + *ongoing_flag = noti->ongoing_flag; return NOTIFICATION_ERROR_NONE; } -void notification_call_changed_cb(notification_op *op_list, int op_num) -{ - notification_cb_list_s *noti_cb_list = NULL; - notification_type_e type = 0; - - if (g_notification_cb_list == NULL) { - return; - } - noti_cb_list = g_notification_cb_list; - - while (noti_cb_list->prev != NULL) { - noti_cb_list = noti_cb_list->prev; - } - - if (op_list == NULL) { - NOTIFICATION_ERR("invalid data"); - return ; - } - - notification_get_type(op_list->noti, &type); - - while (noti_cb_list != NULL) { - if (noti_cb_list->cb_type == NOTIFICATION_CB_NORMAL && noti_cb_list->changed_cb) { - noti_cb_list->changed_cb(noti_cb_list->data, - type); - } - if (noti_cb_list->cb_type == NOTIFICATION_CB_DETAILED && noti_cb_list->detailed_changed_cb) { - noti_cb_list->detailed_changed_cb(noti_cb_list->data, - type, op_list, op_num); - } - - noti_cb_list = noti_cb_list->next; - } -} - -EXPORT_API int notification_is_service_ready(void) -{ - return notification_ipc_is_master_ready(); -} - -EXPORT_API int -notification_add_deferred_task( - void (*deferred_task_cb)(void *data), void *user_data) -{ - if (deferred_task_cb == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - return notification_ipc_add_deffered_task(deferred_task_cb, user_data); -} - -EXPORT_API int -notification_del_deferred_task( - void (*deferred_task_cb)(void *data)) -{ - if (deferred_task_cb == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - return notification_ipc_del_deffered_task(deferred_task_cb); -} - -/* notification_set_icon will be removed */ -EXPORT_API int notification_set_icon(notification_h noti, - const char *icon_path) -{ - int ret_err = NOTIFICATION_ERROR_NONE; - - ret_err = - notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, - icon_path); - - return ret_err; -} - -/* notification_get_icon will be removed */ -EXPORT_API int notification_get_icon(notification_h noti, - char **icon_path) -{ - int ret_err = NOTIFICATION_ERROR_NONE; - char *ret_image_path = NULL; - - ret_err = - notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, - &ret_image_path); - - if (ret_err == NOTIFICATION_ERROR_NONE && icon_path != NULL) { - *icon_path = ret_image_path; - - //NOTIFICATION_DBG("Get icon : %s", *icon_path); - } - - return ret_err; -} - -EXPORT_API int notification_set_title(notification_h noti, - const char *title, - const char *loc_title) -{ - int noti_err = NOTIFICATION_ERROR_NONE; - - noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, - title, loc_title, - NOTIFICATION_VARIABLE_TYPE_NONE); - - return noti_err; -} - -EXPORT_API int notification_get_title(notification_h noti, - char **title, - char **loc_title) -{ - int noti_err = NOTIFICATION_ERROR_NONE; - char *ret_text = NULL; - - noti_err = - notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, - &ret_text); - - if (title != NULL) { - *title = ret_text; - } - - if (loc_title != NULL) { - *loc_title = NULL; - } - - return noti_err; -} - -EXPORT_API int notification_set_content(notification_h noti, - const char *content, - const char *loc_content) -{ - int noti_err = NOTIFICATION_ERROR_NONE; - - noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, - content, loc_content, - NOTIFICATION_VARIABLE_TYPE_NONE); - - return noti_err; -} - -EXPORT_API int notification_get_content(notification_h noti, - char **content, - char **loc_content) -{ - int noti_err = NOTIFICATION_ERROR_NONE; - char *ret_text = NULL; - - noti_err = - notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, - &ret_text); - - if (content != NULL) { - *content = ret_text; - } - - if (loc_content != NULL) { - *loc_content = NULL; - } - - return noti_err; - -#if 0 - ret = - vconf_get_bool - (VCONFKEY_SETAPPL_STATE_TICKER_NOTI_DISPLAY_CONTENT_BOOL, &boolval); - - if (ret == -1 || boolval == 0) { - if (content != NULL && noti->default_content != NULL) { - *content = noti->default_content; - } - - if (loc_content != NULL && noti->loc_default_content != NULL) { - *loc_content = noti->loc_default_content; - } - } -#endif -} - -EXPORT_API int notification_set_args(notification_h noti, - bundle * args, - bundle * group_args) -{ - if (noti == NULL || args == NULL) { - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - if (noti->args) { - bundle_free(noti->args); - } - - noti->args = bundle_dup(args); - - if (noti->group_args) { - bundle_free(noti->group_args); - noti->group_args = NULL; - } - - if (group_args != NULL) { - noti->group_args = bundle_dup(group_args); - } - - return NOTIFICATION_ERROR_NONE; -} -EXPORT_API int notification_get_args(notification_h noti, - bundle ** args, - bundle ** group_args) +EXPORT_API int notification_add_button(notification_h noti, notification_button_index_e button_index) { - if (noti == NULL || args == NULL) { + if (noti == NULL || button_index < NOTIFICATION_BUTTON_1 || button_index > NOTIFICATION_BUTTON_6) return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - if (noti->args) { - *args = noti->args; - } else { - *args = NULL; - } - - if (group_args != NULL && noti->group_args) { - *group_args = noti->group_args; - } - - return NOTIFICATION_ERROR_NONE; -} - -EXPORT_API int notification_delete_group_by_group_id(const char *pkgname, - notification_type_e type, - int group_id) -{ - int ret = 0; - char *caller_pkgname = NULL; - - if (pkgname == NULL) { - caller_pkgname = notification_get_pkgname_by_pid(); - } else { - caller_pkgname = strdup(pkgname); - } - - ret = notification_ipc_request_delete_multiple(type, caller_pkgname); - if (ret != NOTIFICATION_ERROR_NONE) { - if (caller_pkgname) { - free(caller_pkgname); - } - return ret; - } - - if (caller_pkgname) { - free(caller_pkgname); - } - return NOTIFICATION_ERROR_NONE; -} - -EXPORT_API int notification_delete_group_by_priv_id(const char *pkgname, - notification_type_e type, - int priv_id) -{ - int ret = 0; - char *caller_pkgname = NULL; - - if (pkgname == NULL) { - caller_pkgname = notification_get_pkgname_by_pid(); - } else { - caller_pkgname = strdup(pkgname); - } - - ret = notification_ipc_request_delete_single(type, caller_pkgname, priv_id); - if (ret != NOTIFICATION_ERROR_NONE) { - if (caller_pkgname) { - free(caller_pkgname); - } - return ret; - } - if (caller_pkgname) { - free(caller_pkgname); - } return NOTIFICATION_ERROR_NONE; } -EXPORT_API int notification_set_tag(notification_h noti, const char *tag) +EXPORT_API int notification_remove_button(notification_h noti, notification_button_index_e button_index) { - /* Check noti is valid data */ - if (noti == NULL) { + if (noti == NULL || button_index < NOTIFICATION_BUTTON_1 || button_index > NOTIFICATION_BUTTON_6) return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - if (tag != NULL) { - /* save input TAG */ - if (noti->tag != NULL) { - free(noti->tag); - } - noti->tag = strdup(tag); + if (noti->b_event_handler[button_index - 1]) { + bundle_free(noti->b_event_handler[button_index - 1]); + noti->b_event_handler[button_index - 1] = NULL; } return NOTIFICATION_ERROR_NONE; - } -EXPORT_API int notification_get_tag(notification_h noti, const char **tag) +EXPORT_API int notification_set_auto_remove(notification_h noti, bool auto_remove) { - /* Check noti is valid data */ - if (noti == NULL) { + if (noti == NULL) return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - /* Set sound type */ - *tag = noti->tag; - return NOTIFICATION_ERROR_NONE; -} - -EXPORT_API int notification_register_toast_message(void (*posted_toast_cb) (void *data)) -{ - if (notification_ipc_monitor_init() != NOTIFICATION_ERROR_NONE) { - return NOTIFICATION_ERROR_IO_ERROR; - } - posted_toast_message_cb = posted_toast_cb; + noti->auto_remove = auto_remove; return NOTIFICATION_ERROR_NONE; } -void notification_call_posted_toast_cb(const char *message) -{ - if (posted_toast_message_cb != NULL) { - posted_toast_message_cb((void*)message); - } -} - -EXPORT_API int notification_set_permission(notification_h handle, notification_permission_type_e permission_type, const char *app_id) -{ - return NOTIFICATION_ERROR_INVALID_OPERATION; -} - -EXPORT_API int notification_get_permission(notification_h handle, notification_permission_type_e *permission_type, const char **app_id) +EXPORT_API int notification_get_auto_remove(notification_h noti, bool *auto_remove) { - return NOTIFICATION_ERROR_INVALID_OPERATION; -} - -EXPORT_API int notification_set_ongoing_flag(notification_h noti, bool ongoing_flag) -{ - if (noti == NULL) + if (noti == NULL || auto_remove == NULL) return NOTIFICATION_ERROR_INVALID_PARAMETER; - return NOTIFICATION_ERROR_NONE; -} - -EXPORT_API int notification_get_ongoing_flag(notification_h noti, bool *ongoing_flag) -{ - if (noti == NULL) - return NOTIFICATION_ERROR_INVALID_PARAMETER; + *auto_remove = noti->auto_remove; return NOTIFICATION_ERROR_NONE; } diff --git a/src/notification_ipc.c b/src/notification_ipc.c index eefb406..96149e3 100644 --- a/src/notification_ipc.c +++ b/src/notification_ipc.c @@ -311,6 +311,7 @@ notification_op *notification_ipc_create_op(notification_op_type_e type, int num op_list = (notification_op *)malloc(sizeof(notification_op) * num_op); if (op_list == NULL) { + NOTIFICATION_ERR("malloc failed"); return NULL; } @@ -345,7 +346,7 @@ static inline char *_dup_string(const char *string) ret = strdup(string); if (!ret) - NOTIFICATION_ERR("Error: %d\n", errno); + NOTIFICATION_ERR("Error: %s\n", strerror(errno)); return ret; } @@ -540,7 +541,7 @@ EXPORT_API struct packet *notification_ipc_make_packet_from_noti(notification_h char *b_key = NULL; char *b_format_args = NULL; struct packet *(*func_to_create_packet)(const char *command, const char *fmt, ...); - const char *title_key = NULL; + char *title_key = NULL; char buf_key[32] = { 0, }; /* Decode bundle to insert DB */ @@ -596,14 +597,14 @@ EXPORT_API struct packet *notification_ipc_make_packet_from_noti(notification_h snprintf(buf_key, sizeof(buf_key), "%d", NOTIFICATION_TEXT_TYPE_TITLE); - title_key = bundle_get_val(noti->b_key, buf_key); + bundle_get_str(noti->b_key, buf_key, &title_key); } if (title_key == NULL && noti->b_text != NULL) { snprintf(buf_key, sizeof(buf_key), "%d", NOTIFICATION_TEXT_TYPE_TITLE); - title_key = bundle_get_val(noti->b_text, buf_key); + bundle_get_str(noti->b_text, buf_key, &title_key); } if (title_key == NULL) { @@ -729,7 +730,7 @@ EXPORT_API struct packet *notification_ipc_make_reply_packet_from_noti(notificat char *b_text = NULL; char *b_key = NULL; char *b_format_args = NULL; - const char *title_key = NULL; + char *title_key = NULL; char buf_key[32] = { 0, }; /* Decode bundle to insert DB */ @@ -785,14 +786,14 @@ EXPORT_API struct packet *notification_ipc_make_reply_packet_from_noti(notificat snprintf(buf_key, sizeof(buf_key), "%d", NOTIFICATION_TEXT_TYPE_TITLE); - title_key = bundle_get_val(noti->b_key, buf_key); + bundle_get_str(noti->b_key, buf_key, &title_key); } if (title_key == NULL && noti->b_text != NULL) { snprintf(buf_key, sizeof(buf_key), "%d", NOTIFICATION_TEXT_TYPE_TITLE); - title_key = bundle_get_val(noti->b_text, buf_key); + bundle_get_str(noti->b_text, buf_key, &title_key); } if (title_key == NULL) { diff --git a/src/notification_list.c b/src/notification_list.c index 97d205a..8da4b57 100644 --- a/src/notification_list.c +++ b/src/notification_list.c @@ -25,6 +25,7 @@ #include <notification.h> #include <notification_list.h> +#include <notification_noti.h> #include <notification_debug.h> #include <notification_private.h> @@ -225,3 +226,70 @@ EXPORT_API notification_list_h notification_list_remove(notification_list_h list return NULL; } + +EXPORT_API int notification_get_list(notification_type_e type, + int count, + notification_list_h *list) +{ + notification_list_h get_list = NULL; + int ret = 0; + + if (list == NULL) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + + ret = notification_noti_get_grouping_list(type, count, &get_list); + if (ret != NOTIFICATION_ERROR_NONE) { + return ret; + } + + *list = get_list; + + return NOTIFICATION_ERROR_NONE; +} + +EXPORT_API int notification_get_detail_list(const char *pkgname, + int group_id, + int priv_id, + int count, + notification_list_h *list) +{ + notification_list_h get_list = NULL; + int ret = 0; + + if (list == NULL) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + + ret = + notification_noti_get_detail_list(pkgname, group_id, priv_id, count, + &get_list); + if (ret != NOTIFICATION_ERROR_NONE) { + return ret; + } + + *list = get_list; + + return NOTIFICATION_ERROR_NONE; +} + +EXPORT_API int notification_free_list(notification_list_h list) +{ + notification_list_h cur_list = NULL; + notification_h noti = NULL; + + if (list == NULL) { + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + + cur_list = notification_list_get_head(list); + + while (cur_list != NULL) { + noti = notification_list_get_data(cur_list); + cur_list = notification_list_remove(cur_list, noti); + + notification_free(noti); + } + + return NOTIFICATION_ERROR_NONE; +} diff --git a/src/notification_noti.c b/src/notification_noti.c index 2ba2499..90191f4 100644 --- a/src/notification_noti.c +++ b/src/notification_noti.c @@ -27,12 +27,16 @@ #include <Ecore.h> #include <Elementary.h> #include <Eina.h> +#include <package_manager.h> #include <notification.h> #include <notification_db.h> +#include <notification_list.h> #include <notification_noti.h> #include <notification_debug.h> #include <notification_private.h> +#include <notification_setting.h> +#include <notification_setting_internal.h> #define NOTI_BURST_DELETE_UNIT 10 @@ -710,6 +714,53 @@ err: return ret; } +static bool _is_allowed_to_notify(const char *caller_package_name) +{ + notification_setting_h setting = NULL; + int err; + char *package_id = NULL; + bool ret = true; + + err = notification_setting_get_setting_by_package_name(caller_package_name, &setting); + if (err != NOTIFICATION_ERROR_NONE) { + /* Retry with package id */ + err = package_manager_get_package_id_by_app_id (caller_package_name, &package_id); + + if (err != PACKAGE_MANAGER_ERROR_NONE || package_id == NULL) { + NOTIFICATION_ERR("package_manager_get_package_id_by_app_id failed [%d]", err); + goto out; + } + else { + err = notification_setting_get_setting_by_package_name(package_id, &setting); + if (err != NOTIFICATION_ERROR_NONE) { + NOTIFICATION_ERR("notification_setting_get_setting_by_package_name failed [%d]", err); + goto out; + } + } + } + + err = notification_setting_get_allow_to_notify(setting, &ret); + if (err != NOTIFICATION_ERROR_NONE) { + NOTIFICATION_ERR("notification_setting_get_allow_to_notify failed [%d]", err); + goto out; + } + + if (ret != true) { + NOTIFICATION_DBG("[%s] is not allowed to notify", caller_package_name); + } + +out: + if (package_id) { + free(package_id); + } + + if (setting) { + notification_setting_free_notification(setting); + } + + return ret; +} + EXPORT_API int notification_noti_insert(notification_h noti) { int ret = 0; @@ -717,7 +768,17 @@ EXPORT_API int notification_noti_insert(notification_h noti) sqlite3_stmt *stmt = NULL; char *query = NULL; char buf_key[32] = { 0, }; - const char *title_key = NULL; + char *title_key = NULL; + + if (noti == NULL) { + NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + + if (_is_allowed_to_notify((const char*)noti->caller_pkgname) == false) { + NOTIFICATION_DBG("Not allowed to notify"); + return NOTIFICATION_ERROR_PERMISSION_DENIED; + } /* Open DB */ db = notification_db_open(DBPATH); @@ -750,14 +811,14 @@ EXPORT_API int notification_noti_insert(notification_h noti) snprintf(buf_key, sizeof(buf_key), "%d", NOTIFICATION_TEXT_TYPE_TITLE); - title_key = bundle_get_val(noti->b_key, buf_key); + bundle_get_str(noti->b_key, buf_key, &title_key); } if (title_key == NULL && noti->b_text != NULL) { snprintf(buf_key, sizeof(buf_key), "%d", NOTIFICATION_TEXT_TYPE_TITLE); - title_key = bundle_get_val(noti->b_text, buf_key); + bundle_get_str(noti->b_text, buf_key, &title_key); } if (title_key == NULL) { @@ -970,6 +1031,7 @@ EXPORT_API int notification_noti_get_by_tag(notification_h noti, char *pkgname, } else { ret = NOTIFICATION_ERROR_FROM_DB; } + err: if (stmt) { @@ -1118,7 +1180,7 @@ EXPORT_API int notification_noti_delete_all(notification_type_e type, const char if (tmp) { *list_deleted_rowid = tmp; } else { - NOTIFICATION_ERR("Heap: %d\n", errno); + NOTIFICATION_ERR("Heap: %s\n", strerror(errno)); /*! * \TODO * How can I handle this? @@ -1804,22 +1866,6 @@ EXPORT_API int notification_noti_check_tag(notification_h noti) goto err; } -/* - query = sqlite3_mprintf("select priv_id from noti_list where caller_pkgname = '%s' and tag = '%s'", - noti->caller_pkgname, noti->tag); - if (query == NULL) { - ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; - goto err; - } - - ret = sqlite3_prepare(db, query, strlen(query), &stmt, NULL); - if (ret != SQLITE_OK) { - NOTIFICATION_ERR("Get priv id DB err(%d) : %s", ret, - sqlite3_errmsg(db)); - ret = NOTIFICATION_ERROR_FROM_DB; - goto err; - } -*/ ret = sqlite3_step(stmt); if (ret == SQLITE_ROW) { result = sqlite3_column_int(stmt, 0); diff --git a/src/notification_setting.c b/src/notification_setting.c index ec5e81e..f8c8a05 100644 --- a/src/notification_setting.c +++ b/src/notification_setting.c @@ -24,10 +24,12 @@ #include <stdlib.h> #include <db-util.h> #include <package_manager.h> +#include <pkgmgr-info.h> #include <tizen_type.h> #include <notification.h> #include <notification_db.h> +#include <notification_list.h> #include <notification_noti.h> #include <notification_debug.h> #include <notification_ipc.h> @@ -35,6 +37,8 @@ #include <notification_setting.h> #include <notification_setting_internal.h> +#define NOTIFICATION_PRIVILEGE "http://tizen.org/privilege/notification" + static int _get_table_field_data_int(char **table, int *buf, int index) { @@ -221,7 +225,7 @@ EXPORT_API int notification_setting_get_setting_by_package_name(const char *pack } if (!row_count) { - NOTIFICATION_DBG ("No setting found..."); + NOTIFICATION_DBG ("No setting found for [%s]", package_name); err= NOTIFICATION_ERROR_NOT_EXIST_ID; goto out; } @@ -264,6 +268,7 @@ out: EXPORT_API int notification_setting_get_setting(notification_setting_h *setting) { + int ret; char *package_name = NULL; package_name = notification_get_pkgname_by_pid(); @@ -271,7 +276,11 @@ EXPORT_API int notification_setting_get_setting(notification_setting_h *setting) if (package_name == NULL) return NOTIFICATION_ERROR_NOT_EXIST_ID; - return notification_setting_get_setting_by_package_name(package_name, setting); + ret = notification_setting_get_setting_by_package_name(package_name, setting); + + free(package_name); + + return ret; } EXPORT_API int notification_setting_get_package_name(notification_setting_h setting, char **value) @@ -537,81 +546,7 @@ out: return err; } -static int _get_count_of_setting(sqlite3 *db, int *count) -{ - int sqlite3_ret = SQLITE_OK; - int err = NOTIFICATION_ERROR_NONE; - const char *sql_query = "SELECT COUNT(priv_id) FROM notification_setting"; - char **result_table = NULL; - - if (count == NULL) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); - err = NOTIFICATION_ERROR_INVALID_PARAMETER; - goto out; - } - - sqlite3_ret = sqlite3_get_table(db, sql_query, &result_table, NULL, NULL, NULL); - - if (sqlite3_ret != SQLITE_OK || result_table[1] == NULL) { - NOTIFICATION_ERR("sqlite3_get_table failed [%d][%s]", sqlite3_ret, sqlite3_errmsg(db)); - err = NOTIFICATION_ERROR_FROM_DB; - goto out; - } - - *count = atoi(result_table[1]); - -out: - - if (result_table) - sqlite3_free_table(result_table); - - return err; -} - -static int _get_count_of_package(int *count) -{ - int err = NOTIFICATION_ERROR_NONE; - int pkgmgr_ret = PACKAGE_MANAGER_ERROR_NONE; - package_manager_filter_h package_filter = NULL; - int package_count = 0; - - if (count == NULL) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); - err = NOTIFICATION_ERROR_INVALID_PARAMETER; - goto out; - } - - if ((pkgmgr_ret = package_manager_filter_create (&package_filter)) != PACKAGE_MANAGER_ERROR_NONE) { - NOTIFICATION_ERR("package_manager_filter_create failed [%08X]", pkgmgr_ret); - err = NOTIFICATION_ERROR_FROM_DB; - goto out; - } - - if ((pkgmgr_ret = package_manager_filter_add_bool(package_filter, "PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING", false)) != PACKAGE_MANAGER_ERROR_NONE) { - NOTIFICATION_ERR("package_manager_filter_add_bool failed [%08X]", pkgmgr_ret); - err = NOTIFICATION_ERROR_FROM_DB; - goto out; - } - - if ((pkgmgr_ret = package_manager_filter_count(package_filter, &package_count)) != PACKAGE_MANAGER_ERROR_NONE) { - NOTIFICATION_ERR("package_manager_filter_count failed [%08X]", pkgmgr_ret); - err = NOTIFICATION_ERROR_FROM_DB; - goto out; - } - - *count = package_count; - -out: - if (package_filter) { - if ((pkgmgr_ret = package_manager_filter_destroy(package_filter)) != PACKAGE_MANAGER_ERROR_NONE) { - NOTIFICATION_WARN("package_manager_filter_destroy failed [%08X]", pkgmgr_ret); - } - } - - return err; -} - -static bool foreach_package_info_callback(package_info_h package_info, void *user_data) +static int foreach_package_info_callback(const pkgmgrinfo_pkginfo_h package_info, void *user_data) { sqlite3 *db = user_data; sqlite3_stmt *db_statement = NULL; @@ -621,7 +556,7 @@ static bool foreach_package_info_callback(package_info_h package_info, void *use int field_index = 1; int err = true; - if ((pkgmgr_ret = package_info_get_package(package_info, &package_name)) != PACKAGE_MANAGER_ERROR_NONE) { + if ((pkgmgr_ret = pkgmgrinfo_pkginfo_get_pkgname(package_info, &package_name)) != PACKAGE_MANAGER_ERROR_NONE) { NOTIFICATION_ERR("package_info_get_package failed [%d]", pkgmgr_ret); err = false; goto out; @@ -658,10 +593,6 @@ out: sqlite3_finalize(db_statement); } - if(package_name) { - free(package_name); - } - NOTIFICATION_INFO("foreach_package_info_callback returns[%d]", err); return err; } @@ -672,8 +603,8 @@ EXPORT_API int notification_setting_refresh_setting_table() sqlite3 *db = NULL; int sqlite3_ret = SQLITE_OK; int pkgmgr_ret = PACKAGE_MANAGER_ERROR_NONE; - int setting_count = 0; - int package_count = 0; + pkgmgrinfo_pkginfo_filter_h filter; + uid_t current_uid; sqlite3_ret = db_util_open(DBPATH, &db, 0); @@ -683,32 +614,34 @@ EXPORT_API int notification_setting_refresh_setting_table() goto out; } - if ((err = _get_count_of_setting(db, &setting_count)) != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("_get_count_of_setting failed [%08X]", err); - goto out; - } + sqlite3_exec(db, "BEGIN immediate;", NULL, NULL, NULL); - if ((err = _get_count_of_package(&package_count)) != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("_get_count_of_package failed [%08X]", err); + pkgmgr_ret = pkgmgrinfo_pkginfo_filter_create(&filter); + if (pkgmgr_ret != PMINFO_R_OK) { + NOTIFICATION_ERR("pkgmgrinfo_pkginfo_filter_create failed [%d]", pkgmgr_ret); + err = NOTIFICATION_ERROR_FROM_DB; goto out; } - NOTIFICATION_INFO("setting_count [%d], package_count [%d]", setting_count, package_count); - - if (setting_count == package_count) { - NOTIFICATION_INFO("No need to refresh"); + pkgmgr_ret = pkgmgrinfo_pkginfo_filter_add_string(filter, PMINFO_PKGINFO_PROP_PACKAGE_PRIVILEGE, NOTIFICATION_PRIVILEGE); + if (pkgmgr_ret != PMINFO_R_OK) { + NOTIFICATION_ERR("pkgmgrinfo_pkginfo_filter_add_string failed [%d]", pkgmgr_ret); + err = NOTIFICATION_ERROR_FROM_DB; goto out; } - sqlite3_exec(db, "BEGIN immediate;", NULL, NULL, NULL); + current_uid = getuid(); - pkgmgr_ret = package_manager_foreach_package_info(foreach_package_info_callback, db); - if (pkgmgr_ret != PACKAGE_MANAGER_ERROR_NONE) { - NOTIFICATION_ERR("package_manager_filter_foreach_package_info failed [%d]", pkgmgr_ret); + pkgmgr_ret = pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo(filter, foreach_package_info_callback, db, current_uid); + if (pkgmgr_ret != PMINFO_R_OK) { + NOTIFICATION_ERR("pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo failed [%d]", pkgmgr_ret); err = NOTIFICATION_ERROR_FROM_DB; goto out; } + pkgmgrinfo_pkginfo_filter_destroy(filter); + + out: if (db) { diff --git a/src/notification_status.c b/src/notification_status.c index f64d8a6..20062fb 100644 --- a/src/notification_status.c +++ b/src/notification_status.c @@ -29,10 +29,10 @@ #include <Ecore.h> #include <Elementary.h> #include <Eina.h> -#include <Evas.h> #include <notification.h> #include <notification_db.h> +#include <notification_list.h> #include <notification_noti.h> #include <notification_debug.h> #include <notification_private.h> @@ -43,9 +43,6 @@ #define INTERFACE_NAME "org.tizen.system.notification.status_message" #define MEMBER_NAME "status_message" -static Eina_List *toast_list; -static Evas_Object *toast_popup; - struct _message_cb_data { notification_status_message_cb callback; void *data; @@ -55,126 +52,6 @@ struct _message_cb_data { static struct _message_cb_data md; -int _post_toast_message(char *message); - -static void popup_timeout_cb(void *data, Evas_Object *obj, void *event_info) -{ - char *msg = NULL; - int count = 0; - - evas_object_del(toast_popup); - toast_popup = NULL; - evas_object_del((Evas_Object *)data); - - count = eina_list_count(toast_list); - - if (count == 1){ - msg = (char *)eina_list_data_get(toast_list); - free(msg); - - eina_list_free(toast_list); - toast_list = NULL; - } else if (count > 1) { - msg = (char *)eina_list_data_get(toast_list); - toast_list = eina_list_remove(toast_list, msg); - free(msg); - _post_toast_message((char *)eina_list_data_get(toast_list)); - } -} - -int _post_toast_message(char *message) -{ - Evas_Object *toast_window; - Evas *e; - Ecore_Evas *ee; - double scale = elm_config_scale_get(); - - - toast_window = elm_win_add(NULL, "toast", ELM_WIN_BASIC); - - elm_win_alpha_set(toast_window, EINA_TRUE); - elm_win_title_set(toast_window, "toast"); - - elm_win_indicator_mode_set(toast_window, ELM_WIN_INDICATOR_SHOW); -/** - * @note - * TYPE_1 is deprecated from elementary. - elm_win_indicator_type_set(toast_window, ELM_WIN_INDICATOR_TYPE_1); -*/ - - //elm_win_autodel_set(toast_win, EINA_TRUE); - if (elm_win_wm_rotation_supported_get(toast_window)) { - int rots[4] = { 0, 90, 180, 270 }; - elm_win_wm_rotation_available_rotations_set(toast_window, (const int*)(&rots), 4); - } - - e = evas_object_evas_get(toast_window); - ee = ecore_evas_ecore_evas_get(e); - ecore_evas_name_class_set(ee, "TOAST_POPUP", "SYSTEM_POPUP"); - - evas_object_resize(toast_window, (480 * scale), (650 * scale)); -#if defined(HAVE_X11) - ecore_x_window_shape_input_rectangle_set(elm_win_xwindow_get(toast_window), 0, 0, (480 * scale), (650 * scale)); -#endif - - toast_popup = elm_popup_add(toast_window); - - elm_object_style_set(toast_popup, "toast"); - evas_object_size_hint_weight_set(toast_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - - elm_object_text_set(toast_popup,message); - - if (eina_list_count(toast_list) != 1) { - elm_popup_timeout_set(toast_popup, 1.0); - } - else { - elm_popup_timeout_set(toast_popup, 3.0); - } - evas_object_smart_callback_add(toast_popup, "timeout", popup_timeout_cb, (void *)toast_window); - - elm_win_prop_focus_skip_set(toast_window, EINA_TRUE); - - evas_object_show(toast_window); - evas_object_show(toast_popup); - - return 0; -} - -int notification_noti_post_toast_message(const char *message) -{ - char *msg = NULL; - int count = 0; - - msg = (char *)calloc(strlen(message) + 1, sizeof(char)); - strcpy(msg, message); - - count = eina_list_count(toast_list); - if (count == 0) { - toast_list = eina_list_append(toast_list, msg); - (void)_post_toast_message(msg); - } - else if (count == 1) { - if (strcmp(msg, (char *)eina_list_nth(toast_list, count - 1)) == 0) { - elm_popup_timeout_set(toast_popup, 3.0); - } - else { - toast_list = eina_list_append(toast_list, msg); - elm_popup_timeout_set(toast_popup, 1.0); - } - } - else if (count >= 2) { - if (strcmp(msg, (char *)eina_list_nth(toast_list, count - 1)) == 0) { - free(msg); - return 0; - } - else { - toast_list = eina_list_append(toast_list, msg); - } - } - - return 0; -} - static void __notification_status_message_dbus_callback(void *data, DBusMessage *msg) { int ret = 0; @@ -202,7 +79,7 @@ static void __notification_status_message_dbus_callback(void *data, DBusMessage dbus_error_free(&err); return; } - /*if (!md.callback) + if (!md.callback) return; if (strlen(message) <= 0){ @@ -210,59 +87,7 @@ static void __notification_status_message_dbus_callback(void *data, DBusMessage return; } - md.callback(message, md.data);*/ - - notification_noti_post_toast_message(message); -} - -EXPORT_API -int notification_status_message_post(const char *message) -{ - DBusConnection *connection = NULL; - DBusMessage *signal = NULL; - DBusError err; - dbus_bool_t ret; - - if (!message) { - NOTIFICATION_ERR("message is NULL"); - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - if (strlen(message) <= 0) { - NOTIFICATION_ERR("message has only NULL"); - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - dbus_error_init(&err); - connection = dbus_bus_get(DBUS_BUS_SYSTEM, &err); - if (!connection) { - NOTIFICATION_ERR("Fail to dbus_bus_get"); - return NOTIFICATION_ERROR_FROM_DBUS; - } - - signal = - dbus_message_new_signal(PATH_NAME, INTERFACE_NAME, - MEMBER_NAME); - if (!signal) { - NOTIFICATION_ERR("Fail to dbus_message_new_signal"); - return NOTIFICATION_ERROR_FROM_DBUS; - } - - ret = dbus_message_append_args(signal, - DBUS_TYPE_STRING, &message, - DBUS_TYPE_INVALID); - if (ret) { - ret = dbus_connection_send(connection, signal, NULL); - - if (ret) { - dbus_connection_flush(connection); - } - } - - dbus_message_unref(signal); - dbus_connection_unref(connection); - - return NOTIFICATION_ERROR_NONE; + md.callback(message, md.data); } EXPORT_API @@ -319,3 +144,55 @@ int notification_status_monitor_message_cb_unset(void) return NOTIFICATION_ERROR_NONE; } + +EXPORT_API +int notification_status_message_post(const char *message) +{ + DBusConnection *connection = NULL; + DBusMessage *signal = NULL; + DBusError err; + dbus_bool_t ret; + + if (!message) { + NOTIFICATION_ERR("message is NULL"); + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + + if (strlen(message) <= 0) { + NOTIFICATION_ERR("message has only NULL"); + return NOTIFICATION_ERROR_INVALID_PARAMETER; + } + + dbus_error_init(&err); + connection = dbus_bus_get(DBUS_BUS_SYSTEM, &err); + if (!connection) { + NOTIFICATION_ERR("Fail to dbus_bus_get"); + return NOTIFICATION_ERROR_FROM_DBUS; + } + + signal = + dbus_message_new_signal(PATH_NAME, INTERFACE_NAME, + MEMBER_NAME); + if (!signal) { + NOTIFICATION_ERR("Fail to dbus_message_new_signal"); + return NOTIFICATION_ERROR_FROM_DBUS; + } + + ret = dbus_message_append_args(signal, + DBUS_TYPE_STRING, &message, + DBUS_TYPE_INVALID); + if (ret) { + ret = dbus_connection_send(connection, signal, NULL); + + if (ret) { + dbus_connection_flush(connection); + } + } + + dbus_message_unref(signal); + dbus_connection_unref(connection); + + return NOTIFICATION_ERROR_NONE; +} + + diff --git a/test-app/main.c b/test-app/main.c index 95693ab..bfdb4c0 100644 --- a/test-app/main.c +++ b/test-app/main.c @@ -33,9 +33,11 @@ /* notification header */ #include <notification.h> +#include <notification_internal.h> #include <notification_status.h> #include <notification_setting.h> #include <notification_setting_internal.h> +#include <notification_text_domain.h> /*-----------------------------------------------------------------------------------------*/ /* types */ @@ -151,6 +153,7 @@ void testapp_show_menu (testapp_menu_type_e menu) testapp_print (" 5. Delete all notification\n"); testapp_print (" 6. Post a heads notification with a button\n"); testapp_print (" 7. Post a notification with domain text\n"); + testapp_print (" 8. Load by tag\n"); testapp_print ("------------------------------------------\n"); break; case TESTAPP_MENU_TYPE_SETTING_TEST_MENU: @@ -233,8 +236,15 @@ static int testapp_test_post_notifications() testapp_print("Input count : "); - if (0 >= scanf("%d", &repeat_count)) + if (0 >= scanf("%d", &repeat_count)) { testapp_print("Invalid input"); + goto FINISH_OFF; + } + + if (repeat_count > 30) { + testapp_print("Too many count"); + goto FINISH_OFF; + } for (i = 0; i < repeat_count; i++) { if ((err = testapp_add_a_notification()) != NOTIFICATION_ERROR_NONE) { @@ -243,7 +253,7 @@ static int testapp_test_post_notifications() } } - FINISH_OFF: +FINISH_OFF: return err; } @@ -330,9 +340,9 @@ static int testapp_test_post_heads_up_notification_with_button() noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_TITLE, "I'm Title", "TITLE", NOTIFICATION_VARIABLE_TYPE_NONE); noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_CONTENT, "I'm Content", "CONTENT", NOTIFICATION_VARIABLE_TYPE_NONE); - noti_err = notification_set_display_applist(noti_handle, NOTIFICATION_DISPLAY_APP_HEADS_UP | NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY); + noti_err = notification_set_display_applist(noti_handle, NOTIFICATION_DISPLAY_APP_ACTIVE | NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY); - snprintf(tag, 100, "%d", result); + snprintf(tag, 100, "%d", (int)result); noti_err = notification_set_tag(noti_handle, tag); @@ -417,10 +427,6 @@ static int testapp_test_post_notification_with_domain_text() { notification_h noti_handle = NULL; int noti_err = NOTIFICATION_ERROR_NONE; - int app_control_err = APP_CONTROL_ERROR_NONE; - int priv_id = 0; - int group_id = 0; - char *app_id = NULL; time_t result = time(NULL); char tag[100] = { 0, }; @@ -451,7 +457,7 @@ static int testapp_test_post_notification_with_domain_text() goto FINISH_OFF; } - snprintf(tag, 100, "%d", result); + snprintf(tag, 100, "%d", (int)result); noti_err = notification_set_tag(noti_handle, tag); @@ -476,6 +482,25 @@ FINISH_OFF: return noti_err; } +static int testapp_test_load_by_tag() +{ + notification_h noti_handle = NULL; + int noti_err = NOTIFICATION_ERROR_NONE; + + noti_handle = notification_load_by_tag("hfe4fif#$sd$ew"); + + if (noti_handle == NULL) { + testapp_print("notification_load_by_tag failed"); + goto FINISH_OFF; + } + +FINISH_OFF: + if (noti_handle) + notification_free(noti_handle); + + return noti_err; +} + static gboolean testapp_interpret_command_basic_test (int selected_number) { gboolean go_to_loop = TRUE; @@ -509,6 +534,10 @@ static gboolean testapp_interpret_command_basic_test (int selected_number) testapp_test_post_notification_with_domain_text(); break; + case 8: + testapp_test_load_by_tag(); + break; + case 0: go_to_loop = FALSE; break; @@ -546,9 +575,9 @@ static int testapp_test_get_setting_list() int i = 0; int count = 0; char *package_name = NULL; - bool allow_to_notify = false; - bool do_not_disturb_except = false; - bool visibility_class = false; + bool allow_to_notify = false; + bool do_not_disturb_except = false; + int visibility_class = false; notification_setting_h setting_array = NULL; notification_setting_get_setting_array(&setting_array, &count); @@ -741,7 +770,7 @@ int main (int argc, char *argv[]) if ( testapp_initialize_testing() == FALSE ) { testapp_print ("Initializing failed.\n"); - exit(0); + return 1; } while (go_to_loop) { @@ -754,7 +783,7 @@ int main (int argc, char *argv[]) testapp_finalize_testing(); - exit(0); + return 0; } /* Main } ---------------------------------------------------------------------*/ |