)
SET (${this_target}_SOURCE_FILES
- src/OspLiveboxService.cpp
- src/OspLiveboxServiceEntry.cpp
- src/FShell_LiveboxContext.cpp
- src/FShell_LiveboxContextBase.cpp
- src/FShell_LiveboxManagerService.cpp
- src/FShell_LiveboxManagerStub.cpp
- src/FShell_LiveboxPopupContext.cpp
+ src/OspAppWidgetService.cpp
+ src/OspAppWidgetServiceEntry.cpp
+ src/FShell_AppWidgetContext.cpp
+ src/FShell_AppWidgetContextBase.cpp
+ src/FShell_AppWidgetManagerService.cpp
+ src/FShell_AppWidgetManagerStub.cpp
+ src/FShell_AppWidgetPopupContext.cpp
)
## SET EXTRA COMPILER FLAGS
//
/**
- * @file FShell_LiveboxContext.h
- * @brief This is the header file for the _LiveboxContext class.
+ * @file FShell_AppWidgetContext.h
+ * @brief This is the header file for the _AppWidgetContext class.
*
- * This header file contains the declarations of the _LiveboxContext class.
+ * This header file contains the declarations of the _AppWidgetContext class.
*/
-#ifndef _FSHELL_INTERNAL_LIVEBOX_CONTEXT_H_
-#define _FSHELL_INTERNAL_LIVEBOX_CONTEXT_H_
+#ifndef _FSHELL_INTERNAL_APPWIDGET_CONTEXT_H_
+#define _FSHELL_INTERNAL_APPWIDGET_CONTEXT_H_
#include <provider.h>
#include <provider_buffer.h>
#include <FBaseObject.h>
#include <FBaseColArrayList.h>
-#include "FShell_LiveboxContextBase.h"
+#include "FShell_AppWidgetContextBase.h"
#define MAX_PACKAGENAME 512
namespace Tizen { namespace Shell { namespace App
{
-class _LiveboxPopupContext;
+class _AppWidgetPopupContext;
-class _LiveboxContext
- : public _LiveboxContextBase
+class _AppWidgetContext
+ : public _AppWidgetContextBase
,public Tizen::Base::Runtime::ITimerEventListener
{
public:
- _LiveboxContext(const Tizen::Base::String& name, const Tizen::Base::String& appId, const Tizen::Base::String& instanceId,
+ _AppWidgetContext(const Tizen::Base::String& name, const Tizen::Base::String& appId, const Tizen::Base::String& instanceId,
int width, int height, int period, int priority);
- virtual ~_LiveboxContext();
+ virtual ~_AppWidgetContext();
void OnAdded(void);
void OnUpdate(const Tizen::Base::String& argument);
void OnResize(int width, int height);
result RequestUpdateRemote(int width, int height);
- _LiveboxPopupContext* GetLiveboxPopup() const;
+ _AppWidgetPopupContext* GetAppWidgetPopup() const;
virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y);
void RestartLifeDurationTimer();
virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
private:
- _LiveboxPopupContext* __pLiveboxPopup;
+ _AppWidgetPopupContext* __pAppWidgetPopup;
Tizen::Base::Runtime::Timer __lifeDurationTimer;
Tizen::Base::Runtime::Timer __UpdateTimer;
int __UpdateMillis;
} } } // Tizen::Shell::App {
-#endif // _FSHELL_INTERNAL_LIVEBOX_CONTEXT_H_
+#endif // _FSHELL_INTERNAL_APPWIDGET_CONTEXT_H_
//
/**
- * @file FShell_LiveboxContextBase.h
- * @brief This is the header file for the _LiveboxContextBase class.
+ * @file FShell_AppWidgetContextBase.h
+ * @brief This is the header file for the _AppWidgetContextBase class.
*
- * This header file contains the declarations of the _LiveboxContextBase class.
+ * This header file contains the declarations of the _AppWidgetContextBase class.
*/
-#ifndef _FSHELL_INTERNAL_LIVEBOX_CONTEXT_BASE_H_
-#define _FSHELL_INTERNAL_LIVEBOX_CONTEXT_BASE_H_
+#ifndef _FSHELL_INTERNAL_APPWIDGET_CONTEXT_BASE_H_
+#define _FSHELL_INTERNAL_APPWIDGET_CONTEXT_BASE_H_
#include <provider.h>
#include <FBaseObject.h>
#include <FBaseColHashMap.h>
-#define LIVEBOX_PROVIDER_ID_ENABLE true
+#define APPWIDGET_PROVIDER_ID_ENABLE true
typedef struct _bundle_t bundle;//TODO move code to osp-appfw
namespace Tizen { namespace Shell { namespace App
{
-class _LiveboxContextBase:
+class _AppWidgetContextBase:
public Tizen::Base::Object
{
public:
- _LiveboxContextBase(target_type type, const Tizen::Base::String& userInfo, const Tizen::Base::String& providerId, const Tizen::Base::String& instanceId, int width, int height, int priority);
- virtual ~_LiveboxContextBase();
+ _AppWidgetContextBase(target_type type, const Tizen::Base::String& userInfo, const Tizen::Base::String& providerId, const Tizen::Base::String& instanceId, int width, int height, int priority);
+ virtual ~_AppWidgetContextBase();
virtual void OnPopupCreated(double x, double y, int width, int height) = 0;
virtual void OnPopupDestoyed(void) = 0;
void SetClientId(int clientId);
bool HasValidClientId() const;
- // for buffered livebox
+ // for buffered appWidget
int GetSharedMemId(int w, int h);
result ReleaseSharedMem();
int __ipcClientId;
private:
- void *__buffer;
struct livebox_buffer *__buffer_info;
+ void *__buffer;
};
-class _LiveboxRequestHelper
+class _AppWidgetRequestHelper
{
public:
static result SendRequestToApp(const Tizen::App::AppId& appId, const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pArgs);
};
} /* namespace App */
-} /* namespace Livebox */
+} /* namespace AppWidget */
} /* namespace Samsung */
-#endif // _FSHELL_INTERNAL_LIVEBOX_CONTEXT_BASE_H_
+#endif // _FSHELL_INTERNAL_APPWIDGET_CONTEXT_BASE_H_
//
/**
- * @file FShell_LiveboxManagerService.h
- * @brief This is the header file for the %LiveboxManagerService class.
+ * @file FShell_AppWidgetManagerService.h
+ * @brief This is the header file for the %AppWidgetManagerService class.
*
- * This header file contains the declarations of the %LiveboxManagerService class.
+ * This header file contains the declarations of the %AppWidgetManagerService class.
*/
-#ifndef _FSHELL_INTERNAL_LIVEBOX_MANAGER_SERVICE_H_
-#define _FSHELL_INTERNAL_LIVEBOX_MANAGER_SERVICE_H_
+#ifndef _FSHELL_INTERNAL_APPWIDGET_MANAGER_SERVICE_H_
+#define _FSHELL_INTERNAL_APPWIDGET_MANAGER_SERVICE_H_
#include <FBaseObject.h>
#include <FBaseString.h>
#include <FBaseRtTimer.h>
#include <FBaseColArrayListT.h>
-#include "FShell_LiveboxContext.h"
-#include "FShell_LiveboxManagerStub.h"
+#include "FShell_AppWidgetContext.h"
+#include "FShell_AppWidgetManagerStub.h"
namespace Tizen { namespace Shell { namespace App {
-class LiveboxManagerService
- :public Tizen::Shell::App::_LiveboxManagerStub
+class AppWidgetManagerService
+ :public Tizen::Shell::App::_AppWidgetManagerStub
,public Tizen::Base::Runtime::ITimerEventListener
{
public:
- static LiveboxManagerService* GetInstance(void);
- result AddLivebox(_LiveboxContext* pLivebox);
- result RemoveLivebox(const char* pPackageName, const char* pId, bool free);
+ static AppWidgetManagerService* GetInstance(void);
+ result AddAppWidget(_AppWidgetContext* pAppWidget);
+ result RemoveAppWidget(const char* pPackageName, const char* pId, bool free);
private:
result Construct();
result DeinitializeMasterDaemonEventReceiver(void);
// master daemon callbacks
- static int LiveboxConnected(struct event_arg *arg, void* data);
- static int LiveboxDisconnected(struct event_arg *arg, void* data);
- static int OnLiveboxCreate(struct event_arg *arg, int *width, int *height, double *priority, void* data);
- static int OnLiveboxDestroy(struct event_arg *arg, void* data);
- static int OnLiveboxUpdate(struct event_arg *arg, void* data);
- static int OnLiveboxPopupCreate(struct event_arg *arg, void* data);
- static int OnLiveboxPopupDestroy(struct event_arg *arg, void* data);
+ static int AppWidgetConnected(struct event_arg *arg, void* data);
+ static int AppWidgetDisconnected(struct event_arg *arg, void* data);
+ static int OnAppWidgetCreate(struct event_arg *arg, int *width, int *height, double *priority, void* data);
+ static int OnAppWidgetDestroy(struct event_arg *arg, void* data);
+ static int OnAppWidgetUpdate(struct event_arg *arg, void* data);
+ static int OnAppWidgetPopupCreate(struct event_arg *arg, void* data);
+ static int OnAppWidgetPopupDestroy(struct event_arg *arg, void* data);
static int OnLivePause(struct event_arg *arg, void* data);
- static int OnLiveboxResume(struct event_arg *arg, void* data);
- static int OnLiveboxClick(struct event_arg *arg, void* data);
- static int OnLiveboxResize(struct event_arg *arg, void* data);
- static int OnLiveboxPeriodChaned(struct event_arg *arg, void* data);
+ static int OnAppWidgetResume(struct event_arg *arg, void* data);
+ 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);
// stub implementations
virtual result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument);
virtual result RequestReleaseSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId);
// internal functions
- LiveboxManagerService();
- virtual ~LiveboxManagerService();
+ AppWidgetManagerService();
+ virtual ~AppWidgetManagerService();
virtual void OnIpcClientConnected(const Tizen::Io::_IpcServer& server, int clientId);
virtual void OnIpcClientDisconnected(const Tizen::Io::_IpcServer&server, int clientId);
// helpers
result SetClientIds(const Tizen::App::AppId& appId, int clientId);
- int UpdateAllLiveboxesByAppId(const Tizen::Base::String& appId);
+ int UpdateAllAppWidgetesByAppId(const Tizen::Base::String& appId);
void StartPingTimer();
virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
- _LiveboxContext* Find(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId) const;
+ _AppWidgetContext* Find(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId) const;
class _TaskHandlerThread
};
private:
- Tizen::Base::Collection::ArrayListT<_LiveboxContext*> __liveboxContextList;
+ Tizen::Base::Collection::ArrayListT<_AppWidgetContext*> __appWidgetContextList;
Tizen::Base::Runtime::Timer __pingTimer;
_TaskHandlerThread __handlerThread;
};
} } } // Tizen::Shell::App {
-#endif // _FSHELL_INTERNAL_LIVEBOX_MANAGER_SERVICE_H_
+#endif // _FSHELL_INTERNAL_APPWIDGET_MANAGER_SERVICE_H_
//
/**
- * @file FShell_LiveboxManagerStub.h
- * @brief This is the header file for the %_LiveboxManagerStub class.
+ * @file FShell_AppWidgetManagerStub.h
+ * @brief This is the header file for the %_AppWidgetManagerStub class.
*
- * This header file contains the declarations of the %_LiveboxManagerStub class.
+ * This header file contains the declarations of the %_AppWidgetManagerStub class.
*/
-#ifndef _FSHELL_INTERNAL_LIVEBOX_MANAGER_STUB_H_
-#define _FSHELL_INTERNAL_LIVEBOX_MANAGER_STUB_H_
+#ifndef _FSHELL_INTERNAL_APPWIDGET_MANAGER_STUB_H_
+#define _FSHELL_INTERNAL_APPWIDGET_MANAGER_STUB_H_
#include <FBaseObject.h>
#include <FBaseString.h>
namespace Tizen { namespace Shell { namespace App {
/**
- * @class _LiveboxManagerStub
+ * @class _AppWidgetManagerStub
* @brief Handles IPC requests and calls real methods.
* @since 2.1
*/
-class _LiveboxManagerStub
+class _AppWidgetManagerStub
: public Tizen::Base::Object
, public Tizen::Io::_IIpcServerEventListener
, virtual public Tizen::Base::Runtime::IEventListener
bool SendTouchEventForPD(const int clientId, const Tizen::Base::String& instanceId, int eventType, double timestamp, double x, double y);
protected:
- _LiveboxManagerStub(void);
- virtual ~_LiveboxManagerStub(void);
+ _AppWidgetManagerStub(void);
+ virtual ~_AppWidgetManagerStub(void);
// handlers
bool OnRequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument, result* pRes);
result StartIpcServer(void);
private:
- _LiveboxManagerStub(const _LiveboxManagerStub& value);
- _LiveboxManagerStub& operator =(const _LiveboxManagerStub& source);
+ _AppWidgetManagerStub(const _AppWidgetManagerStub& value);
+ _AppWidgetManagerStub& operator =(const _AppWidgetManagerStub& source);
protected:
Tizen::Io::_IpcServer *__pIpcServer;
-}; //_LiveboxManagerStub
+}; //_AppWidgetManagerStub
}}}
-#endif//_FSHELL_INTERNAL_LIVEBOX_MANAGER_STUB_H_
+#endif//_FSHELL_INTERNAL_APPWIDGET_MANAGER_STUB_H_
//
/**
- * @file FShell_LiveboxPopupContext.h
- * @brief This is the header file for the %_LiveboxPopupContext class.
+ * @file FShell_AppWidgetPopupContext.h
+ * @brief This is the header file for the %_AppWidgetPopupContext class.
*
- * This header file contains the declarations of the %_LiveboxPopupContext class.
+ * This header file contains the declarations of the %_AppWidgetPopupContext class.
*/
-#ifndef _FSHELL_INTERNAL_LIVEBOX_POPUP_CONTEXT_H_
-#define _FSHELL_INTERNAL_LIVEBOX_POPUP_CONTEXT_H_
+#ifndef _FSHELL_INTERNAL_APPWIDGET_POPUP_CONTEXT_H_
+#define _FSHELL_INTERNAL_APPWIDGET_POPUP_CONTEXT_H_
-#include "FShell_LiveboxContextBase.h"
+#include "FShell_AppWidgetContextBase.h"
namespace Tizen { namespace Shell { namespace App
{
-class _LiveboxPopupContext
- :public Tizen::Shell::App::_LiveboxContextBase
+class _AppWidgetPopupContext
+ :public Tizen::Shell::App::_AppWidgetContextBase
{
public:
- _LiveboxPopupContext(const Tizen::Base::String& userInfo, const Tizen::Base::String& appId, const Tizen::Base::String& instanceId, int width, int height, int priority);
- virtual ~_LiveboxPopupContext();
+ _AppWidgetPopupContext(const Tizen::Base::String& userInfo, const Tizen::Base::String& appId, const Tizen::Base::String& instanceId, int width, int height, int priority);
+ virtual ~_AppWidgetPopupContext();
// event handler
void OnPopupCreated(double x, double y, int width, int height);
} /* namespace App */
-} /* namespace Livebox */
+} /* namespace AppWidget */
} /* namespace Samsung */
-#endif // _FSHELL_INTERNAL_LIVEBOX_POPUP_CONTEXT_H_
+#endif // _FSHELL_INTERNAL_APPWIDGET_POPUP_CONTEXT_H_
//
/**
- * @file OspLiveboxService.h
- * @brief This is the header file for the OspLiveboxService class.
+ * @file OspAppWidgetService.h
+ * @brief This is the header file for the OspAppWidgetService class.
*
- * This header file contains the declarations of the OspLiveboxService class.
+ * This header file contains the declarations of the OspAppWidgetService class.
*/
-#ifndef _OSP_LIVEBOX_SERVICE_H_
-#define _OSP_LIVEBOX_SERVICE_H_
+#ifndef _OSP_APPWIDGET_SERVICE_H_
+#define _OSP_APPWIDGET_SERVICE_H_
#include <FApp.h>
#include <FBase.h>
#include <FSystem.h>
/**
- * [OspLiveboxService] ServiceApp must inherit from ServiceApp class
+ * [OspAppWidgetService] ServiceApp must inherit from ServiceApp class
* which provides basic features necessary to define an ServiceApp.
*/
-class OspLiveboxService
+class OspAppWidgetService
: public Tizen::App::ServiceApp
{
public:
/**
- * [OspLiveboxService] ServiceApp must have a factory method that creates an instance of itself.
+ * [OspAppWidgetService] ServiceApp must have a factory method that creates an instance of itself.
*/
static Tizen::App::ServiceApp* CreateInstance(void);
public:
- OspLiveboxService();
- ~OspLiveboxService();
+ OspAppWidgetService();
+ ~OspAppWidgetService();
public:
//
/**
- * @file FShell_LiveboxContext.cpp
- * @brief This is the implementation for the _LiveboxContext class.
+ * @file FShell_AppWidgetContext.cpp
+ * @brief This is the implementation for the _AppWidgetContext class.
*/
#include <stdlib.h>
#include <FApp_AppControlManager.h>
-#include "FShell_LiveboxManagerService.h"
-#include "FShell_LiveboxPopupContext.h"
-#include "FShell_LiveboxContextBase.h"
-#include "FShell_LiveboxContext.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::Base::Collection;
-
-const String LIVEBOX_ON_ADD(L"Livebox='event=add'");
-const String LIVEBOX_ON_REMOVE(L"Livebox='event=remove'");
-const String LIVEBOX_ON_UPDATE(L"Livebox='event=update'");
-const String LIVEBOX_ON_RESIZE(L"Livebox='event=resize'");
-const String LIVEBOX_ON_TOUCH(L"Livebox='event=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 String ARG_KEY_WIDTH = L"_Width";
const String ARG_KEY_HEIGHT = L"_Height";
const int LIVE_DURATION_MSEC= 30000;//30sec
-_LiveboxContext::_LiveboxContext(const String& info, const String& providerId, const String& instanceId, int width, int height, int period, int priority)
-:_LiveboxContextBase(TYPE_LB, info, providerId, instanceId, width, height, priority)
-,__pLiveboxPopup(null), __UpdateMillis(period)
+_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)
{
SysLog(NID_APP, "period(%d)", period);
}
}
-_LiveboxContext::~_LiveboxContext()
+_AppWidgetContext::~_AppWidgetContext()
{
SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
__lifeDurationTimer.Cancel();
__UpdateTimer.Cancel();
- if (__pLiveboxPopup)
+ if (__pAppWidgetPopup)
{
- SysLog(NID_APP, "Destroying dangling LiveboxPopup instance..");
- __pLiveboxPopup->OnPopupDestoyed();
- delete __pLiveboxPopup;
+ SysLog(NID_APP, "Destroying dangling AppWidgetPopup instance..");
+ __pAppWidgetPopup->OnPopupDestoyed();
+ delete __pAppWidgetPopup;
}
}
-_LiveboxPopupContext*
-_LiveboxContext::GetLiveboxPopup() const
+_AppWidgetPopupContext*
+_AppWidgetContext::GetAppWidgetPopup() const
{
- return __pLiveboxPopup;
+ return __pAppWidgetPopup;
}
void
-_LiveboxContext::OnAdded(void)
+_AppWidgetContext::OnAdded(void)
{
SendAddRequest(__width, __height);
}
void
-_LiveboxContext::OnRemoved()
+_AppWidgetContext::OnRemoved()
{
SendRemoveRequest();
}
void
-_LiveboxContext::OnUpdate(const String& argument)
+_AppWidgetContext::OnUpdate(const String& argument)
{
SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
}
void
-_LiveboxContext::OnResize(int width, int height)
+_AppWidgetContext::OnResize(int width, int height)
{
SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
}
void
-_LiveboxContext::OnForeground()
+_AppWidgetContext::OnForeground()
{
SysLog(NID_APP, "");
__isForeground = true;
}
void
-_LiveboxContext::OnBackground()
+_AppWidgetContext::OnBackground()
{
SysLog(NID_APP, "");
__isForeground = false;
}
void
-_LiveboxContext::OnPopupCreated(double x, double y, int width, int height)
+_AppWidgetContext::OnPopupCreated(double x, double y, int width, int height)
{
- __pLiveboxPopup = new (std::nothrow) _LiveboxPopupContext(__userInfo, __providerId, __instanceId, width, height, __priority);
- __pLiveboxPopup->SetClientId(__ipcClientId);
- __pLiveboxPopup->OnPopupCreated(x, y, width, height);
+ __pAppWidgetPopup = new (std::nothrow) _AppWidgetPopupContext(__userInfo, __providerId, __instanceId, width, height, __priority);
+ __pAppWidgetPopup->SetClientId(__ipcClientId);
+ __pAppWidgetPopup->OnPopupCreated(x, y, width, height);
__lifeDurationTimer.Cancel();
}
void
-_LiveboxContext::OnPopupDestoyed(void)
+_AppWidgetContext::OnPopupDestoyed(void)
{
- if (__pLiveboxPopup)
+ if (__pAppWidgetPopup)
{
- __pLiveboxPopup->OnPopupDestoyed();
- delete __pLiveboxPopup;
- __pLiveboxPopup = null;
+ __pAppWidgetPopup->OnPopupDestoyed();
+ delete __pAppWidgetPopup;
+ __pAppWidgetPopup = null;
}
RestartLifeDurationTimer();
}
result
-_LiveboxContext::SendAddRequest(int width, int height)
+_AppWidgetContext::SendAddRequest(int width, int height)
{
/* std::unique_ptr<ArrayList, AllElementsDeleter> pArgs (new (std::nothrow) ArrayList);
pArgs->Construct();
pArgs->Add(new String(ARG_KEY_WIDTH), new String(Integer::ToString(width)));
pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(height)));
- return SendRequestToApp( __appId, LIVEBOX_ON_ADD, pArgs.get());
+ return SendRequestToApp( __appId, APPWIDGET_ON_ADD, pArgs.get());
}
result
-_LiveboxContext::SendUpdateRequest(int width, int height, const String& argument)
+_AppWidgetContext::SendUpdateRequest(int width, int height, const String& argument)
{
std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(height)));
pArgs->Add(new String(ARG_KEY_ARGUMENT), new String(argument));
- return SendRequestToApp( __appId, LIVEBOX_ON_UPDATE, pArgs.get());
+ return SendRequestToApp( __appId, APPWIDGET_ON_UPDATE, pArgs.get());
}
result
-_LiveboxContext::SendResizeRequest(int width, int height)
+_AppWidgetContext::SendResizeRequest(int width, int height)
{
std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
pArgs->Add(new String(ARG_KEY_WIDTH), new String(Integer::ToString(width)));
pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(height)));
- return SendRequestToApp( __appId, LIVEBOX_ON_RESIZE, pArgs.get());
+ return SendRequestToApp( __appId, APPWIDGET_ON_RESIZE, pArgs.get());
}
result
-_LiveboxContext::SendRemoveRequest()
+_AppWidgetContext::SendRemoveRequest()
{
std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
- return SendRequestToApp( __appId, LIVEBOX_ON_REMOVE, pArgs.get());
+ return SendRequestToApp( __appId, APPWIDGET_ON_REMOVE, pArgs.get());
}
result
-_LiveboxContext::SendTouchEvent(buffer_event event, double timestamp, double x, double y)
+_AppWidgetContext::SendTouchEvent(buffer_event event, double timestamp, double x, double y)
{
SysLog(NID_APP, "");
if( HasValidClientId() == false )
pArgs->Add(new String(ARG_KEY_X), new String(Double::ToString(x)));
pArgs->Add(new String(ARG_KEY_Y), new String(Double::ToString(y)));
- return SendRequestToApp( __appId, LIVEBOX_ON_TOUCH, pArgs.get());
+ return SendRequestToApp( __appId, APPWIDGET_ON_TOUCH, pArgs.get());
}
else
{
// SysAssertf( Tizen::App::AppManager::GetInstance()->IsRunning(__appId) == false, "application isn't running");
- LiveboxManagerService::GetInstance()->SendTouchEvent(__ipcClientId, __instanceId, event, timestamp, x, y);
+ AppWidgetManagerService::GetInstance()->SendTouchEvent(__ipcClientId, __instanceId, event, timestamp, x, y);
}
return E_SUCCESS;
}
result
-_LiveboxContext::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs)
+_AppWidgetContext::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs)
{
- result r = _LiveboxContextBase::SendRequestToApp(appId, operation, pArgs);
+ result r = _AppWidgetContextBase::SendRequestToApp(appId, operation, pArgs);
RestartLifeDurationTimer();
return r;
}
result
-_LiveboxContext::RequestUpdateRemote(int width, int height)
+_AppWidgetContext::RequestUpdateRemote(int width, int height)
{
- /*if( GetLiveboxPopup() != null)
+ /*if( GetAppWidgetPopup() != null)
{
- SysLog(NID_APP, "LiveboxPopup is appeared, so livebox doesn't need to update");
+ SysLog(NID_APP, "AppWidgetPopup is appeared, so appWidget doesn't need to update");
return E_SUCCESS;
}*/
std::unique_ptr<char[]> packageName(_StringConverter::CopyToCharArrayN(__providerId));
}
void
-_LiveboxContext::RestartLifeDurationTimer()
+_AppWidgetContext::RestartLifeDurationTimer()
{
__lifeDurationTimer.Cancel();
__lifeDurationTimer.Start(LIVE_DURATION_MSEC);
}
void
-_LiveboxContext::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
+_AppWidgetContext::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
{
SysLog(NID_APP, "");
if( &timer == &__lifeDurationTimer)
{
- SysLog(NID_APP, "lifeDuration timer is expired, so terminating livebox app(%ls)..", __providerId.GetPointer() );
+ SysLog(NID_APP, "lifeDuration timer is expired, so terminating appWidget app(%ls)..", __providerId.GetPointer() );
ReleaseSharedMem();
AppManager::GetInstance()->TerminateApplication(__appId);
}
else if( &timer == &__UpdateTimer)
{
- SysLog(NID_APP, "update timer is expired for livebox app(%ls)..", __providerId.GetPointer() );
+ SysLog(NID_APP, "update timer is expired for appWidget app(%ls)..", __providerId.GetPointer() );
OnUpdate(L"");
}
}
//
/**
- * @file FShell_LiveboxContextBase.cpp
- * @brief This is the implementation for the _LiveboxContextBase class.
+ * @file FShell_AppWidgetContextBase.cpp
+ * @brief This is the implementation for the _AppWidgetContextBase class.
*/
#include <stdlib.h>
#include <FApp_AppArg.h>
#include <FApp_AppControlManager.h>
#include <FShell_TemplateUtil.h>
-#include <FShell_LiveboxManagerImpl.h>
+#include <FShell_AppWidgetManagerImpl.h>
-#include "FShell_LiveboxContextBase.h"
+#include "FShell_AppWidgetContextBase.h"
// provider/src/fb.c
struct fb_info {
void *data;
};
-static int LiveboxHandleBufferEventCallback( 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
using namespace Tizen::Base::Collection;
-const String LIVEBOX_ON_ADD(L"Livebox='event=add'");
-const String LIVEBOX_ON_REMOVE(L"Livebox='event=remove'");
-const String LIVEBOX_ON_UPDATE(L"Livebox='event=update'");
-const String LIVEBOX_ON_RESIZE(L"Livebox='event=resize'");
-const String LIVEBOX_ON_TOUCH(L"Livebox='event=touch'");
-const String LIVEBOX_TRAY_ON_CREATE(L"LiveboxTray='event=create'");
-const String LIVEBOX_TRAY_ON_DESTROY(L"LiveboxTray='event=destroy'");
-const String LIVEBOX_TRAY_ON_TOUCH(L"LiveboxTray='event=touch'");
+const String APPWIDGET_ON_ADD(L"AppWidget='event=add'");
+const String APPWIDGET_ON_REMOVE(L"AppWidget='event=remove'");
+const String APPWIDGET_ON_UPDATE(L"AppWidget='event=update'");
+const String APPWIDGET_ON_RESIZE(L"AppWidget='event=resize'");
+const String APPWIDGET_ON_TOUCH(L"AppWidget='event=touch'");
+const String APPWIDGET_POPUP_ON_CREATE(L"AppWidgetPopup='event=create'");
+const String APPWIDGET_POPUP_ON_DESTROY(L"AppWidgetPopup='event=destroy'");
+const String APPWIDGET_POPUP_ON_TOUCH(L"AppWidgetPopup='event=touch'");
const String ARG_KEY_INSTANCE_ID = L"_InstanceId";
const String ARG_KEY_PROVIDER_NAME = L"_ProviderName";
const String ARG_KEY_USER_INFO = L"_UserInfo";
-_LiveboxContextBase::_LiveboxContextBase(target_type type, const String& userInfo, const String& providerId, const String& instanceId, int width, int height, int priority)
+_AppWidgetContextBase::_AppWidgetContextBase(target_type type, const String& userInfo, const String& providerId, const String& instanceId, int width, int height, int priority)
:__type(type)
,__userInfo(userInfo)
,__providerId(providerId)
,__isForeground(true)
,__ipcClientId(-1)
,__buffer_info(null)
- ,__buffer(null) // __pEcoreEvas(null), __pEvas(null), __current(0)
+ ,__buffer(null)
{
- _LiveboxManagerImpl::ExtractAppIdAndProviderName(providerId, __appId, __providerName);
+ _AppWidgetManagerImpl::ExtractAppIdAndProviderName(providerId, __appId, __providerName);
SysLog(NID_APP, "appId(%ls), providerId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __appId.GetPointer(), __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
}
-_LiveboxContextBase::~_LiveboxContextBase()
+_AppWidgetContextBase::~_AppWidgetContextBase()
{
SysLog(NID_APP, "providerId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
}
void
-_LiveboxContextBase::SetClientId(int clientId)
+_AppWidgetContextBase::SetClientId(int clientId)
{
__ipcClientId = clientId;
}
bool
-_LiveboxContextBase::HasValidClientId() const
+_AppWidgetContextBase::HasValidClientId() const
{
SysLog(NID_APP, "%d", __ipcClientId);
return (__ipcClientId > -1);
}
int
-_LiveboxContextBase::GetSharedMemId(int w, int h)
+_AppWidgetContextBase::GetSharedMemId(int w, int h)
{
SysLog(NID_APP, "Enter");
std::unique_ptr<char[]> packageName(_StringConverter::CopyToCharArrayN(__providerId));
std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(__instanceId));
- __buffer_info = provider_buffer_acquire(__type, packageName.get(), id.get(), w, h, sizeof(int), LiveboxHandleBufferEventCallback, this);
+ __buffer_info = provider_buffer_acquire(__type, packageName.get(), id.get(), w, h, sizeof(int), AppWidgetHandleBufferEventCallback, this);
SysTryReturnResult(NID_APP, __buffer_info , -1, "[E_SYSTEM] failed to provider_buffer_acquire");
SysLog(NID_APP, "provider_buffer_acquire successed");
}
result
-_LiveboxContextBase::ReleaseSharedMem()
+_AppWidgetContextBase::ReleaseSharedMem()
{
SysLog(NID_APP, "Enter");
}
Tizen::Base::Collection::HashMap*
-_LiveboxContextBase::CreateRequestArgs(void)
+_AppWidgetContextBase::CreateRequestArgs(void)
{
HashMap* pArgs = new (std::nothrow) HashMap(SingleObjectDeleter);
pArgs->Construct();
}
result
-_LiveboxContextBase::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs)
+_AppWidgetContextBase::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs)
{
if( __isForeground == false)
{
- SysLog(NID_APP, "livebox isn't foreground, so, message skip");
+ SysLog(NID_APP, "appWidget isn't foreground, so, message skip");
return E_SUCCESS;
}
- return _LiveboxRequestHelper::SendRequestToApp(appId, operation, pArgs);
+ return _AppWidgetRequestHelper::SendRequestToApp(appId, operation, pArgs);
}
result
-_LiveboxRequestHelper::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs)
+_AppWidgetRequestHelper::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs)
{
SysLog(NID_APP, "appId(%ls), operation(%ls), arg count(%d)", appId.GetPointer(), operation.GetPointer(), pArgs->GetCount() );
}
/*result
-_LiveboxRequestHelper::ExtractPackageIdAndExecutableName(AppId appId, AppId& outPackageId, String& outExecutableName)
+_AppWidgetRequestHelper::ExtractPackageIdAndExecutableName(AppId appId, AppId& outPackageId, String& outExecutableName)
{
const int APP_ID_LEN = 10;
/*
// helper for bundle
result
-_LiveboxRequestHelper::AddStrArrayToBundle(bundle* b, const char* key, const IList* pList)
+_AppWidgetRequestHelper::AddStrArrayToBundle(bundle* b, const char* key, const IList* pList)
{
bundle* pb = b;
SysTryReturnResult(NID_APP, pb != NULL, E_INVALID_ARG, "Empty bundle.");
////////////////////////////////////////////
// callback
////////////////////////////////////////////
-static int LiveboxHandleBufferEventCallback( 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)
{
SysLog(NID_APP, "timestamp(%f), x(%f), y(%f)", timestamp, x, y);
- Tizen::Shell::App::_LiveboxContextBase *pLiveboxBase = static_cast<Tizen::Shell::App::_LiveboxContextBase*>(data);
- SysTryReturn(NID_APP, pLiveboxBase != null, 0, E_SYSTEM, "[E_SYSTEM] retrieved pLiveboxBase is null");
+ Tizen::Shell::App::_AppWidgetContextBase *pAppWidgetBase = static_cast<Tizen::Shell::App::_AppWidgetContextBase*>(data);
+ SysTryReturn(NID_APP, 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);
SysLog(NID_APP, "BUFFER_EVENT_UP");
}
- pLiveboxBase->SendTouchEvent(event, timestamp, x, y);
+ pAppWidgetBase->SendTouchEvent(event, timestamp, x, y);
return 0;
}
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// 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_AppWidgetManagerService.cpp
+ * @brief This is the implementation for the AppWidgetManagerService class.
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <unique_ptr.h>
+#include <provider.h>
+#include <aul.h>
+
+#include <FBase.h>
+#include <FBaseSysLog.h>
+#include <FApp.h>
+#include <FApp_AppManagerImpl.h>
+#include <FIo_IpcServer.h>
+#include <FBase_StringConverter.h>
+
+#include "FShell_AppWidgetContext.h"
+#include "FShell_AppWidgetPopupContext.h"
+#include "FShell_AppWidgetManagerStub.h"
+
+#include "FShell_AppWidgetManagerService.h"
+
+namespace Tizen { namespace Shell { namespace App {
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Runtime;
+using namespace Tizen::Io;
+using namespace Tizen::System;
+using namespace Tizen::Shell::App;
+
+
+namespace
+{
+static const RequestId LOCAL_EVENT_REQUEST_UPDATE = 0;
+}
+
+AppWidgetManagerService::AppWidgetManagerService()
+{
+}
+
+AppWidgetManagerService::~AppWidgetManagerService()
+{
+ __pingTimer.Cancel();
+ DeinitializeMasterDaemonEventReceiver();
+}
+
+AppWidgetManagerService*
+AppWidgetManagerService::GetInstance(void)
+{
+ static AppWidgetManagerService* pSelf = null;
+ if( pSelf == null)
+ {
+ pSelf = new AppWidgetManagerService();
+ SysTryReturn(NID_APP, pSelf != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
+
+ result r = pSelf->Construct();
+ SysAssertf(!IsFailed(r), "Failed to construct AppWidgetManagerService");
+ SysLog(NID_APP, "AppWidgetManagerService is created.");
+ }
+ return pSelf;
+}
+
+result
+AppWidgetManagerService::Construct()
+{
+// _AppManagerImpl::GetInstance()->AddEventListener(*this);
+
+ _AppWidgetManagerStub::StartIpcServer();
+
+ result r = __handlerThread.Construct(THREAD_TYPE_EVENT_DRIVEN);
+ SysTryReturn(NID_APP, IsFailed(r) == false, false, r, "[%s] Event thread creation failure.", GetErrorMessage(r));
+
+ r = __handlerThread.Start();
+ SysTryReturn(NID_APP, IsFailed(r) == false, false, r, "[%s] Event thread Start failure.", GetErrorMessage(r));
+
+ return InitializeMasterDaemonEventReceiver("osp-livebox-service");
+}
+
+int
+AppWidgetManagerService::AppWidgetConnected(struct event_arg *arg, void* data)
+{
+ int ret;
+ ret = provider_send_hello();
+ if (ret == 0)
+ {
+ SysLog(NID_APP, "success to be connected with master daemon");
+ AppWidgetManagerService::GetInstance()->StartPingTimer();
+
+ }
+ else
+ {
+ SysLog(NID_APP, "failed to provider_send_hello()");
+ }
+ return ret;
+}
+
+int
+AppWidgetManagerService::AppWidgetDisconnected(struct event_arg *arg, void* data)
+{
+ SysLog(NID_APP, "success to be disconnected with master daemon");
+// aul_terminate_pid(getpid());
+ return 0;
+}
+
+void
+AppWidgetManagerService::StartPingTimer()
+{
+ __pingTimer.Construct(*this);//, true);
+ __pingTimer.StartAsRepeatable(120000);
+}
+
+void
+AppWidgetManagerService::OnTimerExpired(Timer& timer)
+{
+ SysLog(NID_APP, "provider_send_ping");
+ provider_send_ping();
+}
+
+_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);
+// SysLog(NID_APP, "%ls", pAppWidgetContext->__instanceId.GetPointer());
+
+ if ( pAppWidgetContext->__instanceId == instanceId )
+ {
+// SysAssert(pAppWidgetContext->__appId == appId)
+ return pAppWidgetContext;
+ }
+ }
+ return null;
+}
+
+result
+AppWidgetManagerService::SetClientIds(const Tizen::App::AppId& appId, int clientId)
+{
+ for( int i = 0; i < __appWidgetContextList.GetCount(); i++ )
+ {
+ _AppWidgetContext* pAppWidgetContext = null;
+ __appWidgetContextList.GetAt(i, pAppWidgetContext);
+ SysLog(NID_APP, "%ls", pAppWidgetContext->__instanceId.GetPointer());
+ SysLog(NID_APP, "%ls, %ls", pAppWidgetContext->__providerId.GetPointer(), appId.GetPointer());
+
+ if ( pAppWidgetContext->__appId == appId )
+ {
+ pAppWidgetContext->SetClientId(clientId);
+ SysLog(NID_APP, "client is registered.(%d)", clientId);
+ if( clientId == -1)
+ {
+ pAppWidgetContext->ReleaseSharedMem();
+ if(pAppWidgetContext->GetAppWidgetPopup())
+ {
+ pAppWidgetContext->OnPopupDestoyed();
+ }
+ }
+ }
+ }
+ return E_SUCCESS;
+}
+
+void
+AppWidgetManagerService::OnIpcClientConnected(const _IpcServer& server, int clientId)
+{
+ //SysLog(NID_APP, "(clientId:%d)\n", clientId);
+ String fullAppId = server.GetClientAppId() + "." + server.GetClientAppExecutableName();
+ SysLog(NID_APP, "(%ls)\n", fullAppId.GetPointer());
+// this->SetClientIds(fullAppId, clientId);//Todo
+
+}
+
+void
+AppWidgetManagerService::OnIpcClientDisconnected(const _IpcServer& server, int clientId)
+{
+ String fullAppId = server.GetClientAppId() + "." + server.GetClientAppExecutableName();
+ SysLog(NID_APP, "(%ls)\n", fullAppId.GetPointer());
+ this->SetClientIds(fullAppId, -1);
+}
+
+result
+AppWidgetManagerService::AddAppWidget(_AppWidgetContext* pAppWidgetContext)
+{
+ SysLog(NID_APP, "%ls, %ls, count(%d)", pAppWidgetContext->__providerId.GetPointer(), pAppWidgetContext->__instanceId.GetPointer(), __appWidgetContextList.GetCount());
+
+ return __appWidgetContextList.Add(pAppWidgetContext);
+}
+
+result
+AppWidgetManagerService::RemoveAppWidget(const char* pPackageName, const char* pId, bool free)
+{
+ SysLog(NID_APP, "%s, %s, count(%d)", pPackageName, pId, __appWidgetContextList.GetCount());
+
+ SysTryReturn(NID_APP, ( pPackageName != null && pId != null), null, E_INVALID_ARG, "[E_INVALID_ARG]");
+ SysLog(NID_APP, "%s, %s", pPackageName, pId);
+
+ _AppWidgetContext* pAppWidgetContext = Find(pPackageName, pId);
+ SysTryReturn(NID_APP, pAppWidgetContext, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND]");
+
+ result r = __appWidgetContextList.Remove(pAppWidgetContext);
+
+ if( __appWidgetContextList.GetCount() == 0 )
+ {
+ SysLog(NID_APP, "No running native appWidget app remains, terminating osp appWidget service...");
+ Tizen::App::App::GetInstance()->Terminate();
+ }
+
+ return r;
+}
+
+
+///////////////////////////////////////////////////////
+// MasterDaemonEventReceiver implementation
+///////////////////////////////////////////////////////
+int
+AppWidgetManagerService::OnAppWidgetCreate(struct event_arg *arg, int *width, int *height, double *priority, void* data)
+{
+ SysTryReturn(NID_APP, arg != null, EINVAL, E_INVALID_ARG, "[E_INVALID_ARG]");
+ SysTryReturn(NID_APP, arg->pkgname != null, EINVAL, E_INVALID_ARG, "[E_INVALID_ARG]");
+ SysTryReturn(NID_APP, arg->id != null, EINVAL, E_INVALID_ARG, "[E_INVALID_ARG]");
+ SysTryReturn(NID_APP, arg->type == event_arg::EVENT_NEW, -EPERM, E_SUCCESS, "invalid argument from master");
+
+ SysLog(NID_APP, "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);
+ SysTryReturn (NID_APP, AppWidgetManagerService::GetInstance()->Find(arg->pkgname, arg->id) == null, -EBUSY, E_SUCCESS,"already exist");
+
+ double default_priority = 1.0f;
+ _AppWidgetContext* pAppWidgetContext = new (std::nothrow)_AppWidgetContext( arg->info.lb_create.content, arg->pkgname, arg->id,
+ arg->info.lb_create.width, arg->info.lb_create.height, arg->info.lb_create.period * 1000, default_priority);
+ SysTryReturn(NID_APP, pAppWidgetContext, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
+
+ AppWidgetManagerService* pAppWidgetService = AppWidgetManagerService::GetInstance();
+ pAppWidgetService->AddAppWidget(pAppWidgetContext);
+ pAppWidgetContext->OnAdded();
+
+ *priority = pAppWidgetContext->__priority;
+ *height= pAppWidgetContext->__height;
+ *width = pAppWidgetContext->__width;
+
+ SysLog(NID_APP, "Exit. %d appWidget(es)", pAppWidgetService->__appWidgetContextList.GetCount());
+ return 0;
+}
+
+int
+AppWidgetManagerService::OnAppWidgetUpdate(struct event_arg *arg, void* data)
+{
+ if( arg->id == null || strlen(arg->id) < 1)
+ {
+ SysLog(NID_APP, "updating alls");
+ AppWidgetManagerService::GetInstance()->UpdateAllAppWidgetesByAppId(arg->pkgname);
+ }
+ else
+ {
+ _AppWidgetContext* pAppWidgetContext = AppWidgetManagerService::GetInstance()->Find(arg->pkgname, arg->id);
+ SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
+
+ pAppWidgetContext->OnUpdate(L"");
+ }
+
+ return 0;
+}
+
+int
+AppWidgetManagerService::UpdateAllAppWidgetesByAppId(const String& providerId)
+{
+ for( int i = 0; i < __appWidgetContextList.GetCount(); i++ )
+ {
+ _AppWidgetContext* pAppWidgetContext = null;
+ __appWidgetContextList.GetAt(i, pAppWidgetContext);
+
+ if ( pAppWidgetContext->__providerId == providerId )
+ {
+ pAppWidgetContext->OnUpdate(L"");
+ }
+ }
+ return E_SUCCESS;
+}
+
+int
+AppWidgetManagerService::OnAppWidgetDestroy(struct event_arg *arg, void* data)
+{
+ SysTryReturn (NID_APP, arg->type == event_arg::EVENT_DELETE, -EPERM, E_SUCCESS, "invalid argument from master");
+ SysLog(NID_APP, "Enter");
+
+ AppWidgetManagerService* pAppWidgetManagerService = AppWidgetManagerService::GetInstance();
+
+ _AppWidgetContext* pAppWidgetContext = pAppWidgetManagerService->Find(arg->pkgname, arg->id);
+ SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
+
+ pAppWidgetContext->OnRemoved();
+ pAppWidgetManagerService->RemoveAppWidget( arg->pkgname, arg->id, true);
+ delete pAppWidgetContext;
+
+ SysLog(NID_APP, "Exit");
+ return 0;
+}
+
+int
+AppWidgetManagerService::OnAppWidgetPopupCreate(struct event_arg *arg, void* data)
+{
+ SysTryReturn (NID_APP, arg->type == event_arg::EVENT_PD_CREATE, -EPERM, E_SUCCESS, "invalid argument from master");
+ SysLog(NID_APP, "packageName(%s), id(%s), width(%d), height(%d), priority(%d)", arg->pkgname, arg->id);
+
+ _AppWidgetContext* pAppWidgetContext = AppWidgetManagerService::GetInstance()->Find(arg->pkgname, arg->id);
+ SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
+
+ /*if( pAppWidgetContext->GetAppWidgetPopup() )
+ {
+ pAppWidgetContext->OnPopupDestoyed();
+ }*/
+ pAppWidgetContext->OnPopupCreated(arg->info.pd_create.x, arg->info.pd_create.y, arg->info.pd_create.w, arg->info.pd_create.h);
+
+ return 0;
+}
+
+ int
+ AppWidgetManagerService::OnAppWidgetPopupDestroy(struct event_arg *arg, void* data)
+{
+ SysTryReturn (NID_APP, arg->type == event_arg::EVENT_PD_DESTROY, -EPERM, E_SUCCESS, "invalid argument from master");
+ SysLog(NID_APP, "packageName(%s), id(%s)", arg->pkgname, arg->id);
+ _AppWidgetContext* pAppWidgetContext = AppWidgetManagerService::GetInstance()->Find(arg->pkgname, arg->id);
+ SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
+
+ pAppWidgetContext->OnPopupDestoyed();
+
+ return 0;
+}
+
+ int
+ AppWidgetManagerService::OnLivePause(struct event_arg *arg, void* data)
+{
+ SysTryReturn(NID_APP, arg, 0, E_SUCCESS, "arg is null!");
+
+ _AppWidgetContext* pAppWidgetContext = AppWidgetManagerService::GetInstance()->Find(arg->pkgname, arg->id);
+ SysTryReturnResult(NID_APP, pAppWidgetContext , 0, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
+
+ SysLog(NID_APP, "packageName(%s), id(%s)", arg->pkgname, arg->id);
+ pAppWidgetContext->OnBackground();
+ return 0;
+}
+
+int
+AppWidgetManagerService::OnAppWidgetResume(struct event_arg *arg, void* data)
+{
+ SysTryReturn(NID_APP, arg || arg->id || arg->pkgname, 0, E_SUCCESS, "arg is null!");
+
+ _AppWidgetContext* pAppWidgetContext = AppWidgetManagerService::GetInstance()->Find(arg->pkgname, arg->id);
+ SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
+
+ SysLog(NID_APP, "packageName(%s), id(%s)", arg->pkgname, arg->id);
+ pAppWidgetContext->OnForeground();
+ return 0;
+}
+
+int
+AppWidgetManagerService::OnAppWidgetClick(struct event_arg *arg, void* data)
+{
+ SysTryReturn (NID_APP, arg->type == event_arg::EVENT_CLICKED, -EPERM, E_SUCCESS, "invalid argument from master");
+ SysTryReturn(NID_APP, arg != null, -EPERM, E_SUCCESS, "arg is null!");
+ SysLog(NID_APP, "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);
+
+ return 0;
+}
+
+int
+AppWidgetManagerService::OnAppWidgetResize(struct event_arg *arg, void* data)
+{
+ SysTryReturn(NID_APP, arg || arg->id || arg->pkgname, 0, E_SUCCESS, "arg is null!");
+ SysTryReturn (NID_APP, arg->type == event_arg::EVENT_RESIZE, -EPERM, E_SUCCESS, "invalid argument from master");
+
+ SysLog(NID_APP, "packageName(%s), id(%s), resize.w(%d), resize.h(%d)", arg->pkgname, arg->id, arg->info.resize.w, arg->info.resize.h);
+
+ _AppWidgetContext* pAppWidgetContext = AppWidgetManagerService::GetInstance()->Find(arg->pkgname, arg->id);
+ SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
+
+ pAppWidgetContext->OnResize(arg->info.resize.w, arg->info.resize.h);
+
+ return 0;
+}
+
+int
+AppWidgetManagerService::OnAppWidgetPeriodChaned(struct event_arg *arg, void* data)
+{
+ SysTryReturn(NID_APP, arg != null, 0, E_SUCCESS, "arg is null!");
+ SysLog(NID_APP, "packageName(%s), id(%s), width(%d), height(%d), priority(%d)", arg->pkgname, arg->id);
+ return 0;
+}
+
+result
+AppWidgetManagerService::InitializeMasterDaemonEventReceiver(const char *pServiceExecutableName)
+{
+ SysTryReturnResult(NID_APP, pServiceExecutableName != null, E_INVALID_ARG, "");
+ SysLog(NID_APP, "Enter.");
+
+ __appWidgetContextList.Construct();
+
+ /*!
+ * \note
+ * Only for the buffer type
+ */
+ struct event_handler cbs;
+ memset(&cbs, 0, sizeof(event_handler));
+
+ cbs.connected = AppWidgetConnected,
+ cbs.disconnected = AppWidgetDisconnected,
+ cbs.pause = OnLivePause,
+ cbs.resume = OnAppWidgetResume,
+// cbs.lb_pause = OnLivePause,
+// cbs.lb_resume = OnAppWidgetResume,
+ cbs.lb_create = OnAppWidgetCreate,
+ cbs.lb_destroy = OnAppWidgetDestroy,
+ cbs.update_content = OnAppWidgetUpdate,
+ cbs.pd_create = OnAppWidgetPopupCreate,
+ cbs.pd_destroy = OnAppWidgetPopupDestroy,
+ cbs.clicked = OnAppWidgetClick,
+ cbs.resize = OnAppWidgetResize,
+ cbs.set_period = OnAppWidgetPeriodChaned;
+ //cbs.lb_recreate = OnAppWidgetRecreate,/* Recover from the fault of slave */
+ //cbs.content_event = OnAppWidgetContentEvent,
+ //cbs.change_group = OnAppWidgetGroupChanged;
+
+ int ret = provider_init(null, pServiceExecutableName, &cbs, this);
+ SysTryReturnResult(NID_APP, ret == 0, E_SYSTEM, "provider_init failed.");
+
+ SysLog(NID_APP, "Exit.");
+ return E_SUCCESS;
+}
+
+result
+AppWidgetManagerService::DeinitializeMasterDaemonEventReceiver()
+{
+ SysLog(NID_APP, "Enter.");
+ provider_fini();
+ SysLog(NID_APP, "Exit.");
+ return E_SUCCESS;
+}
+
+///////////////////////////////////////////////////////
+// stub implmentation
+///////////////////////////////////////////////////////
+
+result
+AppWidgetManagerService::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument)
+{
+ SysLog(NID_APP, "%ls, %ls", appId.GetPointer(), providerName.GetPointer() );
+
+ bool found = false;
+ for( int i = 0; i < __appWidgetContextList.GetCount(); i++ )
+ {
+ _AppWidgetContext* pAppWidgetContext = null;
+ __appWidgetContextList.GetAt(i, pAppWidgetContext);
+
+ if ( pAppWidgetContext->__appId == appId && pAppWidgetContext->__providerName == providerName)
+ {
+ SysLog(NID_APP, "OK");
+
+ ArrayList* pArray = new (std::nothrow) ArrayList();
+ SysTryReturnResult(NID_APP, pArray, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
+
+ pArray->Construct();
+ pArray->Add(pAppWidgetContext);
+ pArray->Add(new String(argument));
+
+ result r = __handlerThread.SendUserEvent(LOCAL_EVENT_REQUEST_UPDATE, pArray);
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Propagated.", GetErrorMessage(r));
+
+ found = true;
+ }
+ }
+ SysLog(NID_APP, "Exit.");
+ return (found) ? E_SUCCESS : E_OBJ_NOT_FOUND;
+
+}
+
+result
+AppWidgetManagerService::RequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument)
+{
+ SysLog(NID_APP, "%ls, %ls", instanceId.GetPointer(), argument.GetPointer() );
+
+ for( int i = 0; i < __appWidgetContextList.GetCount(); i++ )
+ {
+ _AppWidgetContext* pAppWidgetContext = null;
+ __appWidgetContextList.GetAt(i, pAppWidgetContext);
+
+ if ( pAppWidgetContext->__instanceId == instanceId)
+ {
+ SysLog(NID_APP, "OK");
+
+ ArrayList* pArray = new (std::nothrow) ArrayList();
+ SysTryReturnResult(NID_APP, pArray, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
+
+ pArray->Construct();
+ pArray->Add(pAppWidgetContext);
+ pArray->Add(new String(argument));
+
+ result r = __handlerThread.SendUserEvent(LOCAL_EVENT_REQUEST_UPDATE, pArray);
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Propagated.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+ }
+ }
+ SysLog(NID_APP, "Exit.");
+ return E_OBJ_NOT_FOUND;
+}
+
+result
+AppWidgetManagerService::RequestSharedMemoryId(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height, int& shmId)
+{
+ _AppWidgetContext* pAppWidgetContext = this->Find(appId, instanceId);
+ SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
+
+ if(pAppWidgetContext->HasValidClientId() == false)
+ {
+ String fullAppId = __pIpcServer->GetClientAppId() + "." + __pIpcServer->GetClientAppExecutableName();
+ this->SetClientIds(fullAppId, __pIpcServer->GetClientId());
+ }
+
+ shmId = pAppWidgetContext->GetSharedMemId(width, height);
+ SysTryReturnResult(NID_APP, pAppWidgetContext , shmId != -1, "[E_SYSTEM] failed to GetSharedMemId for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
+ return E_SUCCESS;
+}
+
+result
+AppWidgetManagerService::RequestSharedMemoryIdForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height, int& shmId)
+{
+ _AppWidgetContext* pAppWidgetContext = this->Find(appId, instanceId);
+ SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
+
+ _AppWidgetPopupContext* pPd = pAppWidgetContext->GetAppWidgetPopup();
+ SysTryReturnResult(NID_APP, pPd , E_SYSTEM, "[E_SYSTEM] pPd is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
+
+ if(pPd->HasValidClientId() == false)
+ {
+ String fullAppId = __pIpcServer->GetClientAppId() + "." + __pIpcServer->GetClientAppExecutableName();
+ pPd->SetClientId(__pIpcServer->GetClientId());
+ }
+
+ shmId = pPd->GetSharedMemId(width, height);
+ SysTryReturnResult(NID_APP, pAppWidgetContext , shmId != -1, "[E_SYSTEM] failed to GetSharedMemId for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
+
+ return E_SUCCESS;
+}
+
+result
+AppWidgetManagerService::RequestSyncSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height)
+{
+ _AppWidgetContext* pAppWidgetContext = this->Find(appId, instanceId);
+ SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
+
+ return pAppWidgetContext->RequestUpdateRemote(width, height);
+}
+
+result
+AppWidgetManagerService::RequestSyncSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId)
+{
+ _AppWidgetContext* pAppWidgetContext = this->Find(appId, instanceId);
+ SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
+ SysTryReturnResult(NID_APP, pAppWidgetContext->GetAppWidgetPopup(), E_SYSTEM, "[E_SYSTEM] GetAppWidgetPopup() returns null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
+
+ return pAppWidgetContext->GetAppWidgetPopup()->RequestUpdateRemote();
+}
+
+result
+AppWidgetManagerService::RequestReleaseSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId)
+{
+ std::unique_ptr<char[]> pkgname(_StringConverter::CopyToCharArrayN(appId));
+ std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(instanceId));
+
+ _AppWidgetContext* pAppWidgetContext = this->Find(appId, instanceId);
+ SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
+
+ return pAppWidgetContext->ReleaseSharedMem();
+}
+
+result
+AppWidgetManagerService::RequestReleaseSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId)
+{
+ std::unique_ptr<char[]> pkgname(_StringConverter::CopyToCharArrayN(appId));
+ std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(instanceId));
+
+ _AppWidgetContext* pAppWidgetContext = this->Find(appId, instanceId);
+ SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
+ SysTryReturnResult(NID_APP, pAppWidgetContext->GetAppWidgetPopup(), E_SYSTEM, "[E_SYSTEM] GetAppWidgetPopup() returns null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
+
+// return pAppWidgetContext->GetAppWidgetPopup()->ReleaseSharedMem();
+ return E_SUCCESS;
+}
+
+AppWidgetManagerService::_TaskHandlerThread::~_TaskHandlerThread(void)
+{
+
+}
+
+void
+AppWidgetManagerService::_TaskHandlerThread::OnUserEventReceivedN(RequestId reqId, IList* pArgs)
+{
+ SysTryReturnVoidResult(NID_APP, pArgs != null, E_INVALID_STATE, "pArgs is null!.");
+
+ SysLog(NID_APP, "Enter.");
+
+ switch (reqId)
+ {
+ case LOCAL_EVENT_REQUEST_UPDATE:
+ {
+ _AppWidgetContext* pAppWidgetContext = dynamic_cast<_AppWidgetContext*>( pArgs->GetAt(0) );
+ SysTryReturnVoidResult(NID_APP, pAppWidgetContext != null, E_INVALID_STATE, "_AppWidget is null!.");
+
+ String* pArgument = dynamic_cast<String*>( pArgs->GetAt(1) );
+ SysTryReturnVoidResult(NID_APP, pArgument != null, E_INVALID_STATE, "pArgument is null!.");
+
+ pAppWidgetContext->OnUpdate(*pArgument);
+
+ delete pArgument;
+ pArgs->RemoveAll();
+ delete pArgs;
+ }
+ break;
+
+ default:
+ SysAssertf(false, "never get here!");
+ break;
+ }
+ SysLog(NID_APP, "Exit.");
+}
+
+} } } //namespace Tizen { namespace Shell { namespace App {
//
/**
- * @file FShell_LiveboxManagerStub.cpp
- * @brief This is the implementation for the _LiveboxManagerStub class.
+ * @file FShell_AppWidgetManagerStub.cpp
+ * @brief This is the implementation for the _AppWidgetManagerStub class.
*/
#include <FBase.h>
#include <FBaseSysLog.h>
#include <FIo_IpcServer.h>
-#include <FShell_LiveboxManagerIpcMessage.h>
+#include <FShell_AppWidgetManagerIpcMessage.h>
-#include "FShell_LiveboxManagerStub.h"
+#include "FShell_AppWidgetManagerStub.h"
namespace Tizen { namespace Shell { namespace App {
namespace
{
-const char IPC_SERVER_NAME[] = "osp.shell.ipcserver.liveboxmanager";
+const char IPC_SERVER_NAME[] = "osp.shell.ipcserver.appwidgetmanager";
const int INVALID_CLIENT_ID = -1;
};
using namespace Tizen::Security;
-_LiveboxManagerStub::_LiveboxManagerStub(void)
+_AppWidgetManagerStub::_AppWidgetManagerStub(void)
:__pIpcServer(null)
{
SysLog(NID_APP, "Enter\n");
SysLog(NID_APP, "Exit\n");
}
-_LiveboxManagerStub::~_LiveboxManagerStub(void)
+_AppWidgetManagerStub::~_AppWidgetManagerStub(void)
{
SysLog(NID_APP, "Enter\n");
}
result
-_LiveboxManagerStub::StartIpcServer(void)
+_AppWidgetManagerStub::StartIpcServer(void)
{
SysLog(NID_APP, "Enter.");
__pIpcServer = new (std::nothrow) _IpcServer();
bool
-_LiveboxManagerStub::OnRequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument, result* pRes)
+_AppWidgetManagerStub::OnRequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument, result* pRes)
{
SysLog(NID_APP, "");
*pRes = RequestUpdate(appId, providerName, argument);
}
bool
-_LiveboxManagerStub::OnRequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument, result* pRes)
+_AppWidgetManagerStub::OnRequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument, result* pRes)
{
SysLog(NID_APP, "");
*pRes = RequestUpdateInstance(instanceId, argument);
}
bool
-_LiveboxManagerStub::OnRequestSharedMemoryId(const String& instanceId, int w, int h, int* pShmId)
+_AppWidgetManagerStub::OnRequestSharedMemoryId(const String& instanceId, int w, int h, int* pShmId)
{
SysLog(NID_APP, "(instanceId:%d)xxx", instanceId.GetPointer());
}
bool
-_LiveboxManagerStub::OnRequestSharedMemoryIdForPD(const String& instanceId, int w, int h, int* pShmId)
+_AppWidgetManagerStub::OnRequestSharedMemoryIdForPD(const String& instanceId, int w, int h, int* pShmId)
{
SysLog(NID_APP, "(instanceId:%d)", instanceId.GetPointer());
}
bool
-_LiveboxManagerStub::OnRequestSyncSharedMemory(const String& instanceId, int w, int h, result* pRes)
+_AppWidgetManagerStub::OnRequestSyncSharedMemory(const String& instanceId, int w, int h, result* pRes)
{
SysLog(NID_APP, "(instanceId:%ls)", instanceId.GetPointer());
}
bool
-_LiveboxManagerStub::OnRequestSyncSharedMemoryForPD(const String& instanceId, result* pRes)
+_AppWidgetManagerStub::OnRequestSyncSharedMemoryForPD(const String& instanceId, result* pRes)
{
SysLog(NID_APP, "(instanceId:%ls)", instanceId.GetPointer());
}
bool
-_LiveboxManagerStub::OnRequestReleaseSharedMemory(const String& instanceId, result* pRes)
+_AppWidgetManagerStub::OnRequestReleaseSharedMemory(const String& instanceId, result* pRes)
{
SysLog(NID_APP, "(instanceId:%ls)", instanceId.GetPointer());
}
bool
-_LiveboxManagerStub::OnRequestReleaseSharedMemoryForPD(const String& instanceId, result* pRes)
+_AppWidgetManagerStub::OnRequestReleaseSharedMemoryForPD(const String& instanceId, result* pRes)
{
SysLog(NID_APP, "(instanceId:%ls)", instanceId.GetPointer());
}
bool
-_LiveboxManagerStub::SendTouchEvent(const int clientId, const String& instanceId, int eventType, double timestamp, double x, double y)
+_AppWidgetManagerStub::SendTouchEvent(const int clientId, const String& instanceId, int eventType, double timestamp, double x, double y)
{
SysLog(NID_APP,"");
- result r = __pIpcServer->SendResponse(clientId, new LiveboxManager_SendTouchEvent(instanceId, eventType, timestamp, x, y));
+ result r = __pIpcServer->SendResponse(clientId, new AppWidgetManager_SendTouchEvent(instanceId, eventType, timestamp, x, y));
SysTryReturn(NID_APP, !IsFailed(r), r, r, "[%s] Propagated.", GetErrorMessage(r));
return true;
}
bool
-_LiveboxManagerStub::SendTouchEventForPD(const int clientId, const String& instanceId, int eventType, double timestamp, double x, double y)
+_AppWidgetManagerStub::SendTouchEventForPD(const int clientId, const String& instanceId, int eventType, double timestamp, double x, double y)
{
SysLog(NID_APP,"");
- result r = __pIpcServer->SendResponse(clientId, new LiveboxManager_SendTouchEventForPD(instanceId, eventType, timestamp, x, y));
+ result r = __pIpcServer->SendResponse(clientId, new AppWidgetManager_SendTouchEventForPD(instanceId, eventType, timestamp, x, y));
SysTryReturn(NID_APP, !IsFailed(r), r, r, "[%s] Propagated.", GetErrorMessage(r));
return true;
void
-_LiveboxManagerStub::OnIpcRequestReceived(_IpcServer& server, const IPC::Message& message)
+_AppWidgetManagerStub::OnIpcRequestReceived(_IpcServer& server, const IPC::Message& message)
{
SysLog(NID_APP, "(appId:%ls, pid:%d, clientId:%d)\n", server.GetClientAppId().GetPointer(), server.GetClientProcessId(), server.GetClientId());
- IPC_BEGIN_MESSAGE_MAP(_LiveboxManagerStub, message)
- IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestUpdate, &server, OnRequestUpdate)
- IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestUpdateInstance, &server, OnRequestUpdateInstance)
- IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestSharedMemoryId, &server, OnRequestSharedMemoryId)
- IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestSharedMemoryIdForPD, &server, OnRequestSharedMemoryIdForPD)
- IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestSyncSharedMemory, &server, OnRequestSyncSharedMemory)
- IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestSyncSharedMemoryForPD, &server, OnRequestSyncSharedMemoryForPD)
- IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestReleaseSharedMemory, &server, OnRequestReleaseSharedMemory)
- IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestReleaseSharedMemoryForPD, &server, OnRequestReleaseSharedMemoryForPD)
+ IPC_BEGIN_MESSAGE_MAP(_AppWidgetManagerStub, message)
+ IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestUpdate, &server, OnRequestUpdate)
+ IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestUpdateInstance, &server, OnRequestUpdateInstance)
+ IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestSharedMemoryId, &server, OnRequestSharedMemoryId)
+ IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestSharedMemoryIdForPD, &server, OnRequestSharedMemoryIdForPD)
+ IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestSyncSharedMemory, &server, OnRequestSyncSharedMemory)
+ IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestSyncSharedMemoryForPD, &server, OnRequestSyncSharedMemoryForPD)
+ IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestReleaseSharedMemory, &server, OnRequestReleaseSharedMemory)
+ IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestReleaseSharedMemoryForPD, &server, OnRequestReleaseSharedMemoryForPD)
IPC_END_MESSAGE_MAP()
}
void
-_LiveboxManagerStub::OnIpcServerStarted(const _IpcServer& server)
+_AppWidgetManagerStub::OnIpcServerStarted(const _IpcServer& server)
{
SysLog(NID_APP, "\n");
}
void
-_LiveboxManagerStub::OnIpcServerStopped(const _IpcServer& server)
+_AppWidgetManagerStub::OnIpcServerStopped(const _IpcServer& server)
{
SysLog(NID_APP, "\n");
}
void
-_LiveboxManagerStub::OnIpcClientConnected(const _IpcServer& server, int clientId)
+_AppWidgetManagerStub::OnIpcClientConnected(const _IpcServer& server, int clientId)
{
SysLog(NID_APP, "(clientId:%d)\n", clientId);
}
void
-_LiveboxManagerStub::OnIpcClientDisconnected(const _IpcServer& server, int clientId)
+_AppWidgetManagerStub::OnIpcClientDisconnected(const _IpcServer& server, int clientId)
{
SysLog(NID_APP, "(appId:%ls, pid:%d, clientId:%d)\n", server.GetClientAppId().GetPointer(), server.GetClientProcessId(), clientId);
}
//
/**
- * @file FShell_LiveboxPopupContext.cpp
- * @brief This is the implementation for the _LiveboxPopupContext class.
+ * @file FShell_AppWidgetPopupContext.cpp
+ * @brief This is the implementation for the _AppWidgetPopupContext class.
*/
#include <stdlib.h>
#include <FApp_AppControlManager.h>
-#include "FShell_LiveboxManagerService.h"
-#include "FShell_LiveboxPopupContext.h"
+#include "FShell_AppWidgetManagerService.h"
+#include "FShell_AppWidgetPopupContext.h"
namespace Tizen { namespace Shell { namespace App
{
using namespace Tizen::Base::Collection;
-const String LIVEBOX_TRAY_ON_CREATE(L"LiveboxTray='event=create'");
-const String LIVEBOX_TRAY_ON_DESTROY(L"LiveboxTray='event=destroy'");
-const String LIVEBOX_TRAY_ON_TOUCH(L"LiveboxTray='event=touch'");
+const char APPWIDGET_POPUP_ON_CREATE[] = "http://tizen.org/appcontrol/appwidgetpopup/create";
+const char APPWIDGET_POPUP_ON_DESTROY[] = "http://tizen.org/appcontrol/appwidgetpopup/destroy";
+const char APPWIDGET_POPUP_ON_TOUCH[] = "http://tizen.org/appcontrol/appwidgetpopup/touch";
const String ARG_KEY_X = L"_X";
const String ARG_KEY_Y = L"_Y";
const String ARG_KEY_HEIGHT = L"_Height";
-_LiveboxPopupContext::_LiveboxPopupContext(const String& info, const String& appId, const String& instanceId, int width, int height, int priority)
-:_LiveboxContextBase(TYPE_PD, info, appId, instanceId, width, height, priority)
+_AppWidgetPopupContext::_AppWidgetPopupContext(const String& info, const String& appId, const String& instanceId, int width, int height, int priority)
+:_AppWidgetContextBase(TYPE_PD, info, appId, instanceId, width, height, priority)
{
SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height);
}
-_LiveboxPopupContext::~_LiveboxPopupContext()
+_AppWidgetPopupContext::~_AppWidgetPopupContext()
{
SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d))", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height);
ReleaseSharedMem();
void
-_LiveboxPopupContext::OnPopupCreated(double x, double y, int width, int height)
+_AppWidgetPopupContext::OnPopupCreated(double x, double y, int width, int height)
{
SysLog(NID_APP, "width(%d), height(%d)", width, height);
SendPopupCreateRequest(x, y, width, height);
}
void
-_LiveboxPopupContext::OnPopupDestoyed()
+_AppWidgetPopupContext::OnPopupDestoyed()
{
SysLog(NID_APP, "");
SendPopupDestroyRequest();
}
result
-_LiveboxPopupContext::SendPopupCreateRequest(double x, double y, int width, int height)
+_AppWidgetPopupContext::SendPopupCreateRequest(double x, double y, int width, int height)
{
std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
pArgs->Add(new String(ARG_KEY_WIDTH), new String(Integer::ToString(width)));
pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(height)));
- return SendRequestToApp( __appId, LIVEBOX_TRAY_ON_CREATE, pArgs.get());
+ return SendRequestToApp( __appId, APPWIDGET_POPUP_ON_CREATE, pArgs.get());
}
result
-_LiveboxPopupContext::SendPopupDestroyRequest()
+_AppWidgetPopupContext::SendPopupDestroyRequest()
{
std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
- return SendRequestToApp( __appId, LIVEBOX_TRAY_ON_DESTROY, pArgs.get());
+ return SendRequestToApp( __appId, APPWIDGET_POPUP_ON_DESTROY, pArgs.get());
}
result
-_LiveboxPopupContext::SendTouchEvent(buffer_event event, double timestamp, double x, double y)
+_AppWidgetPopupContext::SendTouchEvent(buffer_event event, double timestamp, double x, double y)
{
SysLog(NID_APP, "");
/*if( HasValidClientId() == false )
pArgs->Add(*new String(Double::ToString(x)));
pArgs->Add(*new String(Double::ToString(y)));
- return SendRequestToApp( __appId, LIVEBOX_TRAY_ON_TOUCH, pArgs.get());
+ return SendRequestToApp( __appId, APPWIDGET_POPUP_ON_TOUCH, pArgs.get());
}
else*/
{
// SysAssertf( Tizen::App::AppManager::GetInstance()->IsRunning(__appId) == false, "application isn't running");
- LiveboxManagerService::GetInstance()->SendTouchEventForPD(__ipcClientId, __instanceId, event, timestamp, x, y);
+ AppWidgetManagerService::GetInstance()->SendTouchEventForPD(__ipcClientId, __instanceId, event, timestamp, x, y);
}
return E_SUCCESS;
}
result
-_LiveboxPopupContext::RequestUpdateRemote()
+_AppWidgetPopupContext::RequestUpdateRemote()
{
std::unique_ptr<char[]> packageName(_StringConverter::CopyToCharArrayN(__providerId));
std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(__instanceId));
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// 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_LiveboxManagerService.cpp
- * @brief This is the implementation for the LiveboxManagerService class.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <unique_ptr.h>
-#include <provider.h>
-#include <aul.h>
-
-#include <FBase.h>
-#include <FBaseSysLog.h>
-#include <FApp.h>
-#include <FApp_AppManagerImpl.h>
-#include <FIo_IpcServer.h>
-#include <FBase_StringConverter.h>
-
-#include "FShell_LiveboxContext.h"
-#include "FShell_LiveboxPopupContext.h"
-#include "FShell_LiveboxManagerStub.h"
-
-#include "FShell_LiveboxManagerService.h"
-
-namespace Tizen { namespace Shell { namespace App {
-
-using namespace Tizen::App;
-using namespace Tizen::Base;
-using namespace Tizen::Base::Collection;
-using namespace Tizen::Base::Runtime;
-using namespace Tizen::Io;
-using namespace Tizen::System;
-using namespace Tizen::Shell::App;
-
-
-namespace
-{
-static const RequestId LOCAL_EVENT_REQUEST_UPDATE = 0;
-}
-
-LiveboxManagerService::LiveboxManagerService()
-{
-}
-
-LiveboxManagerService::~LiveboxManagerService()
-{
- __pingTimer.Cancel();
- DeinitializeMasterDaemonEventReceiver();
-}
-
-LiveboxManagerService*
-LiveboxManagerService::GetInstance(void)
-{
- static LiveboxManagerService* pSelf = null;
- if( pSelf == null)
- {
- pSelf = new LiveboxManagerService();
- SysTryReturn(NID_APP, pSelf != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
-
- result r = pSelf->Construct();
- SysAssertf(!IsFailed(r), "Failed to construct LiveboxManagerService");
- SysLog(NID_APP, "LiveboxManagerService is created.");
- }
- return pSelf;
-}
-
-result
-LiveboxManagerService::Construct()
-{
-// _AppManagerImpl::GetInstance()->AddEventListener(*this);
-
- _LiveboxManagerStub::StartIpcServer();
-
- result r = __handlerThread.Construct(THREAD_TYPE_EVENT_DRIVEN);
- SysTryReturn(NID_APP, IsFailed(r) == false, false, r, "[%s] Event thread creation failure.", GetErrorMessage(r));
-
- r = __handlerThread.Start();
- SysTryReturn(NID_APP, IsFailed(r) == false, false, r, "[%s] Event thread Start failure.", GetErrorMessage(r));
-
- return InitializeMasterDaemonEventReceiver("osp-livebox-service");
-}
-
-int
-LiveboxManagerService::LiveboxConnected(struct event_arg *arg, void* data)
-{
- int ret;
- ret = provider_send_hello();
- if (ret == 0)
- {
- SysLog(NID_APP, "success to be connected with master daemon");
- LiveboxManagerService::GetInstance()->StartPingTimer();
-
- }
- else
- {
- SysLog(NID_APP, "failed to provider_send_hello()");
- }
- return ret;
-}
-
-int
-LiveboxManagerService::LiveboxDisconnected(struct event_arg *arg, void* data)
-{
- SysLog(NID_APP, "success to be disconnected with master daemon");
-// aul_terminate_pid(getpid());
- return 0;
-}
-
-void
-LiveboxManagerService::StartPingTimer()
-{
- __pingTimer.Construct(*this);//, true);
- __pingTimer.StartAsRepeatable(120000);
-}
-
-void
-LiveboxManagerService::OnTimerExpired(Timer& timer)
-{
- SysLog(NID_APP, "provider_send_ping");
- provider_send_ping();
-}
-
-_LiveboxContext*
-LiveboxManagerService::Find(const String& appId, const String& instanceId) const
-{
- for( int i = 0; i < __liveboxContextList.GetCount(); i++ )
- {
- _LiveboxContext* pLiveboxContext = null;
- __liveboxContextList.GetAt(i, pLiveboxContext);
-// SysLog(NID_APP, "%ls", pLiveboxContext->__instanceId.GetPointer());
-
- if ( pLiveboxContext->__instanceId == instanceId )
- {
-// SysAssert(pLiveboxContext->__appId == appId)
- return pLiveboxContext;
- }
- }
- return null;
-}
-
-result
-LiveboxManagerService::SetClientIds(const Tizen::App::AppId& appId, int clientId)
-{
- for( int i = 0; i < __liveboxContextList.GetCount(); i++ )
- {
- _LiveboxContext* pLiveboxContext = null;
- __liveboxContextList.GetAt(i, pLiveboxContext);
- SysLog(NID_APP, "%ls", pLiveboxContext->__instanceId.GetPointer());
- SysLog(NID_APP, "%ls, %ls", pLiveboxContext->__providerId.GetPointer(), appId.GetPointer());
-
- if ( pLiveboxContext->__appId == appId )
- {
- pLiveboxContext->SetClientId(clientId);
- SysLog(NID_APP, "client is registered.(%d)", clientId);
- if( clientId == -1)
- {
- pLiveboxContext->ReleaseSharedMem();
- if(pLiveboxContext->GetLiveboxPopup())
- {
- pLiveboxContext->OnPopupDestoyed();
- }
- }
- }
- }
- return E_SUCCESS;
-}
-
-void
-LiveboxManagerService::OnIpcClientConnected(const _IpcServer& server, int clientId)
-{
- //SysLog(NID_APP, "(clientId:%d)\n", clientId);
- String fullAppId = server.GetClientAppId() + "." + server.GetClientAppExecutableName();
- SysLog(NID_APP, "(%ls)\n", fullAppId.GetPointer());
-// this->SetClientIds(fullAppId, clientId);//Todo
-
-}
-
-void
-LiveboxManagerService::OnIpcClientDisconnected(const _IpcServer& server, int clientId)
-{
- String fullAppId = server.GetClientAppId() + "." + server.GetClientAppExecutableName();
- SysLog(NID_APP, "(%ls)\n", fullAppId.GetPointer());
- this->SetClientIds(fullAppId, -1);
-}
-
-result
-LiveboxManagerService::AddLivebox(_LiveboxContext* pLiveboxContext)
-{
- SysLog(NID_APP, "%ls, %ls, count(%d)", pLiveboxContext->__providerId.GetPointer(), pLiveboxContext->__instanceId.GetPointer(), __liveboxContextList.GetCount());
-
- return __liveboxContextList.Add(pLiveboxContext);
-}
-
-result
-LiveboxManagerService::RemoveLivebox(const char* pPackageName, const char* pId, bool free)
-{
- SysLog(NID_APP, "%s, %s, count(%d)", pPackageName, pId, __liveboxContextList.GetCount());
-
- SysTryReturn(NID_APP, ( pPackageName != null && pId != null), null, E_INVALID_ARG, "[E_INVALID_ARG]");
- SysLog(NID_APP, "%s, %s", pPackageName, pId);
-
- _LiveboxContext* pLiveboxContext = Find(pPackageName, pId);
- SysTryReturn(NID_APP, pLiveboxContext, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND]");
-
- result r = __liveboxContextList.Remove(pLiveboxContext);
-
- if( __liveboxContextList.GetCount() == 0 )
- {
- SysLog(NID_APP, "No running native livebox app remains, terminating osp livebox service...");
- Tizen::App::App::GetInstance()->Terminate();
- }
-
- return r;
-}
-
-
-///////////////////////////////////////////////////////
-// MasterDaemonEventReceiver implementation
-///////////////////////////////////////////////////////
-int
-LiveboxManagerService::OnLiveboxCreate(struct event_arg *arg, int *width, int *height, double *priority, void* data)
-{
- SysTryReturn(NID_APP, arg != null, EINVAL, E_INVALID_ARG, "[E_INVALID_ARG]");
- SysTryReturn(NID_APP, arg->pkgname != null, EINVAL, E_INVALID_ARG, "[E_INVALID_ARG]");
- SysTryReturn(NID_APP, arg->id != null, EINVAL, E_INVALID_ARG, "[E_INVALID_ARG]");
- SysTryReturn(NID_APP, arg->type == event_arg::EVENT_NEW, -EPERM, E_SUCCESS, "invalid argument from master");
-
- SysLog(NID_APP, "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);
- SysTryReturn (NID_APP, LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id) == null, -EBUSY, E_SUCCESS,"already exist");
-
- double default_priority = 1.0f;
- _LiveboxContext* pLiveboxContext = new (std::nothrow)_LiveboxContext( arg->info.lb_create.content, arg->pkgname, arg->id,
- arg->info.lb_create.width, arg->info.lb_create.height, arg->info.lb_create.period * 1000, default_priority);
- SysTryReturn(NID_APP, pLiveboxContext, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
-
- LiveboxManagerService* pLiveboxService = LiveboxManagerService::GetInstance();
- pLiveboxService->AddLivebox(pLiveboxContext);
- pLiveboxContext->OnAdded();
-
- *priority = pLiveboxContext->__priority;
- *height= pLiveboxContext->__height;
- *width = pLiveboxContext->__width;
-
- SysLog(NID_APP, "Exit. %d livebox(es)", pLiveboxService->__liveboxContextList.GetCount());
- return 0;
-}
-
-int
-LiveboxManagerService::OnLiveboxUpdate(struct event_arg *arg, void* data)
-{
- if( arg->id == null || strlen(arg->id) < 1)
- {
- SysLog(NID_APP, "updating alls");
- LiveboxManagerService::GetInstance()->UpdateAllLiveboxesByAppId(arg->pkgname);
- }
- else
- {
- _LiveboxContext* pLiveboxContext = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id);
- SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
-
- pLiveboxContext->OnUpdate(L"");
- }
-
- return 0;
-}
-
-int
-LiveboxManagerService::UpdateAllLiveboxesByAppId(const String& providerId)
-{
- for( int i = 0; i < __liveboxContextList.GetCount(); i++ )
- {
- _LiveboxContext* pLiveboxContext = null;
- __liveboxContextList.GetAt(i, pLiveboxContext);
-
- if ( pLiveboxContext->__providerId == providerId )
- {
- pLiveboxContext->OnUpdate(L"");
- }
- }
- return E_SUCCESS;
-}
-
-int
-LiveboxManagerService::OnLiveboxDestroy(struct event_arg *arg, void* data)
-{
- SysTryReturn (NID_APP, arg->type == event_arg::EVENT_DELETE, -EPERM, E_SUCCESS, "invalid argument from master");
- SysLog(NID_APP, "Enter");
-
- LiveboxManagerService* pLiveboxManagerService = LiveboxManagerService::GetInstance();
-
- _LiveboxContext* pLiveboxContext = pLiveboxManagerService->Find(arg->pkgname, arg->id);
- SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
-
- pLiveboxContext->OnRemoved();
- pLiveboxManagerService->RemoveLivebox( arg->pkgname, arg->id, true);
- delete pLiveboxContext;
-
- SysLog(NID_APP, "Exit");
- return 0;
-}
-
-int
-LiveboxManagerService::OnLiveboxPopupCreate(struct event_arg *arg, void* data)
-{
- SysTryReturn (NID_APP, arg->type == event_arg::EVENT_PD_CREATE, -EPERM, E_SUCCESS, "invalid argument from master");
- SysLog(NID_APP, "packageName(%s), id(%s), width(%d), height(%d), priority(%d)", arg->pkgname, arg->id);
-
- _LiveboxContext* pLiveboxContext = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id);
- SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
-
- /*if( pLiveboxContext->GetLiveboxPopup() )
- {
- pLiveboxContext->OnPopupDestoyed();
- }*/
- pLiveboxContext->OnPopupCreated(arg->info.pd_create.x, arg->info.pd_create.y, arg->info.pd_create.w, arg->info.pd_create.h);
-
- return 0;
-}
-
- int
- LiveboxManagerService::OnLiveboxPopupDestroy(struct event_arg *arg, void* data)
-{
- SysTryReturn (NID_APP, arg->type == event_arg::EVENT_PD_DESTROY, -EPERM, E_SUCCESS, "invalid argument from master");
- SysLog(NID_APP, "packageName(%s), id(%s)", arg->pkgname, arg->id);
- _LiveboxContext* pLiveboxContext = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id);
- SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
-
- pLiveboxContext->OnPopupDestoyed();
-
- return 0;
-}
-
- int
- LiveboxManagerService::OnLivePause(struct event_arg *arg, void* data)
-{
- SysTryReturn(NID_APP, arg, 0, E_SUCCESS, "arg is null!");
-
- _LiveboxContext* pLiveboxContext = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id);
- SysTryReturnResult(NID_APP, pLiveboxContext , 0, "[E_SYSTEM] pLiveboxContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
-
- SysLog(NID_APP, "packageName(%s), id(%s)", arg->pkgname, arg->id);
- pLiveboxContext->OnBackground();
- return 0;
-}
-
-int
-LiveboxManagerService::OnLiveboxResume(struct event_arg *arg, void* data)
-{
- SysTryReturn(NID_APP, arg || arg->id || arg->pkgname, 0, E_SUCCESS, "arg is null!");
-
- _LiveboxContext* pLiveboxContext = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id);
- SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
-
- SysLog(NID_APP, "packageName(%s), id(%s)", arg->pkgname, arg->id);
- pLiveboxContext->OnForeground();
- return 0;
-}
-
-int
-LiveboxManagerService::OnLiveboxClick(struct event_arg *arg, void* data)
-{
- SysTryReturn (NID_APP, arg->type == event_arg::EVENT_CLICKED, -EPERM, E_SUCCESS, "invalid argument from master");
- SysTryReturn(NID_APP, arg != null, -EPERM, E_SUCCESS, "arg is null!");
- SysLog(NID_APP, "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);
-
- return 0;
-}
-
-int
-LiveboxManagerService::OnLiveboxResize(struct event_arg *arg, void* data)
-{
- SysTryReturn(NID_APP, arg || arg->id || arg->pkgname, 0, E_SUCCESS, "arg is null!");
- SysTryReturn (NID_APP, arg->type == event_arg::EVENT_RESIZE, -EPERM, E_SUCCESS, "invalid argument from master");
-
- SysLog(NID_APP, "packageName(%s), id(%s), resize.w(%d), resize.h(%d)", arg->pkgname, arg->id, arg->info.resize.w, arg->info.resize.h);
-
- _LiveboxContext* pLiveboxContext = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id);
- SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
-
- pLiveboxContext->OnResize(arg->info.resize.w, arg->info.resize.h);
-
- return 0;
-}
-
-int
-LiveboxManagerService::OnLiveboxPeriodChaned(struct event_arg *arg, void* data)
-{
- SysTryReturn(NID_APP, arg != null, 0, E_SUCCESS, "arg is null!");
- SysLog(NID_APP, "packageName(%s), id(%s), width(%d), height(%d), priority(%d)", arg->pkgname, arg->id);
- return 0;
-}
-
-result
-LiveboxManagerService::InitializeMasterDaemonEventReceiver(const char *pServiceExecutableName)
-{
- SysTryReturnResult(NID_APP, pServiceExecutableName != null, E_INVALID_ARG, "");
- SysLog(NID_APP, "Enter.");
-
- __liveboxContextList.Construct();
-
- /*!
- * \note
- * Only for the buffer type
- */
- struct event_handler cbs;
- memset(&cbs, 0, sizeof(event_handler));
-
- cbs.connected = LiveboxConnected,
- cbs.disconnected = LiveboxDisconnected,
- cbs.pause = OnLivePause,
- cbs.resume = OnLiveboxResume,
-// cbs.lb_pause = OnLivePause,
-// cbs.lb_resume = OnLiveboxResume,
- cbs.lb_create = OnLiveboxCreate,
- cbs.lb_destroy = OnLiveboxDestroy,
- cbs.update_content = OnLiveboxUpdate,
- cbs.pd_create = OnLiveboxPopupCreate,
- cbs.pd_destroy = OnLiveboxPopupDestroy,
- cbs.clicked = OnLiveboxClick,
- cbs.resize = OnLiveboxResize,
- cbs.set_period = OnLiveboxPeriodChaned;
- //cbs.lb_recreate = OnLiveboxRecreate,/* Recover from the fault of slave */
- //cbs.content_event = OnLiveboxContentEvent,
- //cbs.change_group = OnLiveboxGroupChanged;
-
- int ret = provider_init(null, pServiceExecutableName, &cbs, this);
- SysTryReturnResult(NID_APP, ret == 0, E_SYSTEM, "provider_init failed.");
-
- SysLog(NID_APP, "Exit.");
- return E_SUCCESS;
-}
-
-result
-LiveboxManagerService::DeinitializeMasterDaemonEventReceiver()
-{
- SysLog(NID_APP, "Enter.");
- provider_fini();
- SysLog(NID_APP, "Exit.");
- return E_SUCCESS;
-}
-
-///////////////////////////////////////////////////////
-// stub implmentation
-///////////////////////////////////////////////////////
-
-result
-LiveboxManagerService::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument)
-{
- SysLog(NID_APP, "%ls, %ls", appId.GetPointer(), providerName.GetPointer() );
-
- bool found = false;
- for( int i = 0; i < __liveboxContextList.GetCount(); i++ )
- {
- _LiveboxContext* pLiveboxContext = null;
- __liveboxContextList.GetAt(i, pLiveboxContext);
-
- if ( pLiveboxContext->__appId == appId && pLiveboxContext->__providerName == providerName)
- {
- SysLog(NID_APP, "OK");
-
- ArrayList* pArray = new (std::nothrow) ArrayList();
- SysTryReturnResult(NID_APP, pArray, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
-
- pArray->Construct();
- pArray->Add(pLiveboxContext);
- pArray->Add(new String(argument));
-
- result r = __handlerThread.SendUserEvent(LOCAL_EVENT_REQUEST_UPDATE, pArray);
- SysTryLog(NID_APP, !IsFailed(r), "[%s] Propagated.", GetErrorMessage(r));
-
- found = true;
- }
- }
- SysLog(NID_APP, "Exit.");
- return (found) ? E_SUCCESS : E_OBJ_NOT_FOUND;
-
-}
-
-result
-LiveboxManagerService::RequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument)
-{
- SysLog(NID_APP, "%ls, %ls", instanceId.GetPointer(), argument.GetPointer() );
-
- for( int i = 0; i < __liveboxContextList.GetCount(); i++ )
- {
- _LiveboxContext* pLiveboxContext = null;
- __liveboxContextList.GetAt(i, pLiveboxContext);
-
- if ( pLiveboxContext->__instanceId == instanceId)
- {
- SysLog(NID_APP, "OK");
-
- ArrayList* pArray = new (std::nothrow) ArrayList();
- SysTryReturnResult(NID_APP, pArray, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
-
- pArray->Construct();
- pArray->Add(pLiveboxContext);
- pArray->Add(new String(argument));
-
- result r = __handlerThread.SendUserEvent(LOCAL_EVENT_REQUEST_UPDATE, pArray);
- SysTryLog(NID_APP, !IsFailed(r), "[%s] Propagated.", GetErrorMessage(r));
-
- return E_SUCCESS;
- }
- }
- SysLog(NID_APP, "Exit.");
- return E_OBJ_NOT_FOUND;
-}
-
-result
-LiveboxManagerService::RequestSharedMemoryId(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height, int& shmId)
-{
- _LiveboxContext* pLiveboxContext = this->Find(appId, instanceId);
- SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-
- if(pLiveboxContext->HasValidClientId() == false)
- {
- String fullAppId = __pIpcServer->GetClientAppId() + "." + __pIpcServer->GetClientAppExecutableName();
- this->SetClientIds(fullAppId, __pIpcServer->GetClientId());
- }
-
- shmId = pLiveboxContext->GetSharedMemId(width, height);
- SysTryReturnResult(NID_APP, pLiveboxContext , shmId != -1, "[E_SYSTEM] failed to GetSharedMemId for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
- return E_SUCCESS;
-}
-
-result
-LiveboxManagerService::RequestSharedMemoryIdForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height, int& shmId)
-{
- _LiveboxContext* pLiveboxContext = this->Find(appId, instanceId);
- SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-
- _LiveboxPopupContext* pPd = pLiveboxContext->GetLiveboxPopup();
- SysTryReturnResult(NID_APP, pPd , E_SYSTEM, "[E_SYSTEM] pPd is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-
- if(pPd->HasValidClientId() == false)
- {
- String fullAppId = __pIpcServer->GetClientAppId() + "." + __pIpcServer->GetClientAppExecutableName();
- pPd->SetClientId(__pIpcServer->GetClientId());
- }
-
- shmId = pPd->GetSharedMemId(width, height);
- SysTryReturnResult(NID_APP, pLiveboxContext , shmId != -1, "[E_SYSTEM] failed to GetSharedMemId for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-
- return E_SUCCESS;
-}
-
-result
-LiveboxManagerService::RequestSyncSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height)
-{
- _LiveboxContext* pLiveboxContext = this->Find(appId, instanceId);
- SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-
- return pLiveboxContext->RequestUpdateRemote(width, height);
-}
-
-result
-LiveboxManagerService::RequestSyncSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId)
-{
- _LiveboxContext* pLiveboxContext = this->Find(appId, instanceId);
- SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
- SysTryReturnResult(NID_APP, pLiveboxContext->GetLiveboxPopup(), E_SYSTEM, "[E_SYSTEM] GetLiveboxPopup() returns null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-
- return pLiveboxContext->GetLiveboxPopup()->RequestUpdateRemote();
-}
-
-result
-LiveboxManagerService::RequestReleaseSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId)
-{
- std::unique_ptr<char[]> pkgname(_StringConverter::CopyToCharArrayN(appId));
- std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(instanceId));
-
- _LiveboxContext* pLiveboxContext = this->Find(appId, instanceId);
- SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-
- return pLiveboxContext->ReleaseSharedMem();
-}
-
-result
-LiveboxManagerService::RequestReleaseSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId)
-{
- std::unique_ptr<char[]> pkgname(_StringConverter::CopyToCharArrayN(appId));
- std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(instanceId));
-
- _LiveboxContext* pLiveboxContext = this->Find(appId, instanceId);
- SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
- SysTryReturnResult(NID_APP, pLiveboxContext->GetLiveboxPopup(), E_SYSTEM, "[E_SYSTEM] GetLiveboxPopup() returns null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-
-// return pLiveboxContext->GetLiveboxPopup()->ReleaseSharedMem();
- return E_SUCCESS;
-}
-
-LiveboxManagerService::_TaskHandlerThread::~_TaskHandlerThread(void)
-{
-
-}
-
-void
-LiveboxManagerService::_TaskHandlerThread::OnUserEventReceivedN(RequestId reqId, IList* pArgs)
-{
- SysTryReturnVoidResult(NID_APP, pArgs != null, E_INVALID_STATE, "pArgs is null!.");
-
- SysLog(NID_APP, "Enter.");
-
- switch (reqId)
- {
- case LOCAL_EVENT_REQUEST_UPDATE:
- {
- _LiveboxContext* pLiveboxContext = dynamic_cast<_LiveboxContext*>( pArgs->GetAt(0) );
- SysTryReturnVoidResult(NID_APP, pLiveboxContext != null, E_INVALID_STATE, "_Livebox is null!.");
-
- String* pArgument = dynamic_cast<String*>( pArgs->GetAt(1) );
- SysTryReturnVoidResult(NID_APP, pArgument != null, E_INVALID_STATE, "pArgument is null!.");
-
- pLiveboxContext->OnUpdate(*pArgument);
-
- delete pArgument;
- pArgs->RemoveAll();
- delete pArgs;
- }
- break;
-
- default:
- SysAssertf(false, "never get here!");
- break;
- }
- SysLog(NID_APP, "Exit.");
-}
-
-} } } //namespace Tizen { namespace Shell { namespace App {
//
/**
- * @file OspLiveboxService.cpp
- * @brief This is the implementation for the OspLiveboxService class.
+ * @file OspAppWidgetService.cpp
+ * @brief This is the implementation for the OspAppWidgetService class.
*/
-#include "FShell_LiveboxManagerService.h"
-#include "OspLiveboxService.h"
+#include "FShell_AppWidgetManagerService.h"
+#include "OspAppWidgetService.h"
using namespace Tizen::App;
using namespace Tizen::Base;
using namespace Tizen::Shell::App;
-OspLiveboxService::OspLiveboxService()
+OspAppWidgetService::OspAppWidgetService()
{
}
-OspLiveboxService::~OspLiveboxService()
+OspAppWidgetService::~OspAppWidgetService()
{
}
ServiceApp*
-OspLiveboxService::CreateInstance(void)
+OspAppWidgetService::CreateInstance(void)
{
// Create the instance through the constructor.
- return new (std::nothrow) OspLiveboxService();
+ return new (std::nothrow) OspAppWidgetService();
}
bool
-OspLiveboxService::OnAppInitializing(AppRegistry& appRegistry)
+OspAppWidgetService::OnAppInitializing(AppRegistry& appRegistry)
{
AppLog("Enter.");
- LiveboxManagerService* pSvc = LiveboxManagerService::GetInstance();
- AppAssertf( pSvc != null, "LiveboxManagerService::GetInstance() failed.");
+ AppWidgetManagerService* pSvc = AppWidgetManagerService::GetInstance();
+ AppAssertf( pSvc != null, "AppWidgetManagerService::GetInstance() failed.");
return true;
}
bool
-OspLiveboxService::OnAppInitialized(void)
+OspAppWidgetService::OnAppInitialized(void)
{
return true;
}
bool
-OspLiveboxService::OnAppWillTerminate(void)
+OspAppWidgetService::OnAppWillTerminate(void)
{
return true;
}
bool
-OspLiveboxService::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
+OspAppWidgetService::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
{
return true;
}
void
-OspLiveboxService::OnLowMemory(void)
+OspAppWidgetService::OnLowMemory(void)
{
}
void
-OspLiveboxService::OnBatteryLevelChanged(BatteryLevel batteryLevel)
+OspAppWidgetService::OnBatteryLevelChanged(BatteryLevel batteryLevel)
{
}
//
/**
- * @file OspLiveboxService.cpp
+ * @file OspAppWidgetService.cpp
* @brief This file contains the Tizen application entry point.
*/
-#include "OspLiveboxService.h"
+#include "OspAppWidgetService.h"
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
pArgs->Add(*(new String(pArgv[i])));
start_profile();
- r = Tizen::App::ServiceApp::Execute(OspLiveboxService::CreateInstance, pArgs);
+ r = Tizen::App::ServiceApp::Execute(OspAppWidgetService::CreateInstance, pArgs);
if (IsFailed(r))
{
AppLogException("Application execution failed-[%s].", GetErrorMessage(r));