From 75c65b49c855fbe26f47f068fa9dfc9032c740f9 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 9 May 2019 15:15:52 +0200 Subject: [PATCH] enable webview debug on debug builds; disabled on productive builds Signed-off-by: tobiasKaminsky --- .../android/ui/activity/ExternalSiteWebView.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/com/owncloud/android/ui/activity/ExternalSiteWebView.java b/src/main/java/com/owncloud/android/ui/activity/ExternalSiteWebView.java index ee6e9228a5..9d75c42c97 100644 --- a/src/main/java/com/owncloud/android/ui/activity/ExternalSiteWebView.java +++ b/src/main/java/com/owncloud/android/ui/activity/ExternalSiteWebView.java @@ -23,6 +23,8 @@ package com.owncloud.android.ui.activity; import android.annotation.SuppressLint; import android.content.Intent; +import android.content.pm.ApplicationInfo; +import android.os.Build; import android.os.Bundle; import android.view.MenuItem; import android.view.Window; @@ -91,6 +93,15 @@ public class ExternalSiteWebView extends FileActivity { webview.setFocusableInTouchMode(true); webview.setClickable(true); + + // allow debugging (when building the debug version); see details in + // https://developers.google.com/web/tools/chrome-devtools/remote-debugging/webviews + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && + (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { + Log_OC.d(this, "Enable debug for webView"); + WebView.setWebContentsDebuggingEnabled(true); + } + // setup toolbar if (showToolbar) { setupToolbar();