From 5a0c712aba735c4422a367f84e1aa3793f034159 Mon Sep 17 00:00:00 2001 From: Myungki Lee Date: Fri, 11 Dec 2015 14:40:15 +0900 Subject: [PATCH] Fix about app launched event callback. Change-Id: Ia3a96253647a09f504a52b78dc0813bc99d4c3b3 Signed-off-by: Myungki Lee --- src/app_context.c | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/src/app_context.c b/src/app_context.c index 49f3929..b6fba3d 100644 --- a/src/app_context.c +++ b/src/app_context.c @@ -40,8 +40,6 @@ static int app_context_create(const char *app_id, pid_t pid, app_context_h *app_context); -static int app_context_get_app_context_by_pid(pid_t pid, app_context_h *app_context); - struct app_context_s { char *app_id; pid_t pid; @@ -134,25 +132,6 @@ int app_context_get_app_context(const char *app_id, app_context_h *app_context) return app_context_create(retrieval_context.app_id, retrieval_context.pid, app_context); } -static int app_context_get_app_context_by_pid(pid_t pid, app_context_h *app_context) -{ - int retval; - char appid[APPID_MAX] = {0, }; - - if (pid < 0 || app_context == NULL) - return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); - - if (aul_app_get_appid_bypid(pid, appid, sizeof(appid)) != AUL_R_OK) - return app_manager_error(APP_MANAGER_ERROR_NO_SUCH_APP, __FUNCTION__, NULL); - - retval = app_context_get_app_context(appid, app_context); - - if (retval != APP_MANAGER_ERROR_NONE) - return app_manager_error(retval, __FUNCTION__, NULL); - - return APP_MANAGER_ERROR_NONE; -} - static int app_context_create(const char *app_id, pid_t pid, app_context_h *app_context) { app_context_h app_context_created; @@ -320,13 +299,13 @@ static void app_context_pid_table_entry_destroyed_cb(void * data) } } -static int app_context_launched_event_cb(pid_t pid, void *data) +static int app_context_launched_event_cb(pid_t pid, const char *app_id, void *data) { app_context_h app_context = NULL; app_context_lock_event_cb_context(); - if (app_context_get_app_context_by_pid(pid, &app_context) == APP_MANAGER_ERROR_NONE) { + if (app_context_create(app_id, pid, &app_context) == APP_MANAGER_ERROR_NONE) { if (event_cb_context != NULL && event_cb_context->pid_table != NULL) { g_hash_table_insert(event_cb_context->pid_table, GINT_TO_POINTER(&(app_context->pid)), app_context); event_cb_context->callback(app_context, APP_CONTEXT_EVENT_LAUNCHED, event_cb_context->user_data); @@ -390,7 +369,7 @@ int app_context_set_event_cb(app_manager_app_context_event_cb callback, void *us app_context_foreach_app_context(app_context_load_all_app_context_cb_locked, NULL); aul_listen_app_dead_signal(app_context_terminated_event_cb, NULL); - aul_listen_app_launch_signal(app_context_launched_event_cb, NULL); + aul_listen_app_launch_signal_v2(app_context_launched_event_cb, NULL); } -- 2.7.4