simplify condition handling 84/261384/2
authorJeonghoon Park <jh1979.park@samsung.com>
Fri, 16 Jul 2021 07:57:59 +0000 (16:57 +0900)
committerJeonghoon Park <jh1979.park@samsung.com>
Mon, 19 Jul 2021 01:09:57 +0000 (10:09 +0900)
Change-Id: If0edc31eb4f66fa3d1ba02e849583286431cdb2a

src/common/home_mgr.c

index 002fee1..320dd5c 100755 (executable)
@@ -104,7 +104,7 @@ int home_mgr_get_softkey_pid(void)
 
 void home_mgr_softkey_dead_signal_received()
 {
-       s_home_mgr.softkey_pid = 0;
+       s_home_mgr.softkey_pid = -1;
 }
 
 static void _after_launch_home(int pid)
@@ -444,29 +444,31 @@ static void home_mgr_softkey_change(void *user_data)
        _D("home_mgr_softkey_change");
        int state = TRUE;
        int ret = 0;
+       int pid = -1;
+
        ret = vconf_get_bool(VCONFKEY_SETAPPL_SOFT_KEY, &state);
-       if (ret<0) {
+       if (ret < 0) {
                _D("fail to get VCONFKEY_SETAPPL_SOFT_KEY:%d", ret);
                return;
        }
 
        _D("VCONFKEY_SETAPPL_SOFT_KEY STATUS == %d ", state);
-       int pid = home_mgr_get_softkey_pid();
-       if(state == TRUE && pid > 0)
-       {
-               _D("softkey is already running with PID: %d", pid);
-               return ;
-       }
-       if(state == TRUE) {
-               process_mgr_must_launch(APPID_SOFTKEY, NULL, NULL, NULL, _after_launch_softkey);
-       } else {
-               _D("terminating softkey");
-               int softkey_pid = home_mgr_get_softkey_pid();
-               _D("SoftKey Process Id == %d ", softkey_pid);
-               if(softkey_pid > 0) {
+
+       pid = home_mgr_get_softkey_pid();
+       _D("SoftKey Process Id == %d ", pid);
+
+       if (!state) {
+               if (pid > 0) {
+                       _D("terminating softkey");
                        home_mgr_softkey_process_terminate();
                }
+               return;
        }
+
+       if (pid > 0)
+               _D("softkey is already running with PID: %d", pid);
+       else
+               process_mgr_must_launch(APPID_SOFTKEY, NULL, NULL, NULL, _after_launch_softkey);
 }
 
 static void _softkey_vconf_change_cb(keynode_t *node, void *data)