Modify to launch the syspopup application 26/50126/6 submit/tizen/20151028.020252
authorHwankyu Jhun <h.jhun@samsung.com>
Sat, 24 Oct 2015 07:47:45 +0000 (16:47 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 27 Oct 2015 10:34:17 +0000 (19:34 +0900)
Launching request for syspopup is changed to gdbus signal
for system user.

Change-Id: Iff8321d42d2f4660dd2c85e2e141133501861042
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
CMakeLists.txt
include/simple_util.h
packaging/org.tizen.aul.syspopup.conf.in [new file with mode: 0644]
packaging/syspopup.spec
syspopup-caller/syspopup_caller.c

index e21f25819f6f58ed37d1562b33a59b065a98a841..5d82c2999dbaf049142b9d46768ebf5dc80864ed 100644 (file)
@@ -23,7 +23,7 @@ IF (with_wayland)
     ADD_DEFINITIONS("-DWAYLAND")
 ENDIF(with_wayland)
 
-pkg_check_modules(libpkgs REQUIRED aul dlog bundle sqlite3 glib-2.0 gio-2.0 libtzplatform-config)
+pkg_check_modules(libpkgs REQUIRED dlog bundle sqlite3 glib-2.0 gio-2.0 libtzplatform-config)
 
 FOREACH(flag ${libpkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index e95bc18422eb48b1acd7b0ddceb29eaaabd65bfa..9b69a619756de4b149389d65a5f47dfbb7904962 100755 (executable)
@@ -41,5 +41,9 @@
 #define SYSPOPUP_DBUS_SIGNAL_INTERFACE "org.tizen.syspopup.signal"
 #define SYSPOPUP_DBUS_SP_TERM_SIGNAL   "syspopup_term"
 
+#define AUL_SP_DBUS_PATH "/Org/Tizen/Aul/Syspopup"
+#define AUL_SP_DBUS_SIGNAL_INTERFACE "org.tizen.aul.syspopup"
+#define AUL_SP_DBUS_LAUNCH_REQUEST_SIGNAL "syspopup_launch_request"
+
 #endif
 
diff --git a/packaging/org.tizen.aul.syspopup.conf.in b/packaging/org.tizen.aul.syspopup.conf.in
new file mode 100644 (file)
index 0000000..9b8be68
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+        "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+
+<busconfig>
+       <policy context="default">
+               <allow send_destination="*" send_interface="org.tizen.aul.syspopup" send_member="syspopup_launch_request" send_type="signal"/>
+               <check send_destination="*" send_interface="org.tizen.aul.syspopup" send_member="syspopup_launch_request" send_type="signal" privilege="http://tizen.org/privilege/appmanager.launch"/>
+       </policy>
+</busconfig>
index d634db59b435461f649d7ce07b2b74b3585c3987..51244737087a1ba3558d2ab97bd9bc73509bc000 100644 (file)
@@ -12,6 +12,7 @@ Source1001:     %{name}.manifest
 Source1002:     %{name}-devel.manifest
 Source1003:     %{name}-caller.manifest
 Source1004:     %{name}-caller-devel.manifest
+Source1005:    org.tizen.aul.syspopup.conf.in
 
 BuildRequires:  cmake
 BuildRequires:  pkgconfig(sqlite3)
@@ -24,7 +25,6 @@ BuildRequires:  pkgconfig(utilX)
 BuildRequires:  pkgconfig(x11)
 BuildRequires:  pkgconfig(ecore-x)
 %endif
-BuildRequires:  pkgconfig(aul)
 BuildRequires:  pkgconfig(evas)
 BuildRequires:  pkgconfig(appcore-efl)
 BuildRequires:  pkgconfig(libtzplatform-config)
@@ -86,6 +86,9 @@ rm -rf %{buildroot}/usr/share/syspopup/syspopup_db.sql
 
 touch %{buildroot}%{_datadir}/popup_noti_term
 
+mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d
+install -m 0644 %SOURCE1005 %{buildroot}%{_sysconfdir}/dbus-1/system.d/org.tizen.aul.syspopup.conf
+
 %post -p /sbin/ldconfig
 
 %postun -p /sbin/ldconfig
@@ -123,6 +126,7 @@ touch %{buildroot}%{_datadir}/popup_noti_term
 %defattr(-,root,root,-)
 %{_libdir}/libsyspopup_caller.so.0.1.0
 /usr/share/license/%{name}-caller
+%{_sysconfdir}/dbus-1/system.d/org.tizen.aul.syspopup.conf
 
 %files caller-devel
 %manifest %{name}-caller-devel.manifest
index 3d4bde831e6e12188bf19aabac90b0b36d970af0..f3f471726edcf0910553b23327b128c037646746 100755 (executable)
 #include <fcntl.h>
 #include <glib.h>
 #include <gio/gio.h>
-#include <aul.h>
+#include <bundle.h>
 
 #include "syspopup_core.h"
 #include "syspopup_db.h"
 #include "syspopup_api.h"
 #include "simple_util.h"
 
+static int syspopup_send_launch_request(const char *appid, bundle *b)
+{
+       GDBusConnection *conn = NULL;
+       GError *err = NULL;
+       bundle_raw *b_raw = NULL;
+       int ret = 0;
+       int len;
+
+#if !(GLIB_CHECK_VERSION(2, 36, 0))
+       g_type_init();
+#endif
+
+       conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
+       if (err) {
+               _E("gdbus connection error: %s", err->message);
+               g_error_free(err);
+               return -1;
+       }
+
+       if (bundle_encode(b, &b_raw, &len) != BUNDLE_ERROR_NONE) {
+               _E("bundle encode error");
+               ret = -1;
+               goto end;
+       }
+
+       if (g_dbus_connection_emit_signal(conn,
+                                       NULL,
+                                       AUL_SP_DBUS_PATH,
+                                       AUL_SP_DBUS_SIGNAL_INTERFACE,
+                                       AUL_SP_DBUS_LAUNCH_REQUEST_SIGNAL,
+                                       g_variant_new("(ss)", appid, (char *)b_raw),
+                                       &err) == FALSE) {
+               _E("emitting the signal error: %s", err->message);
+               ret = -1;
+               goto end;
+       }
+
+       if (g_dbus_connection_flush_sync(conn, NULL, &err) == FALSE) {
+               _E("gdbus connection flush sync failed: %s", err->message);
+               ret = -1;
+       }
+
+end:
+       if (err)
+               g_error_free(err);
+       if (conn)
+               g_object_unref(conn);
+
+       return ret;
+}
+
 API int syspopup_launch(char *popup_name, bundle *b)
 {
        syspopup_info_t *info = NULL;
@@ -67,9 +118,9 @@ API int syspopup_launch(char *popup_name, bundle *b)
                return -1;
        }
 
-       ret = aul_launch_app(info->pkgname, b);
+       ret = syspopup_send_launch_request(info->pkgname, b);
        if (ret < 0)
-               _E("aul launch error: %d", ret);
+               _E("syspopup launch error: %d", ret);
 
        if (is_bundle == 1)
                bundle_free(b);