From 29616c9e89f3621ddc339cc55894fca6a7df0436 Mon Sep 17 00:00:00 2001 From: Jinjin Shi Date: Thu, 24 Jan 2013 17:36:26 +0800 Subject: [PATCH] [Bug][N_SE-22853]Update time Change-Id: I2745b8f625285e6e5292f8260682aa39258d9f7c --- CMakeLists.txt | 1 + org.tizen.lockscreen.xml.in | 2 +- packaging/org.tizen.lockscreen.spec | 3 +- src/info.c | 16 ++++++++ src/info.h | 1 + src/lockscreen.h | 2 + src/util.c | 75 +++++++++++++++++++++++++++++++++++++ 7 files changed, 98 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a884672..7ad0e39 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,6 +45,7 @@ pkg_check_modules(pkgs REQUIRED notification security-server ui-gadget-1 + heynoti capi-system-info ) diff --git a/org.tizen.lockscreen.xml.in b/org.tizen.lockscreen.xml.in index ff05039..25c9f5e 100755 --- a/org.tizen.lockscreen.xml.in +++ b/org.tizen.lockscreen.xml.in @@ -1,5 +1,5 @@ - + Youngjoo Park seungtaek chung diff --git a/packaging/org.tizen.lockscreen.spec b/packaging/org.tizen.lockscreen.spec index 607bbfb..753de7d 100755 --- a/packaging/org.tizen.lockscreen.spec +++ b/packaging/org.tizen.lockscreen.spec @@ -2,7 +2,7 @@ Name: org.tizen.lockscreen Summary: lockscreen application -Version: 0.1.8 +Version: 0.1.9 Release: 1 Group: TBD License: Apache @@ -15,6 +15,7 @@ BuildRequires: pkgconfig(ail) BuildRequires: pkgconfig(notification) BuildRequires: pkgconfig(security-server) BuildRequires: pkgconfig(ui-gadget-1) +BuildRequires: pkgconfig(heynoti) BuildRequires: pkgconfig(capi-system-info) BuildRequires: cmake diff --git a/src/info.c b/src/info.c index 16dc628..395a2b7 100755 --- a/src/info.c +++ b/src/info.c @@ -178,3 +178,19 @@ void _set_info(void *data) } } } + +void update_time(void *data) +{ + struct appdata *ad = data; + if (ad == NULL) { + return; + } + + int is_clock = -1; + int retc = vconf_get_bool(VCONFKEY_LOCKSCREEN_CLOCK_DISPLAY, &is_clock); + if(0 == retc) { + if(is_clock) { + _set_info_time(ad->info); + } + } +} diff --git a/src/info.h b/src/info.h index 6b685eb..d281150 100755 --- a/src/info.h +++ b/src/info.h @@ -18,5 +18,6 @@ #define __INFO_H__ void _set_info(void *data); +void update_time(void *data); #endif diff --git a/src/lockscreen.h b/src/lockscreen.h index 1d23a20..deb6f75 100755 --- a/src/lockscreen.h +++ b/src/lockscreen.h @@ -73,6 +73,8 @@ struct appdata { Eina_Bool bFlick;//flick to launch shorcuts Eina_Bool bDrag;//for drag lock + int heynoti_fd; + void *h_password_policy; Ecore_Timer *password_timer; int block_seconds; diff --git a/src/util.c b/src/util.c index 7cd8015..0d640c0 100755 --- a/src/util.c +++ b/src/util.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "util.h" #include "info.h" @@ -28,6 +29,7 @@ #include "noti.h" #define DEFAULT_BG_PATH "/opt/share/settings/Wallpapers/Home_default.jpg" +#define SYSTEM_RESUME "system_wakeup" static Evas_Coord pos_down_y = 0; @@ -223,6 +225,68 @@ static void _app_exit(void *data, Evas_Object *obj, const char *emission, const _app_terminate(ad); } +static int _init_heynoti(void *data) +{ + struct appdata *ad = data; + if (ad == NULL) { + return EXIT_FAILURE; + } + int fd = -1, ret = -1; + LOCK_SCREEN_TRACE_DBG("[ == %s == ]", __func__); + + fd = heynoti_init(); + if (fd == -1) { + LOCK_SCREEN_TRACE_DBG("Heynoti init error\n"); + return EXIT_FAILURE; + } + + ret = heynoti_subscribe(fd, SYSTEM_RESUME, update_time, ad); + if (ret == -1) { + LOCK_SCREEN_TRACE_DBG("[Error] heynoti_subscribe : system_wakeup\n"); + return EXIT_FAILURE; + } + + ret = heynoti_attach_handler(fd); + if (ret == -1) { + LOCK_SCREEN_TRACE_DBG("[Error] heynoti_attach_handler failed.\n"); + return EXIT_FAILURE; + } + + ad->heynoti_fd = fd; + + return EXIT_SUCCESS; +} + +static void _fini_heynoti(void *data) +{ + struct appdata *ad = data; + if (ad == NULL) { + return; + } + LOCK_SCREEN_TRACE_DBG("[ == %s == ]", __func__); + heynoti_unsubscribe(ad->heynoti_fd, SYSTEM_RESUME, update_time); + heynoti_close(ad->heynoti_fd); + ad->heynoti_fd = 0; +} + +static void _pm_state_cb(keynode_t * node, void *data) +{ + LOCK_SCREEN_TRACE_DBG("_pm_state_cb"); + + struct appdata *ad = data; + int val = -1; + + if (vconf_get_int(VCONFKEY_PM_STATE, &val) < 0) { + LOCK_SCREEN_TRACE_ERR("Cannot get VCONFKEY_PM_STATE"); + return; + } + + if (val == VCONFKEY_PM_STATE_NORMAL) { + LOCK_SCREEN_TRACE_DBG("LCD on"); + update_time(ad); + } +} + static Eina_Bool _init_widget_cb(void *data) { struct appdata *ad = data; @@ -251,6 +315,14 @@ static Eina_Bool _init_widget_cb(void *data) elm_object_part_content_set(ad->ly_main, "rect.info", ad->info); _set_info(ad); + if(_init_heynoti(ad) != EXIT_SUCCESS) { + LOCK_SCREEN_TRACE_DBG("heynoti ERR..!!"); + } + + if (vconf_notify_key_changed(VCONFKEY_PM_STATE, _pm_state_cb, ad) != 0) { + LOCK_SCREEN_TRACE_ERR("Fail vconf_notify_key_changed : VCONFKEY_PM_STATE"); + } + int state = 0; vconf_get_bool(VCONFKEY_LOCKSCREEN_EVENT_NOTIFICATION_DISPLAY, &state); if(state){ @@ -331,6 +403,9 @@ int _app_terminate(struct appdata *ad) return -1; } + vconf_ignore_key_changed(VCONFKEY_PM_STATE, _pm_state_cb); + _fini_heynoti(ad); + LOGD("[%s] app termiante", __func__); elm_exit(); -- 2.7.4