From c144c0811249e22f91253ef919cc767f892a8fdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=A8=E3=83=AA=E3=82=B9?= Date: Wed, 4 Nov 2020 14:15:26 +0900 Subject: [PATCH] fix(android): allow file access for existing behavior (#1111) --- .../org/apache/cordova/engine/SystemWebViewEngine.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java b/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java index 3201c744..e703f09d 100755 --- a/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java +++ b/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java @@ -152,6 +152,15 @@ public class SystemWebViewEngine implements CordovaWebViewEngine { settings.setJavaScriptCanOpenWindowsAutomatically(true); settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL); + /** + * https://developer.android.com/reference/android/webkit/WebSettings#setAllowFileAccess(boolean) + * + * SDK >= 30 has recently set this value to false by default. + * It is recommended to turn off this settings To prevent possible security issues targeting Build.VERSION_CODES.Q and earlier. + * For existing functionality, this setting is set to true. In a future release, this should be defaulted to false. + */ + settings.setAllowFileAccess(true); + String manufacturer = android.os.Build.MANUFACTURER; LOG.d(TAG, "CordovaWebView is running on device made by: " + manufacturer);