Merge pull request #11215 from keymanapp/chore/common/enable-webview-debugging

chore(android): enables debugging and inspection of mobile app internal webviews
This commit is contained in:
Joshua Horton 2024-04-17 15:49:33 +07:00 • committed by GitHub
commit eaff3a3eb0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -232,7 +232,13 @@ final class KMKeyboard extends WebView {
getSettings().setUseWideViewPort(true);
getSettings().setLoadWithOverviewMode(true);
if (0 != (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE)) {
// When `.isTestMode() == true`, the setWebContentsDebuggingEnabled method is not available
// and thus will trigger unit-test failures.
if (!KMManager.isTestMode() && (
(context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0 ||
KMManager.getTier(null) != KMManager.Tier.STABLE
)) {
// Enable debugging of WebView via adb. Not used during unit tests
// Refer: https://developer.chrome.com/docs/devtools/remote-debugging/webviews/#configure_webviews_for_debugging
setWebContentsDebuggingEnabled(true);