summaryrefslogtreecommitdiffstats
path: root/telephony/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'telephony/java/android')
-rw-r--r--telephony/java/android/telephony/PhoneNumberUtils.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java
index dbe8431..4ed0a5c6 100644
--- a/telephony/java/android/telephony/PhoneNumberUtils.java
+++ b/telephony/java/android/telephony/PhoneNumberUtils.java
@@ -990,6 +990,7 @@ public class PhoneNumberUtils
* as:
*
* <p><code>
+ * xxxxx
* xxx-xxxx
* xxx-xxx-xxxx
* 1-xxx-xxx-xxxx
@@ -1003,7 +1004,11 @@ public class PhoneNumberUtils
if (length > "+1-nnn-nnn-nnnn".length()) {
// The string is too long to be formatted
return;
+ } else if (length <= 5) {
+ // The string is either a shortcode or too short to be formatted
+ return;
}
+
CharSequence saved = text.subSequence(0, length);
// Strip the dashes first, as we're going to add them back