From 3d2cfa7c1538ddd8cd57511825d237734a17cde7 Mon Sep 17 00:00:00 2001 From: "jungmin76.park" Date: Wed, 30 Jan 2013 11:05:41 +0900 Subject: [PATCH] fix LiveboxProviderManager::RequestUpdate() problem. add LiveboxPopupProvider::RequestUpdateToLivebox add manifest validation code to LiveboxProviderManager fix Livebox unstability issue Change-Id: I52974a5e5eb7e7697ae55abee244cf4252bf9972 Signed-off-by: jungmin76.park --- inc/FShell_Livebox.h | 4 +- inc/FShell_LiveboxBase.h | 5 +- inc/FShell_LiveboxManagerService.h | 11 +++-- inc/FShell_LiveboxManagerStub.h | 6 ++- manifest.xml | 18 +++---- src/FShell_Livebox.cpp | 15 +++--- src/FShell_LiveboxBase.cpp | 5 +- src/FShell_LiveboxManagerService.cpp | 93 +++++++++++++++++++++++++++--------- src/FShell_LiveboxManagerStub.cpp | 13 ++++- src/FShell_LiveboxPopup.cpp | 1 + 10 files changed, 114 insertions(+), 57 deletions(-) diff --git a/inc/FShell_Livebox.h b/inc/FShell_Livebox.h index 8e5ee1d..ec90989 100644 --- a/inc/FShell_Livebox.h +++ b/inc/FShell_Livebox.h @@ -47,7 +47,7 @@ public: int width, int height, int period, int priority); virtual ~_Livebox(); void OnAdded(void); - void OnUpdate(void); + void OnUpdate(const Tizen::Base::String& argument); void OnResize(int width, int height); void OnRemoved(); void OnForeground(); @@ -64,7 +64,7 @@ public: private: result SendAddRequest(int width, int height); - result SendUpdateRequest(int width, int height); + result SendUpdateRequest(int width, int height, const Tizen::Base::String& argument); result SendResizeRequest(int width, int height); result SendRemoveRequest(); diff --git a/inc/FShell_LiveboxBase.h b/inc/FShell_LiveboxBase.h index 47aaec4..976aedc 100644 --- a/inc/FShell_LiveboxBase.h +++ b/inc/FShell_LiveboxBase.h @@ -56,11 +56,12 @@ public: int __priority; protected: - struct livebox_buffer *__buffer_info; - void *__buffer; bool __isForeground;// LB only? int __ipcClientId; +private: + void *__buffer; + struct livebox_buffer *__buffer_info; }; class _LiveboxRequestHelper diff --git a/inc/FShell_LiveboxManagerService.h b/inc/FShell_LiveboxManagerService.h index ce84e40..05a5cd2 100644 --- a/inc/FShell_LiveboxManagerService.h +++ b/inc/FShell_LiveboxManagerService.h @@ -23,7 +23,7 @@ #include #include #include -#include +//#include #include //#include #include @@ -34,7 +34,7 @@ namespace Tizen { namespace Shell { namespace App { class LiveboxManagerService :public Tizen::Shell::App::_LiveboxManagerStub - ,public Tizen::App::_IAppManagerEventListener +// ,public Tizen::App::_IAppManagerEventListener ,public Tizen::Base::Runtime::ITimerEventListener { public: @@ -62,7 +62,8 @@ private: static int OnLiveboxPeriodChaned(struct event_arg *arg, void* data); // stub implementations - virtual result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName); + virtual result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument); + virtual result RequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument); virtual result RequestSharedMemoryId(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int w, int h, int& shmId); virtual result RequestSharedMemoryIdForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int w, int h, int& shmId); virtual result RequestSyncSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height); @@ -74,8 +75,8 @@ private: LiveboxManagerService(); virtual ~LiveboxManagerService(); - virtual void OnApplicationLaunched(const Tizen::App::AppId& appId, Tizen::App::_AppType type); - virtual void OnApplicationTerminated(const Tizen::App::AppId& appId, Tizen::App::_AppType type); +// virtual void OnApplicationLaunched(const Tizen::App::AppId& appId, Tizen::App::_AppType type); +// virtual void OnApplicationTerminated(const Tizen::App::AppId& appId, Tizen::App::_AppType type); virtual void OnIpcClientConnected(const Tizen::Io::_IpcServer& server, int clientId); virtual void OnIpcClientDisconnected(const Tizen::Io::_IpcServer&server, int clientId); diff --git a/inc/FShell_LiveboxManagerStub.h b/inc/FShell_LiveboxManagerStub.h index 00d8a4c..6a54d54 100644 --- a/inc/FShell_LiveboxManagerStub.h +++ b/inc/FShell_LiveboxManagerStub.h @@ -52,7 +52,8 @@ protected: virtual ~_LiveboxManagerStub(void); // handlers - bool OnRequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, result* pRes); + bool OnRequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument, result* pRes); + bool OnRequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument, result* pRes); bool OnRequestSharedMemoryId(const Tizen::Base::String& instanceId, int width, int height, int* pShmId); bool OnRequestSharedMemoryIdForPD(const Tizen::Base::String& instanceId, int width, int height, int* pShmId); bool OnRequestSyncSharedMemory(const Tizen::Base::String& instanceId, int width, int height, result* pRes); @@ -61,7 +62,8 @@ protected: bool OnRequestReleaseSharedMemoryForPD(const Tizen::Base::String& instanceId, result* pRes); // interface to service - virtual result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName) = 0; + virtual result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument) = 0; + virtual result RequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument) = 0; virtual result RequestSharedMemoryId(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height, int& shmId) = 0; virtual result RequestSharedMemoryIdForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height, int& shmId) = 0; virtual result RequestSyncSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height) = 0; diff --git a/manifest.xml b/manifest.xml index 2441cde..e0267db 100644 --- a/manifest.xml +++ b/manifest.xml @@ -1,15 +1,12 @@ - + gi2qxenosh 1.0.0 C++App - - - + - x86 vfpv3 @@ -17,17 +14,16 @@ 2.1 - http://tizen.org/privilege/application.launch http://tizen.org/privilege/appmanager.launch + http://tizen.org/privilege/application.kill - - - tizen livebox service - + + + tizen livebox service + - diff --git a/src/FShell_Livebox.cpp b/src/FShell_Livebox.cpp index 31807b2..3d92247 100644 --- a/src/FShell_Livebox.cpp +++ b/src/FShell_Livebox.cpp @@ -99,11 +99,11 @@ _Livebox::OnRemoved() } void -_Livebox::OnUpdate(void) +_Livebox::OnUpdate(const String& argument) { SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority); - SendUpdateRequest(__width, __height); + SendUpdateRequest(__width, __height, argument); } void @@ -150,12 +150,9 @@ _Livebox::OnPopupDestoyed(void) if (__pLiveboxPopup) { __pLiveboxPopup->OnPopupDestoyed(); - __pLiveboxPopup->ReleaseSharedMem(); delete __pLiveboxPopup; + __pLiveboxPopup = null; } - - __pLiveboxPopup = null; - RestartLifeDurationTimer(); } @@ -179,7 +176,7 @@ _Livebox::SendAddRequest(int width, int height) } result -_Livebox::SendUpdateRequest(int width, int height) +_Livebox::SendUpdateRequest(int width, int height, const String& argument) { std::unique_ptr pArgs (CreateRequestArgs() ); @@ -276,12 +273,14 @@ _Livebox::OnTimerExpired(Tizen::Base::Runtime::Timer& timer) { SysLog(NID_APP, "lifeDuration timer is expired, so terminating livebox 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() ); - OnUpdate(); + OnUpdate(L""); } } diff --git a/src/FShell_LiveboxBase.cpp b/src/FShell_LiveboxBase.cpp index 9db8092..8476845 100644 --- a/src/FShell_LiveboxBase.cpp +++ b/src/FShell_LiveboxBase.cpp @@ -102,10 +102,10 @@ _LiveboxBase::_LiveboxBase(target_type type, const String& userInfo, const Strin ,__width(width) ,__height(height) ,__priority(priority) - ,__buffer_info(null) - ,__buffer(null) // __pEcoreEvas(null), __pEvas(null), __current(0) ,__isForeground(true) ,__ipcClientId(-1) + ,__buffer_info(null) + ,__buffer(null) // __pEcoreEvas(null), __pEvas(null), __current(0) { _LiveboxManagerImpl::ExtractAppIdAndProviderName(providerId, __appId, __providerName); @@ -160,6 +160,7 @@ result _LiveboxBase::ReleaseSharedMem() { SysLog(NID_APP, "Enter"); + int ret; if( __buffer) diff --git a/src/FShell_LiveboxManagerService.cpp b/src/FShell_LiveboxManagerService.cpp index 8f2625b..4339da2 100644 --- a/src/FShell_LiveboxManagerService.cpp +++ b/src/FShell_LiveboxManagerService.cpp @@ -79,7 +79,7 @@ LiveboxManagerService::GetInstance(void) result LiveboxManagerService::Construct() { - _AppManagerImpl::GetInstance()->AddEventListener(*this); +// _AppManagerImpl::GetInstance()->AddEventListener(*this); _LiveboxManagerStub::StartIpcServer(); @@ -164,22 +164,30 @@ LiveboxManagerService::SetClientIds(const Tizen::App::AppId& appId, int clientId { pLivebox->SetClientId(clientId); SysLog(NID_APP, "client is registered.(%d)", clientId); + if( clientId == -1) + { + pLivebox->ReleaseSharedMem(); + if(pLivebox->GetLiveboxPopup()) + { + pLivebox->OnPopupDestoyed(); + } + } } } return E_SUCCESS; } -void -LiveboxManagerService::OnApplicationLaunched(const AppId& appId, _AppType type) -{ - -} - -void -LiveboxManagerService::OnApplicationTerminated(const AppId& appId, _AppType type) -{ - this->SetClientIds(appId, -1); -} +//void +//LiveboxManagerService::OnApplicationLaunched(const AppId& appId, _AppType type) +//{ +// +//} +// +//void +//LiveboxManagerService::OnApplicationTerminated(const AppId& appId, _AppType type) +//{ +// this->SetClientIds(appId, -1); +//} void LiveboxManagerService::OnIpcClientConnected(const _IpcServer& server, int clientId) @@ -196,8 +204,7 @@ LiveboxManagerService::OnIpcClientDisconnected(const _IpcServer& server, int cli { String fullAppId = server.GetClientAppId() + "." + server.GetClientAppExecutableName(); SysLog(NID_APP, "(%ls)\n", fullAppId.GetPointer()); -// SysLog(NID_APP, "(appId:%ls, pid:%d, clientId:%d)\n", server.GetClientAppId().GetPointer(), server.GetClientProcessId(), clientId); -// this->SetClientIds(server.GetClientAppId(), -1); + this->SetClientIds(fullAppId, -1); } result @@ -275,7 +282,7 @@ LiveboxManagerService::OnLiveboxUpdate(struct event_arg *arg, void* data) _Livebox* pLivebox = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id); SysTryReturnResult(NID_APP, pLivebox , E_SYSTEM, "[E_SYSTEM] pLivebox is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id); - pLivebox->OnUpdate(); + pLivebox->OnUpdate(L""); } return 0; @@ -291,7 +298,7 @@ LiveboxManagerService::UpdateAllLiveboxesByAppId(const String& providerId) if ( pLivebox->__providerId == providerId ) { - pLivebox->OnUpdate(); + pLivebox->OnUpdate(L""); } } return E_SUCCESS; @@ -325,6 +332,10 @@ LiveboxManagerService::OnLiveboxPopupCreate(struct event_arg *arg, void* data) _Livebox* pLivebox = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id); SysTryReturnResult(NID_APP, pLivebox , E_SYSTEM, "[E_SYSTEM] pLivebox is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id); + /*if( pLivebox->GetLiveboxPopup() ) + { + pLivebox->OnPopupDestoyed(); + }*/ pLivebox->OnPopupCreated(arg->info.pd_create.w, arg->info.pd_create.h); return 0; @@ -334,15 +345,12 @@ LiveboxManagerService::OnLiveboxPopupCreate(struct event_arg *arg, void* data) 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), width(%d), height(%d), priority(%d)", arg->pkgname, arg->id); - SysLog(NID_APP, "Enter"); - + SysLog(NID_APP, "packageName(%s), id(%s)", arg->pkgname, arg->id); _Livebox* pLivebox = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id); SysTryReturnResult(NID_APP, pLivebox , E_SYSTEM, "[E_SYSTEM] pLivebox is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id); pLivebox->OnPopupDestoyed(); - SysLog(NID_APP, "Exit"); return 0; } @@ -425,6 +433,8 @@ LiveboxManagerService::InitializeMasterDaemonEventReceiver(const char *pServiceE 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, @@ -458,7 +468,7 @@ LiveboxManagerService::DeinitializeMasterDaemonEventReceiver() /////////////////////////////////////////////////////// result -LiveboxManagerService::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName)//, const Tizen::Base::String& param) +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() ); @@ -477,6 +487,7 @@ LiveboxManagerService::RequestUpdate(const Tizen::App::AppId& appId, const Tizen pArray->Construct(); pArray->Add(pLivebox); + pArray->Add(new String(argument)); result r = __handlerThread.SendUserEvent(LOCAL_EVENT_REQUEST_UPDATE, pArray); SysTryLog(NID_APP, !IsFailed(r), "[%s] Propagated.", GetErrorMessage(r)); @@ -490,6 +501,37 @@ LiveboxManagerService::RequestUpdate(const Tizen::App::AppId& appId, const Tizen } 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 < __liveboxes.GetCount(); i++ ) + { + _Livebox* pLivebox = null; + __liveboxes.GetAt(i, pLivebox); + + if ( pLivebox->__instanceId == instanceId) + { + SysLog(NID_APP, "OK"); + + ArrayList* pArray = new ArrayList(); + SysTryReturnResult(NID_APP, pArray, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]"); + + pArray->Construct(); + pArray->Add(pLivebox); + 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) { _Livebox* pLivebox = this->Find(appId, instanceId); @@ -568,7 +610,8 @@ LiveboxManagerService::RequestReleaseSharedMemoryForPD(const Tizen::App::AppId& SysTryReturnResult(NID_APP, pLivebox , E_SYSTEM, "[E_SYSTEM] pLivebox is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); SysTryReturnResult(NID_APP, pLivebox->GetLiveboxPopup(), E_SYSTEM, "[E_SYSTEM] GetLiveboxPopup() returns null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); - return pLivebox->GetLiveboxPopup()->ReleaseSharedMem(); +// return pLivebox->GetLiveboxPopup()->ReleaseSharedMem(); + return E_SUCCESS; } LiveboxManagerService::_TaskHandlerThread::~_TaskHandlerThread(void) @@ -590,8 +633,12 @@ LiveboxManagerService::_TaskHandlerThread::OnUserEventReceivedN(RequestId reqId, _Livebox* pLivebox = dynamic_cast<_Livebox*>( pArgs->GetAt(0) ); SysTryReturnVoidResult(NID_APP, pLivebox != null, E_INVALID_STATE, "_Livebox is null!."); - pLivebox->OnUpdate(); + String* pArgument = dynamic_cast( pArgs->GetAt(1) ); + SysTryReturnVoidResult(NID_APP, pArgument != null, E_INVALID_STATE, "pArgument is null!."); + + pLivebox->OnUpdate(*pArgument); + delete pArgument; pArgs->RemoveAll(); delete pArgs; } diff --git a/src/FShell_LiveboxManagerStub.cpp b/src/FShell_LiveboxManagerStub.cpp index 4ead778..ad7747e 100644 --- a/src/FShell_LiveboxManagerStub.cpp +++ b/src/FShell_LiveboxManagerStub.cpp @@ -85,10 +85,18 @@ CATCH: bool -_LiveboxManagerStub::OnRequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, result* pRes) +_LiveboxManagerStub::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); + *pRes = RequestUpdate(appId, providerName, argument); + return true; +} + +bool +_LiveboxManagerStub::OnRequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument, result* pRes) +{ + SysLog(NID_APP, ""); + *pRes = RequestUpdateInstance(instanceId, argument); return true; } @@ -179,6 +187,7 @@ _LiveboxManagerStub::OnIpcRequestReceived(_IpcServer& server, const IPC::Message 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) diff --git a/src/FShell_LiveboxPopup.cpp b/src/FShell_LiveboxPopup.cpp index 559968b..e7860c8 100644 --- a/src/FShell_LiveboxPopup.cpp +++ b/src/FShell_LiveboxPopup.cpp @@ -53,6 +53,7 @@ _LiveboxPopup::_LiveboxPopup(const String& info, const String& appId, const Stri _LiveboxPopup::~_LiveboxPopup() { SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d))", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height); + ReleaseSharedMem(); } -- 2.7.4