From 5242b0263e040e09bb6de622ae0cedc3346009dc Mon Sep 17 00:00:00 2001 From: root Date: Fri, 15 Jul 2016 20:28:09 +0530 Subject: [PATCH] Selection UI adapter fix for 3.0 Signed-off-by: root Change-Id: Ib0bd8f8aa0d6c59fccff69804889cf9684c32b48 --- server/fido_selection_ui_adaptor.c | 41 ++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/server/fido_selection_ui_adaptor.c b/server/fido_selection_ui_adaptor.c index 01f3200..03f31af 100644 --- a/server/fido_selection_ui_adaptor.c +++ b/server/fido_selection_ui_adaptor.c @@ -33,13 +33,16 @@ #include "fido-stub.h" #include "fido_internal_types.h" -#define _UI_LAUNCH_RETRY_COUNT 5 +#define OWNER_UID 5001 + +#define _UI_LAUNCH_RETRY_COUNT 10 #define _UI_SVC_TERMINATE_TIMEOUT 2000 #define _FREEDESKTOP_SERVICE "org.freedesktop.DBus" #define _FREEDESKTOP_PATH "/org/freedesktop/DBus" #define _FREEDESKTOP_INTERFACE "org.freedesktop.DBus" +GMainLoop *__mainLoop; static GQueue *_ui_q = NULL; static int __ui_svc_pid = -1; @@ -270,7 +273,7 @@ __terminate_ui_svc(void) _INFO("Killing inactive UI Service [%d]", __ui_svc_pid); if (__ui_svc_pid > 0) - aul_terminate_pid(__ui_svc_pid); + aul_terminate_pid_for_uid(__ui_svc_pid, OWNER_UID); __ui_svc_pid = -1; } @@ -294,22 +297,29 @@ static int __launch_svc_ui(bundle *ui_req) { int i = 0; - for (; i < _UI_LAUNCH_RETRY_COUNT; i++) { - if (__ui_svc_pid < 0) - __ui_svc_pid = aul_launch_app(_UI_SVC_PACKAGE, ui_req); - else { - aul_terminate_pid(__ui_svc_pid); - __ui_svc_pid = -1; - - __ui_svc_pid = aul_launch_app(_UI_SVC_PACKAGE, ui_req); - } - _INFO("fido svc pid = [%d]", __ui_svc_pid); + int ui_pid = -1; - if (__ui_svc_pid > 0) - return FIDO_ERROR_NONE; + for(; i < _UI_LAUNCH_RETRY_COUNT; i++) { + ui_pid = aul_launch_app_for_uid(_UI_SVC_PACKAGE, ui_req, OWNER_UID); + if(ui_pid > 0) + break; } - return FIDO_ERROR_UNKNOWN; + + if(ui_pid < 0) + return FIDO_ERROR_UNKNOWN; + + __mainLoop = NULL; + + __mainLoop = g_main_loop_new(NULL, FALSE); + + g_main_loop_run(__mainLoop); + + _INFO(""); + + aul_terminate_pid_for_uid(ui_pid, OWNER_UID); + + return FIDO_ERROR_NONE; } static int @@ -508,5 +518,6 @@ CATCH: __start_ui_svc_term_timer(); } + g_main_loop_quit(__mainLoop); return true; } -- 2.7.4