From: Sangyoon Jang Date: Wed, 4 Feb 2015 01:44:29 +0000 (+0900) Subject: Add rua history at am_session_agent X-Git-Tag: accepted/tizen/tv/20150213.052913~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1733988e39aa961a3c1d7236cfa1d6e73362445e;p=platform%2Fcore%2Fappfw%2Faul-1.git Add rua history at am_session_agent rua should be handled at each user daemon remove rua from amd Change-Id: Idf3419867630d8040add819b1f598f1c11768aeb Signed-off-by: Sangyoon Jang --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 664409a..1374bb2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ SET(AUL-1_PKG_CHECK_MODULES dlog libprivilege-control app-checker rua glib-2.0 v 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 pkgmgr-info) -PKG_CHECK_MODULES(PKGS REQUIRED glib-2.0 gio-2.0 dlog bundle) +PKG_CHECK_MODULES(PKGS REQUIRED glib-2.0 gio-2.0 dlog bundle rua) FIND_LIBRARY(LIB_DL dl) @@ -112,7 +112,7 @@ add_executable(amd am_daemon/amd_launch.c am_daemon/amd_status.c ) -SET(AUL-1_LINK_LIBRARY amd aul_mods app-checker-server rua glib-2.0 bundle ail aul) +SET(AUL-1_LINK_LIBRARY amd aul_mods app-checker-server glib-2.0 bundle ail aul) target_link_libraries(${AUL-1_LINK_LIBRARY} ${pkgs_LDFLAGS}) SET(REL_AGENT daemon-manager-release-agent) diff --git a/am_daemon/amd_request.c b/am_daemon/amd_request.c index a33f829..2050299 100644 --- a/am_daemon/amd_request.c +++ b/am_daemon/amd_request.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include "amd_config.h" @@ -160,48 +159,6 @@ static int __app_process_by_pid(int cmd, return ret; } -static gboolean __add_history_handler(gpointer user_data) -{ - struct rua_rec rec; - int ret; - bundle *kb = NULL; - char *appid = NULL; - char *app_path = NULL; - struct appinfo *ai; - pkt_t *pkt_uid = (pkt_t *)user_data; - - if (!pkt_uid) - return FALSE; - - kb = bundle_decode(pkt_uid->pkt->data, pkt_uid->pkt->len); - appid = (char *)bundle_get_val(kb, AUL_K_PKG_NAME); - - ai = (struct appinfo *)appinfo_find(pkt_uid->caller_uid, appid); - app_path = (char *)appinfo_get_value(ai, AIT_EXEC); - - memset((void *)&rec, 0, sizeof(rec)); - - rec.pkg_name = appid; - rec.app_path = app_path; - - if(pkt_uid->pkt->len > 0) { - rec.arg = (char *)pkt_uid->pkt->data; - } - - SECURE_LOGD("add rua history %s %s", rec.pkg_name, rec.app_path); - - ret = rua_add_history(&rec); - if (ret == -1) - _D("rua add history error"); - - if (kb != NULL) - bundle_free(kb); - free(pkt_uid->pkt); - free(pkt_uid); - - return FALSE; -} - static int __get_pid_cb(void *user_data, const char *group, pid_t pid) { int *sz = user_data; @@ -319,7 +276,6 @@ static gboolean __request_handler(gpointer data) pkt_uid->caller_uid = cr.uid; pkt_uid->pkt = pkt; - g_timeout_add(1000, __add_history_handler, pkt_uid); g_timeout_add(1200, __add_item_running_list, item); } @@ -473,11 +429,6 @@ int _requset_init(struct amdmgr *amd) _raf = amd->af; - r = rua_init(); - r = rua_clear_history(); - - _D("rua_clear_history : %d", r); - return 0; } diff --git a/am_session_agent/agent.c b/am_session_agent/agent.c index 1125169..7b748dd 100644 --- a/am_session_agent/agent.c +++ b/am_session_agent/agent.c @@ -52,6 +52,7 @@ #include #include +#include #define _static_ static inline #define POLLFD_MAX 1 @@ -573,6 +574,18 @@ static app_info_from_db *_get_app_info_from_bundle_by_pkgname( return menu_info; } +static void __add_history(const char *pkg_name, const char *app_path, unsigned char *arg) +{ + struct rua_rec rec; + + rec.pkg_name = pkg_name; + rec.app_path = app_path; + rec.arg = arg; + + if (rua_add_history(&rec)) + _E("rua add history error"); +} + _static_ void __agent_main_loop(int main_fd) { bundle *kb = NULL; @@ -687,6 +700,8 @@ _static_ void __agent_main_loop(int main_fd) __signal_block_sigchld(); __send_app_launch_signal_dbus(pid); __signal_unblock_sigchld(); + + __add_history(pkg_name, app_path, pkt->data); } } @@ -733,6 +748,14 @@ _static_ int __agent_pre_init(int argc, char **argv) return -1; } + if (rua_init()) { + _E("rua init failed"); + return fd; + } + + if (rua_clear_history()) + _E("rua clear history failed"); + return fd; }