// _AppWidgetContext class
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
_AppWidgetContext::_AppWidgetContext(_AppContext* pAppContext, const String& userInfo, const String& providerId, const String& instanceId, int width, int height, int period, int priority)
- :__isTouchAvailable(false)
+ :__isRemoteBufferProxyCreated(false)
,__hasPendingRequest(false)
,__isForeground(true)
,__width(width)
void
_AppWidgetContext::OnTouchEventReceived(buffer_event event, double timestamp, double x, double y)
{
- if (__pAppContext->GetConnectionState() == CONNECTION_STATE_CONNECTED && __isTouchAvailable)
+ if (__pAppContext->GetConnectionState() == CONNECTION_STATE_CONNECTED && __isRemoteBufferProxyCreated)
{
SysLog(NID_SHELL, "%d, %f, %f", event, x, y);
AppWidgetManagerService::GetInstance()->SendTouchEvent(GetClientId(), GetInstanceId(), event, timestamp, x, y);
{
__pPendingTouchEventList->Add(new (nothrow) PendingTouchEvent(event, timestamp, x, y));
- if( AppManager::GetInstance()->IsRunning(this->GetAppId() ) == false)
+ if( AppManager::GetInstance()->IsRunning(this->GetAppId() ) == false ||
+ ( __pAppContext->GetConnectionState() == CONNECTION_STATE_CONNECTED && __isRemoteBufferProxyCreated == false))
{
SysLog(NID_SHELL, "request to start AppControl");
std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgsN() );
pArgs->Add(new (nothrow) String(ARG_KEY_X), new (nothrow) String(Double::ToString(x)));
pArgs->Add(new (nothrow) String(ARG_KEY_Y), new (nothrow) String(Double::ToString(y)));
- SendRequestToApp(GetAppId(), APPWIDGET_ON_TOUCH, pArgs.get());
+ _AppWidgetRequestHelper::SendAppControlRequest(GetAppId(), APPWIDGET_ON_TOUCH, pArgs.get());
}
}
}
{
SysSecureLog(NID_SHELL, "%ls, %ls", GetInstanceId().GetPointer(), GetProviderId().GetPointer());
- __isTouchAvailable = false;
+ __isRemoteBufferProxyCreated = false;
if (GetAppWidgetPopup())
{
OnPopupDestoyed();
int id = __pAppWidgetRemoteBuffer->Acquire(w, h);
if (id != -1)
{
- __isTouchAvailable = true;
+ __isRemoteBufferProxyCreated = true;
}
return id;
}
{
static bool isServiceCreated = false;
- if (isServiceCreated == false)
+ if (isServiceCreated == true)
+ {
+ return;
+ }
+
+ AppWidgetManagerService* pSvc = null;
+ String coreDaemonId = "osp-appwidget-service";
+ if (pExtraData)
{
String key(KEY_NAME);
const String* pValue = dynamic_cast<const String*>(pExtraData->GetValue(key));
- AppWidgetManagerService* pSvc = null;
-
if (pValue)
{
- std::unique_ptr<char[]> pIdForCoreDaemon(_StringConverter::CopyToCharArrayN(*pValue));
- pSvc = AppWidgetManagerService::CreateInstance(pIdForCoreDaemon.get());
+ coreDaemonId = *pValue;
}
- else
- {
- pSvc = AppWidgetManagerService::CreateInstance("osp-appwidget-service");
- }
- AppAssertf(pSvc != null, "AppWidgetManagerService::GetInstance() failed.");
-
- isServiceCreated = true;
}
+
+ std::unique_ptr<char[]> pIdForCoreDaemon(_StringConverter::CopyToCharArrayN(coreDaemonId));
+ pSvc = AppWidgetManagerService::CreateInstance(pIdForCoreDaemon.get());
+ AppAssertf(pSvc != null, "AppWidgetManagerService::GetInstance() failed.");
+ isServiceCreated = true;
}
}