From: Jaesung Ku Date: Tue, 16 Apr 2013 08:08:37 +0000 (+0900) Subject: Update for feature options X-Git-Tag: accepted/tizen_2.1/20130425.034849~53 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6d200ba9a86d4229fa68c70a7c8fb43660ed3efd;p=framework%2Fosp%2Fappfw.git Update for feature options Change-Id: I9f3e439c2f692048e06dffc0480207ef011b7b80 Signed-off-by: Jaesung Ku --- diff --git a/inc/FAppAppManager.h b/inc/FAppAppManager.h index 7984790..e2794b6 100755 --- a/inc/FAppAppManager.h +++ b/inc/FAppAppManager.h @@ -374,6 +374,7 @@ public: * @since 2.0 * @privlevel public * @privilege %http://tizen.org/privilege/application.launch + * @feature %http://tizen.org/feature/network.nfc for L¡±NFC=¡¯command¡¯¡± or %http://tzen.org/feature/usb.accessory for L¡±Serial=¡¯command¡¯¡± in the value of @c condition * * @return An error code * @param[in] condition The launch condition for the application @n @@ -405,6 +406,7 @@ public: * @exception E_MAX_EXCEEDED The size of @c pArguments has exceeded the maximum limit. * @exception E_SYSTEM A system error has occurred. * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @exception E_UNSUPPORTED_OPERATION The Emulator or target device does not support the required feature. For more information, see Application Filtering. @b Since: @b 2.1 * * @remarks When the registered application is about to be launched, the registered launch condition and arguments are given as parameters to IAppLaunchConditionEventListener::OnAppLaunchConditionMetN(). * @remarks The newly introduced launch condition does not work on the previous SDK version and the E_INVALID_CONDITION exception is returned. @@ -412,6 +414,7 @@ public: * @remarks The launch period requires more consideration because an inappropriate short period value may lead * to an adverse effect on the device battery. * @remarks For the NFC launch condition, the detected NDEF message can be acquired using the @c pExtraData parameter of the %IAppLaunchConditionEventListener::OnAppLaunchConditionMetN() method. + * @remarks Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue() methods. * @see UnregisterAppLaunch() * @see IsAppLaunchRegistered() * @see LaunchApplication(const AppId&, LaunchOption); @@ -497,6 +500,7 @@ public: * @since 2.0 * @privlevel partner * @privilege %http://tizen.org/privilege/appmanager.launch + * @feature %http://tizen.org/feature/network.nfc for L¡±NFC=¡¯command¡¯¡± or %http://tzen.org/feature/usb.accessory for L¡±Serial=¡¯command¡¯¡± in the value of @c condition * * @return An error code * @param[in] appId The ID of the application registered for launch @@ -527,6 +531,7 @@ public: * @exception E_MAX_EXCEEDED The size of @c pArguments has exceeded the maximum limit. * @exception E_SYSTEM A system error has occurred. * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @exception E_UNSUPPORTED_OPERATION The Emulator or target device does not support the required feature. For more information, see Application Filtering. @b Since: @b 2.1 * * @remarks When the registered application is about to be launched, the registered launch condition and arguments are given as parameters to IAppLaunchConditionEventListener::OnAppLaunchConditionMetN(). * @remarks The newly introduced launch condition does not work on the previous SDK version and the @c E_INVALID_CONDITION exception is returned. @@ -534,6 +539,7 @@ public: * @remarks The launch period requires more consideration because an inappropriate short period value may lead * to an adverse effect on the device battery. * @remarks For the NFC launch condition, the detected NDEF message can be acquired using the @c pExtraData parameter of the %IAppLaunchConditionEventListener::OnAppLaunchConditionMetN() method. + * @remarks Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue() methods. * @see UnregisterAppLaunch() * @see IsAppLaunchRegistered() * @see LaunchApplication(const AppId&, LaunchOption); diff --git a/src/app/FApp_AppManagerImpl.cpp b/src/app/FApp_AppManagerImpl.cpp old mode 100644 new mode 100755 index cfc7a6a..c3d0137 --- a/src/app/FApp_AppManagerImpl.cpp +++ b/src/app/FApp_AppManagerImpl.cpp @@ -67,6 +67,7 @@ #include "FAppPkg_PackageInfoImpl.h" #include "FApp_AppControlManager.h" #include "FApp_Aul.h" +#include "FSys_SystemInfoImpl.h" using namespace Tizen::App::Package; using namespace Tizen::Base; @@ -727,6 +728,24 @@ _AppManagerImpl::RegisterAppLaunch(const AppId& appId, const String& condition, _ConditionManagerProxy* pProxy = GetConditionManagerProxy(); SysTryReturnResult(NID_APP, null != pProxy, E_INVALID_STATE, "ConditionManager instance must not be null."); + Tizen::Base::Utility::StringTokenizer strTok(condition, L"="); + SysTryReturnResult(NID_APP, strTok.GetTokenCount() > 0, E_INVALID_ARG, "Condition string is invalid.(%ls)", condition.GetPointer()); + + String key; + result r = strTok.GetNextToken(key); + SysTryReturnResult(NID_APP, !IsFailed(r), E_INVALID_ARG, "Condition string is invalid.(%ls)", condition.GetPointer()); + + bool ret = true; + if (key == L"Serial") + { + r = Tizen::System::_SystemInfoImpl::GetSysInfo(L"http://tizen.org/feature/usb.accessory", ret); + } + else if (key == L"NFC") + { + r = Tizen::System::_SystemInfoImpl::GetSysInfo(L"http://tizen.org/feature/network.nfc", ret); + } + SysTryReturnResult(NID_APP, ret != false, E_UNSUPPORTED_OPERATION, "Condition(%ls)", condition.GetPointer()); + return pProxy->RegisterAppLaunch(appId, condition, pArguments, option); }