diff --git a/framework/src/org/apache/cordova/CordovaWebViewClient.java b/framework/src/org/apache/cordova/CordovaWebViewClient.java index 5f907636..55e0d904 100755 --- a/framework/src/org/apache/cordova/CordovaWebViewClient.java +++ b/framework/src/org/apache/cordova/CordovaWebViewClient.java @@ -101,7 +101,7 @@ public class CordovaWebViewClient extends WebViewClient { String action = url.substring(idx2 + 1, idx3); String callbackId = url.substring(idx3 + 1, idx4); String jsonArgs = url.substring(idx4 + 1); - appView.pluginManager.exec(service, action, callbackId, jsonArgs, true /* async */); + appView.pluginManager.exec(service, action, callbackId, jsonArgs); } /** diff --git a/framework/src/org/apache/cordova/ExposedJsApi.java b/framework/src/org/apache/cordova/ExposedJsApi.java index 710b2e0c..b386a402 100755 --- a/framework/src/org/apache/cordova/ExposedJsApi.java +++ b/framework/src/org/apache/cordova/ExposedJsApi.java @@ -40,7 +40,7 @@ import org.json.JSONException; public String exec(String service, String action, String callbackId, String arguments) throws JSONException { jsMessageQueue.setPaused(true); try { - boolean wasSync = pluginManager.exec(service, action, callbackId, arguments, true /* async */); + boolean wasSync = pluginManager.exec(service, action, callbackId, arguments); String ret = ""; if (!NativeToJsMessageQueue.DISABLE_EXEC_CHAINING || wasSync) { ret = jsMessageQueue.popAndEncode(); diff --git a/framework/src/org/apache/cordova/api/PluginManager.java b/framework/src/org/apache/cordova/api/PluginManager.java index 589b1037..e51739b0 100755 --- a/framework/src/org/apache/cordova/api/PluginManager.java +++ b/framework/src/org/apache/cordova/api/PluginManager.java @@ -209,20 +209,16 @@ public class PluginManager { * this is an async plugin call. * @param args An Array literal string containing any arguments needed in the * plugin execute method. - * @param async Boolean indicating whether the calling JavaScript code is expecting an - * immediate return value. If true, either Cordova.callbackSuccess(...) or - * Cordova.callbackError(...) is called once the plugin code has executed. * @return Whether the task completed synchronously. */ - public boolean exec(final String service, final String action, final String callbackId, final String jsonArgs, final boolean async) { + public boolean exec(final String service, final String action, final String callbackId, final String jsonArgs) { PluginResult cr = null; - boolean runAsync = async; + final IPlugin plugin = this.getPlugin(service); + boolean runAsync = !plugin.isSynch(action); try { final JSONArray args = new JSONArray(jsonArgs); - final IPlugin plugin = this.getPlugin(service); //final CordovaInterface ctx = this.ctx; if (plugin != null) { - runAsync = async && !plugin.isSynch(action); if (runAsync) { // Run this on a different thread so that this one can return back to JS ctx.getThreadPool().execute(new Runnable() { @@ -266,6 +262,11 @@ public class PluginManager { return true; } + @Deprecated + public boolean exec(String service, String action, String callbackId, String jsonArgs, boolean async) { + return exec(service, action, callbackId, jsonArgs); + } + /** * Get the plugin object that implements the service. * If the plugin object does not already exist, then create it.