int state;
Evas_Object *txt;
} s_animation = {
-.txt = NULL,};
-
-#define CHECK_Xorg "/tmp/.wm_ready"
-#define CHECK_LCD "/sys/class/lcd"
-
-static int run_child(const char *argv[])
-{
- pid_t pid;
- struct sigaction act, oldact;
- int i, r = 0, status;
-
- if (!argv)
- return -EINVAL;
-
- /* Use default signal handler */
- act.sa_handler = SIG_DFL;
- act.sa_sigaction = NULL;
- act.sa_flags = 0;
- sigemptyset(&act.sa_mask);
-
- if (sigaction(SIGCHLD, &act, &oldact) < 0)
- return -errno;
-
- pid = fork();
- if (pid < 0) {
- r = -errno;
- } else if (pid == 0) {
- for (i = 0; i < _NSIG; ++i)
- signal(i, SIG_DFL);
- r = execv(argv[0], (char **)argv);
- if (r < 0)
- exit(EXIT_FAILURE);
- } else {
- /* wait for child */
- if (waitpid(pid, &status, 0) != -1)
- /* terminated normally */
- if (WIFEXITED(status))
- return WEXITSTATUS(status);
- }
-
- if (sigaction(SIGCHLD, &oldact, NULL) < 0)
- _E("Failed to restore sigaction");
- return r;
-}
-
-static int check_window_validity(void)
-{
- _D("Check window validity");
- printf("Check window validity\n");
- DIR *dp;
- struct dirent *dentry;
- int ret = -1;
- dp = opendir(CHECK_LCD);
- if (!dp) {
- _E("Failed to get lcd node");
- printf("Failed to get lcd node\n");
- return -1;
- }
- while ((dentry = readdir(dp)) != NULL) {
- if ((!strcmp(dentry->d_name, ".")) || (!strcmp(dentry->d_name, ".."))) {
- continue;
- }
- else {
- ret = 0;
- break;
- }
- }
- closedir(dp);
- return ret;
-}
+ .txt = NULL,};
static void win_del(void *data, Evas_Object * obj, void *event_info)
{
static Eina_Bool _end_cb(void *data)
{
- static const char *argv[5] = {
- "/usr/bin/xset",
- "dpms", "force", "off", NULL,
- };
_D("_end_cb is invoked");
+ printf("_end_cb is invoked\n");
if (vconf_set_int(VCONFKEY_BOOT_ANIMATION_FINISHED, 1) != 0)
_E("Failed to set finished set");
if (s_animation.state == TYPE_OFF || s_animation.state == TYPE_OFF_WITH_MSG)
- run_child(argv);
- _D("_end_cb is invoked");
elm_exit();
- _D("_end_cb is invoked");
return ECORE_CALLBACK_CANCEL;
}
return EXIT_SUCCESS;
}
-static Eina_Bool _count_for_xorg_timer_cb(void *data)
-{
- int ret = 0;
- static int count = 0;
-
- ret = access(CHECK_Xorg, F_OK);
- if (ret == 0) {
- if (init_layout(data) == EXIT_FAILURE) {
- _E("Failed to init the layout object");
- if (data) {
- evas_object_del(s_animation.txt);
- }
- evas_object_del(s_animation.win);
- }
- count = 0;
- return ECORE_CALLBACK_CANCEL;
- }
- if (count > OVER_COUNT) {
- _E("Getting Xorg is delaying, Something is wrong");
- if (init_layout(data) == EXIT_FAILURE) {
- _E("Failed to init the layout object");
- if (data) {
- evas_object_del(s_animation.txt);
- }
- evas_object_del(s_animation.win);
- }
- count = 0;
- return ECORE_CALLBACK_CANCEL;
- }
- count ++;
-
- return ECORE_CALLBACK_RENEW;
-}
-
int init_animation(int state, const char *msg)
{
_D("Init animation");
Ecore_Timer *timer = NULL;
- //if (check_window_validity()) {
- // _E("Failed to access LCD");
- // printf("Failed to access LCD\n");
- // return EXIT_FAILURE;
- //}
-
s_animation.state = state;
if (create_window() == EXIT_FAILURE) {
return EXIT_FAILURE;
}
- /* waiting initialzing Xorg process during 2 seconds */
- timer = ecore_timer_add(0.1f, _count_for_xorg_timer_cb, msg);
- if (!timer) {
- _E("Critical Error");
- return EXIT_FAILURE;
+ if (init_layout(msg) == EXIT_FAILURE) {
+ _E("Failed to init the layout object");
+ if (msg) {
+ evas_object_del(s_animation.txt);
+ }
+ evas_object_del(s_animation.win);
}
return EXIT_SUCCESS;