am 457d5ae3: Fix a potential(observed sometimes) media server crash
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index 345f810..76cde73 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -1221,7 +1221,7 @@
checkRange(texs.length, texOffset, vertexCount);
}
if (colors != null) {
- checkRange(colors.length, colorOffset, vertexCount);
+ checkRange(colors.length, colorOffset, vertexCount / 2);
}
if (indices != null) {
checkRange(indices.length, indexOffset, indexCount);
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 @@
&& text.charAt(2) == '1') {
formatType = FORMAT_JAPAN;
} else {
- return;
+ formatType = FORMAT_UNKNOWN;
}
}
@@ -1130,6 +1130,9 @@
case FORMAT_JAPAN:
formatJapaneseNumber(text);
return;
+ case FORMAT_UNKNOWN:
+ removeDashes(text);
+ return;
}
}
@@ -1165,14 +1168,7 @@
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 @@
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.