Show the exact time of the call in Quick contact "Recent card"

bug 28806890

Change-Id: Ie814f8fe7cbaa7fa1eb2395c5b60c9d82eb59abb
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d6f8239..909b684 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -751,8 +751,7 @@
 
     <!-- Toast that appears when you are copying a directory contact into your personal contacts -->
     <string name="toast_making_personal_copy">Creating a personal copy&#8230;</string>
-    <!-- Timestamp string for interactions from yesterday. [CHAR LIMIT=40] -->
-    <string name="yesterday">Yesterday</string>
+    <!-- Timestamp string for interactions from tomorrow. [CHAR LIMIT=40] -->
     <string name="tomorrow">Tomorrow</string>
     <!-- Timestamp string for interactions from today. [CHAR LIMIT=40] -->
     <string name="today">Today</string>
diff --git a/src/com/android/contacts/interactions/ContactInteractionUtil.java b/src/com/android/contacts/interactions/ContactInteractionUtil.java
index 98d45ee..8ec0547 100644
--- a/src/com/android/contacts/interactions/ContactInteractionUtil.java
+++ b/src/com/android/contacts/interactions/ContactInteractionUtil.java
@@ -26,9 +26,6 @@
 
 import java.util.Calendar;
 
-import com.android.contacts.R;
-
-
 /**
  * Utility methods for interactions and their loaders
  */
@@ -61,8 +58,7 @@
      * compareCalendar.
      * This formats the date based on a few conditions:
      * 1. If the timestamp is today, the time is shown
-     * 2. If the timestamp occurs tomorrow or yesterday, that is displayed
-     * 3. Otherwise {Month Date} format is used
+     * 2. Otherwise show full date and time
      */
     @NeededForTesting
     public static String formatDateStringFromTimestamp(long timestamp, Context context,
@@ -76,19 +72,9 @@
                     interactionCalendar.getTime());
         }
 
-        // Turn compareCalendar to yesterday
-        compareCalendar.add(Calendar.DAY_OF_YEAR, -1);
-        if (compareCalendarDayYear(interactionCalendar, compareCalendar)) {
-            return context.getString(R.string.yesterday);
-        }
-
-        // Turn compareCalendar to tomorrow
-        compareCalendar.add(Calendar.DAY_OF_YEAR, 2);
-        if (compareCalendarDayYear(interactionCalendar, compareCalendar)) {
-            return context.getString(R.string.tomorrow);
-        }
-        return DateUtils.formatDateTime(context, interactionCalendar.getTimeInMillis(),
-                DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NO_YEAR);
+        return DateUtils.formatDateTime(context, timestamp, DateUtils.FORMAT_SHOW_TIME
+                | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_WEEKDAY
+                | DateUtils.FORMAT_SHOW_YEAR);
     }
 
     /**
diff --git a/tests/src/com/android/contacts/interactions/ContactInteractionUtilTest.java b/tests/src/com/android/contacts/interactions/ContactInteractionUtilTest.java
index 4802b46..86167c1 100644
--- a/tests/src/com/android/contacts/interactions/ContactInteractionUtilTest.java
+++ b/tests/src/com/android/contacts/interactions/ContactInteractionUtilTest.java
@@ -15,12 +15,9 @@
  */
 package com.android.contacts.interactions;
 
-import com.android.contacts.common.R;
-
 import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.test.AndroidTestCase;
-import android.text.format.DateUtils;
 
 import java.util.Calendar;
 import java.util.Locale;
@@ -80,50 +77,15 @@
                         getContext()));
     }
 
-    public void testFormatDateStringFromTimestamp_yesterday() {
-        // Test yesterday and tomorrow (Yesterday or Tomorrow shown)
-        calendar.add(Calendar.DAY_OF_YEAR, -1);
-        assertEquals(getContext().getResources().getString(R.string.yesterday),
-                ContactInteractionUtil.formatDateStringFromTimestamp(calendar.getTimeInMillis(),
-                        getContext()));
-    }
-
-    public void testFormatDateStringFromTimestamp_yesterdayLastYear() {
-        // Set to non leap year
-        calendar.set(Calendar.YEAR, 1999);
-        calendar.set(Calendar.DAY_OF_YEAR, 365);
-        long lastYear = calendar.getTimeInMillis();
-        calendar.add(Calendar.DAY_OF_YEAR, 1);
-
-        assertEquals(getContext().getResources().getString(R.string.yesterday),
-                ContactInteractionUtil.formatDateStringFromTimestamp(lastYear,
-                        getContext(), calendar));
-    }
-
-    public void testFormatDateStringFromTimestamp_tomorrow() {
-        calendar.add(Calendar.DAY_OF_YEAR, 1);
-        assertEquals(getContext().getResources().getString(R.string.tomorrow),
-                ContactInteractionUtil.formatDateStringFromTimestamp(calendar.getTimeInMillis(),
-                        getContext()));
-    }
-
-    public void testFormatDateStringFromTimestamp_tomorrowNewYear() {
-        calendar.set(Calendar.DAY_OF_YEAR, 1);
-        long thisYear = calendar.getTimeInMillis();
-        calendar.add(Calendar.DAY_OF_YEAR, -1);
-
-        assertEquals(getContext().getResources().getString(R.string.tomorrow),
-                ContactInteractionUtil.formatDateStringFromTimestamp(thisYear,
-                        getContext(), calendar));
-    }
-
     public void testFormatDateStringFromTimestamp_other() {
         // Test other (Month Date)
         calendar.set(
                 /* year = */ 1991,
                 /* month = */ Calendar.MONTH,
-                /* day = */ 11);
-        assertEquals("March 11",
+                /* day = */ 11,
+                /* hourOfDay = */ 8,
+                /* minute = */ 8);
+        assertEquals("Monday, March 11, 1991, 8:08 AM",
                 ContactInteractionUtil.formatDateStringFromTimestamp(calendar.getTimeInMillis(),
                         getContext()));
     }