Merge "Update ShadowContentResolver to extend from the official shadow package. Also removes redundant API" into main
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowContentResolver.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowContentResolver.java
index 5d9202f..e259cad 100644
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowContentResolver.java
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowContentResolver.java
@@ -16,16 +16,10 @@
package com.android.settings.testutils.shadow;
-import static android.provider.SearchIndexablesContract.INDEXABLES_RAW_COLUMNS;
-
import android.accounts.Account;
import android.annotation.UserIdInt;
import android.content.ContentResolver;
import android.content.SyncAdapterType;
-import android.database.Cursor;
-import android.database.MatrixCursor;
-import android.net.Uri;
-import android.provider.SearchIndexablesContract;
import android.text.TextUtils;
import org.robolectric.annotation.Implementation;
@@ -35,7 +29,7 @@
import java.util.Map;
@Implements(ContentResolver.class)
-public class ShadowContentResolver {
+public class ShadowContentResolver extends org.robolectric.shadows.ShadowContentResolver {
private static SyncAdapterType[] sSyncAdapterTypes = new SyncAdapterType[0];
private static Map<String, Integer> sSyncable = new HashMap<>();
@@ -48,23 +42,14 @@
}
@Implementation
- protected final Cursor query(Uri uri, String[] projection, String selection,
- String[] selectionArgs, String sortOrder) {
- MatrixCursor cursor = new MatrixCursor(INDEXABLES_RAW_COLUMNS);
- MatrixCursor.RowBuilder builder = cursor.newRow()
- .add(SearchIndexablesContract.NonIndexableKey.COLUMN_KEY_VALUE, "");
- return cursor;
- }
-
- @Implementation
protected static int getIsSyncableAsUser(Account account, String authority, int userId) {
- return sSyncable.containsKey(authority) ? sSyncable.get(authority) : 1;
+ return sSyncable.getOrDefault(authority, 1);
}
@Implementation
protected static boolean getSyncAutomaticallyAsUser(Account account, String authority,
int userId) {
- return sSyncAutomatically.containsKey(authority) ? sSyncAutomatically.get(authority) : true;
+ return sSyncAutomatically.getOrDefault(authority, true);
}
@Implementation