merge from froyo-plus-aosp

Change-Id: I58f1d905b3fa781e4f5827d4d7b9323a4cdcc04e
This commit is contained in:
The Android Open Source Project
2010-06-07 16:42:09 -07:00
2 changed files with 22 additions and 10 deletions

View File

@ -1221,7 +1221,7 @@ public class Canvas {
checkRange(texs.length, texOffset, vertexCount); checkRange(texs.length, texOffset, vertexCount);
} }
if (colors != null) { if (colors != null) {
checkRange(colors.length, colorOffset, vertexCount); checkRange(colors.length, colorOffset, vertexCount / 2);
} }
if (indices != null) { if (indices != null) {
checkRange(indices.length, indexOffset, indexCount); checkRange(indices.length, indexOffset, indexCount);

View File

@ -1119,7 +1119,7 @@ public class PhoneNumberUtils
&& text.charAt(2) == '1') { && text.charAt(2) == '1') {
formatType = FORMAT_JAPAN; formatType = FORMAT_JAPAN;
} else { } else {
return; formatType = FORMAT_UNKNOWN;
} }
} }
@ -1130,6 +1130,9 @@ public class PhoneNumberUtils
case FORMAT_JAPAN: case FORMAT_JAPAN:
formatJapaneseNumber(text); formatJapaneseNumber(text);
return; return;
case FORMAT_UNKNOWN:
removeDashes(text);
return;
} }
} }
@ -1165,14 +1168,7 @@ public class PhoneNumberUtils
CharSequence saved = text.subSequence(0, length); CharSequence saved = text.subSequence(0, length);
// Strip the dashes first, as we're going to add them back // Strip the dashes first, as we're going to add them back
int p = 0; removeDashes(text);
while (p < text.length()) {
if (text.charAt(p) == '-') {
text.delete(p, p + 1);
} else {
p++;
}
}
length = text.length(); length = text.length();
// When scanning the number we record where dashes need to be added, // When scanning the number we record where dashes need to be added,
@ -1276,6 +1272,22 @@ public class PhoneNumberUtils
JapanesePhoneNumberFormatter.format(text); 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, // Three and four digit phone numbers for either special services,
// or 3-6 digit addresses from the network (eg carrier-originated SMS messages) should // or 3-6 digit addresses from the network (eg carrier-originated SMS messages) should
// not match. // not match.