} earlier_item;
#endif
-static bool system_bootcompleted;
-static bool user_bootcompleted;
static GHashTable *user_last_event_table; /* table of user events for last data */
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,
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)
guint reg_id = 0;
guint boot_id = 0;
- guint user_boot_id = 0;
GError *error = NULL;
reg_id = g_dbus_connection_register_object(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,