Merge "Remove verbose logging."
diff --git a/src/com/android/contacts/calllog/CallLogAdapter.java b/src/com/android/contacts/calllog/CallLogAdapter.java
index ea282fc..99ba8e8 100644
--- a/src/com/android/contacts/calllog/CallLogAdapter.java
+++ b/src/com/android/contacts/calllog/CallLogAdapter.java
@@ -650,9 +650,15 @@
return;
}
- mContext.getContentResolver().update(Calls.CONTENT_URI_WITH_VOICEMAIL, values,
- Calls.NUMBER + " = ? AND " + Calls.COUNTRY_ISO + " = ?",
- new String[]{ number, countryIso });
+ if (countryIso == null) {
+ mContext.getContentResolver().update(Calls.CONTENT_URI_WITH_VOICEMAIL, values,
+ Calls.NUMBER + " = ? AND " + Calls.COUNTRY_ISO + " IS NULL",
+ new String[]{ number });
+ } else {
+ mContext.getContentResolver().update(Calls.CONTENT_URI_WITH_VOICEMAIL, values,
+ Calls.NUMBER + " = ? AND " + Calls.COUNTRY_ISO + " = ?",
+ new String[]{ number, countryIso });
+ }
}
/** Returns the contact information as stored in the call log. */
diff --git a/tests/src/com/android/contacts/activities/PeopleActivityTest.java b/tests/src/com/android/contacts/activities/PeopleActivityTest.java
index 66c2c5a..ea7c3dc 100644
--- a/tests/src/com/android/contacts/activities/PeopleActivityTest.java
+++ b/tests/src/com/android/contacts/activities/PeopleActivityTest.java
@@ -48,7 +48,7 @@
import android.provider.ContactsContract.ProviderStatus;
import android.provider.Settings;
import android.test.ActivityInstrumentationTestCase2;
-import android.test.suitebuilder.annotation.Smoke;
+import android.test.suitebuilder.annotation.SmallTest;
import android.widget.TextView;
/**
@@ -64,7 +64,7 @@
* -w com.android.contacts.tests/android.test.InstrumentationTestRunner
*
*/
-@Smoke
+@SmallTest
public class PeopleActivityTest
extends ActivityInstrumentationTestCase2<PeopleActivity>
{
diff --git a/tests/src/com/android/contacts/detail/StreamItemAdapterTest.java b/tests/src/com/android/contacts/detail/StreamItemAdapterTest.java
index 19b14d9..131af96 100644
--- a/tests/src/com/android/contacts/detail/StreamItemAdapterTest.java
+++ b/tests/src/com/android/contacts/detail/StreamItemAdapterTest.java
@@ -21,6 +21,7 @@
import com.google.common.collect.Lists;
import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
import android.view.View;
import java.util.ArrayList;
@@ -33,6 +34,7 @@
/**
* Unit tests for {@link StreamItemAdapter}.
*/
+@SmallTest
public class StreamItemAdapterTest extends AndroidTestCase {
private StreamItemAdapter mAdapter;
private FakeOnClickListener mListener;
diff --git a/tests/src/com/android/contacts/format/PrefixHighligherTest.java b/tests/src/com/android/contacts/format/PrefixHighligherTest.java
index a0c0ff3..668330b 100644
--- a/tests/src/com/android/contacts/format/PrefixHighligherTest.java
+++ b/tests/src/com/android/contacts/format/PrefixHighligherTest.java
@@ -17,11 +17,13 @@
package com.android.contacts.format;
import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
import android.widget.TextView;
/**
* Unit tests for {@link PrefixHighlighter}.
*/
+@SmallTest
public class PrefixHighligherTest extends AndroidTestCase {
private static final int TEST_PREFIX_HIGHLIGHT_COLOR = 0xFF0000;
/** The HTML code used to mark the start of the highlighted part. */
diff --git a/tests/src/com/android/contacts/format/SpannedTestUtils.java b/tests/src/com/android/contacts/format/SpannedTestUtils.java
index 625c6aa..646a7ec 100644
--- a/tests/src/com/android/contacts/format/SpannedTestUtils.java
+++ b/tests/src/com/android/contacts/format/SpannedTestUtils.java
@@ -16,6 +16,7 @@
package com.android.contacts.format;
+import android.test.suitebuilder.annotation.SmallTest;
import android.text.Html;
import android.text.Spanned;
import android.text.TextUtils;
@@ -26,6 +27,7 @@
/**
* Utility class to check the value of spanned text in text views.
*/
+@SmallTest
public class SpannedTestUtils {
/**
* Checks that the text contained in the text view matches the given HTML text.
diff --git a/tests/src/com/android/contacts/format/TestTextWithHighlightingFactory.java b/tests/src/com/android/contacts/format/TestTextWithHighlightingFactory.java
index f2848d0..2deaef3 100644
--- a/tests/src/com/android/contacts/format/TestTextWithHighlightingFactory.java
+++ b/tests/src/com/android/contacts/format/TestTextWithHighlightingFactory.java
@@ -21,10 +21,12 @@
import android.database.CharArrayBuffer;
import android.graphics.Typeface;
+import android.test.suitebuilder.annotation.SmallTest;
import android.text.SpannableStringBuilder;
import android.text.style.StyleSpan;
/** A factory for {@link TextWithHighlighting} that wraps its parts in italics. */
+@SmallTest
public final class TestTextWithHighlightingFactory implements TextWithHighlightingFactory {
/** A {@link TextWithHighlighting} implementation that wraps its parts in italics. */
private final static class TestTextWithHighlighting extends SpannableStringBuilder
diff --git a/tests/src/com/android/contacts/interactions/ContactDeletionInteractionTest.java b/tests/src/com/android/contacts/interactions/ContactDeletionInteractionTest.java
index 2c4b74c..b37d24f 100644
--- a/tests/src/com/android/contacts/interactions/ContactDeletionInteractionTest.java
+++ b/tests/src/com/android/contacts/interactions/ContactDeletionInteractionTest.java
@@ -35,7 +35,7 @@
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Contacts.Entity;
import android.test.ActivityInstrumentationTestCase2;
-import android.test.suitebuilder.annotation.Smoke;
+import android.test.suitebuilder.annotation.SmallTest;
/**
* Tests for {@link ContactDeletionInteraction}.
@@ -47,7 +47,7 @@
* adb shell am instrument \
* -w com.android.contacts.tests/android.test.InstrumentationTestRunner
*/
-@Smoke
+@SmallTest
public class ContactDeletionInteractionTest
extends ActivityInstrumentationTestCase2<FragmentTestActivity> {
diff --git a/tests/src/com/android/contacts/interactions/PhoneNumberInteractionTest.java b/tests/src/com/android/contacts/interactions/PhoneNumberInteractionTest.java
index e0b443a..9490b1b 100644
--- a/tests/src/com/android/contacts/interactions/PhoneNumberInteractionTest.java
+++ b/tests/src/com/android/contacts/interactions/PhoneNumberInteractionTest.java
@@ -29,11 +29,12 @@
import android.net.Uri;
import android.os.AsyncTask;
import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.CommonDataKinds.SipAddress;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.RawContacts;
import android.test.InstrumentationTestCase;
-import android.test.suitebuilder.annotation.Smoke;
+import android.test.suitebuilder.annotation.SmallTest;
import java.util.ArrayList;
import java.util.List;
@@ -48,7 +49,7 @@
* adb shell am instrument \
* -w com.android.contacts.tests/android.test.InstrumentationTestRunner
*/
-@Smoke
+@SmallTest
public class PhoneNumberInteractionTest extends InstrumentationTestCase {
static {
@@ -89,7 +90,8 @@
public void testSendSmsWhenOnlyOneNumberAvailable() {
Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, 13);
expectQuery(contactUri)
- .returnRow(1, "123", 0, null, null, Phone.TYPE_HOME, null);
+ .returnRow(1, "123", 0, null, null, Phone.TYPE_HOME, null,
+ Phone.CONTENT_ITEM_TYPE);
TestPhoneNumberInteraction interaction = new TestPhoneNumberInteraction(
mContext, InteractionType.SMS, null);
@@ -107,7 +109,8 @@
public void testSendSmsWhenDataIdIsProvided() {
Uri dataUri = ContentUris.withAppendedId(Data.CONTENT_URI, 1);
expectQuery(dataUri, true /* isDataUri */ )
- .returnRow(1, "987", 0, null, null, Phone.TYPE_HOME, null);
+ .returnRow(1, "987", 0, null, null, Phone.TYPE_HOME, null,
+ Phone.CONTENT_ITEM_TYPE);
TestPhoneNumberInteraction interaction = new TestPhoneNumberInteraction(
mContext, InteractionType.SMS, null);
@@ -125,8 +128,10 @@
public void testSendSmsWhenThereIsPrimaryNumber() {
Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, 13);
expectQuery(contactUri)
- .returnRow(1, "123", 0, null, null, Phone.TYPE_HOME, null)
- .returnRow(2, "456", 1, null, null, Phone.TYPE_HOME, null);
+ .returnRow(
+ 1, "123", 0, null, null, Phone.TYPE_HOME, null, Phone.CONTENT_ITEM_TYPE)
+ .returnRow(
+ 2, "456", 1, null, null, Phone.TYPE_HOME, null, Phone.CONTENT_ITEM_TYPE);
TestPhoneNumberInteraction interaction = new TestPhoneNumberInteraction(
mContext, InteractionType.SMS, null);
@@ -164,8 +169,10 @@
public void testCallNumberWhenThereAreDuplicates() {
Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, 13);
expectQuery(contactUri)
- .returnRow(1, "123", 0, null, null, Phone.TYPE_HOME, null)
- .returnRow(2, "123", 0, null, null, Phone.TYPE_WORK, null);
+ .returnRow(1, "123", 0, null, null, Phone.TYPE_HOME, null,
+ Phone.CONTENT_ITEM_TYPE)
+ .returnRow(2, "123", 0, null, null, Phone.TYPE_WORK, null,
+ Phone.CONTENT_ITEM_TYPE);
TestPhoneNumberInteraction interaction = new TestPhoneNumberInteraction(
mContext, InteractionType.PHONE_CALL, null);
@@ -180,11 +187,31 @@
assertEquals("tel:123", intent.getDataString());
}
+ public void testCallWithSip() {
+ Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, 13);
+ expectQuery(contactUri)
+ .returnRow(1, "example@example.com", 0, null, null, Phone.TYPE_HOME, null,
+ SipAddress.CONTENT_ITEM_TYPE);
+ TestPhoneNumberInteraction interaction = new TestPhoneNumberInteraction(
+ mContext, InteractionType.PHONE_CALL, null);
+
+ interaction.startInteraction(contactUri);
+ interaction.getLoader().waitForLoader();
+
+ Intent intent = mContext.getIntentForStartActivity();
+ assertNotNull(intent);
+
+ assertEquals(Intent.ACTION_CALL_PRIVILEGED, intent.getAction());
+ assertEquals("tel:example%40example.com", intent.getDataString());
+ }
+
public void testShowDisambigDialogForCalling() {
Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, 13);
expectQuery(contactUri)
- .returnRow(1, "123", 0, "account", null, Phone.TYPE_HOME, "label")
- .returnRow(2, "456", 0, null, null, Phone.TYPE_WORK, null);
+ .returnRow(1, "123", 0, "account", null, Phone.TYPE_HOME, "label",
+ Phone.CONTENT_ITEM_TYPE)
+ .returnRow(2, "456", 0, null, null, Phone.TYPE_WORK, null,
+ Phone.CONTENT_ITEM_TYPE);
TestPhoneNumberInteraction interaction = new TestPhoneNumberInteraction(
mContext, InteractionType.PHONE_CALL, null);
@@ -224,7 +251,9 @@
RawContacts.ACCOUNT_TYPE,
RawContacts.DATA_SET,
Phone.TYPE,
- Phone.LABEL)
- .withSelection("mimetype='vnd.android.cursor.item/phone_v2' AND data1 NOT NULL");
+ Phone.LABEL,
+ Phone.MIMETYPE)
+ .withSelection("mimetype IN ('vnd.android.cursor.item/phone_v2',"
+ + " 'vnd.android.cursor.item/sip_address') AND data1 NOT NULL");
}
}