*
*/
-#include <stdio.h>
+#include <vconf.h>
+#include <getopt.h>
#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <linux/fb.h>
-#include <stddef.h>
-#include <unistd.h>
-
-#include <pthread.h>
-#include <Elementary.h>
-#include <getopt.h>
-#include <system_settings.h>
-#include <vconf.h>
#include "animation.h"
#include "boot.h"
#include "app_log.h"
-#include "test.h"
+#include "boot_sound.h"
-#define XRGB8888 4
+#include "test.h"
extern char *optarg;
-extern int optind, opterr, optopt;
-
-//#define SOUND_PROFILE
-#ifdef SOUND_PROFILE
-#include <mm_sound_private.h>
-#endif
+extern int optind;
void(*boot_exit)(void);
-static void print_usages(char *argv0)
-{
- __D("Usage) %s {--start|--stop}\n"
- " Ex:"
- " # %s --start\n"
- " # %s --stop\n"
- " # %s --off\n", argv0, argv0, argv0, argv0);
-}
-
-
-#ifdef SOUND_PROFILE
-/* Sound is not supported Since Tizen 4.0 */
-static int get_wav_file(int state, char *wavpath)
-{
- __D("Get wav file");
- if (state == TYPE_ON) {
- snprintf(wavpath, FILE_PATH_MAX-1, "%s", DEFAULT_POWERON_WAV);
- __D("Wav file: %s", wavpath);
- } else
- return -1;
-
- return 0;
-}
-#endif
-
static int __check_on_off_type(void *user_data)
{
int c;
argv = args->argv;
for (i = 0; i < argc; i++) {
- __D("argc %d [%s]", i, argv[i]);
+ __D("argc %d [%s]", i, argv[i]);
}
while ((c = getopt_long(argc, argv, "sopc", long_options, NULL)) >= 0) {
return type;
}
-static int __prepare_animation(keynode_t * node, void *user_data)
-{
-#ifdef SOUND_PROFILE
- /* Sound is not supported Since Tizen 4.0 */
- /* check sound profile */
- char wav_path[256];
- int soundon = 1; /* default sound on */
-
- if (vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &soundon) < 0) {
- __D("VCONFKEY_SETAPPL_SOUND_STATUS_BOOL ==> FAIL!!");
- }
-
- __D("Sound status: %d", soundon);
-#endif
-
- int type = -1;
- type = __check_on_off_type(user_data);
- if (type < 0) {
- __E("Failed to get on off type or UNKNOWN_TYPE: %d", type);
- return EXIT_FAILURE;
- }
-
- if (init_animation(type) != EXIT_SUCCESS) {
- __E("Exit boot-animation");
- return EXIT_FAILURE;
- }
-
-#ifdef SOUND_PROFILE
- if (soundon) {
- __D("Sound on!!");
- if (!get_wav_file(type, wav_path)) {
- __D("File path: %s", wav_path);
- mm_sound_boot_ready(3);
- mm_sound_boot_play_sound(wav_path);
- }
- }
-#endif
- __D("EXIT SUCESS");
-
- return EXIT_SUCCESS;
-}
-
-#if 0
-static void _boot_ani_ui_set_scale(void)
-{
- double root_height = 0.0;
- double root_width = 0.0;
- char buf[128] = { 0, };
- Display *disp;
- int screen_num;
-
- disp = XOpenDisplay(NULL);
- if (disp == NULL)
- return;
-
- screen_num = DefaultScreen(disp);
-
- root_height = DisplayHeight(disp, screen_num);
- root_width = DisplayWidth(disp, screen_num);
-
- XCloseDisplay(disp);
-
- snprintf(buf, sizeof(buf), "%lf", root_height / BA_DEFAULT_WINDOW_H);
- //snprintf(buf, sizeof(buf), "%lf", root_width / BA_DEFAULT_WINDOW_W);
- __D("Boot animation scale : [%s]", buf);
-
- setenv("ELM_SCALE", buf, 1);
- setenv("SCALE_FACTOR", buf, 1);
-}
-#endif
-
#if (!TEST_MODE)
int main(int argc, char *argv[])
{
setenv("HOME", "/home/root", 1);
if (argc < 2) {
- print_usages(argv[0]);
+ printf("Usage) %s {--start|--stop}\n", argv[0]);
+ printf(" Ex:");
+ printf(" # %s --start\n", argv[0]);
+ printf(" # %s --stop\n", argv[0]);
+ printf(" # %s --off\n", argv[0]);
+
return EXIT_FAILURE;
}
}
invoked_flag = 1;
-#if 0
- _boot_ani_ui_set_scale();
-#endif
-
close(1);
fd = open("/tmp/myfile.txt", O_CREAT|O_RDWR, S_IRWXU|S_IRWXO);
__D("Result of log file open: %d", fd);
elm_init(argc, argv);
boot_exit = elm_exit;
- if (vconf_set_int(VCONFKEY_BOOT_ANIMATION_FINISHED, 0) != 0) {
- __D("Failed to set finished value to 0\n");
+ int boot_type = -1;
+ boot_type = __check_on_off_type(&args);
+ if (boot_type < 0) {
+ __E("Failed to get on off type or UNKNOWN_TYPE: %d", boot_type);
+ return 1;
}
- if (__prepare_animation(NULL, &args) != EXIT_SUCCESS) {
- vconf_set_int(VCONFKEY_BOOT_ANIMATION_FINISHED, 1);
+
+ if (init_animation(boot_type) != EXIT_SUCCESS) {
+ __E("Exit boot-animation");
return 1;
}
+ if (vconf_set_int(VCONFKEY_BOOT_ANIMATION_FINISHED, 0) != 0) {
+ __D("Failed to set finished value to 0\n");
+ }
+
+ play_boot_sound(boot_type);
+
elm_run();
fini_animation();
--- /dev/null
+/*
+ * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <vconf.h>
+#include <app.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "boot.h"
+#include "app_log.h"
+
+static const int is_supported = 0;
+static bool __get_wav_file(int state, char *wavpath)
+{
+ __D("Get wav file");
+ if (state == TYPE_ON) {
+ snprintf(wavpath, FILE_PATH_MAX-1, "%s", DEFAULT_POWERON_WAV);
+ __D("Wav file: %s", wavpath);
+
+ return true;
+ }
+
+ return false;
+}
+
+static int __get_sound_status(void)
+{
+ int soundon = 1;
+
+ if (vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &soundon) < 0) {
+ __D("VCONFKEY_SETAPPL_SOUND_STATUS_BOOL ==> FAIL!!");
+ }
+
+ __D("Sound status: %d", soundon);
+
+ return soundon;
+}
+
+void play_boot_sound(int boot_type)
+{
+ if(!is_supported) return ;
+
+ int soundon = __get_sound_status();
+ if (soundon) {
+ __D("Sound on!!");
+
+ char wav_path[256];
+ if (__get_wav_file(boot_type, wav_path)) {
+ __D("File path: %s", wav_path);
+#ifdef MM_SOUND
+ mm_sound_boot_ready(3);
+ mm_sound_boot_play_sound(wav_path);
+#endif
+ }
+ }
+}
+