Send visibility using appid 45/137645/1
authorHyunho Kang <hhstark.kang@samsung.com>
Fri, 7 Jul 2017 02:43:41 +0000 (11:43 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Fri, 7 Jul 2017 02:44:44 +0000 (11:44 +0900)
AMD don't know Add by rid viewer's instance ID

Change-Id: I0d3f79784536be866fb5d12ffcb0a0b3594d2ceb
Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
watch-control/src/control.c

index 820710d76b14517d9911e0e8b4a49be104d0a8f1..e241b1e96bb60b157d90f1a66e5921c54a7111a3 100644 (file)
@@ -62,7 +62,6 @@ static screen_connector_toolkit_evas_h __toolkit;
 
 static Evas_Object *__win;
 static char *__watch_appid;
-static char *__watch_instance_id;
 static char *viewer_appid;
 static int __is_dead_signal_connected;
 static aul_app_com_connection_h __conn_dead_signal;
@@ -75,18 +74,18 @@ struct dead_cb_s {
 
 GQueue *__pending_queue;
 
-static void __process_pending_status(int status, const char *instance_id)
+static void __process_pending_status(int status, const char *appid)
 {
        int r;
 
-       _D("send pending event(%d) to %s", status, instance_id);
+       _D("send pending event(%d) to %s", status, appid);
        r = aul_screen_connector_update_screen_viewer_status(status,
-                       instance_id);
+                       appid);
        if (r < 0)
                _E("Failed to update screen viewer status");
 }
 
-static void __flush_pending_queue(const char *instance_id)
+static void __flush_pending_queue(const char *appid)
 {
        gpointer status_pointer;
        int status;
@@ -99,7 +98,7 @@ static void __flush_pending_queue(const char *instance_id)
        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, instance_id);
+               __process_pending_status(status, appid);
        }
 
        g_queue_free(__pending_queue);
@@ -198,14 +197,7 @@ static void __screen_connector_toolkit_evas_added_cb(const char *appid, const ch
        _D("w: %d, h: %d, x: %d y: %d", w, h, x, y);
        evas_object_smart_callback_call(__win, WATCH_SMART_SIGNAL_ADDED, image);
        evas_object_data_set(__win, "tbm,watch", image);
-
-       if (__watch_instance_id)
-               free(__watch_instance_id);
-       __watch_instance_id = strdup(instance_id);
-       if (__watch_instance_id == NULL)
-               _W("Out of memory");
-
-       __flush_pending_queue(instance_id);
+       __flush_pending_queue(appid);
 }
 
 static void __screen_connector_toolkit_evas_removed_cb(const char *appid, const char *instance_id, int pid,
@@ -250,22 +242,7 @@ API int watch_manager_set_resource_id(int resource_id)
                screen_connector_toolkit_evas_remove(handle);
                return -1;
        }
-
-       if (__watch_instance_id) {
-               free(__watch_instance_id);
-               __watch_instance_id = NULL;
-       }
-
-       ret = aul_screen_connector_get_instance_id_by_surface_id(resource_id,
-                       &__watch_instance_id);
-       if (ret != AUL_R_OK) {
-               _E("Failed to get instance id by surface id(%d)", resource_id);
-               screen_connector_toolkit_evas_remove(handle);
-               return -1;
-       }
-
-       _D("appid(%s), instance_id(%s), rid(%d)",
-                       __watch_appid, __watch_instance_id, resource_id);
+       _D("appid(%s), rid(%d)", __watch_appid, resource_id);
 
        return 0;
 }
@@ -520,21 +497,19 @@ static int __change_viewer_visibility(bool visible)
        else
                status = AUL_SCREEN_STATUS_PAUSE;
 
-       if (__watch_appid == NULL || __watch_instance_id == NULL) {
+       if (__watch_appid == NULL) {
                _E("watch is not added");
                __push_pending_queue(status);
                return 0;
        }
 
        r = aul_screen_connector_update_screen_viewer_status(status,
-                       __watch_instance_id);
+                       __watch_appid);
        if (r < 0) {
                _E("Failed to update screen viewer status");
                return -1;
        }
-
-       _D("send watch control status to %s:%s:%d",
-                       __watch_appid, __watch_instance_id, status);
+       _D("send watch control status to %s:%d", __watch_appid, status);
 
        return 0;
 }
@@ -549,33 +524,14 @@ API int watch_manager_notify_paused_status_of_viewer(void)
        return __change_viewer_visibility(false);
 }
 
-static int __change_visibility(bool visible)
-{
-       Evas_Object *image;
-
-       image = evas_object_data_get(__win, "tbm,watch");
-       if (image == NULL) {
-               _E("Failed to get image");
-               return -1;
-       }
-
-       if (visible) {
-               return screen_connector_toolkit_evas_send_visibility(image,
-                       VISIBILITY_TYPE_UNOBSCURED);
-       } else {
-               return screen_connector_toolkit_evas_send_visibility(image,
-                       VISIBILITY_TYPE_FULLY_OBSCURED);
-       }
-}
-
 API int watch_manager_pause(void)
 {
-       return __change_visibility(false);
+       return __change_viewer_visibility(false);
 }
 
 API int watch_manager_resume(void)
 {
-       return __change_visibility(true);
+       return __change_viewer_visibility(true);
 }
 
 API int watch_manager_window_bind(Evas_Object *win)