Android: How to access or set native settings (WebSettings)?

3D WebView for Android is powered by the Android System WebView, which has a native WebSettings class for advanced settings. 3D WebView's AndroidWebView class has methods for some of these settings; for example, AndroidWebView.SetTextZoom() maps to WebSettings.setTextZoom(). AndroidWebView doesn't provide APIs for all of the settings in WebSettings, but you can access the native WebSettings directly using AndroidWebView.GetNativeWebView(), like this:

await webViewPrefab.WaitUntilInitialized();
#if UNITY_ANDROID && !UNITY_EDITOR
    var androidWebView = webViewPrefab.WebView as AndroidWebView;
    var nativeWebView = androidWebView.GetNativeWebView();
    // Most native WebView methods must be called on the Android UI thread.
    AndroidWebView.RunOnAndroidUIThread(() => {
        // Call android.webkit.WebView.getSettings().
        // https://developer.android.com/reference/android/webkit/WebView#getSettings()
        var settings = nativeWebView.Call<AndroidJavaObject>("getSettings");
        // Call WebSettings.setAllowFileAccess() to disable file access.
        // https://developer.android.com/reference/android/webkit/WebSettings#setAllowFileAccess(boolean)
        settings.Call("setAllowFileAccess", false);
    });
#endif

Please note that some settings may interfere with 3D WebView's functionality. For example, some 3D WebView features rely on running JavaScript, so if you disable JavaScript with WebSettings.setJavaScriptEnabled(), some features won't work.