Stop checking usage related contacts provider behavior
The relevant APIs should still exist and "work", but we skip checking
their effects on usage stats.
Bug: 112190021
Test: Run the modified tests with tradefed on:
cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsProviderTestCases
(with unrelated tests in the module removed.)
- marshmallow-cts-dev (on shamu MRA59G)
- nougat-cts-dev (on angler NRD91R)
- nougat-mr1-cts-dev (on bullhead NMF27E)
Merged-in: I1f4dcac959bee2be1a345bc63434ab7a535b3eca
Merged-in: I10e66441a9766947c7c14ae25022deadac5a9c7c
Change-Id: I92bc80a8d69d2b26cb1023b14f00518de9f87b3b
diff --git a/tests/tests/provider/src/android/provider/cts/ContactsContract_DataUsageTest.java b/tests/tests/provider/src/android/provider/cts/ContactsContract_DataUsageTest.java
index d585ec2..62e212f 100644
--- a/tests/tests/provider/src/android/provider/cts/ContactsContract_DataUsageTest.java
+++ b/tests/tests/provider/src/android/provider/cts/ContactsContract_DataUsageTest.java
@@ -63,19 +63,13 @@
long[] dataIds = setupRawContactDataItems(ids.mRawContactId);
- assertDataUsageEquals(dataIds, 0, 0, 0, 0);
-
updateMultipleAndAssertUpdateSuccess(new long[] {dataIds[1], dataIds[2]});
- assertDataUsageEquals(dataIds, 0, 1, 1, 0);
updateMultipleAndAssertUpdateSuccess(new long[]{dataIds[1], dataIds[2]});
- assertDataUsageEquals(dataIds, 0, 2, 2, 0);
updateDataUsageAndAssert(dataIds[1], 3);
- assertDataUsageEquals(dataIds, 0, 3, 2, 0);
updateMultipleAndAssertUpdateSuccess(new long[]{dataIds[0], dataIds[1]});
- assertDataUsageEquals(dataIds, 1, 4, 2, 0);
deleteDataUsage();
RawContactUtil.delete(mResolver, ids.mRawContactId, true);
@@ -103,7 +97,6 @@
.appendQueryParameter(DataUsageFeedback.USAGE_TYPE,
DataUsageFeedback.USAGE_TYPE_CALL).build();
int result = mResolver.update(uri, new ContentValues(), null, null);
- assertTrue(result > 0);
}
/**
@@ -115,38 +108,6 @@
.appendQueryParameter(DataUsageFeedback.USAGE_TYPE,
DataUsageFeedback.USAGE_TYPE_CALL).build();
int result = mResolver.update(uri, new ContentValues(), null, null);
- assertTrue(result > 0);
-
- assertDataUsageEquals(dataId, assertValue);
- }
-
- /**
- * Assert that the given data ids have usage values in the respective order.
- */
- private void assertDataUsageEquals(long[] dataIds, int... expectedValues) {
- if (dataIds.length != expectedValues.length) {
- throw new IllegalArgumentException("dataIds and expectedValues must be the same size");
- }
-
- for (int i = 0; i < dataIds.length; i++) {
- assertDataUsageEquals(dataIds[i], expectedValues[i]);
- }
- }
-
- /**
- * Assert a single data item has a specific usage value.
- */
- private void assertDataUsageEquals(long dataId, int expectedValue) {
- // Query and assert value is expected.
- String[] projection = new String[]{ContactsContract.Data.TIMES_USED};
- String[] record = DataUtil.queryById(mResolver, dataId, projection);
- assertNotNull(record);
- long actual = 0;
- // Tread null as 0
- if (record[0] != null) {
- actual = Long.parseLong(record[0]);
- }
- assertEquals(expectedValue, actual);
}
private void deleteDataUsage() {
diff --git a/tests/tests/provider/src/android/provider/cts/ContactsContract_FrequentsStrequentsTest.java b/tests/tests/provider/src/android/provider/cts/ContactsContract_FrequentsStrequentsTest.java
index b52915c..145c715 100644
--- a/tests/tests/provider/src/android/provider/cts/ContactsContract_FrequentsStrequentsTest.java
+++ b/tests/tests/provider/src/android/provider/cts/ContactsContract_FrequentsStrequentsTest.java
@@ -201,11 +201,6 @@
// Contact the third contact twice.
markDataAsUsed(mDataIds[2], 2);
-
- // The strequents uri should now return contact 2, 3, 1 in order due to ranking by
- // data usage.
- assertCursorStoredValuesWithContactsFilter(Contacts.CONTENT_STREQUENT_URI, ids,
- false, sContentValues[1], sContentValues[2], sContentValues[0]);
}
/**
@@ -225,13 +220,6 @@
// Contact the third contact twice, and mark it as used
markDataAsUsed(mDataIds[2], 2);
starContact(ids[2]);
-
- // The strequents uri should now return contact 3, 2, 1 in order. Contact 3 is ranked first
- // because it is starred, followed by contacts 2 and 1 due to their data usage ranking.
- // Note that contact 3 is only returned once (as a starred contact) even though it is also
- // a frequently contacted contact.
- assertCursorStoredValuesWithContactsFilter(Contacts.CONTENT_STREQUENT_URI, ids,
- false, sContentValues[2], sContentValues[1], sContentValues[0]);
}
/**
@@ -248,10 +236,6 @@
// Construct a uri that filters for the query string "ta".
Uri uri = Contacts.CONTENT_STREQUENT_FILTER_URI.buildUpon().appendEncodedPath("ta").build();
-
- // Only contact 1 and 2 should be returned (sorted in alphabetical order) due to the
- // filtered query.
- assertCursorStoredValuesWithContactsFilter(uri, ids, false, sContentValues[1], sContentValues[0]);
}
public void testStrequents_projection() throws Exception {
@@ -308,10 +292,6 @@
// Construct a uri for phone only favorites.
Uri uri = Contacts.CONTENT_STREQUENT_URI.buildUpon().
appendQueryParameter(ContactsContract.STREQUENT_PHONE_ONLY, "true").build();
-
- // Only the contacts with phone numbers are returned, in frequency ranking order.
- assertCursorStoredValuesWithContactsFilter(uri, mDataIds, false,
- sContentValues[2], sContentValues[0]);
}
public void testStrequents_phoneOnly_projection() throws Exception {
@@ -347,11 +327,6 @@
// Contact the third contact twice.
markDataAsUsed(mDataIds[2], 2);
-
- // The frequents uri should now return contact 2, 3, 1 in order due to ranking by
- // data usage.
- assertCursorStoredValuesWithContactsFilter(Contacts.CONTENT_FREQUENT_URI, ids,
- true /* inOrder */, sContentValues[1], sContentValues[2], sContentValues[0]);
}
public void testFrequent_projection() throws Exception {