From: seungha.son Date: Wed, 27 Jul 2016 23:04:33 +0000 (+0900) Subject: Remove alarm-manager dependency X-Git-Tag: submit/tizen/20160803.012753^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1a9948a97d66cfe6e512491a838eaa9b2d347d85;p=platform%2Fcore%2Fapi%2Fnotification.git Remove alarm-manager dependency - Move function for set alarm to data-provider-master : https://review.tizen.org/gerrit/#/c/81679/ Signed-off-by: seungha.son Change-Id: I6c411685d8be0f77544ebfe07c3d04cd4040d4d4 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c323b85..9cae9116 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,6 @@ pkg_check_modules(pkgs REQUIRED libtzplatform-config glib-2.0 gio-2.0 - alarm-service ) FOREACH(flag ${pkgs_CFLAGS}) diff --git a/include/notification_setting_service.h b/include/notification_setting_service.h index b9483daf..2181044a 100644 --- a/include/notification_setting_service.h +++ b/include/notification_setting_service.h @@ -19,7 +19,6 @@ #include #include -#include #ifdef __cplusplus extern "C" { @@ -39,7 +38,6 @@ int notification_setting_db_update_do_not_disturb(int do_not_disturb, uid_t uid) int noti_setting_service_get_setting_by_package_name(const char *package_name, notification_setting_h *setting, uid_t uid); int noti_setting_get_setting_array(notification_setting_h *setting_array, int *count, uid_t uid); int noti_system_setting_load_system_setting(notification_system_setting_h *system_setting, uid_t uid); -int noti_system_setting_set_alarm(int week_flag, int hour, int min, alarm_cb_t handler, alarm_id_t *dnd_schedule_alarm_id); #ifdef __cplusplus } diff --git a/packaging/notification.spec b/packaging/notification.spec index 01f3105c..0295744a 100755 --- a/packaging/notification.spec +++ b/packaging/notification.spec @@ -23,7 +23,6 @@ BuildRequires: pkgconfig(pkgmgr-info) BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(gio-2.0) BuildRequires: pkgconfig(glib-2.0) -BuildRequires: pkgconfig(alarm-service) BuildRequires: cmake Requires(post): /sbin/ldconfig diff --git a/src/notification_setting_service.c b/src/notification_setting_service.c index 3ce82fed..be6438ac 100644 --- a/src/notification_setting_service.c +++ b/src/notification_setting_service.c @@ -32,7 +32,6 @@ #include #include - static int _get_table_field_data_int(char **table, int *buf, int index) { if ((table == NULL) || (buf == NULL) || (index < 0)) { @@ -89,21 +88,6 @@ out: return ret; } -static int _get_current_time(struct tm *date) -{ - time_t now; - - if (date == NULL) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - time(&now); - localtime_r(&now, date); - - return NOTIFICATION_ERROR_NONE; -} - EXPORT_API int noti_setting_service_get_setting_by_package_name(const char *package_name, notification_setting_h *setting, uid_t uid) { @@ -526,79 +510,4 @@ return_close_db: } /* LCOV_EXCL_STOP */ -EXPORT_API -int noti_system_setting_set_alarm(int week_flag, int hour, int min, alarm_cb_t handler, alarm_id_t *dnd_schedule_alarm_id) -{ - int err = NOTIFICATION_ERROR_NONE; - struct tm struct_time; - alarm_entry_t *alarm_info = NULL; - alarm_date_t alarm_time; - alarm_id_t alarm_id = -1; - - err = alarmmgr_init("notification"); - if (err < 0) { - NOTIFICATION_ERR("alarmmgr_init failed (%d)", err); - goto out; - } - - err = alarmmgr_set_cb(handler, NULL); - if (err < 0) { - NOTIFICATION_ERR("alarmmgr_set_cb failed (%d)", err); - goto out; - } - - err = _get_current_time(&struct_time); - if (err != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("get_current_time failed"); - goto out; - } - - alarm_info = alarmmgr_create_alarm(); - if (alarm_info == NULL) { - NOTIFICATION_ERR("alarmmgr_create_alarm failed"); - goto out; - } - - alarm_time.year = struct_time.tm_year + 1900; - alarm_time.month = struct_time.tm_mon + 1; - alarm_time.day = struct_time.tm_mday; - alarm_time.hour = hour; - alarm_time.min = min; - alarm_time.sec = 0; - - err = alarmmgr_set_time(alarm_info, alarm_time); - if (err != ALARMMGR_RESULT_SUCCESS) { - NOTIFICATION_ERR("alarmmgr_set_time failed (%d)", err); - goto out; - } - if (week_flag) { - err = alarmmgr_set_repeat_mode(alarm_info, ALARM_REPEAT_MODE_WEEKLY, week_flag); - if (err != ALARMMGR_RESULT_SUCCESS) { - NOTIFICATION_ERR("alarmmgr_set_repeat_mode failed (%d)", err); - goto out; - } - } - - err = alarmmgr_set_type(alarm_info, ALARM_TYPE_VOLATILE); - if (err != ALARMMGR_RESULT_SUCCESS) { - NOTIFICATION_ERR("alarmmgr_set_type failed (%d)", err); - goto out; - } - - err = alarmmgr_add_alarm_with_localtime(alarm_info, NULL, &alarm_id); - if (err != ALARMMGR_RESULT_SUCCESS) { - NOTIFICATION_ERR("alarmmgr_add_alarm_with_localtime failed (%d)", err); - goto out; - } - - *dnd_schedule_alarm_id = alarm_id; - - NOTIFICATION_DBG("alarm_id [%d]", *dnd_schedule_alarm_id); - -out: - if (alarm_info) - alarmmgr_free_alarm(alarm_info); - - return err; -}