add features for pausing and resuming
authorkyeongwoo.lee <kyeongwoo.lee@samsung.com>
Tue, 7 May 2013 12:03:48 +0000 (21:03 +0900)
committerkyeongwoo.lee <kyeongwoo.lee@samsung.com>
Tue, 7 May 2013 12:04:09 +0000 (21:04 +0900)
Change-Id: I6a8e4970882b74d90f3ce1d87309a5f70a631631
Signed-off-by: kyeongwoo.lee <kyeongwoo.lee@samsung.com>
inc/FShell_AppWidgetContext.h
inc/FShell_AppWidgetContextBase.h
inc/FShell_AppWidgetManagerService.h
src/FShell_AppWidgetContext.cpp
src/FShell_AppWidgetContextBase.cpp
src/FShell_AppWidgetManagerService.cpp
src/FShell_AppWidgetManagerStub.cpp

index 2139818..283af6a 100644 (file)
 
 #include <provider.h>
 #include <provider_buffer.h>
-
 #include <FAppTypes.h>
 #include <FBaseRtTimer.h>
 #include <FBaseObject.h>
 #include <FBaseColArrayListT.h>
-
 #include "FShell_AppWidgetContextBase.h"
 
-
-#define MAX_PACKAGENAME  512
-
-
 namespace Tizen { namespace Shell  { namespace App
 {
+
 class _AppWidgetPopupContext;
+extern const int UPDATE_PERIOD_MSEC_MIN;
 
 class _AppWidgetContext
         : public _AppWidgetContextBase
@@ -59,13 +55,14 @@ public:
 
        virtual void OnPopupCreated(double x, double y, int width, int height);
        virtual void OnPopupDestoyed(void);
+       virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y);
 
        result RequestUpdateRemote(int width, int height);
-
        _AppWidgetPopupContext* GetAppWidgetPopup() const;
-       virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y);
 
-//     void RestartLifeDurationTimer();
+       bool IsPaused(void) const;
+       int GetPeriod(void) const;
+       long long GetLastUpdatedTime(void) const;
 
 private:
        result SendAddRequest(int width, int height);
@@ -94,14 +91,14 @@ private:
 
 private:
        _AppWidgetPopupContext* __pAppWidgetPopup;
-//     Tizen::Base::Runtime::Timer __lifeDurationTimer;
        Tizen::Base::Runtime::Timer __updateTimer;
        int __updateMillis;
+       long long __lastUpdatedTime;
        Tizen::Base::Collection::ArrayListT<PendingTouchEvent*>* __pPendingTouchEventList;
+       Tizen::Base::String __pendedArgument;
+       bool __hasPendingRequest;
 };
 
-
 } } } // Tizen::Shell::App {
 
-
 #endif // _FSHELL_INTERNAL_APPWIDGET_CONTEXT_H_
index 31259b7..1d8fbde 100644 (file)
 #define _FSHELL_INTERNAL_APPWIDGET_CONTEXT_BASE_H_
 
 #include <provider.h>
-
 #include <FAppTypes.h>
 #include <FBaseObject.h>
 #include <FBaseColHashMap.h>
 
 #define APPWIDGET_PROVIDER_ID_ENABLE true
 
-typedef struct _bundle_t bundle;//TODO move code to osp-appfw
+typedef struct _bundle_t bundle;       //TODO: move code to osp-appfw
 
 namespace Tizen { namespace Shell  { namespace App
 {
 
-class _AppWidgetContextBase:
-       public Tizen::Base::Object
+class _AppWidgetContextBase
+       public Tizen::Base::Object
 {
 protected:
        enum _AppWidgetProviderState
@@ -54,16 +53,18 @@ public:
 
        virtual void OnPopupCreated(double x, double y, int width, int height) = 0;
        virtual void OnPopupDestoyed(void) = 0;
-
        virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y) = 0;
 
        void SetIpcClientId(int clientId);
        bool HasValidClientId(void) const;
+
        // for buffered appWidget
        int GetSharedMemId(int w, int h);
        result ReleaseSharedMem(void);
 
        void Suspend(void);
+       Tizen::Base::String GetAppId(void) const;
+       Tizen::Base::String GetProviderName(void) const;
 
 protected:
        bool IsRunning(void) const;
@@ -97,8 +98,6 @@ class _AppWidgetRequestHelper
 {
 public:
        static result SendRequestToApp(const Tizen::App::AppId& appId, const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pArgs);
-//     static result AddStrArrayToBundle(bundle* b, const char* key, const Tizen::Base::Collection::IList* pList);
-//     static result ExtractPackageIdAndExecutableName(Tizen::App::AppId inAppId, Tizen::Base::String& outPackageId, Tizen::Base::String& outExecutableName);
 };
 
 extern const wchar_t ARG_KEY_INSTANCE_ID[];
index 154c0de..7eb4230 100644 (file)
 #include <FBaseString.h>
 #include <FBaseRtTimer.h>
 #include <FBaseColArrayListT.h>
+#include <FBaseColArrayList.h>
 
 #include "FShell_AppWidgetContext.h"
 #include "FShell_AppWidgetManagerStub.h"
 
 namespace Tizen { namespace Shell  { namespace App {
 
-
 class AppWidgetManagerService
        :public Tizen::Shell::App::_AppWidgetManagerStub
         ,public Tizen::Base::Runtime::ITimerEventListener
@@ -58,9 +58,9 @@ private:
        static int OnAppWidgetPopupCreate(struct event_arg *arg, void* data);
        static int OnAppWidgetPopupDestroy(struct event_arg *arg, void* data);
        static int OnAppWidgetPause(struct event_arg *arg, void* data);
-       static int OnAppWidgetResume(struct event_arg *arg, void* data);
+       static int OnAppWidgetResume(struct event_arg *pArg, void* pData);
        static int OnAppWidgetPauseAll(struct event_arg *arg, void* data);
-       static int OnAppWidgetResumeAll(struct event_arg *arg, void* data);
+       static int OnAppWidgetResumeAll(struct event_arg *pArg, void* pData);
        static int OnAppWidgetClick(struct event_arg *arg, void* data);
        static int OnAppWidgetResize(struct event_arg *arg, void* data);
        static int OnAppWidgetPeriodChaned(struct event_arg *arg, void* data);
@@ -91,7 +91,6 @@ private:
        virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
        _AppWidgetContext* Find(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId) const;
 
-
        class _TaskHandlerThread
                        : public Tizen::Base::Runtime::Thread
        {
index c06db2e..5dad3b4 100644 (file)
 
 #include <stdlib.h>
 #include <unique_ptr.h>
-
-#include "provider_buffer.h"
-
 #include <FBase.h>
 #include <FBaseSysLog.h>
+#include <FSysSystemTime.h>
 #include <FBase_StringConverter.h>
-
 #include <FApp_AppControlManager.h>
-
 #include "FShell_AppWidgetManagerService.h"
 #include "FShell_AppWidgetPopupContext.h"
 #include "FShell_AppWidgetContextBase.h"
 #include "FShell_AppWidgetContext.h"
 
-
 namespace Tizen { namespace Shell  { namespace App
 {
 
 using namespace Tizen::App;
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
+using namespace Tizen::System;
 
+const wchar_t APPWIDGET_ON_ADD[] = L"http://tizen.org/appcontrol/appwidget/add";
+const wchar_t APPWIDGET_ON_REMOVE[] = L"http://tizen.org/appcontrol/appwidget/remove";
+const wchar_t APPWIDGET_ON_UPDATE[] = L"http://tizen.org/appcontrol/appwidget/update";
+const wchar_t APPWIDGET_ON_RESIZE[] = L"http://tizen.org/appcontrol/appwidget/resize";
+const wchar_t APPWIDGET_ON_TOUCH[] = L"http://tizen.org/appcontrol/appwidget/touch";
 
-const char APPWIDGET_ON_ADD[] = "http://tizen.org/appcontrol/appwidget/add";
-const char APPWIDGET_ON_REMOVE[] = "http://tizen.org/appcontrol/appwidget/remove";
-const char APPWIDGET_ON_UPDATE[] = "http://tizen.org/appcontrol/appwidget/update";
-const char APPWIDGET_ON_RESIZE[] = "http://tizen.org/appcontrol/appwidget/resize";
-const char APPWIDGET_ON_TOUCH[] = "http://tizen.org/appcontrol/appwidget/touch";
-
-const int DEFAULT_LIFE_DURATION_MSEC = 30000;//30sec
-const int UPDATE_PERIOD_MSEC_MIN = 1800000;//30min
+const int UPDATE_PERIOD_MSEC_MIN = 1800000;    // 30min
 
 _AppWidgetContext::_AppWidgetContext(const String& info, const String& providerId, const String& instanceId, int width, int height, int period, int priority)
- :_AppWidgetContextBase(TYPE_LB, info, providerId, instanceId, width, height, priority)
- ,__pAppWidgetPopup(null)
- ,__updateMillis(period)
- ,__pPendingTouchEventList(null)
+       :_AppWidgetContextBase(TYPE_LB, info, providerId, instanceId, width, height, priority)
+       ,__pAppWidgetPopup(null)
+       ,__updateMillis(period)
+       ,__lastUpdatedTime(0)
+       ,__pPendingTouchEventList(null)
+       , __hasPendingRequest(false)
 {
-//     __lifeDurationTimer.Construct(*this);//, true);
-//     __lifeDurationTimer.Start(DEFAULT_LIFE_DURATION_MSEC );
-
-       __updateMillis = (__updateMillis > UPDATE_PERIOD_MSEC_MIN) ? __updateMillis : UPDATE_PERIOD_MSEC_MIN;
-       SysLog(NID_SHELL, "period(%d)", __updateMillis);
        if( __updateMillis > 0)
        {
-               __updateTimer.Construct(*this);//, false);
+               __updateMillis = (__updateMillis > UPDATE_PERIOD_MSEC_MIN) ? __updateMillis : UPDATE_PERIOD_MSEC_MIN;
+               SysLog(NID_SHELL, "period(%d)", __updateMillis);
+
+               SystemTime::GetTicks(this->__lastUpdatedTime);
+
+               __updateTimer.Construct(*this);
                __updateTimer.StartAsRepeatable(__updateMillis);
        }
 
@@ -77,7 +73,7 @@ _AppWidgetContext::_AppWidgetContext(const String& info, const String& providerI
 _AppWidgetContext::~_AppWidgetContext()
 {
        SysLog(NID_SHELL, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
-//     __lifeDurationTimer.Cancel();
+
        __updateTimer.Cancel();
 
        if (__pAppWidgetPopup)
@@ -87,10 +83,9 @@ _AppWidgetContext::~_AppWidgetContext()
                delete __pAppWidgetPopup;
        }
 
-
-       if( __pPendingTouchEventList )
+       if (__pPendingTouchEventList)
        {
-               forint i = 0; i < __pPendingTouchEventList->GetCount(); i++)
+               for (int i = 0; i < __pPendingTouchEventList->GetCount(); i++)
                {
                        PendingTouchEvent* pTouchEvent = null;
                        __pPendingTouchEventList->GetAt(i, pTouchEvent);
@@ -122,9 +117,33 @@ _AppWidgetContext::OnRemoved()
 void
 _AppWidgetContext::OnUpdate(const String& argument)
 {
-       SysLog(NID_SHELL, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
+       ClearLastResult();
+
+       AppWidgetManagerService* pMgrService = AppWidgetManagerService::GetInstance();
+       SysTryReturnVoidResult(NID_SHELL, pMgrService, E_SYSTEM, "[E_SYSTEM] Failed to get an instance of AppWidgetManagerService.");
+
+       // Queueing the pointer of paused context.
+       if (this->IsPaused())
+       {
+               // Saving the data
+               if (!argument.IsEmpty())
+               {
+                       __pendedArgument = argument;
+               }
+
+               __hasPendingRequest = true;
+               SysLog(NID_SHELL, "Update is requested but the %ls is paused.", (this->GetAppId()).GetPointer());
+       }
+       else
+       {
+               this->SendUpdateRequest(__width, __height, argument);
 
-       SendUpdateRequest(__width, __height, argument);
+               SystemTime::GetTicks(this->__lastUpdatedTime);
+               SysLog(NID_SHELL, "The last updated time is %lld.", this->__lastUpdatedTime);
+
+               __hasPendingRequest = false;
+               __pendedArgument.Clear();
+       }
 }
 
 void
@@ -140,19 +159,57 @@ _AppWidgetContext::OnResize(int width, int height)
 void
 _AppWidgetContext::OnForeground()
 {
-       SysLog(NID_SHELL, "");
+       SysLog(NID_SHELL, "OnForeground");
+
+       if (__isForeground)
+       {
+               SysLog(NID_SHELL, "%ls is already resumed.", (this->GetAppId()).GetPointer());
+               return;
+       }
+
        __isForeground = true;
 
-       __updateTimer.Cancel();
-       __updateTimer.StartAsRepeatable(__updateMillis);
+       if (__hasPendingRequest == true)
+       {
+               OnUpdate(__pendedArgument);
+       }
+       else
+       {
+               if (this->GetPeriod() > 0)
+               {
+                       long long currentTicks = 0;
+                       SystemTime::GetTicks(currentTicks);
+
+                       SysLog(NID_SHELL, "current[%lld] - updatedTime[%lld] = [%lld], period[%d]",
+                                       currentTicks, this->GetLastUpdatedTime(), currentTicks - this->GetLastUpdatedTime(), this->GetPeriod());
+
+                       bool isPeriodExpired = (currentTicks - this->GetLastUpdatedTime()) >= (this->GetPeriod());
+                       if (isPeriodExpired)
+                       {
+                               SysLog(NID_SHELL, "The period is expired.");
+                               OnUpdate(L"");
+                       }
+               }
+       }
 }
 
 void
 _AppWidgetContext::OnBackground()
 {
-       SysLog(NID_SHELL, "");
+       SysLog(NID_SHELL, "OnBackground");
+
+       if (!__isForeground)
+       {
+               SysLog(NID_SHELL, "%ls is already paused.", (this->GetAppId()).GetPointer());
+               return;
+       }
        __isForeground = false;
-       __updateTimer.Cancel();
+}
+
+bool
+_AppWidgetContext::IsPaused(void) const
+{
+       return __isForeground ? false : true;
 }
 
 void
@@ -161,21 +218,19 @@ _AppWidgetContext::OnPopupCreated(double x, double y, int width, int height)
        __pAppWidgetPopup = new (std::nothrow) _AppWidgetPopupContext(__userInfo, __providerId, __instanceId, width, height, __priority, this);
        __pAppWidgetPopup->SetIpcClientId(__ipcClientId);
        __pAppWidgetPopup->OnPopupCreated(x, y, width, height);
-
-//     __lifeDurationTimer.Cancel();
 }
 
 void
 _AppWidgetContext::OnPopupDestoyed(void)
 {
        SysLog(NID_SHELL, "");
+
        if (__pAppWidgetPopup)
        {
                __pAppWidgetPopup->OnPopupDestoyed();
                delete __pAppWidgetPopup;
                __pAppWidgetPopup = null;
        }
-//     RestartLifeDurationTimer();
 }
 
 result
@@ -239,7 +294,6 @@ _AppWidgetContext::SendTouchEvent(buffer_event eventType, double timeStamp, doub
                SysLog(NID_SHELL, "request to start AppControl");
                __pPendingTouchEventList->Add(new PendingTouchEvent(eventType, timeStamp, x, y));
 
-               //
                std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgsN() );
 
                pArgs->Add(new String(ARG_KEY_EVENT_TYPE), new String(Integer::ToString(eventType)));
@@ -255,20 +309,12 @@ _AppWidgetContext::SendTouchEvent(buffer_event eventType, double timeStamp, doub
 result
 _AppWidgetContext::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs)
 {
-       result r = _AppWidgetContextBase::SendRequestToApp(appId, operation, pArgs);
-//     RestartLifeDurationTimer();
-
-       return r;
+       return _AppWidgetContextBase::SendRequestToApp(appId, operation, pArgs);
 }
 
 result
 _AppWidgetContext::RequestUpdateRemote(int width, int height)
 {
-       /*if( GetAppWidgetPopup() != null)
-       {
-               SysLog(NID_SHELL, "AppWidgetPopup is appeared, so appWidget doesn't need to update");
-               return E_SUCCESS;
-       }*/
        std::unique_ptr<char[]> packageName(_StringConverter::CopyToCharArrayN(__providerId));
        std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(__instanceId));
        std::unique_ptr<char[]> content_info(_StringConverter::CopyToCharArrayN(__userInfo));
@@ -295,34 +341,28 @@ _AppWidgetContext::CreateRequestArgsN(void)
        return pArgs;
 }
 
+int
+_AppWidgetContext::GetPeriod(void) const
+{
+       SysLog(NID_SHELL, "GetPeriod[%d]", __updateMillis);
+       return __updateMillis;
+}
 
-//void
-//_AppWidgetContext::RestartLifeDurationTimer()
-//{
-//     __lifeDurationTimer.Cancel();
-//     __lifeDurationTimer.Start(DEFAULT_LIFE_DURATION_MSEC);
-//     SysLog(NID_SHELL, "lifeDuration timer restarted (%d)msec", DEFAULT_LIFE_DURATION_MSEC);
-//}
+long long
+_AppWidgetContext::GetLastUpdatedTime(void) const
+{
+       return __lastUpdatedTime;
+}
 
 void
 _AppWidgetContext::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
 {
-//     if( &timer == &__lifeDurationTimer)
-//     {
-//             SysLog(NID_SHELL, "lifeDuration timer is expired, so terminating appWidget app(%ls)..", __providerId.GetPointer() );
-//
-////           ReleaseSharedMem();
-//             AppManager::GetInstance()->TerminateApplication(__appId);
-//
-//     }
-//     else
-       if( &timer == &__updateTimer)
+       if (&timer == &__updateTimer)
        {
-               SysLog(NID_SHELL, "update timer is expired for appWidget app(%ls)..", __providerId.GetPointer() );
+               SysLog(NID_SHELL, "update timer is expired for appWidget app(%ls)..", __providerId.GetPointer());
                OnUpdate(L"");
        }
 }
 
-
-} } } // Tizen::Shell::App {
+} } } // Tizen::Shell::App
 
index 8643800..70901b1 100644 (file)
 
 #include <stdlib.h>
 #include <unique_ptr.h>
-
-#include "provider_buffer.h"
-
+#include <provider_buffer.h>
 #include <FBase.h>
 #include <FBaseSysLog.h>
 #include <FBase_StringConverter.h>
-
 #include <FApp_AppMessageImpl.h>
 #include <FApp_AppArg.h>
 #include <FApp_AppControlManager.h>
 #include <FShell_TemplateUtil.h>
 #include <FShell_AppWidgetManagerImpl.h>
-
 #include "FShell_AppWidgetContextBase.h"
 
 // provider/src/fb.c
@@ -73,7 +69,7 @@ struct livebox_buffer {
        void *data;
 };
 
-static int AppWidgetHandleBufferEventCallback( struct livebox_buffer *info, enum buffer_event event,
+static int AppWidgetHandleBufferEventCallback(struct livebox_buffer *info, enum buffer_event event,
                double timestamp, double x, double y, void* data);
 
 namespace Tizen { namespace Shell  { namespace App
@@ -83,7 +79,6 @@ using namespace Tizen::App;
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 
-
 const wchar_t ARG_KEY_INSTANCE_ID[] = L"_InstanceId";
 const wchar_t ARG_KEY_PROVIDER_NAME[] = L"_ProviderName";
 const wchar_t ARG_KEY_USER_INFO[] = L"_UserInfo";
@@ -219,15 +214,21 @@ _AppWidgetContextBase::ReleaseSharedMem()
 result
 _AppWidgetContextBase::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs)
 {
-       /*if( __isForeground == false)
-       {
-               SysLog(NID_SHELL, "appWidget isn't foreground, so, message skip");
-               return E_SUCCESS;
-       }*/
-
        return _AppWidgetRequestHelper::SendRequestToApp(appId, operation, pArgs);
 }
 
+String
+_AppWidgetContextBase::GetAppId(void) const
+{
+       return __appId;
+}
+
+String
+_AppWidgetContextBase::GetProviderName(void) const
+{
+       return __providerName;
+}
+
 result
 _AppWidgetRequestHelper::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs)
 {
@@ -257,10 +258,6 @@ static int AppWidgetHandleBufferEventCallback( struct livebox_buffer *info, enum
     Tizen::Shell::App::_AppWidgetContextBase *pAppWidgetBase = static_cast<Tizen::Shell::App::_AppWidgetContextBase*>(data);
     SysTryReturn(NID_SHELL, pAppWidgetBase != null, 0, E_SYSTEM, "[E_SYSTEM] retrieved pAppWidgetBase is null");
 
-//    const char *pkgname = provider_buffer_pkgname(info);
-//    const char *id = provider_buffer_id(info);
-//    enum target_type type = provider_buffer_type(info);
-
     if( event ==  BUFFER_EVENT_ENTER)
     {
        SysLog(NID_SHELL, "BUFFER_EVENT_ENTER");
index 26e9abc..1f51a0b 100644 (file)
@@ -48,14 +48,16 @@ using namespace Tizen::Io;
 using namespace Tizen::System;
 using namespace Tizen::Shell::App;
 
-
 namespace
 {
 static const RequestId LOCAL_EVENT_REQUEST_UPDATE = 0;
 }
 
+extern const int UPDATE_PERIOD_MSEC_MIN;
+
 AppWidgetManagerService::AppWidgetManagerService()
 {
+
 }
 
 AppWidgetManagerService::~AppWidgetManagerService()
@@ -83,15 +85,13 @@ AppWidgetManagerService::GetInstance(void)
 result
 AppWidgetManagerService::Construct()
 {
-//     _AppManagerImpl::GetInstance()->AddEventListener(*this);
-
        _AppWidgetManagerStub::StartIpcServer();
 
        result r = __handlerThread.Construct(THREAD_TYPE_EVENT_DRIVEN);
-       SysTryReturn(NID_SHELL, IsFailed(r) == false, false, r, "[%s] Event thread creation failure.", GetErrorMessage(r));
+       SysTryReturnResult(NID_SHELL, IsFailed(r) == false, r, "Event thread creation failure.");
 
        r = __handlerThread.Start();
-       SysTryReturn(NID_SHELL, IsFailed(r) == false, false, r, "[%s] Event thread Start failure.", GetErrorMessage(r));
+       SysTryReturnResult(NID_SHELL, IsFailed(r) == false, r, "Event thread Start failure.");
 
        return InitializeMasterDaemonEventReceiver("osp-appwidget-service");
 }
@@ -361,29 +361,51 @@ AppWidgetManagerService::OnAppWidgetPause(struct event_arg *arg, void* data)
 }
 
 int
-AppWidgetManagerService::OnAppWidgetResume(struct event_arg *arg, void* data)
+AppWidgetManagerService::OnAppWidgetPauseAll(struct event_arg *arg, void* data)
 {
-       SysTryReturn(NID_SHELL, arg || arg->id || arg->pkgname, 0, E_SUCCESS, "arg is null!");
+        SysLog(NID_SHELL, "OnAppWidgetPauseAll");
 
-       _AppWidgetContext* pAppWidgetContext = AppWidgetManagerService::GetInstance()->Find(arg->pkgname, arg->id);
-       SysTryReturnResult(NID_SHELL, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
+       AppWidgetManagerService* pAppManagerService = AppWidgetManagerService::GetInstance();
+
+       for (int i = 0; i < (pAppManagerService->__appWidgetContextList).GetCount(); i++)
+       {
+               _AppWidgetContext* pAppWidgetContext = null;
+               (pAppManagerService->__appWidgetContextList).GetAt(i, pAppWidgetContext);
+
+               pAppWidgetContext->OnBackground();
+       }
 
-       SysLog(NID_SHELL, "packageName(%s), id(%s)", arg->pkgname, arg->id);
-       pAppWidgetContext->OnForeground();
     return 0;
 }
 
 int
-AppWidgetManagerService::OnAppWidgetPauseAll(struct event_arg *arg, void* data)
+AppWidgetManagerService::OnAppWidgetResume(struct event_arg *pArg, void* pData)
 {
-       SysLog(NID_SHELL,"");
-    return 0;
+       SysTryReturn(NID_SHELL, pArg || pArg->id || pArg->pkgname, 0, E_SUCCESS, "pArg is null!");
+
+       _AppWidgetContext* pAppWidgetContext = AppWidgetManagerService::GetInstance()->Find(pArg->pkgname, pArg->id);
+       SysTryReturnResult(NID_SHELL, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", pArg->pkgname, pArg->id);
+
+       SysLog(NID_SHELL, "packageName(%s), id(%s)", pArg->pkgname, pArg->id);
+       pAppWidgetContext->OnForeground();
+       return 0;
 }
 
 int
-AppWidgetManagerService::OnAppWidgetResumeAll(struct event_arg *arg, void* data)
+AppWidgetManagerService::OnAppWidgetResumeAll(struct event_arg *pArg, void* pData)
 {
-       SysLog(NID_SHELL,"");
+       SysLog(NID_SHELL, "OnAppWidgetResumeAll");
+
+       AppWidgetManagerService* pAppManagerService = AppWidgetManagerService::GetInstance();
+
+       for (int i = 0; i < (pAppManagerService->__appWidgetContextList).GetCount(); i++)
+       {
+               _AppWidgetContext* pAppWidgetContext = null;
+               (pAppManagerService->__appWidgetContextList).GetAt(i, pAppWidgetContext);
+
+               pAppWidgetContext->OnForeground();
+       }
+
     return 0;
 }
 
@@ -510,7 +532,6 @@ AppWidgetManagerService::RequestUpdate(const Tizen::App::AppId& appId, const Tiz
        }
        SysLog(NID_SHELL, "Exit.");
        return (found) ? E_SUCCESS : E_OBJ_NOT_FOUND;
-
 }
 
 result
index d1e112f..729426c 100644 (file)
 #include <FBaseSysLog.h>
 #include <FIo_IpcServer.h>
 #include <FShell_AppWidgetManagerIpcMessage.h>
-
 #include "FShell_AppWidgetManagerStub.h"
 
-
 namespace Tizen { namespace Shell  { namespace App {
 
 namespace