Add fgmgr timer to handle bg process
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 21 Mar 2022 07:43:46 +0000 (16:43 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 1 Apr 2022 00:51:18 +0000 (09:51 +0900)
When sending APP_RESUME_BY_PID_ASYNC, APP_RESUME_BY_PID and APP_PAUSE_BY_PID commands,
AMD sends the "AppResume" signal to resourceD.
resourceD expects fg or bg or suspendhint signal after getting the "AppResume" signal.
This patch fixes to send the bg signal if the app process is not changed to the fg.

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

index 78152cf54a4da004d5aeff62709f1edcbea42cac..f020e026f5d2168e941ee97caaac4534ca1ba561 100644 (file)
@@ -1491,6 +1491,7 @@ static int __app_process_by_pid(request_h req, const char *pid_str,
        const struct appinfo *ai;
        uid_t target_uid = _request_get_target_uid(req);
        app_status_h app_status;
+       int cmd;
 
        if (pid_str == NULL)
                return -1;
@@ -1518,7 +1519,8 @@ static int __app_process_by_pid(request_h req, const char *pid_str,
        pkgid = _appinfo_get_value(ai, AIT_PKGID);
        type = _appinfo_get_value(ai, AIT_COMPTYPE);
 
-       switch (_request_get_cmd(req)) {
+       cmd = _request_get_cmd(req);
+       switch (cmd) {
        case APP_RESUME_BY_PID:
        case APP_RESUME_BY_PID_ASYNC:
        case APP_PAUSE_BY_PID:
@@ -1529,7 +1531,7 @@ static int __app_process_by_pid(request_h req, const char *pid_str,
                break;
        }
 
-       switch (_request_get_cmd(req)) {
+       switch (cmd) {
        case APP_RESUME_BY_PID_ASYNC:
                _request_send_result(req, 0);
                ret = _resume_app(pid, req);
@@ -1588,6 +1590,15 @@ static int __app_process_by_pid(request_h req, const char *pid_str,
                ret = -1;
        }
 
+       if (cmd == APP_RESUME_BY_PID || cmd == APP_RESUME_BY_PID_ASYNC ||
+                       cmd == APP_PAUSE_BY_PID) {
+               if (_app_status_get_app_type(app_status) == AT_UI_APP &&
+                       _app_status_get_status(app_status) != STATUS_VISIBLE &&
+                       ret == 0)
+                       __launch_add_fgmgr(pid);
+       }
+
+
        return ret;
 }