diff options
author | Tony Mak <tonymak@google.com> | 2016-03-11 15:06:14 +0000 |
---|---|---|
committer | Tony Mak <tonymak@google.com> | 2016-03-11 15:06:14 +0000 |
commit | 3dc68df0b856eace41aaca6bd0266da023c18835 (patch) | |
tree | 2538e20e4185c347c9c9267b26def38056473b89 /tests | |
parent | 5558f89b14af81d38364afe9e51a56f8557fd282 (diff) |
Query lookup uri with work lookup key directly is not allowed
Query lookup uri with work lookup key directly is not allowed, app crashes
if doing so. And actually, all APIs do not support work lookup key
except those explicitly say it does.
This Cls changed two places:
1. Do not pass lookup uri with work lookup to NotificationManager to avoid
NotificationManager using the uri to query.
2. Dialer perform query for alternative display name using lookup key.
But if it is a work contact, do not do so.
Bug: 27146678
Change-Id: Ie59c37ff43b6f953a96564c446d79d8812f5ada1
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/android/dialer/calllog/ContactInfoHelperTest.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/src/com/android/dialer/calllog/ContactInfoHelperTest.java b/tests/src/com/android/dialer/calllog/ContactInfoHelperTest.java index 680afb15f..e53eb7893 100644 --- a/tests/src/com/android/dialer/calllog/ContactInfoHelperTest.java +++ b/tests/src/com/android/dialer/calllog/ContactInfoHelperTest.java @@ -22,6 +22,7 @@ import android.provider.ContactsContract.PhoneLookup; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.MediumTest; +import com.android.contacts.common.ContactsUtils; import com.android.contacts.common.test.mocks.ContactsMockContext; import com.android.contacts.common.test.mocks.MockContentProvider.Query; @@ -99,13 +100,15 @@ public class ContactInfoHelperTest extends AndroidTestCase { } public void testLookupDisplayNameAlternative_NullLookup() { - Assert.assertNull(mContactInfoHelper.lookUpDisplayNameAlternative(mContext, null)); + Assert.assertNull(mContactInfoHelper.lookUpDisplayNameAlternative(mContext, null, + ContactsUtils.USER_TYPE_CURRENT)); } public void testLookupDisplayNameAlternative_NoResults() { setUpQueryExpectations(displayNameAlternativeUri, PhoneQuery.DISPLAY_NAME_ALTERNATIVE_PROJECTION); - Assert.assertNull(mContactInfoHelper.lookUpDisplayNameAlternative(mContext, TEST_LOOKUP_KEY)); + Assert.assertNull(mContactInfoHelper.lookUpDisplayNameAlternative(mContext, + TEST_LOOKUP_KEY, ContactsUtils.USER_TYPE_CURRENT)); mContext.verify(); } @@ -113,7 +116,8 @@ public class ContactInfoHelperTest extends AndroidTestCase { setUpQueryExpectations(displayNameAlternativeUri, PhoneQuery.DISPLAY_NAME_ALTERNATIVE_PROJECTION, TEST_DISPLAY_NAME_ALTERNATIVE_ROW); Assert.assertEquals(TEST_DISPLAY_NAME_ALTERNATIVE, - mContactInfoHelper.lookUpDisplayNameAlternative(mContext, TEST_LOOKUP_KEY)); + mContactInfoHelper.lookUpDisplayNameAlternative(mContext, TEST_LOOKUP_KEY + , ContactsUtils.USER_TYPE_CURRENT)); mContext.verify(); } |