public void setWindow(Object windowProxyObject) {
    if (KrollRuntime.getInstance().isRuntimeThread()) {
      doSetWindow(windowProxyObject);

    } else {
      TiMessenger.sendBlockingRuntimeMessage(
          handler.obtainMessage(MSG_SET_WINDOW), windowProxyObject);
    }
  }
  public Object call(KrollObject krollObject, Object[] args) {
    if (KrollRuntime.getInstance().isRuntimeThread()) {
      return callSync(krollObject, args);

    } else {
      return TiMessenger.sendBlockingRuntimeMessage(
          handler.obtainMessage(MSG_CALL_SYNC), new FunctionArgs(krollObject, args));
    }
  }
  public InputStream openInputStream(String path, boolean report) throws IOException {
    InputStream is = null;

    Context context = softContext.get();
    if (context != null) {
      if (isTitaniumResource(path)) {
        String[] parts = path.split(":");
        if (parts.length != 3) {
          Log.w(TAG, "Malformed titanium resource url, resource not loaded: " + path);
          return null;
        }
        @SuppressWarnings("unused")
        String titanium = parts[0];
        String section = parts[1];
        String resid = parts[2];

        if (TI_RESOURCE_PREFIX.equals(section)) {
          is =
              TiFileHelper.class.getResourceAsStream(
                  "/org/appcelerator/titanium/res/drawable/" + resid + ".png");
        } else if ("Sys".equals(section)) {
          Integer id = systemIcons.get(resid);
          if (id != null) {
            is = Resources.getSystem().openRawResource(id);
          } else {
            Log.w(TAG, "Drawable not found for system id: " + path);
          }
        } else {
          Log.e(TAG, "Unknown section identifier: " + section);
        }
      } else if (URLUtil.isNetworkUrl(path)) {
        if (TiApplication.isUIThread()) {
          is =
              (InputStream)
                  TiMessenger.sendBlockingRuntimeMessage(
                      getRuntimeHandler().obtainMessage(MSG_NETWORK_URL), path);
        } else {
          is = handleNetworkURL(path);
        }
      } else if (path.startsWith(RESOURCE_ROOT_ASSETS)) {
        path = path.substring(22); // length of "file:///android_asset/"
        boolean found = false;

        if (foundResourcePathCache.contains(path)) {
          found = true;
        } else if (!notFoundResourcePathCache.contains(path)) {
          String base = path.substring(0, path.lastIndexOf("/"));

          synchronized (resourcePathCache) {
            if (!resourcePathCache.contains(base)) {
              String[] paths = context.getAssets().list(base);
              for (int i = 0; i < paths.length; i++) {
                foundResourcePathCache.add(base + '/' + paths[i]);
              }
              resourcePathCache.add(base);
              if (foundResourcePathCache.contains(path)) {
                found = true;
              }
            }
            if (!found) {
              notFoundResourcePathCache.add(path);
            }
          }
        }
        if (found) {
          is = context.getAssets().open(path);
        } else throw new FileNotFoundException();
      } else if (path.startsWith(SD_CARD_PREFIX)) {
        File file = new File(path);
        if (file.exists()) {
          is = context.getAssets().open(path);
        } else throw new FileNotFoundException();
      } else if (URLUtil.isFileUrl(path)) {
        URL u = new URL(path);
        is = u.openStream();
      } else {
        path = joinPaths("Resources", path);
        is = context.getAssets().open(path);
      }
    }

    return is;
  }