Loading api/test-current.txt +5 −0 Original line number Diff line number Diff line Loading @@ -2847,6 +2847,11 @@ package android.telephony { method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setTransportType(int); } public class PhoneNumberUtils { method public static int getMinMatchForTest(); method public static void setMinMatchForTest(int); } public class ServiceState implements android.os.Parcelable { method public void addNetworkRegistrationInfo(android.telephony.NetworkRegistrationInfo); method public void setCdmaSystemAndNetworkId(int, int); Loading core/res/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -1301,6 +1301,9 @@ <!-- Whether to use the strict phone number matcher in Kazakhstan. --> <bool name="config_use_strict_phone_number_comparation_for_kazakhstan">true</bool> <!-- The character count of the minimum match for comparison phone numbers --> <integer name="config_phonenumber_compare_min_match">7</integer> <!-- Display low battery warning when battery level dips to this value. Also, the battery stats are flushed to disk when we hit this level. --> <integer name="config_criticalBatteryWarningLevel">5</integer> Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -320,6 +320,7 @@ <java-symbol type="bool" name="config_use_strict_phone_number_comparation" /> <java-symbol type="bool" name="config_use_strict_phone_number_comparation_for_russia" /> <java-symbol type="bool" name="config_use_strict_phone_number_comparation_for_kazakhstan" /> <java-symbol type="integer" name="config_phonenumber_compare_min_match" /> <java-symbol type="bool" name="config_single_volume" /> <java-symbol type="bool" name="config_voice_capable" /> <java-symbol type="bool" name="config_requireCallCapableAccountForHandle" /> Loading telephony/java/android/telephony/PhoneNumberUtils.java +36 −26 Original line number Diff line number Diff line Loading @@ -22,9 +22,11 @@ import com.android.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat; import com.android.i18n.phonenumbers.Phonenumber.PhoneNumber; import android.annotation.IntDef; import android.annotation.TestApi; import android.annotation.UnsupportedAppUsage; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.database.Cursor; import android.location.CountryDetector; import android.net.Uri; Loading Loading @@ -164,6 +166,33 @@ public class PhoneNumberUtils { return c == 'w'||c == 'W'; } private static int sMinMatch = 0; private static int getMinMatch() { if (sMinMatch == 0) { sMinMatch = Resources.getSystem().getInteger( com.android.internal.R.integer.config_phonenumber_compare_min_match); } return sMinMatch; } /** * A Test API to get current sMinMatch. * @hide */ @TestApi public static int getMinMatchForTest() { return getMinMatch(); } /** * A Test API to set sMinMatch. * @hide */ @TestApi public static void setMinMatchForTest(int minMatch) { sMinMatch = minMatch; } /** Returns true if ch is not dialable or alpha char */ private static boolean isSeparator(char ch) { Loading Loading @@ -475,7 +504,7 @@ public class PhoneNumberUtils { * enough for caller ID purposes. * * - Compares from right to left * - requires MIN_MATCH (7) characters to match * - requires minimum characters to match * - handles common trunk prefixes and international prefixes * (basically, everything except the Russian trunk prefix) * Loading @@ -491,6 +520,7 @@ public class PhoneNumberUtils { int matched; int numNonDialableCharsInA = 0; int numNonDialableCharsInB = 0; int minMatch = getMinMatch(); if (a == null || b == null) return a == b; Loading Loading @@ -530,12 +560,12 @@ public class PhoneNumberUtils { } } if (matched < MIN_MATCH) { if (matched < minMatch) { int effectiveALen = a.length() - numNonDialableCharsInA; int effectiveBLen = b.length() - numNonDialableCharsInB; // if the number of dialable chars in a and b match, but the matched chars < MIN_MATCH, // if the number of dialable chars in a and b match, but the matched chars < minMatch, // treat them as equal (i.e. 404-04 and 40404) if (effectiveALen == effectiveBLen && effectiveALen == matched) { return true; Loading @@ -545,7 +575,7 @@ public class PhoneNumberUtils { } // At least one string has matched completely; if (matched >= MIN_MATCH && (ia < 0 || ib < 0)) { if (matched >= minMatch && (ia < 0 || ib < 0)) { return true; } Loading Loading @@ -736,7 +766,7 @@ public class PhoneNumberUtils { } /** * Returns the rightmost MIN_MATCH (5) characters in the network portion * Returns the rightmost minimum matched characters in the network portion * in *reversed* order * * This can be used to do a database lookup against the column Loading @@ -747,7 +777,7 @@ public class PhoneNumberUtils { public static String toCallerIDMinMatch(String phoneNumber) { String np = extractNetworkPortionAlt(phoneNumber); return internalGetStrippedReversed(np, MIN_MATCH); return internalGetStrippedReversed(np, getMinMatch()); } /** Loading Loading @@ -1709,26 +1739,6 @@ public class PhoneNumberUtils { return normalizedDigits.toString(); } // 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. // // This constant used to be 5, but SMS short codes has increased in length and // can be easily 6 digits now days. Most countries have SMS short code length between // 3 to 6 digits. The exceptions are // // Australia: Short codes are six or eight digits in length, starting with the prefix "19" // followed by an additional four or six digits and two. // Czechia: Codes are seven digits in length for MO and five (not billed) or // eight (billed) for MT direction // // see http://en.wikipedia.org/wiki/Short_code#Regional_differences for reference // // However, in order to loose match 650-555-1212 and 555-1212, we need to set the min match // to 7. @UnsupportedAppUsage static final int MIN_MATCH = 7; /** * Checks a given number against the list of * emergency numbers provided by the RIL and SIM card. Loading Loading
api/test-current.txt +5 −0 Original line number Diff line number Diff line Loading @@ -2847,6 +2847,11 @@ package android.telephony { method @NonNull public android.telephony.NetworkRegistrationInfo.Builder setTransportType(int); } public class PhoneNumberUtils { method public static int getMinMatchForTest(); method public static void setMinMatchForTest(int); } public class ServiceState implements android.os.Parcelable { method public void addNetworkRegistrationInfo(android.telephony.NetworkRegistrationInfo); method public void setCdmaSystemAndNetworkId(int, int); Loading
core/res/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -1301,6 +1301,9 @@ <!-- Whether to use the strict phone number matcher in Kazakhstan. --> <bool name="config_use_strict_phone_number_comparation_for_kazakhstan">true</bool> <!-- The character count of the minimum match for comparison phone numbers --> <integer name="config_phonenumber_compare_min_match">7</integer> <!-- Display low battery warning when battery level dips to this value. Also, the battery stats are flushed to disk when we hit this level. --> <integer name="config_criticalBatteryWarningLevel">5</integer> Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -320,6 +320,7 @@ <java-symbol type="bool" name="config_use_strict_phone_number_comparation" /> <java-symbol type="bool" name="config_use_strict_phone_number_comparation_for_russia" /> <java-symbol type="bool" name="config_use_strict_phone_number_comparation_for_kazakhstan" /> <java-symbol type="integer" name="config_phonenumber_compare_min_match" /> <java-symbol type="bool" name="config_single_volume" /> <java-symbol type="bool" name="config_voice_capable" /> <java-symbol type="bool" name="config_requireCallCapableAccountForHandle" /> Loading
telephony/java/android/telephony/PhoneNumberUtils.java +36 −26 Original line number Diff line number Diff line Loading @@ -22,9 +22,11 @@ import com.android.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat; import com.android.i18n.phonenumbers.Phonenumber.PhoneNumber; import android.annotation.IntDef; import android.annotation.TestApi; import android.annotation.UnsupportedAppUsage; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.database.Cursor; import android.location.CountryDetector; import android.net.Uri; Loading Loading @@ -164,6 +166,33 @@ public class PhoneNumberUtils { return c == 'w'||c == 'W'; } private static int sMinMatch = 0; private static int getMinMatch() { if (sMinMatch == 0) { sMinMatch = Resources.getSystem().getInteger( com.android.internal.R.integer.config_phonenumber_compare_min_match); } return sMinMatch; } /** * A Test API to get current sMinMatch. * @hide */ @TestApi public static int getMinMatchForTest() { return getMinMatch(); } /** * A Test API to set sMinMatch. * @hide */ @TestApi public static void setMinMatchForTest(int minMatch) { sMinMatch = minMatch; } /** Returns true if ch is not dialable or alpha char */ private static boolean isSeparator(char ch) { Loading Loading @@ -475,7 +504,7 @@ public class PhoneNumberUtils { * enough for caller ID purposes. * * - Compares from right to left * - requires MIN_MATCH (7) characters to match * - requires minimum characters to match * - handles common trunk prefixes and international prefixes * (basically, everything except the Russian trunk prefix) * Loading @@ -491,6 +520,7 @@ public class PhoneNumberUtils { int matched; int numNonDialableCharsInA = 0; int numNonDialableCharsInB = 0; int minMatch = getMinMatch(); if (a == null || b == null) return a == b; Loading Loading @@ -530,12 +560,12 @@ public class PhoneNumberUtils { } } if (matched < MIN_MATCH) { if (matched < minMatch) { int effectiveALen = a.length() - numNonDialableCharsInA; int effectiveBLen = b.length() - numNonDialableCharsInB; // if the number of dialable chars in a and b match, but the matched chars < MIN_MATCH, // if the number of dialable chars in a and b match, but the matched chars < minMatch, // treat them as equal (i.e. 404-04 and 40404) if (effectiveALen == effectiveBLen && effectiveALen == matched) { return true; Loading @@ -545,7 +575,7 @@ public class PhoneNumberUtils { } // At least one string has matched completely; if (matched >= MIN_MATCH && (ia < 0 || ib < 0)) { if (matched >= minMatch && (ia < 0 || ib < 0)) { return true; } Loading Loading @@ -736,7 +766,7 @@ public class PhoneNumberUtils { } /** * Returns the rightmost MIN_MATCH (5) characters in the network portion * Returns the rightmost minimum matched characters in the network portion * in *reversed* order * * This can be used to do a database lookup against the column Loading @@ -747,7 +777,7 @@ public class PhoneNumberUtils { public static String toCallerIDMinMatch(String phoneNumber) { String np = extractNetworkPortionAlt(phoneNumber); return internalGetStrippedReversed(np, MIN_MATCH); return internalGetStrippedReversed(np, getMinMatch()); } /** Loading Loading @@ -1709,26 +1739,6 @@ public class PhoneNumberUtils { return normalizedDigits.toString(); } // 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. // // This constant used to be 5, but SMS short codes has increased in length and // can be easily 6 digits now days. Most countries have SMS short code length between // 3 to 6 digits. The exceptions are // // Australia: Short codes are six or eight digits in length, starting with the prefix "19" // followed by an additional four or six digits and two. // Czechia: Codes are seven digits in length for MO and five (not billed) or // eight (billed) for MT direction // // see http://en.wikipedia.org/wiki/Short_code#Regional_differences for reference // // However, in order to loose match 650-555-1212 and 555-1212, we need to set the min match // to 7. @UnsupportedAppUsage static final int MIN_MATCH = 7; /** * Checks a given number against the list of * emergency numbers provided by the RIL and SIM card. Loading