--- /dev/null
+.gitattributes
+.*swp
+*.log
+*.cmake
+*.install
+*.substvars
+*stamp
+CMakeCache.txt
+CMakeFiles
+debian/tmp
+debian/menu-daemon-dbg
+debian/menu-daemon
+debian/files
+Makefile
+menu-daemon
INCLUDE(FindPkgConfig)
pkg_check_modules(pkgs REQUIRED
- elementary
- heynoti
- elementary
+ ail
aul
- vconf
+ capi-system-media-key
+ db-util
+ dlog
ecore
- evas
ecore-evas
- eet
- x11
- dlog
- db-util
ecore-x
- utilX
ecore-input
ecore-file
- syspopup-caller
- ail
+ eet
eina
+ elementary
+ evas
+ heynoti
+ syspopup-caller
+ utilX
+ vconf
+ x11
)
#!/bin/sh
+echo -e "<2>[${_G}menu-daemon start${C_}]" > /dev/kmsg
/usr/bin/menu-daemon &
sleep 9
#!/bin/sh
+echo -e "<2>[${_G}menu-daemon start${C_}]" > /dev/kmsg
/usr/bin/menu-daemon &
Section: utils
Priority: extra
Maintainer: Jin Yoon <jinny.yoon@samsung.com>, Youngjoo Park <yjoo93.park@samsung.com>
-Build-Depends: debhelper (>= 5), libelm-dev, libslp-setting-dev, libefreet-dev, dlog-dev, libecore-dev, libaul-1-dev, syspopup-caller-dev, libheynoti-dev, libslp-utilx-dev, libail-0-dev
+Build-Depends: debhelper (>= 5), libelm-dev, libslp-setting-dev, libefreet-dev, dlog-dev, libecore-dev, libaul-1-dev, syspopup-caller-dev, libheynoti-dev, libslp-utilx-dev, libail-0-dev, capi-system-media-key-dev
Homepage: N/A
Standards-Version: 0.1.0
Package: menu-daemon
Section: utils
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, libelm, libslp-setting-0, libefreet, libdlog-0, libaul-1, syspopup-caller-0, libheynoti-0, libslp-utilx-0, libail-0
+Depends: ${shlibs:Depends}, ${misc:Depends}, libelm, libslp-setting-0, libefreet, libdlog-0, libaul-1, syspopup-caller-0, libheynoti-0, libslp-utilx-0, libail-0, capi-system-media-key
Description: menu-daemon (Grab H/W key, Package manifest file parsing)
Package: menu-daemon-dbg
vconf_init()
{
- vconftool set -t string memory/menuscreen/desktop "0" -i
- vconftool set -t string db/menuscreen/pkgname "org.tizen.menu-screen" -i -u 5000
+ vconftool set -t string memory/menuscreen/desktop "0" -i -f
+ vconftool set -t int memory/idle-screen/is_idle_screen_launched "0" -i -u 5000 -f
}
vconf_init
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
-CFLAGS += -Wall -Werror -fpie
-CXXFLAGS += -Wall -Werror -fpie
+CFLAGS += -Wall -Werror -fpie -Winline
+CXXFLAGS += -Wall -Werror -fpie -Winline
LDFLAGS ?=
PREFIX ?= /usr
DATADIR ?= /opt
#include <dlog.h>
#define HOME_SCREEN_PKG_NAME "org.tizen.menu-screen"
-#define MENU_PKG_VCONF_KEY "db/menuscreen/pkgname"
+#define MENU_PKG_VCONF_KEY "db/setting/menuscreen/pkgname"
#define CONF_PATH_NUMBER 1024
/* Log */
Group: TO_BE/FILLED_IN
License: Flora Software License
Source0: menu-daemon-%{version}.tar.gz
-BuildRequires: pkgconfig(ail)
-BuildRequires: pkgconfig(aul)
-BuildRequires: pkgconfig(db-util)
-BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(ecore)
-BuildRequires: pkgconfig(ecore-evas)
-BuildRequires: pkgconfig(ecore-file)
-BuildRequires: pkgconfig(ecore-input)
-BuildRequires: pkgconfig(ecore-x)
-BuildRequires: pkgconfig(eet)
-BuildRequires: pkgconfig(eina)
-BuildRequires: pkgconfig(elementary)
-BuildRequires: pkgconfig(evas)
-BuildRequires: pkgconfig(heynoti)
-BuildRequires: pkgconfig(syspopup-caller)
-BuildRequires: pkgconfig(utilX)
-BuildRequires: pkgconfig(vconf)
-BuildRequires: pkgconfig(x11)
+BuildRequires: pkgconfig(ail)
+BuildRequires: pkgconfig(aul)
+BuildRequires: pkgconfig(capi-system-media-key)
+BuildRequires: pkgconfig(db-util)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(ecore)
+BuildRequires: pkgconfig(eet)
+BuildRequires: pkgconfig(eina)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(evas)
+BuildRequires: pkgconfig(heynoti)
+BuildRequires: pkgconfig(syspopup-caller)
+BuildRequires: pkgconfig(utilX)
+BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(x11)
BuildRequires: cmake
BuildRequires: edje-bin
chmod +x %{buildroot}/etc/init.d/menudaemon.fast
%post
-vconftool set -t string memory/menuscreen/desktop "0" -i
-vconftool set -t string db/menuscreen/pkgname "org.tizen.menu-screen" -i -u 5000
+vconftool set -t string memory/menuscreen/desktop "0" -i -f
+vconftool set -t int memory/idle-screen/is_idle_screen_launched "0" -i -u 5000 -f
+
ln -sf /etc/init.d/menudaemon /etc/rc.d/rc3.d/S46menudaemon
ln -sf /etc/init.d/menudaemon.fast /etc/rc.d/rc4.d/S85menudaemon
%files
+%defattr(-,root,root,-)
%{_sysconfdir}/init.d/menudaemon
%{_sysconfdir}/init.d/menudaemon.fast
%{_bindir}/menu-daemon
#include <syspopup_caller.h>
#include <utilX.h>
#include <vconf.h>
+#include <system/media_key.h>
#include "hw_key.h"
#include "util.h"
syspopup_destroy_all();
key_info.single_timer = NULL;
- package = vconf_get_str(MENU_PKG_VCONF_KEY);
+ package = vconf_get_str(VCONFKEY_SETAPPL_SELECTED_PACKAGE_NAME);
if (package) {
int ret;
_E("Default homescreen is not able to launch");
} else {
_E("Package %s is not exists, rollback to default home", package);
+ if (0 != vconf_set_str(VCONFKEY_SETAPPL_SELECTED_PACKAGE_NAME, HOME_SCREEN_PKG_NAME)) {
+ _E("Cannot set value(%s) into key(%s)", VCONFKEY_SETAPPL_SELECTED_PACKAGE_NAME, HOME_SCREEN_PKG_NAME);
+ }
ret = aul_open_app(HOME_SCREEN_PKG_NAME);
if (ret < 0)
_E("Failed to launch default home");
free(package);
} else {
+ if (0 != vconf_set_str(VCONFKEY_SETAPPL_SELECTED_PACKAGE_NAME, HOME_SCREEN_PKG_NAME)) {
+ _E("Cannot set value(%s) into key(%s)", VCONFKEY_SETAPPL_SELECTED_PACKAGE_NAME, HOME_SCREEN_PKG_NAME);
+ }
+
if (aul_open_app(HOME_SCREEN_PKG_NAME) < 0)
_E("Cannot open default home");
}
} else if (!strcmp(ev->keyname, KEY_CAMERA)) {
} else if (!strcmp(ev->keyname, KEY_SEND)) {
} else if (!strcmp(ev->keyname, KEY_SELECT)) {
+ if (EINA_TRUE == key_info.cancel) {
+ _D("Cancel key is activated");
+ if (key_info.long_press) {
+ ecore_timer_del(key_info.long_press);
+ key_info.long_press = NULL;
+ }
+
+ if (key_info.single_timer) {
+ ecore_timer_del(key_info.single_timer);
+ key_info.single_timer = NULL;
+ }
+
+ return ECORE_CALLBACK_RENEW;
+ }
+
_release_home_key();
} else if (!strcmp(ev->keyname, KEY_PAUSE)) {
} else if (!strcmp(ev->keyname, KEY_VOLUMEDOWN)) {
ecore_timer_del(key_info.volume_down_long_press);
key_info.volume_down_long_press = NULL;
}
- if (key_info.cancel == EINA_TRUE) {
- _D("Cancel key is deactivating");
+
+ if (EINA_TRUE == key_info.cancel) {
+ _D("Cancel key is activated");
return ECORE_CALLBACK_RENEW;
}
if (syspopup_launch("volume", NULL) < 0)
_D("Long press : Volume down");
key_info.volume_down_long_press = NULL;
- if (key_info.cancel == EINA_TRUE)
+ if (EINA_TRUE == key_info.cancel)
return ECORE_CALLBACK_CANCEL;
b = bundle_create();
+void _media_key_event_cb(media_key_e key, media_key_event_e status, void *user_data)
+{
+ _D("MEDIA KEY EVENT");
+ if (MEDIA_KEY_STATUS_PRESSED == status) return;
+
+ if (MEDIA_KEY_PAUSE == key) {
+ _release_multimedia_key("KEY_PAUSECD");
+ } else if (MEDIA_KEY_PLAY == key) {
+ _release_multimedia_key("KEY_PLAYCD");
+ }
+}
+
+
+
void create_key_window(void)
{
key_info.win = ecore_x_window_input_new(0, 0, 0, 1, 1);
key_info.key_down = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _key_press_cb, NULL);
if (!key_info.key_down)
_D("Failed to register a key down event handler");
+
+ media_key_reserve(_media_key_event_cb, NULL);
}
key_info.key_down = NULL;
}
- ecore_x_window_delete_request_send(key_info.win);
+ ecore_x_window_delete_request_send(key_info.win);
key_info.win = 0x0;
+
+ media_key_release();
}
#include <aul.h>
#include <db-util.h>
#include <Elementary.h>
+#include <fcntl.h>
#include <heynoti.h>
#include <stdio.h>
#include <sys/types.h>
#define QUERY_UPDATE_NAME "UPDATE app_info SET name='%s' where package='%s';"
#define SAT_DESKTOP_FILE "/opt/share/applications/org.tizen.sat-ui.desktop"
+#define HIBERNATION_DIR "/tmp/hibernation"
+#define HIBERNATION_READY "/tmp/hibernation/menuscreen_ready"
static struct info {
pid_t pid;
+ int power_off;
} s_info = {
.pid = -1,
+ .power_off = 0,
};
-static inline char *_get_pkgname(keynode_t *node)
+static inline char *_get_selected_pkgname(void)
{
char *pkgname;
- if (node)
- pkgname = vconf_keynode_get_str(node);
- else
- pkgname = vconf_get_str(MENU_PKG_VCONF_KEY);
-
+ pkgname = vconf_get_str(VCONFKEY_SETAPPL_SELECTED_PACKAGE_NAME);
if (!pkgname) {
_E("Cannot get pkgname from vconf.");
+
+ if (0 != vconf_set_str(VCONFKEY_SETAPPL_SELECTED_PACKAGE_NAME, HOME_SCREEN_PKG_NAME)) {
+ _E("Cannot set value(%s) into key(%s)", VCONFKEY_SETAPPL_SELECTED_PACKAGE_NAME, HOME_SCREEN_PKG_NAME);
+ }
+
pkgname = strdup(HOME_SCREEN_PKG_NAME);
- if (!pkgname)
+ if (!pkgname) {
_E("strdup error for pkgname, %s", strerror(errno));
+ return NULL;
+ }
}
return pkgname;
ret = aul_open_app(homescreen);
_D("can%s launch %s now. (%d)", ret < 0 ? "not" : "", homescreen, ret);
if (ret < 0 && strcmp(homescreen, HOME_SCREEN_PKG_NAME)) {
+ if (0 != vconf_set_str(VCONFKEY_SETAPPL_SELECTED_PACKAGE_NAME, HOME_SCREEN_PKG_NAME)) {
+ _E("Cannot set value(%s) into key(%s)", VCONFKEY_SETAPPL_SELECTED_PACKAGE_NAME, HOME_SCREEN_PKG_NAME);
+ }
+
ret = aul_open_app(HOME_SCREEN_PKG_NAME);
if (ret < 0) {
_E("Failed to open a default home, %s", HOME_SCREEN_PKG_NAME);
_D("[MENU_DAEMON] _show_cb is invoked");
- pkgname = _get_pkgname(NULL);
+ pkgname = _get_selected_pkgname();
if (!pkgname)
return;
if (node) {
seq = vconf_keynode_get_int(node);
} else {
- if (vconf_get_int("memory/startapps/sequence", &seq) < 0) {
+ if (vconf_get_int(VCONFKEY_STARTER_SEQUENCE, &seq) < 0) {
_E("Failed to get sequence info");
free(pkgname);
return;
char *pkgname;
int seq;
- if (vconf_get_int("memory/startapps/sequence", &seq) < 0) {
+ if (vconf_get_int(VCONFKEY_STARTER_SEQUENCE, &seq) < 0) {
_E("Do nothing, there is no sequence info yet");
return;
}
_D("_pkg_changed is invoked");
- pkgname = _get_pkgname(node);
+ pkgname = _get_selected_pkgname();
if (!pkgname)
return;
{
char *pkgname;
- _D("Process %d is termianted", pid);
- if (pid != s_info.pid || s_info.pid <= 0) {
- _D("Unknown process, ignore it (pid %d, menu pid %d)", pid, s_info.pid);
+ if (s_info.power_off) {
+ _D("Power off. ignore dead cb\n");
return 0;
}
- pkgname = _get_pkgname(NULL);
+ _D("Process %d is termianted", pid);
+
+ if (pid < 0)
+ return 0;
+
+ pkgname = _get_selected_pkgname();
if (!pkgname)
return 0;
if (unlink(SAT_DESKTOP_FILE) != 0)
_E("cannot remove sat-ui desktop.");
- if (vconf_notify_key_changed(MENU_PKG_VCONF_KEY, _pkg_changed, NULL) < 0)
+ if (vconf_notify_key_changed(VCONFKEY_SETAPPL_SELECTED_PACKAGE_NAME, _pkg_changed, NULL) < 0)
_E("Failed to add callback for package change event");
- if (vconf_notify_key_changed("memory/startapps/sequence", _show_cb, NULL) < 0)
+ if (vconf_notify_key_changed(VCONFKEY_STARTER_SEQUENCE, _show_cb, NULL) < 0)
_E("Failed to add callback for show event");
_pkg_changed(NULL, NULL);
// THIS ROUTINE IS FOR SAT.
- vconf_set_int("memory/menu-screen/is_menu_screen_done", 1);
+ vconf_set_int(VCONFKEY_IDLE_SCREEN_LAUNCHED, VCONFKEY_IDLE_SCREEN_LAUNCHED_TRUE);
+}
+
+
+
+static void power_off_cb(void *data)
+{
+ _D("heynoti power off\n");
+ s_info.power_off = 1;
}
{
FILE *fp;
int fd;
+ int ret;
elm_init(argc, argv);
+
fd = heynoti_init();
+ if (fd < 0)
+ fprintf(stderr, "heynoti_init\n");
+
+ ret = heynoti_subscribe(fd, "power_off_start", power_off_cb, NULL);
+ if (ret < 0)
+ fprintf(stderr, "heynoti_subscribe\n");
- system("/usr/bin/ail_initdb");
+ ret = system("/usr/bin/ail_initdb");
+ if (-1 == ret)
+ _D("Cannot execute ail_initdb");
fp = fopen("/opt/etc/.hib_capturing", "r");
if (!fp) {
fprintf(stderr,"Heynoti subscribe is failed\n");
} else {
fprintf(stderr,"Heynoti subscribe is done\n");
- }
-
- if (heynoti_attach_handler(fd)) {
- fprintf(stderr,"Heynoti attach handler is failed\n");
- } else {
- fprintf(stderr,"Heynoti attach handler is done\n");
- if (vconf_set_int("memory/hibernation/menuscreen_ready", 1)) {
- fprintf(stderr, "[MENU_DAEMON]vconf_set_int FAIL\n");
- } else {
- fprintf(stderr, "[MENU_DAEMON]vconf_set_int OK\n");
+ int fd;
+ if (mkdir(HIBERNATION_DIR, 0777) != -1)
+ _D("Make a directory - [%s]", HIBERNATION_DIR);
+
+ fd = creat(HIBERNATION_READY, 0644);
+ if (fd != -1) {
+ _D("Create a file for hibernation_ready");
+ close(fd);
}
}
+
}
fclose(fp);
}
+ if (heynoti_attach_handler(fd))
+ fprintf(stderr,"Heynoti attach handler is failed\n");
+ else
+ fprintf(stderr,"Heynoti attach handler is done\n");
+
elm_run();
destroy_key_window();
elm_exit();