Merge "Allow google dialer code to be compiled against M and N SDKs" into ub-contactsdialer-b-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 9d5af42..91c91b9 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -17,8 +17,8 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.android.dialer"
     coreApp="true"
-    android:versionCode="20314"
-    android:versionName="2.3.14">
+    android:versionCode="20401"
+    android:versionName="2.04.01">
 
     <uses-sdk
         android:minSdkVersion="23"
diff --git a/src/com/android/dialer/calllog/ContactInfoHelper.java b/src/com/android/dialer/calllog/ContactInfoHelper.java
index 2ecb1e8..1fd2fad 100644
--- a/src/com/android/dialer/calllog/ContactInfoHelper.java
+++ b/src/com/android/dialer/calllog/ContactInfoHelper.java
@@ -26,6 +26,7 @@
 import android.provider.ContactsContract.Contacts;
 import android.provider.ContactsContract.DisplayNameSources;
 import android.provider.ContactsContract.PhoneLookup;
+import android.support.annotation.Nullable;
 import android.telephony.PhoneNumberUtils;
 import android.text.TextUtils;
 import android.util.Log;
@@ -72,6 +73,7 @@
      * @param number the number to look up
      * @param countryIso the country associated with this number
      */
+    @Nullable
     public ContactInfo lookupNumber(String number, String countryIso) {
         if (TextUtils.isEmpty(number)) {
             return null;
diff --git a/src/com/android/dialer/filterednumber/NumbersAdapter.java b/src/com/android/dialer/filterednumber/NumbersAdapter.java
index 4e2e578..17d5db3 100644
--- a/src/com/android/dialer/filterednumber/NumbersAdapter.java
+++ b/src/com/android/dialer/filterednumber/NumbersAdapter.java
@@ -15,10 +15,8 @@
  */
 package com.android.dialer.filterednumber;
 
-import android.app.Activity;
 import android.app.FragmentManager;
 import android.content.Context;
-import android.content.res.Resources;
 import android.provider.ContactsContract;
 import android.provider.ContactsContract.CommonDataKinds.Phone;
 import android.text.BidiFormatter;
@@ -43,7 +41,6 @@
     private Context mContext;
     private FragmentManager mFragmentManager;
     private ContactInfoHelper mContactInfoHelper;
-    private Resources mResources;
     private BidiFormatter mBidiFormatter = BidiFormatter.getInstance();
     private ContactPhotoManager mContactPhotoManager;
 
@@ -68,11 +65,16 @@
         if (CompatUtils.hasPrioritizedMimeType()) {
             quickContactBadge.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE);
         }
-        final ContactInfo info = mContactInfoHelper.lookupNumber(number, countryIso);
+
+        ContactInfo info = mContactInfoHelper.lookupNumber(number, countryIso);
+        if (info == null) {
+            info = new ContactInfo();
+            info.number = number;
+        }
         final CharSequence locationOrType = getNumberTypeOrLocation(info);
         final String displayNumber = getDisplayNumber(info);
-        final String displayNumberStr = mBidiFormatter.unicodeWrap(
-                displayNumber.toString(), TextDirectionHeuristics.LTR);
+        final String displayNumberStr = mBidiFormatter.unicodeWrap(displayNumber,
+                TextDirectionHeuristics.LTR);
 
         String nameForDefaultImage;
         if (!TextUtils.isEmpty(info.name)) {