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)
{
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);
}
}
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);