_InProcessInfo* pInfo = __inAppManager.FindItem(reqId);
SysTryReturnVoidResult(NID_APP, pInfo != null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] request Id %d not found.", reqId);
+ // at least listener
IAppControlResponseListener* pListener = dynamic_cast<IAppControlResponseListener*>(pInfo->pListener);
- if (pListener == null)
- {
- SysLog(NID_APP, "Empty AppControl listener callback for req %d, app %ls.", reqId, appId.GetPointer());
- return;
- }
+ SysTryReturnVoidResult(NID_APP, pListener != null, E_SYSTEM, "[E_SYSTEM] Invalid result callback for req %d, app %ls.", reqId, appId.GetPointer());
result r = E_SUCCESS;
- AppId actualAppId = appId;
- if (appId == L'c')
+ if (pListener)
{
- actualAppId.Clear();
- r = E_OPERATION_CANCELED;
- }
- SysLog(NID_APP, "Invoking callback 0x%x.", pListener);
+ AppId actualAppId = appId;
+ if (appId == L'c')
+ {
+ actualAppId.Clear();
+ r = E_OPERATION_CANCELED;
+ }
+ SysLog(NID_APP, "Invoking callback 0x%x.", pListener);
- _AppControlResponseEvent* pResponseEvent = null;
- __appControlResponseEventContainer.GetValue(reqId, pResponseEvent);
- SysLog(NID_APP, "StartResponseReceived Request Id(%d), ResponseEvent 0x%x.", reqId, pResponseEvent);
- if (pResponseEvent != null)
- {
- String oId(operationId);
- _AppControlResponseEventArg* pResponseEventArg = new (std::nothrow) _AppControlResponseEventArg(pListener, _APPCONTROL_RESPONSETYPE_START, actualAppId, oId, r, APP_CTRL_RESULT_SUCCEEDED, null, reqId, false);
+ _AppControlResponseEvent* pResponseEvent = null;
+ __appControlResponseEventContainer.GetValue(reqId, pResponseEvent);
+ SysLog(NID_APP, "StartResponseReceived Request Id(%d), ResponseEvent 0x%x.", reqId, pResponseEvent);
+ if (pResponseEvent != null)
+ {
+ String oId(operationId);
+ _AppControlResponseEventArg* pResponseEventArg = new (std::nothrow) _AppControlResponseEventArg(pListener, _APPCONTROL_RESPONSETYPE_START, actualAppId, oId, r, APP_CTRL_RESULT_SUCCEEDED, null, reqId, false);
- if (pResponseEventArg != null)
+ if (pResponseEventArg != null)
+ {
+ pResponseEvent->Fire(*pResponseEventArg);
+ SysLog(NID_APP, "pResponseEvent is Fired");
+ }
+ }
+ else
{
- pResponseEvent->Fire(*pResponseEventArg);
- SysLog(NID_APP, "pResponseEvent is Fired");
+ pListener->OnAppControlStartResponseReceived(actualAppId, operationId, r);
+ SysLog(NID_APP, "OnAppControlStartResponseReceived called directly");
}
}
else
{
- pListener->OnAppControlStartResponseReceived(actualAppId, operationId, r);
- SysLog(NID_APP, "OnAppControlStartResponseReceived called directly");
+ SysLog(NID_APP, "No listener registered.");
}
if (r == E_OPERATION_CANCELED)
}
else
{
- SysLog(NID_APP, "Empty AppControl listener.");
+ SysLogException(NID_APP, E_SYSTEM, "Invalid AppControl listener.");
}
_InProcessInfo* pProcInfo = __inAppManager.FindItemWithListener(IsMatchingProcListener, pListener);
if (pProcInfo)
{
- pProcInfo->pListener = null;
+ __inAppManager.RemoveItem(pProcInfo);
SysLog(NID_APP, "Listener 0x%x is removed from in-process stub list.", pListener);
}
}
result
-_AppControlManager::LaunchPkg(const char* pkg_name, const char* op, const char* mime, const char* uri, AppSvcResFn pCb, void* data)
-{
- _AppMessageImpl msg;
-
- return LaunchPkg(msg, pkg_name, op, mime, uri, pCb, data);
-}
-
-result
-_AppControlManager::LaunchAppWithCondition(const AppId& appId, const String& condition, IList* pArrayArgs)
-{
- result r = E_SUCCESS;
- _AppArg * pArg = new (std::nothrow) _AppArg();
- SysTryCatch(NID_APP, pArg != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
-
- r = pArg->ConstructForAppLaunchCondition(condition, pArrayArgs);
- SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] ConstructForAppLaunchCondition(%ls, .. ) fails", GetErrorMessage(r), condition.GetPointer());
-
- r = _AppControlManager::LaunchApp(appId, pArg);
-CATCH:
- delete pArg;
- return r;
-}
-
-result
_AppControlManager::LaunchApp(const AppId& appId, _AppArg* pArg, int req)
{
SysTryReturnResult(NID_APP, pArg != null, E_INVALID_ARG, "Invalid launch argument");
SysLog(NID_APP, "App: %ls.", appId.GetPointer());
String actualAppId = appId;
+#if 0
+ // This logic is only for very old legacy code to support "pkgid" launch and should be removed
if (appId.GetLength() == 10)
{
const String& name = _PackageManagerImpl::GetInstance()->GetDefaultAppExecutableName(appId);
actualAppId.Append(name);
}
}
+#endif
pArg->UpdateRequestId(req);