Change PhoneCallDetail fields to be non-final.

It's been a pain to add/change fields on PhoneCallDetails because
a multitude of parameters required for the constructors to create
an instance. I ran into this while considering how to add an
objectId to its parameters, and have previously too...

Make fields non-final so that they are more easily set. This has
the side-effect of making the casing of some initialization code
more straightforward.

+ Change it's constructor to a subset of required fields.
+ Simplify/reorganize CallLogAdapter and CallLogAsyncTaskUtil code.
+ Simplify tests.

Bug: 21733599
Change-Id: I236dfb0b8e6513f4b44dbdae17ce2eb9c9ae4778
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,