From f02f846439b3e01adc34bde4d56ced1304ac8d84 Mon Sep 17 00:00:00 2001
From: Nate Fischer
block for consistency. Other than the modified*/ public abstract class ServiceWorkerController { diff --git a/core/java/android/webkit/WebChromeClient.java b/core/java/android/webkit/WebChromeClient.java index 81aa2f3a05fc8..f07ecbf58d5a0 100644 --- a/core/java/android/webkit/WebChromeClient.java +++ b/core/java/android/webkit/WebChromeClient.java @@ -289,7 +289,7 @@ public class WebChromeClient { * (API level > {@link android.os.Build.VERSION_CODES#M}) * this method is only called for requests originating from secure * origins such as https. On non-secure origins geolocation requests - * are automatically denied. + * are automatically denied. * * @param origin The origin of the web content attempting to use the * Geolocation API. diff --git a/core/java/android/webkit/WebMessagePort.java b/core/java/android/webkit/WebMessagePort.java index 54dd502ca7de1..acd7af955b75e 100644 --- a/core/java/android/webkit/WebMessagePort.java +++ b/core/java/android/webkit/WebMessagePort.java @@ -22,30 +22,30 @@ import android.os.Handler; /** *block, this has no reader-visible change, it merely complies with best practices from Android API guidelines. Bug: 65381884 Test: make docs (and manually compare before/after for differences) Change-Id: I2f911a43b88a8897d9d1b5c7945360580491883d --- .../android/webkit/SafeBrowsingResponse.java | 1 - .../webkit/ServiceWorkerController.java | 2 +- core/java/android/webkit/WebChromeClient.java | 2 +- core/java/android/webkit/WebMessagePort.java | 12 ++-- core/java/android/webkit/WebSettings.java | 2 - core/java/android/webkit/WebView.java | 67 +++++++++---------- core/java/android/webkit/WebViewClient.java | 9 ++- 7 files changed, 43 insertions(+), 52 deletions(-) diff --git a/core/java/android/webkit/SafeBrowsingResponse.java b/core/java/android/webkit/SafeBrowsingResponse.java index 0d0f1cce2dfc6..0acfcc76b190b 100644 --- a/core/java/android/webkit/SafeBrowsingResponse.java +++ b/core/java/android/webkit/SafeBrowsingResponse.java @@ -25,7 +25,6 @@ package android.webkit; *+ ** If reporting is enabled, all reports will be sent according to the privacy policy referenced by * {@link android.webkit.WebView#getSafeBrowsingPrivacyPolicyUrl()}. - *
*/ public abstract class SafeBrowsingResponse { diff --git a/core/java/android/webkit/ServiceWorkerController.java b/core/java/android/webkit/ServiceWorkerController.java index 571d45e22d3b5..3517c74b680e9 100644 --- a/core/java/android/webkit/ServiceWorkerController.java +++ b/core/java/android/webkit/ServiceWorkerController.java @@ -33,7 +33,7 @@ import android.annotation.Nullable; * return null; * } * }); - *
The Java representation of the * - * HTML5 message ports.
+ * HTML5 message ports. * *A Message port represents one endpoint of a Message Channel. In Android * webview, there is no separate Message Channel object. When a message channel * is created, both ports are tangled to each other and started, and then * returned in a MessagePort array, see {@link WebView#createWebMessageChannel} - * for creating a message channel.
+ * for creating a message channel. * *When a message port is first created or received via transfer, it does not * have a WebMessageCallback to receive web messages. The messages are queued until - * a WebMessageCallback is set.
+ * a WebMessageCallback is set. * *A message port should be closed when it is not used by the embedder application * anymore. A closed port cannot be transferred or cannot be reopened to send - * messages. Close can be called multiple times.
+ * messages. Close can be called multiple times. * *When a port is transferred to JS, it cannot be used to send or receive messages * at the Java side anymore. Different from HTML5 Spec, a port cannot be transferred * if one of these has ever happened: i. a message callback was set, ii. a message was * posted on it. A transferred port cannot be closed by the application, since - * the ownership is also transferred.
+ * the ownership is also transferred. * *It is possible to transfer both ports of a channel to JS, for example for - * communication between subframes.
+ * communication between subframes. */ public abstract class WebMessagePort { diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java index 82cff7c13e472..b1b10f509f2b6 100644 --- a/core/java/android/webkit/WebSettings.java +++ b/core/java/android/webkit/WebSettings.java @@ -1394,11 +1394,9 @@ public abstract class WebSettings { * Safe browsing is disabled by default. The recommended way to enable Safe browsing is using a * manifest tag to change the default value to enabled for all WebViews (read general Safe Browsing info). - * * ** This API overrides the manifest tag value for this WebView. - *
* * @param enabled Whether Safe browsing is enabled. */ diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index f918cadde87c7..e92f71e6d6504 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -75,18 +75,22 @@ import java.util.Map; * can roll your own web browser or simply display some online content within your Activity. * It uses the WebKit rendering engine to display * web pages and includes methods to navigate forward and backward - * through a history, zoom in and out, perform text searches and more. + * through a history, zoom in and out, perform text searches and more. + * *Note that, in order for your Activity to access the Internet and load web pages * in a WebView, you must add the {@code INTERNET} permissions to your - * Android Manifest file:
- *<uses-permission android:name="android.permission.INTERNET" />+ * Android Manifest file: + * + *
+ * {@code }
+ *
*
* This must be a child of the {@code
For more information, read - * Building Web Apps in WebView.
+ * Building Web Apps in WebView. * *See {@link android.content.Intent} for more information.
+ *See {@link android.content.Intent} for more information. * *
To provide a WebView in your own Activity, include a {@code
* WebView webview = new WebView(this); * setContentView(webview); ** - *
Then load the desired web page:
+ *Then load the desired web page: + * *
* // Simplest usage: note that an exception will NOT be thrown * // if there is an error loading this page (see below). @@ -128,7 +134,7 @@ import java.util.Map; ** *
A WebView has several customization points where you can add your - * own behavior. These are:
+ * own behavior. These are: * *Here's a more complicated example, showing error handling, - * settings, and progress notification:
+ * settings, and progress notification: * ** // Let's display the progress in the activity title bar, like the @@ -183,23 +189,23 @@ import java.util.Map; * *To enable the built-in zoom, set * {@link #getSettings() WebSettings}.{@link WebSettings#setBuiltInZoomControls(boolean)} - * (introduced in API level {@link android.os.Build.VERSION_CODES#CUPCAKE}).
+ * (introduced in API level {@link android.os.Build.VERSION_CODES#CUPCAKE}). + * *NOTE: Using zoom if either the height or width is set to * {@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT} may lead to undefined behavior - * and should be avoided.
+ * and should be avoided. * *Cookie and window management
* *For obvious security reasons, your application has its own * cache, cookie store etc.—it does not share the Browser * application's data. - *
* *By default, requests by the HTML to open new windows are * ignored. This is true whether they be opened by JavaScript or by * the target attribute on a link. You can customize your * {@link WebChromeClient} to provide your own behavior for opening multiple windows, - * and render them in whatever manner you want.
+ * and render them in whatever manner you want. * *The standard behavior for an Activity is to be destroyed and * recreated when the device orientation or any other configuration changes. This will cause @@ -208,7 +214,7 @@ import java.util.Map; * changes, and then just leave the WebView alone. It'll automatically * re-orient itself as appropriate. Read Handling Runtime Changes for - * more information about how to handle configuration changes during runtime.
+ * more information about how to handle configuration changes during runtime. * * *Building web pages to support different screen densities
@@ -220,15 +226,15 @@ import java.util.Map; * height and width are defined in terms of screen pixels will appear larger on the lower density * screen and smaller on the higher density screen. * For simplicity, Android collapses all actual screen densities into three generalized densities: - * high, medium, and low. + * high, medium, and low. *By default, WebView scales a web page so that it is drawn at a size that matches the default * appearance on a medium density screen. So, it applies 1.5x scaling on a high density screen * (because its pixels are smaller) and 0.75x scaling on a low density screen (because its pixels * are bigger). * Starting with API level {@link android.os.Build.VERSION_CODES#ECLAIR}, WebView supports DOM, CSS, * and meta tag features to help you (as a web developer) target screens with different screen - * densities.
- *Here's a summary of the features you can use to handle different screen densities:
+ * densities. + *Here's a summary of the features you can use to handle different screen densities: *
* <link rel="stylesheet" media="screen and (-webkit-device-pixel-ratio:1.5)" href="hdpi.css" />*
The {@code hdpi.css} stylesheet is only used for devices with a screen pixel ration of 1.5, - * which is the high density pixel ratio.
+ * which is the high density pixel ratio. *In order to support inline HTML5 video in your application you need to have hardware * acceleration turned on. - *
* *@@ -284,7 +287,6 @@ import java.util.Map; * for the height none of the WebView's parents should use a * {@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT} layout height since that could result in * incorrect sizing of the views. - *
* *Setting the WebView's height to {@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT} * enables the following behaviors: @@ -294,13 +296,11 @@ import java.util.Map; *
* Using a layout width of {@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT} is not * supported. If such a width is used the WebView will attempt to use the width of the parent * instead. - *
* ** Data will only be uploaded for a given app if the user has consented AND the app has not opted * out. - *
* ** If Safe Browsing is enabled, WebView will block malicious URLs and present a warning UI to the * user to allow them to navigate back safely or proceed to the malicious page. - *
** The recommended way for apps to enable the feature is putting the following tag in the manifest: - *
**
* <meta-data android:name="android.webkit.WebView.EnableSafeBrowsing" * android:value="true" /> *- * * */ // Implementation notes. @@ -1197,11 +1192,11 @@ public class WebView extends AbsoluteLayout * immediately be reflected visually by subsequent {@link WebView#onDraw} invocations. The * {@link VisualStateCallback} provides a mechanism to notify the caller when the contents of * the DOM at the current time are ready to be drawn the next time the {@link WebView} - * draws. + * draws. * *
The next draw after the callback completes is guaranteed to reflect all the updates to the * DOM up to the point at which the {@link VisualStateCallback} was posted, but it may also - * contain updates applied after the callback was posted.
+ * contain updates applied after the callback was posted. * *The state of the DOM covered by this API includes the following: *
To guarantee that the {@link WebView} will successfully render the first frame * after the {@link VisualStateCallback#onComplete} method has been called a set of conditions @@ -1230,11 +1225,11 @@ public class WebView extends AbsoluteLayout * {@link AbsoluteLayout.LayoutParams LayoutParams}'s width and height need to be set to fixed * values and must be made {@link View#VISIBLE VISIBLE} from the * {@link VisualStateCallback#onComplete} method. - *
+ * * *When using this API it is also recommended to enable pre-rasterization if the {@link * WebView} is off screen to avoid flickering. See {@link WebSettings#setOffscreenPreRaster} for - * more details and do consider its caveats.
+ * more details and do consider its caveats. * * @param requestId An id that will be returned in the callback to allow callers to match * requests with callbacks. @@ -1990,7 +1985,7 @@ public class WebView extends AbsoluteLayout * here * * - *The returned message channels are entangled and already in started state.
+ *The returned message channels are entangled and already in started state. * * @return the two message ports that form the message channel. */ diff --git a/core/java/android/webkit/WebViewClient.java b/core/java/android/webkit/WebViewClient.java index e7e539c7f01c1..98c131edcba4f 100644 --- a/core/java/android/webkit/WebViewClient.java +++ b/core/java/android/webkit/WebViewClient.java @@ -66,7 +66,6 @@ public class WebViewClient { * with the request's url from inside the method and then return true, * as this will make WebView to attempt loading a non-http url, and thus fail. * - *
* * @param view The WebView that is initiating the callback. * @param request Object containing the details of the request. @@ -130,15 +129,15 @@ public class WebViewClient { *This method is called when the body of the HTTP response has started loading, is reflected * in the DOM, and will be visible in subsequent draws. This callback occurs early in the * document loading process, and as such you should expect that linked resources (for example, - * css and images) may not be available.
+ * css and images) may not be available. * *For more fine-grained notification of visual state updates, see {@link - * WebView#postVisualStateCallback}.
+ * WebView#postVisualStateCallback}. * *Please note that all the conditions and recommendations applicable to - * {@link WebView#postVisualStateCallback} also apply to this API.
+ * {@link WebView#postVisualStateCallback} also apply to this API. * - *
This callback is only called for main frame navigations.
+ *This callback is only called for main frame navigations. * * @param view The {@link android.webkit.WebView} for which the navigation occurred. * @param url The URL corresponding to the page navigation that triggered this callback.