From: jungmin76.park Date: Mon, 22 Apr 2013 12:00:26 +0000 (+0900) Subject: add PauseLifeDurationTimer internal API for AppWidgetPopup X-Git-Tag: accepted/tizen_2.1/20130425.034849~15^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=89da94792c4a09df29d9b3b6e1d20772886d61b9;p=platform%2Fframework%2Fnative%2Fappfw.git add PauseLifeDurationTimer internal API for AppWidgetPopup Change-Id: I0dcf24cc225744a2ecc611a43d1059ff962ec6bf Signed-off-by: jungmin76.park --- diff --git a/src/app/FApp_ServiceAppImpl.cpp b/src/app/FApp_ServiceAppImpl.cpp index 48f19bf..6095ad0 100644 --- a/src/app/FApp_ServiceAppImpl.cpp +++ b/src/app/FApp_ServiceAppImpl.cpp @@ -62,9 +62,10 @@ _ServiceAppImpl* _ServiceAppImpl::__pServiceAppImpl = null; _ServiceAppImpl::_ServiceAppImpl(ServiceApp* pServiceApp) : __pAppImpl(_AppImpl::GetInstance()) , __pServiceApp(pServiceApp) - , __pLifeDurationEventListener(null) + , __pAppTerminatingInternalEventListener(null) , __pLifeDurationTimer(null) , __lifeDuration(0) + , __pauseLifeDurationTimer(false) { __pServiceAppImpl = this; SysTryReturnVoidResult(NID_APP, __pAppImpl, E_INVALID_STATE, "[E_INVALID_STATE] Getting internal instance failed."); @@ -147,7 +148,7 @@ _ServiceAppImpl::OnService(service_s* service, bool initial) free(pOperation); } - if( __lifeDuration > 0) + if( __lifeDuration > 0 && __pauseLifeDurationTimer == false) { SetLifeDurationTimer(__lifeDuration); } @@ -278,6 +279,11 @@ bool _ServiceAppImpl::OnServiceAppImplTerminating(bool forcedTermination) { SysTryReturn(NID_APP, __pServiceApp != null, false, E_INVALID_STATE, "[E_INVALID_STATE] Getting ServiceApp instance failed."); + + if( __pAppTerminatingInternalEventListener) + { + __pAppTerminatingInternalEventListener->OnApplicationTerminated(L"", 0); + } return __pServiceApp->OnAppTerminating(*(AppRegistry::GetInstance()), forcedTermination); } @@ -300,8 +306,12 @@ _ServiceAppImpl::SetLifeDurationTimer(int lifeDuration) __pLifeDurationTimer->Cancel(); SysLog(NID_APP, "Life duration timer is cancelled.", lifeDuration ); } - __pLifeDurationTimer->Start(__lifeDuration); - SysLog(NID_APP, "Life duration timer is started with timeout.(%d)", lifeDuration ); + + if( __pauseLifeDurationTimer == false) + { + __pLifeDurationTimer->Start(lifeDuration); + SysLog(NID_APP, "Life duration timer is started with timeout.(%d)", lifeDuration ); + } } void @@ -309,17 +319,32 @@ _ServiceAppImpl::OnTimerExpired(Timer& timer) { SysLog(NID_APP, "Life duration timer is expired, so terminating the application."); timer.Cancel(); - if( __pLifeDurationEventListener) + App::GetInstance()->Terminate(); +} + +void +_ServiceAppImpl::SetAppTerminatingInternalEventListener(_IAppEventListener* pListener) +{ + __pAppTerminatingInternalEventListener = pListener; +} + +void +_ServiceAppImpl::PauseLifeDurationTimer(void) +{ + __pauseLifeDurationTimer = true; + if( __pLifeDurationTimer) { - __pLifeDurationEventListener->OnApplicationTerminated(L"", 0); + __pLifeDurationTimer->Cancel(); + SysLog(NID_APP, "Life duration timer is paused." ); } - App::GetInstance()->Terminate(); } void -_ServiceAppImpl::SetLifeDurationEventListener(_IAppEventListener* pListener) +_ServiceAppImpl::ResumeLifeDurationTimer(void) { - __pLifeDurationEventListener = pListener; + __pauseLifeDurationTimer = false; +// SetLifeDurationTimer(__lifeDuration); + SysLog(NID_APP, "Life duration timer will be resumed." ); } } } //Tizen::App diff --git a/src/app/inc/FApp_ServiceAppImpl.h b/src/app/inc/FApp_ServiceAppImpl.h index ec817c2..6b04a91 100644 --- a/src/app/inc/FApp_ServiceAppImpl.h +++ b/src/app/inc/FApp_ServiceAppImpl.h @@ -183,7 +183,11 @@ public: result Execute(void); - void SetLifeDurationEventListener(_IAppEventListener* pListener); + void SetAppTerminatingInternalEventListener(_IAppEventListener* pListener); + + void PauseLifeDurationTimer(void); + + void ResumeLifeDurationTimer(void); private: /** @@ -229,12 +233,14 @@ private: ServiceApp* __pServiceApp; - _IAppEventListener* __pLifeDurationEventListener; + _IAppEventListener* __pAppTerminatingInternalEventListener; Tizen::Base::Runtime::Timer* __pLifeDurationTimer; int __lifeDuration; + bool __pauseLifeDurationTimer; + friend class ServiceApp; }; // _ServiceAppImpl