Fix timeout handler of ANR monitor
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 16 Dec 2021 22:19:21 +0000 (07:19 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 16 Dec 2021 22:25:18 +0000 (07:25 +0900)
If the command is not the launch request, AMD should not send the watchdog signal
to ResourceD when ANR occurs.

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

index bc342d0..17b9a3e 100644 (file)
@@ -99,6 +99,25 @@ static bool __can_ignore_anr_policy(app_status_h app_status)
        return false;
 }
 
+static bool __is_launch_request(int cmd)
+{
+       switch (cmd) {
+       case APP_OPEN:
+       case APP_RESUME:
+       case APP_RESUME_BY_PID:
+       case APP_START:
+       case APP_START_RES:
+       case APP_START_ASYNC:
+       case APP_START_RES_ASYNC:
+       case APP_SEND_LAUNCH_REQUEST:
+       case APP_SEND_LAUNCH_REQUEST_SYNC:
+       case APP_SEND_RESUME_REQUEST:
+               return true;
+       default:
+               return false;
+       }
+}
+
 static gboolean __timeout_handler(gpointer data)
 {
        pid_t pid = GPOINTER_TO_INT(data);
@@ -126,6 +145,9 @@ static gboolean __timeout_handler(gpointer data)
        }
 
        _W("Application(%d) Not Responding. cmd(%d)", pid, cmd);
+       if (!__is_launch_request(cmd))
+               return G_SOURCE_REMOVE;
+
        if (__can_ignore_anr_policy(app_status)) {
                _W("Ignore ANR policy. pid(%d)", pid);
                return G_SOURCE_REMOVE;