WebView: Clarify documentation about mimeTypes
This change edits the WebView documentation to specify that the mimeType
parameter to loadData and loadDataWithBaseUrl should be a valid mimeType
and the data will be downloaded if it is not.
Test: manual - this only changes documentation
Bug: 70528830
Change-Id: I58ca4655673c6ccfe7547572579ef86a14a259ed
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 6f99254..70080e6f 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -997,6 +997,10 @@
* hex encoding of URLs for octets outside that range. For example, '#',
* '%', '\', '?' should be replaced by %23, %25, %27, %3f respectively.
* <p>
+ * The {@code mimeType} parameter specifies the format of the data.
+ * If WebView can't handle the specified MIME type, it will download the data.
+ * If {@code null}, defaults to 'text/html'.
+ * <p>
* The 'data' scheme URL formed by this method uses the default US-ASCII
* charset. If you need need to set a different charset, you should form a
* 'data' scheme URL which explicitly specifies a charset parameter in the
@@ -1005,8 +1009,7 @@
* always overrides that specified in the HTML or XML document itself.
*
* @param data a String of data in the given encoding
- * @param mimeType the MIMEType of the data, e.g. 'text/html'. If {@code null},
- * defaults to 'text/html'.
+ * @param mimeType the MIME type of the data, e.g. 'text/html'.
* @param encoding the encoding of the data
*/
public void loadData(String data, @Nullable String mimeType, @Nullable String encoding) {
@@ -1020,6 +1023,10 @@
* applying JavaScript's same origin policy. The historyUrl is used for the
* history entry.
* <p>
+ * The {@code mimeType} parameter specifies the format of the data.
+ * If WebView can't handle the specified MIME type, it will download the data.
+ * If {@code null}, defaults to 'text/html'.
+ * <p>
* Note that content specified in this way can access local device files
* (via 'file' scheme URLs) only if baseUrl specifies a scheme other than
* 'http', 'https', 'ftp', 'ftps', 'about' or 'javascript'.
@@ -1037,8 +1044,7 @@
* @param baseUrl the URL to use as the page's base URL. If {@code null} defaults to
* 'about:blank'.
* @param data a String of data in the given encoding
- * @param mimeType the MIMEType of the data, e.g. 'text/html'. If {@code null},
- * defaults to 'text/html'.
+ * @param mimeType the MIME type of the data, e.g. 'text/html'.
* @param encoding the encoding of the data
* @param historyUrl the URL to use as the history entry. If {@code null} defaults
* to 'about:blank'. If non-null, this must be a valid URL.