static void _after_launch_home(int pid)
{
- if (dbus_util_send_oomadj(pid, OOM_ADJ_VALUE_HOMESCREEN) < 0){
+ if (dbus_util_send_oomadj(pid, OOM_ADJ_VALUE_HOMESCREEN) < 0) {
_E("failed to send oom dbus signal");
}
s_home_mgr.home_pid = pid;
#if VOLUME_ENABLE
static void _after_launch_volume(int pid)
{
- if (dbus_util_send_oomadj(pid, OOM_ADJ_VALUE_DEFAULT) < 0){
+ if (dbus_util_send_oomadj(pid, OOM_ADJ_VALUE_DEFAULT) < 0) {
_E("failed to send oom dbus signal");
}
s_home_mgr.volume_pid = pid;
static void _launch_after_home(int pid)
{
if (pid > 0) {
- if(dbus_util_send_oomadj(pid, OOM_ADJ_VALUE_HOMESCREEN) < 0){
+ if (dbus_util_send_oomadj(pid, OOM_ADJ_VALUE_HOMESCREEN) < 0) {
_E("failed to send oom dbus signal");
}
}
void home_mgr_init(void *data)
{
- _D( "[MENU_DAEMON]home_mgr_init is invoked");
+ _D("[MENU_DAEMON]home_mgr_init is invoked");
status_active_register_cb(STATUS_ACTIVE_KEY_STARTER_SEQUENCE, _show_home_cb, NULL);
status_active_register_cb(STATUS_ACTIVE_KEY_SYSMAN_POWER_OFF_STATUS, _power_off_cb, NULL);
status_active_unregister_cb(STATUS_ACTIVE_KEY_SYSMAN_POWER_OFF_STATUS, _power_off_cb);
status_active_unregister_cb(STATUS_ACTIVE_KEY_SETAPPL_SELECTED_PACKAGE_NAME, _change_selected_package_name);
}
-
-
-
-// End of a file
* limitations under the License.
*/
-#ifdef HAVE_X11
-
-#include <app.h>
-#include <bundle.h>
-#include <Elementary.h>
-#include <Ecore_X.h>
-#include <Ecore_Input.h>
-#include <dd-deviced.h>
-#include <syspopup_caller.h>
-#include <utilX.h>
-#include <vconf.h>
-#include <system/media_key.h>
-#include <aul.h>
-#include <feedback.h>
-#include <system_settings.h>
-
-#include "hw_key.h"
-#include "home_mgr.h"
-#include "util.h"
-#include "dbus_util.h"
-#include "lock_mgr.h"
-#include "status.h"
-#include "process_mgr.h"
-
-#define APPID_CAMERA "org.tizen.camera-app"
-#define APPID_CALLLOG "org.tizen.calllog"
-#define APPID_MUSIC_PLAYER "org.tizen.music-player"
-#define APPID_TASKMGR "org.tizen.task-mgr"
-#define APPID_BROWSER "org.tizen.browser"
-#define APPID_EMAIL "org.tizen.email"
-#define APPID_DIALER "org.tizen.phone"
-
-#define STR_ATOM_XKEY_COMPOSITION "_XKEY_COMPOSITION"
-#define STR_ATOM_KEYROUTER_NOTIWINDOW "_KEYROUTER_NOTIWINDOW"
-
-#define LONG_PRESS_TIMER_SEC 0.4
-#define HOMEKEY_TIMER_SEC 0.2
-#define CANCEL_KEY_TIMER_SEC 0.3
-
-static struct {
- Ecore_X_Window win;
- Ecore_Event_Handler *key_up;
- Ecore_Event_Handler *key_down;
- Ecore_Timer *home_long_press_timer;
- Ecore_Timer *home_multi_press_timer;
- Eina_Bool cancel;
- Ecore_X_Window keyrouter_notiwindow;
- int homekey_count;
-} key_info = {
- .win = 0x0,
- .key_up = NULL,
- .key_down = NULL,
- .home_long_press_timer = NULL,
- .home_multi_press_timer = NULL,
- .cancel = EINA_FALSE,
- .keyrouter_notiwindow = 0x0,
- .homekey_count = 0,
-};
-
-
-
-static void _after_launch_taskmgr(int pid)
-{
- if(0 < pid) {
- if(dbus_util_send_oomadj(pid, OOM_ADJ_VALUE_DEFAULT) < 0){
- _E("failed to send oom dbus signal");
- }
- }
-}
-
-
-
-static Eina_Bool _launch_taskmgr_cb(void* data)
-{
- int val = -1;
-
- _D("Launch TASKMGR");
-
- key_info.home_long_press_timer = NULL;
-
- if (vconf_get_int(VCONFKEY_IDLE_LOCK_STATE, &val) < 0) {
- _E("Cannot get VCONFKEY for lock state");
- } else if (VCONFKEY_IDLE_LOCK == val) {
- _E("lock state, ignore home key long press..!!");
- return ECORE_CALLBACK_CANCEL;
- }
-
- process_mgr_must_launch(APPID_TASKMGR, NULL, NULL, NULL, _after_launch_taskmgr);
-
- return ECORE_CALLBACK_CANCEL;
-}
-
-
-
-static void _release_multimedia_key(const char *value)
-{
- ret_if(NULL == value);
- _D("Multimedia key is released with %s", value);
- process_mgr_must_launch(APPID_MUSIC_PLAYER, "multimedia_key", value, NULL, NULL);
-}
-
-
-
-#define HOME_OP_KEY "__HOME_OP__"
-#define HOME_OP_VAL_LAUNCH_BY_HOME_KEY "__LAUNCH_BY_HOME_KEY__"
-static Eina_Bool _launch_by_home_key(void *data)
-{
- if (status_passive_get()->idle_lock_state > VCONFKEY_IDLE_UNLOCK) {
- return ECORE_CALLBACK_CANCEL;
- }
-
- home_mgr_open_home(NULL, HOME_OP_KEY, HOME_OP_VAL_LAUNCH_BY_HOME_KEY);
-
- return ECORE_CALLBACK_CANCEL;
-}
-
-
-
-static Eina_Bool _home_multi_press_timer_cb(void *data)
-{
- _W("homekey count[%d]", key_info.homekey_count);
-
- key_info.home_multi_press_timer = NULL;
-
- if (0 == key_info.homekey_count % 2) {
- key_info.homekey_count = 0;
- return ECORE_CALLBACK_CANCEL;
- } else if(key_info.homekey_count >= 3) {
- key_info.homekey_count = 0;
- return ECORE_CALLBACK_CANCEL;
- }
-
- /* Single homekey operation */
- key_info.homekey_count = 0;
- _launch_by_home_key(data);
-
- return ECORE_CALLBACK_CANCEL;
-
-}
-
-
-
-#define SERVICE_OPERATION_POPUP_SEARCH "http://samsung.com/appcontrol/operation/search"
-#define SEARCH_PKG_NAME "org.tizen.sfinder"
-static int _launch_search(void)
-{
- app_control_h app_control;
- int ret = APP_CONTROL_ERROR_NONE;
-
- app_control_create(&app_control);
- app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
- app_control_set_app_id(app_control, SEARCH_PKG_NAME);
-
- ret = app_control_send_launch_request(app_control, NULL, NULL);
-
- if(ret != APP_CONTROL_ERROR_NONE) {
- _E("Cannot launch search!! err[%d]", ret);
- }
-
- app_control_destroy(app_control);
- return ret;
-}
-
-
-
-static void _cancel_key_events(void)
-{
- key_info.homekey_count = 0;
-
- if (key_info.home_long_press_timer) {
- ecore_timer_del(key_info.home_long_press_timer);
- key_info.home_long_press_timer = NULL;
- }
-
- if(key_info.home_multi_press_timer) {
- ecore_timer_del(key_info.home_multi_press_timer);
- key_info.home_multi_press_timer = NULL;
- }
-}
-
-
-
-static Eina_Bool _key_release_cb(void *data, int type, void *event)
-{
- Evas_Event_Key_Up *ev = event;
-
- retv_if(!ev, ECORE_CALLBACK_RENEW);
- retv_if(!ev->keyname, ECORE_CALLBACK_RENEW);
-
- _D("_key_release_cb : %s Released", ev->keyname);
-
- /* Priority 1 : Cancel event */
- if (!strcmp(ev->keyname, KEY_CANCEL)) {
- _D("CANCEL Key is released");
- key_info.cancel = EINA_FALSE;
- return ECORE_CALLBACK_RENEW;
- }
-
- if (EINA_TRUE == key_info.cancel) {
- _D("CANCEL is on");
- return ECORE_CALLBACK_RENEW;
- }
-
- /* Priority 2 : Execute before checking the lock status */
- if (!strcmp(ev->keyname, KEY_MEDIA)) {
- _release_multimedia_key("KEY_PLAYCD");
- return ECORE_CALLBACK_RENEW;
- }
-
- /* Priority 3 : Check the lock status */
- if ((status_passive_get()->idle_lock_state == VCONFKEY_IDLE_LOCK)
- && (status_active_get()->setappl_screen_lock_type_int > SETTING_SCREEN_LOCK_TYPE_NONE)) {
- _D("phone lock state, ignore home key.");
- return ECORE_CALLBACK_RENEW;
- }
-
- /* Priority 4 : These keys are only activated after checking the lock state */
- if (!strcmp(ev->keyname, KEY_END)) {
- } else if (!strcmp(ev->keyname, KEY_CONFIG)) {
- } else if (!strcmp(ev->keyname, KEY_SEND)) {
- } else if (!strcmp(ev->keyname, KEY_HOME)) {
- _W("Home Key is released");
-
- syspopup_destroy_all();
-
- if(key_info.home_multi_press_timer) {
- _D("delete homekey timer");
- ecore_timer_del(key_info.home_multi_press_timer);
- key_info.home_multi_press_timer = NULL;
- }
-
- if (key_info.home_long_press_timer) {
- ecore_timer_del(key_info.home_long_press_timer);
- key_info.home_long_press_timer = NULL;
- } else {
- key_info.homekey_count = 0;
- return ECORE_CALLBACK_RENEW;
- }
-
- key_info.home_multi_press_timer = ecore_timer_add(HOMEKEY_TIMER_SEC, _home_multi_press_timer_cb, NULL);
- if (!key_info.home_multi_press_timer) {
- _E("Critical! cannot add a timer for home multi press");
- }
- return ECORE_CALLBACK_RENEW;
- } else if (!strcmp(ev->keyname, KEY_PAUSE)) {
- } else if (!strcmp(ev->keyname, KEY_APPS)) {
- _D("App tray key is released");
- } else if (!strcmp(ev->keyname, KEY_TASKSWITCH)) {
- _D("Task switch key is released");
- _launch_taskmgr_cb(NULL);
- } else if (!strcmp(ev->keyname, KEY_WEBPAGE)) {
- _D("Web page key is released");
- process_mgr_must_open(APPID_BROWSER, NULL, NULL);
- } else if (!strcmp(ev->keyname, KEY_MAIL)) {
- _D("Mail key is released");
- process_mgr_must_open(APPID_EMAIL, NULL, NULL);
- } else if (!strcmp(ev->keyname, KEY_CONNECT)) {
- _D("Connect key is released");
- process_mgr_must_open(APPID_DIALER, NULL, NULL);
- } else if (!strcmp(ev->keyname, KEY_SEARCH)) {
- _D("Search key is released");
- if (_launch_search() < 0) {
- _E("Failed to launch the search");
- }
- } else if (!strcmp(ev->keyname, KEY_VOICE)) {
- _D("Voice key is released");
- }
-
- return ECORE_CALLBACK_RENEW;
-}
-
-
-
-static Eina_Bool _key_press_cb(void *data, int type, void *event)
-{
- Evas_Event_Key_Down *ev = event;
-
- retv_if(!ev, ECORE_CALLBACK_RENEW);
- retv_if(!ev->keyname, ECORE_CALLBACK_RENEW);
-
- _D("_key_press_cb : %s Pressed", ev->keyname);
-
- /* Priority 1 : Cancel */
- /* every reserved events have to be canceld when cancel key is pressed */
- if (!strcmp(ev->keyname, KEY_CANCEL)) {
- _D("Cancel button is pressed");
- key_info.cancel = EINA_TRUE;
- _cancel_key_events();
- return ECORE_CALLBACK_RENEW;
- }
-
- if (EINA_TRUE == key_info.cancel) {
- _D("CANCEL is on");
- return ECORE_CALLBACK_RENEW;
- }
-
- /* Priority 2 : Check the lock status */
- if ((status_passive_get()->idle_lock_state == VCONFKEY_IDLE_LOCK)
- && (status_active_get()->setappl_screen_lock_type_int > SETTING_SCREEN_LOCK_TYPE_NONE)) {
- _D("phone lock state, ignore key events.");
- _cancel_key_events();
- return ECORE_CALLBACK_RENEW;
- }
-
- /* Priority 3 : other keys */
- if (!strcmp(ev->keyname, KEY_SEND)) {
- _D("Launch calllog");
- process_mgr_must_open(APPID_CALLLOG, NULL, NULL);
- } else if(!strcmp(ev->keyname, KEY_CONFIG)) {
- _D("Launch camera");
- process_mgr_must_open(APPID_CAMERA, NULL, NULL);
- } else if (!strcmp(ev->keyname, KEY_HOME)) {
- _W("Home Key is pressed");
- if (key_info.home_long_press_timer) {
- ecore_timer_del(key_info.home_long_press_timer);
- key_info.home_long_press_timer = NULL;
- }
-
- key_info.homekey_count++;
- _W("homekey count : %d", key_info.homekey_count);
-
- if(key_info.home_multi_press_timer) {
- ecore_timer_del(key_info.home_multi_press_timer);
- key_info.home_multi_press_timer = NULL;
- _D("delete homekey timer");
- }
-
- _D("create long press timer");
- key_info.home_long_press_timer = ecore_timer_add(LONG_PRESS_TIMER_SEC, _launch_taskmgr_cb, NULL);
- if (!key_info.home_long_press_timer) {
- _E("Failed to add timer for long press detection");
- }
- } else if (!strcmp(ev->keyname, KEY_MEDIA)) {
- _D("Media key is pressed");
- } else if (!strcmp(ev->keyname, KEY_APPS)) {
- _D("App tray key is pressed");
- } else if (!strcmp(ev->keyname, KEY_TASKSWITCH)) {
- _D("Task switch key is pressed");
- } else if (!strcmp(ev->keyname, KEY_WEBPAGE)) {
- _D("Web page key is pressed");
- } else if (!strcmp(ev->keyname, KEY_MAIL)) {
- _D("Mail key is pressed");
- } else if (!strcmp(ev->keyname, KEY_SEARCH)) {
- _D("Search key is pressed");
- } else if (!strcmp(ev->keyname, KEY_VOICE)) {
- _D("Voice key is pressed");
- } else if (!strcmp(ev->keyname, KEY_CONNECT)) {
- _D("Connect key is pressed");
- }
-
- return ECORE_CALLBACK_RENEW;
-}
-
-
-
-void _media_key_event_cb(media_key_e key, media_key_event_e status, void *user_data)
-{
- _D("MEDIA KEY EVENT : %d", key);
- if (MEDIA_KEY_STATUS_PRESSED == status) return;
-
- switch (key) {
- case MEDIA_KEY_PAUSE:
- _release_multimedia_key("KEY_PAUSECD");
- break;
- case MEDIA_KEY_PLAY:
- _release_multimedia_key("KEY_PLAYCD");
- break;
- case MEDIA_KEY_PLAYPAUSE:
- _release_multimedia_key("KEY_PLAYPAUSECD");
- break;
- default:
- _E("cannot reach here, key[%d]", key);
- break;
- }
-}
-
-
-
-void hw_key_create_window(void)
-{
- int ret;
- Ecore_X_Atom atomNotiWindow;
- Ecore_X_Window keyrouter_notiwindow;
-
- key_info.win = ecore_x_window_input_new(0, 0, 0, 1, 1);
- if (!key_info.win) {
- _D("Failed to create hidden window");
- return;
- }
- ecore_x_event_mask_unset(key_info.win, ECORE_X_EVENT_MASK_NONE);
- ecore_x_icccm_title_set(key_info.win, "menudaemon,key,receiver");
- ecore_x_netwm_name_set(key_info.win, "menudaemon,key,receiver");
- ecore_x_netwm_pid_set(key_info.win, getpid());
-
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_HOME, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_VOLUMEDOWN, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_VOLUMEUP, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_CONFIG, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_MEDIA, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_APPS, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_TASKSWITCH, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_WEBPAGE, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_MAIL, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_SEARCH, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_VOICE, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_CONNECT, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_POWER, SHARED_GRAB);
-
- key_info.key_up = ecore_event_handler_add(ECORE_EVENT_KEY_UP, _key_release_cb, NULL);
- if (!key_info.key_up)
- _E("Failed to register a key up event handler");
-
- key_info.key_down = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _key_press_cb, NULL);
- if (!key_info.key_down)
- _E("Failed to register a key down event handler");
-
- /* Get notifwindow */
- atomNotiWindow = ecore_x_atom_get(STR_ATOM_KEYROUTER_NOTIWINDOW);
- ret = ecore_x_window_prop_window_get(ecore_x_window_root_first_get(), atomNotiWindow, &keyrouter_notiwindow, 1);
- if (ret > 0) {
- _D("Succeed to get keyrouter notiwindow ! ret = %d (win=0x%x)\n"
- , ret, keyrouter_notiwindow);
- ecore_x_window_sniff(keyrouter_notiwindow);
- key_info.keyrouter_notiwindow = keyrouter_notiwindow;
- } else {
- _E("Failed to get keyrouter notiwindow! ret = %d, atomNotiWindow = 0x%x, keyrouter_notiwindow = 0x%x"
- , ret, atomNotiWindow, keyrouter_notiwindow);
- }
-
- media_key_reserve(_media_key_event_cb, NULL);
-}
-
-
-
-void hw_key_destroy_window(void)
-{
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_HOME);
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_VOLUMEDOWN);
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_VOLUMEUP);
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_CONFIG);
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_MEDIA);
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_APPS);
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_TASKSWITCH);
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_WEBPAGE);
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_MAIL);
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_SEARCH);
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_VOICE);
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_CONNECT);
-
- if (key_info.key_up) {
- ecore_event_handler_del(key_info.key_up);
- key_info.key_up = NULL;
- }
-
- if (key_info.key_down) {
- ecore_event_handler_del(key_info.key_down);
- key_info.key_down = NULL;
- }
-
- ecore_x_window_delete_request_send(key_info.win);
- key_info.win = 0x0;
-
- media_key_release();
-}
-
-#elif HAVE_WAYLAND
-
#include <app.h>
#include <bundle.h>
#include <Elementary.h>
key_info.home_long_press_timer = NULL;
}
- if(key_info.home_multi_press_timer) {
+ if (key_info.home_multi_press_timer) {
ecore_timer_del(key_info.home_multi_press_timer);
key_info.home_multi_press_timer = NULL;
}
ret = app_control_send_launch_request(app_control, NULL, NULL);
- if(ret != APP_CONTROL_ERROR_NONE) {
+ if (ret != APP_CONTROL_ERROR_NONE) {
_E("Cannot launch search!! err[%d]", ret);
}
static void _after_launch_taskmgr(int pid)
{
- if(0 < pid) {
- if(dbus_util_send_oomadj(pid, OOM_ADJ_VALUE_DEFAULT) < 0){
+ if (0 < pid) {
+ if (dbus_util_send_oomadj(pid, OOM_ADJ_VALUE_DEFAULT) < 0) {
_E("failed to send oom dbus signal");
}
}
if (0 == key_info.homekey_count % 2) {
key_info.homekey_count = 0;
return ECORE_CALLBACK_CANCEL;
- } else if(key_info.homekey_count >= 3) {
+ } else if (key_info.homekey_count >= 3) {
key_info.homekey_count = 0;
return ECORE_CALLBACK_CANCEL;
}
syspopup_destroy_all();
- if(key_info.home_multi_press_timer) {
+ if (key_info.home_multi_press_timer) {
_D("delete homekey timer");
ecore_timer_del(key_info.home_multi_press_timer);
key_info.home_multi_press_timer = NULL;
process_mgr_must_open(APPID_CALLLOG, NULL, NULL);
} else
#endif
- if(!strcmp(ev->keyname, key_name[KEY_CONFIG])) {
+ if (!strcmp(ev->keyname, key_name[KEY_CONFIG])) {
_D("Launch camera");
process_mgr_must_open(APPID_CAMERA, NULL, NULL);
} else if (!strcmp(ev->keyname, key_name[KEY_HOME])) {
key_info.homekey_count++;
_W("homekey count : %d", key_info.homekey_count);
- if(key_info.home_multi_press_timer) {
+ if (key_info.home_multi_press_timer) {
ecore_timer_del(key_info.home_multi_press_timer);
key_info.home_multi_press_timer = NULL;
_D("delete homekey timer");
key_info.key_down = NULL;
}
}
-
-#endif
-
-// End of a file
static struct {
int checkfd;
- //alarm_id_t alarm_id; /* -1 : None, others : set alarm */
- //Eina_Bool is_alarm; /* EINA_TRUE : can use alarm EINA_FALSE : cannot use */
-
int old_lock_type;
int lock_pid;
int lcd_state;
-#ifdef HAVE_X11
- lockw_data *lockw;
-#endif
} s_lock_mgr = {
.checkfd = 0,
- //.alarm_id = -1,
- //.is_alarm = EINA_FALSE,
.old_lock_type = 0,
.lock_pid = -1,
.lcd_state = -1,
-
-#ifdef HVAE_X11
- .lockw = NULL,
-#endif
};
-#if 0
-static int _alarm_del(alarm_id_t id, void * user_param)
-{
- int ret = ALARMMGR_RESULT_SUCCESS;
-
- _D("delete alarm id : %d", id);
-
- ret = alarmmgr_remove_alarm(id);
- if (ret != ALARMMGR_RESULT_SUCCESS) {
- _E("Failed to remove alarm(%d)", ret );
- }
-
- return 0;
-}
-
-
-
-static void _alarm_unset(void)
-{
- int ret = ALARMMGR_RESULT_SUCCESS;
-
- ret = alarmmgr_enum_alarm_ids(_alarm_del, NULL);
- if (ret != ALARMMGR_RESULT_SUCCESS) {
- _E("Failed to get list of alarm ids");
- }
-}
-
-
-
-static void _alarm_lockscreen_launch(alarm_id_t alarm_id, void *data)
-{
- int ret = ALARMMGR_RESULT_SUCCESS;
-
- _D("alarm id : %d", alarm_id);
-
- /* launch lockscreen */
- if (!lock_mgr_lockscreen_launch()) {
- _E("Failed to launch lockscreen");
- }
-
- if (alarm_id != -1) {
- if (alarm_id != s_lock_mgr.alarm_id) {
- _E("alarm ids are different callback->id(%d), s_lock_mgr.alarm_id(%d)", alarm_id, s_lock_mgr.alarm_id);
- /* delete all registering alarm*/
- _alarm_unset();
- s_lock_mgr.alarm_id = -1;
- } else {
- ret = alarmmgr_remove_alarm(alarm_id);
- if (ret != ALARMMGR_RESULT_SUCCESS) {
- _E("Failed to remove alaram(%d)", ret);
- /* delete all registering alarm*/
- _alarm_unset();
- }
- s_lock_mgr.alarm_id = -1;
- }
- }
-}
-
-
-
-static Eina_Bool _alarm_init(void)
-{
- int ret = 0;
-
- /* alarm id initialize */
- s_lock_mgr.alarm_id = -1;
-
- ret = alarmmgr_init(PACKAGE_NAME);
- if (ret != ALARMMGR_RESULT_SUCCESS) {
- _E("Failed to initialize alarmmgr(%d)", ret);
- return EINA_FALSE;
- }
-
- ret = alarmmgr_set_cb((alarm_cb_t)_alarm_lockscreen_launch, NULL);
- if (ret != ALARMMGR_RESULT_SUCCESS) {
- _E("Failed to set cb func(%d)", ret);
- return EINA_FALSE;
- }
-
- _D("alarm init success");
-
- return EINA_TRUE;
-}
-#endif
-
-
-
void lock_mgr_sound_play(lock_sound_type_e type)
{
int val = status_passive_get()->setappl_sound_lock_bool;
ret_if(!val);
- switch(type) {
+ switch (type) {
case LOCK_SOUND_LOCK:
feedback_play_type(FEEDBACK_TYPE_SOUND, FEEDBACK_PATTERN_LOCK);
break;
process_mgr_must_launch(lock_appid, NULL, NULL, _lock_changed_cb, _after_launch_lock);
goto_if(s_lock_mgr.lock_pid < 0, ERROR);
- if (dbus_util_send_oomadj(s_lock_mgr.lock_pid, OOM_ADJ_VALUE_DEFAULT) < 0){
+ if (dbus_util_send_oomadj(s_lock_mgr.lock_pid, OOM_ADJ_VALUE_DEFAULT) < 0) {
_E("Failed to send oom dbus signal");
}
static void _signal_handler(int signum, siginfo_t *info, void *unused)
{
- _D("_signal_handler : Terminated...");
- elm_exit();
+ _D("_signal_handler : Terminated...");
+ elm_exit();
}
{
int val = status_active_get()->sysman_power_off_status;
- if (val == VCONFKEY_SYSMAN_POWER_OFF_DIRECT
- || val == VCONFKEY_SYSMAN_POWER_OFF_RESTART)
- {
+ if (val == VCONFKEY_SYSMAN_POWER_OFF_DIRECT || val == VCONFKEY_SYSMAN_POWER_OFF_RESTART) {
_D("_power_off_cb : Terminated...");
elm_exit();
}
struct sigaction act;
char err_buf[128] = {0,};
- memset(&act,0x00,sizeof(struct sigaction));
+ memset(&act, 0x00, sizeof(struct sigaction));
act.sa_sigaction = _signal_handler;
act.sa_flags = SA_SIGINFO;
int ret = sigemptyset(&act.sa_mask);
if (ret < 0) {
- strerror_r(errno, err_buf, sizeof(err_buf));
- _E("Failed to sigemptyset[%d / %s]", errno, err_buf);
+ if (strerror_r(errno, err_buf, sizeof(err_buf)) == 0) {
+ _E("Failed to sigemptyset[%d / %s]", errno, err_buf);
+ }
}
ret = sigaddset(&act.sa_mask, SIGTERM);
if (ret < 0) {
- strerror_r(errno, err_buf, sizeof(err_buf));
- _E("Failed to sigaddset[%d / %s]", errno, err_buf);
+ if (strerror_r(errno, err_buf, sizeof(err_buf)) == 0) {
+ _E("Failed to sigaddset[%d / %s]", errno, err_buf);
+ }
}
ret = sigaction(SIGTERM, &act, NULL);
if (ret < 0) {
- strerror_r(errno, err_buf, sizeof(err_buf));
- _E("Failed to sigaction[%d / %s]", errno, err_buf);
+ if (strerror_r(errno, err_buf, sizeof(err_buf)) == 0) {
+ _E("Failed to sigaction[%d / %s]", errno, err_buf);
+ }
}
_set_i18n(PACKAGE, LOCALEDIR);
char buf2[BUF_SIZE_16];
int ret, val;
- if(pid <= 0){
+ if (pid <= 0) {
_E("Pid is invalid");
return -1;
}
static void _after_launch_home(int pid)
{
- if (dbus_util_send_oomadj(pid, OOM_ADJ_VALUE_HOMESCREEN) < 0){
+ if (dbus_util_send_oomadj(pid, OOM_ADJ_VALUE_HOMESCREEN) < 0) {
_E("failed to send oom dbus signal");
}
s_home_mgr.home_pid = pid;
static void _after_launch_volume(int pid)
{
- if (dbus_util_send_oomadj(pid, OOM_ADJ_VALUE_DEFAULT) < 0){
+ if (dbus_util_send_oomadj(pid, OOM_ADJ_VALUE_DEFAULT) < 0) {
_E("failed to send oom dbus signal");
}
s_home_mgr.volume_pid = pid;
static void _launch_after_home(int pid)
{
if (pid > 0) {
- if(dbus_util_send_oomadj(pid, OOM_ADJ_VALUE_HOMESCREEN) < 0){
+ if (dbus_util_send_oomadj(pid, OOM_ADJ_VALUE_HOMESCREEN) < 0) {
_E("failed to send oom dbus signal");
}
}
void home_mgr_init(void *data)
{
- _D( "[MENU_DAEMON]home_mgr_init is invoked");
+ _D("[MENU_DAEMON]home_mgr_init is invoked");
status_active_register_cb(STATUS_ACTIVE_KEY_STARTER_SEQUENCE, _show_home_cb, NULL);
status_active_register_cb(STATUS_ACTIVE_KEY_SYSMAN_POWER_OFF_STATUS, _power_off_cb, NULL);
* limitations under the License.
*/
-#ifdef HAVE_X11
-
-#include <app.h>
-#include <bundle.h>
-#include <Elementary.h>
-#include <Ecore_X.h>
-#include <Ecore_Input.h>
-#include <dd-deviced.h>
-#include <syspopup_caller.h>
-#include <utilX.h>
-#include <vconf.h>
-#include <system/media_key.h>
-#include <aul.h>
-#include <feedback.h>
-#include <system_settings.h>
-
-#include "hw_key.h"
-#include "home_mgr.h"
-#include "util.h"
-#include "dbus_util.h"
-#include "lock_mgr.h"
-#include "status.h"
-#include "process_mgr.h"
-
-#define APPID_CAMERA "org.tizen.camera-app"
-#define APPID_CALLLOG "org.tizen.calllog"
-#define APPID_MUSIC_PLAYER "org.tizen.music-player"
-#define APPID_TASKMGR "org.tizen.task-mgr"
-#define APPID_BROWSER "org.tizen.browser"
-#define APPID_EMAIL "org.tizen.email"
-#define APPID_DIALER "org.tizen.phone"
-
-#define STR_ATOM_XKEY_COMPOSITION "_XKEY_COMPOSITION"
-#define STR_ATOM_KEYROUTER_NOTIWINDOW "_KEYROUTER_NOTIWINDOW"
-
-#define LONG_PRESS_TIMER_SEC 0.4
-#define HOMEKEY_TIMER_SEC 0.2
-#define CANCEL_KEY_TIMER_SEC 0.3
-
-static struct {
- Ecore_X_Window win;
- Ecore_Event_Handler *key_up;
- Ecore_Event_Handler *key_down;
- Ecore_Timer *home_long_press_timer;
- Ecore_Timer *home_multi_press_timer;
- Eina_Bool cancel;
- Ecore_X_Window keyrouter_notiwindow;
- int homekey_count;
-} key_info = {
- .win = 0x0,
- .key_up = NULL,
- .key_down = NULL,
- .home_long_press_timer = NULL,
- .home_multi_press_timer = NULL,
- .cancel = EINA_FALSE,
- .keyrouter_notiwindow = 0x0,
- .homekey_count = 0,
-};
-
-
-
-static void _after_launch_taskmgr(int pid)
-{
- if (0 < pid) {
- if(dbus_util_send_oomadj(pid, OOM_ADJ_VALUE_DEFAULT) < 0){
- _E("failed to send oom dbus signal");
- }
- }
-}
-
-
-
-static Eina_Bool _launch_taskmgr_cb(void* data)
-{
- int val = -1;
-
- _D("Launch TASKMGR");
-
- key_info.home_long_press_timer = NULL;
-
- if (vconf_get_int(VCONFKEY_IDLE_LOCK_STATE, &val) < 0) {
- _E("Cannot get VCONFKEY for lock state");
- } else if (VCONFKEY_IDLE_LOCK == val) {
- _E("lock state, ignore home key long press..!!");
- return ECORE_CALLBACK_CANCEL;
- }
-
- process_mgr_must_launch(APPID_TASKMGR, NULL, NULL, NULL, _after_launch_taskmgr);
-
- return ECORE_CALLBACK_CANCEL;
-}
-
-
-
-static void _release_multimedia_key(const char *value)
-{
- ret_if(NULL == value);
- _D("Multimedia key is released with %s", value);
- process_mgr_must_launch(APPID_MUSIC_PLAYER, "multimedia_key", value, NULL, NULL);
-}
-
-
-
-#define HOME_OP_KEY "__HOME_OP__"
-#define HOME_OP_VAL_LAUNCH_BY_HOME_KEY "__LAUNCH_BY_HOME_KEY__"
-static Eina_Bool _launch_by_home_key(void *data)
-{
- if (status_passive_get()->idle_lock_state > VCONFKEY_IDLE_UNLOCK) {
- return ECORE_CALLBACK_CANCEL;
- }
-
- home_mgr_open_home(NULL, HOME_OP_KEY, HOME_OP_VAL_LAUNCH_BY_HOME_KEY);
-
- return ECORE_CALLBACK_CANCEL;
-}
-
-
-
-static Eina_Bool _home_multi_press_timer_cb(void *data)
-{
- _W("homekey count[%d]", key_info.homekey_count);
-
- key_info.home_multi_press_timer = NULL;
-
- if (0 == key_info.homekey_count % 2) {
- key_info.homekey_count = 0;
- return ECORE_CALLBACK_CANCEL;
- } else if(key_info.homekey_count >= 3) {
- key_info.homekey_count = 0;
- return ECORE_CALLBACK_CANCEL;
- }
-
- /* Single homekey operation */
- key_info.homekey_count = 0;
- _launch_by_home_key(data);
-
- return ECORE_CALLBACK_CANCEL;
-
-}
-
-
-
-#define SEARCH_PKG_NAME "org.tizen.sfinder"
-static int _launch_search(void)
-{
- app_control_h app_control;
- int ret = APP_CONTROL_ERROR_NONE;
-
- app_control_create(&app_control);
- app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
- app_control_set_app_id(app_control, SEARCH_PKG_NAME);
-
- ret = app_control_send_launch_request(app_control, NULL, NULL);
-
- if(ret != APP_CONTROL_ERROR_NONE) {
- _E("Cannot launch search!! err[%d]", ret);
- }
-
- app_control_destroy(app_control);
- return ret;
-}
-
-
-
-static void _cancel_key_events(void)
-{
- key_info.homekey_count = 0;
-
- if (key_info.home_long_press_timer) {
- ecore_timer_del(key_info.home_long_press_timer);
- key_info.home_long_press_timer = NULL;
- }
-
- if(key_info.home_multi_press_timer) {
- ecore_timer_del(key_info.home_multi_press_timer);
- key_info.home_multi_press_timer = NULL;
- }
-}
-
-
-
-static Eina_Bool _key_release_cb(void *data, int type, void *event)
-{
- Evas_Event_Key_Up *ev = event;
-
- retv_if(!ev, ECORE_CALLBACK_RENEW);
- retv_if(!ev->keyname, ECORE_CALLBACK_RENEW);
-
- _D("_key_release_cb : %s Released", ev->keyname);
-
- /* Priority 1 : Cancel event */
- if (!strcmp(ev->keyname, KEY_CANCEL)) {
- _D("CANCEL Key is released");
- key_info.cancel = EINA_FALSE;
- return ECORE_CALLBACK_RENEW;
- }
-
- if (EINA_TRUE == key_info.cancel) {
- _D("CANCEL is on");
- return ECORE_CALLBACK_RENEW;
- }
-
- /* Priority 2 : Execute before checking the lock status */
- if (!strcmp(ev->keyname, KEY_MEDIA)) {
- _release_multimedia_key("KEY_PLAYCD");
- return ECORE_CALLBACK_RENEW;
- }
-
- /* Priority 3 : Check the lock status */
- if ((status_passive_get()->idle_lock_state == VCONFKEY_IDLE_LOCK)
- && (status_active_get()->setappl_screen_lock_type_int > SETTING_SCREEN_LOCK_TYPE_NONE)) {
- _D("phone lock state, ignore home key.");
- return ECORE_CALLBACK_RENEW;
- }
-
- /* Priority 4 : These keys are only activated after checking the lock state */
- if (!strcmp(ev->keyname, KEY_END)) {
- } else if (!strcmp(ev->keyname, KEY_CONFIG)) {
- } else if (!strcmp(ev->keyname, KEY_SEND)) {
- } else if (!strcmp(ev->keyname, KEY_HOME)) {
- _W("Home Key is released");
-
- syspopup_destroy_all();
-
- if(key_info.home_multi_press_timer) {
- _D("delete homekey timer");
- ecore_timer_del(key_info.home_multi_press_timer);
- key_info.home_multi_press_timer = NULL;
- }
-
- if (key_info.home_long_press_timer) {
- ecore_timer_del(key_info.home_long_press_timer);
- key_info.home_long_press_timer = NULL;
- } else {
- key_info.homekey_count = 0;
- return ECORE_CALLBACK_RENEW;
- }
-
- key_info.home_multi_press_timer = ecore_timer_add(HOMEKEY_TIMER_SEC, _home_multi_press_timer_cb, NULL);
- if (!key_info.home_multi_press_timer) {
- _E("Critical! cannot add a timer for home multi press");
- }
- return ECORE_CALLBACK_RENEW;
- } else if (!strcmp(ev->keyname, KEY_PAUSE)) {
- } else if (!strcmp(ev->keyname, KEY_APPS)) {
- _D("App tray key is released");
- } else if (!strcmp(ev->keyname, KEY_TASKSWITCH)) {
- _D("Task switch key is released");
- _launch_taskmgr_cb(NULL);
- } else if (!strcmp(ev->keyname, KEY_WEBPAGE)) {
- _D("Web page key is released");
- process_mgr_must_open(APPID_BROWSER, NULL, NULL);
- } else if (!strcmp(ev->keyname, KEY_MAIL)) {
- _D("Mail key is released");
- process_mgr_must_open(APPID_EMAIL, NULL, NULL);
- } else if (!strcmp(ev->keyname, KEY_CONNECT)) {
- _D("Connect key is released");
- process_mgr_must_open(APPID_DIALER, NULL, NULL);
- } else if (!strcmp(ev->keyname, KEY_SEARCH)) {
- _D("Search key is released");
- if (_launch_search() < 0) {
- _E("Failed to launch the search");
- }
- } else if (!strcmp(ev->keyname, KEY_VOICE)) {
- _D("Voice key is released");
- }
-
- return ECORE_CALLBACK_RENEW;
-}
-
-
-
-static Eina_Bool _key_press_cb(void *data, int type, void *event)
-{
- Evas_Event_Key_Down *ev = event;
-
- retv_if(!ev, ECORE_CALLBACK_RENEW);
- retv_if(!ev->keyname, ECORE_CALLBACK_RENEW);
-
- _D("_key_press_cb : %s Pressed", ev->keyname);
-
- /* Priority 1 : Cancel */
- /* every reserved events have to be canceld when cancel key is pressed */
- if (!strcmp(ev->keyname, KEY_CANCEL)) {
- _D("Cancel button is pressed");
- key_info.cancel = EINA_TRUE;
- _cancel_key_events();
- return ECORE_CALLBACK_RENEW;
- }
-
- if (EINA_TRUE == key_info.cancel) {
- _D("CANCEL is on");
- return ECORE_CALLBACK_RENEW;
- }
-
- /* Priority 2 : Check the lock status */
- if ((status_passive_get()->idle_lock_state == VCONFKEY_IDLE_LOCK)
- && (status_active_get()->setappl_screen_lock_type_int > SETTING_SCREEN_LOCK_TYPE_NONE)) {
- _D("phone lock state, ignore key events.");
- _cancel_key_events();
- return ECORE_CALLBACK_RENEW;
- }
-
- /* Priority 3 : other keys */
- if (!strcmp(ev->keyname, KEY_SEND)) {
- _D("Launch calllog");
- process_mgr_must_open(APPID_CALLLOG, NULL, NULL);
- } else if(!strcmp(ev->keyname, KEY_CONFIG)) {
- _D("Launch camera");
- process_mgr_must_open(APPID_CAMERA, NULL, NULL);
- } else if (!strcmp(ev->keyname, KEY_HOME)) {
- _W("Home Key is pressed");
- if (key_info.home_long_press_timer) {
- ecore_timer_del(key_info.home_long_press_timer);
- key_info.home_long_press_timer = NULL;
- }
-
- key_info.homekey_count++;
- _W("homekey count : %d", key_info.homekey_count);
-
- if(key_info.home_multi_press_timer) {
- ecore_timer_del(key_info.home_multi_press_timer);
- key_info.home_multi_press_timer = NULL;
- _D("delete homekey timer");
- }
-
- _D("create long press timer");
- key_info.home_long_press_timer = ecore_timer_add(LONG_PRESS_TIMER_SEC, _launch_taskmgr_cb, NULL);
- if (!key_info.home_long_press_timer) {
- _E("Failed to add timer for long press detection");
- }
- } else if (!strcmp(ev->keyname, KEY_MEDIA)) {
- _D("Media key is pressed");
- } else if (!strcmp(ev->keyname, KEY_APPS)) {
- _D("App tray key is pressed");
- } else if (!strcmp(ev->keyname, KEY_TASKSWITCH)) {
- _D("Task switch key is pressed");
- } else if (!strcmp(ev->keyname, KEY_WEBPAGE)) {
- _D("Web page key is pressed");
- } else if (!strcmp(ev->keyname, KEY_MAIL)) {
- _D("Mail key is pressed");
- } else if (!strcmp(ev->keyname, KEY_SEARCH)) {
- _D("Search key is pressed");
- } else if (!strcmp(ev->keyname, KEY_VOICE)) {
- _D("Voice key is pressed");
- } else if (!strcmp(ev->keyname, KEY_CONNECT)) {
- _D("Connect key is pressed");
- }
-
- return ECORE_CALLBACK_RENEW;
-}
-
-
-
-void _media_key_event_cb(media_key_e key, media_key_event_e status, void *user_data)
-{
- _D("MEDIA KEY EVENT : %d", key);
- if (MEDIA_KEY_STATUS_PRESSED == status) return;
-
- switch (key) {
- case MEDIA_KEY_PAUSE:
- _release_multimedia_key("KEY_PAUSECD");
- break;
- case MEDIA_KEY_PLAY:
- _release_multimedia_key("KEY_PLAYCD");
- break;
- case MEDIA_KEY_PLAYPAUSE:
- _release_multimedia_key("KEY_PLAYPAUSECD");
- break;
- default:
- _E("cannot reach here, key[%d]", key);
- break;
- }
-}
-
-
-
-void hw_key_create_window(void)
-{
- int ret;
- Ecore_X_Atom atomNotiWindow;
- Ecore_X_Window keyrouter_notiwindow;
-
- key_info.win = ecore_x_window_input_new(0, 0, 0, 1, 1);
- if (!key_info.win) {
- _D("Failed to create hidden window");
- return;
- }
- ecore_x_event_mask_unset(key_info.win, ECORE_X_EVENT_MASK_NONE);
- ecore_x_icccm_title_set(key_info.win, "menudaemon,key,receiver");
- ecore_x_netwm_name_set(key_info.win, "menudaemon,key,receiver");
- ecore_x_netwm_pid_set(key_info.win, getpid());
-
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_HOME, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_VOLUMEDOWN, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_VOLUMEUP, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_CONFIG, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_MEDIA, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_APPS, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_TASKSWITCH, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_WEBPAGE, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_MAIL, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_SEARCH, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_VOICE, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_CONNECT, SHARED_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_POWER, SHARED_GRAB);
-
- key_info.key_up = ecore_event_handler_add(ECORE_EVENT_KEY_UP, _key_release_cb, NULL);
- if (!key_info.key_up)
- _E("Failed to register a key up event handler");
-
- key_info.key_down = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _key_press_cb, NULL);
- if (!key_info.key_down)
- _E("Failed to register a key down event handler");
-
- /* Get notifwindow */
- atomNotiWindow = ecore_x_atom_get(STR_ATOM_KEYROUTER_NOTIWINDOW);
- ret = ecore_x_window_prop_window_get(ecore_x_window_root_first_get(), atomNotiWindow, &keyrouter_notiwindow, 1);
- if (ret > 0) {
- _D("Succeed to get keyrouter notiwindow ! ret = %d (win=0x%x)\n"
- , ret, keyrouter_notiwindow);
- ecore_x_window_sniff(keyrouter_notiwindow);
- key_info.keyrouter_notiwindow = keyrouter_notiwindow;
- } else {
- _E("Failed to get keyrouter notiwindow! ret = %d, atomNotiWindow = 0x%x, keyrouter_notiwindow = 0x%x"
- , ret, atomNotiWindow, keyrouter_notiwindow);
- }
-
- media_key_reserve(_media_key_event_cb, NULL);
-}
-
-
-
-void hw_key_destroy_window(void)
-{
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_HOME);
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_VOLUMEDOWN);
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_VOLUMEUP);
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_CONFIG);
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_MEDIA);
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_APPS);
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_TASKSWITCH);
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_WEBPAGE);
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_MAIL);
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_SEARCH);
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_VOICE);
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_CONNECT);
-
- if (key_info.key_up) {
- ecore_event_handler_del(key_info.key_up);
- key_info.key_up = NULL;
- }
-
- if (key_info.key_down) {
- ecore_event_handler_del(key_info.key_down);
- key_info.key_down = NULL;
- }
-
- ecore_x_window_delete_request_send(key_info.win);
- key_info.win = 0x0;
-
- media_key_release();
-}
-
-#elif HAVE_WAYLAND
-
#include <app.h>
#include <bundle.h>
#include <Elementary.h>
key_info.home_key_long_press_timer = NULL;
}
- if(key_info.home_key_multi_press_timer) {
+ if (key_info.home_key_multi_press_timer) {
ecore_timer_del(key_info.home_key_multi_press_timer);
key_info.home_key_multi_press_timer = NULL;
}
static void _after_launch_taskmgr(int pid)
{
- if(0 < pid) {
- if(dbus_util_send_oomadj(pid, OOM_ADJ_VALUE_DEFAULT) < 0){
+ if (0 < pid) {
+ if (dbus_util_send_oomadj(pid, OOM_ADJ_VALUE_DEFAULT) < 0) {
_E("failed to send oom dbus signal");
}
}
key_info.home_key_count++;
_W("home key count : %d", key_info.home_key_count);
- if(key_info.home_key_multi_press_timer) {
+ if (key_info.home_key_multi_press_timer) {
_D("delete home key multi press timer");
ecore_timer_del(key_info.home_key_multi_press_timer);
key_info.home_key_multi_press_timer = NULL;
}
/* Priority 4 : These keys are only activated after checking the lock state */
- if (!strcmp(ev->keyname, key_name[KEY_CONFIG])) {
+ if (!strcmp(ev->keyname, key_name[KEY_CONFIG])) {
} else if (!strcmp(ev->keyname, key_name[KEY_HOME])) {
_W("Home Key is released");
_home_key_release_events();
}
/* Priority 3 : other keys */
- if(!strcmp(ev->keyname, key_name[KEY_CONFIG])) {
+ if (!strcmp(ev->keyname, key_name[KEY_CONFIG])) {
_D("Launch camera");
process_mgr_must_open(APPID_CAMERA, NULL, NULL);
} else if (!strcmp(ev->keyname, key_name[KEY_HOME])) {
_unset_keygrab();
}
-#endif
-
// End of a file
static bool _check_support_telephony(void)
{
int ret = 0;
- bool is_support= EINA_FALSE;
+ bool is_support = EINA_FALSE;
ret = system_info_get_platform_bool(SYSTEM_INFO_KEY_NETWORK_TELEPHONY, &is_support);
if (ret != SYSTEM_INFO_ERROR_NONE) {
int val = status_passive_get()->setappl_sound_lock_bool;
ret_if(!val);
- switch(type) {
+ switch (type) {
case LOCK_SOUND_LOCK:
feedback_play_type(FEEDBACK_TYPE_SOUND, FEEDBACK_PATTERN_LOCK);
break;
static void _signal_handler(int signum, siginfo_t *info, void *unused)
{
- _D("_signal_handler : Terminated...");
- elm_exit();
+ _D("_signal_handler : Terminated...");
+ elm_exit();
}
int val = status_active_get()->sysman_power_off_status;
if (val == VCONFKEY_SYSMAN_POWER_OFF_DIRECT
- || val == VCONFKEY_SYSMAN_POWER_OFF_RESTART)
- {
+ || val == VCONFKEY_SYSMAN_POWER_OFF_RESTART) {
_D("_power_off_cb : Terminated...");
elm_exit();
}
int is_lazy_mount = 0;
int ret = 0;
- memset(&act,0x00,sizeof(struct sigaction));
+ memset(&act, 0x00, sizeof(struct sigaction));
act.sa_sigaction = _signal_handler;
act.sa_flags = SA_SIGINFO;
retv_if(pid == AUL_R_ETERMINATING, ECORE_CALLBACK_RENEW);
if (pid == AUL_R_ERROR) {
if (launch_info->cfn
- && 0 == launch_info->cfn(launch_info->appid, launch_info->key, launch_info->value, (void *) launch_info->cfn, (void *) launch_info->afn))
- {
+ && 0 == launch_info->cfn(launch_info->appid, launch_info->key, launch_info->value, (void *) launch_info->cfn, (void *) launch_info->afn)) {
_D("change func has set the next appid");
} else {
_E("change func has returned error");
return ECORE_CALLBACK_CANCEL;
}
- if (setpriority(PRIO_PROCESS, (pid_t)data, NICE_VALUE_LOCKSCREEN) < 0 ) {
+ if (setpriority(PRIO_PROCESS, (pid_t)data, NICE_VALUE_LOCKSCREEN) < 0) {
_D("error : %d", errno);
return ECORE_CALLBACK_CANCEL;
}
return ECORE_CALLBACK_CANCEL;
}
- if (setpriority(PRIO_PROCESS, (pid_t)data, NICE_VALUE_PWLOCK) < 0 ) {
+ if (setpriority(PRIO_PROCESS, (pid_t)data, NICE_VALUE_PWLOCK) < 0) {
_D("error : %d", errno);
return ECORE_CALLBACK_CANCEL;
}
extern int aul_kill_pid(int pid);
void process_mgr_kill_app(int pid)
{
- _D ("process_mgr_kill_app [pid:%d]..", pid);
+ _D("process_mgr_kill_app [pid:%d]..", pid);
aul_kill_pid(pid);
}
continue_if(!info->func);
if (0 == info->func(STATUS_ACTIVE_KEY_BOOT_ANIMATION_FINISHED, info->data)) break;
}
-#if 0
- } else if (!strcmp(key_name, )) {
- s_status_active. = vconf_keynode_get_int(node);
- EINA_LIST_FOREACH(s_status_active.list[STATUS_ACTIVE_KEY_], l, info) {
- continue_if(!info->func);
- if (0 == info->func(STATUS_ACTIVE_KEY_, info->data)) break;
- }
-#endif
}
}
_E("Keep old package. because of strdup\n");
}
}
-
-#if 0
- } else if (!strcmp(key_name, )) {
- s_status_passive. = vconf_keynode_get_int(node);
-#endif
}
}
if (vconf_notify_key_changed(VCONFKEY_SYSMAN_POWER_OFF_STATUS, _status_active_change_cb, NULL) < 0) {
_E("Failed to register add the callback for %s", VCONFKEY_SYSMAN_POWER_OFF_STATUS);
- } else if (vconf_get_int(VCONFKEY_SYSMAN_POWER_OFF_STATUS, &s_status_active.sysman_power_off_status ) < 0) {
+ } else if (vconf_get_int(VCONFKEY_SYSMAN_POWER_OFF_STATUS, &s_status_active.sysman_power_off_status) < 0) {
_E("Failed to get vconfkey[%s]", VCONFKEY_SYSMAN_POWER_OFF_STATUS);
s_status_active.sysman_power_off_status = -1;
}
s_status_active.boot_animation_finished = -1;
}
-#if 0
- if (vconf_notify_key_changed(, _status_active_change_cb, NULL) < 0) {
- _E("Failed to register add the callback for %s", );
- } else if (vconf_get_int(, &s_status_active.) < 0) {
- _E("Failed to get vconfkey[%s]", );
- s_status_active. = -1;
- }
-#endif
-
/* Passive events */
#ifdef TIZEN_PROFILE_WEARABLE
if (vconf_notify_key_changed(VCONFKEY_WMS_WAKEUP_BY_GESTURE_SETTING, _status_passive_change_cb, NULL) < 0) {
}
}
-#if 0
- if (vconf_notify_key_changed(, _status_passive_change_cb, NULL) < 0) {
- _E("Failed to register add the callback for %s", );
- } else if (vconf_get_int(, &s_status_passive.) < 0) {
- _E("Failed to get vconfkey[%s]", );
- s_status_passive. = -1;
- }
-#endif
-
return 0;
}
_E("Failed to unregister the callback for %s", VCONFKEY_BOOT_ANIMATION_FINISHED);
}
-#if 0
- if (vconf_ignore_key_changed(, _status_active_change_cb) < 0) {
- _E("Failed to unregister the callback for %s", );
- }
-#endif
-
/* Passive events */
#ifdef TIZEN_PROFILE_WEARABLE
if (vconf_ignore_key_changed(VCONFKEY_WMS_WAKEUP_BY_GESTURE_SETTING, _status_passive_change_cb) < 0) {
_E("Failed to unregister ther callback for %s", VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR);
}
free(s_status_passive.setappl_3rd_lock_pkg_name_str);
-
-#if 0
- if (vconf_ignore_key_changed(, _status_passive_change_cb) < 0) {
- _E("Failed to unregister the callback for %s", );
- }
-#endif
}
int ret = ALARMMGR_RESULT_SUCCESS;
ret = alarmmgr_remove_alarm(id);
- if(ret != ALARMMGR_RESULT_SUCCESS) {
+ if (ret != ALARMMGR_RESULT_SUCCESS) {
_E("alarmmgr_enum_alarm_ids() failed");
}
if (s_hourly_alert.alarm_id != -1) {
_D("try to delete alarm_id(%d)", s_hourly_alert.alarm_id);
ret = alarmmgr_remove_alarm(s_hourly_alert.alarm_id);
- if(ret != ALARMMGR_RESULT_SUCCESS) {
+ if (ret != ALARMMGR_RESULT_SUCCESS) {
ret = alarmmgr_enum_alarm_ids(_alarm_delete_cb, NULL);
- if(ret != ALARMMGR_RESULT_SUCCESS) {
+ if (ret != ALARMMGR_RESULT_SUCCESS) {
_E("alarmmgr_enum_alarm_ids() failed");
}
}
localtime_r(¤t_time, ¤t_tm);
alarm_info = alarmmgr_create_alarm();
- if(alarm_info == NULL) {
+ if (alarm_info == NULL) {
_E("alarmmgr_create_alarm() is failed\n");
return -1;
}
//alarmmgr_set_repeat_mode(alarm_info, ALARM_REPEAT_MODE_ONCE, 0);
ret = alarmmgr_set_repeat_mode(alarm_info, ALARM_REPEAT_MODE_REPEAT, 60*60);
- if(ret != ALARMMGR_RESULT_SUCCESS) {
+ if (ret != ALARMMGR_RESULT_SUCCESS) {
_E("alarmmgr_set_repeat_mode() failed");
- alarmmgr_free_alarm(alarm_info) ;
+ alarmmgr_free_alarm(alarm_info);
return -1;
}
alarmmgr_set_time(alarm_info, alarm_time);
alarmmgr_set_type(alarm_info, ALARM_TYPE_VOLATILE);
ret = alarmmgr_add_alarm_with_localtime(alarm_info, NULL, &alarm_id);
- if(ret != ALARMMGR_RESULT_SUCCESS) {
+ if (ret != ALARMMGR_RESULT_SUCCESS) {
_E("alarmmgr_add_alarm_with_localtime() failed");
alarmmgr_free_alarm(alarm_info) ;
return -1;
int ret = 0;
ret = alarmmgr_init("starter");
- retv_if(ret<0, -1);
+ retv_if(ret < 0, -1);
ret = alarmmgr_set_cb(_alarm_cb, NULL);
- retv_if(ret<0, -1);
+ retv_if(ret < 0, -1);
s_hourly_alert.alarm_id = -1;
int ret = 0;
ret = vconf_get_bool(VCONFKEY_SETAPPL_HOURLY_ALERT_BOOL, &hourly_alert);
- if (ret < 0){
+ if (ret < 0) {
_E("can't get vconfkey value of [%s], ret=[%d]", VCONFKEY_SETAPPL_HOURLY_ALERT_BOOL, ret);
hourly_alert = 0;
} else if (hourly_alert == 1) {
* limitations under the License.
*/
-#ifdef HAVE_X11
-
-#include <bundle.h>
-#include <Elementary.h>
-#include <Ecore_X.h>
-#include <Ecore_Input.h>
-#include <utilX.h>
-
-#include <dd-display.h>
-#include <feedback.h>
-#include <vconf.h>
-
-#include "hw_key.h"
-#include "util.h"
-#include "status.h"
-#include "dbus_util.h"
-#include "home_mgr.h"
-#include "process_mgr.h"
-
-#define GRAB_TWO_FINGERS 2
-#define POWERKEY_TIMER_SEC 0.25
-#define POWERKEY_LCDOFF_TIMER_SEC 0.4
-#define LONG_PRESS_TIMER_SEC 0.7
-
-#define APP_CONTROL_OPERATION_MAIN_KEY "__APP_SVC_OP_TYPE__"
-#define APP_CONTROL_OPERATION_MAIN_VALUE "http://tizen.org/appcontrol/operation/main"
-
-#define USE_DBUS_POWEROFF 1
-#define W_TASKMGR_PKGNAME "org.tizen.w-taskmanager"
-
-
-
-static struct {
- Ecore_X_Window win;
- Ecore_Event_Handler *key_up;
- Ecore_Event_Handler *key_down;
- Ecore_Event_Handler *two_fingers_hold_hd;
- Ecore_Timer *power_long_press_timer;
- Ecore_Timer *power_release_timer;
- Eina_Bool is_lcd_on;
- Eina_Bool is_long_press;
- int powerkey_count;
- Eina_Bool is_cancel;
-} key_info = {
- .win = 0x0,
- .key_up = NULL,
- .key_down = NULL,
- .two_fingers_hold_hd = NULL,
- .power_long_press_timer = NULL,
- .power_release_timer = NULL,
- .is_lcd_on = EINA_FALSE,
- .is_long_press = EINA_FALSE,
- .powerkey_count = 0,
- .is_cancel = EINA_FALSE,
-};
-
-
-
-static Eina_Bool _powerkey_timer_cb(void *data)
-{
- _W("%s, powerkey count[%d]", __func__, key_info.powerkey_count);
-
- key_info.power_release_timer = NULL;
-
- if (VCONFKEY_PM_KEY_LOCK == status_passive_get()->pm_key_ignore) {
- _E("Critical Low Batt Clock Mode");
- key_info.powerkey_count = 0;
- if(key_info.is_lcd_on) {
- _W("just turn off LCD");
- display_change_state(LCD_OFF);
- } else {
- _W("just turn on LCD by powerkey.. starter ignore powerkey operation");
- }
- return ECORE_CALLBACK_CANCEL;
- }
-
- if (key_info.powerkey_count % 2 == 0) {
- /* double press */
- _W("powerkey double press");
- key_info.powerkey_count = 0;
- return ECORE_CALLBACK_CANCEL;
- }
- key_info.powerkey_count = 0;
-
- if (key_info.is_lcd_on) {
- if(VCONFKEY_PM_STATE_LCDOFF <= status_active_get()->pm_state) {
- _E("Already lcd state was changed while powerkey op. starter ignore powerkey operation");
- return ECORE_CALLBACK_CANCEL;
- }
- } else {
- _W("just turn on LCD by powerkey.. starter ignore powerkey operation");
- return ECORE_CALLBACK_CANCEL;
- }
-
- if (VCONFKEY_CALL_VOICE_ACTIVE == status_passive_get()->call_state) {
- _W("call state is [%d] -> just turn off LCD");
- display_change_state(LCD_OFF);
- return ECORE_CALLBACK_CANCEL;
- }
-
- if (VCONFKEY_IDLE_LOCK == status_passive_get()->idle_lock_state) {
- _W("lock state is [%d] -> just turn off LCD");
- display_change_state(LCD_OFF);
- return ECORE_CALLBACK_CANCEL;
- }
-
- if (0 < status_passive_get()->remote_lock_islocked) {
- _W("remote lock is on top (%d), -> just turn off LCD", status_passive_get()->remote_lock_islocked);
- display_change_state(LCD_OFF);
- return ECORE_CALLBACK_CANCEL;
- }
-
- home_mgr_launch_home();
-
- return ECORE_CALLBACK_CANCEL;
-}
-
-
-static Eina_Bool _long_press_timer_cb(void* data)
-{
- key_info.power_long_press_timer = NULL;
- key_info.is_long_press = EINA_TRUE;
- key_info.powerkey_count = 0;
-
- if (0 < status_passive_get()->remote_lock_islocked){
- _W("remote lock is on top (%d), -> just turn off LCD", status_passive_get()->remote_lock_islocked);
- return ECORE_CALLBACK_CANCEL;
- }
-
- if (key_info.power_release_timer) {
- ecore_timer_del(key_info.power_release_timer);
- key_info.power_release_timer = NULL;
- _D("delete power_release_timer");
- }
-
-#if USE_DBUS_POWEROFF
- dbus_util_send_poweroff_signal();
-#else
- _D("launch power off syspopup");
- process_mgr_syspopup_launch("poweroff-syspopup", NULL, NULL, NULL, NULL);
-#endif
-
- feedback_initialize();
- feedback_play_type(FEEDBACK_TYPE_VIBRATION, FEEDBACK_PATTERN_HOLD);
- feedback_deinitialize();
-
- return ECORE_CALLBACK_CANCEL;
-}
-
-
-static Eina_Bool _key_release_cb(void *data, int type, void *event)
-{
- Evas_Event_Key_Up *ev = event;
-
- retv_if(!ev, ECORE_CALLBACK_RENEW);
- retv_if(!ev->keyname, ECORE_CALLBACK_RENEW);
-
- _D("_key_release_cb : %s Released", ev->keyname);
-
- if (!strcmp(ev->keyname, KEY_POWER)) {
- _W("POWER Key is released");
-
- if(key_info.power_long_press_timer) {
- ecore_timer_del(key_info.power_long_press_timer);
- key_info.power_long_press_timer = NULL;
- _D("delete long press timer");
- }
-
- // Check powerkey timer
- if(key_info.power_release_timer) {
- ecore_timer_del(key_info.power_release_timer);
- key_info.power_release_timer = NULL;
- _D("delete powerkey timer");
- }
-
- // Cancel key operation
- if (EINA_TRUE == key_info.is_cancel) {
- _D("Cancel key is activated");
- key_info.is_cancel = EINA_FALSE;
- key_info.powerkey_count = 0; //initialize powerkey count
- return ECORE_CALLBACK_RENEW;
- }
-
- // Check long press operation
- if(key_info.is_long_press) {
- _D("ignore power key release by long poress");
- key_info.is_long_press = EINA_FALSE;
- return ECORE_CALLBACK_RENEW;
- }
-
- if(key_info.is_lcd_on) {
- key_info.power_release_timer = ecore_timer_add(POWERKEY_TIMER_SEC, _powerkey_timer_cb, NULL);
- } else {
- _D("lcd off --> [%f]sec timer", POWERKEY_LCDOFF_TIMER_SEC);
- key_info.power_release_timer = ecore_timer_add(POWERKEY_LCDOFF_TIMER_SEC, _powerkey_timer_cb, NULL);
- }
- if (!key_info.power_release_timer) {
- _E("Critical, cannot add a timer for powerkey");
- }
- } else if (!strcmp(ev->keyname, KEY_CANCEL)) {
- _D("CANCEL Key is released");
- key_info.is_cancel = EINA_FALSE;
- }
-
- return ECORE_CALLBACK_RENEW;
-}
-
-
-
-static Eina_Bool _key_press_cb(void *data, int type, void *event)
-{
- Evas_Event_Key_Down *ev = event;
-
- retv_if(!ev, ECORE_CALLBACK_RENEW);
- retv_if(!ev->keyname, ECORE_CALLBACK_RENEW);
-
- _D("_key_press_cb : %s Pressed", ev->keyname);
-
- if (!strcmp(ev->keyname, KEY_POWER)) {
- _W("POWER Key is pressed");
-
- /**
- * lcd status
- * 1 : lcd normal
- * 2 : lcd dim
- * 3 : lcd off
- * 4 : suspend
- */
- if (VCONFKEY_PM_STATE_LCDDIM >= status_active_get()->pm_state) {
- key_info.is_lcd_on = EINA_TRUE;
- } else if (VCONFKEY_PM_STATE_LCDOFF <= status_active_get()->pm_state) {
- key_info.is_lcd_on = EINA_FALSE;
- }
-
- key_info.powerkey_count++;
- _W("powerkey count : %d", key_info.powerkey_count);
-
- if(key_info.power_release_timer) {
- ecore_timer_del(key_info.power_release_timer);
- key_info.power_release_timer = NULL;
- }
-
- if (key_info.power_long_press_timer) {
- ecore_timer_del(key_info.power_long_press_timer);
- key_info.power_long_press_timer = NULL;
- }
-
- key_info.is_long_press = EINA_FALSE;
- key_info.power_long_press_timer = ecore_timer_add(LONG_PRESS_TIMER_SEC, _long_press_timer_cb, NULL);
- if(!key_info.power_long_press_timer) {
- _E("Failed to add power_long_press_timer");
- }
- } else if (!strcmp(ev->keyname, KEY_CANCEL)) {
- _D("CANCEL key is pressed");
- key_info.is_cancel = EINA_TRUE;
- }
-
- return ECORE_CALLBACK_RENEW;
-}
-
-
-
-static Eina_Bool _w_gesture_hold_cb(void *data, int ev_type, void *ev)
-{
- Ecore_X_Event_Gesture_Notify_Hold *e = ev;
-
- if (VCONFKEY_PM_KEY_LOCK == status_passive_get()->pm_key_ignore) {
- _E("Critical Low Batt Clock Mode, ignore gesture");
- return ECORE_CALLBACK_RENEW;
- }
-
- if (SETTING_PSMODE_WEARABLE_ENHANCED == status_passive_get()->setappl_psmode) {
- _E("UPS Mode, ignore gesture");
- return ECORE_CALLBACK_RENEW;
- }
-
- if(e->num_fingers == GRAB_TWO_FINGERS) {
- _D("subtype[%d]: hold[%d]\n", e->subtype, e->hold_time);
- if (e->subtype == ECORE_X_GESTURE_BEGIN) {
- _D("Begin : launch task mgr..!!");
- dbus_util_send_cpu_booster_signal();
- process_mgr_must_launch(W_TASKMGR_PKGNAME, APP_CONTROL_OPERATION_MAIN_KEY, APP_CONTROL_OPERATION_MAIN_VALUE, NULL, NULL);
- }
- }
-
- return ECORE_CALLBACK_RENEW;
-}
-
-
-
-void hw_key_create_window(void)
-{
- int status = -1;
- int ret = -1;
-
- _W("hw_key_create_window");
-
- key_info.win = ecore_x_window_input_new(0, 0, 0, 1, 1);
- if (!key_info.win) {
- _E("Failed to create hidden window");
- return;
- }
- ecore_x_event_mask_unset(key_info.win, ECORE_X_EVENT_MASK_NONE);
- ecore_x_icccm_title_set(key_info.win, "w_starter,key,receiver");
- ecore_x_netwm_name_set(key_info.win, "w_starter,key,receiver");
- ecore_x_netwm_pid_set(key_info.win, getpid());
-
- ret = utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_POWER, SHARED_GRAB);
- if (ret != 0) {
- _E("utilx_grab_key KEY_POWER GrabSHARED_GRAB failed, ret[%d]", ret);
- }
-
- key_info.key_up = ecore_event_handler_add(ECORE_EVENT_KEY_UP, _key_release_cb, NULL);
- if (!key_info.key_up) {
- _E("Failed to register a key up event handler");
- }
-
- key_info.key_down = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _key_press_cb, NULL);
- if (!key_info.key_down) {
- _E("Failed to register a key down event handler");
- }
-
- status = ecore_x_gesture_event_grab(key_info.win, ECORE_X_GESTURE_EVENT_HOLD, GRAB_TWO_FINGERS);
- _E("ECORE_X_GESTURE_EVENT_HOLD Grab(%d fingers) status[%d]\n", GRAB_TWO_FINGERS, status);
-
- key_info.two_fingers_hold_hd = ecore_event_handler_add(ECORE_X_EVENT_GESTURE_NOTIFY_HOLD, _w_gesture_hold_cb, NULL);
- if (!key_info.two_fingers_hold_hd) {
- _E("Failed to register handler : ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD\n");
- }
-}
-
-
-
-void hw_key_destroy_window(void)
-{
- int status;
-
- if (key_info.two_fingers_hold_hd) {
- ecore_event_handler_del(key_info.two_fingers_hold_hd);
- key_info.two_fingers_hold_hd = NULL;
- }
-
- status = ecore_x_gesture_event_ungrab(key_info.win, ECORE_X_GESTURE_EVENT_HOLD, GRAB_TWO_FINGERS);
- if (!status) {
- _E("ECORE_X_GESTURE_EVENT_HOLD UnGrab(%d fingers) failed, status[%d]\n", GRAB_TWO_FINGERS, status);
- }
-
- if (key_info.key_up) {
- ecore_event_handler_del(key_info.key_up);
- key_info.key_up = NULL;
- }
-
- if (key_info.key_down) {
- ecore_event_handler_del(key_info.key_down);
- key_info.key_down = NULL;
- }
-
- utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_POWER);
-
- ecore_x_window_delete_request_send(key_info.win);
- key_info.win = 0x0;
-}
-
-#elif HAVE_WAYLAND
-
#include <bundle.h>
#include <Elementary.h>
#include <Ecore_Input.h>
key_info.is_long_press = EINA_TRUE;
key_info.powerkey_count = 0;
- if (0 < status_passive_get()->remote_lock_islocked){
+ if (0 < status_passive_get()->remote_lock_islocked) {
_W("remote lock is on top (%d), -> just turn off LCD", status_passive_get()->remote_lock_islocked);
return ECORE_CALLBACK_CANCEL;
}
is_watch_face_shown = status_passive_get()->homescreen_watch_face_visibility;
_D("Watch face status : %d", is_watch_face_shown);
- switch(op) {
+ switch (op) {
case VCONFKEY_DOUBLE_PRESS_HOME_KEY_NONE:
break;
case VCONFKEY_DOUBLE_PRESS_HOME_KEY_LAST_APP:
if (VCONFKEY_PM_KEY_LOCK == status_passive_get()->pm_key_ignore) {
_E("Critical Low Batt Clock Mode");
key_info.powerkey_count = 0;
- if(key_info.is_lcd_on) {
+ if (key_info.is_lcd_on) {
_W("just turn off LCD");
display_change_state(LCD_OFF);
} else {
key_info.powerkey_count = 0;
if (key_info.is_lcd_on) {
- if(VCONFKEY_PM_STATE_LCDOFF <= status_active_get()->pm_state) {
+ if (VCONFKEY_PM_STATE_LCDOFF <= status_active_get()->pm_state) {
_E("Already lcd state was changed while powerkey op. starter ignore powerkey operation");
return ECORE_CALLBACK_CANCEL;
}
if (!strcmp(ev->keyname, key_name[KEY_POWER])) {
_W("POWER Key is released");
- if(key_info.power_long_press_timer) {
+ if (key_info.power_long_press_timer) {
ecore_timer_del(key_info.power_long_press_timer);
key_info.power_long_press_timer = NULL;
_D("delete long press timer");
}
// Check powerkey timer
- if(key_info.power_release_timer) {
+ if (key_info.power_release_timer) {
ecore_timer_del(key_info.power_release_timer);
key_info.power_release_timer = NULL;
_D("delete powerkey timer");
}
// Check long press operation
- if(key_info.is_long_press) {
+ if (key_info.is_long_press) {
_D("ignore power key release by long poress");
key_info.is_long_press = EINA_FALSE;
return ECORE_CALLBACK_RENEW;
}
- if(key_info.is_lcd_on) {
+ if (key_info.is_lcd_on) {
key_info.power_release_timer = ecore_timer_add(POWERKEY_TIMER_SEC, _powerkey_timer_cb, NULL);
} else {
_D("lcd off --> [%f]sec timer", POWERKEY_LCDOFF_TIMER_SEC);
key_info.powerkey_count++;
_W("powerkey count : %d", key_info.powerkey_count);
- if(key_info.power_release_timer) {
+ if (key_info.power_release_timer) {
ecore_timer_del(key_info.power_release_timer);
key_info.power_release_timer = NULL;
}
key_info.is_long_press = EINA_FALSE;
key_info.power_long_press_timer = ecore_timer_add(LONG_PRESS_TIMER_SEC, _long_press_timer_cb, NULL);
- if(!key_info.power_long_press_timer) {
+ if (!key_info.power_long_press_timer) {
_E("Failed to add power_long_press_timer");
}
}
}
-#endif
-
-
-
// End of a file
static void _signal_handler(int signum, siginfo_t *info, void *unused)
{
- _D("_signal_handler : Terminated...");
- elm_exit();
+ _D("_signal_handler : Terminated...");
+ elm_exit();
}
if (lcd_on) {
_W("LCD on");
s_starter.lcd_status = 1;
- } else if(lcd_off) {
+ } else if (lcd_off) {
_W("LCD off");
s_starter.lcd_status = 0;
} else {
char err_buf[128] = {0,};
int ret = 0;
- memset(&act,0x00,sizeof(struct sigaction));
+ memset(&act, 0x00, sizeof(struct sigaction));
act.sa_sigaction = _signal_handler;
act.sa_flags = SA_SIGINFO;