WebView: add WebView#getSafeBrowsingPrivacyPolicyUrl() API

This adds a dedicated API for fetching a URL for the Safe Browsing
reporting privacy policy.

This URL should be displayed by applications on custom Safe Browsing
interstitials.

Bug: 64077668
Test: make update-api (it compiles and javadocs look good)
Change-Id: I2873260edcaa924e68517c8679079e147b9995f4
diff --git a/api/current.txt b/api/current.txt
index dbf6c0d..da2a8ee 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -49066,6 +49066,7 @@
     method public int getProgress();
     method public boolean getRendererPriorityWaivedWhenNotVisible();
     method public int getRendererRequestedPriority();
+    method public static android.net.Uri getSafeBrowsingPrivacyPolicyUrl();
     method public deprecated float getScale();
     method public android.webkit.WebSettings getSettings();
     method public android.view.textclassifier.TextClassifier getTextClassifier();
diff --git a/api/system-current.txt b/api/system-current.txt
index 5510217..bd62aec 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -52863,6 +52863,7 @@
     method public int getProgress();
     method public boolean getRendererPriorityWaivedWhenNotVisible();
     method public int getRendererRequestedPriority();
+    method public static android.net.Uri getSafeBrowsingPrivacyPolicyUrl();
     method public deprecated float getScale();
     method public android.webkit.WebSettings getSettings();
     method public android.view.textclassifier.TextClassifier getTextClassifier();
@@ -53115,6 +53116,7 @@
     method public abstract java.lang.String findAddress(java.lang.String);
     method public abstract void freeMemoryForTests();
     method public abstract java.lang.String getDefaultUserAgent(android.content.Context);
+    method public abstract android.net.Uri getSafeBrowsingPrivacyPolicyUrl();
     method public abstract void initSafeBrowsing(android.content.Context, android.webkit.ValueCallback<java.lang.Boolean>);
     method public abstract android.net.Uri[] parseFileChooserResult(int, android.content.Intent);
     method public abstract void setSafeBrowsingWhitelist(java.util.List<java.lang.String>, android.webkit.ValueCallback<java.lang.Boolean>);
diff --git a/api/test-current.txt b/api/test-current.txt
index e21debf..b38f25d 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -49513,6 +49513,7 @@
     method public int getProgress();
     method public boolean getRendererPriorityWaivedWhenNotVisible();
     method public int getRendererRequestedPriority();
+    method public static android.net.Uri getSafeBrowsingPrivacyPolicyUrl();
     method public deprecated float getScale();
     method public android.webkit.WebSettings getSettings();
     method public android.view.textclassifier.TextClassifier getTextClassifier();
diff --git a/core/java/android/webkit/SafeBrowsingResponse.java b/core/java/android/webkit/SafeBrowsingResponse.java
index 2ccd2ba..0d0f1cc 100644
--- a/core/java/android/webkit/SafeBrowsingResponse.java
+++ b/core/java/android/webkit/SafeBrowsingResponse.java
@@ -21,6 +21,11 @@
  * created by the WebView and passed to {@link android.webkit.WebViewClient#onSafeBrowsingHit}. The
  * host application must call {@link #showInterstitial(boolean)}, {@link #proceed(boolean)}, or
  * {@link #backToSafety(boolean)} to set the WebView's response to the Safe Browsing hit.
+ *
+ * <p>
+ * If reporting is enabled, all reports will be sent according to the privacy policy referenced by
+ * {@link android.webkit.WebView#getSafeBrowsingPrivacyPolicyUrl()}.
+ * </p>
  */
 public abstract class SafeBrowsingResponse {
 
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index dd716eb..78b26a7 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -1700,6 +1700,16 @@
     }
 
     /**
+     * Returns a URL pointing to the privacy policy for Safe Browsing reporting.
+     *
+     * @return the url pointing to a privacy policy document which can be displayed to users.
+     */
+    @NonNull
+    public static Uri getSafeBrowsingPrivacyPolicyUrl() {
+        return getFactory().getStatics().getSafeBrowsingPrivacyPolicyUrl();
+    }
+
+    /**
      * Gets the WebBackForwardList for this WebView. This contains the
      * back/forward list for use in querying each item in the history stack.
      * This is a copy of the private WebBackForwardList so it contains only a
diff --git a/core/java/android/webkit/WebViewFactoryProvider.java b/core/java/android/webkit/WebViewFactoryProvider.java
index 613eb72..4f6513f 100644
--- a/core/java/android/webkit/WebViewFactoryProvider.java
+++ b/core/java/android/webkit/WebViewFactoryProvider.java
@@ -16,6 +16,7 @@
 
 package android.webkit;
 
+import android.annotation.NonNull;
 import android.annotation.SystemApi;
 import android.content.Context;
 import android.content.Intent;
@@ -95,6 +96,13 @@
         * ValueCallback<Boolean>)}
         */
         void setSafeBrowsingWhitelist(List<String> urls, ValueCallback<Boolean> callback);
+
+        /**
+         * Implement the API method
+         * {@link android.webkit.WebView#getSafeBrowsingPrivacyPolicyUrl()}
+         */
+        @NonNull
+        Uri getSafeBrowsingPrivacyPolicyUrl();
     }
 
     Statics getStatics();