Fix the issue that IME doesn't work when ISF was terminated in On-demand mode 13/191613/3
authorInhong Han <inhong1.han@samsung.com>
Fri, 19 Oct 2018 02:20:34 +0000 (11:20 +0900)
committerInHong Han <inhong1.han@samsung.com>
Fri, 19 Oct 2018 06:35:44 +0000 (06:35 +0000)
Change-Id: I33539fe3a38c46920a5081d4dd3f7324111d5c30

ism/extras/efl_panel/isf_panel_efl.cpp

index de92774..a5c95fc 100644 (file)
@@ -290,6 +290,7 @@ static void       show_ime_selector_notification       (void);
 #endif
 static void       set_language_and_locale              (const char *lang_str);
 static bool       app_control_launch                   (const char *app_id);
+static void       terminate_active_ise                 (const String uuid);
 
 /////////////////////////////////////////////////////////////////////////////
 // Declaration of internal variables.
@@ -6615,6 +6616,24 @@ static void add_ise_check_pid_alive_timer(const String &uuid) {
         ise_check_pid_alive_timer, NULL);
 }
 
+static void terminate_active_ise (const String uuid)
+{
+    /* Check if IME with the same AppID is alive */
+    int status_ret = aul_app_get_status (uuid.c_str ());
+    if (status_ret >= STATUS_LAUNCHING) {
+        /* Request to terminate IME */
+        int ime_pid = aul_app_get_pid (uuid.c_str ());
+        status_ret = aul_terminate_pid (ime_pid);
+        if (status_ret < AUL_R_OK) {
+            LOGE ("aul_terminate_pid(%d) failed: %d", ime_pid, status_ret);
+        }
+        else {
+            LOGD ("Requested to terminate IME(%s)", uuid.c_str ());
+            usleep (1000000);
+        }
+    }
+}
+
 static void slot_run_helper (const String &uuid, const String &config, const String &display)
 {
     ISF_SAVE_LOG ("time:%ld  pid:%d  %s  %s  uuid(%s)",
@@ -6661,20 +6680,7 @@ static void slot_run_helper (const String &uuid, const String &config, const Str
     for (size_t i = 0; i < _ime_info.size (); ++i) {
         if (_ime_info[i].appid == uuid && _ime_info[i].module_name.length ()) {
             if (scim_helper_path != String (SCIM_HELPER_LAUNCHER_PROGRAM)) {
-                /* Check if IME with the same AppID is alive */
-                int status_ret = aul_app_get_status (uuid.c_str ());
-                if (status_ret >= STATUS_LAUNCHING) {
-                    /* Request to terminate IME */
-                    int ime_pid = aul_app_get_pid (uuid.c_str ());
-                    status_ret = aul_terminate_pid (ime_pid);
-                    if (status_ret < AUL_R_OK) {
-                        LOGE ("aul_terminate_pid(%d) failed: %d", ime_pid, status_ret);
-                    }
-                    else {
-                        LOGD ("Requested to terminate IME(%s)", uuid.c_str ());
-                        usleep (1000000);
-                    }
-                }
+                terminate_active_ise (uuid);
                 /* execute type IME */
                 LOGD ("Try to launch IME (%s)", uuid.c_str ());
                 app_control_launch (uuid.c_str ());
@@ -7956,6 +7962,9 @@ int main (int argc, char *argv [])
             }
         }
 
+        /* Request to terminate active IME */
+        terminate_active_ise (_initial_ise_uuid);
+
         /* Launches default soft keyboard when all conditions are satisfied */
         launch_default_soft_keyboard ();