Apply the code for handling the multiple providers that existed in the same application.
authorkyeongwoo.lee <kyeongwoo.lee@samsung.com>
Wed, 22 May 2013 13:40:37 +0000 (22:40 +0900)
committerkyeongwoo.lee <kyeongwoo.lee@samsung.com>
Wed, 22 May 2013 13:40:37 +0000 (22:40 +0900)
Change-Id: Ic4c179c2861d5788d719d544421d05d4cf11b1c5

inc/FShell_AppWidgetContextBase.h
inc/FShell_AppWidgetManagerService.h
src/FShell_AppWidgetManagerService.cpp

index 1f9666a1e7d6e8e0cc60a0321f894ca12fd1298e..2400eb6a14b52dcf65510da40618e7ee98064112 100644 (file)
@@ -55,6 +55,7 @@ public:
        virtual void OnPopupDestoyed(void) = 0;
        virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y) = 0;
        void SetIpcClientId(int clientId);
+       int GetClientId(void) const;
        bool HasValidClientId(void) const;
        // for buffered appWidget
        int GetSharedMemId(int w, int h);
@@ -76,7 +77,6 @@ protected:
        void SetForeground(bool forground);
        bool IsForeground(void) const;
        Tizen::Base::String GetUserInfo(void) const;
-       int GetClientId(void) const;
 
        void SetWidth(int width);
        void SetHeight(int height);
index 421afe88bc89a07194e920fe9b455b21fb686f42..26ee083fd82316a49edb9ccb62931ff1fa72d484 100644 (file)
@@ -93,6 +93,7 @@ private:
        void StartPingTimer(void);
        virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
        _AppWidgetContext* Find(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId) const;
+       int Find(const Tizen::App::AppId& appId) const;
 
        class _TaskHandlerThread
                        : public Tizen::Base::Runtime::Thread
index e17f2020f637b1b95f98589d0f78cb55da143b47..37185b672a1c97826a127e708bcf56c7e54914c0 100644 (file)
@@ -146,6 +146,28 @@ AppWidgetManagerService::Find(const String& appId, const String& instanceId) con
        return null;
 }
 
+int
+AppWidgetManagerService::Find(const String& appId) const
+{
+       int clientId = -1;
+
+       for (int i = 0; i < __appWidgetContextList.GetCount(); i++)
+       {
+               _AppWidgetContext* pAppWidgetContext = null;
+               __appWidgetContextList.GetAt(i, pAppWidgetContext);
+
+               if (pAppWidgetContext->GetProviderId() == appId)
+               {
+                       clientId = pAppWidgetContext->GetClientId();
+                       break;
+               }
+       }
+
+       SysLog(NID_SHELL, "clientId is %d", clientId);
+
+       return clientId;
+}
+
 result
 AppWidgetManagerService::SetIpcClientIds(const Tizen::App::AppId& appId, int clientId)
 {
@@ -236,6 +258,17 @@ AppWidgetManagerService::OnAppWidgetCreate(struct event_arg *arg, int *width, in
                        arg->info.lb_create.width, arg->info.lb_create.height, arg->info.lb_create.period * 1000, default_priority);
        SysTryReturn(NID_SHELL, pAppWidgetContext, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
 
+       int clientId = AppWidgetManagerService::GetInstance()->Find(arg->pkgname);
+       if (clientId != -1)
+       {
+               SysLog(NID_SHELL, "There is same parent application.");
+               pAppWidgetContext->SetIpcClientId(clientId);
+       }
+       else
+       {
+               SysLog(NID_SHELL, "There is no same parent application.");
+       }
+
        AppWidgetManagerService* pAppWidgetService = AppWidgetManagerService::GetInstance();
        pAppWidgetService->AddAppWidget(pAppWidgetContext);
        pAppWidgetContext->OnAdded();