ECode CLauncherHelper::LaunchApp2(
    /* [in] */ const String& capsule,
    /* [in] */ const String& action)
{
    AutoPtr<IIntent> intent;
    ECode ec = CIntent::New((IIntent**)&intent);
    if (FAILED(ec)) return ec;
    intent->SetPackage(capsule);
    intent->SetAction(action);

    return LaunchApp(intent);
}
Exemple #2
0
void TryLaunchApp()
{
	if( LaunchApp() )
	{
		g_ShouldExit = true;
	}
	else
	{
		AddStatus( SimpleString::PrintF( "Failed to launch %s", g_CommandLine->m_App.CStr() ), g_StatusWarningColor );
		++g_NumWarnings;
	}
}
ECode CLauncherHelper::StartVideoViewDemo(
    /* [in] */ const String& path)
{
    AutoPtr<IIntent> intent;
    ECode ec = CIntent::New((IIntent**)&intent);
    if (FAILED(ec)) return ec;
    intent->SetPackage(String("VideoViewDemo"));
    intent->SetAction(String("android.intent.action.MAIN"));
    intent->PutStringExtra(String(IIntent::EXTRA_STREAM), path);

    return LaunchApp(intent);
}
Exemple #4
0
static void i51ManagedLaunchi51App(u32 param)
{
    CmnAppLaunchRspCbInfo_t tRspCb = {0};
    u32 *pSxmParam = MALLOC(sizeof(u32));
    MAE_WChar Url[128];
    int nLen = 128;
	u16 nClsId = CLSID_I51BASE;

    if (NULL != pSxmParam)
    {
        *pSxmParam = param;
        SWPRINTF(Url, nLen, L"Launch?APM_Mode=%d&ClsId=%d&VenData=%d&VenDataLen=%d&TransInId=%d&TransOutId=%d", APM_LAUNCH_NORMAL, nClsId, (u32)pSxmParam, sizeof(u32), 0, 0);
        tRspCb.pvUserData = (void *)pSxmParam;
        tRspCb.pfnLaunchListenerCb = i51ManagedAppLaunchVendorAppRspCB;
        if (MAE_RET_SUCCESS != LaunchApp(MAE_CLSID_2_SCHEMEID(nClsId), Url, &tRspCb))
        {
            FREEIF(pSxmParam);
        }
    }
}
Exemple #5
0
static void
DoUpdate(NS_tchar *path)
{
  NS_tchar spath[MAXPATHLEN];
  NS_tchar dpath[MAXPATHLEN];
  NS_tchar upstatus[MAXPATHLEN];
  NS_tchar upparams[MAXPATHLEN];
  NS_tchar sysdir[MAXPATHLEN];
  NS_tchar msiexec[MAXPATHLEN];
  NS_tsnprintf(spath, MAXPATHLEN, NS_T("%s/update.mar"), path);
  NS_tsnprintf(dpath, MAXPATHLEN, NS_T("%s/update.msi"), path);
  NS_tsnprintf(upstatus, MAXPATHLEN, NS_T("%s/update.status"), path);
  NS_tsnprintf(upparams, MAXPATHLEN, NS_T("%s/../../update.params"), path);
  GetSystemDirectory(sysdir, MAXPATHLEN);
  NS_tsnprintf(msiexec, MAXPATHLEN, NS_T("%s\\msiexec.exe"), sysdir);

  int rv = NS_taccess(spath, F_OK | R_OK | W_OK);
  if (rv != OK) {
  	LOG(("failed: can't access update.mar (rv=%d)\n", rv));
	NS_tremove(spath);
	NS_tremove(upstatus);
	return;
  }

  NS_tremove(dpath);
  rv = NS_trename(spath, dpath);
  if (rv != OK) {
  	LOG(("failed: can't rename update.mar (rv=%d)\n", rv));
	NS_tremove(spath);
	NS_tremove(upstatus);
	return;
  }
 
  WCharReplace(dpath, L'/', L'\\');
  int largc = 3;
  NS_tchar* largv[16]; //16 being max
  largv[0] = msiexec; //first arg is the path to msiexec.exe
  largv[1] = NS_T("/i"); //second arg is the install-flag
  largv[2] = dpath; //third arg is the path to update.msi
  NS_tchar argbuf[MAXPATHLEN];
  int start = 0;
  int end = 0;

  rv = NS_taccess(upparams, F_OK | R_OK);
  char buf[MAXPATHLEN];
  if (rv == OK) {
      int fd = NS_topen(upparams, O_RDONLY | O_BINARY);
      if (fd >= 0) {
          int num = read(fd, buf, MAXPATHLEN - 1);
	  if (num > 0) {
	      buf[num] = '\0';
	      for (int i = 0; i <= num; ++i) {
                  if (buf[i] != ' ' && buf[i] != '\n' && buf[i] != '\r' && buf[i] != '\0')
                      argbuf[end++] = buf[i];
	          else if (end > start) { //we had an arg
		      largv[largc++] = argbuf + start;
		      argbuf[end++] = '\0';
		      start = end;
	          }
	      }	
	  } else
              LOG(("warn: can't read update.params\n"));
      } else
  	  LOG(("warn: can't open update.params\n"));
  } else
      LOG(("warn: can't access update.params (rv=%d)\n", rv));

  //for (int i = 0; i < largc; ++i)
  //    NS_tfprintf(stderr, NS_T("arg[%d]=%s\n"), i, largv[i]);

  LOG(("info: running %ls %ls %ls\n", largv[0], largv[1], largv[2]));
  LaunchApp(path, largc, largv);

  LOG(("succeeded\n"));
  //WriteStatusFile(path, rv);
  NS_tremove(upstatus);
}