Try re-launch IME if launch request failure is detected 39/147839/4
authorJi-hoon Lee <dalton.lee@samsung.com>
Wed, 6 Sep 2017 01:48:26 +0000 (10:48 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Wed, 6 Sep 2017 02:08:35 +0000 (11:08 +0900)
Change-Id: I3ae551ec463bed100e4debff6f4338e88007c52f

ism/extras/efl_panel/isf_panel_efl.cpp

index aadfcdb..7857d99 100644 (file)
@@ -1884,7 +1884,6 @@ static bool set_active_ise (const String &uuid, bool launch_ise)
 #ifdef HAVE_VCONF
                 vconf_set_str (VCONFKEY_ISF_ACTIVE_KEYBOARD_UUID, uuid.c_str ());
 #endif
-                LOGD ("Succeeded to launch IME (%s)\n", uuid.c_str ());
             }
             else {
                 LOGW ("Failed to launch IME (%s)\n", uuid.c_str ());
@@ -6208,15 +6207,20 @@ static void app_control_launch (const char *app_id)
         return;
     }
 
-    ret = app_control_send_launch_request (app_control, NULL, NULL);
-    if (ret != APP_CONTROL_ERROR_NONE) {
+    int tries = 0;
+    do {
+        if (tries != 0) usleep(1000000); /* If we are retrying to launch, pause for a while */
+        ret = app_control_send_launch_request(app_control, NULL, NULL);
         LOGW ("app_control_send_launch_request returned %08x, app_id=%s\n", ret, app_id);
-        app_control_destroy (app_control);
-        return;
-    }
+    } while (ret != APP_CONTROL_ERROR_NONE && (++tries) < 3);
 
     app_control_destroy (app_control);
-    LOGD ("Succeeded to launch IME (%s)\n", app_id);
+
+    if (ret != APP_CONTROL_ERROR_NONE) {
+        LOGW ("Failed to launch IME (%s)\n", app_id);
+    } else {
+        LOGD ("Succeeded to launch IME (%s)\n", app_id);
+    }
 }
 
 static void slot_run_helper (const String &uuid, const String &config, const String &display)