Fix a timing issue about suspend preparation
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 6 Apr 2022 07:29:39 +0000 (16:29 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 6 Apr 2022 07:44:43 +0000 (16:44 +0900)
Currently, AMD sends a suspend event to the process after executing an
application. In this time, the AUL socket of the executed process is not
prepared. It makes an issue about AMD latency. This patch uses g_timeout_add()
instead of g_idle_add().

Change-Id: Ia8dd6b56f8130726f34a302cee89ddecba5beaf8
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/lib/amd_launch.c

index f020e02..ec89bf6 100644 (file)
@@ -946,10 +946,13 @@ static gboolean __check_service_only(gpointer user_data)
 
        SECURE_LOGD("[__SUSPEND__] pid :%d", pid);
        app_status = _app_status_find(pid);
+       if (!app_status)
+               return G_SOURCE_REMOVE;
+
        _app_status_check_service_only(app_status,
                        __prepare_to_suspend);
 
-       return FALSE;
+       return G_SOURCE_REMOVE;;
 }
 
 static int __check_allowed_appid(const char *callee_appid,
@@ -3165,8 +3168,10 @@ static int __do_starting_app(struct launch_s *handle, request_h req,
        }
 
        if (comp_type && !strcmp(comp_type, APP_TYPE_SERVICE)) {
-               if (!handle->bg_allowed)
-                       g_idle_add(__check_service_only, GINT_TO_POINTER(ret));
+               if (!handle->bg_allowed) {
+                       g_timeout_add(5000, __check_service_only,
+                                       GINT_TO_POINTER(ret));
+               }
        }
 
        return ret;