diff options
author | David Brown <dab@google.com> | 2011-11-16 22:11:25 -0800 |
---|---|---|
committer | David Brown <dab@google.com> | 2011-11-17 15:46:30 -0800 |
commit | 643edd29b2234dfa22132b55284c1863f3b1ec5d (patch) | |
tree | ef76bda028a9c24ec3129da080a1293b67fcc3da | |
parent | 1a7f42494dbde3c268bc0763ebd62d55d43027ae (diff) | |
download | Contacts-643edd29b2234dfa22132b55284c1863f3b1ec5d.tar.gz |
Fix a crash caused by SIP addresses containing "%40" instead of "@"
ContactInfoHelper.lookupNumber() was assuming that SIP addresses would
always contain the character '@', but that's not always true since the
username/domainname delimiter can actually be "%40" (the URI-escaped
equivalent.)
This would cause Dialtacts to crash upon launch if you somehow managed to
get a SIP address like "123%40foo" in your call log.
TESTED:
(1) Make an outgoing call to the (malformed) SIP address "123%40foo"
(2) Launch Dialtacts ("Phone")
==> No longer crashes
This change should be submitted after change I62d15a in frameworks/base,
which adds the PhoneNumberUtils.getUsernameFromUriNumber() method.
Bug: 5637074
Change-Id: I06f333cf993ca5e33b88c0c8b9006116b6fd5cf7
-rw-r--r-- | src/com/android/contacts/calllog/ContactInfoHelper.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/com/android/contacts/calllog/ContactInfoHelper.java b/src/com/android/contacts/calllog/ContactInfoHelper.java index b4e4cf7d3..90d5e8b0b 100644 --- a/src/com/android/contacts/calllog/ContactInfoHelper.java +++ b/src/com/android/contacts/calllog/ContactInfoHelper.java @@ -57,8 +57,9 @@ public class ContactInfoHelper { // This "number" is really a SIP address. ContactInfo sipInfo = queryContactInfoForSipAddress(number); if (sipInfo == null || sipInfo == ContactInfo.EMPTY) { - // Check whether the username is actually a phone number of contact. - String username = number.substring(0, number.indexOf('@')); + // Check whether the "username" part of the SIP address is + // actually the phone number of a contact. + String username = PhoneNumberUtils.getUsernameFromUriNumber(number); if (PhoneNumberUtils.isGlobalPhoneNumber(username)) { sipInfo = queryContactInfoForPhoneNumber(username, countryIso); } |