summaryrefslogtreecommitdiff
path: root/am_daemon
diff options
context:
space:
mode:
Diffstat (limited to 'am_daemon')
-rwxr-xr-xam_daemon/amd_appinfo.c2
-rwxr-xr-xam_daemon/amd_key.c205
-rwxr-xr-xam_daemon/amd_key.h30
-rwxr-xr-xam_daemon/amd_main.c38
-rwxr-xr-xam_daemon/amd_request.c9
-rwxr-xr-xam_daemon/amd_status.c19
6 files changed, 14 insertions, 289 deletions
diff --git a/am_daemon/amd_appinfo.c b/am_daemon/amd_appinfo.c
index 0c520b8f..33ba9936 100755
--- a/am_daemon/amd_appinfo.c
+++ b/am_daemon/amd_appinfo.c
@@ -86,8 +86,8 @@ static void _fini(struct appinfomgr *cf)
static int __app_info_insert_handler (const pkgmgrinfo_appinfo_h handle, void *data)
{
struct appinfo *c;
- struct appinfomgr *cf = (struct appinfomgr *)data;
gboolean r;
+ struct appinfomgr *cf = (struct appinfomgr *)data;
char *exec;
char *type;
char *appid;
diff --git a/am_daemon/amd_key.c b/am_daemon/amd_key.c
deleted file mode 100755
index 47258894..00000000
--- a/am_daemon/amd_key.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * aul
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
- *
- * 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 <Ecore.h>
-#include <Evas.h>
-#include <Ecore_Input.h>
-#ifdef X11
-#include <Ecore_X.h>
-#include <utilX.h>
-#endif
-#ifdef WAYLAND
-#include <Ecore_Wayland.h>
-#endif
-#include <aul.h>
-#include <glib.h>
-
-#include "amd_config.h"
-#include "simple_util.h"
-#include "app_sock.h"
-#include "launch.h"
-
-static struct {
- Evas_Object *win;
- Ecore_Event_Handler *key_up;
- Ecore_Event_Handler *key_down;
-} key_info = {
- .win = NULL,
- .key_up = NULL,
- .key_down = NULL,
-};
-
-GSList *key_pid_list = NULL;
-
-static Eina_Bool __key_release_cb(void *data, int type, void *event);
-static Eina_Bool __key_press_cb(void *data, int type, void *event);
-
-static Eina_Bool __key_release_cb(void *data, int type, void *event)
-{
- Evas_Event_Key_Up *ev = event;
- int ret;
- GSList *entry;
- int *pid_data;
- bundle *kb;
-
- _D("Released");
-
- if (!ev) {
- _D("Invalid event object");
- return ECORE_CALLBACK_RENEW;
- }
-
- entry = key_pid_list;
- if (entry && entry->data) {
- pid_data = (int *) entry->data;
-
- kb = bundle_create();
- bundle_add(kb, AUL_K_MULTI_KEY, ev->keyname);
- bundle_add(kb, AUL_K_MULTI_KEY_EVENT, AUL_V_KEY_RELEASED);
-
- ret = app_send_cmd(*pid_data, APP_KEY_EVENT, kb);
- if (ret < 0)
- _E("app_send_cmd failed with error %d\n", ret);
-
- bundle_free(kb);
- }
-
- return ECORE_CALLBACK_RENEW;
-}
-
-
-static Eina_Bool __key_press_cb(void *data, int type, void *event)
-{
- Evas_Event_Key_Down *ev = event;
- int ret;
- GSList *entry;
- int *pid_data;
- bundle *kb;
-
- _D("Pressed");
-
- if (!ev) {
- _D("Invalid event object");
- return ECORE_CALLBACK_RENEW;
- }
-
- entry = key_pid_list;
- if (entry && entry->data) {
- pid_data = (int *) entry->data;
-
- kb = bundle_create();
- bundle_add(kb, AUL_K_MULTI_KEY, ev->keyname);
- bundle_add(kb, AUL_K_MULTI_KEY_EVENT, AUL_V_KEY_PRESSED);
-
- ret = app_send_cmd(*pid_data, APP_KEY_EVENT, kb);
- if (ret < 0)
- _E("app_send_cmd failed with error %d\n", ret);
-
- bundle_free(kb);
- }
-
- return ECORE_CALLBACK_RENEW;
-}
-
-int _register_key_event(int pid)
-{
- int *pid_data;
- GSList *entry;
-
- pid_data = malloc(sizeof(int));
- *pid_data = pid;
-
- key_pid_list = g_slist_prepend(key_pid_list, pid_data);
-
- _D("===key stack===");
-
- for (entry = key_pid_list; entry; entry = entry->next) {
- if (entry->data) {
- pid_data = (int *) entry->data;
- _D("pid : %d",*pid_data);
- }
- }
-
- return 0;
-}
-
-int _unregister_key_event(int pid)
-{
- GSList *entry;
- int *pid_data;
-
- for (entry = key_pid_list; entry;) {
- if (entry->data) {
- pid_data = (int *) entry->data;
- entry = entry->next;
- if(pid == *pid_data) {
- key_pid_list = g_slist_remove(key_pid_list, pid_data);
- free(pid_data);
- }
- }
- }
-
- _D("===key stack===");
-
- for (entry = key_pid_list; entry; entry = entry->next) {
- if (entry->data) {
- pid_data = (int *) entry->data;
- _D("pid : %d",*pid_data);
- }
- }
-
- return 0;
-}
-
-int _key_init()
-{
-#ifdef X11
- key_info.win = ecore_x_window_input_new(0, 0, 0, 1, 1);
- if (!key_info.win) {
- _D("Failed to create hidden window");
- }
-
- ecore_x_icccm_title_set(key_info.win, "acdaemon,key,receiver");
- ecore_x_netwm_name_set(key_info.win, "acdaemon,key,receiver");
- ecore_x_netwm_pid_set(key_info.win, getpid());
-
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_PLAYCD, EXCLUSIVE_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_STOPCD, EXCLUSIVE_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_PAUSECD, EXCLUSIVE_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_NEXTSONG, EXCLUSIVE_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_PREVIOUSSONG, EXCLUSIVE_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_REWIND, EXCLUSIVE_GRAB);
- utilx_grab_key(ecore_x_display_get(), key_info.win, KEY_FASTFORWARD, EXCLUSIVE_GRAB);
-
- key_info.key_up = ecore_event_handler_add(ECORE_EVENT_KEY_UP, __key_release_cb, NULL);
- if (!key_info.key_up) {
- _D("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) {
- _D("Failed to register a key down event handler");
- }
-#endif // X11
-
- return 0;
-}
-
diff --git a/am_daemon/amd_key.h b/am_daemon/amd_key.h
deleted file mode 100755
index bcf8d2eb..00000000
--- a/am_daemon/amd_key.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * aul
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
- *
- * 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.
- *
- */
-
-#ifndef __AUL_AMD_KEY_H_
-#define __AUL_AMD_KEY_H_
-
-int _key_init(void);
-int _register_key_event(int pid);
-int _unregister_key_event(int pid);
-
-#endif
-
diff --git a/am_daemon/amd_main.c b/am_daemon/amd_main.c
index 9dc4aed3..a1634da2 100755
--- a/am_daemon/amd_main.c
+++ b/am_daemon/amd_main.c
@@ -24,28 +24,18 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
-#include <Ecore.h>
-#include <Ecore_Input.h>
-#include <Evas.h>
-#ifdef X11
-#include <Ecore_X.h>
-#include <utilX.h>
-#endif
-#ifdef WAYLAND
-#include <Ecore_Wayland.h>
-#endif
#include <aul.h>
#include <vconf.h>
#include <app-checker-server.h>
#include <ail.h>
#include <glib.h>
+#include <stdlib.h>
#include "amd_config.h"
#include "simple_util.h"
#include "aul_util.h"
#include "amd_appinfo.h"
#include "amd_cgutil.h"
-#include "amd_key.h"
#include "amd_status.h"
#include "amd_launch.h"
#include "amd_request.h"
@@ -229,7 +219,6 @@ int __app_dead_handler(int pid, uid_t user)
// this function was called in single user mode as a callback to aul_listen_app_dead_signal
// but in multiuser mode, AMD daemon can't listen any more on DBUS system to catch those events
// AMD Agents must connect to AMD Daemon to signal a dead process
- _unregister_key_event(pid);
__remove_item_running_list(pid, user);
_status_remove_app_info_list(pid, user);
return 0;
@@ -263,27 +252,12 @@ static int __init()
int ret=0;
- ecore_init();
- evas_init();
- ecore_event_init();
-#ifdef X11
- ret = ecore_x_init(NULL);
- _D("ecore_x_init initialized %d times\n", ret);
-#endif
-#ifdef WAYLAND
- ecore_wl_init(NULL);
-#endif
-
appinfo_init(&amd.af);
cgutil_create(MOUNT_PATH, AGENT_PATH, &amd.cg);
_requset_init(&amd);
_launch_init(&amd);
_status_init(&amd);
-#ifndef __emul__
- if (ret > 0)
- _key_init();
-#endif
if (vconf_notify_key_changed(VCONFKEY_SETAPPL_DEVOPTION_BGPROCESS, __vconf_cb, NULL) != 0)
_E("Unable to register callback for VCONFKEY_SETAPPL_DEVOPTION_BGPROCESS\n");
@@ -295,7 +269,6 @@ static int __init()
gboolean __amd_ready(gpointer user_data)
{
int fd;
- int ret;
fd = creat("/run/amd_ready", S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
@@ -311,6 +284,8 @@ gboolean __amd_ready(gpointer user_data)
int main(int argc, char *argv[])
{
+ GMainLoop *mainloop = NULL;
+
if (ac_server_initialize() != AC_R_OK){
_E("ac_server_initialize failed!\n");
return -1;
@@ -322,7 +297,12 @@ int main(int argc, char *argv[])
g_idle_add(__amd_ready, NULL);
- ecore_main_loop_begin();
+ mainloop = g_main_loop_new(NULL, FALSE);
+ if (!mainloop) {
+ _E("failed to create glib main loop");
+ return -1;
+ }
+ g_main_loop_run(mainloop);
return 0;
}
diff --git a/am_daemon/amd_request.c b/am_daemon/amd_request.c
index fc8a21b1..cb39faf6 100755
--- a/am_daemon/amd_request.c
+++ b/am_daemon/amd_request.c
@@ -38,7 +38,6 @@
#include "app_sock.h"
#include "aul_util.h"
#include "amd_request.h"
-#include "amd_key.h"
#include "amd_launch.h"
#include "amd_appinfo.h"
#include "amd_cgutil.h"
@@ -402,12 +401,12 @@ static gboolean __request_handler(gpointer data)
_D("APP_GET_APPID_BYPID : %d : %d", pid, ret);
break;
case APP_KEY_RESERVE:
- ret = _register_key_event(cr.pid);
- __send_result_to_client(clifd, ret);
+ // support for key events has been removed (sdx-20140813)
+ __send_result_to_client(clifd, 0);
break;
case APP_KEY_RELEASE:
- ret = _unregister_key_event(cr.pid);
- __send_result_to_client(clifd, ret);
+ // support for key events has been removed (sdx-20140813)
+ __send_result_to_client(clifd, 0);
break;
case APP_STATUS_UPDATE:
status = (int *)pkt->data;
diff --git a/am_daemon/amd_status.c b/am_daemon/amd_status.c
index ce965802..05d83901 100755
--- a/am_daemon/amd_status.c
+++ b/am_daemon/amd_status.c
@@ -24,7 +24,6 @@
#include <glib.h>
#include <aul.h>
#include <string.h>
-#include <Ecore.h>
#include "amd_config.h"
#include "amd_status.h"
@@ -77,20 +76,6 @@ int _status_add_app_info_list(char *appid, char *app_path, int pid, int pad_pid,
return 0;
}
-static Eina_Bool __app_terminate_timer_cb(void *data)
-{
- int pid = (int)data;
- int ret = 0;
-
- _D("pid(%d)", pid);
-
- ret = kill(pid, SIGKILL);
- if (ret == -1)
- _D("send SIGKILL: %s", strerror(errno));
-
- return ECORE_CALLBACK_CANCEL;
-}
-
int _status_update_app_info_list(int pid, int status, uid_t uid)
{
GSList *iter = NULL;
@@ -101,10 +86,6 @@ int _status_update_app_info_list(int pid, int status, uid_t uid)
info_t = (app_status_info_t *)iter->data;
if((pid == info_t->pid) && ((info_t->user == uid) || (info_t->user == 0))) {
info_t->status = status;
- if(status == STATUS_DYING) {
- if(info_t->pad_pid != DEBUG_LAUNCHPAD_PID)
- ecore_timer_add(2, __app_terminate_timer_cb, info_t->pid);
- }
break;
}
}