[WebView] Update ServiceWorker related documentation.

Add some clarifying documentation and usage example.

BUG: 28296205
Change-Id: Ib1695822e3d361b17fc4d8a9a3f24a14e34f40ec
diff --git a/core/java/android/webkit/ServiceWorkerController.java b/core/java/android/webkit/ServiceWorkerController.java
index 9115558..571d45e 100644
--- a/core/java/android/webkit/ServiceWorkerController.java
+++ b/core/java/android/webkit/ServiceWorkerController.java
@@ -21,6 +21,19 @@
 
 /**
  * Manages Service Workers used by WebView.
+ *
+ * <p>Example usage:
+ * <pre class="prettyprint">
+ * ServiceWorkerController swController = ServiceWorkerController.getInstance();
+ * swController.setServiceWorkerClient(new ServiceWorkerClient() {
+ *   {@literal @}Override
+ *   public WebResourceResponse shouldInterceptRequest(WebResourceRequest request) {
+ *     // Capture request here and generate response or allow pass-through
+ *     // by returning null.
+ *     return null;
+ *   }
+ * });
+ * </pre></p>
  */
 public abstract class ServiceWorkerController {
 
@@ -29,7 +42,7 @@
      * only one ServiceWorkerController instance for all WebView instances,
      * however this restriction may be relaxed in the future.
      *
-     * @return The default ServiceWorkerController instance.
+     * @return the default ServiceWorkerController instance
      */
      @NonNull
      public static ServiceWorkerController getInstance() {
@@ -39,13 +52,17 @@
     /**
      * Gets the settings for all service workers.
      *
-     * @return The current ServiceWorkerWebSettings
+     * @return the current ServiceWorkerWebSettings
      */
     @NonNull
     public abstract ServiceWorkerWebSettings getServiceWorkerWebSettings();
 
     /**
      * Sets the client to capture service worker related callbacks.
+     *
+     * A {@link ServiceWorkerClient} should be set before any service workers are
+     * active, e.g. a safe place is before any WebView instances are created or
+     * pages loaded.
      */
     public abstract void setServiceWorkerClient(@Nullable ServiceWorkerClient client);
 }