replace the data type from ArrayListT to HashMapT
authorkyeongwoo.lee <kyeongwoo.lee@samsung.com>
Wed, 19 Jun 2013 06:00:03 +0000 (15:00 +0900)
committerkyeongwoo.lee <kyeongwoo.lee@samsung.com>
Wed, 19 Jun 2013 08:23:03 +0000 (17:23 +0900)
Change-Id: Ief75b7614e90eccd89f07d027404f3ac3fd7fa39
Signed-off-by: kyeongwoo.lee <kyeongwoo.lee@samsung.com>
CMakeLists.txt
inc/FShell_AppWidgetContext.h
inc/FShell_AppWidgetContextBase.h
inc/FShell_AppWidgetContextHelper.h [new file with mode: 0644]
inc/FShell_AppWidgetManagerService.h
src/FShell_AppWidgetContext.cpp
src/FShell_AppWidgetContextBase.cpp
src/FShell_AppWidgetContextHelper.cpp [new file with mode: 0644]
src/FShell_AppWidgetManagerService.cpp

index d0bf6ef1d72e51c000e0175eeb31e05e54f5757e..9c52ed1732823fb9b91b1d2351c49de972f987d1 100644 (file)
@@ -32,6 +32,7 @@ SET (${this_target}_SOURCE_FILES
        src/FShell_AppWidgetManagerService.cpp
        src/FShell_AppWidgetManagerStub.cpp
        src/FShell_AppWidgetPopupContext.cpp
+       src/FShell_AppWidgetContextHelper.cpp
        )
 
 ## SET EXTRA COMPILER FLAGS
index 9dd32dacd343ad065e09290aa63ed4b361f3ae6b..bfe5b734f6a11a42aac3655dfc98840f1e06d571 100644 (file)
@@ -95,10 +95,9 @@ private:
 
        struct PendingEvent
        {
-               PendingEvent(const Tizen::Base::String& instanceId, const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pHashMap)
-                : instanceId(instanceId), operation(operation), pArg(pHashMap) {  }
+               PendingEvent(const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pHashMap)
+                : operation(operation), pArg(pHashMap) {  }
 
-               Tizen::Base::String instanceId;
                Tizen::Base::String operation;
                Tizen::Base::Collection::HashMap* pArg;
        };
index 524fead22fa41d15b3ecdef156e15572c400020f..e9b40cd6b6a4117312db25350b446022837d1978 100644 (file)
@@ -100,14 +100,6 @@ private:
 
 };     // class _AppWidgetContextBase
 
-class _AppWidgetRequestHelper
-{
-public:
-       static result SendRequestToApp(const Tizen::App::AppId& appId, const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pArgs);
-       static result SendRequestToApp(const int clientId, const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pArgs);
-
-};     // class _AppWidgetRequestHelper
-
 extern const Tizen::Base::String ARG_KEY_INSTANCE_ID;
 extern const Tizen::Base::String ARG_KEY_PROVIDER_NAME;
 extern const Tizen::Base::String ARG_KEY_USER_INFO;
diff --git a/inc/FShell_AppWidgetContextHelper.h b/inc/FShell_AppWidgetContextHelper.h
new file mode 100644 (file)
index 0000000..ee91232
--- /dev/null
@@ -0,0 +1,40 @@
+//
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.1 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file       FShell_AppWidgetContextHelper.h
+ * @brief      This is the header file for the _AppWidgetContextHelper class.
+ *
+ * This header file contains the declarations of the _AppWidgetContextHelper class.
+ */
+
+#ifndef _FSHELL_APPWIDGET_CONTEXT_HELPER_H_
+#define _FSHELL_APPWIDGET_CONTEXT_HELPER_H_
+
+namespace Tizen { namespace Shell  { namespace App
+{
+
+class _AppWidgetRequestHelper
+{
+public:
+       static result SendAppControlRequest(const Tizen::App::AppId& appId, const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pArgs);
+       static result SendIpcRequest(const int clientId, const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pArgs);
+
+};     // class _AppWidgetRequestHelper
+
+}}} // Tizen::Shell::App
+
+#endif // _FSHELL_APPWIDGET_CONTEXT_HELPER_H_
index 135dff455d7eb65c702ca3302b4fd133764875af..dda360ba4640cc987d98450a3d1e205877e0dc37 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <FBaseRtTimer.h>
 #include <FBaseRtThread.h>
-#include <FBaseColArrayListT.h>
+#include <FBaseColHashMapT.h>
 #include <FSysISettingEventListener.h>
 #include "FShell_AppWidgetContext.h"
 #include "FShell_AppWidgetManagerStub.h"
@@ -115,7 +115,7 @@ private:
 
 private:
        static AppWidgetManagerService* __pTheInstance;
-       Tizen::Base::Collection::ArrayListT<_AppWidgetContext*> __appWidgetContextList;
+       Tizen::Base::Collection::HashMapT<Tizen::Base::String, _AppWidgetContext*> __appWidgetContextList;
        Tizen::Base::Runtime::Timer __pingTimer;
        _TaskHandlerThread      __handlerThread;
 
index 7c49f629e377965880670f18d3a458865ffa7550..ca9d58434b708589d4452ffe4fce426ad7c53bc4 100644 (file)
@@ -34,6 +34,7 @@
 #include "FShell_AppWidgetManagerService.h"
 #include "FShell_AppWidgetPopupContext.h"
 #include "FShell_AppWidgetContext.h"
+#include "FShell_AppWidgetContextHelper.h"
 
 namespace Tizen { namespace Shell  { namespace App
 {
@@ -60,6 +61,7 @@ _AppWidgetContext::_AppWidgetContext(const String& info, const String& providerI
        ,__pPendingEventList(null)
        , __hasPendingRequest(false)
 {
+       // for updating period
        if (__updateMillis > 0)
        {
                __updateMillis = (__updateMillis > UPDATE_PERIOD_MSEC_MIN) ? __updateMillis : UPDATE_PERIOD_MSEC_MIN;
@@ -76,8 +78,6 @@ _AppWidgetContext::_AppWidgetContext(const String& info, const String& providerI
 
        __pPendingEventList = new ArrayListT<PendingEvent*>();
        __pPendingEventList->Construct();
-
-
 }
 
 _AppWidgetContext::~_AppWidgetContext(void)
@@ -316,8 +316,9 @@ _AppWidgetContext::SendPendingEvent(void)
        if (pEvent != null)
        {
                SysLog(NID_SHELL, "SendPendingEvent by IPC [%d existed.]", __pPendingEventList->GetCount());
-               _AppWidgetRequestHelper::SendRequestToApp(GetClientId(), pEvent->operation, pEvent->pArg);
+               _AppWidgetRequestHelper::SendIpcRequest(GetClientId(), pEvent->operation, pEvent->pArg);
                __pPendingEventList->RemoveAt(0);
+               delete pEvent;
        }
        else
        {
@@ -385,15 +386,15 @@ _AppWidgetContext::SendRequestToApp(const AppId& appId, const String& operation,
                if(!HasValidClientId())
                {
                        SysLog(NID_SHELL, "The application is running but IPC is not connected yet.");
-                       __pPendingEventList->Add(new PendingEvent(*new String(GetInstanceId()), *new String(operation), pArgs));
+                       __pPendingEventList->Add(new PendingEvent(*new String(operation), pArgs));
                }
                else
                {
                        SysLog(NID_SHELL, "The application is running and IPC is connected.");
-                       r  = _AppWidgetRequestHelper::SendRequestToApp(GetClientId(), operation, pArgs);
+                       r  = _AppWidgetRequestHelper::SendIpcRequest(GetClientId(), operation, pArgs);
 
-//                     pArgs->RemoveAll(true);
-//                     delete pArgs;
+                       pArgs->RemoveAll(true);
+                       delete pArgs;
                }
        }
 
index 3934ec5b2303966149e678085ba9aa2c317f5320..8a04cb02eae809b2fcb87a331ee6cc241247acfd 100644 (file)
 #include <FBaseSysLog.h>
 #include <FBaseRt.h>
 #include <FBase_StringConverter.h>
-#include <FApp_AppMessageImpl.h>
-#include <FApp_AppArg.h>
-#include <FApp_AppControlManager.h>
 #include "FShell_AppWidgetManagerImpl.h"
 #include "FShell_AppWidgetContextBase.h"
 #include "FShell_AppWidgetManagerService.h"
+#include "FShell_AppWidgetContextHelper.h"
 
 // provider/src/fb.c
 struct fb_info {
@@ -212,7 +210,7 @@ _AppWidgetContextBase::ReleaseSharedMem(void)
 result
 _AppWidgetContextBase::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs)
 {
-       result r = _AppWidgetRequestHelper::SendRequestToApp(appId, operation, pArgs);
+       result r = _AppWidgetRequestHelper::SendAppControlRequest(appId, operation, pArgs);
        SysTryReturnResult(NID_SHELL, !IsFailed(r), E_SYSTEM, "Failed to SendRequestToApp");
 
        return r;
@@ -296,62 +294,6 @@ _AppWidgetContextBase::SetHeight(int height)
        __height = height;
 }
 
-result
-_AppWidgetRequestHelper::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs)
-{
-       const String* pInstanceId = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_INSTANCE_ID));
-       SysTryReturnResult(NID_SHELL, pInstanceId, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_INSTANCE_ID.GetPointer() );
-
-       SysSecureLog(NID_SHELL, "[ac] pInstanceId(%ls), operation(%ls), appId(%ls), arg count(%d)", pInstanceId->GetPointer(), operation.GetPointer(), appId.GetPointer(), pArgs->GetCount());
-
-       _AppMessageImpl msg;
-       msg.AddData(OSP_K_APPCONTROL_INTERNAL_OPERATION, L"appwidget");
-       Tizen::App::_AppArg::AddStrMap(msg.GetBundle(), pArgs);
-
-       std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId) );
-       std::unique_ptr<char[]> pOperation(_StringConverter::CopyToCharArrayN(operation) );
-
-       const int TRY_COUNT = 3;
-       const int TRY_SLEEP_TIME = 65;
-
-       int retry = 0;
-
-       result r = E_FAILURE;
-       while (true)
-       {
-               r = Tizen::App::_AppControlManager::GetInstance()->LaunchPkg(msg, pAppId.get(), pOperation.get(), null, null, null, null);
-               if( r == E_SUCCESS)
-               {
-                       SysLog(NID_SHELL, "[%s] Successed to invoke LaunchPkg()", GetErrorMessage(r));
-                       break;
-               }
-
-               if( retry ++ >= TRY_COUNT)
-               {
-                       break;
-               }
-
-               SysLog(NID_SHELL, "[%s] Failed to invoke LaunchPkg(%s), %dth retry.", GetErrorMessage(r), pOperation.get(), retry);
-               Tizen::Base::Runtime::Thread::Sleep(TRY_SLEEP_TIME);
-       }
-
-       return r;
-}
-
-result
-_AppWidgetRequestHelper::SendRequestToApp(const int clientId, const String& operation, HashMap* pArgs)
-{
-       const String* pInstanceId = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_INSTANCE_ID));
-       SysTryReturnResult(NID_SHELL, pInstanceId, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_INSTANCE_ID.GetPointer() );
-
-       SysSecureLog(NID_SHELL, "[ipc] pInstanceId(%ls), operation(%ls), clientId(%d)", pInstanceId->GetPointer(), operation.GetPointer(), clientId);
-
-       bool sendResult = AppWidgetManagerService::GetInstance()->SendAppWidgetEvent(clientId, *pInstanceId, operation, pArgs);
-       SysTryReturnResult(NID_SHELL, sendResult, E_FAILURE, "Propagated.");
-
-       return E_SUCCESS;
-}
-
 }}} // Tizen::Shell::App
 
 ////////////////////////////////////////////
diff --git a/src/FShell_AppWidgetContextHelper.cpp b/src/FShell_AppWidgetContextHelper.cpp
new file mode 100644 (file)
index 0000000..0300d53
--- /dev/null
@@ -0,0 +1,96 @@
+//
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.1 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file       FShell_AppWidgetContextHelper.cpp
+ * @brief      This is the implementation for the _AppWidgetContextHelper class.
+ */
+
+#include <unique_ptr.h>
+#include <FBaseColHashMap.h>
+#include <FBaseString.h>
+#include <FAppTypes.h>
+#include <FBase_StringConverter.h>
+#include <FApp_AppArg.h>
+#include <FApp_AppMessageImpl.h>
+#include <FApp_AppControlManager.h>
+#include "FShell_AppWidgetContextHelper.h"
+#include "FShell_AppWidgetManagerService.h"
+
+namespace Tizen { namespace Shell  { namespace App
+{
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+result
+_AppWidgetRequestHelper::SendAppControlRequest(const AppId& appId, const String& operation, HashMap* pArgs)
+{
+       const String* pInstanceId = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_INSTANCE_ID));
+       SysTryReturnResult(NID_SHELL, pInstanceId, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_INSTANCE_ID.GetPointer() );
+
+       SysSecureLog(NID_SHELL, "[ac] pInstanceId(%ls), operation(%ls), appId(%ls), arg count(%d)", pInstanceId->GetPointer(), operation.GetPointer(), appId.GetPointer(), pArgs->GetCount());
+
+       _AppMessageImpl msg;
+       msg.AddData(OSP_K_APPCONTROL_INTERNAL_OPERATION, L"appwidget");
+       Tizen::App::_AppArg::AddStrMap(msg.GetBundle(), pArgs);
+
+       std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId) );
+       std::unique_ptr<char[]> pOperation(_StringConverter::CopyToCharArrayN(operation) );
+
+       const int TRY_COUNT = 3;
+       const int TRY_SLEEP_TIME = 65;
+
+       int retry = 0;
+
+       result r = E_FAILURE;
+       while (true)
+       {
+               r = Tizen::App::_AppControlManager::GetInstance()->LaunchPkg(msg, pAppId.get(), pOperation.get(), null, null, null, null);
+               if( r == E_SUCCESS)
+               {
+                       SysLog(NID_SHELL, "[%s] Successed to invoke LaunchPkg()", GetErrorMessage(r));
+                       break;
+               }
+
+               if( retry ++ >= TRY_COUNT)
+               {
+                       break;
+               }
+
+               SysLog(NID_SHELL, "[%s] Failed to invoke LaunchPkg(%s), %dth retry.", GetErrorMessage(r), pOperation.get(), retry);
+               Tizen::Base::Runtime::Thread::Sleep(TRY_SLEEP_TIME);
+       }
+
+       return r;
+}
+
+result
+_AppWidgetRequestHelper::SendIpcRequest(const int clientId, const String& operation, HashMap* pArgs)
+{
+       const String* pInstanceId = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_INSTANCE_ID));
+       SysTryReturnResult(NID_SHELL, pInstanceId, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_INSTANCE_ID.GetPointer() );
+
+       SysSecureLog(NID_SHELL, "[ipc] pInstanceId(%ls), operation(%ls), clientId(%d)", pInstanceId->GetPointer(), operation.GetPointer(), clientId);
+
+       bool sendResult = AppWidgetManagerService::GetInstance()->SendAppWidgetEvent(clientId, *pInstanceId, operation, pArgs);
+       SysTryReturnResult(NID_SHELL, sendResult, E_FAILURE, "Propagated.");
+
+       return E_SUCCESS;
+}
+
+}}}  // Tizen::Shell::App
index 47d551d47e3e91cff12a9810b4d27aaba6104695..6cc2d4aeef51f9969b75850806778c4ede0041f5 100644 (file)
 #include <FBaseColIList.h>
 #include <FAppApp.h>
 #include <FSystem.h>
+#include <FBaseComparerT.h>
 #include <FApp_AppManagerImpl.h>
 #include <FIo_IpcServer.h>
 #include <FBase_StringConverter.h>
+#include <FBase.h>
 #include "FShell_AppWidgetContext.h"
 #include "FShell_AppWidgetPopupContext.h"
 #include "FShell_AppWidgetManagerStub.h"
 #include "FShell_AppWidgetManagerService.h"
+#include "FShell_TemplateUtil.h"
 
 namespace Tizen { namespace Shell  { namespace App {
 
+using namespace std;
 using namespace Tizen::App;
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
@@ -148,17 +152,10 @@ AppWidgetManagerService::OnTimerExpired(Timer& timer)
 _AppWidgetContext*
 AppWidgetManagerService::Find(const String& appId, const String& instanceId) const
 {
-       for (int i = 0; i < __appWidgetContextList.GetCount(); i++)
-       {
-               _AppWidgetContext* pAppWidgetContext = null;
-               __appWidgetContextList.GetAt(i, pAppWidgetContext);
+       _AppWidgetContext* pAppWidgetContext = null;
+       __appWidgetContextList.GetValue(instanceId, pAppWidgetContext);
 
-               if (pAppWidgetContext->GetInstanceId() == instanceId)
-               {
-                       return pAppWidgetContext;
-               }
-       }
-       return null;
+       return pAppWidgetContext;
 }
 
 int
@@ -166,43 +163,49 @@ AppWidgetManagerService::Find(const String& appId) const
 {
        int clientId = -1;
 
-       for (int i = 0; i < __appWidgetContextList.GetCount(); i++)
+       unique_ptr< IMapEnumeratorT<String, _AppWidgetContext*> > pAppWidgetContextEnum(__appWidgetContextList.GetMapEnumeratorN());
+       SysTryReturn(NID_SHELL, pAppWidgetContextEnum, clientId, E_SYSTEM, "[E_SYSTEM]");
+
+       while (pAppWidgetContextEnum->MoveNext() == E_SUCCESS)
        {
-               _AppWidgetContext* pAppWidgetContext = null;
-               __appWidgetContextList.GetAt(i, pAppWidgetContext);
+               _AppWidgetContext* pValue = null;
+               pAppWidgetContextEnum->GetValue(pValue);
 
-               if (pAppWidgetContext->GetProviderId() == appId)
+               if (pValue->GetProviderId() == appId)
                {
-                       clientId = pAppWidgetContext->GetClientId();
+                       clientId = pValue->GetClientId();
                        break;
                }
        }
 
        SysLog(NID_SHELL, "clientId is %d", clientId);
-
        return clientId;
 }
 
 result
 AppWidgetManagerService::SetIpcClientIds(const Tizen::App::AppId& appId, int clientId)
 {
-       for (int i = 0; i < __appWidgetContextList.GetCount(); i++)
+       unique_ptr< IMapEnumeratorT<String, _AppWidgetContext*> > pAppWidgetContextEnum(__appWidgetContextList.GetMapEnumeratorN());
+       SysTryReturnResult(NID_SHELL, pAppWidgetContextEnum, E_SYSTEM, "");
+
+       while (pAppWidgetContextEnum->MoveNext() == E_SUCCESS)
        {
-               _AppWidgetContext* pAppWidgetContext = null;
-               __appWidgetContextList.GetAt(i, pAppWidgetContext);
-               SysSecureLog(NID_SHELL, "%ls, %ls, %ls", pAppWidgetContext->GetInstanceId().GetPointer(), pAppWidgetContext->GetProviderId().GetPointer(), appId.GetPointer());
+               _AppWidgetContext* pValue = null;
+               pAppWidgetContextEnum->GetValue(pValue);
+               SysSecureLog(NID_SHELL, "%ls, %ls, %ls", pValue->GetInstanceId().GetPointer(), pValue->GetProviderId().GetPointer(), appId.GetPointer());
 
-               if (pAppWidgetContext->GetAppId() == appId)
+               if (pValue->GetAppId() == appId)
                {
-                       pAppWidgetContext->SetIpcClientId(clientId);
+                       pValue->SetIpcClientId(clientId);
 
-                       ifclientId == -1)
+                       if (clientId == -1)
                        {
                                SysLog(NID_SHELL, "client is unregistered.");
-                               pAppWidgetContext->Suspend();
-                               if(pAppWidgetContext->GetAppWidgetPopup())
+                               pValue->Suspend();
+
+                               if (pValue->GetAppWidgetPopup())
                                {
-                                       pAppWidgetContext->OnPopupDestoyed();
+                                       pValue->OnPopupDestoyed();
                                }
                        }
                        else
@@ -211,6 +214,7 @@ AppWidgetManagerService::SetIpcClientIds(const Tizen::App::AppId& appId, int cli
                        }
                }
        }
+
        return E_SUCCESS;
 }
 
@@ -255,7 +259,7 @@ AppWidgetManagerService::AddAppWidget(_AppWidgetContext* pAppWidgetContext)
 {
        SysSecureLog(NID_SHELL, "%ls, %ls, count(%d)", pAppWidgetContext->GetProviderId().GetPointer(), pAppWidgetContext->GetInstanceId().GetPointer(), __appWidgetContextList.GetCount());
 
-       return __appWidgetContextList.Add(pAppWidgetContext);
+       return __appWidgetContextList.Add(pAppWidgetContext->GetInstanceId(), pAppWidgetContext);
 }
 
 result
@@ -266,7 +270,7 @@ AppWidgetManagerService::RemoveAppWidget(const char* pPackageName, const char* p
        _AppWidgetContext* pAppWidgetContext = Find(pPackageName, pId);
        SysTryReturn(NID_SHELL, pAppWidgetContext, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND]");
 
-       result r = __appWidgetContextList.Remove(pAppWidgetContext);
+       result r = __appWidgetContextList.Remove(pAppWidgetContext->GetInstanceId());
 
        delete pAppWidgetContext;
 
@@ -338,17 +342,21 @@ AppWidgetManagerService::OnAppWidgetUpdate(struct event_arg *arg, void* data)
 int
 AppWidgetManagerService::UpdateAllAppWidgetsByAppId(const String& providerId)
 {
-       for( int i = 0; i < __appWidgetContextList.GetCount(); i++ )
+       unique_ptr< IMapEnumeratorT<String, _AppWidgetContext*> > pAppWidgetContextEnum(__appWidgetContextList.GetMapEnumeratorN());
+       SysTryReturn(NID_SHELL, pAppWidgetContextEnum, 0, E_SYSTEM, "[E_SYSTEM]");
+
+       while (pAppWidgetContextEnum->MoveNext() == E_SUCCESS)
        {
-               _AppWidgetContext* pAppWidgetContext = null;
-               __appWidgetContextList.GetAt(i, pAppWidgetContext);
+               _AppWidgetContext* pValue = null;
+               pAppWidgetContextEnum->GetValue(pValue);
 
-               if ( pAppWidgetContext->GetProviderId() == providerId )
+               if (pValue->GetProviderId() == providerId)
                {
-                       pAppWidgetContext->OnUpdate(L"");
+                       pValue->OnUpdate(L"");
                }
        }
-       return E_SUCCESS;
+
+       return 0;
 }
 
 int
@@ -416,20 +424,18 @@ AppWidgetManagerService::OnAppWidgetPause(struct event_arg *arg, void* data)
 int
 AppWidgetManagerService::OnAppWidgetPauseAll(struct event_arg *arg, void* data)
 {
-       SysLog(NID_SHELL, "I");
-
-       AppWidgetManagerService* pAppManagerService = AppWidgetManagerService::GetInstance();
+       unique_ptr< IMapEnumeratorT<String, _AppWidgetContext*> > pAppWidgetContextEnum((AppWidgetManagerService::GetInstance()->__appWidgetContextList).GetMapEnumeratorN());
+       SysTryReturn(NID_SHELL, pAppWidgetContextEnum, -1, E_SYSTEM, "[E_SYSTEM]");
 
-       for (int i = 0; i < (pAppManagerService->__appWidgetContextList).GetCount(); i++)
+       while (pAppWidgetContextEnum->MoveNext() == E_SUCCESS)
        {
-               _AppWidgetContext* pAppWidgetContext = null;
-               (pAppManagerService->__appWidgetContextList).GetAt(i, pAppWidgetContext);
+               _AppWidgetContext* pValue = null;
+               pAppWidgetContextEnum->GetValue(pValue);
 
-               pAppWidgetContext->OnBackground();
+               pValue->OnBackground();
        }
 
-       SysLog(NID_SHELL, "O");
-    return 0;
+       return 0;
 }
 
 int
@@ -448,20 +454,18 @@ AppWidgetManagerService::OnAppWidgetResume(struct event_arg *pArg, void* pData)
 int
 AppWidgetManagerService::OnAppWidgetResumeAll(struct event_arg *pArg, void* pData)
 {
-       SysLog(NID_SHELL, "I");
+       unique_ptr< IMapEnumeratorT<String, _AppWidgetContext*> > pAppWidgetContextEnum((AppWidgetManagerService::GetInstance()->__appWidgetContextList).GetMapEnumeratorN());
+       SysTryReturn(NID_SHELL, pAppWidgetContextEnum, -1, E_SYSTEM, "[E_SYSTEM]");
 
-       AppWidgetManagerService* pAppManagerService = AppWidgetManagerService::GetInstance();
-
-       for (int i = 0; i < (pAppManagerService->__appWidgetContextList).GetCount(); i++)
+       while (pAppWidgetContextEnum->MoveNext() == E_SUCCESS)
        {
-               _AppWidgetContext* pAppWidgetContext = null;
-               (pAppManagerService->__appWidgetContextList).GetAt(i, pAppWidgetContext);
+               _AppWidgetContext* pValue = null;
+               pAppWidgetContextEnum->GetValue(pValue);
 
-               pAppWidgetContext->OnForeground();
+               pValue->OnForeground();
        }
 
-       SysLog(NID_SHELL, "O");
-    return 0;
+       return 0;
 }
 
 int
@@ -536,7 +540,11 @@ AppWidgetManagerService::InitializeCoreDaemonEventReceiver(const char *pIdForCor
 {
        SysTryReturnResult(NID_SHELL, pIdForCoreDaemon != null, E_INVALID_ARG, "pIdForCoreDaemon should not be null!");
 
-       __appWidgetContextList.Construct();
+       static __HashMapDefaultProviderT <String> strHashCodeProvider;
+       static ComparerT <String> strComparer;
+
+       result r = __appWidgetContextList.Construct(0, 0, strHashCodeProvider, strComparer);
+       SysTryReturnResult(NID_SHELL, !IsFailed(r), E_SYSTEM, "Failed to execute Construct.");
 
        /*!
         * \note
@@ -589,29 +597,32 @@ AppWidgetManagerService::RequestUpdate(const Tizen::App::AppId& appId, const Tiz
        bool found = false;
        bool updateAllSuspended = appId.IsEmpty();
 
-       for( int i = 0; i < __appWidgetContextList.GetCount(); i++ )
+       unique_ptr< IMapEnumeratorT<String, _AppWidgetContext*> > pAppWidgetContextEnum((AppWidgetManagerService::GetInstance()->__appWidgetContextList).GetMapEnumeratorN());
+       SysTryReturnResult(NID_SHELL, pAppWidgetContextEnum, E_SYSTEM, "");
+
+       while (pAppWidgetContextEnum->MoveNext() == E_SUCCESS)
        {
-               _AppWidgetContext* pAppWidgetContext = null;
-               __appWidgetContextList.GetAt(i, pAppWidgetContext);
-               SysAssertf(pAppWidgetContext, "pAppWidgetContext is null!");
+               _AppWidgetContext* pValue = null;
+               pAppWidgetContextEnum->GetValue(pValue);
 
                if ( (updateAllSuspended == true && AppManager::GetInstance()->IsRunning(appId) == false )
-                       || ( pAppWidgetContext->GetAppId() == appId && pAppWidgetContext->GetProviderName() == providerName ) )
+                       || ( pValue->GetAppId() == appId && pValue->GetProviderName() == providerName ) )
                {
                        ArrayList* pArray = new (std::nothrow) ArrayList();
                        SysTryReturnResult(NID_SHELL, pArray, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
 
                        pArray->Construct();
-                       pArray->Add(pAppWidgetContext);
+                       pArray->Add(pValue);
                        pArray->Add(new String(argument));
 
                        result r = __handlerThread.SendUserEvent(LOCAL_EVENT_REQUEST_UPDATE, pArray);
                        SysTryLog(NID_SHELL, !IsFailed(r), "[%s] Propagated.", GetErrorMessage(r));
 
-                       SysLog(NID_SHELL, "UserEvent(%d) is sent for '%ls.%ls'.", LOCAL_EVENT_REQUEST_UPDATE, pAppWidgetContext->GetAppId().GetPointer(), pAppWidgetContext->GetProviderName().GetPointer() );
+                       SysLog(NID_SHELL, "UserEvent(%d) is sent for '%ls.%ls'.", LOCAL_EVENT_REQUEST_UPDATE, pValue->GetAppId().GetPointer(), pValue->GetProviderName().GetPointer() );
                        found = true;
                }
        }
+
        SysLog(NID_SHELL, "Exit.");
        return (found) ? E_SUCCESS : E_OBJ_NOT_FOUND;
 }
@@ -637,7 +648,6 @@ AppWidgetManagerService::RequestUpdate(_AppWidgetContext* pAppWidgetContext, con
                SysLog(NID_SHELL, "pAppWidgetContext is null.");
        }
 
-       SysLog(NID_SHELL, "O");
        return E_SUCCESS;
 }
 
@@ -646,30 +656,20 @@ AppWidgetManagerService::RequestUpdateInstance(const Tizen::Base::String& instan
 {
        SysSecureLog(NID_SHELL, "%ls, %ls", instanceId.GetPointer(), argument.GetPointer() );
 
-       for (int i = 0; i < __appWidgetContextList.GetCount(); i++ )
-       {
-               _AppWidgetContext* pAppWidgetContext = null;
-               __appWidgetContextList.GetAt(i, pAppWidgetContext);
+       _AppWidgetContext* pAppWidgetContext = Find(L"", instanceId);
+       SysTryReturnResult(NID_SHELL, pAppWidgetContext, E_OBJ_NOT_FOUND, "Failed to find the object.");
 
-               if (pAppWidgetContext->GetInstanceId() == instanceId)
-               {
-                       SysLog(NID_SHELL, "OK");
+       ArrayList* pArray = new (std::nothrow) ArrayList();
+       SysTryReturnResult(NID_SHELL, pArray, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
 
-                       ArrayList* pArray = new (std::nothrow) ArrayList();
-                       SysTryReturnResult(NID_SHELL, pArray, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
+       pArray->Construct();
+       pArray->Add(pAppWidgetContext);
+       pArray->Add(new String(argument));
 
-                       pArray->Construct();
-                       pArray->Add(pAppWidgetContext);
-                       pArray->Add(new String(argument));
+       result r = __handlerThread.SendUserEvent(LOCAL_EVENT_REQUEST_UPDATE, pArray);
+       SysTryLog(NID_SHELL, !IsFailed(r), "[%s] Propagated.", GetErrorMessage(r));
 
-                       result r = __handlerThread.SendUserEvent(LOCAL_EVENT_REQUEST_UPDATE, pArray);
-                       SysTryLog(NID_SHELL, !IsFailed(r), "[%s] Propagated.", GetErrorMessage(r));
-
-                       return E_SUCCESS;
-               }
-       }
-       SysLog(NID_SHELL, "Exit.");
-       return E_OBJ_NOT_FOUND;
+       return E_SUCCESS;
 }
 
 result
@@ -747,11 +747,15 @@ AppWidgetManagerService::SendResult(const Tizen::App::AppId& appId, const Tizen:
 
                if (instanceId == INVALID_INSTANCE)
                {
-                       for (int i = 0; i < __appWidgetContextList.GetCount(); i++)
+                       unique_ptr< IMapEnumeratorT<String, _AppWidgetContext*> > pAppWidgetContextEnum((AppWidgetManagerService::GetInstance()->__appWidgetContextList).GetMapEnumeratorN());
+                       SysTryReturnResult(NID_SHELL, pAppWidgetContextEnum, E_SYSTEM, "");
+
+                       while (pAppWidgetContextEnum->MoveNext() == E_SUCCESS)
                        {
-                               __appWidgetContextList.GetAt(i, pAppWidgetContext);
+                               _AppWidgetContext* pValue = null;
+                               pAppWidgetContextEnum->GetValue(pValue);
 
-                               if (!pAppWidgetContext->IsRunning())
+                               if (!pValue->IsRunning())
                                {
                                        break;
                                }
@@ -809,12 +813,15 @@ AppWidgetManagerService::SendAccessStatus(const Tizen::App::AppId& appId, const
 result
 AppWidgetManagerService::RequestPendingEvent(void)
 {
-       for (int i = 0; i < __appWidgetContextList.GetCount(); i++ )
+       unique_ptr< IMapEnumeratorT<String, _AppWidgetContext*> > pAppWidgetContextEnum((AppWidgetManagerService::GetInstance()->__appWidgetContextList).GetMapEnumeratorN());
+       SysTryReturnResult(NID_SHELL, pAppWidgetContextEnum, E_SYSTEM, "");
+
+       while (pAppWidgetContextEnum->MoveNext() == E_SUCCESS)
        {
-               _AppWidgetContext* pAppWidgetContext = null;
-               __appWidgetContextList.GetAt(i, pAppWidgetContext);
+               _AppWidgetContext* pValue = null;
+               pAppWidgetContextEnum->GetValue(pValue);
 
-               pAppWidgetContext->SendPendingEvent();
+               pValue->SendPendingEvent();
        }
 
        return E_SUCCESS;