Add bg launch feature 98/225098/2
authorhyunho <hhstark.kang@samsung.com>
Mon, 17 Feb 2020 09:24:26 +0000 (18:24 +0900)
committerhyunho <hhstark.kang@samsung.com>
Tue, 18 Feb 2020 07:57:10 +0000 (16:57 +0900)
https://review.tizen.org/gerrit/#/c/platform/core/appfw/widget-viewer/+/225169/

Change-Id: I25be46599af55d3205849cad4315a930be185a4b
Signed-off-by: hyunho <hhstark.kang@samsung.com>
src/base/watch_base.c

index 752e2b7..74b657c 100755 (executable)
@@ -110,6 +110,7 @@ struct watch_base_context {
        enum watch_visible_state watch_visibility;
        bool ambient_mode;
        bool ambient_mode_skip_resume;
+       bool bg_launch;
        guint pause_timer;
        void *data;
 };
@@ -687,8 +688,14 @@ static void __on_ambient_changed(int ambient, void *data)
 
 static void __on_window_show(int type, void *event, void *data)
 {
+       LOGW("on window show bg_launch(%d)", __context.bg_launch);
        appcore_ui_base_window_on_show(type, event);
-       appcore_ui_base_resume();
+       if (__context.bg_launch) {
+               appcore_ui_base_resume();
+               appcore_ui_base_pause();
+       } else {
+               appcore_ui_base_resume();
+       }
 }
 
 static gboolean __delayed_pause(gpointer data)
@@ -729,6 +736,7 @@ static void __on_window_visibility(int type, void *event, void *data)
                __add_pause_timer();
        } else {
                __context.watch_visibility = WVS_RESUME;
+               __context.bg_launch = false;
                __remove_pause_timer();
                __on_ui_base_resume(NULL);
        }
@@ -883,6 +891,8 @@ EXPORT_API int watch_base_init(int argc, char **argv,
        bundle *kb;
        char *width_str = NULL;
        char *height_str = NULL;
+       char *bg_launch_str = NULL;
+       bool bg_launch = false;
        int width = 360;
        int height = 360;
        appcore_ui_base_ops ops = appcore_ui_base_get_default_ops();
@@ -929,6 +939,7 @@ EXPORT_API int watch_base_init(int argc, char **argv,
        if (kb) {
                bundle_get_str(kb, "WATCH_WIDTH", &width_str);
                bundle_get_str(kb, "WATCH_HEIGHT", &height_str);
+               bundle_get_str(kb, "WATCH_BG_LAUNCH", &bg_launch_str);
 
                if (width_str)
                        width = atoi(width_str);
@@ -936,12 +947,16 @@ EXPORT_API int watch_base_init(int argc, char **argv,
                if (height_str)
                        height = atoi(height_str);
 
+               if (bg_launch_str)
+                       bg_launch = atoi(bg_launch_str);
+
                bundle_free(kb);
        } else {
                _E("failed to get launch argv");
        }
 
        __context.callback = *callback;
+       __context.bg_launch = bg_launch;
        __context.width = width;
        __context.height = height;
        __context.watch_visibility = WVS_UNKNOWN;