export _AppControlImpl::FindAndStart()
[platform/framework/native/appfw.git] / src / app / FApp_AppManagerImpl.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 44000c8..8ef7d29
 #include "FApp_AppControlRegistry.h"
 #include "FApp_AppImpl.h"
 #include "FApp_AppInfo.h"
-#include "FApp_AppManagerEventArg.h"
 #include "FApp_AppManagerImpl.h"
 #include "FApp_AppManagerProxy.h"
 #include "FApp_AppMessageImpl.h"
 #include "FApp_AppControlImpl.h"
 #include "FApp_ConditionManagerProxy.h"
-#include "FApp_IAppManagerEventListener.h"
 #include "FApp_IAppEventListener.h"
 #include "FApp_MapDataControlImpl.h"
 #include "FApp_SqlDataControlImpl.h"
 #include "FAppPkg_PackageManagerImpl.h"
 #include "FAppPkg_PackageInfoImpl.h"
 #include "FApp_AppControlManager.h"
+#include "FApp_TemplateUtil.h"
 #include "FApp_Aul.h"
 #include "FApp_AppLifecycleEvent.h"
 #include "FApp_AppLifecycleEventArg.h"
@@ -134,9 +133,8 @@ _AppManagerImpl::~_AppManagerImpl(void)
 result
 _AppManagerImpl::Construct(void)
 {
-       __appManagerEvent.Construct();
        __appLifecycleEvent.Construct();
-       __appListForAppLifecycle.Construct(0, 0, __strHashCodeProvider, __comparer);
+       __appListForAppLifecycle.Construct();
        result r = __mutex.Create();
         SysTryLog(NID_APP, r == E_SUCCESS, "Creating mutex failed.");
 
@@ -198,14 +196,6 @@ _AppManagerImpl::FindAppControlN(const AppId& aId, const String& oId)
        AppControl* pAc = null;
 
        pAc = pRegs->GetTizenAppControlN(aId, oId);
-       if (pAc != null)
-       {
-               SetLastResult(E_SUCCESS);
-               return pAc;
-       }
-
-       pAc = pRegs->GetAppControlN(aId, oId);
-
        SysTryReturn(NID_APP, pAc != null, null, E_OBJ_NOT_FOUND, "[%s] No matching AppControl instance found (%ls, %ls).",
                                 GetErrorMessage(E_OBJ_NOT_FOUND), aId.GetPointer(), oId.GetPointer());
        SetLastResult(E_SUCCESS);
@@ -471,7 +461,7 @@ _AppManagerImpl::LaunchApplication(const String& appId, const IList* pArguments,
 //                                       "The length of appid exceeded the limit(%d).",
 //                                       WIDGET_APP_MAX_APPID_LENGTH);
 
-       std::unique_ptr<AppControl> pAc(_AppControlRegistry::GetInstance()->GetAppControlN(appId, TIZEN_OPERATION_MAIN));
+       std::unique_ptr<AppControl> pAc(FindAppControlN(appId, TIZEN_OPERATION_MAIN));
        SysTryReturnResult(NID_APP, pAc.get() != null, E_OBJ_NOT_FOUND, "The target application (%ls) is not found.", appId.GetPointer());
 
        if (pArguments)
@@ -661,16 +651,6 @@ _AppManagerImpl::SetEventListener(_AppEvent appEvent, Tizen::Base::Runtime::IEve
        return _AppImpl::GetInstance()->SetListener(appEvent, pListener);
 }
 
-result
-_AppManagerImpl::OnServiceEventReceived(int clientId, const _AppManagerEventArg& arg)
-{
-       SysLog(NID_APP, "app:%ls, appType:0x%x", arg.GetAppId().GetPointer(), arg.GetAppType());
-
-       _AppManagerEventArg* pArg = new (std::nothrow)_AppManagerEventArg(arg);
-       SysTryReturnResult(NID_APP, pArg != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
-       __appManagerEvent.FireAsync(*pArg);
-       return E_SUCCESS;
-}
 
 result
 _AppManagerImpl::OnTerminateApplicationRequested(int clientId)
@@ -680,46 +660,6 @@ _AppManagerImpl::OnTerminateApplicationRequested(int clientId)
        return E_SUCCESS;
 }
 
-result
-_AppManagerImpl::AddEventListener(_IAppManagerEventListener& listener)
-{
-       _IAppManager* pMgr = _AppManagerProxy::GetService();
-       SysTryReturnResult(NID_APP, pMgr != null, E_INVALID_STATE, "");
-
-       result r = __appManagerEvent.AddListener(listener);
-       SysTryReturn(NID_APP, IsFailed(r) == false, r, r, "[%s]", GetErrorMessage(r));
-
-       const int count = __appManagerEvent.GetListenerCount();
-       SysLog(NID_APP, "registered event listener(s) # %d", count);
-
-       if (count > 1)
-       {
-               return E_SUCCESS;
-       }
-
-       return pMgr->AddEventListener(-1);
-}
-
-result
-_AppManagerImpl::RemoveEventListener(_IAppManagerEventListener& listener)
-{
-       _IAppManager* pMgr = _AppManagerProxy::GetService();
-       SysTryReturnResult(NID_APP, pMgr != null, E_INVALID_STATE, "");
-
-       result r = __appManagerEvent.RemoveListener(listener);
-       SysTryReturn(NID_APP, IsFailed(r) == false, r, r, "[%s]", GetErrorMessage(r));
-
-       const int count = __appManagerEvent.GetListenerCount();
-       SysLog(NID_APP, "registered event listener(s) # %d", count);
-
-       if (count == 0)
-       {
-               return pMgr->RemoveEventListener(-1);
-       }
-
-       return E_SUCCESS;
-}
-
 
 ///////////////////////////////////////////////////////////////////////////////
 // LifecycleManager begins.
@@ -1002,7 +942,7 @@ _AppManagerImpl::UnregisterAppForAppLifecycleEvent(const AppId& appId)
                else
                {
                        r = __appListForAppLifecycle.SetValue(appId, currentRefCnt);
-               }               
+               }
        }
        else
        {