summaryrefslogtreecommitdiff
path: root/test-mock
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2019-11-15 12:45:15 -0700
committerJeff Sharkey <jsharkey@android.com>2019-11-15 13:46:31 -0700
commite9fe152f317bbce0bce63b657468867f0fc1f4a4 (patch)
treeec405d03c37c9795b18bfa87b5e91ca7ae6f940d /test-mock
parentb500cb85ff779bd564f68d0a293bbf6b74f05b7b (diff)
Extend insert/update/delete to provide extras.
A few releases ago we added ContentResolver.QUERY_ARG_* constants to query() as a new best-practice that will help wean us off raw SQL arguments. (For example, a provider could add their own custom arguments like QUERY_ARG_INCLUDE_PENDING to cause the query to reveal pending items that would otherwise be hidden.) This change expands update() and delete() to accept those arguments. This change also expand insert() to accept extras too, as part of preparing to support an upcoming MediaProvider feature that will let apps place new media "adjacent" to an existing media item. (Sending that adjacent item through extras is cleaner than trying to send it through escaped query parameters.) Bug: 131643582 Test: atest CtsContentTestCases Change-Id: I436296155b9b5f371b4cbe661feaf42070285fcc
Diffstat (limited to 'test-mock')
-rw-r--r--test-mock/src/android/test/mock/MockContentProvider.java13
-rw-r--r--test-mock/src/android/test/mock/MockIContentProvider.java6
2 files changed, 9 insertions, 10 deletions
diff --git a/test-mock/src/android/test/mock/MockContentProvider.java b/test-mock/src/android/test/mock/MockContentProvider.java
index 9d3e12050193..85e5916a63df 100644
--- a/test-mock/src/android/test/mock/MockContentProvider.java
+++ b/test-mock/src/android/test/mock/MockContentProvider.java
@@ -71,8 +71,8 @@ public class MockContentProvider extends ContentProvider {
@Override
public int delete(String callingPackage, @Nullable String featureId, Uri url,
- String selection, String[] selectionArgs) throws RemoteException {
- return MockContentProvider.this.delete(url, selection, selectionArgs);
+ Bundle extras) throws RemoteException {
+ return MockContentProvider.this.delete(url, extras);
}
@Override
@@ -82,8 +82,8 @@ public class MockContentProvider extends ContentProvider {
@Override
public Uri insert(String callingPackage, @Nullable String featureId, Uri url,
- ContentValues initialValues) throws RemoteException {
- return MockContentProvider.this.insert(url, initialValues);
+ ContentValues initialValues, Bundle extras) throws RemoteException {
+ return MockContentProvider.this.insert(url, initialValues, extras);
}
@Override
@@ -109,9 +109,8 @@ public class MockContentProvider extends ContentProvider {
@Override
public int update(String callingPackage, @Nullable String featureId, Uri url,
- ContentValues values, String selection, String[] selectionArgs)
- throws RemoteException {
- return MockContentProvider.this.update(url, values, selection, selectionArgs);
+ ContentValues values, Bundle extras) throws RemoteException {
+ return MockContentProvider.this.update(url, values, extras);
}
@Override
diff --git a/test-mock/src/android/test/mock/MockIContentProvider.java b/test-mock/src/android/test/mock/MockIContentProvider.java
index e512b52643f3..464abfb1a514 100644
--- a/test-mock/src/android/test/mock/MockIContentProvider.java
+++ b/test-mock/src/android/test/mock/MockIContentProvider.java
@@ -51,7 +51,7 @@ public class MockIContentProvider implements IContentProvider {
@Override
@SuppressWarnings("unused")
public int delete(String callingPackage, @Nullable String featureId, Uri url,
- String selection, String[] selectionArgs) throws RemoteException {
+ Bundle extras) throws RemoteException {
throw new UnsupportedOperationException("unimplemented mock method");
}
@@ -63,7 +63,7 @@ public class MockIContentProvider implements IContentProvider {
@Override
@SuppressWarnings("unused")
public Uri insert(String callingPackage, @Nullable String featureId, Uri url,
- ContentValues initialValues) throws RemoteException {
+ ContentValues initialValues, Bundle extras) throws RemoteException {
throw new UnsupportedOperationException("unimplemented mock method");
}
@@ -99,7 +99,7 @@ public class MockIContentProvider implements IContentProvider {
@Override
public int update(String callingPackage, @Nullable String featureId, Uri url,
- ContentValues values, String selection, String[] selectionArgs) throws RemoteException {
+ ContentValues values, Bundle extras) throws RemoteException {
throw new UnsupportedOperationException("unimplemented mock method");
}