Modify pending queue handling 78/182878/1
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 28 Jun 2018 10:23:16 +0000 (19:23 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 28 Jun 2018 10:23:16 +0000 (19:23 +0900)
When sending viewer visibility event to the provider,
the consumer does not send the previous visibility.

Change-Id: Iaf9c0c19e11be084672f17669473e09e0f7d318a
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
watch-control/src/control.c

index 4abdbe8..6deca36 100755 (executable)
@@ -84,7 +84,7 @@ struct dead_cb_s {
        void *data;
 };
 
-GQueue *__pending_queue;
+static bool __is_pended;
 static int __change_viewer_visibility(int visibility, bool update_cur_state);
 static int __change_visibility(int visibility);
 static aul_app_com_connection_h __conn_launch_signal;
@@ -99,7 +99,7 @@ static void __process_pending_status(int status, unsigned int surf)
 {
        int r;
 
-       _D("send pending event(%d) to %s:%u", status, __watch_appid, surf);
+       _W("Send pending event(%d) to %s:%u", status, __watch_appid, surf);
        r = aul_screen_connector_update_screen_viewer_status(status, surf);
        if (r < 0)
                _E("Failed to update screen viewer status");
@@ -107,36 +107,17 @@ static void __process_pending_status(int status, unsigned int surf)
 
 static void __flush_pending_queue(unsigned int surf)
 {
-       gpointer status_pointer;
-       int status;
-
-       if (!__pending_queue) {
-               _D("Pending queue is empty");
+       if (!__is_pended)
                return;
-       }
 
-       while (!g_queue_is_empty(__pending_queue)) {
-               status_pointer = g_queue_pop_head(__pending_queue);
-               status = GPOINTER_TO_INT(status_pointer);
-               __process_pending_status(status, surf);
-       }
-
-       g_queue_free(__pending_queue);
-       __pending_queue = NULL;
+       __process_pending_status(__viewer_visibility, surf);
+       __is_pended = false;
 }
 
 static void __push_pending_queue(int status)
 {
-       if (!__pending_queue)
-               __pending_queue= g_queue_new();
-
-       if (!__pending_queue) {
-               _E("Out of memory");
-               return;
-       }
-
-       g_queue_push_tail(__pending_queue, GINT_TO_POINTER(status));
-       _D("status(%d)", status);
+       __is_pended = true;
+       _W("status(%d)", status);
 }
 
 static void __win_resized(void *data, Evas *e, Evas_Object *obj, void *event_info)