From be4081838a63959a486e8686da15ae524e6a3a7a Mon Sep 17 00:00:00 2001 From: "jungmin76.park" Date: Wed, 30 Jan 2013 11:01:07 +0900 Subject: [PATCH] fix LiveboxProviderManager::RequestUpdate() problem. add LiveboxPopupProvider::RequestUpdateToLivebox add manifest validation code to LiveboxProviderManager Change-Id: Iea49117b03fba37051d57e5d3a0f177d835ce5f7 Signed-off-by: jungmin76.park --- inc/FShellLiveboxPopupProvider.h | 16 ++- inc/FShellLiveboxProviderManager.h | 6 +- src/FShellLiveboxPopupProvider.cpp | 6 + src/FShellLiveboxProviderManager.cpp | 2 +- src/FShell_LiveboxManagerProxy.cpp | 17 ++- src/FShell_LiveboxPopupProviderImpl.cpp | 7 ++ src/FShell_LiveboxProviderManagerImpl.cpp | 185 +++++++++++++++++++--------- src/inc/FShell_LiveboxManagerIpcMessage.h | 8 +- src/inc/FShell_LiveboxManagerProxy.h | 3 +- src/inc/FShell_LiveboxPopupProviderImpl.h | 1 + src/inc/FShell_LiveboxProviderManagerImpl.h | 15 ++- 11 files changed, 187 insertions(+), 79 deletions(-) diff --git a/inc/FShellLiveboxPopupProvider.h b/inc/FShellLiveboxPopupProvider.h index e4c11e6..636640c 100644 --- a/inc/FShellLiveboxPopupProvider.h +++ b/inc/FShellLiveboxPopupProvider.h @@ -78,7 +78,7 @@ protected: virtual void OnLiveboxPopupProviderTerminating(void) = 0; /** - * Sets the Livebox popup to the Livebox + * Sets the Livebox popup to the Livebox popup provider * * @since 2.1 * @@ -94,7 +94,7 @@ protected: result SetLiveboxPopup(Tizen::Shell::LiveboxPopup* pLiveboxPopup); /** - * Get the Livebox popup from the Livebox + * Gets the Livebox popup * * @since 2.1 * @@ -103,7 +103,7 @@ protected: Tizen::Shell::LiveboxPopup* GetLiveboxPopup(); /** - * Get the Livebox popup from the Livebox + * Gets the Livebox popup from the Livebox * * @since 2.1 * @@ -111,6 +111,16 @@ protected: */ const Tizen::Shell::LiveboxPopup* GetLiveboxPopup() const; + /** + * Requests Livebox service to trigger specified Livebox update + * + * @since 2.1 + * + * @exception E_SUCCESS The method is successful. + * @exception E_SYSTEM The method cannot proceed due to a severe system error. + */ + result RequestUpdateToLivebox(); + protected: // // This method is for internal use only. Using this method can cause behavioral, diff --git a/inc/FShellLiveboxProviderManager.h b/inc/FShellLiveboxProviderManager.h index 999ec54..e16f2b5 100644 --- a/inc/FShellLiveboxProviderManager.h +++ b/inc/FShellLiveboxProviderManager.h @@ -62,7 +62,7 @@ public: static LiveboxProviderManager* GetInstance(); /** - * Request Livebox service to trigger specified Livebox update + * Requests Livebox service to trigger specified Livebox update * * @since 2.1 * @@ -83,7 +83,7 @@ public: result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& userInfo = L""); /** - * Request a Livebox viewer(eg, Home screen, Lock screen) to add the specified Livebox. + * Requests a Livebox viewer(eg, Home screen, Lock screen) to add the specified Livebox. * * @since 2.1 * @privlevel user @@ -121,6 +121,7 @@ public: * @return An error code * @param[in] factory The factory to create concrete LiveboxProvider * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_OPERATION The application's attribute doesn't meet conditon to provide Livebox. * @exception E_SYSTEM The method cannot proceed due to a severe system error. * @see ILiveboxProviderFactory */ @@ -137,6 +138,7 @@ public: * @return An error code * @param[in] factory The factory to create concrete LiveboxPopupProvider * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_OPERATION The application's attribute doesn't meet conditon to provide Livebox popup. * @exception E_SYSTEM The method cannot proceed due to a severe system error. * @see ILiveboxPopupProviderFactory */ diff --git a/src/FShellLiveboxPopupProvider.cpp b/src/FShellLiveboxPopupProvider.cpp index 9da3704..a190606 100644 --- a/src/FShellLiveboxPopupProvider.cpp +++ b/src/FShellLiveboxPopupProvider.cpp @@ -79,4 +79,10 @@ LiveboxPopupProvider::GetLiveboxPopup() const return const_cast(__pLiveboxPopupProviderImpl->GetLiveboxPopup()); } +result +LiveboxPopupProvider::RequestUpdateToLivebox() +{ + return __pLiveboxPopupProviderImpl->RequestUpdateToLivebox(); +} + }} // Tizen::Shell diff --git a/src/FShellLiveboxProviderManager.cpp b/src/FShellLiveboxProviderManager.cpp index 41da880..8639080 100644 --- a/src/FShellLiveboxProviderManager.cpp +++ b/src/FShellLiveboxProviderManager.cpp @@ -107,7 +107,7 @@ LiveboxProviderManager::SetLiveboxPopupProviderFactory(ILiveboxPopupProviderFact result LiveboxProviderManager::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument) { - __pLiveboxProviderManagerImpl->RequestUpdate(appId, providerName); + __pLiveboxProviderManagerImpl->RequestUpdate(appId, providerName, argument); return E_SUCCESS; } diff --git a/src/FShell_LiveboxManagerProxy.cpp b/src/FShell_LiveboxManagerProxy.cpp index 531849a..9117613 100644 --- a/src/FShell_LiveboxManagerProxy.cpp +++ b/src/FShell_LiveboxManagerProxy.cpp @@ -80,7 +80,7 @@ _LiveboxManagerProxy::Construct(void) } result -_LiveboxManagerProxy::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName) +_LiveboxManagerProxy::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument) { SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null."); SysLog(NID_APP, "Enter."); @@ -95,13 +95,26 @@ _LiveboxManagerProxy::RequestUpdate(const Tizen::App::AppId& appId, const Tizen: // } result ret = E_SUCCESS; - std::auto_ptr pMsg (new (std::nothrow) LiveboxManager_RequestUpdate(appId, providerName, &ret)); + std::auto_ptr pMsg (new (std::nothrow) LiveboxManager_RequestUpdate(appId, providerName, argument, &ret)); result r = __pIpcClient->SendRequest(*pMsg.get()); SysTryReturn(NID_APP, !IsFailed(r), r, r, "SendRequest is failed."); return ret; } +result +_LiveboxManagerProxy::RequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument) +{ + SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null."); + SysLog(NID_APP, "Enter."); + + result ret = E_SUCCESS; + std::auto_ptr pMsg (new (std::nothrow) LiveboxManager_RequestUpdateInstance(instanceId, argument, &ret)); + result r = __pIpcClient->SendRequest(*pMsg.get()); + SysTryReturn(NID_APP, !IsFailed(r), r, r, "SendRequest is failed."); + + return ret; +} result _LiveboxManagerProxy::RequestSharedMemoryId(const Tizen::Base::String& instanceId, int width, int height, int& shmId ) diff --git a/src/FShell_LiveboxPopupProviderImpl.cpp b/src/FShell_LiveboxPopupProviderImpl.cpp index e4527b1..2af297a 100644 --- a/src/FShell_LiveboxPopupProviderImpl.cpp +++ b/src/FShell_LiveboxPopupProviderImpl.cpp @@ -23,6 +23,7 @@ #include #include +#include "FShell_LiveboxProviderManagerImpl.h" #include "FShell_LiveboxPopupProviderImpl.h" #include "FShell_LiveboxPopupImpl.h" @@ -78,4 +79,10 @@ _LiveboxPopupProviderImpl::GetLiveboxPopup() const return __pLiveboxPopup; } +result +_LiveboxPopupProviderImpl::RequestUpdateToLivebox() +{ + return _LiveboxProviderManagerImpl::GetInstance()->RequestUpdateInstance(__instanceId); +} + }} // Tizen::Shell diff --git a/src/FShell_LiveboxProviderManagerImpl.cpp b/src/FShell_LiveboxProviderManagerImpl.cpp index 052f495..2764295 100644 --- a/src/FShell_LiveboxProviderManagerImpl.cpp +++ b/src/FShell_LiveboxProviderManagerImpl.cpp @@ -28,7 +28,11 @@ #include #include #include + +#include +#include #include +#include #include #include @@ -86,7 +90,7 @@ _LiveboxProviderManagerImpl::_LiveboxProviderManagerImpl() ,__pLiveboxPopupProviderFactory(null) ,__pLiveboxPopupProvider(null) ,__LiveboxPopupTouchEventListener(null) - ,__messageReceived(false) +// ,__messageReceived(false) { SysLog(NID_APP, ""); } @@ -129,13 +133,50 @@ _LiveboxProviderManagerImpl::Construct() result _LiveboxProviderManagerImpl::SetLiveboxProviderFactory(ILiveboxProviderFactory& factory) { + result r = ValidateApplicationAttributeForLivebox(); + SysTryReturnResult(NID_APP, !IsFailed(r), E_INVALID_OPERATION, "This application can't export Livebox provider."); + __pLiveboxFactory = &factory; return E_SUCCESS; } +const wchar_t USE_UI_KEY[] = L"UseUi"; +const wchar_t USE_UI_VAL_TRUE[] = L"True"; +const wchar_t LIFE_DURATION_KEY[] = L"LifeDuration"; +const int LIFE_DURATION_MIN = 30000; + +result +_LiveboxProviderManagerImpl::ValidateApplicationAttributeForLivebox(void) +{ + HashMapT* pInfo = _PackageManagerImpl::GetInstance()->GetPackageAppFeatureMapN(_AppInfo::GetPackageId(), _AppInfo::GetAppExecutableName()); + SysTryReturnResult(NID_APP, pInfo, E_SYSTEM, "Failed to invoke _PackageManagerImpl::GetPackageAppFeatureMapN()"); + + _AppFeatureInfoImpl* pFeature = null; + + result r = pInfo->GetValue(USE_UI_KEY, pFeature); + SysTryReturnResult(NID_APP, !IsFailed(r), E_INVALID_OPERATION, "Can't find %ls attribute for the ServiceApp in package information.", USE_UI_KEY ); + + const String& useUi = pFeature->GetValue(); + SysTryReturnResult(NID_APP, useUi == USE_UI_VAL_TRUE, E_INVALID_OPERATION, "%ls attribute value should be '%ls' to be an application that providing Livebox, but value is %ls", USE_UI_KEY, USE_UI_VAL_TRUE, useUi.GetPointer() ); + + r = pInfo->GetValue(LIFE_DURATION_KEY, pFeature); + SysTryReturnResult(NID_APP, !IsFailed(r), E_INVALID_OPERATION, "Can't find %ls attribute for the ServiceApp in package information.", LIFE_DURATION_KEY ); + + const String& lifeDurationValue = pFeature->GetValue(); + int lifeDuration = 0; + r = Tizen::Base::Integer::Parse(lifeDurationValue, lifeDuration); + SysTryReturnResult(NID_APP, !IsFailed(r), E_INVALID_OPERATION, "Failed to parse %ls attribute for the ServiceApp in package information.", LIFE_DURATION_KEY ); +// SysTryReturnResult(NID_APP, lifeDuration <= LIFE_DURATION_MIN, E_INVALID_OPERATION, "%ls attribute value should be less than '%d' to be an application that providing Livebox, but value is %d", LIFE_DURATION_KEY, LIFE_DURATION_MIN, lifeDuration ); + + return E_SUCCESS; +} + result _LiveboxProviderManagerImpl::SetLiveboxPopupProviderFactory(ILiveboxPopupProviderFactory& factory) { + result r = ValidateApplicationAttributeForLivebox(); + SysTryReturnResult(NID_APP, !IsFailed(r), E_INVALID_OPERATION, "This application can't export Livebox provider."); + __pLiveboxPopupProviderFactory = &factory; return E_SUCCESS; } @@ -155,18 +196,39 @@ _LiveboxProviderManagerImpl::SetLiveboxPopupEventListener(_ILiveboxTouchEventLis } result -_LiveboxProviderManagerImpl::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName) +_LiveboxProviderManagerImpl::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument) { /*if( appId == App::App::GetInstance()->GetAppId()) { - //TODO: optimazing for local request + //TODO: optimizing for local request } else*/ { - _LiveboxManagerProxy::GetInstance()->RequestUpdate(appId, providerName); + _LiveboxManagerProxy::GetInstance()->RequestUpdate(appId, providerName, argument); } - return E_SUCCESS; + return E_SUCCESS; +} + +result +_LiveboxProviderManagerImpl::RequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument) +{ + if(ContainsLivebox(instanceId)) + { + LiveboxProvider* pLiveboxProvider = null; + __liveBoxes.GetValue(instanceId, pLiveboxProvider); + + LiveboxFrame* pLiveBoxFrame = pLiveboxProvider->GetLiveboxFrame(); + SysTryReturnResult(NID_APP, pLiveBoxFrame, E_SYSTEM, "Failed to GetLiveboxFrame"); + + pLiveboxProvider->OnLiveboxProviderUpdating(argument); + } + else + { + return _LiveboxManagerProxy::GetInstance()->RequestUpdateInstance(instanceId, argument); + } + + return E_SUCCESS; } namespace @@ -188,6 +250,7 @@ _LiveboxProviderManagerImpl::AddLivebox(const Tizen::App::AppId& viewerAppId, co SysTryReturnResult(NID_APP, providerAppId.IsEmpty()==false, E_INVALID_ARG, "The providerAppId is empty."); SysTryReturnResult(NID_APP, providerAppId.GetLength() < NATIVE_APP_MAX_APPID_LENGTH, E_INVALID_ARG, "The providerAppId is too long (Maximum %d bytes).", NATIVE_APP_MAX_APPID_LENGTH); // SysTryReturnResult(NID_APP, _PackageManagerImpl::IsAppInstalled(providerAppId) == true, E_APP_NOT_INSTALLED, "The application(%ls) is not installed.", providerAppId.GetPointer()); + SysTryReturnResult(NID_APP, Tizen::App::_Aul::IsInstalled(providerAppId) == true, E_APP_NOT_INSTALLED, "The application(%ls) is not installed.", providerAppId.GetPointer()); //TODO :: check privilege String providerId; @@ -232,20 +295,20 @@ _LiveboxProviderManagerImpl::AddLivebox(const Tizen::App::AppId& viewerAppId, co bool _LiveboxProviderManagerImpl::ContainsLivebox(const String& instanceId) const { - bool isCreated = false; - __liveBoxes.ContainsKey(instanceId, isCreated); + bool contains = false; + __liveBoxes.ContainsKey(instanceId, contains); - return isCreated; + return contains; } -void -_LiveboxProviderManagerImpl::TerminateAppIfInvalidState() -{ - if( __messageReceived == false ) - { - Tizen::App::App::GetInstance()->Terminate(); - } -} +//void +//_LiveboxProviderManagerImpl::TerminateAppIfInvalidState() +//{ +// if( __messageReceived == false ) +// { +// Tizen::App::App::GetInstance()->Terminate(); +// } +//} void _LiveboxProviderManagerImpl::OnAppControlRequestReceived(RequestId reqId, const String& operationId, const String* pUri, const String* pMimeType, const IMap* pArgs) @@ -253,18 +316,18 @@ _LiveboxProviderManagerImpl::OnAppControlRequestReceived(RequestId reqId, const SysAssertf( pArgs, "[E_SYSTEN] pArgs should not be null."); SysAssertf( pArgs->GetCount() > 0, "[E_SYSTEN] pArgs should have one more key-values."); - __messageReceived = true; +// __messageReceived = true; SysLog(NID_APP, "operationId(%ls), argc(%d)", operationId.GetPointer(), pArgs->GetCount()); const String* pInstanceId = dynamic_cast(pArgs->GetValue(ARG_KEY_INSTANCE_ID)); - SysTryReturnVoidResult(NID_APP, pInstanceId, E_FAILURE, "[E_FAILURE] pId is null."); + SysTryReturnVoidResult(NID_APP, pInstanceId, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_INSTANCE_ID.GetPointer() ); const String* pName = dynamic_cast(pArgs->GetValue(ARG_KEY_PROVIDER_NAME)); - SysTryReturnVoidResult(NID_APP, pInstanceId, E_FAILURE, "[E_FAILURE] pName is null"); + SysTryReturnVoidResult(NID_APP, pName, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_PROVIDER_NAME.GetPointer() ); const String* pParam = dynamic_cast(pArgs->GetValue(ARG_KEY_USER_INFO)); - SysTryReturnVoidResult(NID_APP, pParam, E_FAILURE, "[E_FAILURE] pParam is null"); + SysTryReturnVoidResult(NID_APP, pParam, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_USER_INFO.GetPointer() ); SysLog(NID_APP, "id(%ls), name(%ls), param(%ls)", pInstanceId->GetPointer(), pName->GetPointer(), pParam->GetPointer()); @@ -273,13 +336,13 @@ _LiveboxProviderManagerImpl::OnAppControlRequestReceived(RequestId reqId, const SysLog(NID_APP, "no livebox instance, creating.."); int width = 0; - int height = 0; const String* pValue = dynamic_cast(pArgs->GetValue(ARG_KEY_WIDTH)); - SysTryReturnVoidResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + SysTryReturnVoidResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_WIDTH.GetPointer() ); Integer::Parse(*pValue, width); + int height = 0; pValue = dynamic_cast(pArgs->GetValue(ARG_KEY_HEIGHT)); - SysTryReturnVoidResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + SysTryReturnVoidResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_HEIGHT.GetPointer() ); Integer::Parse(*pValue, height); this->CreateLivebox( *pName, *pInstanceId, width, height, *pParam); @@ -346,11 +409,11 @@ _LiveboxProviderManagerImpl::HandleLiveboxRequest(const Tizen::Base::String& ope int width = 0; int height = 0; const String* pValue = dynamic_cast(pArgs->GetValue(ARG_KEY_WIDTH)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_WIDTH.GetPointer() ); Integer::Parse(*pValue, width); pValue = dynamic_cast(pArgs->GetValue(ARG_KEY_HEIGHT)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_HEIGHT.GetPointer() ); Integer::Parse(*pValue, height); this->ResizeLivebox(*pInstanceId, width, height); @@ -360,42 +423,40 @@ _LiveboxProviderManagerImpl::HandleLiveboxRequest(const Tizen::Base::String& ope int width = 0; int height = 0; const String* pValue = dynamic_cast( pArgs->GetValue(ARG_KEY_WIDTH)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE], "); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_WIDTH.GetPointer() ); Integer::Parse(*pValue, width); pValue = dynamic_cast(pArgs->GetValue(ARG_KEY_HEIGHT)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_HEIGHT.GetPointer() ); Integer::Parse(*pValue, height); this->UpdateLivebox(*pInstanceId, width, height); } else if (operationId == LIVEBOX_ON_REMOVE) { - this->RemoveLivebox(*pInstanceId); + this->RemoveLivebox(*pInstanceId, true); } else if (operationId == LIVEBOX_ON_TOUCH) { - SysAssertf(pArgs->GetCount() == 7, "invalid argc(%d)", pArgs->GetCount() ); - int eventType = 0; double timeStamp = 0.0f; double x = 0.0f; double y = 0.0f; const String* pValue = dynamic_cast(pArgs->GetValue(ARG_KEY_EVENT_TYPE)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_EVENT_TYPE.GetPointer() ); Integer::Parse(*pValue, eventType); pValue = dynamic_cast(pArgs->GetValue(ARG_KEY_TIME_STAMP)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_TIME_STAMP.GetPointer() ); Double::Parse(*pValue, timeStamp); pValue = dynamic_cast(pArgs->GetValue(ARG_KEY_X)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_X.GetPointer() ); Double::Parse(*pValue, x); pValue = dynamic_cast(pArgs->GetValue(ARG_KEY_Y)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_Y.GetPointer() ); Double::Parse(*pValue, y); this->ForwardTouchEvent(*pInstanceId, eventType, timeStamp, x, y); @@ -415,30 +476,25 @@ _LiveboxProviderManagerImpl::HandleLiveboxPopupRequest(const Tizen::Base::String } const String* pInstanceId = dynamic_cast(pArgs->GetValue(ARG_KEY_INSTANCE_ID)); - SysTryReturnResult(NID_APP, pInstanceId, E_FAILURE, "[E_FAILURE] pId is null."); - - /*String *pName = dynamic_cast(pArgs->GetAt(1)); - SysTryReturnResult(NID_APP, pInstanceId, E_FAILURE, "[E_FAILURE] pName is null"); - - String *pParam = dynamic_cast(pArgs->GetAt(2)); - SysTryReturnResult(NID_APP, pParam, E_FAILURE, "[E_FAILURE] pName is null"); - - SysLog(NID_APP, "id(%ls), name(%d)", pInstanceId->GetPointer(), pName->GetPointer());*/ + SysTryReturnResult(NID_APP, pInstanceId, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_INSTANCE_ID.GetPointer() ); if (operationId == LIVEBOX_TRAY_ON_CREATE) { int width = 0; int height = 0; + const String* pName = dynamic_cast(pArgs->GetValue(ARG_KEY_PROVIDER_NAME)); + SysTryReturnResult(NID_APP, pName, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_PROVIDER_NAME.GetPointer() ); + const String* pValue = dynamic_cast(pArgs->GetValue(ARG_KEY_WIDTH)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_WIDTH.GetPointer() ); Integer::Parse(*pValue, width); pValue = dynamic_cast(pArgs->GetValue(ARG_KEY_HEIGHT));; - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_HEIGHT.GetPointer() ); Integer::Parse(*pValue, height); - this->CreateLiveboxPopupProvider(*pInstanceId); + this->CreateLiveboxPopupProvider(*pInstanceId, *pName); return E_SUCCESS; } else if (operationId == LIVEBOX_TRAY_ON_DESTROY) @@ -456,19 +512,19 @@ _LiveboxProviderManagerImpl::HandleLiveboxPopupRequest(const Tizen::Base::String double y = 0.0f; const String* pValue = dynamic_cast(pArgs->GetValue(ARG_KEY_EVENT_TYPE)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_EVENT_TYPE.GetPointer() ); Integer::Parse(*pValue, eventType); pValue = dynamic_cast(pArgs->GetValue(ARG_KEY_TIME_STAMP)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_TIME_STAMP.GetPointer() ); Double::Parse(*pValue, timeStamp); pValue = dynamic_cast(pArgs->GetValue(ARG_KEY_X)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_X.GetPointer() ); Double::Parse(*pValue, x); pValue = dynamic_cast(pArgs->GetValue(ARG_KEY_Y)); - SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]"); + SysTryReturnResult(NID_APP, pValue, E_FAILURE, "Failed to GetValue(%ls)", ARG_KEY_Y.GetPointer() ); Double::Parse(*pValue, y); ForwardTouchEventForPD(*pInstanceId, eventType, timeStamp, x, y); @@ -487,6 +543,12 @@ _LiveboxProviderManagerImpl::CreateLivebox(const String& name, const String& ins SysLog(NID_APP, "instanceId(%ls), w:%d, h:%d", instanceId.GetPointer(), width, height); SysTryReturnResult(NID_APP, __pLiveboxFactory, E_FAILURE, "[E_INVALID_OPERATION] __pLiveboxFactory should not be null"); + if( ContainsLivebox(instanceId)) + { + SysLog(NID_APP, "CreateLivebox invoke is duplicated!!"); + RemoveLivebox(instanceId, false); + } + LiveboxProvider* pLivebox = __pLiveboxFactory->CreateInstance(name, width, height, userInfo); SysTryReturnResult(NID_APP, pLivebox, E_INVALID_OPERATION, "[E_INVALID_OPERATION]"); @@ -507,7 +569,7 @@ _LiveboxProviderManagerImpl::UpdateLivebox(const String& instanceId, int width, LiveboxProvider* pLivebox = null; __liveBoxes.GetValue(instanceId, pLivebox); - SysTryReturnResult(NID_APP, pLivebox, E_INVALID_OPERATION, "[E_INVALID_OPERATION]"); + SysTryReturnResult(NID_APP, pLivebox, E_SYSTEM, "Can't find the Livebox provider"); pLivebox->OnLiveboxProviderUpdating(L""); @@ -521,30 +583,31 @@ _LiveboxProviderManagerImpl::ResizeLivebox(const String& instanceId, int width, LiveboxProvider* pLivebox = null; __liveBoxes.GetValue(instanceId, pLivebox); - SysTryReturnResult(NID_APP, pLivebox, E_SYSTEM, "[E_SYSTEM]"); + SysTryReturnResult(NID_APP, pLivebox, E_SYSTEM, "Can't find the Livebox provider"); LiveboxFrame* pLiveBoxFrame = pLivebox->GetLiveboxFrame(); - SysTryReturnResult(NID_APP, pLiveBoxFrame, E_INVALID_STATE, "[E_INVALID_STATE]"); + SysTryReturnResult(NID_APP, pLiveBoxFrame, E_SYSTEM, "GetLiveboxFrame() returns 'null'."); return pLiveBoxFrame->SetSize(Dimension(width, height)); } result -_LiveboxProviderManagerImpl::RemoveLivebox(const String& instanceId) +_LiveboxProviderManagerImpl::RemoveLivebox(const String& instanceId, bool terminateIfFinished) { SysLog(NID_APP, "instanceId(%ls)", instanceId.GetPointer() ); // __pLiveboxEventListener->OnLiveboxRemoved(instanceId); - LiveboxProvider* pLivebox = null; - __liveBoxes.GetValue(instanceId, pLivebox); + LiveboxProvider* pLiveboxProvider = null; + __liveBoxes.GetValue(instanceId, pLiveboxProvider); __liveBoxes.Remove(instanceId); - if( pLivebox != null) + + if( pLiveboxProvider != null) { - delete pLivebox; + delete pLiveboxProvider; } // this->__pLiveboxEventListener->OnLiveboxRemoved(instanceId); - if( this->__liveBoxes.GetCount() == 0) + if( terminateIfFinished && this->__liveBoxes.GetCount() == 0) { Tizen::App::App::GetInstance()->Terminate(); } @@ -553,7 +616,7 @@ _LiveboxProviderManagerImpl::RemoveLivebox(const String& instanceId) } result -_LiveboxProviderManagerImpl::CreateLiveboxPopupProvider(const String& instanceId) +_LiveboxProviderManagerImpl::CreateLiveboxPopupProvider(const String& instanceId, const String& providerName) { SysLog(NID_APP, "instanceId(%ls)", instanceId.GetPointer()); SysTryReturnResult(NID_APP, __pLiveboxPopupProviderFactory, E_FAILURE, "[E_INVALID_OPERATION] __pLiveboxPopupProviderFactory should not be null"); @@ -562,7 +625,7 @@ _LiveboxProviderManagerImpl::CreateLiveboxPopupProvider(const String& instanceId __liveBoxes.GetValue(instanceId, pLivebox); SysTryReturnResult(NID_APP, pLivebox, E_INVALID_OPERATION, "[E_INVALID_OPERATION]"); - LiveboxPopupProvider* pPd = __pLiveboxPopupProviderFactory->CreateInstance(L"test", L""); + LiveboxPopupProvider* pPd = __pLiveboxPopupProviderFactory->CreateInstance(providerName, L""); __pLiveboxPopupProvider = pPd; __pLiveboxPopupProvider->Construct(instanceId); diff --git a/src/inc/FShell_LiveboxManagerIpcMessage.h b/src/inc/FShell_LiveboxManagerIpcMessage.h index ce3c06a..76442cf 100644 --- a/src/inc/FShell_LiveboxManagerIpcMessage.h +++ b/src/inc/FShell_LiveboxManagerIpcMessage.h @@ -30,14 +30,16 @@ #define IPC_MESSAGE_START LiveboxManagerServiceStart -IPC_SYNC_MESSAGE_CONTROL2_1(LiveboxManager_RequestUpdate, Tizen::Base::String, Tizen::Base::String, result) +// Message to service +IPC_SYNC_MESSAGE_CONTROL3_1(LiveboxManager_RequestUpdate, Tizen::Base::String, Tizen::Base::String, Tizen::Base::String, result) +IPC_SYNC_MESSAGE_CONTROL2_1(LiveboxManager_RequestUpdateInstance, Tizen::Base::String, Tizen::Base::String, result) IPC_SYNC_MESSAGE_CONTROL3_1(LiveboxManager_RequestSharedMemoryId, Tizen::Base::String, int, int, int) IPC_SYNC_MESSAGE_CONTROL3_1(LiveboxManager_RequestSharedMemoryIdForPD, Tizen::Base::String, int, int, int) IPC_SYNC_MESSAGE_CONTROL3_1(LiveboxManager_RequestSyncSharedMemory, Tizen::Base::String, int, int, result) IPC_SYNC_MESSAGE_CONTROL1_1(LiveboxManager_RequestSyncSharedMemoryForPD, Tizen::Base::String, result) IPC_SYNC_MESSAGE_CONTROL1_1(LiveboxManager_RequestReleaseSharedMemory, Tizen::Base::String, result) IPC_SYNC_MESSAGE_CONTROL1_1(LiveboxManager_RequestReleaseSharedMemoryForPD, Tizen::Base::String, result) + +// Message from service IPC_MESSAGE_CONTROL5(LiveboxManager_SendTouchEvent, Tizen::Base::String, int, double, double, double) IPC_MESSAGE_CONTROL5(LiveboxManager_SendTouchEventForPD, Tizen::Base::String, int, double, double, double) - - diff --git a/src/inc/FShell_LiveboxManagerProxy.h b/src/inc/FShell_LiveboxManagerProxy.h index d3647c8..ea3e0c5 100644 --- a/src/inc/FShell_LiveboxManagerProxy.h +++ b/src/inc/FShell_LiveboxManagerProxy.h @@ -41,7 +41,8 @@ public: static _LiveboxManagerProxy* GetInstance(); result Construct(void); - result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName); + result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument); + result RequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument); result RequestSharedMemoryId(const Tizen::Base::String& instanceId, int w, int h, int& shmId); result RequestSharedMemoryIdForPD(const Tizen::Base::String& instanceId, int w, int h, int& shmId); diff --git a/src/inc/FShell_LiveboxPopupProviderImpl.h b/src/inc/FShell_LiveboxPopupProviderImpl.h index 395b2ab..a957b10 100644 --- a/src/inc/FShell_LiveboxPopupProviderImpl.h +++ b/src/inc/FShell_LiveboxPopupProviderImpl.h @@ -43,6 +43,7 @@ public: const Tizen::Base::String& GetInstanceId() const; result SetLiveboxPopup(Tizen::Shell::LiveboxPopup* pLiveboxPopup); Tizen::Shell::LiveboxPopup* GetLiveboxPopup() const; + result RequestUpdateToLivebox(); private: _LiveboxPopupProviderImpl(); diff --git a/src/inc/FShell_LiveboxProviderManagerImpl.h b/src/inc/FShell_LiveboxProviderManagerImpl.h index 47b8de9..30403ab 100644 --- a/src/inc/FShell_LiveboxProviderManagerImpl.h +++ b/src/inc/FShell_LiveboxProviderManagerImpl.h @@ -56,10 +56,12 @@ public: // public APIs result SetLiveboxProviderFactory(ILiveboxProviderFactory& factory); result SetLiveboxPopupProviderFactory(ILiveboxPopupProviderFactory& factory); - result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName); + result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument); result AddLivebox(const Tizen::App::AppId& viewerAppId, const Tizen::Base::String& providerAppId, const Tizen::Base::String& providerName, const Tizen::Base::String& text, const Tizen::Base::String& userInfo); // internal APIs + result RequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument = L""); + result RequestSharedMemoryId(const Tizen::Base::String& instanceId, int width, int height, int& shmId); result RequestSharedMemoryIdForPD(const Tizen::Base::String& instanceId, int width, int height, int& shmId); result RequestSyncSharedMemory(const Tizen::Base::String& instanceId, int width, int height); @@ -76,6 +78,7 @@ public: // helper // static result ExtractAppIdAndProviderName(const Tizen::Base::String& providerId, Tizen::App::AppId& appId, Tizen::Base::String& providerName); + result ValidateApplicationAttributeForLivebox(void); void TerminateAppIfInvalidState(); @@ -87,8 +90,8 @@ private: result CreateLivebox(const Tizen::Base::String& name, const Tizen::Base::String& instanceId, int width, int height, const Tizen::Base::String& userInfo); result UpdateLivebox(const Tizen::Base::String& instanceId, int width, int height); result ResizeLivebox(const Tizen::Base::String& instanceId, int width, int height); - result RemoveLivebox(const Tizen::Base::String& instanceId); - result CreateLiveboxPopupProvider(const Tizen::Base::String& instanceId); + result RemoveLivebox(const Tizen::Base::String& instanceId, bool terminateIfFinished); + result CreateLiveboxPopupProvider(const Tizen::Base::String& instanceId, const Tizen::Base::String& providerName); result DestroyLiveboxPopupProvider(const Tizen::Base::String& instanceId); bool ContainsLivebox(const Tizen::Base::String& instanceId) const; @@ -99,17 +102,17 @@ private: result HandleLiveboxPopupRequest(const Tizen::Base::String& operationId, const Tizen::Base::Collection::IMap* pArgs); private: - // for livebox + // for Livebox ILiveboxProviderFactory* __pLiveboxFactory; Tizen::Base::Collection::HashMapT __liveBoxes; Tizen::Base::Collection::HashMapT __touchEventListeners; - // for PD + // for LiveboxPopup ILiveboxPopupProviderFactory* __pLiveboxPopupProviderFactory; LiveboxPopupProvider* __pLiveboxPopupProvider; _ILiveboxTouchEventListener* __LiveboxPopupTouchEventListener; - bool __messageReceived; +// bool __messageReceived; }; }} // Tizen::Shell -- 2.7.4