From: Hwankyu Jhun Date: Thu, 9 Mar 2017 07:06:03 +0000 (+0900) Subject: Fix background launch X-Git-Tag: accepted/tizen/common/20170321.102348~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fappfw%2Fapp-core.git;a=commitdiff_plain;h=ef6b8b85e90aa026deb4647fccaba4bffa3aaa20 Fix background launch After applying this patch, the appcore supports the background launch when the application is running in the background. Some UI applications don't want to be shown the window when getting the launch request. Change-Id: I16e1006e67642c39f9774cbc8612e6fe9b7a2c2f Signed-off-by: Hwankyu Jhun --- diff --git a/src/appcore-efl.c b/src/appcore-efl.c index 46294a1..ff6a0ee 100644 --- a/src/appcore-efl.c +++ b/src/appcore-efl.c @@ -187,7 +187,7 @@ static void __finish_wl(void) static void __set_bg_state(void) { - if (__init_wl() < 0) + if (!tz_policy && __init_wl() < 0) return; tizen_policy_set_background_state(tz_policy, getpid()); @@ -205,7 +205,6 @@ static void __unset_bg_state(void) wl_display_roundtrip(dsp); bg_state = false; _DBG("bg state: %d", bg_state); - __finish_wl(); } static void __appcore_efl_prepare_to_suspend(void *data) @@ -422,12 +421,16 @@ static void __do_app(enum app_event event, void *data, bundle * b) first_launch = FALSE; } else { _INFO("[APP %d] App already running, raise the window", _pid); - if (bg_state) { - bg_launch = bundle_get_val(b, AUL_SVC_K_BG_LAUNCH); - if (!bg_launch || strcmp(bg_launch, "enable")) + bg_launch = bundle_get_val(b, AUL_SVC_K_BG_LAUNCH); + if (bg_launch && strcmp(bg_launch, "enable") == 0) { + if (!bg_state && ui->state != AS_RUNNING) + __set_bg_state(); + } else { + if (bg_state) __unset_bg_state(); } - wl_raise_win(); + if (!bg_state) + wl_raise_win(); } LOG(LOG_DEBUG, "LAUNCH", "[%s:Application:reset:done]", ui->name); @@ -822,6 +825,7 @@ static void __after_loop(struct ui_priv *ui) ecore_event_handler_del(ui->hlower); __appcore_timer_del(ui); + __finish_wl(); elm_shutdown(); diff --git a/src/ui_base/appcore_ui_base.c b/src/ui_base/appcore_ui_base.c index 07b847a..40919f0 100644 --- a/src/ui_base/appcore_ui_base.c +++ b/src/ui_base/appcore_ui_base.c @@ -389,7 +389,7 @@ static void __finish_wl(void) static void __set_bg_state(void) { - if (__init_wl() < 0) + if (!tz_policy && __init_wl() < 0) return; tizen_policy_set_background_state(tz_policy, getpid()); @@ -407,7 +407,6 @@ static void __unset_bg_state(void) wl_display_roundtrip(dsp); bg_state = false; _DBG("bg state: %d", bg_state); - __finish_wl(); } static void __do_start(bundle *b) @@ -431,14 +430,19 @@ static void __do_start(bundle *b) return; } - if ((__context.hint & APPCORE_UI_BASE_HINT_BG_LAUNCH_CONTROL) && - bg_state) { + if (__context.hint & APPCORE_UI_BASE_HINT_BG_LAUNCH_CONTROL) { bg_launch = bundle_get_val(b, AUL_SVC_K_BG_LAUNCH); - if (!bg_launch || strcmp(bg_launch, "enable")) - __unset_bg_state(); + if (bg_launch && strcmp(bg_launch, "enable") == 0) { + if (!bg_state && __context.state != AS_RUNNING) + __set_bg_state(); + } else { + if (bg_state) + __unset_bg_state(); + } } - __raise_win(); + if (!bg_state) + __raise_win(); } EXPORT_API int appcore_ui_base_on_receive(aul_type type, bundle *b) @@ -514,6 +518,7 @@ EXPORT_API int appcore_ui_base_on_terminate(void) if (__context.hlower) ecore_event_handler_del(__context.hlower); + __finish_wl(); elm_shutdown(); /* Check loader case */