Make esd broadcast boot_complete once. 95/106695/2 accepted/tizen_3.0.m2_mobile accepted/tizen_3.0.m2_tv accepted/tizen_3.0.m2_wearable tizen_3.0.m2 tizen_3.0_tv accepted/tizen/3.0.m2/mobile/20170104.121650 accepted/tizen/3.0.m2/tv/20170104.122351 accepted/tizen/3.0.m2/wearable/20170104.122731 accepted/tizen/3.0/common/20161227.101316 accepted/tizen/3.0/ivi/20161226.024800 accepted/tizen/3.0/mobile/20161226.024720 accepted/tizen/3.0/tv/20161226.024733 accepted/tizen/3.0/wearable/20161226.024746 submit/tizen_3.0.m2/20170104.093749 submit/tizen_3.0/20161222.014602
authorjongmyeongko <jongmyeong.ko@samsung.com>
Thu, 22 Dec 2016 11:47:25 +0000 (20:47 +0900)
committerjongmyeongko <jongmyeong.ko@samsung.com>
Thu, 22 Dec 2016 12:56:07 +0000 (21:56 +0900)
boot_complete system-event will be emitted after system-session finished.

Change-Id: Ifb604a813d5f4c2339c17252ddabf14c079308c6
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
include/eventsystem_daemon.h
src/esd_main.c

index a5aaa8f..56f44a0 100644 (file)
@@ -46,7 +46,6 @@ extern "C" {
 #define SYSTEMD_DBUS_IFACE_MANAGER  SYSTEMD_DBUS_DEST ".Manager"
 #define SYSTEMD_DBUS_PATH       "/org/freedesktop/systemd1"
 #define SYSTEMD_DBUS_SIGNAL_STARTUP_FINISHED "StartupFinished"
-#define SYSTEMD_DBUS_SIGNAL_USER_STARTUP_FINISHED "UserSessionStartupFinished"
 
 int __esd_register_vconf_callbacks(void);
 
index 1bbe29d..93e096a 100644 (file)
@@ -70,8 +70,6 @@ typedef struct __earlier_table_item {
 } earlier_item;
 
 #endif
-static bool system_bootcompleted;
-static bool user_bootcompleted;
 
 static GHashTable *user_last_event_table; /* table of user events for last data */
 
@@ -1035,62 +1033,6 @@ static int __esd_get_user_items(void)
        return ES_R_OK;
 }
 
-static int __esd_send_bootcomplete(GDBusConnection *conn, const char *list_name)
-{
-       GVariant *result;
-       GError *error = NULL;
-       GVariantIter *iter;
-       gchar *str;
-       GVariant *gv;
-       bundle *b;
-       bundle_raw *raw;
-       int len;
-       gboolean ret;
-
-       result = g_dbus_connection_call_sync(conn,
-               "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus",
-               list_name, NULL, G_VARIANT_TYPE("(as)"), G_DBUS_CALL_FLAGS_NONE,
-               -1, NULL, &error);
-
-       if (result == NULL) {
-               _E("get (%s) error(%s)", list_name, error->message);
-               g_error_free(error);
-               return ES_R_ERROR;
-       }
-
-       b = bundle_create();
-       bundle_add_str(b, EVT_KEY_BOOT_COMPLETED,
-                       EVT_VAL_BOOT_COMPLETED_TRUE);
-
-       bundle_encode(b, &raw, &len);
-
-       g_variant_get(result, "(as)", &iter);
-       while (g_variant_iter_loop(iter, "s", &str)) {
-               if (!strstr((const char *)str, "event.busname"))
-                       continue;
-
-               gv  = g_variant_new("(us)", (unsigned int)len, raw);
-               ret = g_dbus_connection_emit_signal(conn,
-                               str,
-                               SYS_EVENT_OBJ_PATH,
-                               SYS_EVENT_NAME_PREFIX,
-                               EVT_KEY_BOOT_COMPLETED,
-                               gv,
-                               &error);
-               if (ret == FALSE) {
-                       _E("Unable to emit signal: %s", error->message);
-                       g_error_free(error);
-               }
-       }
-
-       g_variant_iter_free(iter);
-       g_variant_unref(result);
-       bundle_free_encoded_rawdata(&raw);
-       bundle_free(b);
-
-       return ES_R_OK;
-}
-
 static void __esd_signal_handler(GDBusConnection *connection,
                const gchar *sender_name,
                const gchar *object_path,
@@ -1100,21 +1042,17 @@ static void __esd_signal_handler(GDBusConnection *connection,
                gpointer user_data)
 {
        int handle;
+       bundle *b;
 
        if (!g_strcmp0(signal_name,
                                SYSTEMD_DBUS_SIGNAL_STARTUP_FINISHED)) {
                _I("System session finished");
-               system_bootcompleted = true;
-       } else if (!g_strcmp0(signal_name,
-                               SYSTEMD_DBUS_SIGNAL_USER_STARTUP_FINISHED)) {
-               _I("User session finished");
-               __esd_get_user_items();
-               user_bootcompleted = true;
-       }
 
-       if (system_bootcompleted && user_bootcompleted) {
-               __esd_send_bootcomplete(connection, "ListNames");
-               __esd_send_bootcomplete(connection, "ListActivatableNames");
+               b = bundle_create();
+               bundle_add_str(b, EVT_KEY_BOOT_COMPLETED,
+                       EVT_VAL_BOOT_COMPLETED_TRUE);
+               eventsystem_send_system_event(SYS_EVENT_BOOT_COMPLETED, b);
+               bundle_free(b);
 
                handle = creat(ESD_BOOT_COMPLETED, 0640);
                if (handle != -1)
@@ -1714,7 +1652,6 @@ static void __esd_on_bus_acquired(GDBusConnection *connection,
 
        guint reg_id = 0;
        guint boot_id = 0;
-       guint user_boot_id = 0;
        GError *error = NULL;
 
        reg_id = g_dbus_connection_register_object(connection,
@@ -1742,22 +1679,6 @@ static void __esd_on_bus_acquired(GDBusConnection *connection,
                _E("g_dbus_connection_signal_subscribe() is failed.");
                g_object_unref(connection);
        }
-
-       user_boot_id = g_dbus_connection_signal_subscribe(connection,
-                       NULL,
-                       SYSTEMD_DBUS_IFACE_MANAGER,
-                       SYSTEMD_DBUS_SIGNAL_USER_STARTUP_FINISHED,
-                       SYSTEMD_DBUS_PATH,
-                       NULL,
-                       G_DBUS_SIGNAL_FLAGS_NONE,
-                       __esd_signal_handler,
-                       NULL,
-                       NULL);
-
-       if (user_boot_id == 0) {
-               _E("g_dbus_connection_signal_subscribe() is failed.");
-               g_object_unref(connection);
-       }
 }
 
 static void __esd_on_name_acquired(GDBusConnection *connection,