Merge branch 'tizen_3.0' into tizen 41/108141/1 accepted/tizen/common/20170112.174225 accepted/tizen/ivi/20170111.222045 accepted/tizen/mobile/20170111.221912 accepted/tizen/tv/20170111.221933 accepted/tizen/wearable/20170111.221955 submit/tizen/20170111.041200
authorInkyun Kil <inkyun.kil@samsung.com>
Tue, 3 Jan 2017 06:17:24 +0000 (15:17 +0900)
committerInkyun Kil <inkyun.kil@samsung.com>
Tue, 3 Jan 2017 06:17:31 +0000 (15:17 +0900)
Change-Id: Ia38089142c1004e59902f9c5634791db755f81b5

include/appcore-common.h
include/appcore-internal.h
src/appcore-efl.c
src/appcore-i18n.c
src/appcore-rotation.c
src/appcore.c

index a130336..125aabe 100644 (file)
@@ -76,6 +76,8 @@ enum appcore_event {
                        /**< Region setting is changed */
        APPCORE_EVENT_SUSPENDED_STATE_CHANGE,
                        /**< The suspended state is changed */
+       APPCORE_EVENT_UPDATE_REQUESTED,
+                       /**< Update requested */
 };
 
 /**
index f16c214..a645a69 100644 (file)
@@ -117,6 +117,7 @@ enum app_event {
        AE_RESET,
        AE_LOWMEM_POST,
        AE_MEM_FLUSH,
+       AE_UPDATE_REQUESTED,
        AE_MAX
 };
 
@@ -130,6 +131,7 @@ enum sys_event {
        SE_LANGCHG,
        SE_REGIONCHG,
        SE_SUSPENDED_STATE,
+       SE_UPDATE_REQUESTED,
        SE_MAX
 };
 
index b70ee32..f0161b3 100644 (file)
@@ -70,8 +70,8 @@ struct ui_priv {
 
        Ecore_Timer *mftimer; /* Ecore Timer for memory flushing */
 
-#ifdef _APPFW_FEATURE_BACKGROUND_MANAGEMENT
        struct appcore *app_core;
+#ifdef _APPFW_FEATURE_BACKGROUND_MANAGEMENT
        void (*prepare_to_suspend) (void *data);
        void (*exit_from_suspend) (void *data);
 #endif
@@ -99,6 +99,7 @@ static const char *_ae_name[AE_MAX] = {
        [AE_RESET] = "RESET",
        [AE_LOWMEM_POST] = "LOWMEM_POST",
        [AE_MEM_FLUSH] = "MEM_FLUSH",
+       [AE_UPDATE_REQUESTED] = "UPDATE_REQUESTED",
 };
 
 static const char *_as_name[] = {
@@ -256,6 +257,20 @@ static void __appcore_efl_exit_from_suspend(void *data)
 }
 #endif
 
+static void __appcore_efl_update_requested(void *data)
+{
+       struct ui_priv *ui = (struct ui_priv *)data;
+       struct sys_op *op;
+       int dummy = 0;
+
+       if (ui->app_core) {
+               op = &ui->app_core->sops[SE_UPDATE_REQUESTED];
+               if (op && op->func)
+                       op->func((void *)&dummy, op->data);
+       }
+       _DBG("[__UPDATE_REQUESTED__]");
+}
+
 #if defined(MEMORY_FLUSH_ACTIVATE)
 static Eina_Bool __appcore_memory_flush_cb(void *data)
 {
@@ -407,6 +422,8 @@ static void __do_app(enum app_event event, void *data, bundle * b)
        switch (event) {
        case AE_RESET:
                _DBG("[APP %d] RESET", _pid);
+               if (ui->pending_data)
+                       bundle_free(ui->pending_data);
                ui->pending_data = bundle_dup(b);
                LOG(LOG_DEBUG, "LAUNCH", "[%s:Application:reset:start]", ui->name);
 
@@ -533,6 +550,9 @@ static void __do_app(enum app_event event, void *data, bundle * b)
                        _DBG("[APP %d] is another state", _pid);
                }
                break;
+       case AE_UPDATE_REQUESTED:
+               __appcore_efl_update_requested(ui);
+               break;
        default:
                /* do nothing */
                break;
@@ -664,14 +684,10 @@ static bool __update_win(unsigned int win, bool bfobscured)
                return FALSE;
        }
 
-       g_winnode_list = g_slist_remove_link(g_winnode_list, f);
-
        t = (struct win_node *)f->data;
        t->win = win;
        t->bfobscured = bfobscured;
 
-       g_winnode_list = g_slist_concat(g_winnode_list, f);
-
        return TRUE;
 }
 #elif defined(WAYLAND)
@@ -690,16 +706,12 @@ static bool __update_win(unsigned int win, unsigned int surf, bool bfobscured)
                return FALSE;
        }
 
-       g_winnode_list = g_slist_remove_link(g_winnode_list, f);
-
        t = (struct win_node *)f->data;
        t->win = win;
        if (surf != 0)
                t->surf = surf;
        t->bfobscured = bfobscured;
 
-       g_winnode_list = g_slist_concat(g_winnode_list, f);
-
        return TRUE;
 }
 #endif
@@ -1075,8 +1087,13 @@ static void __after_loop(struct ui_priv *ui)
 
        __appcore_timer_del(ui);
 
-       /* Check the launchpad-loader case */
-       while (elm_shutdown() > 0);
+       elm_shutdown();
+
+       /* Check loader case */
+       if (getenv("AUL_LOADER_INIT")) {
+               unsetenv("AUL_LOADER_INIT");
+               elm_shutdown();
+       }
 }
 
 static int __set_data(struct ui_priv *ui, const char *name,
index 5cae8d7..3cbefcc 100644 (file)
@@ -82,6 +82,7 @@ void update_region(void)
 static int __set_i18n(const char *domain, const char *dir)
 {
        char *r;
+       char *lan;
 
        if (domain == NULL) {
                errno = EINVAL;
@@ -91,8 +92,12 @@ static int __set_i18n(const char *domain, const char *dir)
        r = setlocale(LC_ALL, "");
        /* if locale is not set properly, try again to set as language base */
        if (r == NULL) {
-               r = setlocale(LC_ALL, vconf_get_str(VCONFKEY_LANGSET));
-               _DBG("*****appcore setlocale=%s\n", r);
+               lan = vconf_get_str(VCONFKEY_LANGSET);
+               if (lan != NULL) {
+                       r = setlocale(LC_ALL, lan);
+                       _DBG("*****appcore setlocale=%s\n", r);
+                       free(lan);
+               }
        }
        if (r == NULL)
                _ERR("appcore: setlocale() error");
index e4227cb..5d90526 100644 (file)
@@ -128,7 +128,7 @@ static void __changed_cb(sensor_t sensor, unsigned int event_type,
        if (rot.callback) {
                if (rot.cb_set && rot.mode != m) {
                        _DBG("[APP %d] Rotation: %d -> %d", getpid(), rot.mode, m);
-                       rot.callback((void *)&m, m, data);
+                       rot.callback((void *)&m, m, user_data);
                        rot.mode = m;
                }
        }
index ca16b35..20fb3c4 100644 (file)
@@ -58,6 +58,7 @@ static enum appcore_event to_ae[SE_MAX] = {
        APPCORE_EVENT_LANG_CHANGE,      /* SE_LANGCGH */
        APPCORE_EVENT_REGION_CHANGE,
        APPCORE_EVENT_SUSPENDED_STATE_CHANGE,
+       APPCORE_EVENT_UPDATE_REQUESTED,
 };
 
 static int appcore_event_initialized[SE_MAX] = {0,};
@@ -228,6 +229,17 @@ static int __app_pause(void *data)
        return 0;
 }
 
+static int __app_update_requested(void *data)
+{
+       struct appcore *ac = data;
+
+       _retv_if(ac == NULL || ac->ops == NULL, -1);
+       _retv_if(ac->ops->cb_app == NULL, 0);
+       ac->ops->cb_app(AE_UPDATE_REQUESTED, ac->ops->data, NULL);
+
+       return 0;
+}
+
 static int __sys_do_default(struct appcore *ac, enum sys_event event)
 {
        int r;
@@ -594,6 +606,10 @@ static int __aul_handler(aul_type type, bundle *b, void *data)
                }
                break;
 #endif
+       case AUL_UPDATE_REQUESTED:
+               _DBG("[APP %d]     AUL event: AUL_UPDATE_REQUESTED", _pid);
+               __app_update_requested(data);
+               break;
        default:
                _DBG("[APP %d]     AUL event: %d", _pid, type);
                /* do nothing */