From 592f4ebad353635bbc62384b9d3c0cfaba3e6441 Mon Sep 17 00:00:00 2001 From: Young Ik Cho Date: Mon, 8 Apr 2013 22:52:46 +0900 Subject: [PATCH] fix P130408-1578 : fix multiple process for submode service launch Change-Id: I31f8567942c7e52e214d9c3105f2f8c7d35e29bb Signed-off-by: Young Ik Cho --- src/app/FApp_AppControlManager.cpp | 54 +++++++++++++++++++++++++++++--------- src/app/FApp_AppResourceImpl.h | 0 2 files changed, 41 insertions(+), 13 deletions(-) mode change 100755 => 100644 src/app/FApp_AppResourceImpl.h diff --git a/src/app/FApp_AppControlManager.cpp b/src/app/FApp_AppControlManager.cpp index 3d48a30..09b5d33 100644 --- a/src/app/FApp_AppControlManager.cpp +++ b/src/app/FApp_AppControlManager.cpp @@ -542,6 +542,29 @@ _AppControlManager::LaunchApp(const AppId& appId, _AppArg* pArg, int req) return r; } +static bool +_IsDefaultApplication(const AppId& packageId, const String& appId) +{ + const String& execName = _PackageManagerImpl::GetInstance()->GetDefaultAppExecutableName(packageId); + + int index = -1; + result r = appId.IndexOf(L'.', 0, index); + if (r != E_SUCCESS) + { + return false; + } + + String tmp; + appId.SubString(index + 1, tmp); + if (tmp == execName) + { + SysLog(NID_APP, "Default application %ls", tmp.GetPointer()); + return true; + } + + return false; +} + int _AppControlManager::Launch(const AppId& appId, _AppArg* pArg, int req) { @@ -551,12 +574,12 @@ _AppControlManager::Launch(const AppId& appId, _AppArg* pArg, int req) String actualAppId = appId; if (appId.GetLength() == 10) { - const String& name = _PackageManagerImpl::GetInstance()->GetDefaultAppExecutableName(appId); + const String& execName = _PackageManagerImpl::GetInstance()->GetDefaultAppExecutableName(appId); - if (!name.IsEmpty()) + if (!execName.IsEmpty()) { actualAppId.Append(L'.'); - actualAppId.Append(name); + actualAppId.Append(execName); } } @@ -571,19 +594,24 @@ _AppControlManager::Launch(const AppId& appId, _AppArg* pArg, int req) int pid = -1; bundle* kb = NULL; String tempId; + actualAppId.SubString(0, 10, tempId); - tempId += L'.'; - tempId += L"_AppControl"; - // [INFO] Ugly solution for submode support - pArg->UpdateAppId(tempId); - kb = pArg->GetBundle(); - - pid = appsvc_run_service(kb, req, LaunchResultCb, this); - if (pid > 0) + if (_IsDefaultApplication(tempId, appId)) { - SysLog(NID_APP, "Submode launch successful"); - return pid; + tempId += L'.'; + tempId += L"_AppControl"; + + // [INFO] Ugly solution for submode support + pArg->UpdateAppId(tempId); + kb = pArg->GetBundle(); + + pid = appsvc_run_service(kb, req, LaunchResultCb, this); + if (pid > 0) + { + SysLog(NID_APP, "Submode launch successful"); + return pid; + } } pArg->UpdateAppId(actualAppId); diff --git a/src/app/FApp_AppResourceImpl.h b/src/app/FApp_AppResourceImpl.h old mode 100755 new mode 100644 -- 2.7.4