Remove unused async arg from PluginManager.exec().

This commit is contained in:
Andrew Grieve 2012-09-24 23:32:31 -04:00
parent afcdccf783
commit c7ce9598a8
3 changed files with 10 additions and 9 deletions

View File

@ -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);
}
/**

View File

@ -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();

View File

@ -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.