#include <Elementary.h>
-int init_animation(int state);
-int fini_animation(void);
-Evas_Object *create_layout(Evas_Object *win, const char *file_name);
-Evas_Object *create_window(void);
-char *get_layout_file_name(int state, int w, int h);
-Eina_Bool is_layout_file_exist(const char *file_name);
+int animation_init(int animation_type);
+int animation_fini(void);
#endif
#define POWEROFF_WAV "poweroff.wav"
#endif
-
-#define NICE_VALUE -20
-#define FILE_PATH_MAX 128
+#define FILE_PATH_MAX 256
struct args {
int argc;
TYPE_ON,
TYPE_OFF,
TYPE_OFF_NOEXIT,
- TYPE_OFF_WITH_MSG,
- TYPE_CLEAR,
TYPE_MAX
};
-enum {
- TYPE_CHECK_ANI,
- TYPE_CHECK_SOUND,
-};
-
extern void(*boot_exit)(void);
#endif
*
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <dirent.h>
-
#include <vconf.h>
#include <efl_util.h>
#include "animation.h"
#include "app_log.h"
-#define OVER_COUNT 19
-
static struct animation {
Evas_Object *win;
Evas_Object *layout;
- Evas_Object *txt;
Evas_Object *display_block;
- Evas_Coord w;
- Evas_Coord h;
- int state;
- int t;
+ Evas_Coord win_w;
+ Evas_Coord win_h;
+ int animation_type;
} s_animation = {
.win = NULL,
.layout = NULL,
- .txt = NULL,
.display_block = NULL,
- .w = 0,
- .h = 0,
- .state = 0,
- .t = 0,
+ .win_w = 0,
+ .win_h = 0,
+ .animation_type = 0,
};
-static void win_del(void *data, Evas_Object * obj, void *event_info)
+static void __win_del_cb(void *data, Evas_Object * obj, void *event_info)
{
__D("Window delete event received");
elm_exit();
}
+static Evas_Object *__create_window(void)
+{
+ __D("Create Window");
+
+ Evas_Object *win;
+
+ win = elm_win_add(NULL, "BOOT_ANIMATION", ELM_WIN_NOTIFICATION);
+ if (!win) {
+ __E("Failed to create a new window");
+ return NULL;
+ }
+ elm_win_aux_hint_add(win, "wm.comp.win.always.selective.mode", "1");
+ elm_win_role_set(win, "alert");
+ efl_util_set_notification_window_level(win, EFL_UTIL_NOTIFICATION_LEVEL_HIGH);
+ evas_object_smart_callback_add(win, "delete-request", __win_del_cb, NULL);
+
+ elm_win_screen_size_get(win, NULL, NULL, &s_animation.win_w, &s_animation.win_h);
+ elm_win_borderless_set(win, EINA_TRUE);
+ elm_win_indicator_mode_set(win, ELM_WIN_INDICATOR_HIDE);
+ evas_object_move(win, 0, 0);
+ evas_object_show(win);
+
+ return win;
+}
+
static void __block_display(void)
{
Evas_Object *display_block = NULL;
static void __animation_finished_cb(void *d, Evas_Object * obj, const char *e, const char *s)
{
- if (s_animation.state == TYPE_OFF) {
+ if (s_animation.animation_type == TYPE_OFF) {
__D("TYPE OFF");
if (vconf_set_int(VCONFKEY_BOOT_ANIMATION_FINISHED, 1) != 0) {
__E("Failed to set finished set");
}
}
-static void __fini_layout(void)
+static Evas_Object * __create_layout(Evas_Object *win, const char *file_name)
{
- if (s_animation.display_block) {
- evas_object_del(s_animation.display_block);
- s_animation.display_block = NULL;
+ Evas_Object *layout = elm_layout_add(win);
+ if (!layout) {
+ __E("Failed to create layout");
+ return NULL;
}
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(s_animation.win, layout);
+ elm_layout_signal_callback_add(layout, "end", "animation", __animation_finished_cb, NULL);
- if (s_animation.layout) {
- evas_object_del(s_animation.layout);
- s_animation.layout = NULL;
+ if (!elm_layout_file_set(layout, file_name, GRP_ANIM)) {
+ __E("Failed to layout file set");
+ return NULL;
}
- if (s_animation.txt) {
- evas_object_del(s_animation.txt);
- s_animation.txt = NULL;
- }
+ evas_object_show(layout);
+
+ return layout;
}
-Evas_Object *create_window(void)
+static void __destroy_layout(void)
{
- __D("Create Window");
-
- Evas_Object *win;
-
- win = elm_win_add(NULL, "BOOT_ANIMATION", ELM_WIN_NOTIFICATION);
- if (!win) {
- __E("Failed to create a new window");
- return NULL;
+ if (s_animation.display_block) {
+ evas_object_del(s_animation.display_block);
+ s_animation.display_block = NULL;
}
- elm_win_aux_hint_add(win, "wm.comp.win.always.selective.mode", "1");
- elm_win_role_set(win, "alert");
- efl_util_set_notification_window_level(win, EFL_UTIL_NOTIFICATION_LEVEL_HIGH);
- evas_object_smart_callback_add(win, "delete-request", win_del, NULL);
- elm_win_screen_size_get(win, NULL, NULL, &s_animation.w, &s_animation.h);
- elm_win_borderless_set(win, EINA_TRUE);
- elm_win_indicator_mode_set(win, ELM_WIN_INDICATOR_HIDE);
- evas_object_move(win, 0, 0);
- evas_object_show(win);
-
- return win;
+ if (s_animation.layout) {
+ evas_object_del(s_animation.layout);
+ s_animation.layout = NULL;
+ }
}
-char *get_layout_file_name(int state, int w, int h)
+static char * __get_layout_file_name(int animation_type, int w, int h)
{
char file_name[1024];
int ret = 0;
- if (state == TYPE_OFF) {
+ if (animation_type == TYPE_OFF) {
snprintf(file_name, sizeof(file_name), FILE_PATH"%dx%d_PowerOff.edj", w, h);
} else {
snprintf(file_name, sizeof(file_name), FILE_PATH"%dx%d_PowerOn.edj", w, h);
if (ret == 0) {
} else {
__E("There's no Image same with [%s], So set Default[720x1280] image", file_name);
- if (state == TYPE_OFF) {
+ if (animation_type == TYPE_OFF) {
snprintf(file_name, sizeof(file_name), "%s", DEFAULT_OFF);
} else {
snprintf(file_name, sizeof(file_name), "%s", DEFAULT_ON);
return strdup(file_name);
}
-Eina_Bool is_layout_file_exist(const char *file_name)
+static Eina_Bool __is_layout_file_exist(const char *file_name)
{
int ret = 0;
}
}
-Evas_Object *create_layout(Evas_Object *win, const char *file_name)
-{
- Evas_Object *layout = elm_layout_add(win);
- if (!layout) {
- __E("Failed to create layout");
- return NULL;
- }
- evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(s_animation.win, layout);
- elm_layout_signal_callback_add(layout, "end", "animation", __animation_finished_cb, NULL);
-
- if (!elm_layout_file_set(layout, file_name, GRP_ANIM)) {
- __E("Failed to layout file set");
- return NULL;
- }
-
- evas_object_show(layout);
-
- return layout;
-}
-
-int init_animation(int state)
+int animation_init(int animation_type)
{
__D("Init animation");
- s_animation.state = state;
+ s_animation.animation_type = animation_type;
- s_animation.win = create_window();
+ s_animation.win = __create_window();
if (!s_animation.win) {
__E("Failed to create a new window");
return EXIT_FAILURE;
}
char *layout_file_name = NULL;
- layout_file_name = get_layout_file_name(state, s_animation.w, s_animation.h);
+ layout_file_name = __get_layout_file_name(animation_type, s_animation.win_w, s_animation.win_h);
if (!layout_file_name) {
__E("Failed to get layout file name");
return EXIT_FAILURE;
}
- if (!is_layout_file_exist(layout_file_name)) {
+ if (!__is_layout_file_exist(layout_file_name)) {
__E("This file is not exist");
free(layout_file_name);
return EXIT_FAILURE;
}
- s_animation.layout = create_layout(s_animation.win, layout_file_name);
+ s_animation.layout = __create_layout(s_animation.win, layout_file_name);
if (!s_animation.layout) {
__E("Failed to create layout");
free(layout_file_name);
return EXIT_SUCCESS;
}
-int fini_animation(void)
+int animation_fini(void)
{
- __fini_layout();
+ __destroy_layout();
+
evas_object_del(s_animation.win);
fflush(stdout);
close(1);
{
return s_animation.display_block;
}
+
+Evas_Object * __t__animation_create_layout(Evas_Object *win, const char *file_name)
+{
+ return __create_layout(win, file_name);
+}
+
+Evas_Object *__t__animation_create_window(void)
+{
+ return __create_window();
+}
+
+char * __t__get_layout_file_name(int animation_type, int w, int h)
+{
+ return __get_layout_file_name(animation_type, w, h);
+}
+
+Eina_Bool __t__is_layout_file_exist(const char *file_name)
+{
+ return __is_layout_file_exist(file_name);
+}
#endif
return 1;
}
- if (init_animation(boot_type) != EXIT_SUCCESS) {
+ if (animation_init(boot_type) != EXIT_SUCCESS) {
__E("Exit boot-animation");
return 1;
}
elm_run();
- fini_animation();
+ animation_fini();
return 0;
}
#include "app_log.h"
static const int is_supported = 0;
-static bool __get_wav_file(int state, char *wavpath)
+static bool __get_wav_file(int animation_type, char *wavpath)
{
__D("Get wav file");
- if (state == TYPE_ON) {
+ if (animation_type == TYPE_ON) {
snprintf(wavpath, FILE_PATH_MAX-1, "%s", DEFAULT_POWERON_WAV);
__D("Wav file: %s", wavpath);
}
extern Evas_Object *__t__get_layout(void);
+extern char * __t__get_layout_file_name(int animation_type, int w, int h);
static unit_case_func_t __continue_check_animation_layout(void *data)
{
int rx, ry, rw, rh;
const char *file_name = NULL;
elm_layout_file_get(layout, &file_name, NULL);
- char * expected_file_name = get_layout_file_name(s_info.animation_type, screen_w, screen_h);
+ char * expected_file_name = __t__get_layout_file_name(s_info.animation_type, screen_w, screen_h);
TEST_ASSERT_EQUAL_STRING(expected_file_name, file_name);
free(expected_file_name);
s_info.is_exit = false;
s_info.animation_type = (int)data;
- init_animation(s_info.animation_type);
+ animation_init(s_info.animation_type);
/* 0.8 because boot-animation take 6 sec, we should not use divisor */
TEST_CASE_CONTINUE(0.8, __continue_check_animation_layout, (void*)1);
.group = NULL,
};
+extern Evas_Object *__t__animation_create_window(void);
static void __set_up(void)
{
unit_clear_log();
- s_info.win = create_window();
+ s_info.win = __t__animation_create_window();
s_info.args.argv = (char **)malloc(4 * 2);
s_info.group->set_up_complete(s_info.group);
}
TEST_CASE_DONE(s_info.group);
}
+extern Evas_Object * __t__animation_create_layout(Evas_Object *win, const char *file_name);
static unit_case_func_t __case_create_layout(void * data)
{
TEST_ASSERT_TRUE(s_info.win != NULL);
char *file_name = "/usr/share/edje/720x1280_PowerOn.edj";
- Evas_Object *layout = create_layout(s_info.win, file_name);
+ Evas_Object *layout = __t__animation_create_layout(s_info.win, file_name);
TEST_ASSERT_TRUE(layout != NULL);
TEST_ASSERT_TRUE(evas_object_visible_get(layout));
evas_object_del(layout);
file_name = "/usr/share/edje/720x1280_PowerOff.edj";
- layout = create_layout(s_info.win, file_name);
+ layout = __t__animation_create_layout(s_info.win, file_name);
TEST_ASSERT_TRUE(layout != NULL);
TEST_ASSERT_TRUE(evas_object_visible_get(layout));
evas_object_del(layout);
file_name = "/usr/share/edje/360x360_PowerOn.edj";
- layout = create_layout(s_info.win, file_name);
+ layout = __t__animation_create_layout(s_info.win, file_name);
TEST_ASSERT_TRUE(layout != NULL);
TEST_ASSERT_TRUE(evas_object_visible_get(layout));
evas_object_del(layout);
file_name = "/usr/share/edje/360x360_PowerOff.edj";
- layout = create_layout(s_info.win, file_name);
+ layout = __t__animation_create_layout(s_info.win, file_name);
TEST_ASSERT_TRUE(layout != NULL);
TEST_ASSERT_TRUE(evas_object_visible_get(layout));
evas_object_del(layout);
file_name = "/usr/share/edje/480x800_PowerOff.edj";
- layout = create_layout(s_info.win, file_name);
+ layout = __t__animation_create_layout(s_info.win, file_name);
TEST_ASSERT_TRUE(layout != NULL);
TEST_ASSERT_TRUE(evas_object_visible_get(layout));
evas_object_del(layout);
file_name = "/usr/share/edje/480x800_PowerOn.edj";
- layout = create_layout(s_info.win, file_name);
+ layout = __t__animation_create_layout(s_info.win, file_name);
TEST_ASSERT_TRUE(layout != NULL);
TEST_ASSERT_TRUE(evas_object_visible_get(layout));
evas_object_del(layout);
file_name = "/usr/share/720x1280_PowerOn.edj";
- layout = create_layout(s_info.win, file_name);
+ layout = __t__animation_create_layout(s_info.win, file_name);
TEST_ASSERT_TRUE(layout == NULL);
evas_object_del(layout);
file_name = "/usr/share/edje/2x2_PowerOn.edj";
- layout = create_layout(s_info.win, file_name);
+ layout = __t__animation_create_layout(s_info.win, file_name);
TEST_ASSERT_TRUE(layout == NULL);
evas_object_del(layout);
TEST_CASE_DONE(s_info.group);
}
+extern char * __t__get_layout_file_name(int animation_type, int w, int h);
static unit_case_func_t __case_get_layout_file_name(void * data)
{
- char * file_name = get_layout_file_name(0, 720, 1280);
+ char * file_name = __t__get_layout_file_name(0, 720, 1280);
TEST_ASSERT_EQUAL_STRING("/usr/share/edje/720x1280_PowerOn.edj", file_name);
free(file_name);
- file_name = get_layout_file_name(3, 720, 1280);
+ file_name = __t__get_layout_file_name(3, 720, 1280);
TEST_ASSERT_EQUAL_STRING("/usr/share/edje/720x1280_PowerOn.edj", file_name);
free(file_name);
- file_name = get_layout_file_name(2, 1280, 720);
+ file_name = __t__get_layout_file_name(2, 1280, 720);
TEST_ASSERT_EQUAL_STRING("/usr/share/edje/720x1280_PowerOff.edj", file_name);
free(file_name);
- file_name = get_layout_file_name(1, 360, 360);
+ file_name = __t__get_layout_file_name(1, 360, 360);
TEST_ASSERT_EQUAL_STRING("/usr/share/edje/360x360_PowerOn.edj", file_name);
free(file_name);
- file_name = get_layout_file_name(2, 360, 360);
+ file_name = __t__get_layout_file_name(2, 360, 360);
TEST_ASSERT_EQUAL_STRING("/usr/share/edje/360x360_PowerOff.edj", file_name);
free(file_name);
- file_name = get_layout_file_name(1, 480, 800);
+ file_name = __t__get_layout_file_name(1, 480, 800);
TEST_ASSERT_EQUAL_STRING("/usr/share/edje/480x800_PowerOn.edj", file_name);
free(file_name);
- file_name = get_layout_file_name(2, 480, 800);
+ file_name = __t__get_layout_file_name(2, 480, 800);
TEST_ASSERT_EQUAL_STRING("/usr/share/edje/480x800_PowerOff.edj", file_name);
free(file_name);
- file_name = get_layout_file_name(3, 480, 800);
+ file_name = __t__get_layout_file_name(3, 480, 800);
TEST_ASSERT_EQUAL_STRING("/usr/share/edje/480x800_PowerOn.edj", file_name);
free(file_name);
TEST_CASE_DONE(s_info.group);
}
+extern Eina_Bool __t__is_layout_file_exist(const char *file_name);
static unit_case_func_t __case_is_layout_file_exist(void * data)
{
char *file_name = "/usr/share/edje/480x800_PowerOn.edj";
- TEST_ASSERT_TRUE(is_layout_file_exist(file_name));
+ TEST_ASSERT_TRUE(__t__is_layout_file_exist(file_name));
file_name = "/usr/share/edje/360x360_PowerOff.edj";
- TEST_ASSERT_TRUE(is_layout_file_exist(file_name));
+ TEST_ASSERT_TRUE(__t__is_layout_file_exist(file_name));
file_name = "/usr/share/edje/720x1280_PowerOff.edj";
- TEST_ASSERT_TRUE(is_layout_file_exist(file_name));
+ TEST_ASSERT_TRUE(__t__is_layout_file_exist(file_name));
file_name = "/usr/share/edje/720x1280_PowerOn.edj";
- TEST_ASSERT_TRUE(is_layout_file_exist(file_name));
+ TEST_ASSERT_TRUE(__t__is_layout_file_exist(file_name));
file_name = "/usr/share/edje/1280x720_PowerOn.edj";
- TEST_ASSERT_TRUE(is_layout_file_exist(file_name) == EINA_FALSE);
+ TEST_ASSERT_TRUE(__t__is_layout_file_exist(file_name) == EINA_FALSE);
file_name = "/usr/share/edje/800x_480_PowerOn.edj";
- TEST_ASSERT_TRUE(is_layout_file_exist(file_name) == EINA_FALSE);
+ TEST_ASSERT_TRUE(__t__is_layout_file_exist(file_name) == EINA_FALSE);
file_name = "/usr/share/720x1280_PowerOn.edj";
- TEST_ASSERT_TRUE(is_layout_file_exist(file_name) == EINA_FALSE);
+ TEST_ASSERT_TRUE(__t__is_layout_file_exist(file_name) == EINA_FALSE);
TEST_CASE_DONE(s_info.group);
}