Remove database dependence from HelperAgent 16/86516/4
authorLi Zhang <li2012.zhang@samsung.com>
Thu, 1 Sep 2016 13:17:28 +0000 (21:17 +0800)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 20 Sep 2016 22:25:50 +0000 (15:25 -0700)
Fix self recovery failure issue:
IME open database failed, it gives wrong ise.options to isf-manager.
the right ise.options with SCIM_HELPER_AUTO_RESTART mark, should be
readed in isf-manager side.

Change-Id: I82ef298405051b324b7db2ab75dfcad357abe17a

ism/src/isf_info_manager.cpp
ism/src/scim_helper.cpp

index ad1c7b601a48f4a2d523ede71525e8c6a5ca37be..e03f3e62815ab01d9c43f3cefddc8cdd1d750f7e 100644 (file)
@@ -2496,7 +2496,6 @@ public:
     }
 
     void del_client (int client_id) {
-        LOGD ("id:%d", client_id);
         lock ();
         m_signal_close_connection (client_id);
         ClientInfo client_info = socket_get_client_info (client_id);
@@ -2510,6 +2509,7 @@ public:
         }
 #endif
         unlock ();
+        LOGD ("id:%d type:%d", client_id, client_info.type);
 
         if (client_info.type == FRONTEND_CLIENT) {
             SCIM_DEBUG_MAIN (4) << "It's a FrontEnd client.\n";
@@ -2624,6 +2624,7 @@ public:
                     static String  restart_uuid;
 
                     if (restart_uuid != uuid || secs > MIN_REPEAT_TIME) {
+                        scim_usleep (100000);
                         m_signal_run_helper (uuid, m_config_name, m_display_name);
                         restart_uuid = uuid;
                         LOGE ("Auto restart soft ISE:%s", uuid.c_str ());
@@ -3499,6 +3500,16 @@ client context helpers: %d, helpers uuid count: %d",
         bool result = false;
         lock ();
         LOGD ("");
+        String language;
+        int type;
+        int option;
+        String module_name;
+
+        if (!m_signal_get_ise_information (info.uuid, info.name, language, type, option, module_name)) {
+            LOGD ("This helper is not IME");
+            return;
+        }
+        info.option = option;
 
         if (info.uuid.length ()) {
             SCIM_DEBUG_MAIN (4) << "New Helper uuid=" << info.uuid << " name=" << info.name << "\n";
@@ -3529,6 +3540,16 @@ client context helpers: %d, helpers uuid count: %d",
         SCIM_DEBUG_MAIN (4) << "InfoManager::socket_helper_register_helper_passive (" << client << ")\n";
         LOGD ("");
         lock ();
+        String language;
+        int type;
+        int option;
+        String module_name;
+
+        if (!m_signal_get_ise_information (info.uuid, info.name, language, type, option, module_name)) {
+            LOGD ("This helper is not IME");
+            return;
+        }
+        info.option = option;
 
         if (info.uuid.length ()) {
             SCIM_DEBUG_MAIN (4) << "New Helper Passive uuid=" << info.uuid << " name=" << info.name << "\n";
index e4497384ca1b66f7c438b73be8182b227fe027d7..b2b9119e39c0bfd0a87253765ef0c5a421213074 100644 (file)
@@ -643,25 +643,15 @@ HelperAgent::open_connection (const HelperInfo &info,
     ISF_LOG ("scim_socket_open_connection () is successful.\n");
     LOGD ("scim_socket_open_connection successful\n");
 
-    bool match = false;
-    std::vector<ImeInfoDB> ime_info_db;
-    isf_db_select_all_ime_info (ime_info_db);
-    for (i = 0; i < (int)ime_info_db.size (); i++) {
-        if (ime_info_db[i].appid.compare (info.uuid) == 0) {
-            match = true;
-            break;
-        }
-    }
-
     m_impl->send.clear ();
     m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
     m_impl->send.put_data (magic);
     m_impl->send.put_command (SCIM_TRANS_CMD_PANEL_REGISTER_HELPER);
     m_impl->send.put_data (info.uuid);
-    m_impl->send.put_data (match? ime_info_db[i].label : info.name);
-    m_impl->send.put_data (match? ime_info_db[i].iconpath : info.icon);
+    m_impl->send.put_data (info.name);
+    m_impl->send.put_data (info.icon);
     m_impl->send.put_data (info.description);
-    m_impl->send.put_data (match? ime_info_db[i].options : info.option);
+    m_impl->send.put_data (info.option);
 
     if (!m_impl->send.write_to_socket (m_impl->socket, magic)) {
         m_impl->socket.close ();
@@ -721,10 +711,10 @@ HelperAgent::open_connection (const HelperInfo &info,
     m_impl->send.put_data (magic);
     m_impl->send.put_command (SCIM_TRANS_CMD_PANEL_REGISTER_ACTIVE_HELPER);
     m_impl->send.put_data (info.uuid);
-    m_impl->send.put_data (match? ime_info_db[i].label : info.name);
-    m_impl->send.put_data (match? ime_info_db[i].iconpath : info.icon);
+    m_impl->send.put_data (info.name);
+    m_impl->send.put_data (info.icon);
     m_impl->send.put_data (info.description);
-    m_impl->send.put_data (match? ime_info_db[i].options : info.option);
+    m_impl->send.put_data (info.option);
 
     if (!m_impl->send.write_to_socket (m_impl->socket_active, magic)) {
         ISF_SAVE_LOG ("Helper_Active write_to_socket() failed\n");