Send module name of keyboard Engine 95/239495/3
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 27 Jul 2020 06:51:12 +0000 (15:51 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 30 Jul 2020 07:23:09 +0000 (16:23 +0900)
Change-Id: I744970c31df4e485e941c448450357bd3b338c1d
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
CMakeLists.txt
packaging/ise-default.spec
src/include/ise-dbus.h
src/include/ise.h
src/ise-dbus.cpp
src/ise.cpp
src/sdk/sdk.cpp

index f50d646..0ce650f 100644 (file)
@@ -84,6 +84,7 @@ SET(PKGS_CHECK_MODULES
         glib-2.0
         dbus-1
         gio-2.0
+        pkgmgr-info
         )
 
 IF (with_cbhm)
index 5f5b11c..04dcf86 100644 (file)
@@ -27,6 +27,7 @@ BuildRequires:  pkgconfig(ode)
 BuildRequires:  pkgconfig(capi-system-system-settings)
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(gio-2.0)
+BuildRequires:  pkgconfig(pkgmgr-info)
 
 # This is for old profile-based OBS project optimizations.
 # In 4.0 unified build env, this if statement is always true.
index c948b14..1deea46 100644 (file)
@@ -44,7 +44,7 @@ typedef struct {
 
 bool engine_loader_dbus_init(void *data);
 bool engine_loader_dbus_shutdown();
-void engine_loader_set_imengine(const char *engine_id);
+void engine_loader_set_imengine(const char *engine_id, const char *module_name);
 void engine_loader_flush_imengine();
 void engine_loader_reset_imengine();
 void engine_loader_send_imengine_event(int command, uint32_t value);
index 8cd9db0..02e38f0 100644 (file)
@@ -39,6 +39,7 @@
 #endif
 
 #define DEFAULT_KEYBOARD_ISE_UUID "org.tizen.ise-engine-default"
+#define DEFAULT_KEYBOARD_ISE_PKGID "ise-engine-default"
 
 //#define INPUT_MODE_NATIVE MAX_INPUT_MODE /* Native mode. It will distinguish to the current user language */
 
index 4b6ce7c..fd2186e 100644 (file)
@@ -17,6 +17,7 @@
 #include <dlog.h>
 #include <inputmethod.h>
 #include <inputmethod_internal.h>
+#include <pkgmgr-info.h>
 
 #include "ise-dbus.h"
 
@@ -628,13 +629,13 @@ bool engine_loader_dbus_shutdown()
     return true;
 }
 
-void engine_loader_set_imengine(const char *engine_id)
+void engine_loader_set_imengine(const char *engine_id, const char *module_name)
 {
     GDBusMessage *reply = NULL;
     GVariant *reply_body = NULL;
-    bool result;
+    bool result = false;
 
-    if (_send_sync_message(dbus_info->gdbus_connection, g_variant_new("(s)", engine_id), &reply, "set_imengine")) {
+    if (_send_sync_message(dbus_info->gdbus_connection, g_variant_new("(ss)", engine_id, module_name), &reply, "set_imengine")) {
         reply_body = g_dbus_message_get_body(reply);
         g_variant_get(reply_body, "(b)", &result);
     }
@@ -666,7 +667,7 @@ void engine_loader_send_imengine_event(int command, uint32_t value)
 
 bool engine_loader_process_key_event(scim::KeyEvent& key)
 {
-    bool result;
+    bool result = false;
     GDBusMessage *reply = NULL;
     GVariant *reply_body = NULL;
     GVariantBuilder *key_event_builder = NULL;
index 4a73511..e01508f 100644 (file)
@@ -1412,10 +1412,11 @@ ise_show(int ic)
 
         if (ic == g_keyboard_state.focused_ic) {
             if (g_keyboard_state.layout == ISE_LAYOUT_STYLE_PHONENUMBER ||
-                    g_keyboard_state.layout == ISE_LAYOUT_STYLE_IP ||
-                    g_keyboard_state.layout == ISE_LAYOUT_STYLE_MONTH ||
-                    g_keyboard_state.layout == ISE_LAYOUT_STYLE_NUMBERONLY) {
-                engine_loader_set_imengine(DEFAULT_KEYBOARD_ISE_UUID);
+                g_keyboard_state.layout == ISE_LAYOUT_STYLE_IP ||
+                g_keyboard_state.layout == ISE_LAYOUT_STYLE_MONTH ||
+                g_keyboard_state.layout == ISE_LAYOUT_STYLE_NUMBERONLY) {
+
+                engine_loader_set_imengine(DEFAULT_KEYBOARD_ISE_UUID, DEFAULT_KEYBOARD_ISE_PKGID);
             }
         }
 
index 88aee26..bfd6ea3 100644 (file)
@@ -19,6 +19,7 @@
 #include <iconv.h>
 #include <inputmethod.h>
 #include <inputmethod_internal.h>
+#include <pkgmgr-info.h>
 
 #include "ise.h"
 #include "sdk.h"
@@ -390,7 +391,25 @@ sclboolean CSDKISE::on_language_selected(const sclchar *language, const sclchar
             if (strcmp(language, table[loop].language) == 0) {
                 if (g_ui) {
                     if (table[loop].keyboard_ise_uuid) {
-                        engine_loader_set_imengine(table[loop].keyboard_ise_uuid);
+                        int ret = 0;
+                        char *pkgid = NULL;
+                        pkgmgrinfo_appinfo_h handle;
+                        ret = pkgmgrinfo_appinfo_get_appinfo(table[loop].keyboard_ise_uuid, &handle);
+                        if (ret == PMINFO_R_OK) {
+                            ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid);
+                            if (ret == PMINFO_R_OK) {
+                                engine_loader_set_imengine(table[loop].keyboard_ise_uuid, pkgid);
+                            }
+                            else {
+                                LOGE("Retrieve pkgid failed : %s, %p", table[loop].keyboard_ise_uuid, handle);
+                            }
+                        }
+                        else {
+                            LOGE("Retrieve app info failed : %s", table[loop].keyboard_ise_uuid);
+                        }
+
+                        pkgmgrinfo_appinfo_destroy_appinfo(handle);
+                        handle = NULL;
                         /*
                         g_core.send_imengine_event(-1, table[loop].keyboard_ise_uuid,
                             table[loop].language_command, table[loop].language_code);