diff options
author | Hwankyu Jhun <h.jhun@samsung.com> | 2018-02-13 17:07:56 +0900 |
---|---|---|
committer | Hwankyu Jhun <h.jhun@samsung.com> | 2018-02-13 17:08:43 +0900 |
commit | 4151db4b300660e594e505be39bba9c3d4e63ac1 (patch) | |
tree | 02feb3ccb33adaeed4e52f95b4a941ac5a353e42 | |
parent | 0d791bc8e28eb713fee37c997b82542514a3d7cf (diff) | |
download | app-core-4151db4b300660e594e505be39bba9c3d4e63ac1.tar.gz app-core-4151db4b300660e594e505be39bba9c3d4e63ac1.tar.bz2 app-core-4151db4b300660e594e505be39bba9c3d4e63ac1.zip |
Add suspend timer after calling pause callback
After calling pause callback, appcore_ui_base adds
the suspend timer to flush memory.
Change-Id: I1f98725e8ba70fbf146b11226a9f16157a522704
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
-rw-r--r-- | include/appcore_base.h | 2 | ||||
-rw-r--r-- | include/appcore_efl_base.h | 1 | ||||
-rw-r--r-- | include/appcore_ui_base.h | 1 | ||||
-rw-r--r-- | src/base/appcore_base.c | 10 | ||||
-rw-r--r-- | src/efl_base/appcore_efl_base.c | 5 | ||||
-rw-r--r-- | src/legacy/appcore-efl.c | 1 | ||||
-rw-r--r-- | src/ui_base/appcore_ui_base.c | 14 |
7 files changed, 33 insertions, 1 deletions
diff --git a/include/appcore_base.h b/include/appcore_base.h index 795b18a..3fb216e 100644 --- a/include/appcore_base.h +++ b/include/appcore_base.h @@ -89,6 +89,8 @@ bool appcore_base_is_suspended(void); void appcore_base_toggle_suspended_state(void); int appcore_base_set_i18n(const char *domain_name, const char *dir_name); void appcore_base_exit(void); +void appcore_base_add_suspend_timer(void); +void appcore_base_remove_suspend_timer(void); #ifdef __cplusplus } diff --git a/include/appcore_efl_base.h b/include/appcore_efl_base.h index 90903d2..d902130 100644 --- a/include/appcore_efl_base.h +++ b/include/appcore_efl_base.h @@ -63,6 +63,7 @@ unsigned int appcore_efl_base_get_main_surface(void); int appcore_efl_base_get_hint(void); bool appcore_efl_base_get_bg_state(void); void appcore_efl_base_set_bg_state(bool bg_state); +void appcore_efl_base_set_system_resource_reclaiming(bool enable); #ifdef __cplusplus } diff --git a/include/appcore_ui_base.h b/include/appcore_ui_base.h index 83f648d..f85f727 100644 --- a/include/appcore_ui_base.h +++ b/include/appcore_ui_base.h @@ -75,6 +75,7 @@ unsigned int appcore_ui_base_get_main_surface(void); int appcore_ui_base_get_hint(void); bool appcore_ui_base_get_bg_state(void); void appcore_ui_base_set_bg_state(bool bg_state); +void appcore_ui_base_set_system_resource_reclaiming(bool enable); #ifdef __cplusplus } diff --git a/src/base/appcore_base.c b/src/base/appcore_base.c index c815922..a792d8f 100644 --- a/src/base/appcore_base.c +++ b/src/base/appcore_base.c @@ -1321,6 +1321,16 @@ EXPORT_API void appcore_base_exit(void) __context.ops.exit(__context.data); } +EXPORT_API void appcore_base_add_suspend_timer(void) +{ + __add_suspend_timer(); +} + +EXPORT_API void appcore_base_remove_suspend_timer(void) +{ + __remove_suspend_timer(); +} + static int __on_receive(aul_type type, bundle *b, void *data) { return appcore_base_on_receive(type, b); diff --git a/src/efl_base/appcore_efl_base.c b/src/efl_base/appcore_efl_base.c index e2fd7c3..d193f38 100644 --- a/src/efl_base/appcore_efl_base.c +++ b/src/efl_base/appcore_efl_base.c @@ -323,3 +323,8 @@ EXPORT_API void appcore_efl_base_set_bg_state(bool bg_state) { appcore_ui_base_set_bg_state(bg_state); } + +EXPORT_API void appcore_efl_base_set_system_resource_reclaiming(bool enable) +{ + appcore_ui_base_set_system_resource_reclaiming(enable); +} diff --git a/src/legacy/appcore-efl.c b/src/legacy/appcore-efl.c index b171a27..0ec077f 100644 --- a/src/legacy/appcore-efl.c +++ b/src/legacy/appcore-efl.c @@ -146,5 +146,6 @@ EXPORT_API unsigned int appcore_get_main_surface(void) EXPORT_API int appcore_set_system_resource_reclaiming(bool enable) { + appcore_efl_base_set_system_resource_reclaiming(enable); return 0; } diff --git a/src/ui_base/appcore_ui_base.c b/src/ui_base/appcore_ui_base.c index 56817dc..f641ce0 100644 --- a/src/ui_base/appcore_ui_base.c +++ b/src/ui_base/appcore_ui_base.c @@ -70,6 +70,7 @@ typedef struct _appcore_ui_base_context { char *below_app; char *appid; bool bg_state; + bool resource_reclaiming; int state; Ecore_Event_Handler *hshow; @@ -284,14 +285,19 @@ static void __exit_from_suspend(void) static void __do_pause(void) { + int r = -1; + if (__context.state == AS_RUNNING) { if (__context.ops.pause) { traceBegin(TTRACE_TAG_APPLICATION_MANAGER, "APPCORE:PAUSE"); _DBG("Call pause callback"); - __context.ops.pause(__context.data); + r = __context.ops.pause(__context.data); traceEnd(TTRACE_TAG_APPLICATION_MANAGER); } + if (r >= 0 && __context.resource_reclaiming) + appcore_base_add_suspend_timer(); + __context.state = AS_PAUSED; __prepare_to_suspend(); } @@ -922,6 +928,7 @@ EXPORT_API int appcore_ui_base_init(appcore_ui_base_ops ops, int argc, char **ar __context.hint = hint; __context.state = AS_NONE; __context.appid = strdup(appid); + __context.resource_reclaiming = true; LOG(LOG_DEBUG, "LAUNCH", "[%s:Application:main:done]", appid); if (__context.hint & APPCORE_UI_BASE_HINT_BG_LAUNCH_CONTROL) { @@ -997,6 +1004,11 @@ EXPORT_API void appcore_ui_base_set_bg_state(bool bg_state) __context.bg_state = bg_state; } +EXPORT_API void appcore_ui_base_set_system_resource_reclaiming(bool enable) +{ + __context.resource_reclaiming = enable; +} + static int __on_receive(aul_type type, bundle *b, void *data) { return appcore_ui_base_on_receive(type, b); |