Fix wrong parameter of pkgmgrinfo_appinfo_get_usr_appinfo 00/115500/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 20 Feb 2017 07:36:49 +0000 (16:36 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 20 Feb 2017 07:36:49 +0000 (16:36 +0900)
Change-Id: I35dfaffdf427ab72ebff763a02e6329b89d3e717
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
ism/extras/efl_panel/isf_panel_efl.cpp
ism/modules/frontend/scim_socket_frontend.cpp

index 4c57230..45007b8 100644 (file)
@@ -522,6 +522,22 @@ static void get_input_window (void)
 }
 #endif
 
+static int pkgmgr_get_appinfo (const char *appid, pkgmgrinfo_appinfo_h *handle)
+{
+    int ret = 0;
+    /* Try to get in global packages */
+    ret = pkgmgrinfo_appinfo_get_appinfo (appid, handle);
+    if (ret != PMINFO_R_OK) {
+        LOGW ("[pkgmgrinfo_appinfo_get_appinfo] appid : '%s', ret : %d\n", appid, ret);
+        /* Try to get in user packages */
+        ret = pkgmgrinfo_appinfo_get_usr_appinfo (appid, getuid (), handle);
+        if (ret != PMINFO_R_OK)
+            LOGW ("[pkgmgrinfo_appinfo_get_usr_appinfo] appid : '%s', ret : %d\n", appid, ret);
+    }
+
+    return ret;
+}
+
 static void usb_keyboard_signal_cb (void *data, DBusMessage *msg)
 {
     DBusError err;
@@ -5270,16 +5286,12 @@ static void slot_set_active_ise (const String &uuid, bool changeDefault)
        This may be necessary if IME packages are changed while panel process is terminated. */
     pkgmgrinfo_appinfo_h handle = NULL;
     /* Try to get in global packages */
-    int ret = pkgmgrinfo_appinfo_get_appinfo (uuid.c_str (), &handle);
+    int ret = pkgmgr_get_appinfo (uuid.c_str (), &handle);
     if (ret != PMINFO_R_OK) {
-        /* Try to get in user packages */
-        ret = pkgmgrinfo_appinfo_get_usr_appinfo (uuid.c_str (), getpid (), &handle);
-        if (ret != PMINFO_R_OK) {
-            LOGW ("appid \"%s\" is invalid.\n", uuid.c_str ());
-            /* This might happen if IME is uninstalled while the panel process is inactive.
-               The variable uuid would be invalid, so set_active_ise() would return false. */
-            invalid = true;
-        }
+        LOGW ("appid \"%s\" is invalid.\n", uuid.c_str ());
+        /* This might happen if IME is uninstalled while the panel process is inactive.
+           The variable uuid would be invalid, so set_active_ise() would return false. */
+        invalid = true;
     }
 
     if (handle)
@@ -6158,15 +6170,10 @@ static void slot_run_helper (const String &uuid, const String &config, const Str
 
     /* get app info handle */
     /* Try to get in global packages */
-    ret = pkgmgrinfo_appinfo_get_appinfo (uuid.c_str (), &appinfo_handle);
+    ret = pkgmgr_get_appinfo (uuid.c_str (), &appinfo_handle);
     if (ret != PMINFO_R_OK) {
-        /* Try to get in user packages */
-        ret = pkgmgrinfo_appinfo_get_usr_appinfo (uuid.c_str (), getpid (), &appinfo_handle);
-
-        if (ret != PMINFO_R_OK) {
-            LOGW ("pkgmgrinfo_appinfo_get_appinfo () & get_usr_appinfo () failed. appid : %s, ret : %d \n", uuid.c_str (), ret);
-            return;
-        }
+        LOGW ("pkgmgrinfo_appinfo_get_appinfo () & get_usr_appinfo () failed. appid : %s, ret : %d \n", uuid.c_str (), ret);
+        return;
     }
 
     /* Get exec path */
@@ -6247,12 +6254,7 @@ static void update_ise_locale ()
     isf_load_ise_information(ALL_ISE, _config);
 
     for (unsigned int i = 0; i < _ime_info.size (); i++) {
-        /* Try to get in global packages */
-        ret = pkgmgrinfo_appinfo_get_appinfo(_ime_info[i].appid.c_str(), &handle);
-        if (ret != PMINFO_R_OK) {
-            /* Try to get in user packages */
-            ret = pkgmgrinfo_appinfo_get_usr_appinfo(_ime_info[i].appid.c_str(), getpid (), &handle);
-        }
+        ret = pkgmgr_get_appinfo (_ime_info[i].appid.c_str(), &handle);
 
         if (ret == PMINFO_R_OK) {
             ret = pkgmgrinfo_appinfo_is_category_exist(handle, "http://tizen.org/category/ime", &exist);
index 309d870..d63cbf1 100644 (file)
@@ -295,7 +295,7 @@ void SocketFrontEnd::run_helper (const Socket &client)
     ret = pkgmgrinfo_appinfo_get_appinfo (uuid.c_str (), &appinfo_handle);
     if (ret != PMINFO_R_OK) {
         /* Try to get in user packages */
-        ret = pkgmgrinfo_appinfo_get_usr_appinfo (uuid.c_str (), getpid (), &appinfo_handle);
+        ret = pkgmgrinfo_appinfo_get_usr_appinfo (uuid.c_str (), getuid (), &appinfo_handle);
 
         if (ret != PMINFO_R_OK) {
             LOGW ("pkgmgrinfo_appinfo_get_appinfo () & get_usr_appinfo () failed. appid : %s, ret : %d \n", uuid.c_str (), ret);