using namespace Tizen::Base::Utility;
using namespace Tizen::Io;
-//extern const char* _DATACONTROL_RESULTSET_DIR;
-
namespace Tizen { namespace App
{
void
_AppControlManager::OnAppControlEventReceivedN(int reqId, const AppId& appId, const String& operationId)
{
- SysLog(NID_APP, "Received request Id %d, appId %ls, operationId %ls", reqId, appId.GetPointer(), operationId.GetPointer());
+ SysLog(NID_APP, "Received request Id %d, app %ls, operationId %ls", reqId, appId.GetPointer(), operationId.GetPointer());
// get launch info from request Id
_LaunchInfo* pInfo = __launchManager.FindItem(reqId);
void
_AppControlManager::OnAppControlEventReceivedN(int reqId, int res, const IMap* pArgs)
{
- SysLog(NID_APP, "Received request Id %d, args 0x%x", reqId, pArgs);
+ SysLog(NID_APP, "Received request Id %d, res %d, args 0x%x", reqId, res, pArgs);
// process proper callback
_InProcessInfo* pInfo = __inAppManager.FindItem(reqId);
if (pResponseEvent != null)
{
- _AppControlResponseEventArg* pResponseEventArg = new (std::nothrow) _AppControlResponseEventArg(pListener, _APPCONTROL_RESPONSETYPE_COMPLETE, aId, oId, E_SUCCESS, static_cast<AppCtrlResult>(res), 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);
if (pResponseEventArg != null)
{
pResponseEvent->Fire(*pResponseEventArg);
}
else
{
- pListener->OnAppControlCompleteResponseReceived(aId, oId, static_cast<AppCtrlResult>(res), pArgs);
+ pListener->OnAppControlCompleteResponseReceived(aId, oId, ConvertAppControlResultCode(res), pArgs);
SysLog(NID_APP, "OnAppControlCompleteResponseReceived called directly");
+ IMap* pMap = const_cast<IMap*> (pArgs);
+ delete pMap;
}
}
else
}
-result
-_AppControlManager::LaunchPkg(_AppMessageImpl& msg, const String& package, const String& opId, const String* pUri, const String* pMime, AppSvcResFn pCb, void* data)
+int
+_AppControlManager::LaunchPkg(_AppMessageImpl& msg, const AppId& appId, const String& opId, const String* pUri, const String* pMime, AppSvcResFn pCb, void* data)
{
- std::unique_ptr<char[]> pPackage(_StringConverter::CopyToCharArrayN(package));
+ std::unique_ptr<char[]> pPackage(_StringConverter::CopyToCharArrayN(appId));
std::unique_ptr<char[]> pOperation(_StringConverter::CopyToCharArrayN(opId));
const char* pUriData = null;
pMimeData = _StringConverter::CopyToCharArrayN(*pMime);
}
- result r = LaunchPkg(msg, pPackage.get(), pOperation.get(), pMimeData, pUriData, pCb, data);
+ int pid = Launch(msg, pPackage.get(), pOperation.get(), pMimeData, pUriData, pCb, data);
delete [] pUriData;
delete [] pMimeData;
- return r;
+ return pid;
}
_AppControlManager::LaunchApp(const AppId& appId, _AppArg* pArg, int req)
{
SysTryReturnResult(NID_APP, pArg != null, E_INVALID_ARG, "Invalid launch argument");
- SysLog(NID_APP, "AppId: %ls.", appId.GetPointer());
+ SysLog(NID_APP, "App: %ls.", appId.GetPointer());
String actualAppId = appId;
if (appId.GetLength() == 10)
return false;
}
+
+int
+_AppControlManager::Launch(const _AppMessageImpl& msg, const AppId& aId, const String& oId, const String* pUriData, const String* pMimeType, AppSvcResFn pCb, void* pData)
+{
+ SysLog(NID_APP, "Enter");
+
+ _AppArg arg;
+ arg.Construct(msg, oId, pUriData, pMimeType);
+
+ int pid = Launch(aId, &arg, pCb, pData, -1);
+ SysTryReturn(NID_APP, pid >= 0, -1, GetLastResult(), "Launching(%ls) is failed", aId.GetPointer());
+
+ SysLog(NID_APP, "Exit");
+
+ return pid;
+}
+
+
int
_AppControlManager::Launch(const AppId& appId, _AppArg* pArg, int req)
{
+ return Launch(appId, pArg, reinterpret_cast<AppSvcResFn>(LaunchResultCb), this, req);
+}
+
+
+int
+_AppControlManager::Launch(const AppId& appId, _AppArg* pArg, AppSvcResFn pCb, void* pData, int req)
+{
SysTryReturn(NID_APP, pArg != null, -1, E_INVALID_ARG, "[E_INVALID_ARG] Invalid launch argument");
- SysLog(NID_APP, "AppId: %ls.", appId.GetPointer());
+ SysLog(NID_APP, "App: %ls.", appId.GetPointer());
String actualAppId = appId;
if (appId.GetLength() == 10)
pArg->UpdateAppId(tempId);
kb = pArg->GetBundle();
- pid = appsvc_run_service(kb, req, LaunchResultCb, this);
+ pid = appsvc_run_service(kb, req, reinterpret_cast<appsvc_res_fn>(pCb), pData);
if (pid > 0)
{
SysLog(NID_APP, "Submode launch successful");
do
{
kb = pArg->GetBundle();
- pid = appsvc_run_service(kb, req, LaunchResultCb, this);
+ pid = appsvc_run_service(kb, req, reinterpret_cast<appsvc_res_fn>(pCb), pData);
if (pid > 0)
{
SysLog(NID_APP, "Application(%d) launched with reqId(%d) and arg(0x%x).", pid, req, pArg);
_AppMessageImpl::AddData(kb, SELECTOR_NOTI_KEY, _AppInfo::GetApplicationId());
}
+ if (_AppImpl::GetInstance() != null)
+ {
+ const long handle = _AppImpl::GetInstance()->GetWindowHandle();
+ _AppArg::UpdateWindowHandle(kb, handle);
+ }
+
int pid = appsvc_run_service(kb, req, LaunchResultCb, this);
if (pid > 0)
{
}
void
-_AppControlManager::FinishAppControl(int reqId, int res, const IMap* pMap)
+_AppControlManager::FinishAppControl(int reqId, int res, IMap* pMap)
{
- SysLog(NID_APP, "Enter.");
+ SysLog(NID_APP, "req %d, res %d.", reqId, res);
_NativeAppControlEventArg* pArg = new (std::nothrow) _NativeAppControlEventArg(reqId, res, pMap);
SysTryReturnVoidResult(NID_APP, pArg != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Return argument allocation failure.");
bundle* b = _AppArg::GetBundleFromSvc(service);
_AppArg* pArg = new (std::nothrow) _AppArg();
- SysTryReturnResult(NID_APP, pArg != null, E_OUT_OF_MEMORY, "rrayList creation failure.");
+ SysTryReturnResult(NID_APP, pArg != null, E_OUT_OF_MEMORY, "ArrayList creation failure.");
pArg->Construct(b);
result r = E_SUCCESS;
bool
-_AppControlManager::IsAllowedAppControl(const wchar_t aTable[][2][64], int count, const String& aId, const String& oId)
+_AppControlManager::IsAllowedAppControl(const char aTable[][2][96], int count, const String& aId, const String& oId)
{
for (int i = 0; i < count; i++)
{
if (aId == aTable[i][0] && oId == aTable[i][1])
{
- SysLog(NID_APP, "Found entry (%ls, %ls)", aTable[i][0], aTable[i][1]);
+ SysLog(NID_APP, "Found entry (%s, %s)", aTable[i][0], aTable[i][1]);
return true;
}
}
return false;
}
+
+AppCtrlResult
+_AppControlManager::ConvertAppControlResultCode(int resCode)
+{
+ AppCtrlResult ret = APP_CTRL_RESULT_FAILED;
+
+ switch(resCode)
+ {
+ case SERVICE_RESULT_SUCCEEDED:
+ ret = APP_CTRL_RESULT_SUCCEEDED;
+ break;
+ case SERVICE_RESULT_FAILED:
+ ret = APP_CTRL_RESULT_CANCELED;
+ break;
+ case SERVICE_RESULT_CANCELED:
+ ret = APP_CTRL_RESULT_ABORTED;
+ break;
+ case APPSVC_OSP_RES_FAIL:
+ ret = APP_CTRL_RESULT_FAILED;
+ break;
+ case APPSVC_OSP_RES_TERMINATE:
+ ret = APP_CTRL_RESULT_TERMINATED;
+ break;
+ default:
+ ret = APP_CTRL_RESULT_FAILED;
+ break;
+ }
+
+ return ret;
+}
+
+
void
_AppControlManager::OnAppControlResponseEventReceivedN(const Tizen::Base::Runtime::IEventArg* arg)
{