Launch user services after all osp services are initialized 84/14084/1
authorHyunbin Lee <hyunbin.lee@samsung.com>
Wed, 4 Dec 2013 14:57:07 +0000 (23:57 +0900)
committerHyunbin Lee <hyunbin.lee@samsung.com>
Mon, 23 Dec 2013 06:46:12 +0000 (15:46 +0900)
Change-Id: I176904c35ca9a11655eac7eb7b5057a1450d31d6
Signed-off-by: Hyunbin Lee <hyunbin.lee@samsung.com>
src/AppService.cpp

index a23abc0..414d357 100644 (file)
@@ -646,9 +646,13 @@ AppService::OnApplicationLaunched(const AppId& appId, Tizen::App::_AppType type)
 
        static bool channelServiceLaunched = false;
        static bool securityServiceLaunched = false;
-
-       const String CHANNEL_SERVICE_APPID = L"cp7ipabg4k.osp-channel-service";
-       const String SECURITY_SERVICE_APPID = L"q7097a278m.osp-security-service";
+       static bool commonServiceLaunched = false;
+       static bool connectivityServiceLaunched = false;
+       static bool initialized = false;
+       const String CHANNEL_SERVICE_APPID(L"cp7ipabg4k.osp-channel-service");
+       const String SECURITY_SERVICE_APPID(L"q7097a278m.osp-security-service");
+       const String COMMON_SERVICE_APPID(L"sjjevolsjk.osp-common-service");
+       const String CONNECTIVITY_SERVICE_APPID(L"57r43275q7.osp-connectivity-service");
 
        if (appId == CHANNEL_SERVICE_APPID)
        {
@@ -658,35 +662,46 @@ AppService::OnApplicationLaunched(const AppId& appId, Tizen::App::_AppType type)
        {
                securityServiceLaunched = true;
        }
-
-
-       if (securityServiceLaunched && channelServiceLaunched)
+       else if (appId == COMMON_SERVICE_APPID)
        {
-               if (__pContextMgr)
-               {
-                       __pContextMgr->RemoveAppRegistrationEvent(*this);
-               }
+               commonServiceLaunched = true;
+       }
+       else if (appId == CONNECTIVITY_SERVICE_APPID)
+       {
+               connectivityServiceLaunched = true;
+       }
 
+       if (!initialized && securityServiceLaunched && channelServiceLaunched)
+       {
                InitializeServices();
 
-               if (!__pContextMgr)
-               {
-                       SysLogException(NID_APP, E_SYSTEM, "Failed to initialize app-service");
-                       return ;
-               }
-
                LaunchSystemServices();
 
                Tizen::App::Package::_PackageManagerImpl::GetInstance()->AddEventListener(this, 0);
 
                vconf_set_int(VCONFKEY_APPSERVICE_STATUS, 2);
 
-               LaunchUserServices();
-
                RegisterPreloadedAppCondition();
+
+               initialized = true;
                
                SysLog(NID_APP, "Exit. AppId(%ls)",appId.GetPointer());
        }
+
+       if (initialized && commonServiceLaunched && connectivityServiceLaunched)
+       {
+               if (__pContextMgr)
+               {
+                       __pContextMgr->RemoveAppRegistrationEvent(*this);
+               }
+               else
+               {
+                       SysLogException(NID_APP, E_SYSTEM, "[E_SYSTEM] __pContextMgr is null.");
+                       return ;
+               }
+
+               LaunchUserServices();
+       }
 }
 
 void