From 719a7adde25e0a717816b00668c16c3a1e3c5518 Mon Sep 17 00:00:00 2001 From: Jay Shrauner Date: Thu, 30 May 2013 15:41:13 -0700 Subject: Use new CallLog number presentation column Switch to using new number presentation column in the CallLog table and discontinue using special phone number strings in CallerInfo. Needed for unbundling. Bug:6948882 Change-Id: Ibf27ea55cee783c4530101e4e228198e245e6684 --- .../com/android/dialer/CallDetailActivityTest.java | 1 + .../android/dialer/PhoneCallDetailsHelperTest.java | 60 +++++++++++------- .../dialer/calllog/CallLogFragmentTest.java | 74 ++++++++++++---------- .../dialer/calllog/CallLogListItemHelperTest.java | 40 +++++++----- .../dialer/calllog/CallLogQueryTestUtils.java | 4 +- .../tests/calllog/FillCallLogTestActivity.java | 1 + 6 files changed, 102 insertions(+), 78 deletions(-) (limited to 'tests') diff --git a/tests/src/com/android/dialer/CallDetailActivityTest.java b/tests/src/com/android/dialer/CallDetailActivityTest.java index eebb681d9..1ad17c4f4 100644 --- a/tests/src/com/android/dialer/CallDetailActivityTest.java +++ b/tests/src/com/android/dialer/CallDetailActivityTest.java @@ -230,6 +230,7 @@ public class CallDetailActivityTest extends ActivityInstrumentationTestCase2Yesterday", mViews.callTypeAndDate.getText()); @@ -199,35 +200,36 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { } public void testSetPhoneCallDetails_Highlighted() { - setPhoneCallDetailsWithNumber(TEST_VOICEMAIL_NUMBER, ""); + setPhoneCallDetailsWithNumber(TEST_VOICEMAIL_NUMBER, + Calls.PRESENTATION_ALLOWED, ""); } public void testSetCallDetailsHeader_NumberOnly() { - setCallDetailsHeaderWithNumberOnly(TEST_NUMBER); + setCallDetailsHeaderWithNumber(TEST_NUMBER, Calls.PRESENTATION_ALLOWED); assertEquals(View.VISIBLE, mNameView.getVisibility()); assertEquals("Add to contacts", mNameView.getText().toString()); } public void testSetCallDetailsHeader_UnknownNumber() { - setCallDetailsHeaderWithNumberOnly(CallerInfo.UNKNOWN_NUMBER); + setCallDetailsHeaderWithNumber("", Calls.PRESENTATION_UNKNOWN); assertEquals(View.VISIBLE, mNameView.getVisibility()); assertEquals("Unknown", mNameView.getText().toString()); } public void testSetCallDetailsHeader_PrivateNumber() { - setCallDetailsHeaderWithNumberOnly(CallerInfo.PRIVATE_NUMBER); + setCallDetailsHeaderWithNumber("", Calls.PRESENTATION_RESTRICTED); assertEquals(View.VISIBLE, mNameView.getVisibility()); assertEquals("Private number", mNameView.getText().toString()); } public void testSetCallDetailsHeader_PayphoneNumber() { - setCallDetailsHeaderWithNumberOnly(CallerInfo.PAYPHONE_NUMBER); + setCallDetailsHeaderWithNumber("", Calls.PRESENTATION_PAYPHONE); assertEquals(View.VISIBLE, mNameView.getVisibility()); assertEquals("Pay phone", mNameView.getText().toString()); } public void testSetCallDetailsHeader_VoicemailNumber() { - setCallDetailsHeaderWithNumberOnly(TEST_VOICEMAIL_NUMBER); + setCallDetailsHeaderWithNumber(TEST_VOICEMAIL_NUMBER, Calls.PRESENTATION_ALLOWED); assertEquals(View.VISIBLE, mNameView.getVisibility()); assertEquals("Voicemail", mNameView.getText().toString()); } @@ -284,15 +286,21 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { } /** Sets the phone call details with default values and the given number. */ - private void setPhoneCallDetailsWithNumber(String number, String formattedNumber) { - setPhoneCallDetailsWithNumberAndGeocode(number, formattedNumber, TEST_GEOCODE); + private void setPhoneCallDetailsWithNumber(String number, int presentation, + String formattedNumber) { + mHelper.setPhoneCallDetails(mViews, + new PhoneCallDetails(number, presentation, formattedNumber, + TEST_COUNTRY_ISO, TEST_GEOCODE, + new int[]{ Calls.VOICEMAIL_TYPE }, TEST_DATE, TEST_DURATION), + true); } /** 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(number, formattedNumber, TEST_COUNTRY_ISO, geocodedLocation, + new PhoneCallDetails(number, Calls.PRESENTATION_ALLOWED, + formattedNumber, TEST_COUNTRY_ISO, geocodedLocation, new int[]{ Calls.VOICEMAIL_TYPE }, TEST_DATE, TEST_DURATION), true); } @@ -300,29 +308,33 @@ public class PhoneCallDetailsHelperTest extends AndroidTestCase { /** Sets the phone call details with default values and the given date. */ private void setPhoneCallDetailsWithDate(long date) { mHelper.setPhoneCallDetails(mViews, - new PhoneCallDetails(TEST_NUMBER, TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, - TEST_GEOCODE, new int[]{ Calls.INCOMING_TYPE }, date, TEST_DURATION), + new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED, + TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, + new int[]{ Calls.INCOMING_TYPE }, date, TEST_DURATION), false); } /** 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(TEST_NUMBER, TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, - TEST_GEOCODE, callTypes, TEST_DATE, TEST_DURATION), + new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED, + TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, + callTypes, TEST_DATE, TEST_DURATION), false); } - private void setCallDetailsHeaderWithNumberOnly(String number) { + private void setCallDetailsHeaderWithNumber(String number, int presentation) { mHelper.setCallDetailsHeader(mNameView, - new PhoneCallDetails(number, TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, - TEST_GEOCODE, new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION)); + new PhoneCallDetails(number, presentation, + TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE, + new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION)); } private void setCallDetailsHeader(String name) { mHelper.setCallDetailsHeader(mNameView, - new PhoneCallDetails(TEST_NUMBER, TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, - TEST_GEOCODE, new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION, + new PhoneCallDetails(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)); } } diff --git a/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java b/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java index 67132fd45..c94f8d9ac 100644 --- a/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java @@ -40,7 +40,6 @@ import android.widget.FrameLayout; import com.android.contacts.common.test.FragmentTestActivity; import com.android.dialer.CallDetailActivity; import com.android.dialer.R; -import com.android.internal.telephony.CallerInfo; import java.util.Date; import java.util.Formatter; @@ -165,9 +164,9 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2