Fix background launch 58/118358/2 accepted/tizen/3.0/common/20170321.122823 accepted/tizen/3.0/ivi/20170321.035520 accepted/tizen/3.0/mobile/20170321.035343 accepted/tizen/3.0/tv/20170321.035440 accepted/tizen/3.0/wearable/20170321.035452 submit/tizen_3.0/20170320.090005
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 10 Mar 2017 05:55:19 +0000 (14:55 +0900)
committerHwanKyu Jhun <h.jhun@samsung.com>
Fri, 10 Mar 2017 05:55:46 +0000 (21:55 -0800)
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: I03ddfaddf861cb0b1f1443e304380e2414c16fac
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/appcore-efl.c

index e1741159802e79d2cddd05706900db549ba3b68a..ac3908697350dbc553984feabe345d3aab7a772e 100644 (file)
@@ -201,7 +201,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());
@@ -219,7 +219,6 @@ static void __unset_bg_state(void)
        wl_display_roundtrip(dsp);
        bg_state = false;
        _DBG("bg state: %d", bg_state);
-       __finish_wl();
 }
 
 #ifdef _APPFW_FEATURE_BACKGROUND_MANAGEMENT
@@ -454,16 +453,22 @@ 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();
                        }
+
+                       if (!bg_state) {
 #ifdef X11
-                       x_raise_win(getpid());
+                               x_raise_win(getpid());
 #else
-                       wl_raise_win();
+                               wl_raise_win();
 #endif
+                       }
                }
                LOG(LOG_DEBUG, "LAUNCH", "[%s:Application:reset:done]",
                    ui->name);
@@ -1076,7 +1081,7 @@ static void __after_loop(struct ui_priv *ui)
 #endif
 
        __appcore_timer_del(ui);
-
+       __finish_wl();
        elm_shutdown();
 
        /* Check loader case */