This is an automated email from the ASF dual-hosted git repository.
normanbreau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-android.git
The following commit(s) were added to refs/heads/master by this push:
new a78fad17 feat: InspectableWebview preference (#1589)
a78fad17 is described below
commit a78fad17835f37e55b232427348d02c0c81bf491
Author: Norman Breau <[email protected]>
AuthorDate: Sun Apr 9 20:41:00 2023 -0300
feat: InspectableWebview preference (#1589)
---
.../org/apache/cordova/engine/SystemWebViewEngine.java | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
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();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]