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);
+ _AppControlResponseEventArg* pResponseEventArg = new (std::nothrow) _AppControlResponseEventArg(pListener, _APPCONTROL_RESPONSETYPE_START, actualAppId, oId, r, APP_CTRL_RESULT_SUCCEEDED, null, reqId, false);
if (pResponseEventArg != null)
{
}
+void
+_AppControlManager::InvokeAppControlCompleteListener(IAppControlResponseListener& listener, const AppId& appId, const String& op, AppCtrlResult res, const IMap* pExtraData, bool isSubMode)
+{
+ listener.OnAppControlCompleteResponseReceived(appId, op, res, pExtraData);
+
+ if (!isSubMode)
+ {
+ _AppImpl::GetInstance()->SendUserEvent(_APP_EVENT_RAISE, null, false);
+ }
+
+ SysLog(NID_APP, "AppControl response finished.");
+}
+
+
+void
+_AppControlManager::InvokeLegacyAppControlCompleteListener(IAppControlEventListener& listener, const AppId& appId, const String& op, const IList* pList, bool isSubMode)
+{
+ listener.OnAppControlCompleted(appId, op, pList);
+
+ if (!isSubMode)
+ {
+ _AppImpl::GetInstance()->SendUserEvent(_APP_EVENT_RAISE, null, false);
+ }
+
+ SysLog(NID_APP, "Legacy AppControl response finished.");
+}
+
+
// callback for in-process event handling
void
-_AppControlManager::OnAppControlEventReceivedN(int reqId, int res, const IMap* pArgs)
+_AppControlManager::OnAppControlEventReceivedN(int reqId, int res, const IMap* pArgs, int property)
{
SysLog(NID_APP, "Received request Id %d, res %d, args 0x%x", reqId, res, pArgs);
aId = pEntry->provider;
oId = pEntry->operation;
- SysLog(NID_APP, "Legacy AppControl name (%ls, %ls).", aId.GetPointer(), oId.GetPointer());
+ SysLog(NID_APP, "Legacy AppControl (%ls, %ls).", aId.GetPointer(), oId.GetPointer());
}
}
+ const bool isSubMode = (property & _APPCONTROL_PROPERTY_SUBMODE);
+
if (pInfo->isLegacy)
{
IAppControlEventListener* pListener = dynamic_cast<IAppControlEventListener*>(pInfo->pListener);
ArrayList list(SingleObjectDeleter);
_AppArg::FillLegacyAppControlResult(list, res, pArgs, aId);
- pListener->OnAppControlCompleted(aId, oId, &list);
+ InvokeLegacyAppControlCompleteListener(*pListener, aId, oId, &list, isSubMode);
}
else
{
if (pResponseEvent != null)
{
- _AppControlResponseEventArg* pResponseEventArg = new (std::nothrow) _AppControlResponseEventArg(pListener, _APPCONTROL_RESPONSETYPE_COMPLETE, aId, oId, E_SUCCESS, static_cast<AppCtrlResult>(res), const_cast<IMap*> (pArgs), responseEventRequestId);
+ _AppControlResponseEventArg* pResponseEventArg = new (std::nothrow) _AppControlResponseEventArg(pListener, _APPCONTROL_RESPONSETYPE_COMPLETE, aId, oId, E_SUCCESS, static_cast<AppCtrlResult>(res), const_cast<IMap*> (pArgs), responseEventRequestId, isSubMode);
if (pResponseEventArg != null)
{
pResponseEvent->Fire(*pResponseEventArg);
}
else
{
- pListener->OnAppControlCompleteResponseReceived(aId, oId, ConvertAppControlResultCode(res), pArgs);
- SysLog(NID_APP, "OnAppControlCompleteResponseReceived called directly");
- IMap* pMap = const_cast<IMap*> (pArgs);
- delete pMap;
+ InvokeAppControlCompleteListener(*pListener, aId, oId, ConvertAppControlResultCode(res), pArgs, isSubMode);
+ SysLog(NID_APP, "Listener called directly");
+ delete pArgs;
}
}
else
case APPSVC_RET_EILLACC:
r = E_ILLEGAL_ACCESS;
break;
+ case APPSVC_RET_EINVAL:
+ r = E_MAX_EXCEEDED;
+ break;
default:
r = E_SYSTEM;
break;
}
- SysLog(NID_APP, "[%s]Launching service %s failure", GetErrorMessage(r), pkg_name);
+ SysLog(NID_APP, "[%s] Launching service %s failure", GetErrorMessage(r), pkg_name);
}
return r;
case APPSVC_RET_EILLACC:
r = E_ILLEGAL_ACCESS;
break;
+ case APPSVC_RET_EINVAL:
+ r = E_MAX_EXCEEDED;
+ break;
default:
r = E_SYSTEM;
break;
SysLog(NID_APP, "Submode launch successful");
return E_SUCCESS;
}
+ else if (pid == APPSVC_RET_EINVAL)
+ {
+ SysLog(NID_APP, "Argument overflow");
+ return E_MAX_EXCEEDED;
+ }
pArg->UpdateAppId(actualAppId);
SysLog(NID_APP, "Application(%d) launched with reqId(%d) and arg(0x%x).", pid, req, pArg);
return E_SUCCESS;
}
+ else if (pid == APPSVC_RET_EINVAL)
+ {
+ SysLog(NID_APP, "Argument overflow");
+ return E_MAX_EXCEEDED;
+ }
+
count++;
SysLog(NID_APP, "Waiting %dth time.", count);
Thread::Sleep(TRY_SLEEP_TIME);
if (pid >= 0)
{
SysLog(NID_APP, "Submode launch successful");
+ SetLastResult(E_SUCCESS);
+ return pid;
+ }
+ else if (pid == APPSVC_RET_EINVAL)
+ {
+ SetLastResult(E_MAX_EXCEEDED);
return pid;
}
}
if (pid >= 0)
{
SysLog(NID_APP, "Application(%d) launched with reqId(%d) and arg(0x%x).", pid, req, pArg);
+ SetLastResult(E_SUCCESS);
return pid;
}
+ else if (pid == APPSVC_RET_EINVAL)
+ {
+ SetLastResult(E_MAX_EXCEEDED);
+ return pid;
+ }
+
count++;
SysLog(NID_APP, "Waiting %dth time with %d.", count, pid);
Thread::Sleep(TRY_SLEEP_TIME);
_AppControlManager::FinishAppControl(int reqId, int res, IMap* pMap)
{
SysLog(NID_APP, "req %d, res %d.", reqId, res);
- _NativeAppControlEventArg* pArg = new (std::nothrow) _NativeAppControlEventArg(reqId, res, pMap);
+ _NativeAppControlEventArg* pArg = new (std::nothrow) _NativeAppControlEventArg(reqId, res, pMap, _APPCONTROL_PROPERTY_SUBMODE);
SysTryReturnVoidResult(NID_APP, pArg != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Return argument allocation failure.");
SendAppControlEvent(*pArg);
}
else
{
- pResponseListener->OnAppControlCompleteResponseReceived(pEventArg->GetAppId(), pEventArg->GetOperationId(), pEventArg->GetAppControlResult(), pEventArg->GetExtraData());
- SysLog(NID_APP, "OnAppControlCompleteResponseReceived called");
+ InvokeAppControlCompleteListener(*pResponseListener, pEventArg->GetAppId(), pEventArg->GetOperationId(), pEventArg->GetAppControlResult(), pEventArg->GetExtraData(), pEventArg->IsSubMode());
+ SysLog(NID_APP, "Listener called");
_AppControlResponseEvent* pResponseEvent = null;
_AppControlManager::GetInstance()->GetAppControlResponseEventContainer()->GetValue(pEventArg->GetRequestId(), pResponseEvent);