Add deprecation notice to Linkify MAP_ADDRESSES
Bug: 22362008
Test: N/A
Change-Id: Ib70e0cbdd8c454a96e5e75b906ace7b6f1e21cba
diff --git a/api/current.txt b/api/current.txt
index 607109d..bf363a5 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -44679,7 +44679,7 @@
method public static final boolean addLinks(android.text.Spannable, java.util.regex.Pattern, java.lang.String, java.lang.String[], android.text.util.Linkify.MatchFilter, android.text.util.Linkify.TransformFilter);
field public static final int ALL = 15; // 0xf
field public static final int EMAIL_ADDRESSES = 2; // 0x2
- field public static final int MAP_ADDRESSES = 8; // 0x8
+ field public static final deprecated int MAP_ADDRESSES = 8; // 0x8
field public static final int PHONE_NUMBERS = 4; // 0x4
field public static final int WEB_URLS = 1; // 0x1
field public static final android.text.util.Linkify.MatchFilter sPhoneNumberMatchFilter;
@@ -51298,7 +51298,7 @@
method public void documentHasImages(android.os.Message);
method public static void enableSlowWholeDocumentDraw();
method public void evaluateJavascript(java.lang.String, android.webkit.ValueCallback<java.lang.String>);
- method public static java.lang.String findAddress(java.lang.String);
+ method public static deprecated java.lang.String findAddress(java.lang.String);
method public deprecated int findAll(java.lang.String);
method public void findAllAsync(java.lang.String);
method public void findNext(boolean);
diff --git a/core/java/android/text/util/Linkify.java b/core/java/android/text/util/Linkify.java
index 9c6a3f5..c905f49 100644
--- a/core/java/android/text/util/Linkify.java
+++ b/core/java/android/text/util/Linkify.java
@@ -100,13 +100,20 @@
* take an options mask. Note that this uses the
* {@link android.webkit.WebView#findAddress(String) findAddress()} method in
* {@link android.webkit.WebView} for finding addresses, which has various
- * limitations.
+ * limitations and has been deprecated.
+ * @deprecated use {@link android.view.textclassifier.TextClassifier#generateLinks(
+ * TextLinks.Request)} instead and avoid it even when targeting API levels where no alternative
+ * is available.
*/
+ @Deprecated
public static final int MAP_ADDRESSES = 0x08;
/**
* Bit mask indicating that all available patterns should be matched in
* methods that take an options mask
+ * <p><strong>Note:</strong></p> {@link #MAP_ADDRESSES} is deprecated.
+ * Use {@link android.view.textclassifier.TextClassifier#generateLinks(TextLinks.Request)}
+ * instead and avoid it even when targeting API levels where no alternative is available.
*/
public static final int ALL = WEB_URLS | EMAIL_ADDRESSES | PHONE_NUMBERS | MAP_ADDRESSES;
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index fc94b1f..2bc36d8 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -1837,8 +1837,12 @@
*
* @param addr the string to search for addresses
* @return the address, or if no address is found, {@code null}
+ * @deprecated this method is superseded by {@link TextClassifier#generateLinks(
+ * android.view.textclassifier.TextLinks.Request)}. Avoid using this method even when targeting
+ * API levels where no alternative is available.
*/
@Nullable
+ @Deprecated
public static String findAddress(String addr) {
if (addr == null) {
throw new NullPointerException("addr is null");