summaryrefslogtreecommitdiff
path: root/android/OldPhoneNumberUtils.cpp
AgeCommit message (Collapse)Author
2019-07-18Support loose comparison using minimum matched charsTaesu Lee
Specific min match is required for each country. Test: Manual Change-Id: I2f1355c4ba712170464e4c23a916024e0bf58e71 Merged-In: I2f1355c4ba712170464e4c23a916024e0bf58e71 Signed-off-by: Taesu Lee <taesu82.lee@samsung.com> Bug:134246556
2017-07-18Fix false positives comparing local and intl numbersFrancisco Pimenta
Previously when comparing local phone numbers with international it was possible to match the wrong number because the first digit of the area code was being treated as a skippable trunk digit, e.g: "550-123-4567" would be considered equal to "+14501234567". Since there are two different algorithms (loose/old and strict) there are two solutions with the same basic goal: Only ignore mismatches if there's an actual extra digit which could possibly be the trunk digit, i.e: "0550-123-4567" is acceptable as equal to "+15501234567". NB: The US not having a trunk digit to begin with is a different issue entirely - the code is agnostic on which country has which trunk digits! For "loose" matching we achieve this by checking the length of the mismatch. For "strict" matching we keep track of the supposed trunk digit and compare it against the current position in match. So for the above example 5 != 4. Several new unit tests were added (including replicating tests for OldPhoneNumberUtils). I broke down the c++ tests into smaller methods for additional readability. NB: By adding more tests I uncovered that two digit trunk prefixes were never handled correctly for the "strict" matching case. "Loose" matching is much more robust. I commented out the "strict" test cases. Test: All unit tests pass for PhoneNumberUtilsTest, OldPhoneNumberUtilsTest and DatabaseGeneralTest. Bug: 63179537 Bug: 63178542 Bug: 62916088 Change-Id: Idc2a1c2c2f64ed29995208503de4755c521e1c82
2010-05-19Fix problem with const result from strchr()Mike Lockwood
Needed for simulator build on newer Ubuntu distributions. Change-Id: Ibb8cd3cdb4feae89a20eec56131e322f39721b1a Signed-off-by: Mike Lockwood <lockwood@android.com>
2009-10-23bug #2180646: make comparing "404-04" and "40404" return true in the native ↵Wei Huang
sqlite (loose) phone number comparison method. - when comparing two numbers whose dialable char length is less than the MIN_MATCH (7), treat them as equal if the dialable portion of the numbers match.
2009-09-20make native sqlite phone_number_compare_loosely use MIN_MATCH of 7 instead of 5.Wei Huang
Change-Id: Ie0dde105e810c07e05471182cd0c0f81045731ef
2009-09-20Revert the default phone number comparation algorithm.Daisuke Miyakawa
Now developers have to explicitly set the third argument of PHONE_NUMBERS_COMPARE() into 1, when they want to use "strict" phone number comparation algorithm, which was used in Donut. In default, PHONE_NUMBER_COMPARE() now uses "loose" phone number comparation algorithm, which had been used in Cupcake. Internal issue id: 1892808