From 17d1adb1835754e5ed015372027cbfa914fd4d31 Mon Sep 17 00:00:00 2001 From: Selim Gurun Date: Wed, 27 Aug 2014 11:22:26 -0700 Subject: [PATCH] Address API Feedback Bug: 17253647 This is Part I of API feedback. It does not address portions of the feedback that is still pending a response from API council. Change-Id: I6ae250c6455a5545912623aeb34332d564fffde7 --- api/current.txt | 9 ++++----- .../android/webkit/PermissionRequest.java | 6 ++++-- core/java/android/webkit/WebChromeClient.java | 19 +++++++++++-------- core/java/android/webkit/WebView.java | 16 ++++++++++++---- 4 files changed, 31 insertions(+), 19 deletions(-) diff --git a/api/current.txt b/api/current.txt index ffdd9f73f1ae9..dfdeeeeba9ee4 100644 --- a/api/current.txt +++ b/api/current.txt @@ -36785,15 +36785,14 @@ package android.webkit { public static abstract class WebChromeClient.FileChooserParams { ctor public WebChromeClient.FileChooserParams(); method public abstract java.lang.String[] getAcceptTypes(); - method public abstract java.lang.String getDefaultFilename(); + method public abstract java.lang.String getFilenameHint(); method public abstract int getMode(); method public abstract java.lang.CharSequence getTitle(); method public abstract android.webkit.WebChromeClient.UploadHelper getUploadHelper(); method public abstract boolean isCaptureEnabled(); - field public static final int OPEN = 0; // 0x0 - field public static final int OPEN_FOLDER = 2; // 0x2 - field public static final int OPEN_MULTIPLE = 1; // 0x1 - field public static final int SAVE = 3; // 0x3 + field public static final int MODE_OPEN = 0; // 0x0 + field public static final int MODE_OPEN_MULTIPLE = 1; // 0x1 + field public static final int MODE_SAVE = 3; // 0x3 } public static abstract class WebChromeClient.UploadHelper { diff --git a/core/java/android/webkit/PermissionRequest.java b/core/java/android/webkit/PermissionRequest.java index 862e8c2d0d6e9..6ad639c1c58f3 100644 --- a/core/java/android/webkit/PermissionRequest.java +++ b/core/java/android/webkit/PermissionRequest.java @@ -19,8 +19,10 @@ package android.webkit; import android.net.Uri; /** - * This interface defines a permission request and is used when web content - * requests access to protected resources. + * This class defines a permission request and is used when web content + * requests access to protected resources. The permission request related events + * are delivered via {@link WebChromeClient#onPermissionRequest} and + * {@link WebChromeClient#onPermissionRequestCanceled}. * * Either {@link #grant(String[]) grant()} or {@link #deny()} must be called in UI * thread to respond to the request. diff --git a/core/java/android/webkit/WebChromeClient.java b/core/java/android/webkit/WebChromeClient.java index 35c9598018941..547acfad61dd9 100644 --- a/core/java/android/webkit/WebChromeClient.java +++ b/core/java/android/webkit/WebChromeClient.java @@ -452,14 +452,16 @@ public class WebChromeClient { */ public static abstract class FileChooserParams { /** Open single file. Requires that the file exists before allowing the user to pick it. */ - public static final int OPEN = 0; + public static final int MODE_OPEN = 0; /** Like Open but allows multiple files to be selected. */ - public static final int OPEN_MULTIPLE = 1; + public static final int MODE_OPEN_MULTIPLE = 1; /** Like Open but allows a folder to be selected. The implementation should enumerate - all files selected by this operation. */ - public static final int OPEN_FOLDER = 2; + all files selected by this operation. + This feature is not supported at the moment. + @hide */ + public static final int MODE_OPEN_FOLDER = 2; /** Allows picking a nonexistent file and saving it. */ - public static final int SAVE = 3; + public static final int MODE_SAVE = 3; /** * Returns a helper to simplify choosing and uploading files. The helper builds a default @@ -474,7 +476,8 @@ public class WebChromeClient { public abstract int getMode(); /** - * Returns an array of acceptable MIME types. The array will be empty if no + * Returns an array of acceptable MIME types. The returned MIME type + * could be partial such as audio/*. The array will be empty if no * acceptable types are specified. */ public abstract String[] getAcceptTypes(); @@ -494,9 +497,9 @@ public class WebChromeClient { public abstract CharSequence getTitle(); /** - * The file path of a default selection if specified, or null. + * The file name of a default selection if specified, or null. */ - public abstract String getDefaultFilename(); + public abstract String getFilenameHint(); }; /** diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 1b0cb3d8caac6..e1f19ee0e3e7c 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -1624,10 +1624,18 @@ public class WebView extends AbsoluteLayout } /** - * Enable drawing the entire HTML document at a significant performance - * cost. Call this to enable drawing and capturing HTML content outside of - * the WebView's viewport. This should be called before any WebViews are - * created. + * For apps targeting the L release, WebView has a new default behavior that reduces + * memory footprint and increases performance by intelligently choosing + * the portion of the HTML document that needs to be drawn. These + * optimizations are transparent to the developers. However, under certain + * circumstances, an App developer may want to disable them: + * 1. When an app uses {@link #onDraw} to do own drawing and accesses portions + * of the page that is way outside the visible portion of the page. + * 2. When an app uses {@link #capturePicture} to capture a very large HTML document. + * Note that capturePicture is a deprecated API. + * + * Enabling drawing the entire HTML document has a significant performance + * cost. This method should be called before any WebViews are created. */ public static void enableSlowWholeDocumentDraw() { getFactory().getStatics().enableSlowWholeDocumentDraw();