From 2c39bea963856aaab76716dd2da7540be0562a8e Mon Sep 17 00:00:00 2001 From: Sarmad Hashmi Date: Thu, 17 Mar 2016 18:26:25 -0700 Subject: 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 --- src/com/android/dialer/calllog/CallLogNotificationsHelper.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/com/android/dialer/calllog') 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); -- cgit v1.2.3