summaryrefslogtreecommitdiffstats
path: root/core/java/android/text
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2014-12-17 14:31:39 -0800
committerRaph Levien <raph@google.com>2014-12-17 14:31:39 -0800
commit047e816fe2e6c94ff425188c4b12f02921d3f5bf (patch)
treea11149fd54110e58bdd7e42aa7b1050bdaac1423 /core/java/android/text
parent613fffcd0f17eecb0231fe24f7abf7936eef8d37 (diff)
downloadframeworks_base-047e816fe2e6c94ff425188c4b12f02921d3f5bf.zip
frameworks_base-047e816fe2e6c94ff425188c4b12f02921d3f5bf.tar.gz
frameworks_base-047e816fe2e6c94ff425188c4b12f02921d3f5bf.tar.bz2
Revert "Change Linkify leniency to VALID"
This reverts commit 9dfe86d4102b93885b947917fccee35053cfc9f2. That change moved the lenience from POSSIBLE to VALID, which eliminated false positive links, especially 4 digit phone numbers, but caused significant false negatives, leading to CTS test failures (android.text.util.cts.LinkifyTest#testAddLinks7 in particular). The true fix requires new functionality to validate phone numbers in a mobile context. In the meantime, the best solution is to revert. Bug: 18708556
Diffstat (limited to 'core/java/android/text')
-rw-r--r--core/java/android/text/util/Linkify.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/java/android/text/util/Linkify.java b/core/java/android/text/util/Linkify.java
index 14be269..c1341e1 100644
--- a/core/java/android/text/util/Linkify.java
+++ b/core/java/android/text/util/Linkify.java
@@ -402,7 +402,7 @@ public class Linkify {
}
boolean hasPrefix = false;
-
+
for (int i = 0; i < prefixes.length; i++) {
if (url.regionMatches(true, 0, prefixes[i], 0,
prefixes[i].length())) {
@@ -450,7 +450,7 @@ public class Linkify {
private static final void gatherTelLinks(ArrayList<LinkSpec> links, Spannable s) {
PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
Iterable<PhoneNumberMatch> matches = phoneUtil.findNumbers(s.toString(),
- Locale.getDefault().getCountry(), Leniency.VALID, Long.MAX_VALUE);
+ Locale.getDefault().getCountry(), Leniency.POSSIBLE, Long.MAX_VALUE);
for (PhoneNumberMatch match : matches) {
LinkSpec spec = new LinkSpec();
spec.url = "tel:" + PhoneNumberUtils.normalizeNumber(match.rawString());