From: Haifeng Deng Date: Tue, 7 Jul 2015 06:48:17 +0000 (+0800) Subject: Prevent ISF from restarting the problematic IME repeatedly X-Git-Tag: accepted/tizen/mobile/20150721.092036~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F09%2F44309%2F1;p=platform%2Fcore%2Fuifw%2Fisf.git Prevent ISF from restarting the problematic IME repeatedly Change-Id: Ia6501482debc8c53f5c7e567672db5bdf33d401a Signed-off-by: Haifeng Deng --- diff --git a/ism/src/scim_panel_agent.cpp b/ism/src/scim_panel_agent.cpp index 7e1aab2..36c11ce 100644 --- a/ism/src/scim_panel_agent.cpp +++ b/ism/src/scim_panel_agent.cpp @@ -61,11 +61,20 @@ #include #include +#include +#include #include #include "scim_private.h" #include "scim.h" #include "scim_stl_map.h" +#ifdef LOG_TAG +# undef LOG_TAG +#endif +#define LOG_TAG "ISF_PANEL_AGENT" + +#define MIN_REPEAT_TIME 2.0 + EAPI scim::CommonLookupTable g_isf_candidate_table; @@ -4226,8 +4235,23 @@ private: m_helper_info_repository.erase (hiit); if (restart && !m_ise_exiting) { - m_helper_manager.run_helper (uuid, m_config_name, m_display_name); - std::cerr << "Auto restart soft ISE:" << uuid << "\n"; + struct tms tiks_buf; + static clock_t start_tiks = times (&tiks_buf); + static double clock_tiks = (double)sysconf (_SC_CLK_TCK); + clock_t curr_tiks = times (&tiks_buf); + double secs = (double)(curr_tiks - start_tiks) / clock_tiks; + //LOGE ("time second:%f\n", secs); + + static String restart_uuid; + if (restart_uuid != uuid || secs > MIN_REPEAT_TIME) { + m_helper_manager.run_helper (uuid, m_config_name, m_display_name); + restart_uuid = uuid; + LOGE ("Auto restart soft ISE:%s\n", uuid.c_str ()); + } else { + reset_default_ise (0); + LOGE ("Auto restart is abnormal, reset default ISE\n"); + } + start_tiks = curr_tiks; } }