am c1776cbd: am a74ebca7: Merge "Change PhoneCallDetail fields to be non-final." into mnc-dev

* commit 'c1776cbde4851ccbb88378ea77e893919631507f':
  Change PhoneCallDetail fields to be non-final.
diff --git a/src/com/android/dialer/PhoneCallDetails.java b/src/com/android/dialer/PhoneCallDetails.java
index 843e193..68fdadc 100644
--- a/src/com/android/dialer/PhoneCallDetails.java
+++ b/src/com/android/dialer/PhoneCallDetails.java
@@ -16,7 +16,6 @@
 
 package com.android.dialer;
 
-import com.google.common.annotations.VisibleForTesting;
 import com.android.dialer.calllog.PhoneNumberDisplayUtil;
 
 import android.content.Context;
@@ -29,124 +28,81 @@
 
 /**
  * The details of a phone call to be shown in the UI.
- *
- * TODO: Create a builder, to make it easier to construct an instance.
  */
 public class PhoneCallDetails {
-    /** The number of the other party involved in the call. */
-    public final CharSequence number;
-    /** The number presenting rules set by the network, e.g., {@link Calls#PRESENTATION_ALLOWED} */
-    public final int numberPresentation;
-    /** The formatted version of {@link #number}. */
-    public final CharSequence formattedNumber;
-    /** The country corresponding with the phone number. */
-    public final String countryIso;
-    /** The geocoded location for the phone number. */
-    public final String geocode;
+    // The number of the other party involved in the call.
+    public CharSequence number;
+    // The number presenting rules set by the network, e.g., {@link Calls#PRESENTATION_ALLOWED}
+    public int numberPresentation;
+    // The formatted version of {@link #number}.
+    public CharSequence formattedNumber;
+    // The country corresponding with the phone number.
+    public String countryIso;
+    // The geocoded location for the phone number.
+    public String geocode;
+
     /**
      * The type of calls, as defined in the call log table, e.g., {@link Calls#INCOMING_TYPE}.
      * <p>
      * There might be multiple types if this represents a set of entries grouped together.
      */
-    public final int[] callTypes;
-    /** The date of the call, in milliseconds since the epoch. */
-    public final long date;
-    /** The duration of the call in milliseconds, or 0 for missed calls. */
-    public final long duration;
-    /** The name of the contact, or the empty string. */
-    public final CharSequence name;
-    /** The type of phone, e.g., {@link Phone#TYPE_HOME}, 0 if not available. */
-    public final int numberType;
-    /** The custom label associated with the phone number in the contact, or the empty string. */
-    public final CharSequence numberLabel;
-    /** The URI of the contact associated with this phone call. */
-    public final Uri contactUri;
+    public int[] callTypes;
+
+    // The date of the call, in milliseconds since the epoch.
+    public long date;
+    // The duration of the call in milliseconds, or 0 for missed calls.
+    public long duration;
+    // The name of the contact, or the empty string.
+    public CharSequence name;
+    // The type of phone, e.g., {@link Phone#TYPE_HOME}, 0 if not available.
+    public int numberType;
+    // The custom label associated with the phone number in the contact, or the empty string.
+    public CharSequence numberLabel;
+    // The URI of the contact associated with this phone call.
+    public Uri contactUri;
     /**
      * The photo URI of the picture of the contact that is associated with this phone call or
      * null if there is none.
      * <p>
      * This is meant to store the high-res photo only.
      */
-    public final Uri photoUri;
-    /**
-     * The source type of the contact associated with this call.
-     */
-    public final int sourceType;
+    public Uri photoUri;
+
+    // The source type of the contact associated with this call.
+    public int sourceType;
+
+    // The unique identifier for the account associated with the call.
+    public PhoneAccountHandle accountHandle;
+
+    // Features applicable to this call.
+    public int features;
+
+    // Total data usage for this call.
+    public Long dataUsage;
+
+    // Voicemail transcription
+    public String transcription;
+
+    public String displayNumber;
+    public boolean isVoicemail;
 
     /**
-     * The unique identifier for the account associated with the call.
+     * Constructor with required fields for the details of a call with a number associated with a
+     * contact.
      */
-    public final PhoneAccountHandle accountHandle;
-    /**
-     * Features applicable to this call.
-     */
-    public final int features;
-    /**
-     * Total data usage for this call.
-     */
-    public final Long dataUsage;
-    /**
-     * Voicemail transcription
-     */
-    public final String transcription;
-
-    public final String displayNumber;
-    public final boolean isVoicemail;
-
-    /**
-     * Create the details for a call, with empty defaults specified for extra fields that are
-     * not necessary for testing.
-     */
-    @VisibleForTesting
-    public PhoneCallDetails(Context context, CharSequence number, int numberPresentation,
-            CharSequence formattedNumber, String countryIso, String geocode,
-            int[] callTypes, long date, long duration, boolean isVoicemail) {
-        this(context, number, numberPresentation, formattedNumber, countryIso, geocode,
-                callTypes, date, duration, "", 0, "", null, null, 0, null, 0, null, null,
-                isVoicemail);
-    }
-
-    /** Create the details for a call with a number not associated with a contact. */
-    public PhoneCallDetails(Context context, CharSequence number, int numberPresentation,
-            CharSequence formattedNumber, String countryIso, String geocode,
-            int[] callTypes, long date, long duration,
-            PhoneAccountHandle accountHandle, int features, Long dataUsage, String transcription,
+    public PhoneCallDetails(
+            Context context,
+            CharSequence number,
+            int numberPresentation,
+            CharSequence formattedNumber,
             boolean isVoicemail) {
-        this(context, number, numberPresentation, formattedNumber, countryIso, geocode,
-                callTypes, date, duration, "", 0, "", null, null, 0, accountHandle, features,
-                dataUsage, transcription, isVoicemail);
-    }
-
-    /** Create the details for a call with a number associated with a contact. */
-    public PhoneCallDetails(Context context, CharSequence number, int numberPresentation,
-            CharSequence formattedNumber, String countryIso, String geocode,
-            int[] callTypes, long date, long duration, CharSequence name,
-            int numberType, CharSequence numberLabel, Uri contactUri, Uri photoUri,
-            int sourceType, PhoneAccountHandle accountHandle, int features, Long dataUsage,
-            String transcription, boolean isVoicemail) {
         this.number = number;
         this.numberPresentation = numberPresentation;
         this.formattedNumber = formattedNumber;
-        this.countryIso = countryIso;
-        this.geocode = geocode;
-        this.callTypes = callTypes;
-        this.date = date;
-        this.duration = duration;
-        this.name = name;
-        this.numberType = numberType;
-        this.numberLabel = numberLabel;
-        this.contactUri = contactUri;
-        this.photoUri = photoUri;
-        this.sourceType = sourceType;
-        this.accountHandle = accountHandle;
-        this.features = features;
-        this.dataUsage = dataUsage;
-        this.transcription = transcription;
         this.isVoicemail = isVoicemail;
 
         this.displayNumber = PhoneNumberDisplayUtil.getDisplayNumber(
                 context,
-                this.accountHandle,
                 this.number,
                 this.numberPresentation,
                 this.formattedNumber,
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index 6862f68..daa7350 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -350,46 +350,13 @@
         }
         int count = getGroupSize(position);
 
-        CallLogListItemViewHolder views = (CallLogListItemViewHolder) viewHolder;
-
-        // Default case: an item in the call log.
-        views.primaryActionView.setVisibility(View.VISIBLE);
-
         final String number = c.getString(CallLogQuery.NUMBER);
         final int numberPresentation = c.getInt(CallLogQuery.NUMBER_PRESENTATION);
-        final long date = c.getLong(CallLogQuery.DATE);
-        final long duration = c.getLong(CallLogQuery.DURATION);
-        final int callType = c.getInt(CallLogQuery.CALL_TYPE);
         final PhoneAccountHandle accountHandle = PhoneAccountUtils.getAccount(
                 c.getString(CallLogQuery.ACCOUNT_COMPONENT_NAME),
                 c.getString(CallLogQuery.ACCOUNT_ID));
         final String countryIso = c.getString(CallLogQuery.COUNTRY_ISO);
-
-        final long rowId = c.getLong(CallLogQuery.ID);
-        views.rowId = rowId;
-
-        // Check if the day group has changed and display a header if necessary.
-        int currentGroup = getDayGroupForCall(rowId);
-        int previousGroup = getPreviousDayGroup(c);
-        if (currentGroup != previousGroup) {
-            views.dayGroupHeader.setVisibility(View.VISIBLE);
-            views.dayGroupHeader.setText(getGroupDescription(currentGroup));
-        } else {
-            views.dayGroupHeader.setVisibility(View.GONE);
-        }
-
-        // Store some values used when the actions ViewStub is inflated on expansion of the actions
-        // section.
-        views.number = number;
-        views.numberPresentation = numberPresentation;
-        views.callType = callType;
-        views.accountHandle = accountHandle;
-        views.voicemailUri = c.getString(CallLogQuery.VOICEMAIL_URI);
-        // Stash away the Ids of the calls so that we can support deleting a row in the call log.
-        views.callIds = getCallIds(c, count);
-
         final ContactInfo cachedContactInfo = mContactInfoHelper.getContactInfo(c);
-
         final boolean isVoicemailNumber =
                 mPhoneNumberUtilsWrapper.isVoicemailNumber(accountHandle, number);
 
@@ -402,66 +369,81 @@
             // Lookup contacts with this number
             info = mContactInfoCache.getValue(number, countryIso, cachedContactInfo);
         }
-
-        final Uri lookupUri = info.lookupUri;
-        final String name = info.name;
-        final int ntype = info.type;
-        final String label = info.label;
-        final long photoId = info.photoId;
-        final Uri photoUri = info.photoUri;
         CharSequence formattedNumber = info.formattedNumber == null
                 ? null : PhoneNumberUtils.createTtsSpannable(info.formattedNumber);
-        final int[] callTypes = getCallTypes(c, count);
-        final String geocode = c.getString(CallLogQuery.GEOCODED_LOCATION);
-        final int sourceType = info.sourceType;
-        final int features = getCallFeatures(c, count);
-        final String transcription = c.getString(CallLogQuery.TRANSCRIPTION);
-        Long dataUsage = null;
+
+        final PhoneCallDetails details = new PhoneCallDetails(
+                mContext, number, numberPresentation, formattedNumber, isVoicemailNumber);
+        details.accountHandle = accountHandle;
+        details.callTypes = getCallTypes(c, count);
+        details.countryIso = countryIso;
+        details.date = c.getLong(CallLogQuery.DATE);
+        details.duration = c.getLong(CallLogQuery.DURATION);
+        details.features = getCallFeatures(c, count);
+        details.geocode = c.getString(CallLogQuery.GEOCODED_LOCATION);
+        details.transcription = c.getString(CallLogQuery.TRANSCRIPTION);
+
         if (!c.isNull(CallLogQuery.DATA_USAGE)) {
-            dataUsage = c.getLong(CallLogQuery.DATA_USAGE);
+            details.dataUsage = c.getLong(CallLogQuery.DATA_USAGE);
         }
 
-        final PhoneCallDetails details;
+        if (!TextUtils.isEmpty(info.name)) {
+            details.contactUri = info.lookupUri;
+            details.name = info.name;
+            details.numberType = info.type;
+            details.numberLabel = info.label;
+            details.photoUri = info.photoUri;
+            details.sourceType = info.sourceType;
+        }
 
+        CallLogListItemViewHolder views = (CallLogListItemViewHolder) viewHolder;
         views.info = info;
+        views.rowId = c.getLong(CallLogQuery.ID);
+        // Store values used when the actions ViewStub is inflated on expansion.
+        views.number = number;
+        views.numberPresentation = numberPresentation;
+        views.callType = c.getInt(CallLogQuery.CALL_TYPE);
+        views.accountHandle = accountHandle;
+        views.voicemailUri = c.getString(CallLogQuery.VOICEMAIL_URI);
+        // Stash away the Ids of the calls so that we can support deleting a row in the call log.
+        views.callIds = getCallIds(c, count);
 
         // The entry can only be reported as invalid if it has a valid ID and the source of the
         // entry supports marking entries as invalid.
-        views.canBeReportedAsInvalid = mContactInfoHelper.canReportAsInvalid(info.sourceType,
-                info.objectId);
+        views.canBeReportedAsInvalid = mContactInfoHelper.canReportAsInvalid(
+                info.sourceType, info.objectId);
+
+        // Default case: an item in the call log.
+        views.primaryActionView.setVisibility(View.VISIBLE);
+
+        // Check if the day group has changed and display a header if necessary.
+        int currentGroup = getDayGroupForCall(views.rowId);
+        int previousGroup = getPreviousDayGroup(c);
+        if (currentGroup != previousGroup) {
+            views.dayGroupHeader.setVisibility(View.VISIBLE);
+            views.dayGroupHeader.setText(getGroupDescription(currentGroup));
+        } else {
+            views.dayGroupHeader.setVisibility(View.GONE);
+        }
 
         // Update the expanded position if the rowIds match, in case ViewHolders were added/removed.
-        if (mCurrentlyExpandedRowId == rowId) {
+        // Then restore the state of the row on rebind.
+        if (mCurrentlyExpandedRowId == views.rowId) {
             mCurrentlyExpandedPosition = position;
         }
-        // Restore expansion state of the row on rebind. Inflate the actions ViewStub if required,
-        // and set its visibility state accordingly.
         views.showActions(mCurrentlyExpandedPosition == position, mOnReportButtonClickListener);
-
-        if (TextUtils.isEmpty(name)) {
-            details = new PhoneCallDetails(mContext, number, numberPresentation, formattedNumber,
-                    countryIso, geocode, callTypes, date, duration, accountHandle, features,
-                    dataUsage, transcription, isVoicemailNumber);
-        } else {
-            details = new PhoneCallDetails(mContext, number, numberPresentation, formattedNumber,
-                    countryIso, geocode, callTypes, date, duration, name, ntype, label, lookupUri,
-                    photoUri, sourceType, accountHandle, features, dataUsage, transcription,
-                    isVoicemailNumber);
-        }
-
-        mCallLogViewsHelper.setPhoneCallDetails(mContext, views, details);
+        views.updateCallButton();
 
         String nameForDefaultImage = null;
-        if (TextUtils.isEmpty(name)) {
+        if (TextUtils.isEmpty(info.name)) {
             nameForDefaultImage = details.displayNumber;
         } else {
-            nameForDefaultImage = name;
+            nameForDefaultImage = info.name;
         }
+        views.setPhoto(info.photoId, info.photoUri, info.lookupUri, nameForDefaultImage,
+                isVoicemailNumber, mContactInfoHelper.isBusiness(info.sourceType));
 
-        views.setPhoto(photoId, photoUri, lookupUri, nameForDefaultImage, isVoicemailNumber,
-                mContactInfoHelper.isBusiness(info.sourceType));
-
-        views.updateCallButton();
+        mCallLogViewsHelper.setPhoneCallDetails(mContext, views, details);
 
         // Listen for the first draw
         if (mViewTreeObserver == null) {
diff --git a/src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java b/src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java
index aa186eb..97fc324 100644
--- a/src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java
+++ b/src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java
@@ -139,35 +139,15 @@
             }
 
             // Read call log.
+            final String countryIso = cursor.getString(CallDetailQuery.COUNTRY_ISO_COLUMN_INDEX);
             final String number = cursor.getString(CallDetailQuery.NUMBER_COLUMN_INDEX);
             final int numberPresentation =
                     cursor.getInt(CallDetailQuery.NUMBER_PRESENTATION_COLUMN_INDEX);
-            final long date = cursor.getLong(CallDetailQuery.DATE_COLUMN_INDEX);
-            final long duration = cursor.getLong(CallDetailQuery.DURATION_COLUMN_INDEX);
-            final int callType = cursor.getInt(CallDetailQuery.CALL_TYPE_COLUMN_INDEX);
-            final String geocode = cursor.getString(CallDetailQuery.GEOCODED_LOCATION_COLUMN_INDEX);
-            final String transcription =
-                    cursor.getString(CallDetailQuery.TRANSCRIPTION_COLUMN_INDEX);
 
             final PhoneAccountHandle accountHandle = PhoneAccountUtils.getAccount(
                     cursor.getString(CallDetailQuery.ACCOUNT_COMPONENT_NAME),
                     cursor.getString(CallDetailQuery.ACCOUNT_ID));
 
-            String countryIso = cursor.getString(CallDetailQuery.COUNTRY_ISO_COLUMN_INDEX);
-            if (TextUtils.isEmpty(countryIso)) {
-                countryIso = GeoUtil.getCurrentCountryIso(context);
-            }
-
-            // Formatted phone number.
-            final CharSequence formattedNumber;
-            // Read contact specifics.
-            final CharSequence nameText;
-            final int numberType;
-            final CharSequence numberLabel;
-            final Uri photoUri;
-            final Uri lookupUri;
-            int sourceType;
-
             // If this is not a regular number, there is no point in looking it up in the contacts.
             ContactInfoHelper contactInfoHelper =
                     new ContactInfoHelper(context, GeoUtil.getCurrentCountryIso(context));
@@ -178,39 +158,36 @@
                     PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation)
                             && !isVoicemail;
             ContactInfo info = shouldLookupNumber
-                            ? contactInfoHelper.lookupNumber(number, countryIso) : null;
+                            ? contactInfoHelper.lookupNumber(number, countryIso)
+                            : ContactInfo.EMPTY;
+            PhoneCallDetails details = new PhoneCallDetails(
+                    context, number, numberPresentation, info.formattedNumber, isVoicemail);
 
-            if (info == null) {
-                formattedNumber = PhoneNumberDisplayUtil.getDisplayNumber(
-                        context, accountHandle, number, numberPresentation, null, isVoicemail);
-                nameText = "";
-                numberType = 0;
-                numberLabel = "";
-                photoUri = null;
-                lookupUri = null;
-                sourceType = 0;
-            } else {
-                formattedNumber = info.formattedNumber;
-                nameText = info.name;
-                numberType = info.type;
-                numberLabel = info.label;
-                photoUri = info.photoUri;
-                lookupUri = info.lookupUri;
-                sourceType = info.sourceType;
-            }
+            details.accountHandle = accountHandle;
+            details.contactUri = info.lookupUri;
+            details.name = info.name;
+            details.numberType = info.type;
+            details.numberLabel = info.label;
+            details.photoUri = info.photoUri;
+            details.sourceType = info.sourceType;
 
+            details.callTypes = new int[] {
+                    cursor.getInt(CallDetailQuery.CALL_TYPE_COLUMN_INDEX)
+            };
+            details.date = cursor.getLong(CallDetailQuery.DATE_COLUMN_INDEX);
+            details.duration = cursor.getLong(CallDetailQuery.DURATION_COLUMN_INDEX);
+            details.features = cursor.getInt(CallDetailQuery.FEATURES);
+            details.geocode = cursor.getString(CallDetailQuery.GEOCODED_LOCATION_COLUMN_INDEX);
+            details.transcription = cursor.getString(CallDetailQuery.TRANSCRIPTION_COLUMN_INDEX);
 
-            final int features = cursor.getInt(CallDetailQuery.FEATURES);
+            details.countryIso = !TextUtils.isEmpty(countryIso) ? countryIso
+                    : GeoUtil.getCurrentCountryIso(context);
 
-            Long dataUsage = null;
             if (!cursor.isNull(CallDetailQuery.DATA_USAGE)) {
-                dataUsage = cursor.getLong(CallDetailQuery.DATA_USAGE);
+                details.dataUsage = cursor.getLong(CallDetailQuery.DATA_USAGE);
             }
 
-            return new PhoneCallDetails(context, number, numberPresentation, formattedNumber,
-                    countryIso, geocode, new int[]{ callType }, date, duration, nameText,
-                    numberType, numberLabel, lookupUri, photoUri, sourceType, accountHandle,
-                    features, dataUsage, transcription, isVoicemail);
+            return details;
         } finally {
             if (cursor != null) {
                 cursor.close();
diff --git a/src/com/android/dialer/calllog/CallLogListItemHelper.java b/src/com/android/dialer/calllog/CallLogListItemHelper.java
index 4eb8797..6e3e8b5 100644
--- a/src/com/android/dialer/calllog/CallLogListItemHelper.java
+++ b/src/com/android/dialer/calllog/CallLogListItemHelper.java
@@ -186,7 +186,7 @@
             callDescription.append(mResources.getString(R.string.description_video_call));
         }
 
-        int stringID = getCallDescriptionStringID(details);
+        int stringID = getCallDescriptionStringID(details.callTypes);
         String accountLabel = PhoneAccountUtils.getAccountLabel(context, details.accountHandle);
 
         // Use chosen string resource to build up the message.
@@ -213,8 +213,8 @@
      * @param details Call details.
      * @return String resource ID to use.
      */
-    public int getCallDescriptionStringID(PhoneCallDetails details) {
-        int lastCallType = getLastCallType(details.callTypes);
+    public int getCallDescriptionStringID(int[] callTypes) {
+        int lastCallType = getLastCallType(callTypes);
         int stringID;
 
         if (lastCallType == Calls.VOICEMAIL_TYPE || lastCallType == Calls.MISSED_TYPE) {
diff --git a/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java b/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
index 7c2a966..942a73f 100644
--- a/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
+++ b/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
@@ -28,7 +28,6 @@
 import android.net.Uri;
 import android.provider.CallLog.Calls;
 import android.provider.ContactsContract.PhoneLookup;
-import android.telecom.PhoneAccountHandle;
 import android.text.TextUtils;
 import android.util.Log;
 
@@ -122,12 +121,8 @@
             // Check if we already know the name associated with this number.
             String name = names.get(newCall.number);
             if (name == null) {
-                PhoneAccountHandle accountHandle = PhoneAccountUtils.getAccount(
-                        newCall.accountComponentName,
-                        newCall.accountId);
                 name = PhoneNumberDisplayUtil.getDisplayName(
                         mContext,
-                        accountHandle,
                         newCall.number,
                         newCall.numberPresentation,
                         /* isVoicemail */ false).toString();
diff --git a/src/com/android/dialer/calllog/PhoneNumberDisplayUtil.java b/src/com/android/dialer/calllog/PhoneNumberDisplayUtil.java
index acfd32c..f80c2bc 100644
--- a/src/com/android/dialer/calllog/PhoneNumberDisplayUtil.java
+++ b/src/com/android/dialer/calllog/PhoneNumberDisplayUtil.java
@@ -19,7 +19,6 @@
 import android.content.Context;
 import android.content.res.Resources;
 import android.provider.CallLog.Calls;
-import android.telecom.PhoneAccountHandle;
 import android.text.TextUtils;
 import android.util.Log;
 
@@ -35,7 +34,6 @@
      */
     /* package */ static CharSequence getDisplayName(
             Context context,
-            PhoneAccountHandle accountHandle,
             CharSequence number,
             int presentation,
             boolean isVoicemail) {
@@ -60,19 +58,16 @@
     /**
      * Returns the string to display for the given phone number.
      *
-     * @param accountHandle The handle for the account corresponding to the call
      * @param number the number to display
      * @param formattedNumber the formatted number if available, may be null
      */
     public static CharSequence getDisplayNumber(
             Context context,
-            PhoneAccountHandle accountHandle,
             CharSequence number,
             int presentation,
             CharSequence formattedNumber,
             boolean isVoicemail) {
-        final CharSequence displayName =
-                getDisplayName(context, accountHandle, number, presentation, isVoicemail);
+        final CharSequence displayName = getDisplayName(context, number, presentation, isVoicemail);
         if (!TextUtils.isEmpty(displayName)) {
             return displayName;
         }
diff --git a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java
index 3e7eb66..9edbbc9 100644
--- a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java
+++ b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java
@@ -25,6 +25,7 @@
 import android.view.View;
 import android.widget.TextView;
 
+import com.android.dialer.calllog.ContactInfo;
 import com.android.dialer.calllog.TestPhoneNumberUtilsWrapper;
 import com.android.dialer.util.LocaleTestUtils;
 
@@ -165,7 +166,10 @@
      * Tests a case where the video call feature is present.
      */
     public void testSetPhoneCallDetails_Video() {
-        setPhoneCallDetailsWithFeatures(Calls.FEATURES_VIDEO);
+        PhoneCallDetails details = getPhoneCallDetails();
+        details.features = Calls.FEATURES_VIDEO;
+        mHelper.setPhoneCallDetails(mViews, details);
+
         assertIsVideoCall(true);
     }
 
@@ -173,7 +177,10 @@
      * Tests a case where the video call feature is not present.
      */
     public void testSetPhoneCallDetails_NoVideo() {
-        setPhoneCallDetailsWithFeatures(0);
+        PhoneCallDetails details = getPhoneCallDetails();
+        details.features = 0;
+        mHelper.setPhoneCallDetails(mViews, details);
+
         assertIsVideoCall(false);
     }
 
@@ -245,7 +252,11 @@
     }
 
     public void testSetCallDetailsHeader_VoicemailNumber() {
-        setCallDetailsHeaderWithVoicemailNumber(TEST_VOICEMAIL_NUMBER, Calls.PRESENTATION_ALLOWED);
+        PhoneCallDetails details = getPhoneCallDetails(
+                TEST_VOICEMAIL_NUMBER,
+                Calls.PRESENTATION_ALLOWED,
+                TEST_FORMATTED_NUMBER);
+        mHelper.setCallDetailsHeader(mNameView, details);
         assertEquals(View.VISIBLE, mNameView.getVisibility());
         assertEquals("Voicemail", mNameView.getText().toString());
     }
@@ -310,140 +321,75 @@
     /** Sets the phone call details with default values and the given number. */
     private void setPhoneCallDetailsWithNumber(String number, int presentation,
             String formattedNumber) {
-        mHelper.setPhoneCallDetails(mViews,
-                new PhoneCallDetails(
-                        mContext,
-                        number,
-                        presentation,
-                        formattedNumber,
-                        TEST_COUNTRY_ISO,
-                        TEST_GEOCODE,
-                        new int[]{ Calls.VOICEMAIL_TYPE },
-                        TEST_DATE,
-                        TEST_DURATION,
-                        isVoicemail(number)));
+        PhoneCallDetails details = getPhoneCallDetails(number, presentation, formattedNumber);
+        details.callTypes = new int[]{ Calls.VOICEMAIL_TYPE };
+        mHelper.setPhoneCallDetails(mViews, details);
     }
 
     /** Sets the phone call details with default values and the given number. */
-    private void setPhoneCallDetailsWithNumberAndGeocode(String number, String formattedNumber,
-            String geocodedLocation) {
-        mHelper.setPhoneCallDetails(mViews,
-                new PhoneCallDetails(
-                        mContext,
-                        number,
-                        Calls.PRESENTATION_ALLOWED,
-                        formattedNumber,
-                        TEST_COUNTRY_ISO,
-                        geocodedLocation,
-                        new int[]{ Calls.VOICEMAIL_TYPE },
-                        TEST_DATE,
-                        TEST_DURATION,
-                        isVoicemail(number)));
+    private void setPhoneCallDetailsWithNumberAndGeocode(
+            String number, String formattedNumber, String geocodedLocation) {
+        PhoneCallDetails details = getPhoneCallDetails(
+                number, Calls.PRESENTATION_ALLOWED, formattedNumber);
+        details.geocode = geocodedLocation;
+        mHelper.setPhoneCallDetails(mViews, details);
     }
 
     /** Sets the phone call details with default values and the given date. */
     private void setPhoneCallDetailsWithDate(long date) {
-        mHelper.setPhoneCallDetails(mViews,
-                new PhoneCallDetails(
-                        mContext,
-                        TEST_NUMBER,
-                        Calls.PRESENTATION_ALLOWED,
-                        TEST_FORMATTED_NUMBER,
-                        TEST_COUNTRY_ISO,
-                        TEST_GEOCODE,
-                        new int[]{ Calls.INCOMING_TYPE },
-                        date,
-                        TEST_DURATION,
-                        false /* isVoicemail */));
+        PhoneCallDetails details = getPhoneCallDetails();
+        details.date = date;
+        mHelper.setPhoneCallDetails(mViews, details);
     }
 
     /** Sets the phone call details with default values and the given call types using icons. */
     private void setPhoneCallDetailsWithCallTypeIcons(int... callTypes) {
-        mHelper.setPhoneCallDetails(mViews,
-                new PhoneCallDetails(
-                        mContext,
-                        TEST_NUMBER,
-                        Calls.PRESENTATION_ALLOWED,
-                        TEST_FORMATTED_NUMBER,
-                        TEST_COUNTRY_ISO,
-                        TEST_GEOCODE,
-                        callTypes,
-                        TEST_DATE,
-                        TEST_DURATION,
-                        false /* isVoicemail */));
-    }
-
-    /**
-     * Sets the phone call details with default values and the given call features.
-     */
-    private void setPhoneCallDetailsWithFeatures(int features) {
-        mHelper.setPhoneCallDetails(mViews,
-                new PhoneCallDetails(
-                        mContext,
-                        TEST_NUMBER,
-                        Calls.PRESENTATION_ALLOWED,
-                        TEST_FORMATTED_NUMBER,
-                        TEST_COUNTRY_ISO,
-                        TEST_GEOCODE,
-                        new int[]{ Calls.INCOMING_TYPE },
-                        TEST_DATE,
-                        TEST_DURATION,
-                        null,
-                        features,
-                        null,
-                        null,
-                        false /* isVoicemail */)
-        );
+        PhoneCallDetails details = getPhoneCallDetails();
+        details.callTypes = callTypes;
+        mHelper.setPhoneCallDetails(mViews, details);
     }
 
     private void setCallDetailsHeaderWithNumber(String number, int presentation) {
         mHelper.setCallDetailsHeader(mNameView,
-                new PhoneCallDetails(
-                        mContext,
-                        number,
-                        presentation,
-                        TEST_FORMATTED_NUMBER,
-                        TEST_COUNTRY_ISO,
-                        TEST_GEOCODE,
-                        new int[]{ Calls.INCOMING_TYPE },
-                        TEST_DATE,
-                        TEST_DURATION,
-                        null, 0, null,  null,
-                        false /* isVoicemail */));
+                getPhoneCallDetails(number, presentation, TEST_FORMATTED_NUMBER));
     }
 
-    private void setCallDetailsHeaderWithVoicemailNumber(String number, int presentation) {
-        mHelper.setCallDetailsHeader(mNameView,
-                new PhoneCallDetails(
-                        mContext,
-                        number,
-                        presentation,
-                        TEST_FORMATTED_NUMBER,
-                        TEST_COUNTRY_ISO,
-                        TEST_GEOCODE,
-                        new int[]{ Calls.INCOMING_TYPE },
-                        TEST_DATE,
-                        TEST_DURATION,
-                        null, 0, null,  null,
-                        true /* isVoicemail */));
-    }
-
-
     private void setCallDetailsHeader(String name) {
-        mHelper.setCallDetailsHeader(mNameView,
-                new PhoneCallDetails(
-                        mContext,
-                        TEST_NUMBER,
-                        Calls.PRESENTATION_ALLOWED,
-                        TEST_FORMATTED_NUMBER,
-                        TEST_COUNTRY_ISO,
-                        TEST_GEOCODE,
-                        new int[]{ Calls.INCOMING_TYPE },
-                        TEST_DATE,
-                        TEST_DURATION,
-                        name,
-                        0, "", null, null, 0, null, 0, null, null,
-                        false /* isVoicemail */));
+        PhoneCallDetails details = getPhoneCallDetails();
+        details.name = name;
+        mHelper.setCallDetailsHeader(mNameView, details);
+    }
+
+    private PhoneCallDetails getPhoneCallDetails() {
+        PhoneCallDetails details = new PhoneCallDetails(
+                mContext,
+                TEST_NUMBER,
+                Calls.PRESENTATION_ALLOWED,
+                TEST_FORMATTED_NUMBER,
+                false /* isVoicemail */);
+        setDefaultDetails(details);
+        return details;
+    }
+
+    private PhoneCallDetails getPhoneCallDetails(
+            String number, int presentation, String formattedNumber) {
+        PhoneCallDetails details = new PhoneCallDetails(
+                mContext,
+                number,
+                presentation,
+                formattedNumber,
+                isVoicemail(number));
+        setDefaultDetails(details);
+        return details;
+    }
+
+    private void setDefaultDetails(PhoneCallDetails details) {
+        details.callTypes = new int[]{ Calls.INCOMING_TYPE };
+        details.countryIso = TEST_COUNTRY_ISO;
+        details.date = TEST_DATE;
+        details.duration = TEST_DURATION;
+        details.geocode = TEST_GEOCODE;
+        details.numberLabel = ContactInfo.GEOCODE_AS_LABEL;
     }
 
     private boolean isVoicemail(String number) {
diff --git a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
index a7d9b99..091065b 100644
--- a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
+++ b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
@@ -103,12 +103,14 @@
     }
 
     public void testSetPhoneCallDetails_ReadVoicemail() {
-        setPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE);
+        PhoneCallDetails details = getPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE);
+        mHelper.setPhoneCallDetails(getContext(), mViewHolder, details);
         assertEquals(View.VISIBLE, mViewHolder.voicemailPlaybackView.getVisibility());
     }
 
     public void testSetPhoneCallDetails_UnreadVoicemail() {
-        setUnreadPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE);
+        PhoneCallDetails details = getPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE);
+        mHelper.setPhoneCallDetails(getContext(), mViewHolder, details);
         assertEquals(View.VISIBLE, mViewHolder.voicemailPlaybackView.getVisibility());
     }
 
@@ -120,121 +122,29 @@
 
     /**
      * Test getCallDescriptionID method used to get the accessibility description for calls.
-     * Test case where an answered unknown call is received.
      */
-    public void testGetCallDescriptionID_UnknownAnswered() {
-        PhoneCallDetails details = new PhoneCallDetails(
-                mContext,
-                "",
-                Calls.PRESENTATION_UNKNOWN,
-                "",
-                TEST_COUNTRY_ISO,
-                TEST_GEOCODE,
-                new int[]{Calls.INCOMING_TYPE},
-                TEST_DATE,
-                TEST_DURATION,
-                false /* isVoicemail */);
+    public void testGetCallDescriptionID_Answered() {
+        int[] callTypes = new int[]{ Calls.INCOMING_TYPE };
         assertEquals(R.string.description_incoming_answered_call,
-                mHelper.getCallDescriptionStringID(details));
+                mHelper.getCallDescriptionStringID(callTypes));
     }
 
     /**
      * Test getCallDescriptionID method used to get the accessibility description for calls.
-     * Test case where an missed unknown call is received.
      */
-    public void testGetCallDescriptionID_UnknownMissed() {
-        PhoneCallDetails details = new PhoneCallDetails(
-                mContext,
-                "",
-                Calls.PRESENTATION_UNKNOWN,
-                "",
-                TEST_COUNTRY_ISO,
-                TEST_GEOCODE,
-                new int[]{Calls.MISSED_TYPE},
-                TEST_DATE,
-                TEST_DURATION,
-                false /* isVoicemail */);
+    public void testGetCallDescriptionID_Missed() {
+        int[] callTypes = new int[]{ Calls.MISSED_TYPE };
         assertEquals(R.string.description_incoming_missed_call,
-                mHelper.getCallDescriptionStringID(details));
+                mHelper.getCallDescriptionStringID(callTypes));
     }
 
     /**
      * Test getCallDescriptionID method used to get the accessibility description for calls.
-     * Test case where an missed unknown call is received and a voicemail was left.
      */
-    public void testGetCallDescriptionID_UnknownVoicemail() {
-        PhoneCallDetails details = new PhoneCallDetails(
-                mContext,
-                "",
-                Calls.PRESENTATION_UNKNOWN,
-                "",
-                TEST_COUNTRY_ISO,
-                TEST_GEOCODE,
-                new int[]{Calls.VOICEMAIL_TYPE},
-                TEST_DATE,
-                TEST_DURATION,
-                false /* isVoicemail */);
+    public void testGetCallDescriptionID_Voicemail() {
+        int[] callTypes = new int[]{ Calls.VOICEMAIL_TYPE };
         assertEquals(R.string.description_incoming_missed_call,
-                mHelper.getCallDescriptionStringID(details));
-    }
-
-    /**
-     * Test getCallDescriptionID method used to get the accessibility description for calls.
-     * Test case where an answered call from a known caller is received.
-     */
-    public void testGetCallDescriptionID_KnownAnswered() {
-        PhoneCallDetails details = new PhoneCallDetails(
-                mContext,
-                TEST_NUMBER,
-                Calls.PRESENTATION_ALLOWED,
-                TEST_FORMATTED_NUMBER,
-                TEST_COUNTRY_ISO,
-                TEST_GEOCODE,
-                new int[]{Calls.INCOMING_TYPE},
-                TEST_DATE,
-                TEST_DURATION,
-                false /* isVoicemail */);
-        assertEquals(R.string.description_incoming_answered_call,
-                mHelper.getCallDescriptionStringID(details));
-    }
-
-    /**
-     * Test getCallDescriptionID method used to get the accessibility description for calls.
-     * Test case where a missed call from a known caller is received.
-     */
-    public void testGetCallDescriptionID_KnownMissed() {
-        PhoneCallDetails details = new PhoneCallDetails(
-                mContext,
-                TEST_NUMBER,
-                Calls.PRESENTATION_ALLOWED,
-                TEST_FORMATTED_NUMBER,
-                TEST_COUNTRY_ISO,
-                TEST_GEOCODE,
-                new int[]{Calls.MISSED_TYPE},
-                TEST_DATE,
-                TEST_DURATION,
-                false /* isVoicemail */);
-        assertEquals(R.string.description_incoming_missed_call,
-                mHelper.getCallDescriptionStringID(details));
-    }
-
-    /**
-     * Test getCallDescriptionID method used to get the accessibility description for calls.
-     * Test case where a missed call from a known caller is received and a voicemail was left.
-     */
-    public void testGetCallDescriptionID_KnownVoicemail() {
-        PhoneCallDetails details = new PhoneCallDetails(
-                mContext,
-                TEST_NUMBER,
-                Calls.PRESENTATION_ALLOWED,
-                TEST_FORMATTED_NUMBER,
-                TEST_COUNTRY_ISO, TEST_GEOCODE,
-                new int[]{Calls.VOICEMAIL_TYPE},
-                TEST_DATE,
-                TEST_DURATION,
-                false /* isVoicemail */);
-        assertEquals(R.string.description_incoming_missed_call,
-                mHelper.getCallDescriptionStringID(details));
+                mHelper.getCallDescriptionStringID(callTypes));
     }
 
     /**
@@ -243,19 +153,9 @@
      * only a single call for this caller.
      */
     public void testGetCallDescriptionID_OutgoingSingle() {
-        PhoneCallDetails details = new PhoneCallDetails(
-                mContext,
-                TEST_NUMBER,
-                Calls.PRESENTATION_ALLOWED,
-                TEST_FORMATTED_NUMBER,
-                TEST_COUNTRY_ISO,
-                TEST_GEOCODE,
-                new int[]{Calls.OUTGOING_TYPE},
-                TEST_DATE,
-                TEST_DURATION,
-                false /* isVoicemail */);
+        int[] callTypes = new int[]{ Calls.OUTGOING_TYPE };
         assertEquals(R.string.description_outgoing_call,
-                mHelper.getCallDescriptionStringID(details));
+                mHelper.getCallDescriptionStringID(callTypes));
     }
 
     /**
@@ -264,19 +164,9 @@
      * many calls for this caller.
      */
     public void testGetCallDescriptionID_OutgoingMultiple() {
-        PhoneCallDetails details = new PhoneCallDetails(
-                mContext,
-                TEST_NUMBER,
-                Calls.PRESENTATION_ALLOWED,
-                TEST_FORMATTED_NUMBER,
-                TEST_COUNTRY_ISO,
-                TEST_GEOCODE,
-                new int[]{Calls.OUTGOING_TYPE, Calls.OUTGOING_TYPE},
-                TEST_DATE,
-                TEST_DURATION,
-                false /* isVoicemail */);
+        int[] callTypes = new int[]{ Calls.OUTGOING_TYPE, Calls.OUTGOING_TYPE };
         assertEquals(R.string.description_outgoing_call,
-                mHelper.getCallDescriptionStringID(details));
+                mHelper.getCallDescriptionStringID(callTypes));
     }
 
     /**
@@ -284,17 +174,8 @@
      * For outgoing calls, we should NOT have "New Voicemail" in the description.
      */
     public void testGetCallDescription_NoVoicemailOutgoing() {
-        PhoneCallDetails details = new PhoneCallDetails(
-                mContext,
-                TEST_NUMBER,
-                Calls.PRESENTATION_ALLOWED,
-                TEST_FORMATTED_NUMBER,
-                TEST_COUNTRY_ISO,
-                TEST_GEOCODE,
-                new int[]{Calls.OUTGOING_TYPE, Calls.OUTGOING_TYPE},
-                TEST_DATE,
-                TEST_DURATION,
-                false /* isVoicemail */);
+        PhoneCallDetails details =
+                getPhoneCallDetailsWithTypes(Calls.OUTGOING_TYPE, Calls.OUTGOING_TYPE);
         CharSequence description = mHelper.getCallDescription(getContext(), details);
         assertFalse(description.toString()
                 .contains(this.mResources.getString(R.string.description_new_voicemail)));
@@ -305,17 +186,8 @@
      * For regular incoming calls, we should NOT have "New Voicemail" in the description.
      */
     public void testGetCallDescription_NoVoicemailIncoming() {
-        PhoneCallDetails details = new PhoneCallDetails(
-                mContext,
-                TEST_NUMBER,
-                Calls.PRESENTATION_ALLOWED,
-                TEST_FORMATTED_NUMBER,
-                TEST_COUNTRY_ISO,
-                TEST_GEOCODE,
-                new int[]{Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE},
-                TEST_DATE,
-                TEST_DURATION,
-                false /* isVoicemail */);
+        PhoneCallDetails details =
+                getPhoneCallDetailsWithTypes(Calls.INCOMING_TYPE, Calls.OUTGOING_TYPE);
         CharSequence description = mHelper.getCallDescription(getContext(), details);
         assertFalse(description.toString()
                 .contains(this.mResources.getString(R.string.description_new_voicemail)));
@@ -326,17 +198,8 @@
      * For regular missed calls, we should NOT have "New Voicemail" in the description.
      */
     public void testGetCallDescription_NoVoicemailMissed() {
-        PhoneCallDetails details = new PhoneCallDetails(
-                mContext,
-                TEST_NUMBER,
-                Calls.PRESENTATION_ALLOWED,
-                TEST_FORMATTED_NUMBER,
-                TEST_COUNTRY_ISO,
-                TEST_GEOCODE,
-                new int[]{Calls.MISSED_TYPE, Calls.OUTGOING_TYPE},
-                TEST_DATE,
-                TEST_DURATION,
-                false /* isVoicemail */);
+        PhoneCallDetails details =
+                getPhoneCallDetailsWithTypes(Calls.MISSED_TYPE, Calls.OUTGOING_TYPE);
         CharSequence description = mHelper.getCallDescription(getContext(), details);
         assertFalse(description.toString()
                 .contains(this.mResources.getString(R.string.description_new_voicemail)));
@@ -347,17 +210,8 @@
      * For voicemail calls, we should have "New Voicemail" in the description.
      */
     public void testGetCallDescription_Voicemail() {
-        PhoneCallDetails details = new PhoneCallDetails(
-                mContext,
-                TEST_NUMBER,
-                Calls.PRESENTATION_ALLOWED,
-                TEST_FORMATTED_NUMBER,
-                TEST_COUNTRY_ISO,
-                TEST_GEOCODE,
-                new int[]{Calls.VOICEMAIL_TYPE, Calls.OUTGOING_TYPE},
-                TEST_DATE,
-                TEST_DURATION,
-                false /* isVoicemail */);
+        PhoneCallDetails details =
+                getPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE, Calls.OUTGOING_TYPE);
         CharSequence description = mHelper.getCallDescription(getContext(), details);
         assertTrue(description.toString()
                 .contains(this.mResources.getString(R.string.description_new_voicemail)));
@@ -368,16 +222,7 @@
      * Test that the "X calls" message is not present if there is only a single call.
      */
     public void testGetCallDescription_NumCallsSingle() {
-        PhoneCallDetails details = new PhoneCallDetails(
-                mContext,
-                TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
-                TEST_FORMATTED_NUMBER,
-                TEST_COUNTRY_ISO,
-                TEST_GEOCODE,
-                new int[]{Calls.VOICEMAIL_TYPE},
-                TEST_DATE,
-                TEST_DURATION,
-                false /* isVoicemail */);
+        PhoneCallDetails details = getPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE);
         CharSequence description = mHelper.getCallDescription(getContext(), details);
 
         // Rather than hard coding the "X calls" string message, we'll generate it with an empty
@@ -393,15 +238,8 @@
      * Test that the "X calls" message is present if there are many calls.
      */
     public void testGetCallDescription_NumCallsMultiple() {
-        PhoneCallDetails details = new PhoneCallDetails(
-                mContext,
-                TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
-                TEST_FORMATTED_NUMBER,
-                TEST_COUNTRY_ISO, TEST_GEOCODE,
-                new int[]{Calls.VOICEMAIL_TYPE, Calls.INCOMING_TYPE},
-                TEST_DATE,
-                TEST_DURATION,
-                false /* isVoicemail */);
+        PhoneCallDetails details =
+                getPhoneCallDetailsWithTypes(Calls.VOICEMAIL_TYPE, Calls.INCOMING_TYPE);
         CharSequence description = mHelper.getCallDescription(getContext(), details);
         assertTrue(description.toString()
                 .contains(this.mResources.getString(R.string.description_num_calls, 2)));
@@ -412,20 +250,9 @@
      * Test that the "Video call." message is present if the call had video capability.
      */
     public void testGetCallDescription_Video() {
-        PhoneCallDetails details = new PhoneCallDetails(
-                mContext,
-                TEST_NUMBER,
-                Calls.PRESENTATION_ALLOWED,
-                TEST_FORMATTED_NUMBER,
-                TEST_COUNTRY_ISO, TEST_GEOCODE,
-                new int[]{Calls.INCOMING_TYPE, Calls.INCOMING_TYPE},
-                TEST_DATE,
-                TEST_DURATION,
-                null,
-                Calls.FEATURES_VIDEO,
-                null,
-                null,
-                false /* isVoicemail */);
+        PhoneCallDetails details =
+                getPhoneCallDetailsWithTypes(Calls.INCOMING_TYPE, Calls.INCOMING_TYPE);
+        details.features = Calls.FEATURES_VIDEO;
 
         CharSequence description = mHelper.getCallDescription(getContext(), details);
         final boolean isVideoEnabled = CallUtil.isVideoEnabled(getContext());
@@ -454,49 +281,42 @@
     /** Sets the details of a phone call using the specified phone number. */
     private void setPhoneCallDetailsWithNumberAndType(String number,
             int presentation, String formattedNumber, int callType) {
-        mHelper.setPhoneCallDetails(mContext, mViewHolder,
-                new PhoneCallDetails(
-                        mContext,
-                        number,
-                        presentation,
-                        formattedNumber,
-                        TEST_COUNTRY_ISO,
-                        TEST_GEOCODE,
-                        new int[]{ callType },
-                        TEST_DATE,
-                        TEST_DURATION,
-                        false /* isVoicemail */));
+        PhoneCallDetails details = getPhoneCallDetails(
+                number, presentation, formattedNumber);
+        details.callTypes = new int[]{ callType };
+        mHelper.setPhoneCallDetails(mContext, mViewHolder, details);
     }
 
-    /** Sets the details of a phone call using the specified call type. */
-    private void setPhoneCallDetailsWithTypes(int... types) {
-        mHelper.setPhoneCallDetails(getContext(), mViewHolder,
-                new PhoneCallDetails(
-                        mContext,
-                        TEST_NUMBER,
-                        Calls.PRESENTATION_ALLOWED,
-                        TEST_FORMATTED_NUMBER,
-                        TEST_COUNTRY_ISO,
-                        TEST_GEOCODE,
-                        types,
-                        TEST_DATE,
-                        TEST_DURATION,
-                        false /* isVoicemail */));
+    private PhoneCallDetails getPhoneCallDetails(
+            String number, int presentation, String formattedNumber) {
+        PhoneCallDetails details = new PhoneCallDetails(
+                mContext,
+                number,
+                presentation,
+                formattedNumber,
+                false /* isVoicemail */);
+        setDefaultDetails(details);
+        return details;
     }
 
-    /** Sets the details of an unread phone call using the specified call type. */
-    private void setUnreadPhoneCallDetailsWithTypes(int... types) {
-        mHelper.setPhoneCallDetails(getContext(), mViewHolder,
-                new PhoneCallDetails(
-                        mContext,
-                        TEST_NUMBER,
-                        Calls.PRESENTATION_ALLOWED,
-                        TEST_FORMATTED_NUMBER,
-                        TEST_COUNTRY_ISO,
-                        TEST_GEOCODE,
-                        types,
-                        TEST_DATE,
-                        TEST_DURATION,
-                        false /* isVoicemail */));
+    /** Returns the details of a phone call using the specified call type. */
+    private PhoneCallDetails getPhoneCallDetailsWithTypes(int... types) {
+        PhoneCallDetails details = new PhoneCallDetails(
+                mContext,
+                TEST_NUMBER,
+                Calls.PRESENTATION_ALLOWED,
+                TEST_FORMATTED_NUMBER,
+                false /* isVoicemail */);
+        setDefaultDetails(details);
+        details.callTypes = types;
+        return details;
+    }
+
+    private void setDefaultDetails(PhoneCallDetails details) {
+        details.callTypes = new int[]{ Calls.INCOMING_TYPE };
+        details.countryIso = TEST_COUNTRY_ISO;
+        details.date = TEST_DATE;
+        details.duration = TEST_DURATION;
+        details.geocode = TEST_GEOCODE;
     }
 }