From 9f290301d5eec50554b16ada4652f67d6f860429 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 9 Aug 2016 18:27:08 +0900 Subject: [PATCH] Fix background management feature While an application receives the AUL_SUSPEND event, the allowed_bg value is changed to "false". AMD always sends the AUL_SUSPEND event when the application is not allowed to run in the background. And, the allowed_bg value can be changed when the application receives the AUL_WAKE event. - Requires [aul] https://review.tizen.org/gerrit/#/c/83134/ [amd] https://review.tizen.org/gerrit/#/c/83044/ Change-Id: Ibaca3e8d0ba62f827b2abf2f58de44446c510ff1 Signed-off-by: Hwankyu Jhun --- src/appcore-agent.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/appcore-agent.c b/src/appcore-agent.c index a33301f..df898ea 100644 --- a/src/appcore-agent.c +++ b/src/appcore-agent.c @@ -752,10 +752,9 @@ static int __aul_handler(aul_type type, bundle *b, void *data) ret = __agent_terminate(data); break; case AUL_SUSPEND: - if (!ac->allowed_bg) { - _DBG("[__SUSPEND__] suspend"); - __add_suspend_timer(data); - } + ac->allowed_bg = false; + _DBG("[__SUSPEND__] suspend"); + __add_suspend_timer(data); break; case AUL_WAKE: if (!ac->allowed_bg) { @@ -763,6 +762,14 @@ static int __aul_handler(aul_type type, bundle *b, void *data) __remove_suspend_timer(data); __exit_from_suspend(data); } + + if (b) { + bundle_get_str(b, AUL_K_ALLOWED_BG, &bg); + if (bg && strcmp(bg, "ALLOWED_BG") == 0) { + _DBG("[__SUSPEND__] allowed background"); + ac->allowed_bg = true; + } + } break; default: /* do nothing */ -- 2.7.4