Merge change I064698b3 into eclair-mr2
* changes:
Add wifi "HANGED" driver state triggering reload.
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java
index a0a1b14..6b33f52aa 100644
--- a/telephony/java/android/telephony/PhoneNumberUtils.java
+++ b/telephony/java/android/telephony/PhoneNumberUtils.java
@@ -378,6 +378,8 @@
compareLoosely(String a, String b) {
int ia, ib;
int matched;
+ int numNonDialableCharsInA = 0;
+ int numNonDialableCharsInB = 0;
if (a == null || b == null) return a == b;
@@ -398,6 +400,7 @@
if (!isDialable(ca)) {
ia--;
skipCmp = true;
+ numNonDialableCharsInA++;
}
cb = b.charAt(ib);
@@ -405,6 +408,7 @@
if (!isDialable(cb)) {
ib--;
skipCmp = true;
+ numNonDialableCharsInB++;
}
if (!skipCmp) {
@@ -416,13 +420,16 @@
}
if (matched < MIN_MATCH) {
- int aLen = a.length();
+ int effectiveALen = a.length() - numNonDialableCharsInA;
+ int effectiveBLen = b.length() - numNonDialableCharsInB;
- // if the input strings match, but their lengths < MIN_MATCH,
- // treat them as equal.
- if (aLen == b.length() && aLen == matched) {
+
+ // if the number of dialable chars in a and b match, but the matched chars < MIN_MATCH,
+ // treat them as equal (i.e. 404-04 and 40404)
+ if (effectiveALen == effectiveBLen && effectiveALen == matched) {
return true;
}
+
return false;
}
diff --git a/tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java b/tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java
index a4e253e..aa2981b 100644
--- a/tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java
+++ b/tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java
@@ -314,6 +314,9 @@
// 444 is not a valid country code, but
// matchIntlPrefixAndCC doesnt know this
assertTrue(PhoneNumberUtils.compare("+444 207 792 3490", "0 207 792 3490"));
+
+ // compare SMS short code
+ assertTrue(PhoneNumberUtils.compare("404-04", "40404"));
}