diff --git a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md index 6baf3762c445..a7683435ce2b 100644 --- a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md @@ -1,3 +1,8 @@ +## 4.0.0 + +* Bumps androidx.webkit:webkit from 1.12.0 to 1.12.1. +* **Breaking Change** Bumps Android `minSdkVersion` from 19 to 21. + ## 3.16.9 * Updates Java compatibility version to 11. diff --git a/packages/webview_flutter/webview_flutter_android/android/build.gradle b/packages/webview_flutter/webview_flutter_android/android/build.gradle index a0d12facbb3d..7e5bcc82d8fe 100644 --- a/packages/webview_flutter/webview_flutter_android/android/build.gradle +++ b/packages/webview_flutter/webview_flutter_android/android/build.gradle @@ -26,7 +26,7 @@ android { compileSdk 34 defaultConfig { - minSdkVersion 19 + minSdkVersion 21 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -38,7 +38,7 @@ android { dependencies { implementation 'androidx.annotation:annotation:1.8.2' - implementation 'androidx.webkit:webkit:1.12.0' + implementation 'androidx.webkit:webkit:1.12.1' testImplementation 'junit:junit:4.13.2' testImplementation 'org.mockito:mockito-inline:5.1.0' testImplementation 'androidx.test:core:1.3.0' diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FileChooserParamsFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FileChooserParamsFlutterApiImpl.java index 5ad5923d5f2c..d0f5b9c4d64a 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FileChooserParamsFlutterApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FileChooserParamsFlutterApiImpl.java @@ -4,10 +4,8 @@ package io.flutter.plugins.webviewflutter; -import android.os.Build; import android.webkit.WebChromeClient; import androidx.annotation.NonNull; -import androidx.annotation.RequiresApi; import io.flutter.plugin.common.BinaryMessenger; import java.util.Arrays; @@ -17,7 +15,6 @@ *
Passes arguments of callbacks methods from a {@link * android.webkit.WebChromeClient.FileChooserParams} to Dart. */ -@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public class FileChooserParamsFlutterApiImpl extends GeneratedAndroidWebView.FileChooserParamsFlutterApi { private final InstanceManager instanceManager; diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/PermissionRequestHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/PermissionRequestHostApiImpl.java index e4faf449adc8..2a7e6ccb58a0 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/PermissionRequestHostApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/PermissionRequestHostApiImpl.java @@ -4,10 +4,8 @@ package io.flutter.plugins.webviewflutter; -import android.os.Build; import android.webkit.PermissionRequest; import androidx.annotation.NonNull; -import androidx.annotation.RequiresApi; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.PermissionRequestHostApi; import java.util.List; @@ -19,7 +17,6 @@ *
This class may handle instantiating and adding native object instances that are attached to a * Dart instance or handle method calls on the associated native class or an instance of the class. */ -@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public class PermissionRequestHostApiImpl implements PermissionRequestHostApi { // To ease adding additional methods, this value is added prematurely. @SuppressWarnings({"unused", "FieldCanBeLocal"}) diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientFlutterApiImpl.java index d5601670630c..45a1c98adae1 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientFlutterApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientFlutterApiImpl.java @@ -4,7 +4,6 @@ package io.flutter.plugins.webviewflutter; -import android.os.Build; import android.view.View; import android.webkit.ConsoleMessage; import android.webkit.GeolocationPermissions; @@ -12,7 +11,6 @@ import android.webkit.WebChromeClient; import android.webkit.WebView; import androidx.annotation.NonNull; -import androidx.annotation.RequiresApi; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.WebChromeClientFlutterApi; import java.util.List; @@ -75,7 +73,6 @@ public void onProgressChanged( } /** Passes arguments from {@link WebChromeClient#onShowFileChooser} to Dart. */ - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public void onShowFileChooser( @NonNull WebChromeClient webChromeClient, @NonNull WebView webView, @@ -123,7 +120,6 @@ public void onGeolocationPermissionsHidePrompt( * Sends a message to Dart to call `WebChromeClient.onPermissionRequest` on the Dart object * representing `instance`. */ - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public void onPermissionRequest( @NonNull WebChromeClient instance, @NonNull PermissionRequest request, diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java index 3f230b7b794f..2edb012c5350 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java @@ -83,7 +83,6 @@ public void onGeolocationPermissionsHidePrompt() { flutterApi.onGeolocationPermissionsHidePrompt(this, reply -> {}); } - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @SuppressWarnings("LambdaLast") @Override public boolean onShowFileChooser( @@ -109,7 +108,6 @@ public boolean onShowFileChooser( return currentReturnValueForOnShowFileChooser; } - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @Override public void onPermissionRequest(@NonNull PermissionRequest request) { flutterApi.onPermissionRequest(this, request, reply -> {}); diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java index 0bd280d705b2..b94238bcb4b5 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java @@ -51,7 +51,6 @@ static GeneratedAndroidWebView.WebResourceErrorData createWebResourceErrorData( .build(); } - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) static GeneratedAndroidWebView.WebResourceRequestData createWebResourceRequestData( WebResourceRequest request) { final GeneratedAndroidWebView.WebResourceRequestData.Builder requestData = @@ -71,7 +70,6 @@ static GeneratedAndroidWebView.WebResourceRequestData createWebResourceRequestDa return requestData.build(); } - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) static GeneratedAndroidWebView.WebResourceResponseData createWebResourceResponseData( WebResourceResponse response) { final GeneratedAndroidWebView.WebResourceResponseData.Builder responseData = @@ -122,7 +120,6 @@ public void onPageFinished( } /** Passes arguments from {@link WebViewClient#onReceivedHttpError} to Dart. */ - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public void onReceivedHttpError( @NonNull WebViewClient webViewClient, @NonNull WebView webView, @@ -167,7 +164,6 @@ public void onReceivedRequestError( * Passes arguments from {@link androidx.webkit.WebViewClientCompat#onReceivedError(WebView, * WebResourceRequest, WebResourceError)} to Dart. */ - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public void onReceivedRequestError( @NonNull WebViewClient webViewClient, @NonNull WebView webView, @@ -214,7 +210,6 @@ public void onReceivedError( * Passes arguments from {@link WebViewClient#shouldOverrideUrlLoading(WebView, * WebResourceRequest)} to Dart. */ - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public void requestLoading( @NonNull WebViewClient webViewClient, @NonNull WebView webView, diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientHostApiImpl.java index fdc448279982..a71b5efbcc4f 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientHostApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientHostApiImpl.java @@ -4,8 +4,6 @@ package io.flutter.plugins.webviewflutter; -import android.annotation.SuppressLint; -import android.annotation.TargetApi; import android.graphics.Bitmap; import android.os.Build; import android.view.KeyEvent; @@ -152,7 +150,6 @@ public void onPageFinished(@NonNull WebView view, @NonNull String url) { flutterApi.onPageFinished(this, view, url, reply -> {}); } - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @Override public void onReceivedHttpError( @NonNull WebView view, @@ -161,10 +158,6 @@ public void onReceivedHttpError( flutterApi.onReceivedHttpError(this, view, request, response, reply -> {}); } - // This method is only called when the WebViewFeature.RECEIVE_WEB_RESOURCE_ERROR feature is - // enabled. The deprecated method is called when a device doesn't support this. - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) - @SuppressLint("RequiresFeature") @Override public void onReceivedError( @NonNull WebView view, @@ -185,7 +178,6 @@ public void onReceivedError( this, view, (long) errorCode, description, failingUrl, reply -> {}); } - @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public boolean shouldOverrideUrlLoading( @NonNull WebView view, @NonNull WebResourceRequest request) { diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java index 3c73a4e4c31b..80c574badf81 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java @@ -5,7 +5,6 @@ package io.flutter.plugins.webviewflutter; import android.content.Context; -import android.os.Build; import android.os.Handler; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -109,11 +108,8 @@ private void setUp( WebStorageHostApi.setup( binaryMessenger, new WebStorageHostApiImpl(instanceManager, new WebStorageHostApiImpl.WebStorageCreator())); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - PermissionRequestHostApi.setup( - binaryMessenger, new PermissionRequestHostApiImpl(binaryMessenger, instanceManager)); - } + PermissionRequestHostApi.setup( + binaryMessenger, new PermissionRequestHostApiImpl(binaryMessenger, instanceManager)); GeolocationPermissionsCallbackHostApi.setup( binaryMessenger, new GeolocationPermissionsCallbackHostApiImpl(binaryMessenger, instanceManager)); diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml index 103d7f640d67..031ca80375d1 100644 --- a/packages/webview_flutter/webview_flutter_android/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter_android description: A Flutter plugin that provides a WebView widget on Android. repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 3.16.9 +version: 4.0.0 environment: sdk: ^3.5.0