Modified the ISE not to access imedb directly 44/82944/2
authorJi-hoon Lee <dalton.lee@samsung.com>
Mon, 8 Aug 2016 08:28:56 +0000 (17:28 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 8 Aug 2016 22:41:45 +0000 (07:41 +0900)
Change-Id: Id0e41bf66516a0ba545b9a9f757147284b44a78a

ism/src/Makefile.am
ism/src/scim_helper.cpp
ism/src/scim_module.cpp

index f4e7677..95d9146 100644 (file)
@@ -162,7 +162,8 @@ libscim@SCIM_EPOCH@_la_SOURCES = \
 libscim@SCIM_EPOCH@_la_CXXFLAGS = @EVAS_CFLAGS@ \
                          @DLOG_CFLAGS@ \
                          @DB_UTIL_CFLAGS@ \
-                         @TZPLATFORM_CONFIG_CFLAGS@
+                         @TZPLATFORM_CONFIG_CFLAGS@ \
+                         @PKGMGR_INFO_CFLAGS@
 
 libscim@SCIM_EPOCH@_la_LDFLAGS  = -version-info $(SCIM_CURRENT):$(SCIM_REVISION):$(SCIM_AGE) \
                          -export-dynamic \
@@ -174,6 +175,7 @@ libscim@SCIM_EPOCH@_la_LDFLAGS  = -version-info $(SCIM_CURRENT):$(SCIM_REVISION)
                          @DLOG_LIBS@ \
                          @DB_UTIL_LIBS@ \
                          @TZPLATFORM_CONFIG_LIBS@ \
+                         @PKGMGR_INFO_LIBS@ \
                          -lstdc++
 
 libscim@SCIM_EPOCH@_la_LIBADD  = libltdlc.la
index 6ff8408..2027eae 100644 (file)
@@ -57,6 +57,9 @@
 #include <dlog.h>
 #include "isf_debug.h"
 #include "isf_message_queue.h"
+#if HAVE_PKGMGR_INFO
+#include <pkgmgr-info.h>
+#endif // HAVE_PKGMGR_INFO
 
 #ifdef LOG_TAG
 # undef LOG_TAG
@@ -2276,11 +2279,32 @@ HelperAgent::set_keyboard_ise_by_uuid (const String &uuid) const
         return;
     }
 
-    if (isf_db_select_ime_info_by_appid(uuid.c_str (), &imeInfo) < 1) {
-        LOGW ("ime_info row is not available for %s", uuid.c_str ());
+#if HAVE_PKGMGR_INFO
+    int ret = 0;
+    char *pkgid = NULL;
+    pkgmgrinfo_appinfo_h handle;
+    ret = pkgmgrinfo_appinfo_get_appinfo(uuid.c_str(), &handle);
+    if (ret != PMINFO_R_OK) {
+        LOGW("Retrieve app info failed : %s", uuid.c_str ());
         return;
     }
 
+    ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid);
+    if (ret != PMINFO_R_OK) {
+        LOGW("Retrieve pkgid failed : %s, %p", uuid.c_str(), handle);
+        pkgmgrinfo_appinfo_destroy_appinfo(handle);
+        return;
+    }
+
+    imeInfo.module_name = pkgid;
+    pkgmgrinfo_appinfo_destroy_appinfo(handle);
+#else
+    if (isf_db_select_ime_info_by_appid(uuid.c_str(), &imeInfo) < 1) {
+        LOGW("ime_info row is not available for %s", uuid.c_str());
+        return;
+    }
+#endif
+
     engine_module = &m_impl->engine_module;
 
     if (engine_module->valid() && imeInfo.module_name != engine_module->get_module_name()) {
@@ -2289,7 +2313,6 @@ HelperAgent::set_keyboard_ise_by_uuid (const String &uuid) const
     }
 
     if (!engine_module->valid()) {
-
         if (engine_module->load (imeInfo.module_name, m_impl->m_config) == false) {
             LOGW ("load module %s failed", imeInfo.module_name.c_str());
             return;
index be1ee8b..d6c793b 100644 (file)
@@ -202,7 +202,8 @@ Module::load (const String &name, const String &type)
     ModuleExitFunc new_exit;
 
     if (type.compare("Helper") == 0) {
-        isf_db_select_module_path_by_mode(TOOLBAR_HELPER_MODE, mpath);
+        mpath.push_back(String(SCIM_MODULE_PATH) + String(SCIM_PATH_DELIM_STRING) + String(SCIM_BINARY_VERSION)
+            + String(SCIM_PATH_DELIM_STRING) + String("Helper"));
         for (i = 0; i < mpath.size(); i++) {
             module_path = mpath[i] + String (SCIM_PATH_DELIM_STRING) + name;
             new_handle = lt_dlopenext (module_path.c_str ());
@@ -211,7 +212,8 @@ Module::load (const String &name, const String &type)
         }
     }
     else if (type.compare("IMEngine") == 0 && name.compare("socket")) {
-        isf_db_select_module_path_by_mode(TOOLBAR_KEYBOARD_MODE, mpath);
+        mpath.push_back(String(SCIM_MODULE_PATH) + String(SCIM_PATH_DELIM_STRING) + String(SCIM_BINARY_VERSION)
+            + String(SCIM_PATH_DELIM_STRING) + String("IMEngine"));
         for (i = 0; i < mpath.size(); i++) {
             module_path = mpath[i] + String (SCIM_PATH_DELIM_STRING) + name;
             new_handle = lt_dlopenext (module_path.c_str ());