summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2014-11-17 20:34:32 +0000
committerBen Murdoch <benm@google.com>2014-11-17 23:53:30 +0000
commit12399ba4bb12154b7897cf88bee04aca0adeb770 (patch)
tree0bb28722fb9b7f457ac2ce9df9d6c8f8863cd166
parenta0cac3151315da4adcd4dbea4ff21a3b4fc7ea54 (diff)
downloadwebview-lollipop-mr1-dev.tar.gz
The 4.4W SDK bump between K and L means that apps running on L that are compiled with targetSDK 20 are picking up some features only intended to be enabled on L devices, due to erroneous target SDK checks that didn't take 4.4W into account. Bug: 18385629 Change-Id: Ia7996e948f9902c535e9f7fa7dea5b05db0a1aa0
-rw-r--r--chromium/java/com/android/webview/chromium/WebViewChromium.java8
-rw-r--r--chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java13
2 files changed, 15 insertions, 6 deletions
diff --git a/chromium/java/com/android/webview/chromium/WebViewChromium.java b/chromium/java/com/android/webview/chromium/WebViewChromium.java
index b347103..d1d037b 100644
--- a/chromium/java/com/android/webview/chromium/WebViewChromium.java
+++ b/chromium/java/com/android/webview/chromium/WebViewChromium.java
@@ -250,9 +250,9 @@ class WebViewChromium implements WebViewProvider,
mWebView.getContext(), isAccessFromFileURLsGrantedByDefault,
areLegacyQuirksEnabled));
- if (mAppTargetSdkVersion <= Build.VERSION_CODES.KITKAT) {
+ if (mAppTargetSdkVersion < Build.VERSION_CODES.LOLLIPOP) {
+ // Prior to Lollipop we always allowed third party cookies and mixed content.
mWebSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
- // On KK and older versions we always allowed third party cookies.
mWebSettings.setAcceptThirdPartyCookies(true);
mWebSettings.getAwSettings().setZeroLayoutHeightDisablesViewportQuirk(true);
}
@@ -321,8 +321,8 @@ class WebViewChromium implements WebViewProvider,
AwContentsStatics.setRecordFullDocument(sRecordWholeDocumentEnabledByApi ||
mAppTargetSdkVersion < Build.VERSION_CODES.LOLLIPOP);
- if (mAppTargetSdkVersion <= Build.VERSION_CODES.KITKAT) {
- // On KK and older versions, JavaScript objects injected via addJavascriptInterface
+ if (mAppTargetSdkVersion < Build.VERSION_CODES.LOLLIPOP) {
+ // Prior to Lollipop, JavaScript objects injected via addJavascriptInterface
// were not inspectable.
mAwContents.disableJavascriptInterfacesInspection();
}
diff --git a/chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java b/chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java
index 6b4b894..f3351c5 100644
--- a/chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java
+++ b/chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java
@@ -911,14 +911,23 @@ public class WebViewContentsClientAdapter extends AwContentsClient {
uploadFileCallback.onReceiveValue(s);
}
};
+
+ // Invoke the new callback introduced in Lollipop. If the app handles
+ // it, we're done here.
if (mWebChromeClient.onShowFileChooser(mWebView, callbackAdapter, adapter)) {
return;
}
- if (mWebView.getContext().getApplicationInfo().targetSdkVersion >
- Build.VERSION_CODES.KITKAT) {
+
+ // If the app did not handle it and we are running on Lollipop or newer, then
+ // abort.
+ if (mWebView.getContext().getApplicationInfo().targetSdkVersion >=
+ Build.VERSION_CODES.LOLLIPOP) {
uploadFileCallback.onReceiveValue(null);
return;
}
+
+ // Otherwise, for older apps, attempt to invoke the legacy (hidden) API for
+ // backwards compatibility.
ValueCallback<Uri> innerCallback = new ValueCallback<Uri>() {
private boolean mCompleted;
@Override