2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.1 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FShell_AppWidgetManagerService.cpp
20 * @brief This is the implementation for the AppWidgetManagerService class.
25 #include <unique_ptr.h>
30 #include <FBaseSysLog.h>
32 #include <FApp_AppManagerImpl.h>
33 #include <FIo_IpcServer.h>
34 #include <FBase_StringConverter.h>
36 #include "FShell_AppWidgetContext.h"
37 #include "FShell_AppWidgetPopupContext.h"
38 #include "FShell_AppWidgetManagerStub.h"
40 #include "FShell_AppWidgetManagerService.h"
42 namespace Tizen { namespace Shell { namespace App {
44 using namespace Tizen::App;
45 using namespace Tizen::Base;
46 using namespace Tizen::Base::Collection;
47 using namespace Tizen::Base::Runtime;
48 using namespace Tizen::Io;
49 using namespace Tizen::System;
50 using namespace Tizen::Shell::App;
55 static const RequestId LOCAL_EVENT_REQUEST_UPDATE = 0;
58 AppWidgetManagerService::AppWidgetManagerService()
62 AppWidgetManagerService::~AppWidgetManagerService()
65 DeinitializeMasterDaemonEventReceiver();
68 AppWidgetManagerService*
69 AppWidgetManagerService::GetInstance(void)
71 static AppWidgetManagerService* pSelf = null;
74 pSelf = new AppWidgetManagerService();
75 SysTryReturn(NID_SHELL, pSelf != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
77 result r = pSelf->Construct();
78 SysAssertf(!IsFailed(r), "Failed to construct AppWidgetManagerService");
79 SysLog(NID_SHELL, "AppWidgetManagerService is created.");
85 AppWidgetManagerService::Construct()
87 // _AppManagerImpl::GetInstance()->AddEventListener(*this);
89 _AppWidgetManagerStub::StartIpcServer();
91 result r = __handlerThread.Construct(THREAD_TYPE_EVENT_DRIVEN);
92 SysTryReturn(NID_SHELL, IsFailed(r) == false, false, r, "[%s] Event thread creation failure.", GetErrorMessage(r));
94 r = __handlerThread.Start();
95 SysTryReturn(NID_SHELL, IsFailed(r) == false, false, r, "[%s] Event thread Start failure.", GetErrorMessage(r));
97 return InitializeMasterDaemonEventReceiver("osp-appwidget-service");
101 AppWidgetManagerService::AppWidgetConnected(struct event_arg *arg, void* data)
104 ret = provider_send_hello();
107 SysLog(NID_SHELL, "success to be connected with master daemon");
108 AppWidgetManagerService::GetInstance()->StartPingTimer();
113 SysLog(NID_SHELL, "failed to provider_send_hello()");
119 AppWidgetManagerService::AppWidgetDisconnected(struct event_arg *arg, void* data)
121 SysLog(NID_SHELL, "success to be disconnected with master daemon");
122 // aul_terminate_pid(getpid());
127 AppWidgetManagerService::StartPingTimer()
129 __pingTimer.Construct(*this);//, true);
130 __pingTimer.StartAsRepeatable(120000);
134 AppWidgetManagerService::OnTimerExpired(Timer& timer)
136 SysLog(NID_SHELL, "provider_send_ping");
137 provider_send_ping();
141 AppWidgetManagerService::Find(const String& appId, const String& instanceId) const
143 for( int i = 0; i < __appWidgetContextList.GetCount(); i++ )
145 _AppWidgetContext* pAppWidgetContext = null;
146 __appWidgetContextList.GetAt(i, pAppWidgetContext);
147 // SysLog(NID_SHELL, "%ls", pAppWidgetContext->__instanceId.GetPointer());
149 if ( pAppWidgetContext->__instanceId == instanceId )
151 // SysAssert(pAppWidgetContext->__appId == appId)
152 return pAppWidgetContext;
159 AppWidgetManagerService::SetIpcClientIds(const Tizen::App::AppId& appId, int clientId)
161 for( int i = 0; i < __appWidgetContextList.GetCount(); i++ )
163 _AppWidgetContext* pAppWidgetContext = null;
164 __appWidgetContextList.GetAt(i, pAppWidgetContext);
165 SysLog(NID_SHELL, "%ls", pAppWidgetContext->__instanceId.GetPointer());
166 SysLog(NID_SHELL, "%ls, %ls", pAppWidgetContext->__providerId.GetPointer(), appId.GetPointer());
168 if ( pAppWidgetContext->__appId == appId )
170 SysLog(NID_SHELL,"");
171 pAppWidgetContext->SetIpcClientId(clientId);
172 SysLog(NID_SHELL, "client is registered.(%d)", clientId);
174 if( clientId == -1)//disconnected
176 // pAppWidgetContext->ReleaseSharedMem();
177 pAppWidgetContext->Suspend();
178 if(pAppWidgetContext->GetAppWidgetPopup())
180 pAppWidgetContext->OnPopupDestoyed();
189 AppWidgetManagerService::OnIpcClientConnected(const _IpcServer& server, int clientId)
191 String appId = server.GetClientApplicationId();
192 SysLog(NID_SHELL, "(%ls)\n", appId.GetPointer());
194 this->SetIpcClientIds(appId, clientId);
198 AppWidgetManagerService::OnIpcClientDisconnected(const _IpcServer& server, int clientId)
200 String appId = server.GetClientApplicationId();
201 SysLog(NID_SHELL, "(%ls)\n", appId.GetPointer());
203 this->SetIpcClientIds(appId, -1);
207 AppWidgetManagerService::AddAppWidget(_AppWidgetContext* pAppWidgetContext)
209 SysLog(NID_SHELL, "%ls, %ls, count(%d)", pAppWidgetContext->__providerId.GetPointer(), pAppWidgetContext->__instanceId.GetPointer(), __appWidgetContextList.GetCount());
211 return __appWidgetContextList.Add(pAppWidgetContext);
215 AppWidgetManagerService::RemoveAppWidget(const char* pPackageName, const char* pId, bool free)
217 SysLog(NID_SHELL, "%s, %s, count(%d)", pPackageName, pId, __appWidgetContextList.GetCount());
219 SysTryReturn(NID_SHELL, ( pPackageName != null && pId != null), null, E_INVALID_ARG, "[E_INVALID_ARG]");
220 SysLog(NID_SHELL, "%s, %s", pPackageName, pId);
222 _AppWidgetContext* pAppWidgetContext = Find(pPackageName, pId);
223 SysTryReturn(NID_SHELL, pAppWidgetContext, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND]");
225 result r = __appWidgetContextList.Remove(pAppWidgetContext);
227 if( __appWidgetContextList.GetCount() == 0 )
229 SysLog(NID_SHELL, "No running native appWidget app remains, terminating osp appWidget service...");
230 Tizen::App::App::GetInstance()->Terminate();
237 ///////////////////////////////////////////////////////
238 // MasterDaemonEventReceiver implementation
239 ///////////////////////////////////////////////////////
241 AppWidgetManagerService::OnAppWidgetCreate(struct event_arg *arg, int *width, int *height, double *priority, void* data)
243 SysTryReturn(NID_SHELL, arg != null, EINVAL, E_INVALID_ARG, "[E_INVALID_ARG]");
244 SysTryReturn(NID_SHELL, arg->pkgname != null, EINVAL, E_INVALID_ARG, "[E_INVALID_ARG]");
245 SysTryReturn(NID_SHELL, arg->id != null, EINVAL, E_INVALID_ARG, "[E_INVALID_ARG]");
246 SysTryReturn(NID_SHELL, arg->type == event_arg::EVENT_NEW, -EPERM, E_SUCCESS, "invalid argument from master");
248 SysLog(NID_SHELL, "packageName(%s) id(%s) content(%s) cluster(%s) category(%s)", arg->pkgname, arg->id, arg->info.lb_create.content, arg->info.lb_create.cluster, arg->info.lb_create.category);
249 SysTryReturn (NID_SHELL, AppWidgetManagerService::GetInstance()->Find(arg->pkgname, arg->id) == null, -EBUSY, E_SUCCESS,"already exist");
251 double default_priority = 1.0f;
252 _AppWidgetContext* pAppWidgetContext = new (std::nothrow)_AppWidgetContext( arg->info.lb_create.content, arg->pkgname, arg->id,
253 arg->info.lb_create.width, arg->info.lb_create.height, arg->info.lb_create.period * 1000, default_priority);
254 SysTryReturn(NID_SHELL, pAppWidgetContext, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
256 AppWidgetManagerService* pAppWidgetService = AppWidgetManagerService::GetInstance();
257 pAppWidgetService->AddAppWidget(pAppWidgetContext);
258 pAppWidgetContext->OnAdded();
260 *priority = pAppWidgetContext->__priority;
261 *height= pAppWidgetContext->__height;
262 *width = pAppWidgetContext->__width;
264 SysLog(NID_SHELL, "Exit. %d appWidget(es)", pAppWidgetService->__appWidgetContextList.GetCount());
269 AppWidgetManagerService::OnAppWidgetUpdate(struct event_arg *arg, void* data)
271 if( arg->id == null || strlen(arg->id) < 1)
273 SysLog(NID_SHELL, "updating alls");
274 AppWidgetManagerService::GetInstance()->UpdateAllAppWidgetsByAppId(arg->pkgname);
278 _AppWidgetContext* pAppWidgetContext = AppWidgetManagerService::GetInstance()->Find(arg->pkgname, arg->id);
279 SysTryReturnResult(NID_SHELL, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
281 pAppWidgetContext->OnUpdate(L"");
288 AppWidgetManagerService::UpdateAllAppWidgetsByAppId(const String& providerId)
290 for( int i = 0; i < __appWidgetContextList.GetCount(); i++ )
292 _AppWidgetContext* pAppWidgetContext = null;
293 __appWidgetContextList.GetAt(i, pAppWidgetContext);
295 if ( pAppWidgetContext->__providerId == providerId )
297 pAppWidgetContext->OnUpdate(L"");
304 AppWidgetManagerService::OnAppWidgetDestroy(struct event_arg *arg, void* data)
306 SysTryReturn (NID_SHELL, arg->type == event_arg::EVENT_DELETE, -EPERM, E_SUCCESS, "invalid argument from master");
307 SysLog(NID_SHELL, "Enter");
309 AppWidgetManagerService* pAppWidgetManagerService = AppWidgetManagerService::GetInstance();
311 _AppWidgetContext* pAppWidgetContext = pAppWidgetManagerService->Find(arg->pkgname, arg->id);
312 SysTryReturnResult(NID_SHELL, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
314 pAppWidgetContext->OnRemoved();
315 pAppWidgetManagerService->RemoveAppWidget( arg->pkgname, arg->id, true);
316 delete pAppWidgetContext;
318 SysLog(NID_SHELL, "Exit");
323 AppWidgetManagerService::OnAppWidgetPopupCreate(struct event_arg *arg, void* data)
325 SysTryReturn (NID_SHELL, arg->type == event_arg::EVENT_PD_CREATE, -EPERM, E_SUCCESS, "invalid argument from master");
326 SysLog(NID_SHELL, "packageName(%s), id(%s), x(%d), y(%d), width(%f), height(%f), priority(%d)", arg->pkgname, arg->id, arg->info.pd_create.x, arg->info.pd_create.y, arg->info.pd_create.w, arg->info.pd_create.h);
328 _AppWidgetContext* pAppWidgetContext = AppWidgetManagerService::GetInstance()->Find(arg->pkgname, arg->id);
329 SysTryReturnResult(NID_SHELL, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
331 /*if( pAppWidgetContext->GetAppWidgetPopup() )
333 pAppWidgetContext->OnPopupDestoyed();
335 pAppWidgetContext->OnPopupCreated(arg->info.pd_create.x, arg->info.pd_create.y, arg->info.pd_create.w, arg->info.pd_create.h);
341 AppWidgetManagerService::OnAppWidgetPopupDestroy(struct event_arg *arg, void* data)
343 SysTryReturn (NID_SHELL, arg->type == event_arg::EVENT_PD_DESTROY, -EPERM, E_SUCCESS, "invalid argument from master");
344 SysLog(NID_SHELL, "packageName(%s), id(%s)", arg->pkgname, arg->id);
345 _AppWidgetContext* pAppWidgetContext = AppWidgetManagerService::GetInstance()->Find(arg->pkgname, arg->id);
346 SysTryReturnResult(NID_SHELL, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
348 pAppWidgetContext->OnPopupDestoyed();
354 AppWidgetManagerService::OnAppWidgetPause(struct event_arg *arg, void* data)
356 SysTryReturn(NID_SHELL, arg, 0, E_SUCCESS, "arg is null!");
358 _AppWidgetContext* pAppWidgetContext = AppWidgetManagerService::GetInstance()->Find(arg->pkgname, arg->id);
359 SysTryReturnResult(NID_SHELL, pAppWidgetContext , 0, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
361 SysLog(NID_SHELL, "packageName(%s), id(%s)", arg->pkgname, arg->id);
362 pAppWidgetContext->OnBackground();
367 AppWidgetManagerService::OnAppWidgetResume(struct event_arg *arg, void* data)
369 SysTryReturn(NID_SHELL, arg || arg->id || arg->pkgname, 0, E_SUCCESS, "arg is null!");
371 _AppWidgetContext* pAppWidgetContext = AppWidgetManagerService::GetInstance()->Find(arg->pkgname, arg->id);
372 SysTryReturnResult(NID_SHELL, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
374 SysLog(NID_SHELL, "packageName(%s), id(%s)", arg->pkgname, arg->id);
375 pAppWidgetContext->OnForeground();
380 AppWidgetManagerService::OnAppWidgetPauseAll(struct event_arg *arg, void* data)
382 SysLog(NID_SHELL,"");
387 AppWidgetManagerService::OnAppWidgetResumeAll(struct event_arg *arg, void* data)
389 SysLog(NID_SHELL,"");
394 AppWidgetManagerService::OnAppWidgetClick(struct event_arg *arg, void* data)
396 SysTryReturn (NID_SHELL, arg->type == event_arg::EVENT_CLICKED, -EPERM, E_SUCCESS, "invalid argument from master");
397 SysTryReturn(NID_SHELL, arg != null, -EPERM, E_SUCCESS, "arg is null!");
398 SysLog(NID_SHELL, "packageName(%s), id(%s), clicked.event(%s), clicked.x(%d), clicked.y(%d)", arg->pkgname, arg->id, arg->info.clicked.event, arg->info.clicked.x, arg->info.clicked.y);
404 AppWidgetManagerService::OnAppWidgetResize(struct event_arg *arg, void* data)
406 SysTryReturn(NID_SHELL, arg || arg->id || arg->pkgname, 0, E_SUCCESS, "arg is null!");
407 SysTryReturn (NID_SHELL, arg->type == event_arg::EVENT_RESIZE, -EPERM, E_SUCCESS, "invalid argument from master");
409 SysLog(NID_SHELL, "packageName(%s), id(%s), resize.w(%d), resize.h(%d)", arg->pkgname, arg->id, arg->info.resize.w, arg->info.resize.h);
411 _AppWidgetContext* pAppWidgetContext = AppWidgetManagerService::GetInstance()->Find(arg->pkgname, arg->id);
412 SysTryReturnResult(NID_SHELL, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
414 pAppWidgetContext->OnResize(arg->info.resize.w, arg->info.resize.h);
420 AppWidgetManagerService::OnAppWidgetPeriodChaned(struct event_arg *arg, void* data)
422 SysTryReturn(NID_SHELL, arg != null, 0, E_SUCCESS, "arg is null!");
423 SysLog(NID_SHELL, "packageName(%s), id(%s), width(%d), height(%d), priority(%d)", arg->pkgname, arg->id);
428 AppWidgetManagerService::OnAppWidgetRecreate(struct event_arg *arg, void* data)
430 SysLog(NID_SHELL, "");
435 AppWidgetManagerService::InitializeMasterDaemonEventReceiver(const char *pServiceExecutableName)
437 SysTryReturnResult(NID_SHELL, pServiceExecutableName != null, E_INVALID_ARG, "");
438 SysLog(NID_SHELL, "Enter.");
440 __appWidgetContextList.Construct();
444 * Only for the buffer type
446 struct event_handler cbs;
447 memset(&cbs, 0, sizeof(event_handler));
449 cbs.connected = AppWidgetConnected,
450 cbs.disconnected = AppWidgetDisconnected,
451 cbs.pause = OnAppWidgetPauseAll,
452 cbs.resume = OnAppWidgetResumeAll,
453 cbs.lb_pause = OnAppWidgetPause,
454 cbs.lb_resume = OnAppWidgetResume,
455 cbs.lb_create = OnAppWidgetCreate,
456 cbs.lb_destroy = OnAppWidgetDestroy,
457 cbs.update_content = OnAppWidgetUpdate,
458 cbs.pd_create = OnAppWidgetPopupCreate,
459 cbs.pd_destroy = OnAppWidgetPopupDestroy,
460 cbs.clicked = OnAppWidgetClick,
461 cbs.resize = OnAppWidgetResize,
462 cbs.set_period = OnAppWidgetPeriodChaned;
463 cbs.lb_recreate = OnAppWidgetRecreate;/* Recover from the fault of slave */
464 //cbs.content_event = OnAppWidgetContentEvent,
466 int ret = provider_init(null, pServiceExecutableName, &cbs, this);
467 SysTryReturnResult(NID_SHELL, ret == 0, E_SYSTEM, "provider_init failed.");
469 SysLog(NID_SHELL, "Exit.");
474 AppWidgetManagerService::DeinitializeMasterDaemonEventReceiver()
476 SysLog(NID_SHELL, "Enter.");
478 SysLog(NID_SHELL, "Exit.");
482 ///////////////////////////////////////////////////////
483 // stub implmentation
484 ///////////////////////////////////////////////////////
487 AppWidgetManagerService::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument)
489 SysLog(NID_SHELL, "%ls, %ls", appId.GetPointer(), providerName.GetPointer() );
492 for( int i = 0; i < __appWidgetContextList.GetCount(); i++ )
494 _AppWidgetContext* pAppWidgetContext = null;
495 __appWidgetContextList.GetAt(i, pAppWidgetContext);
497 if ( pAppWidgetContext->__appId == appId && pAppWidgetContext->__providerName == providerName)
499 SysLog(NID_SHELL, "OK");
501 ArrayList* pArray = new (std::nothrow) ArrayList();
502 SysTryReturnResult(NID_SHELL, pArray, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
505 pArray->Add(pAppWidgetContext);
506 pArray->Add(new String(argument));
508 result r = __handlerThread.SendUserEvent(LOCAL_EVENT_REQUEST_UPDATE, pArray);
509 SysTryLog(NID_SHELL, !IsFailed(r), "[%s] Propagated.", GetErrorMessage(r));
514 SysLog(NID_SHELL, "Exit.");
515 return (found) ? E_SUCCESS : E_OBJ_NOT_FOUND;
520 AppWidgetManagerService::RequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument)
522 SysLog(NID_SHELL, "%ls, %ls", instanceId.GetPointer(), argument.GetPointer() );
524 for( int i = 0; i < __appWidgetContextList.GetCount(); i++ )
526 _AppWidgetContext* pAppWidgetContext = null;
527 __appWidgetContextList.GetAt(i, pAppWidgetContext);
529 if ( pAppWidgetContext->__instanceId == instanceId)
531 SysLog(NID_SHELL, "OK");
533 ArrayList* pArray = new (std::nothrow) ArrayList();
534 SysTryReturnResult(NID_SHELL, pArray, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
537 pArray->Add(pAppWidgetContext);
538 pArray->Add(new String(argument));
540 result r = __handlerThread.SendUserEvent(LOCAL_EVENT_REQUEST_UPDATE, pArray);
541 SysTryLog(NID_SHELL, !IsFailed(r), "[%s] Propagated.", GetErrorMessage(r));
546 SysLog(NID_SHELL, "Exit.");
547 return E_OBJ_NOT_FOUND;
551 AppWidgetManagerService::RequestSharedMemoryId(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height, int& shmId)
553 _AppWidgetContext* pAppWidgetContext = this->Find(appId, instanceId);
554 SysTryReturnResult(NID_SHELL, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
556 // if(pAppWidgetContext->HasValidClientId() == false)
558 // String fullAppId = __pIpcServer->GetClientApplicationId();
559 // this->SetIpcClientIds(fullAppId, __pIpcServer->GetClientId());
562 shmId = pAppWidgetContext->GetSharedMemId(width, height);
563 SysTryReturnResult(NID_SHELL, pAppWidgetContext , shmId != -1, "[E_SYSTEM] failed to GetSharedMemId for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
569 AppWidgetManagerService::RequestSharedMemoryIdForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height, int& shmId)
571 _AppWidgetContext* pAppWidgetContext = this->Find(appId, instanceId);
572 SysTryReturnResult(NID_SHELL, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
574 _AppWidgetPopupContext* pPd = pAppWidgetContext->GetAppWidgetPopup();
575 SysTryReturnResult(NID_SHELL, pPd , E_SYSTEM, "[E_SYSTEM] pPd is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
577 if(pPd->HasValidClientId() == false)
579 String fullAppId = __pIpcServer->GetClientApplicationId();
580 pPd->SetIpcClientId(__pIpcServer->GetClientId());
583 shmId = pPd->GetSharedMemId(width, height);
584 SysTryReturnResult(NID_SHELL, pAppWidgetContext , shmId != -1, "[E_SYSTEM] failed to GetSharedMemId for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
590 AppWidgetManagerService::RequestSyncSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height)
592 _AppWidgetContext* pAppWidgetContext = this->Find(appId, instanceId);
593 SysTryReturnResult(NID_SHELL, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
595 return pAppWidgetContext->RequestUpdateRemote(width, height);
599 AppWidgetManagerService::RequestSyncSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId)
601 _AppWidgetContext* pAppWidgetContext = this->Find(appId, instanceId);
602 SysTryReturnResult(NID_SHELL, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
603 SysTryReturnResult(NID_SHELL, pAppWidgetContext->GetAppWidgetPopup(), E_SYSTEM, "[E_SYSTEM] GetAppWidgetPopup() returns null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
605 return pAppWidgetContext->GetAppWidgetPopup()->RequestUpdateRemote();
609 AppWidgetManagerService::RequestReleaseSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId)
611 // std::unique_ptr<char[]> pkgname(_StringConverter::CopyToCharArrayN(appId));
612 // std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(instanceId));
614 // _AppWidgetContext* pAppWidgetContext = this->Find(appId, instanceId);
615 // SysTryReturnResult(NID_SHELL, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
617 // return pAppWidgetContext->ReleaseSharedMem();
622 AppWidgetManagerService::RequestReleaseSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId)
624 // std::unique_ptr<char[]> pkgname(_StringConverter::CopyToCharArrayN(appId));
625 // std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(instanceId));
627 // _AppWidgetContext* pAppWidgetContext = this->Find(appId, instanceId);
628 // SysTryReturnResult(NID_SHELL, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
629 // SysTryReturnResult(NID_SHELL, pAppWidgetContext->GetAppWidgetPopup(), E_SYSTEM, "[E_SYSTEM] GetAppWidgetPopup() returns null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
631 // return pAppWidgetContext->GetAppWidgetPopup()->ReleaseSharedMem();
635 AppWidgetManagerService::_TaskHandlerThread::~_TaskHandlerThread(void)
641 AppWidgetManagerService::_TaskHandlerThread::OnUserEventReceivedN(RequestId reqId, IList* pArgs)
643 SysTryReturnVoidResult(NID_SHELL, pArgs != null, E_INVALID_STATE, "pArgs is null!.");
645 SysLog(NID_SHELL, "Enter.");
649 case LOCAL_EVENT_REQUEST_UPDATE:
651 _AppWidgetContext* pAppWidgetContext = dynamic_cast<_AppWidgetContext*>( pArgs->GetAt(0) );
652 SysTryReturnVoidResult(NID_SHELL, pAppWidgetContext != null, E_INVALID_STATE, "_AppWidget is null!.");
654 String* pArgument = dynamic_cast<String*>( pArgs->GetAt(1) );
655 SysTryReturnVoidResult(NID_SHELL, pArgument != null, E_INVALID_STATE, "pArgument is null!.");
657 pAppWidgetContext->OnUpdate(*pArgument);
666 SysAssertf(false, "never get here!");
669 SysLog(NID_SHELL, "Exit.");
672 } } } //namespace Tizen { namespace Shell { namespace App {