From: Hwankyu Jhun Date: Fri, 23 Jun 2017 09:22:22 +0000 (+0900) Subject: Support legacy lifecycle X-Git-Tag: submit/tizen_3.0/20170816.055230~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ee10db346c9cd2dfa12d13c0a10dd91bf1b2140;p=platform%2Fcore%2Fappfw%2Fapp-core.git Support legacy lifecycle This patch is for Tizen 2.3 applications. In Tizen 2.3, the resume callback is invoked when getting the reset event. Change-Id: I9d09ae79570e3dbc0552a695918b4baa8c30b752 Signed-off-by: Hwankyu Jhun --- diff --git a/src/appcore-efl.c b/src/appcore-efl.c index 0091c3d..d7f0db8 100644 --- a/src/appcore-efl.c +++ b/src/appcore-efl.c @@ -14,6 +14,7 @@ * limitations under the License. */ +#define _GNU_SOURCE #include #include #include @@ -361,6 +362,59 @@ static void wl_pause_win(void) #endif +static void __on_resume(struct ui_priv *ui, bundle *b) +{ + 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 (ui->app_core->allowed_bg) + __appcore_timer_del(ui); +#endif + + if (ui->state == AS_PAUSED || ui->state == AS_CREATED) { + _DBG("[APP %d] RESUME", _pid); + if (ui->ops->resume) { + traceBegin(TTRACE_TAG_APPLICATION_MANAGER, + "APPCORE:RESUME"); + ui->ops->resume(ui->ops->data); + traceEnd(TTRACE_TAG_APPLICATION_MANAGER); + } + ui->state = AS_RUNNING; + + if (ui->below_app) { + aul_app_group_activate_below(ui->below_app); + free(ui->below_app); + ui->below_app = NULL; + } + } + LOG(LOG_DEBUG, "LAUNCH", "[%s:Application:resume:done]", ui->name); + aul_status_update(STATUS_VISIBLE); +} + +static int __is_legacy_lifecycle(void) +{ + static int legacy = -1; + const char *api_version; + + if (legacy != -1) + return legacy; + + api_version = getenv("TIZEN_API_VERSION"); + if (api_version) { + if (strverscmp("2.4", api_version) <= 0) + legacy = 0; + else + legacy = 1; + } else { + legacy = 0; + } + + return legacy; +} + static void __do_app(enum app_event event, void *data, bundle * b) { int r = -1; @@ -475,6 +529,10 @@ static void __do_app(enum app_event event, void *data, bundle * b) } LOG(LOG_DEBUG, "LAUNCH", "[%s:Application:reset:done]", ui->name); + if (!bg_state && __is_legacy_lifecycle()) { + _DBG("Legacy lifecycle"); + __on_resume(ui, b); + } break; case AE_PAUSE: if (ui->state == AS_RUNNING) { @@ -501,39 +559,7 @@ static void __do_app(enum app_event event, void *data, bundle * b) aul_status_update(STATUS_BG); break; 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 (ui->app_core->allowed_bg) - __appcore_timer_del(ui); -#endif - - if (ui->state == AS_PAUSED || ui->state == AS_CREATED) { - _DBG("[APP %d] RESUME", _pid); - - if (ui->ops->resume) { - traceBegin(TTRACE_TAG_APPLICATION_MANAGER, - "APPCORE:RESUME"); - ui->ops->resume(ui->ops->data); - traceEnd(TTRACE_TAG_APPLICATION_MANAGER); - } - ui->state = AS_RUNNING; - - if (ui->below_app) { - aul_app_group_activate_below(ui->below_app); - free(ui->below_app); - ui->below_app = NULL; - } - } - /*TODO : rotation start*/ - /* r = appcore_resume_rotation_cb(); */ - LOG(LOG_DEBUG, "LAUNCH", "[%s:Application:resume:done]", - ui->name); - aul_status_update(STATUS_VISIBLE); + __on_resume(ui, b); break; case AE_TERMINATE_BGAPP: if (ui->state == AS_PAUSED) {