[FIX] killing apps for TV 52/46752/3
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Tue, 25 Aug 2015 12:15:34 +0000 (15:15 +0300)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Tue, 25 Aug 2015 16:54:13 +0000 (09:54 -0700)
Change-Id: I3203ff19729d7fce12125648227a5b9516a18787
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
daemon/Makefile
daemon/utils.c
packaging/swap-manager.spec

index bc4af9b..4cda24b 100644 (file)
@@ -37,6 +37,13 @@ FLAGS := \
        $(INCLUDE) \
        $(DEBUG_FLAGS)
 
+
+# set profile info
+ifeq ($(PROFILE_TV),y)
+FLAGS += -DPROFILE_TV
+endif # PROFILE_TV
+
+
 # CALL_MNGR
 ifeq ($(CALL_MNGR),y)
 FLAGS += -DCALL_MNGR
index e1689e5..c722d7f 100644 (file)
@@ -362,10 +362,17 @@ static int find_alternative_bin_path(const char *binary_path, char *alter_bin_pa
 
 int kill_app(const char *binary_path)
 {
+#ifdef PROFILE_TV
+       /* usage of SIGTERM signal isn't possible on TV */
+       enum { FINISH_SIG = SIGKILL };
+#else /* PROFILE_TV */
+       enum { FINISH_SIG = SIGTERM };
+#endif /* PROFILE_TV */
+
        pid_t pkg_pid;
        char alter_bin_path[PATH_MAX];
 
-       LOGI("kill %s (%d)\n", binary_path, SIGKILL);
+       LOGI("kill %s (%d)\n", binary_path, FINISH_SIG);
 
        pkg_pid = get_pid_by_path(binary_path);
 
@@ -375,9 +382,9 @@ int kill_app(const char *binary_path)
        }
 
        if (pkg_pid != 0) {
-               if (kill(pkg_pid, SIGTERM) == -1) {
+               if (kill(pkg_pid, FINISH_SIG) == -1) {
                        GETSTRERROR(errno, err_buf);
-                       LOGE("cannot kill %d -%d errno<%s>\n", pkg_pid, SIGKILL,
+                       LOGE("cannot kill %d -%d errno<%s>\n", pkg_pid, FINISH_SIG,
                             err_buf);
                        return -1;
                } else {
@@ -385,7 +392,7 @@ int kill_app(const char *binary_path)
                        // returns control immediately after send signal
                        // without it app_launch returns err on start app
                        sleep(1);
-                       LOGI("killed %d -%d\n", pkg_pid, SIGKILL);
+                       LOGI("killed %d -%d\n", pkg_pid, FINISH_SIG);
                }
        } else
                LOGI("cannot kill <%s>; process not found\n", binary_path);
index 46fb01b..19308ca 100644 (file)
@@ -59,7 +59,9 @@ cd daemon
 SWAP_BUILD_CMD+=" CALL_MNGR=y"
 %endif
 
-%if "%{?tizen_profile_name}" != "tv"
+%if "%{?tizen_profile_name}" == "tv"
+SWAP_BUILD_CMD+=" PROFILE_TV=y"
+%else
 SWAP_BUILD_CMD+=" WSP_SUPPORT=y"
 %endif