Delete go to watch timer if lcd is on during timer 30/130830/5
authorjunkyu han <junkyu.han@samsung.com>
Wed, 24 May 2017 06:26:30 +0000 (15:26 +0900)
committerjunkyu han <junkyu.han@samsung.com>
Wed, 24 May 2017 06:48:40 +0000 (15:48 +0900)
Change-Id: I4f864bedcfc0b2a44f59876204d34b37bf0ee9e2

src/wearable/starter.c

index 7d20894..992a732 100755 (executable)
 #include "home_mgr.h"
 #include "process_mgr.h"
 
+#define GO_TO_WATCH_TIME 20
 int errno;
 
 
-
 static struct {
        int lcd_status;
+       Ecore_Timer *go_watch_timer;
 } s_starter = {
        .lcd_status = -1,
+       .go_watch_timer = NULL,
 };
 
 
@@ -121,10 +123,22 @@ static void _on_lcd_changed_receive(void *data, DBusMessage *msg)
        if (lcd_on) {
                _W("LCD on");
                s_starter.lcd_status = 1;
+
+               if (s_starter.go_watch_timer) {
+                       ecore_timer_del(s_starter.go_watch_timer);
+                       s_starter.go_watch_timer = NULL;
+               }
        } else if (lcd_off) {
                _W("LCD off");
                s_starter.lcd_status = 0;
-               if (!ecore_timer_add(20, _go_to_watch_after_screenoff_cb, NULL)) {
+
+               if (s_starter.go_watch_timer) {
+                       ecore_timer_del(s_starter.go_watch_timer);
+                       s_starter.go_watch_timer = NULL;
+               }
+
+               s_starter.go_watch_timer = ecore_timer_add(GO_TO_WATCH_TIME, _go_to_watch_after_screenoff_cb, NULL);
+               if (!s_starter.go_watch_timer) {
                        _E("Falied to add timer for launching watch face after screenoff");
                }
        } else {