summaryrefslogtreecommitdiffstats
path: root/telephony/java
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2014-12-15 15:46:17 -0800
committerRaph Levien <raph@google.com>2014-12-15 15:46:17 -0800
commit50e922849399f12d2411a29b2199d8202087492d (patch)
treef36cdc197a4ed63f9c4709b42f5a30ac44e05377 /telephony/java
parent613fffcd0f17eecb0231fe24f7abf7936eef8d37 (diff)
downloadframeworks_base-50e922849399f12d2411a29b2199d8202087492d.zip
frameworks_base-50e922849399f12d2411a29b2199d8202087492d.tar.gz
frameworks_base-50e922849399f12d2411a29b2199d8202087492d.tar.bz2
Preserve leading "+" in phone numbers
The normalizeNumber method in PhoneNumberUtils preserves a leading "+" but only if it's the first character in the string. Thus it gets dropped if there is leading punctuation such as "(". This patch preserves the leading "+" as long as it would be the first character in the normalized phone number. Bug: 18418335 Change-Id: Ifcb1d3dd6c2943c729f570e7f3c90d1da9ee8b4b
Diffstat (limited to 'telephony/java')
-rw-r--r--telephony/java/android/telephony/PhoneNumberUtils.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java
index 4ff6389..ba07a95 100644
--- a/telephony/java/android/telephony/PhoneNumberUtils.java
+++ b/telephony/java/android/telephony/PhoneNumberUtils.java
@@ -1503,7 +1503,7 @@ public class PhoneNumberUtils
int digit = Character.digit(c, 10);
if (digit != -1) {
sb.append(digit);
- } else if (i == 0 && c == '+') {
+ } else if (sb.length() == 0 && c == '+') {
sb.append(c);
} else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
return normalizeNumber(PhoneNumberUtils.convertKeypadLettersToDigits(phoneNumber));