Fix duplicate pre resume call 60/151260/2
authorHyunho Kang <hhstark.kang@samsung.com>
Tue, 22 Aug 2017 10:13:54 +0000 (19:13 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Wed, 20 Sep 2017 09:14:21 +0000 (18:14 +0900)
Change-Id: I82dbddd7b51e5683d06123807449762d4f0aff81
Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
src/watch_app_main.c

index 9fc9c1639fb3352e7d550b5cc3a06fd0c7b1ade4..b9c93150512fdd7ea8fb3ac21bf1fc11b2f89422 100755 (executable)
@@ -107,6 +107,7 @@ static watch_app_ambient_tick_type_e ambient_tick_type = WATCH_APP_AMBIENT_TICK_
 static watch_app_time_tick_resolution_e app_tick_type = WATCH_APP_TIME_TICKS_PER_SECOND;
 static int app_tick_resolution = 1;
 static aul_app_com_connection_h __conn_viewer_state;
+static bool __pre_resume_called = 0;
 
 struct app_event_handler {
        app_event_type_e type;
@@ -559,6 +560,9 @@ static int __on_pause(void *data)
 {
        _W("_watch_core_pause");
 
+       /* clear pre resume flag */
+       __pre_resume_called = 0;
+
        __context.watch_visibility = WVS_PAUSE;
        /* Handling the ambient mode */
        if (__context.ambient_mode)
@@ -776,10 +780,12 @@ static int __viewer_state_handler(const char *widget_id, aul_app_com_result_e e,
                __on_resume(NULL);
        } else if (*state == AUL_SCREEN_STATUS_PAUSE) {
                __on_pause(NULL);
-       } else if (*state == AUL_SCREEN_STATUS_PRE_RESUME) {
+       } else if (*state == AUL_SCREEN_STATUS_PRE_RESUME
+                       && __pre_resume_called == 0) {
                __get_timeinfo(&timeinfo);
                _D("call pre resume tick");
                __on_time_tick(&timeinfo, NULL);
+               __pre_resume_called = 1;
        }
 
        if (timeinfo.timezone)