Skip to content
Browse files

Add @JavascriptInterface annotations to ExposedJsApi.

And re-enable the JS bridge on 4.2.
https://issues.apache.org/jira/browse/CB-1879
  • Loading branch information...
1 parent 2ee4326 commit 11e0ffa90abe3c818887706cc22286cbb4b54742 @agrieve agrieve committed with macdonst
View
4 framework/src/org/apache/cordova/CordovaWebView.java
@@ -302,10 +302,6 @@ private void exposeJsInterface() {
Log.i(TAG, "Disabled addJavascriptInterface() bridge callback due to a bug on the 2.3 emulator");
return;
}
- else if (SDK_INT == Build.VERSION_CODES.JELLY_BEAN_MR1) {
- Log.i(TAG, "Disabled addJavascriptInterface() bridge callback for 4.2. Symbols are broken, and we can't compile the annotation needed to expose the exec.");
- return;
- }
this.addJavascriptInterface(exposedJsApi, "_cordovaNative");
}
View
4 framework/src/org/apache/cordova/ExposedJsApi.java
@@ -18,6 +18,7 @@ Licensed to the Apache Software Foundation (ASF) under one
*/
package org.apache.cordova;
+import android.webkit.JavascriptInterface;
import org.apache.cordova.api.PluginManager;
import org.apache.cordova.api.PluginResult;
import org.json.JSONException;
@@ -37,6 +38,7 @@ public ExposedJsApi(PluginManager pluginManager, NativeToJsMessageQueue jsMessag
this.jsMessageQueue = jsMessageQueue;
}
+ @JavascriptInterface
public String exec(String service, String action, String callbackId, String arguments) throws JSONException {
jsMessageQueue.setPaused(true);
try {
@@ -51,10 +53,12 @@ public String exec(String service, String action, String callbackId, String argu
}
}
+ @JavascriptInterface
public void setNativeToJsBridgeMode(int value) {
jsMessageQueue.setBridgeMode(value);
}
+ @JavascriptInterface
public String retrieveJsMessages() {
return jsMessageQueue.popAndEncode();
}

0 comments on commit 11e0ffa

Please sign in to comment.
Something went wrong with that request. Please try again.