Fix the boiler plate codes
[platform/framework/native/appfw.git] / src / app / FAppAppManager.cpp
index e9cd615..177e2d7 100644 (file)
@@ -1,5 +1,4 @@
 //
-// Open Service Platform
 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the License);
@@ -222,13 +221,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 +232,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 +251,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 +262,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 +273,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 +281,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 +298,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 +309,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