diff --git a/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java b/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java index 5ff1abff..cbe727cd 100755 --- a/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java +++ b/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java @@ -175,9 +175,20 @@ public class SystemWebViewEngine implements CordovaWebViewEngine { String databasePath = webView.getContext().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath(); settings.setDatabaseEnabled(true); - //Determine whether we're in debug or release mode, and turn on Debugging! - ApplicationInfo appInfo = webView.getContext().getApplicationContext().getApplicationInfo(); - if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { + // The default is to use the module's debuggable state to decide if the webview inspecter + // should be enabled. However, users can configure InspectableWebview preference to forcefully enable + // or disable the webview inspecter. + String inspectableWebview = preferences.getString("InspectableWebview", null); + boolean shouldEnableInspector = false; + if (inspectableWebview == null) { + ApplicationInfo appInfo = webView.getContext().getApplicationContext().getApplicationInfo(); + shouldEnableInspector = (appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; + } + else if ("true".equals(inspectableWebview)) { + shouldEnableInspector = true; + } + + if (shouldEnableInspector) { enableRemoteDebugging(); }