Support window event 94/263694/3
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 8 Sep 2021 07:49:13 +0000 (16:49 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 8 Sep 2021 23:25:53 +0000 (08:25 +0900)
When the window of the application is appeared, AMD emits an event
signal.

Requires:
 - https://review.tizen.org/gerrit/#/c/platform/core/appfw/aul-1/+/263688/

Change-Id: I48d47f91262491d651128441b60d1b1dedf6e037
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/modules/ui-core/src/app_group_request.c

index a37a7806df9e8ad969d29223b72c31fc36d3eb5e..1f6a4bc41284108f73f37c9b4d9a37a2028f329e 100644 (file)
 #include "app_group_private.h"
 #include "window_group.h"
 
+static void __send_window_event(const char *event_name, int wid, int pid,
+               uid_t uid)
+{
+       amd_app_status_h app_status;
+       bundle *envelope;
+       char buf[32];
+
+       envelope = bundle_create();
+       if (!envelope) {
+               _E("Out of memory");
+               return;
+       }
+
+       bundle_add(envelope, AUL_K_EVENT_NAME, event_name);
+       app_status = amd_app_status_find_by_pid(pid);
+       bundle_add(envelope, AUL_K_APPID, amd_app_status_get_appid(app_status));
+       snprintf(buf, sizeof(buf), "%d", wid);
+       bundle_add(envelope, AUL_K_WID, buf);
+       snprintf(buf, sizeof(buf), "%d", pid);
+       bundle_add(envelope, AUL_K_PID, buf);
+
+       amd_app_com_send("aul_window_event", pid, envelope, uid);
+       bundle_free(envelope);
+}
+
 static app_group_h __find_app_group_by_pid(pid_t pid)
 {
        const char *id;
@@ -162,6 +187,7 @@ static int __dispatch_app_group_set_window(amd_request_h req)
 
        _screen_connector_add_app_screen(pid, wid, NULL, uid);
        amd_noti_send(AMD_NOTI_MSG_APP_GROUP_WINDOW_SET, pid, wid, NULL, NULL);
+       __send_window_event("Appeared", wid, pid, amd_request_get_uid(req));
        _I("pid(%d), wid(%d), result(%d)", pid, wid, ret);
 
        return ret;
@@ -653,6 +679,7 @@ static int __dispatch_app_group_set_window_v2(amd_request_h req)
        _screen_connector_add_app_screen(pid, wid, id, uid);
        amd_noti_send(AMD_NOTI_MSG_APP_GROUP_WINDOW_SET,
                        pid, wid, (void *)id, NULL);
+       __send_window_event("Appeared", wid, pid, uid);
        _I("id(%s), wid(%u), result(%d)", id, wid, ret);
 
        return ret;