summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2010-06-07 16:32:53 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2010-06-07 16:32:53 -0700
commit7ad843d66d3ebb9250f00e836f0e8e9502d7287b (patch)
tree0cb1715de919f10f94f82f02aa17ab7a9f1b2185
parenta78b025a18ed6083e5f556526e7b859d83696ac8 (diff)
parent47633f86279bc1854660d95a0b02bfa5ff14ad04 (diff)
downloadframeworks_base-7ad843d66d3ebb9250f00e836f0e8e9502d7287b.zip
frameworks_base-7ad843d66d3ebb9250f00e836f0e8e9502d7287b.tar.gz
frameworks_base-7ad843d66d3ebb9250f00e836f0e8e9502d7287b.tar.bz2
merge from open-source master
Change-Id: I56de40bad4be52a06300bfc310e16d27b2fb14df
-rw-r--r--telephony/java/android/telephony/PhoneNumberUtils.java30
1 files changed, 21 insertions, 9 deletions
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java
index a60d2be..f2212fb 100644
--- a/telephony/java/android/telephony/PhoneNumberUtils.java
+++ b/telephony/java/android/telephony/PhoneNumberUtils.java
@@ -1119,7 +1119,7 @@ public class PhoneNumberUtils
&& text.charAt(2) == '1') {
formatType = FORMAT_JAPAN;
} else {
- return;
+ formatType = FORMAT_UNKNOWN;
}
}
@@ -1130,6 +1130,9 @@ public class PhoneNumberUtils
case FORMAT_JAPAN:
formatJapaneseNumber(text);
return;
+ case FORMAT_UNKNOWN:
+ removeDashes(text);
+ return;
}
}
@@ -1165,14 +1168,7 @@ public class PhoneNumberUtils
CharSequence saved = text.subSequence(0, length);
// Strip the dashes first, as we're going to add them back
- int p = 0;
- while (p < text.length()) {
- if (text.charAt(p) == '-') {
- text.delete(p, p + 1);
- } else {
- p++;
- }
- }
+ removeDashes(text);
length = text.length();
// When scanning the number we record where dashes need to be added,
@@ -1276,6 +1272,22 @@ public class PhoneNumberUtils
JapanesePhoneNumberFormatter.format(text);
}
+ /**
+ * Removes all dashes from the number.
+ *
+ * @param text the number to clear from dashes
+ */
+ private static void removeDashes(Editable text) {
+ int p = 0;
+ while (p < text.length()) {
+ if (text.charAt(p) == '-') {
+ text.delete(p, p + 1);
+ } else {
+ p++;
+ }
+ }
+ }
+
// Three and four digit phone numbers for either special services,
// or 3-6 digit addresses from the network (eg carrier-originated SMS messages) should
// not match.