diff options
author | Sarmad Hashmi <mhashmi@google.com> | 2016-03-17 18:26:25 -0700 |
---|---|---|
committer | Sarmad Hashmi <mhashmi@google.com> | 2016-03-18 10:14:48 -0700 |
commit | 2c39bea963856aaab76716dd2da7540be0562a8e (patch) | |
tree | 8c1631847ed3f1de4d57df7567ae0d59d07d5c38 /src | |
parent | 8196a91d00afb10864d43bc9433bc08b355a03bd (diff) |
Fix dialer crash on unknown number call.
+Number is set to empty string if null
+Added 11 tests for getContactInfo method, mainly testing various
combinations of inputs
BUG=27725458
BUG=27724999
Change-Id: Ic64fbdb7490a3c07145310cf02249555bfc963a3
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/calllog/CallLogNotificationsHelper.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/com/android/dialer/calllog/CallLogNotificationsHelper.java b/src/com/android/dialer/calllog/CallLogNotificationsHelper.java index 189263199..9a5028460 100644 --- a/src/com/android/dialer/calllog/CallLogNotificationsHelper.java +++ b/src/com/android/dialer/calllog/CallLogNotificationsHelper.java @@ -16,6 +16,8 @@ package com.android.dialer.calllog; +import com.google.common.base.Strings; + import android.Manifest; import android.content.ContentResolver; import android.content.ContentUris; @@ -112,12 +114,13 @@ public class CallLogNotificationsHelper { * Otherwise attempt to look it up in the cache. * If that fails, fall back to displaying the number. */ - public @NonNull ContactInfo getContactInfo(@Nullable String number, int numberPresentation, + public ContactInfo getContactInfo(@Nullable String number, int numberPresentation, @Nullable String countryIso) { if (countryIso == null) { countryIso = mCurrentCountryIso; } + number = Strings.nullToEmpty(number); ContactInfo contactInfo = new ContactInfo(); contactInfo.number = number; contactInfo.formattedNumber = PhoneNumberUtils.formatNumber(number, countryIso); |