Support privilege of executable type IME 02/63602/2
authorJihoon Kim <jihoon48.kim@samsung.com>
Thu, 24 Mar 2016 23:57:03 +0000 (08:57 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 24 Mar 2016 23:57:35 +0000 (08:57 +0900)
To support privilege, IME should be launched by app_control.

Change-Id: I38190f7bdeaff57b095e862f309b597320e295e0

ism/modules/frontend/Makefile.am
ism/modules/frontend/scim_socket_frontend.cpp
ism/modules/frontend/scim_socket_frontend.h

index 1eb6a94..3c88453 100644 (file)
@@ -72,7 +72,7 @@ x11_la_LIBADD      = imdkit/libXimd.la \
 
 socket_la_SOURCES  = scim_socket_frontend.cpp
 
-socket_la_CXXFLAGS = @DLOG_CFLAGS@ @ECORE_CFLAGS@ @PKGMGR_INFO_CFLAGS@
+socket_la_CXXFLAGS = @DLOG_CFLAGS@ @ECORE_CFLAGS@ @PKGMGR_INFO_CFLAGS@ @APP_CONTROL_CFLAGS@
 
 socket_la_LDFLAGS  = -avoid-version \
                      -rpath $(moduledir) \
@@ -80,6 +80,7 @@ socket_la_LDFLAGS  = -avoid-version \
                      @DLOG_LIBS@ \
                      @ECORE_LIBS@ \
                      @PKGMGR_INFO_LIBS@ \
+                     @APP_CONTROL_LIBS@ \
                      @LIBTOOL_EXPORT_OPTIONS@
 
 socket_la_LIBADD   = $(top_builddir)/ism/src/libscim@SCIM_EPOCH@.la
index 291d592..86998f8 100644 (file)
@@ -68,6 +68,7 @@
 #include <unistd.h>
 #include <signal.h>
 #include <dlog.h>
+#include <app_control.h>
 #if HAVE_PKGMGR_INFO
 #include <pkgmgr-info.h>
 #endif
@@ -239,6 +240,42 @@ void SocketFrontEnd::launch_helper (const char *name, const char *appid, const c
     }
 }
 
+void SocketFrontEnd::app_control_launch (const char *app_id)
+{
+    app_control_h app_control;
+    int ret;
+
+    ret = app_control_create (&app_control);
+    if (ret != APP_CONTROL_ERROR_NONE) {
+        LOGW ("app_control_create returned %d\n", ret);
+        return;
+    }
+
+    ret = app_control_set_operation (app_control, APP_CONTROL_OPERATION_DEFAULT);
+    if (ret != APP_CONTROL_ERROR_NONE) {
+        LOGW ("app_control_set_operation returned %d\n", ret);
+        app_control_destroy (app_control);
+        return;
+    }
+
+    ret = app_control_set_app_id (app_control, app_id);
+    if (ret != APP_CONTROL_ERROR_NONE) {
+        LOGW ("app_control_set_app_id returned %d\n", ret);
+        app_control_destroy (app_control);
+        return;
+    }
+
+    ret = app_control_send_launch_request (app_control, NULL, NULL);
+    if (ret != APP_CONTROL_ERROR_NONE) {
+        LOGW ("app_control_send_launch_request returned %d, app_id=%s\n", ret, app_id);
+        app_control_destroy (app_control);
+        return;
+    }
+
+    app_control_destroy (app_control);
+    LOGD ("Launch %s\n", app_id);
+}
+
 void SocketFrontEnd::run_helper (const Socket &client)
 {
     String uuid;
@@ -293,7 +330,7 @@ void SocketFrontEnd::run_helper (const Socket &client)
 
     if (scim_helper_path != String (SCIM_HELPER_LAUNCHER_PROGRAM)) {
         /* exe type IME */
-        launch_helper (NULL, NULL, config.c_str (), display.c_str ());
+        app_control_launch (uuid.c_str ());
         m_send_trans.put_command (SCIM_TRANS_CMD_OK);
     }
     else {
index 324441a..38787c5 100644 (file)
@@ -169,6 +169,7 @@ private:
     void load_helper_modules (const std::vector<String> &load_engine_list);
     void get_helper_list (const Socket &client);
     void launch_helper (const char *name, const char *appid, const char *config, const char *display);
+    void app_control_launch (const char *app_id);
     void run_helper (const Socket &client);
 
     void get_active_ise_list (int client_id);