X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fapp%2FFAppAppManager.cpp;h=a3fcc04f73269b543fc5ecf8226e0e34b39edd2c;hb=HEAD;hp=e9cd61523b2a808c02f247fd12d954a78fa69d03;hpb=6b44196c40a66b895028f7ba2e9b5e41bc715ab2;p=platform%2Fframework%2Fnative%2Fappfw.git diff --git a/src/app/FAppAppManager.cpp b/src/app/FAppAppManager.cpp index e9cd615..a3fcc04 100644 --- a/src/app/FAppAppManager.cpp +++ b/src/app/FAppAppManager.cpp @@ -1,5 +1,4 @@ // -// Open Service Platform // Copyright (c) 2012 Samsung Electronics Co., Ltd. // // Licensed under the Apache License, Version 2.0 (the License); @@ -77,7 +76,11 @@ AppManager::Construct(void) SysTryReturnResult(NID_APP, __pAppManagerImpl != null, E_OUT_OF_MEMORY, ""); r = __pAppManagerImpl->Construct(); - SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r)); + if (IsFailed(r)) + { + SysPropagate(NID_APP, r); + goto CATCH; + } return r; @@ -151,8 +154,7 @@ AppManager::GetAppSharedPath(const AppId& appId) String sharedPath; result r = _AppManagerImpl::GetAppRootPath(appId, sharedPath); - SysTryReturn(NID_APP, !IsFailed(r), sharedPath, r, "[%s] Propagating to caller...", - GetErrorMessage(r)); + SysTryReturn(NID_APP, !IsFailed(r), sharedPath, r, "[%s] Propagating to caller...", GetErrorMessage(r)); sharedPath.Append(L"shared/"); @@ -222,13 +224,10 @@ AppManager::TerminateApplication(const AppId& appId) SysTryReturnResult(NID_APP, appId.GetLength() <= WIDGET_APP_MAX_APPID_LENGTH, E_MAX_EXCEEDED, "The length of appid exceeded the limit(%d).", WIDGET_APP_MAX_APPID_LENGTH); - String tmpAppId = appId; - String executableName = L""; - - result r = _AppManagerImpl::ExtractValues(appId, tmpAppId, executableName ); - bool hasExecutableName = (r == E_SUCCESS); + result r = _AccessController::CheckUserPrivilege(_PRV_APPLICATION_KILL, _PRV_APPMANAGER_KILL); + SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method."); - return __pAppManagerImpl->TerminateApplication(tmpAppId, (hasExecutableName) ? &executableName : null); + return __pAppManagerImpl->TerminateApplication(appId); } bool @@ -236,13 +235,7 @@ AppManager::IsRunning(const AppId& appId) const { SysAssertf(__pAppManagerImpl != null, "Not constructed properly by platform."); - String tmpAppId = appId; - String executableName = L""; - - result r = _AppManagerImpl::ExtractValues(appId, tmpAppId, executableName ); - bool hasExecutableName = (r == E_SUCCESS); - - return __pAppManagerImpl->IsRunning(tmpAppId, (hasExecutableName) ? &executableName : null); + return __pAppManagerImpl->IsRunning(appId); } IList* @@ -261,7 +254,7 @@ AppManager::RegisterAppLaunch(const String& condition, const IList* pArguments, result r = _AccessController::CheckUserPrivilege(_PRV_APPLICATION_LAUNCH); SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method."); - return __pAppManagerImpl->RegisterAppLaunch(L"", _AppInfo::GetAppExecutableName(), condition, pArguments, option); + return __pAppManagerImpl->RegisterAppLaunch(L"", condition, pArguments, option); } result @@ -272,7 +265,7 @@ AppManager::UnregisterAppLaunch(void) result r = _AccessController::CheckUserPrivilege(_PRV_APPLICATION_LAUNCH); SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method."); - return __pAppManagerImpl->UnregisterAppLaunch(L"", _AppInfo::GetAppExecutableName(), null); + return __pAppManagerImpl->UnregisterAppLaunch(L"", null); } result @@ -283,7 +276,7 @@ AppManager::UnregisterAppLaunch(const String& condition) result r = _AccessController::CheckUserPrivilege(_PRV_APPLICATION_LAUNCH); SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method."); - return __pAppManagerImpl->UnregisterAppLaunch(L"", _AppInfo::GetAppExecutableName(), &condition); + return __pAppManagerImpl->UnregisterAppLaunch(L"", &condition); } bool @@ -291,21 +284,16 @@ AppManager::IsAppLaunchRegistered(void) const { SysAssertf(__pAppManagerImpl != null, "Not constructed properly by platform."); - return __pAppManagerImpl->IsAppLaunchRegistered(L"", _AppInfo::GetAppExecutableName(), null); + return __pAppManagerImpl->IsAppLaunchRegistered(L"", null); } result AppManager::RegisterAppLaunch(const AppId& appId, const String& condition, const IList* pArguments, LaunchOption option) { SysAssertf(__pAppManagerImpl != null, "Not constructed properly by platform."); + SysTryReturnResult(NID_APP, _Aul::IsInstalled(appId) == true, E_APP_NOT_INSTALLED, "The application(%ls) is not installed.", appId.GetPointer()); - String tmpAppId = appId; - String executableName = L""; - - _AppManagerImpl::ExtractValues(appId, tmpAppId, executableName ); - SysTryReturnResult(NID_APP, _PackageManagerImpl::GetInstance()->IsPackageInstalled(tmpAppId) == true, E_APP_NOT_INSTALLED, "The application(%ls) is not installed.", appId.GetPointer()); - - return __pAppManagerImpl->RegisterAppLaunch(tmpAppId, executableName, condition, pArguments, option); + return __pAppManagerImpl->RegisterAppLaunch(appId, condition, pArguments, option); } @@ -313,14 +301,9 @@ result AppManager::UnregisterAppLaunch(const AppId& appId, const String* pCondition) { SysAssertf(__pAppManagerImpl != null, "Not constructed properly by platform."); + SysTryReturnResult(NID_APP, _Aul::IsInstalled(appId) == true, E_APP_NOT_INSTALLED, "The application(%ls) is not installed.", appId.GetPointer()); - String tmpAppId = appId; - String executableName = L""; - - _AppManagerImpl::ExtractValues(appId, tmpAppId, executableName ); - SysTryReturnResult(NID_APP, _PackageManagerImpl::GetInstance()->IsPackageInstalled(tmpAppId) == true, E_APP_NOT_INSTALLED, "The application(%ls) is not installed.", appId.GetPointer()); - - return __pAppManagerImpl->UnregisterAppLaunch(tmpAppId, executableName, pCondition); + return __pAppManagerImpl->UnregisterAppLaunch(appId, pCondition); } @@ -329,13 +312,7 @@ AppManager::IsAppLaunchRegistered(const AppId& appId, const String* pCondition) { SysAssertf(__pAppManagerImpl != null, "Not constructed properly by platform."); - String tmpAppId = appId; - String executableName = L""; - - _AppManagerImpl::ExtractValues(appId, tmpAppId, executableName ); - SysTryReturn(NID_APP, _PackageManagerImpl::GetInstance()->IsPackageInstalled(tmpAppId) == true, false, E_APP_NOT_INSTALLED, "[E_APP_NOT_INSTALLED] The application(%ls) is not installed.", appId.GetPointer()); - - return __pAppManagerImpl->IsAppLaunchRegistered(tmpAppId, executableName, pCondition); + return __pAppManagerImpl->IsAppLaunchRegistered(appId, pCondition); } result @@ -344,7 +321,7 @@ AppManager::SetCheckpointEventListener(IAppCheckpointEventListener& listener) SysAssertf(__pAppManagerImpl != null, "Not constructed properly by platform."); Tizen::Base::Runtime::IEventListener* pListener = &listener; - return __pAppManagerImpl->SetEventListener(AE_CHECKPOINT, pListener); + return __pAppManagerImpl->SetEventListener(_APP_EVENT_CHECKPOINT, pListener); } void @@ -396,4 +373,22 @@ AppManager::GetActiveApp(AppId& appId) return __pAppManagerImpl->GetActiveApp(appId); } +bool +AppManager::IsUserPreferredAppForAppControlResolution(const AppId& appId) const +{ + SysAssertf(__pAppManagerImpl != null, "Not constructed properly by platform."); + SysTryReturn(NID_APP, _Aul::IsInstalled(appId) == true, false, E_APP_NOT_INSTALLED, "The application(%ls) is not installed.", appId.GetPointer()); + + return __pAppManagerImpl->IsUserPreferredAppForAppControlResolution(appId); +} + +result +AppManager::ClearUserPreferenceForAppControlResolution(const AppId& appId) +{ + SysAssertf(__pAppManagerImpl != null, "Not constructed properly by platform."); + SysTryReturnResult(NID_APP, _Aul::IsInstalled(appId) == true, E_APP_NOT_INSTALLED, "The application(%ls) is not installed.", appId.GetPointer()); + + return __pAppManagerImpl->ClearUserPreferenceForAppControlResolution(appId); +} + }} // Tizen::App