2 * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <Elementary.h>
20 #include <sys/types.h>
28 #include <dd-deviced.h>
29 #include <Ecore_Wayland.h>
32 #include <lazy_mount.h>
33 #include <systemd/sd-daemon.h>
37 #include "hourly_alert.h"
38 #include "dbus_util.h"
39 #include "clock_mgr.h"
42 #include "process_mgr.h"
56 static void _signal_handler(int signum, siginfo_t *info, void *unused)
58 _D("_signal_handler : Terminated...");
64 static int _power_off_cb(status_active_key_e key, void *data)
66 int val = status_active_get()->sysman_power_off_status;
68 if (val > VCONFKEY_SYSMAN_POWER_OFF_POPUP) {
69 _E("power off status : %d", val);
78 static int _change_language_cb(status_active_key_e key, void *data)
80 _D("%s, %d", __func__, __LINE__);
82 if (status_active_get()->langset) {
83 elm_language_set(status_active_get()->langset);
91 static int _change_sequence_cb(status_active_key_e key, void *data)
93 int seq = status_active_get()->starter_sequence;
96 home_mgr_launch_home_first();
104 static void _on_lcd_changed_receive(void *data, DBusMessage *msg)
109 _D("LCD signal is received");
111 lcd_on = dbus_message_is_signal(msg, DEVICED_INTERFACE_DISPLAY, MEMBER_LCD_ON);
112 lcd_off = dbus_message_is_signal(msg, DEVICED_INTERFACE_DISPLAY, MEMBER_LCD_OFF);
116 s_starter.lcd_status = 1;
119 s_starter.lcd_status = 0;
121 _E("%s dbus_message_is_signal error", DEVICED_INTERFACE_DISPLAY);
127 static void _init(void)
129 struct sigaction act;
130 char err_buf[128] = {0,};
133 memset(&act,0x00,sizeof(struct sigaction));
134 act.sa_sigaction = _signal_handler;
135 act.sa_flags = SA_SIGINFO;
137 ret = sigemptyset(&act.sa_mask);
139 if (strerror_r(errno, err_buf, sizeof(err_buf)) == 0) {
140 _E("Failed to sigemptyset[%d / %s]", errno, err_buf);
143 ret = sigaddset(&act.sa_mask, SIGTERM);
145 if (strerror_r(errno, err_buf, sizeof(err_buf)) == 0) {
146 _E("Failed to sigaddset[%d / %s]", errno, err_buf);
149 ret = sigaction(SIGTERM, &act, NULL);
151 if (strerror_r(errno, err_buf, sizeof(err_buf)) == 0) {
152 _E("Failed to sigaction[%d / %s]", errno, err_buf);
157 status_active_register_cb(STATUS_ACTIVE_KEY_SYSMAN_POWER_OFF_STATUS, _power_off_cb, NULL);
158 status_active_register_cb(STATUS_ACTIVE_KEY_LANGSET, _change_language_cb, NULL);
160 /* Tells the service manager that service startup is finished */
161 sd_notify(0, "READY=1");
163 home_mgr_launch_home();
165 dbus_util_receive_lcd_status(_on_lcd_changed_receive, NULL);
170 hw_key_create_window();
175 static void _fini(void)
177 hw_key_destroy_window();
182 status_active_unregister_cb(STATUS_ACTIVE_KEY_SYSMAN_POWER_OFF_STATUS, _power_off_cb);
183 status_active_unregister_cb(STATUS_ACTIVE_KEY_LANGSET, _change_language_cb);
184 status_active_unregister_cb(STATUS_ACTIVE_KEY_STARTER_SEQUENCE, _change_sequence_cb);
190 int main(int argc, char *argv[])
194 _D("starter is launched..!!");
196 ret = elm_init(argc, argv);
198 _E("elm_init() failed : %d", ret);
202 ret = ecore_wl_init(NULL);
204 _E("ecore_wl_init() failed : %d", ret);
212 * Release free memory from top of the heap