X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fappcore-efl.c;h=6ff2939f8d5e71ded819c2a800ac0f381a7cfdca;hb=4a3ee09c23531d4b4e76ac1df6b2796118a650a2;hp=323242cd3bede16fa1f9d3ea4baba50b685aa2c7;hpb=2e92f8f0b291c2b310ea290be48f324fbfd32954;p=platform%2Fcore%2Fappfw%2Fapp-core.git diff --git a/src/appcore-efl.c b/src/appcore-efl.c index 323242c..6ff2939 100644 --- a/src/appcore-efl.c +++ b/src/appcore-efl.c @@ -51,6 +51,7 @@ #include "appcore-internal.h" #include "appcore-efl.h" +#include static pid_t _pid; static bool resource_reclaiming = TRUE; @@ -71,10 +72,8 @@ struct ui_priv { Ecore_Timer *mftimer; /* Ecore Timer for memory flushing */ struct appcore *app_core; -#ifdef _APPFW_FEATURE_BACKGROUND_MANAGEMENT void (*prepare_to_suspend) (void *data); void (*exit_from_suspend) (void *data); -#endif struct appcore_ops *ops; void (*mfcb) (void); /* Memory Flushing Callback */ @@ -223,7 +222,6 @@ static void __unset_bg_state(void) __finish_wl(); } -#ifdef _APPFW_FEATURE_BACKGROUND_MANAGEMENT static void __appcore_efl_prepare_to_suspend(void *data) { struct ui_priv *ui = (struct ui_priv *)data; @@ -255,7 +253,6 @@ static void __appcore_efl_exit_from_suspend(void *data) } _DBG("[__SUSPEND__]"); } -#endif static void __appcore_efl_update_requested(void *data) { @@ -280,12 +277,10 @@ static Eina_Bool __appcore_memory_flush_cb(void *data) if (ui) ui->mftimer = NULL; -#ifdef _APPFW_FEATURE_BACKGROUND_MANAGEMENT - if (ui && ui->prepare_to_suspend) { + if (_APPFW_FEATURE_BACKGROUND_MANAGEMENT && ui && ui->prepare_to_suspend) { _DBG("[__SUSPEND__] flush case"); ui->prepare_to_suspend(ui); } -#endif return ECORE_CALLBACK_CANCEL; } @@ -435,12 +430,10 @@ static void __do_app(enum app_event event, void *data, bundle * b) below_app = bundle_get_val(b, AUL_SVC_K_RELOCATE_BELOW); if (below_app) ui->below_app = strdup(below_app); -#ifdef _APPFW_FEATURE_BACKGROUND_MANAGEMENT - if (ui->exit_from_suspend) { + if (_APPFW_FEATURE_BACKGROUND_MANAGEMENT && ui->exit_from_suspend) { _DBG("[__SUSPEND__] reset case"); ui->exit_from_suspend(ui); } -#endif if (ui->ops->reset) { traceBegin(TTRACE_TAG_APPLICATION_MANAGER, @@ -451,10 +444,8 @@ static void __do_app(enum app_event event, void *data, bundle * b) LOG(LOG_DEBUG, "LAUNCH", "[%s:Application:reset:done]", ui->name); if (first_launch) { -#ifdef _APPFW_FEATURE_BACKGROUND_MANAGEMENT - if (ui->app_core->allowed_bg) + if (_APPFW_FEATURE_BACKGROUND_MANAGEMENT && ui->app_core->allowed_bg) __appcore_timer_add(ui); -#endif first_launch = FALSE; } else { _INFO("[APP %d] App already running, raise the window", _pid); @@ -484,13 +475,11 @@ static void __do_app(enum app_event event, void *data, bundle * b) ui->state = AS_PAUSED; if (r >= 0 && resource_reclaiming == TRUE) __appcore_timer_add(ui); -#ifdef _APPFW_FEATURE_BACKGROUND_MANAGEMENT - else if (r >= 0 && resource_reclaiming == FALSE + else if (_APPFW_FEATURE_BACKGROUND_MANAGEMENT && r >= 0 && resource_reclaiming == FALSE && ui->prepare_to_suspend) { _DBG("[__SUSPEND__] pause case"); ui->prepare_to_suspend(ui); } -#endif } /* TODO : rotation stop */ /* r = appcore_pause_rotation_cb(); */ @@ -499,14 +488,14 @@ static void __do_app(enum app_event event, void *data, bundle * b) case AE_RESUME: LOG(LOG_DEBUG, "LAUNCH", "[%s:Application:resume:start]", ui->name); -#ifdef _APPFW_FEATURE_BACKGROUND_MANAGEMENT - if (ui->exit_from_suspend) { - _DBG("[__SUSPEND__] resume case"); - ui->exit_from_suspend(ui); + if (_APPFW_FEATURE_BACKGROUND_MANAGEMENT) { + if (ui->exit_from_suspend) { + _DBG("[__SUSPEND__] resume case"); + ui->exit_from_suspend(ui); + } + if (ui->app_core->allowed_bg) + __appcore_timer_del(ui); } - if (ui->app_core->allowed_bg) - __appcore_timer_del(ui); -#endif if (ui->state == AS_PAUSED || ui->state == AS_CREATED) { _DBG("[APP %d] RESUME", _pid); @@ -684,14 +673,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) @@ -710,16 +695,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 @@ -984,9 +965,7 @@ static int __before_loop(struct ui_priv *ui, int *argc, char ***argv) { int r; char *hwacc = NULL; -#if _APPFW_FEATURE_BACKGROUND_MANAGEMENT struct appcore *ac = NULL; -#endif bundle *b; const char *bg_launch; @@ -1017,11 +996,11 @@ static int __before_loop(struct ui_priv *ui, int *argc, char ***argv) r = appcore_init(ui->name, &efl_ops, *argc, *argv); _retv_if(r == -1, -1); -#if _APPFW_FEATURE_BACKGROUND_MANAGEMENT - appcore_get_app_core(&ac); - ui->app_core = ac; - SECURE_LOGD("[__SUSPEND__] appcore initialized, appcore addr: #%x", ac); -#endif + if (_APPFW_FEATURE_BACKGROUND_MANAGEMENT) { + appcore_get_app_core(&ac); + ui->app_core = ac; + SECURE_LOGD("[__SUSPEND__] appcore initialized, appcore addr: #%x", ac); + } b = bundle_import_from_argv(*argc, *argv); if (b) { @@ -1096,6 +1075,12 @@ static void __after_loop(struct ui_priv *ui) __appcore_timer_del(ui); 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, @@ -1133,11 +1118,11 @@ static int __set_data(struct ui_priv *ui, const char *name, ui->rot_cb_data = NULL; ui->rot_mode = APPCORE_RM_UNKNOWN; -#ifdef _APPFW_FEATURE_BACKGROUND_MANAGEMENT - ui->app_core = NULL; - ui->prepare_to_suspend = __appcore_efl_prepare_to_suspend; - ui->exit_from_suspend = __appcore_efl_exit_from_suspend; -#endif + if (_APPFW_FEATURE_BACKGROUND_MANAGEMENT) { + ui->app_core = NULL; + ui->prepare_to_suspend = __appcore_efl_prepare_to_suspend; + ui->exit_from_suspend = __appcore_efl_exit_from_suspend; + } return 0; } @@ -1336,3 +1321,36 @@ EXPORT_API unsigned int appcore_get_main_surface(void) return 0; } #endif + +tizen_profile_t _get_tizen_profile() +{ + static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN; + if (__builtin_expect(profile != TIZEN_PROFILE_UNKNOWN, 1)) + return profile; + + char *profileName; + system_info_get_platform_string("http://tizen.org/feature/profile", &profileName); + switch (*profileName) { + case 'm': + case 'M': + profile = TIZEN_PROFILE_MOBILE; + break; + case 'w': + case 'W': + profile = TIZEN_PROFILE_WEARABLE; + break; + case 't': + case 'T': + profile = TIZEN_PROFILE_TV; + break; + case 'i': + case 'I': + profile = TIZEN_PROFILE_IVI; + break; + default: // common or unTIZEN_nown ==> ALL ARE COMMON. + profile = TIZEN_PROFILE_COMMON; + } + free(profileName); + + return profile; +}