#include <bundle_internal.h>
#include <aul.h>
#include <aul_sock.h>
+#include <vconf.h>
#include "amd_util.h"
#include "amd_login_monitor.h"
sd_login_monitor *m;
GIOChannel *io;
guint sid;
+ bool booting_status;
};
struct user_s {
},
};
-static gboolean __login_default_user(gpointer data)
+static void __booting_status_changed_cb(keynode_t *node, void *user_data)
+{
+ int booting_status;
+ struct user_s *user;
+ GList *iter;
+
+ booting_status = vconf_keynode_get_int(node);
+ if (booting_status != login_monitor->booting_status) {
+ _W("Booting status is changed. %d -> %d",
+ login_monitor->booting_status,
+ booting_status);
+ login_monitor->booting_status = booting_status;
+ if (booting_status != VCONFKEY_SYSMAN_BOOTING_SUCCESS)
+ return;
+
+ iter = user_list;
+ while (iter) {
+ user = (struct user_s *)iter->data;
+ if (user->state != UID_STATE_ACTIVE &&
+ user->state != UID_STATE_CLOSING &&
+ user->state != UID_STATE_OFFLINE) {
+ user->state = UID_STATE_ACTIVE;
+ __remove_login_timer(user);
+ __user_login(user);
+ }
+
+ iter = g_list_next(iter);
+ }
+ }
+}
+
+static bool __check_system_boot_finished(void)
{
bool boot_finished = false;
+ int booting_status;
+ int ret;
+
+ if (login_monitor->booting_status == VCONFKEY_SYSMAN_BOOTING_SUCCESS)
+ return true;
+
+ ret = vconf_get_int(VCONFKEY_SYSMAN_BOOTINGSTATUS, &booting_status);
+ if (ret == 0 && booting_status == VCONFKEY_SYSMAN_BOOTING_SUCCESS) {
+ _W("Booting success");
+ login_monitor->booting_status = booting_status;
+ return true;
+ }
+
+ _signal_check_system_boot_finished(&boot_finished);
+ return boot_finished;
+}
+
+static gboolean __login_default_user(gpointer data)
+{
struct user_s *user;
uid_t uid;
+ sid = 0;
__check_user_state();
uid = tzplatform_getuid(TZ_SYS_DEFAULT_USER);
return G_SOURCE_REMOVE;
}
+ if (user->state == UID_STATE_ACTIVE) {
+ _W("Already active state");
+ return G_SOURCE_REMOVE;
+ }
+
if (user->state == UID_STATE_UNKNOWN)
user->state = UID_STATE_OPENING;
- _signal_check_system_boot_finished(&boot_finished);
- if (boot_finished)
+ if (__check_system_boot_finished())
user->state = UID_STATE_ACTIVE;
__user_login(user);
- sid = 0;
return G_SOURCE_REMOVE;
}
int r;
uid_t uid;
struct user_s *user;
+ int booting_status;
_D("login monitor init");
if (__init_login_monitor()) {
return -1;
}
+ r = vconf_get_int(VCONFKEY_SYSMAN_BOOTINGSTATUS, &booting_status);
+ if (r == 0) {
+ _W("booting status(%d)", booting_status);
+ login_monitor->booting_status = booting_status;
+ }
+
+ r = vconf_notify_key_changed(VCONFKEY_SYSMAN_BOOTINGSTATUS,
+ __booting_status_changed_cb, NULL);
+ if (r != 0)
+ _W("Failed to register callback for checking booting");
+
_noti_listen(NOTI_MSG_LOGIN_MONITOR_STARTUP_FINISHED,
__on_startup_finished);
_noti_listen(NOTI_MSG_APPINFO_LOAD,
if (user_list)
g_list_free_full(user_list, __destroy_user);
+ vconf_ignore_key_changed(VCONFKEY_SYSMAN_BOOTINGSTATUS,
+ __booting_status_changed_cb);
+
__fini_login_monitor();
}