X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fapp%2FFApp_AppArg.cpp;h=a85fdebc833fa146a8c53ba6f3fbb9e15b1fbdc8;hb=refs%2Fchanges%2F61%2F14661%2F1;hp=3d5c714dd4e0378b0832173128b6d14f3ade3f38;hpb=8add6e34504456d593983014101182e11e867b5f;p=platform%2Fframework%2Fnative%2Fappfw.git diff --git a/src/app/FApp_AppArg.cpp b/src/app/FApp_AppArg.cpp index 3d5c714..a85fdeb 100644 --- a/src/app/FApp_AppArg.cpp +++ b/src/app/FApp_AppArg.cpp @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -35,9 +34,10 @@ #include #include #include +#include #include - #include + #include #include "FApp_MapDataControlImpl.h" @@ -47,12 +47,10 @@ #include "FApp_AppArg.h" #include "FApp_AppMessageImpl.h" #include "FApp_Aul.h" -#include "FAppPkg_PackageManagerImpl.h" using namespace Tizen::Base; using namespace Tizen::Base::Collection; using namespace Tizen::Base::Utility; -using namespace Tizen::App::Package; extern "C" int appsvc_allow_transient_app(bundle*, Ecore_X_Window); @@ -73,10 +71,13 @@ static const char OSP_V_REQUEST_TYPE_MAP_INSERT[] = "map_insert"; static const char OSP_V_REQUEST_TYPE_MAP_UPDATE[] = "map_update"; static const char OSP_V_REQUEST_TYPE_MAP_DELETE[] = "map_delete"; static const char OSP_V_VERSION_2_1_0_3[] = "ver_2.1.0.3"; + static const char BUNDLE_KEY_PREFIX_AUL[] = "__AUL_"; static const char BUNDLE_KEY_PREFIX_SERVICE[] = "__APP_SVC_"; static const char BUNDLE_KEY_PREFIX_OSP[] = "__OSP_"; -const char TIZEN_NOTIFICATION_DATA[] = "http://tizen.org/appcontrol/data/notification"; +static const char BUNDLE_KEY_PREFIX_UG[] = "__UG_"; + +static const char OSP_K_RAISE_MODE[] = "__OSP_RAISE_MODE__"; _AppArg::_AppArg(void) @@ -100,7 +101,7 @@ _AppArg::Construct(const String& argText) __pBundle = bundle_create(); SysTryReturnResult(NID_APP, __pBundle != null, E_OUT_OF_MEMORY, "Bundle creation failure."); - return CreateLaunchArg(__pBundle, argText); + return CreateNotificationArg(__pBundle, argText); } @@ -115,36 +116,6 @@ _AppArg::Construct(const IList* pList) result -_AppArg::Construct(const _AppControlImpl& ac, const IList* pList) -{ - __pBundle = bundle_create(); - SysTryReturnResult(NID_APP, __pBundle != null, E_OUT_OF_MEMORY, "Bundle creation failure."); - - return CreateAppControlArg(__pBundle, ac, pList); -} - - -result -_AppArg::Construct(const _AppControlImpl& ac, const String* pUri, const String* pMime, const IMap* pList) -{ - __pBundle = bundle_create(); - SysTryReturnResult(NID_APP, __pBundle != null, E_OUT_OF_MEMORY, "Bundle creation failure."); - - return CreateAppControlArg(__pBundle, ac, pUri, pMime, pList); -} - - -result -_AppArg::Construct(const _AppMessageImpl& msg, const String& oId, const String* pUri, const String* pMime) -{ - __pBundle = bundle_dup(const_cast(msg.GetBundle())); - SysTryReturnResult(NID_APP, __pBundle != null, E_OUT_OF_MEMORY, "Bundle creation failure."); - - return CreateAppControlArg(__pBundle, oId, pUri, pMime, null); -} - - -result _AppArg::Construct(const _SqlDataControlImpl& dc, _DataControlRequestType requestType, const IList* pList) { __pBundle = bundle_create(); @@ -185,9 +156,9 @@ _AppArg::ConstructResult(const _AppArg& arg, const IMap* pMap) result -_AppArg::Construct(bundle* b) +_AppArg::Construct(const bundle* b) { - __pBundle = bundle_dup(b); + __pBundle = bundle_dup(const_cast(b)); SysTryReturnResult(NID_APP, __pBundle != null, E_INVALID_STATE, "Bundle creatioin from service handle failure."); return E_SUCCESS; @@ -288,7 +259,7 @@ _AppArg::GetArgListN(int num) const case _APP_HANDLER_LAUNCH_NORMAL: pList->Add(*new (std::nothrow) String(LEGACY_LAUNCH_REASON_NORMAL)); - pList->Add(*new (std::nothrow) String(L"osp.operation.MAIN")); + pList->Add(*new (std::nothrow) String(LEGACY_OPERATION_MAIN)); break; default: @@ -359,6 +330,11 @@ IsInternalKey(const char* pKey) return true; } + if (strncmp(BUNDLE_KEY_PREFIX_UG, pKey, strlen(BUNDLE_KEY_PREFIX_UG)) == 0) + { + return true; + } + return false; } @@ -563,9 +539,9 @@ _AppArg::GetCallerAppId(void) const AppId -_AppArg::GetCalleeAppId(void) const +_AppArg::GetCalleeAppId(bundle* pBundle) { - const char* pBundleValue = bundle_get_val(__pBundle, AUL_K_CALLEE_APPID); + const char* pBundleValue = bundle_get_val(pBundle, AUL_K_CALLEE_APPID); const AppId retVal = pBundleValue; @@ -824,7 +800,7 @@ _AppArg::GetListN(bundle* b, const char* key) result -_AppArg::CreateLaunchArg(bundle* b, const String& arg) +_AppArg::CreateNotificationArg(bundle* b, const String& arg) { SysAssertf(b != null, "Valid bundle should be supplied"); @@ -832,15 +808,8 @@ _AppArg::CreateLaunchArg(bundle* b, const String& arg) if (!arg.IsEmpty()) { - const char** pSa = new (std::nothrow) const char*[1]; - SysTryReturnResult(NID_APP, pSa != null, E_OUT_OF_MEMORY, "Insufficient memory."); - pSa[0] = _StringConverter::CopyToCharArrayN(arg); - bundle_add_str_array(pb, OSP_K_ARG, pSa, 1); - - bundle_add(pb, TIZEN_NOTIFICATION_DATA, pSa[0]); - - delete[] pSa[0]; - delete[] pSa; + std::unique_ptr pStr(_StringConverter::CopyToCharArrayN(arg)); + bundle_add(pb, TIZEN_NOTIFICATION_DATA, pStr.get()); } bundle_add(pb, OSP_K_LAUNCH_TYPE, OSP_V_LAUNCH_TYPE_LAUNCH); @@ -886,73 +855,6 @@ _AppArg::CreateAppLaunchConditionArg(bundle* b, const String& condition, const I } -result -_AppArg::CreateAppControlArg(bundle* b, const _AppControlImpl& ac, const IList* pList) -{ - SysAssertf(b != null, "Valid bundle should be supplied"); - - bundle* pb = b; - - AddStrArray(pb, OSP_K_ARG, pList); - - std::unique_ptr pOperation(_StringConverter::CopyToCharArrayN(ac._opId)); - if (pOperation) - { - appsvc_set_operation(pb, pOperation.get()); - } - - bundle_add(pb, OSP_K_LAUNCH_TYPE, OSP_V_LAUNCH_TYPE_APPCONTROL); - - return E_SUCCESS; -} - - -result -_AppArg::CreateAppControlArg(bundle* b, const _AppControlImpl& ac, const String* pUriData, const String* pMimeType, const IMap* pMap) -{ - return CreateAppControlArg(b, ac._opId, pUriData, pMimeType, pMap); -} - - -result -_AppArg::CreateAppControlArg(bundle* b, const String& oId, const String* pUriData, const String* pMimeType, const IMap* pMap) -{ - SysAssertf(b != null, "Valid bundle should be supplied"); - - bundle* pb = b; - - std::unique_ptr pOperation(_StringConverter::CopyToCharArrayN(oId)); - if (pOperation.get()) - { - appsvc_set_operation(pb, pOperation.get()); - } - - if (pUriData) - { - std::unique_ptr pUri(_StringConverter::CopyToCharArrayN(*pUriData)); - if (pUri.get()) - { - appsvc_set_uri(pb, pUri.get()); - } - } - - if (pMimeType) - { - std::unique_ptr pMime(_StringConverter::CopyToCharArrayN(*pMimeType)); - if (pMime.get()) - { - appsvc_set_mime(pb, pMime.get()); - } - } - - AddStrMap(pb, pMap); - - bundle_add(pb, OSP_K_LAUNCH_TYPE, OSP_V_LAUNCH_TYPE_APPCONTROL); - - return E_SUCCESS; -} - - namespace { const int MAX_LEN_DATA_CONTROL_REQ_TYPE = 8; @@ -1053,21 +955,10 @@ _AppArg::CreateBundleFromSvc(void* svc) bundle* _AppArg::GetBundleFromSvc(void* svc) { - struct DummyS - { - int dummy1; - int dummy2; - bundle* pData; - }; - - DummyS* pDummy = static_cast(svc); - - if (pDummy && pDummy->pData) - { - return pDummy->pData; - } + bundle* pBundle = NULL; + int ret = service_to_bundle(static_cast(svc), &pBundle); - return NULL; + return (ret == SERVICE_ERROR_NONE) ? pBundle : NULL; } @@ -1153,25 +1044,19 @@ _AppArg::UpdateKeyValue(bundle* pBundle, const char* pKey, const String& value) void -_AppArg::UpdateSubMode(bundle* pBundle) +_AppArg::UpdateRaiseMode(bundle* pBundle) { - appsvc_add_data(pBundle, OSP_K_SUBMODE_CALLEE, "1"); + appsvc_add_data(pBundle, OSP_K_RAISE_MODE, "1"); } bool -_AppArg::IsSubMode(bundle* pBundle) +_AppArg::IsRaiseMode(bundle* pBundle) { - const char* p = appsvc_get_data(pBundle, OSP_K_SUBMODE_CALLEE); - if (p && (strncmp(p, "1", sizeof(char)) == 0)) - { - return true; - } - - return false; + const char* p = appsvc_get_data(pBundle, OSP_K_RAISE_MODE); + return (p && (strncmp(p, "1", sizeof(char)) == 0)); } - int _AppArg::GetRequestIdFromBundle(bundle* pBundle) {