diff options
author | Stephane Desneux <stephane.desneux@open.eurogiciel.org> | 2014-07-22 19:31:49 +0200 |
---|---|---|
committer | Stephane Desneux <stephane.desneux@open.eurogiciel.org> | 2014-08-13 15:27:47 +0200 |
commit | d88504c461aa9eca05d171611ec97a03226acbe6 (patch) | |
tree | 5350f10dc166329867acc2700e676f7e49358922 | |
parent | 33faaaa1d1d72ed982c1c2454457858a24bea405 (diff) | |
download | aul-1-d88504c461aa9eca05d171611ec97a03226acbe6.tar.gz aul-1-d88504c461aa9eca05d171611ec97a03226acbe6.tar.bz2 aul-1-d88504c461aa9eca05d171611ec97a03226acbe6.zip |
Remove Wayland,X11 and EFL dependencies
ecore_main_loop calls were replaced by g_main_loop calls
Change-Id: I76ad2615aa66eb9c1af3e482f528aebb45708401
Bug-Tizen: BTY-3
Signed-off-by: Stephane Desneux <stephane.desneux@open.eurogiciel.org>
-rw-r--r-- | CMakeLists.txt | 16 | ||||
-rwxr-xr-x | am_daemon/amd_appinfo.c | 2 | ||||
-rwxr-xr-x | am_daemon/amd_key.c | 205 | ||||
-rwxr-xr-x | am_daemon/amd_key.h | 30 | ||||
-rwxr-xr-x | am_daemon/amd_main.c | 38 | ||||
-rwxr-xr-x | am_daemon/amd_request.c | 9 | ||||
-rwxr-xr-x | am_daemon/amd_status.c | 19 | ||||
-rw-r--r-- | am_session_agent/agent.c | 43 | ||||
-rwxr-xr-x | include/SLP_AUL_PG.h | 5 | ||||
-rwxr-xr-x | include/aul.h | 11 | ||||
-rwxr-xr-x | include/menu_db_util.h | 9 | ||||
-rw-r--r-- | packaging/aul.spec | 19 | ||||
-rwxr-xr-x | src/app_sock.c | 8 | ||||
-rw-r--r-- | src/key.c | 3 | ||||
-rwxr-xr-x | src/launch.c | 5 | ||||
-rwxr-xr-x | src/simple_util.c | 3 | ||||
-rwxr-xr-x | test/app_test.c | 43 | ||||
-rwxr-xr-x | test/aul_test.c | 56 | ||||
-rwxr-xr-x | test/launch_app.c | 26 | ||||
-rwxr-xr-x | test/open_app.c | 24 |
20 files changed, 120 insertions, 454 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 22e73a72..689a1815 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,15 +19,8 @@ MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") # Set required packages INCLUDE(FindPkgConfig) -SET(AUL-1_PKG_CHECK_MODULES dlog ecore libprivilege-control app-checker rua glib-2.0 ecore-input evas vconf pkgmgr-info privacy-manager-client) -OPTION(WITH_WAYLAND "Build with wayland" OFF) -IF(WITH_WAYLAND) - ADD_DEFINITIONS("-DWAYLAND") - pkg_check_modules(pkgs REQUIRED ${AUL-1_PKG_CHECK_MODULES} ecore-wayland) -ELSE(WITH_WAYLAND) - ADD_DEFINITIONS("-DX11") - pkg_check_modules(pkgs REQUIRED ${AUL-1_PKG_CHECK_MODULES} x11 ecore-x) -ENDIF(WITH_WAYLAND) +SET(AUL-1_PKG_CHECK_MODULES dlog libprivilege-control app-checker rua glib-2.0 vconf pkgmgr-info privacy-manager-client) +pkg_check_modules(pkgs REQUIRED ${AUL-1_PKG_CHECK_MODULES} ) pkg_check_modules(libpkgs REQUIRED dlog bundle dbus-glib-1 ail xdgmime app-checker libtzplatform-config) PKG_CHECK_MODULES(PKGS REQUIRED glib-2.0 gio-2.0 dlog bundle) @@ -113,7 +106,6 @@ set_target_properties(${AM_SESSION_AGENT_NAME} add_executable(amd am_daemon/amd_main.c - am_daemon/amd_key.c am_daemon/amd_request.c am_daemon/amd_appinfo.c am_daemon/amd_cgutil.c @@ -121,11 +113,7 @@ add_executable(amd am_daemon/amd_status.c ) SET(AUL-1_LINK_LIBRARY amd aul_mods app-checker-server rua glib-2.0 bundle ail aul) -IF (WITH_WAYLAND) target_link_libraries(${AUL-1_LINK_LIBRARY} ${pkgs_LDFLAGS}) -ELSE(WITH_WAYLAND) -target_link_libraries(${AUL-1_LINK_LIBRARY} utilX ${pkgs_LDFLAGS}) -ENDIF(WITH_WAYLAND) SET(REL_AGENT daemon-manager-release-agent) ADD_EXECUTABLE(${REL_AGENT} agent/${REL_AGENT}.c) 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; } } diff --git a/am_session_agent/agent.c b/am_session_agent/agent.c index 58c88bc9..1d1efd0e 100644 --- a/am_session_agent/agent.c +++ b/am_session_agent/agent.c @@ -23,7 +23,6 @@ /* * AMD user session agent */ - #include <stdio.h> #include <string.h> #include <dlfcn.h> @@ -77,8 +76,6 @@ _static_ void __real_launch(const char *app_path, bundle * kb); _static_ int __parser(const char *arg, char *out, int out_size); _static_ void __modify_bundle(bundle * kb, int caller_pid, app_info_from_db * menu_info, int cmd); -_static_ int __child_raise_win_by_x(int pid, void *priv); -_static_ int __raise_win_by_x(int pid); _static_ int __send_to_sigkill(int pid); _static_ int __term_app(int pid); _static_ int __resume_app(int pid); @@ -108,7 +105,6 @@ _static_ void __set_oom() _static_ void __set_env(app_info_from_db * menu_info, bundle * kb) { const char *str; - const char **str_array; setenv("PKG_NAME", _get_pkgname(menu_info), 1); @@ -375,34 +371,6 @@ _static_ void __modify_bundle(bundle * kb, int caller_pid, } } -_static_ int __child_raise_win_by_x(int pid, void *priv) -{ -#ifdef X11 - return x_util_raise_win(pid); -#else - return 0; -#endif -} - -_static_ int __raise_win_by_x(int pid) -{ - int pgid; - if (x_util_raise_win(pid) == 0) - return 0; - - /* support app launched by shell script*/ - pgid = getpgid(pid); - _D("X raise failed. try to find first child & raise it - c:%d p:%d\n", - pgid, pid); - - if (pgid <= 1) - return -1; - if (__proc_iter_pgid(pgid, __child_raise_win_by_x, NULL) < 0) - return -1; - - return 0; -} - _static_ int __send_to_sigkill(int pid) { int pgid; @@ -441,16 +409,6 @@ _static_ int __resume_app(int pid) sizeof(int))) < 0) { if (ret == -EAGAIN) _E("resume packet timeout error"); - else { - _D("resume packet send error - use raise win"); - if (__raise_win_by_x(pid) < 0) { - _E("raise failed - %d resume fail\n", pid); - _E("we will term the app - %d\n", pid); - __send_to_sigkill(pid); - ret = -1; - } else - ret = 0; - } } _D("resume done\n"); return ret; @@ -486,7 +444,6 @@ static int __get_caller_uid(bundle *kb) if (uid_str == NULL) return -1; -end: uid = atoi(uid_str); if (uid <0) return -1; diff --git a/include/SLP_AUL_PG.h b/include/SLP_AUL_PG.h index 60fe4081..3856d50c 100755 --- a/include/SLP_AUL_PG.h +++ b/include/SLP_AUL_PG.h @@ -211,7 +211,6 @@ int main(int argc, char *argv[]) // Callee application #include <aul.h> #include <bundle.h> -#include <Ecore.h> static int aul_handler(aul_type type, bundle *kb,void* data) { @@ -234,13 +233,11 @@ static int aul_handler(aul_type type, bundle *kb,void* data) int main(int argc, char** argv) { - ecore_init(); - aul_launch_init(aul_handler,NULL); // enable this if you want to handle at aul_handler when launch aul_launch_argv_handler(argc, argv); - ecore_main_loop_begin(); // You must need ecore or glib mainloop + ecore_main_loop_begin(); // You must need ecore or glib mainloop return 0; } @endcode diff --git a/include/aul.h b/include/aul.h index 1274dec0..cc417a90 100755 --- a/include/aul.h +++ b/include/aul.h @@ -235,10 +235,10 @@ typedef int (*aul_handler_fn) (aul_type type, bundle * b, void *data); * @retval AUL_R_OK - success * @retval AUL_R_ECANCELD - aul handler was installed already by others * @retval AUL_R_ECOMM - error to create internal ipc - * @retval AUL_R_ERROR - error to attach glib main loop or ecore main loop + * @retval AUL_R_ERROR - error to attach glib main loop * * @warning If you use AppCore, you should NOT use this API.\n - * You need glib main loop or ecore main loop.\n + * You need glib main loop.\n * @pre * you must have aul handler to use this API. * aul_luanch_init register aul handler. @@ -267,12 +267,15 @@ typedef int (*aul_handler_fn) (aul_type type, bundle * b, void *data); * return 0; * } * + * static GMainLoop *mainloop = NULL; + * * int main(int argc, char **argv) * { - * ecore_init(); * aul_launch_init(aul_handler,NULL); * aul_launch_argv_handler(argc, argv); - * ecore_main_loop_begin(); + * + * mainloop = g_main_loop_new(NULL, FALSE); + * g_main_loop_run(mainloop); * } * * @endcode diff --git a/include/menu_db_util.h b/include/menu_db_util.h index 954c2792..064476bb 100755 --- a/include/menu_db_util.h +++ b/include/menu_db_util.h @@ -23,6 +23,7 @@ #include <ail.h> #include <string.h> #include <stdio.h> +#include <stdlib.h> #include "simple_util.h" #define MAX_PATH_LEN 1024 @@ -136,7 +137,7 @@ static inline app_info_from_db *_get_app_info_from_db_by_pkgname( else ret = ail_appinfo_get_str(handle, AIL_PROP_PACKAGE_STR, &str); if (str) { - menu_info->pkg_name = strdup(str); + menu_info->pkg_name = strdup(str); str = NULL; } //is_admin is global @@ -161,7 +162,7 @@ static inline app_info_from_db *_get_app_info_from_db_by_pkgname( menu_info->pkg_type = strdup(str); str = NULL; } - + ret = ail_destroy_appinfo(handle); if (ret != AIL_ERROR_OK) { _E("ail_destroy_appinfo failed"); @@ -203,7 +204,7 @@ static inline app_info_from_db *_get_app_info_from_db_by_apppath( ail_filter_h filter; ail_error_e ret; int count; - + if (apppath == NULL) return NULL; @@ -250,6 +251,6 @@ static inline app_info_from_db *_get_app_info_from_db_by_apppath( menu_info->original_app_path = strdup(apppath); return menu_info; - + } diff --git a/packaging/aul.spec b/packaging/aul.spec index f3264a8f..ae9b46ad 100644 --- a/packaging/aul.spec +++ b/packaging/aul.spec @@ -1,5 +1,3 @@ -%bcond_with wayland -%bcond_with x Name: aul Summary: App utility library Version: 0.0.300 @@ -21,7 +19,6 @@ Requires(preun): /usr/bin/systemctl BuildRequires: cmake BuildRequires: pkgconfig(dbus-glib-1) BuildRequires: pkgconfig(sqlite3) -BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(bundle) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(ail) @@ -30,15 +27,6 @@ BuildRequires: pkgconfig(libprivilege-control) BuildRequires: pkgconfig(app-checker) BuildRequires: pkgconfig(app-checker-server) BuildRequires: pkgconfig(rua) -%if %{with wayland} -BuildRequires: pkgconfig(ecore-wayland) -%endif -%if %{with x} -BuildRequires: pkgconfig(ecore-x) -BuildRequires: pkgconfig(x11) -BuildRequires: pkgconfig(utilX) -%endif -BuildRequires: pkgconfig(ecore-input) BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(pkgmgr-info) BuildRequires: libattr-devel @@ -67,12 +55,7 @@ cp %{SOURCE1001} . CFLAGS="%{optflags} -D__emul__"; export CFLAGS %endif -%cmake . \ -%if %{with wayland} - -DWITH_WAYLAND=On \ -%else - -DWITH_WAYLAND=Off \ -%endif +%cmake . make %{?jobs:-j%jobs} diff --git a/src/app_sock.c b/src/app_sock.c index fb712618..84b6f4f9 100755 --- a/src/app_sock.c +++ b/src/app_sock.c @@ -146,7 +146,6 @@ int __create_server_sock(int pid) int __create_server_sock_by_path(char *path) { struct sockaddr_un saddr; - struct sockaddr_un p_saddr; int fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0); /* support above version 2.6.27*/ if (fd < 0) { @@ -200,7 +199,7 @@ int __create_agent_client_sock(int uid) int retry = 1; int ret = -1; - fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0); + fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0); /* support above version 2.6.27*/ if (fd < 0) { if (errno == EINVAL) { @@ -246,7 +245,7 @@ int __create_client_sock(int pid) int retry = 1; int ret = -1; - fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0); + fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0); /* support above version 2.6.27*/ if (fd < 0) { if (errno == EINVAL) { @@ -301,7 +300,7 @@ static int __connect_client_sock(int fd, const struct sockaddr *saptr, socklen_t error = 0; if ((ret = connect(fd, (struct sockaddr *)saptr, salen)) < 0) { if (errno != EAGAIN && errno != EINPROGRESS) { - fcntl(fd, F_SETFL, flags); + fcntl(fd, F_SETFL, flags); return (-2); } } @@ -676,7 +675,6 @@ int __app_send_raw_with_delay_reply(int pid, int cmd, unsigned char *kb_data, in int fd; int len; int ret; - int res = 0; app_pkt_t *pkt = NULL; if (kb_data == NULL || datalen > AUL_SOCK_MAXBUFF - 8) { @@ -23,9 +23,6 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> -#ifdef X11 -#include <utilX.h> -#endif #include <glib.h> #include <poll.h> #include <bundle.h> diff --git a/src/launch.c b/src/launch.c index b3c7bb36..1e7a9251 100755 --- a/src/launch.c +++ b/src/launch.c @@ -22,6 +22,7 @@ #include <sys/types.h> #include <sys/stat.h> +#include <sys/time.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> @@ -373,7 +374,7 @@ static int __send_result_to_launchpad(int fd, int res) } /** - * @brief caller & callee's sock handler + * @brief caller & callee's sock handler */ int aul_sock_handler(int fd) { @@ -484,7 +485,7 @@ int aul_make_bundle_from_argv(int argc, char **argv, bundle **kb) _E("Malloc failed"); return AUL_R_ERROR; } - + bundle_add(*kb, AUL_K_ARGV0, buf); } if (buf) { /*Prevent FIX: ID 38717 */ diff --git a/src/simple_util.c b/src/simple_util.c index 95c7d14a..9e1c580b 100755 --- a/src/simple_util.c +++ b/src/simple_util.c @@ -165,7 +165,7 @@ char *__proc_get_cmdline_bypid(int pid) } ptr++; - if (*ptr == NULL) + if (!(*ptr)) break; // ignore trailing "--" @@ -190,7 +190,6 @@ char *__proc_get_exe_bypid(int pid) { char buf[MAX_CMD_BUFSZ]; char buf2[MAX_CMD_BUFSZ]; - int ret; ssize_t len; snprintf(buf, sizeof(buf), "/proc/%d/exe", pid); diff --git a/test/app_test.c b/test/app_test.c index d92da2a3..19ff4e5e 100755 --- a/test/app_test.c +++ b/test/app_test.c @@ -22,14 +22,15 @@ #include <poll.h> #include <stdio.h> #include <unistd.h> +#include <stdlib.h> +#include <sys/time.h> +#include <glib.h> #include "aul.h" -/* ecore-glib integration */ - -#include <Ecore.h> - extern int aul_listen_app_dead_signal(int (*func) (int, void *), void *data); +static GMainLoop *mainloop = NULL; + void do_create() { /* call real create callback*/ @@ -44,24 +45,6 @@ void do_resume() printf("=================================\n"); } -static Eina_Bool send_result(void *data) -{ - bundle *kb; - bundle *res_b; - kb = (bundle *) data; - - aul_create_result_bundle(kb, &res_b); - if (res_b == NULL) - return 0; - - aul_send_service_result(res_b); - bundle_free(res_b); - - bundle_free(kb); - - return 0; -} - static void prt_bundle(const char *key, const char *value, void *d) { printf("bundle - key: %s, value: %s\n", key, value); @@ -94,8 +77,6 @@ int do_start(void *data) bundle_iterate(kb, prt_bundle, NULL); - ecore_timer_add(5, send_result, bundle_dup(kb)); - return 0; } @@ -134,8 +115,6 @@ int app_launch_handler(int pid, void *data) __attribute__ ((visibility("default"))) int main(int argc, char **argv) { - ecore_init(); - do_create(); if (aul_launch_init(aul_handler, NULL) < 0) @@ -152,12 +131,14 @@ int main(int argc, char **argv) exit(0); } - ecore_main_loop_begin(); + mainloop = g_main_loop_new(NULL, FALSE); + if (!mainloop) { + printf("failed to create glib main loop\n"); + exit(EXIT_FAILURE); + } + g_main_loop_run(mainloop); + return 0; } /* vi: set ts=8 sts=8 sw=8: */ - - - -/* vi: set ts=8 sts=8 sw=8: */ diff --git a/test/aul_test.c b/test/aul_test.c index c9129518..8ce2b904 100755 --- a/test/aul_test.c +++ b/test/aul_test.c @@ -24,7 +24,8 @@ #include <stdio.h> #include <sys/time.h> #include <unistd.h> -#include <Ecore.h> +#include <stdlib.h> +#include <glib.h> #include "menu_db_util.h" #include "aul.h" @@ -38,6 +39,7 @@ static char **gargv; static int gargc; static char *cmd; static int apn_pid; +static GMainLoop *mainloop = NULL; typedef struct _test_func_t { char *name; @@ -123,7 +125,8 @@ static void cb_func(bundle *kb, int is_cancel, void *data) if ((strcmp(cmd, "launch_res") == 0) || (strcmp(cmd, "open_svc_res") == 0)) - ecore_main_loop_quit(); + g_main_loop_quit(mainloop); + } int open_test() @@ -175,14 +178,14 @@ static test_func_t scn_func[] = { {"n", launch_test, "launch_test", ""} }; -static Eina_Bool run_all_test(void *data) +static gboolean run_all_test(void *data) { static int pos = 0; int ret; if (pos > sizeof(scn_func) / sizeof(test_func_t) - 1) { printf("all internal test done\n"); - ecore_main_loop_quit(); + g_main_loop_quit(mainloop); return 0; } @@ -204,7 +207,27 @@ static Eina_Bool run_all_test(void *data) int all_test() { - ecore_timer_add(2, run_all_test, NULL); + static int pos = 0; + int ret; + + if (pos > sizeof(scn_func) / sizeof(test_func_t) - 1) { + printf("all internal test done\n"); + return 0; + } + + if (strncmp(scn_func[pos].name, "n", 1) == 0) { + printf("[test %d] %s , pkgname = %s\n", pos, scn_func[pos].desc, + gargv[2]); + apn_pid = scn_func[pos].func(); + printf("... return pid = %d\n", apn_pid); + } else { + printf("[test %d] %s , pid = %d\n", pos, scn_func[pos].desc, + apn_pid); + ret = scn_func[pos].func(); + printf("... return res = %d\n", ret); + } + pos++; + return 0; } @@ -387,10 +410,10 @@ static int set_pkg_func() pkgname = gargv[2]; apppath = gargv[3]; - + appname = strrchr(apppath,'/')+1; snprintf(ai.app_icon_path, PATH_LEN, "aul_test_icon_path/%d",getpid()); - snprintf(ai.desktop_path, PATH_LEN, + snprintf(ai.desktop_path, PATH_LEN, "aul_test_desktop_path/%d",getpid()); snprintf (query, sizeof(query), "insert into "TABLE_MENU"(\ @@ -570,7 +593,7 @@ static test_func_t test_func[] = { "[usage] getallpkg all"}, {"getpkgpid", get_pkgpid_test, "aul_app_get_appid_bypid test", "[usage] getpkgpid <pid>"}, - + {"open_file", open_file_test, "aul_open_file test", "[usage] open_file <filename>"}, {"open_content", open_content_test, "aul_open_content test", @@ -602,7 +625,7 @@ static test_func_t test_func[] = { "[usage] set_defapp_svc <svcname> <defapp to be set>"}, {"get_defapp_svc", get_defapp_svc_test, "aul_get_defapp_from_svc test" "[usage] get_defapp_svc <svcname>"}, - + {"getpkg", get_pkg_func, "get package", "[usage] getpkg <pkgname>"}, {"update_list", update_running_list, "update running list", @@ -661,7 +684,7 @@ void print_usage(char *progname) "cmd is internal purpose\n"); } -static Eina_Bool run_func(void *data) +static gboolean run_func(void *data) { callfunc(cmd); @@ -670,7 +693,7 @@ static Eina_Bool run_func(void *data) || strcmp(cmd, "open_svc_res") == 0) return 0; else - ecore_main_loop_quit(); + g_main_loop_quit(mainloop); return 0; } @@ -682,8 +705,6 @@ int main(int argc, char **argv) exit(0); } - ecore_init(); - cmd = argv[1]; gargc = argc; gargv = argv; @@ -694,9 +715,14 @@ int main(int argc, char **argv) /*aul_listen_app_dead_signal(dead_tracker,NULL); */ /*aul_listen_app_dead_signal(NULL,NULL); */ - ecore_idler_add(run_func, NULL); + g_idle_add(run_func,NULL); - ecore_main_loop_begin(); + mainloop = g_main_loop_new(NULL, FALSE); + if (!mainloop) { + printf("failed to create glib main loop\n"); + exit(EXIT_FAILURE); + } + g_main_loop_run(mainloop); return 0; } diff --git a/test/launch_app.c b/test/launch_app.c index cbd1593f..4625f453 100755 --- a/test/launch_app.c +++ b/test/launch_app.c @@ -23,8 +23,9 @@ #include <stdlib.h> #include <unistd.h> #include <sys/types.h> +#include <string.h> +#include <glib.h> -#include <Ecore.h> #include "aul.h" #define ROOT_UID 0 @@ -33,6 +34,7 @@ static char **gargv; static int gargc; bundle *kb = NULL; +static GMainLoop *mainloop = NULL; static bundle *create_internal_bundle(int start) { @@ -91,12 +93,12 @@ static int __launch_app_dead_handler(int pid, void *data) int listen_pid = (int) data; if(listen_pid == pid) - ecore_main_loop_quit(); + g_main_loop_quit(mainloop); return 0; } -static Eina_Bool run_func(void *data) +static gboolean run_func(void *data) { int pid = -1; char *str = NULL; @@ -108,11 +110,11 @@ static Eina_Bool run_func(void *data) if( str && strcmp(str, "SYNC") == 0 ) { aul_listen_app_dead_signal(__launch_app_dead_handler, pid); } else { - ecore_main_loop_quit(); + g_main_loop_quit(mainloop); } } else { printf("... launch failed\n"); - ecore_main_loop_quit(); + g_main_loop_quit(mainloop); } if (kb) { @@ -120,10 +122,9 @@ static Eina_Bool run_func(void *data) kb = NULL; } - return 0; + return TRUE; } - int main(int argc, char **argv) { if (argc < 2) { @@ -131,16 +132,19 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } - ecore_init(); - gargc = argc; gargv = argv; aul_launch_init(NULL, NULL); - ecore_idler_add(run_func, NULL); + g_idle_add(run_func, NULL); - ecore_main_loop_begin(); + mainloop = g_main_loop_new(NULL, FALSE); + if (!mainloop) { + printf("failed to create glib main loop\n"); + exit(EXIT_FAILURE); + } + g_main_loop_run(mainloop); return 0; } diff --git a/test/open_app.c b/test/open_app.c index 7525fefc..53616ca8 100755 --- a/test/open_app.c +++ b/test/open_app.c @@ -23,8 +23,9 @@ #include <stdlib.h> #include <unistd.h> #include <sys/types.h> +#include <string.h> +#include <glib.h> -#include <Ecore.h> #include "aul.h" #define ROOT_UID 0 @@ -34,6 +35,7 @@ static char **gargv; static int gargc; bundle *kb = NULL; +static GMainLoop *mainloop = NULL; static bundle *create_internal_bundle(int start) { @@ -93,12 +95,12 @@ static int __launch_app_dead_handler(int pid, void *data) int listen_pid = (int) data; if(listen_pid == pid) - ecore_main_loop_quit(); + g_main_loop_quit(mainloop); return 0; } -static Eina_Bool run_func(void *data) +static gboolean run_func(void *data) { int pid = -1; char *str = NULL; @@ -113,7 +115,7 @@ static Eina_Bool run_func(void *data) if( str && strcmp(str, "SYNC") == 0 ) { aul_listen_app_dead_signal(__launch_app_dead_handler, pid); } else { - ecore_main_loop_quit(); + g_main_loop_quit(mainloop); } if (kb) { @@ -121,9 +123,10 @@ static Eina_Bool run_func(void *data) kb = NULL; } - return 0; + return TRUE; } + int main(int argc, char **argv) { if (argc < 2) { @@ -131,16 +134,19 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } - ecore_init(); - gargc = argc; gargv = argv; aul_launch_init(NULL, NULL); - ecore_idler_add(run_func, NULL); + g_idle_add(run_func, NULL); - ecore_main_loop_begin(); + mainloop = g_main_loop_new(NULL, FALSE); + if (!mainloop) { + printf("failed to create glib main loop\n"); + exit(EXIT_FAILURE); + } + g_main_loop_run(mainloop); return 0; } |