diff options
author | 2018-12-07 12:00:45 -0700 | |
---|---|---|
committer | 2018-12-08 11:25:13 -0700 | |
commit | 633a13e2fa8f378d523d4ae209dc573c66db8cb1 (patch) | |
tree | 12ee3167af570b76906f9c49c7666105503fba2e /test-mock/src | |
parent | dfeea6047748925a5c7481ff54b1d672bd91bd2b (diff) |
Extract common methods into ContentInterface.
Existing APIs that accept a ContentResolver are too restrictive when
the caller has their own ContentProviderClient already bound and
configured, so we're in the market for a solution to open those
existing APIs to accept a wider range of inputs.
The solution we've come up with is to introduce a super-interface
which contains the common ContentProvider APIs, and then make
ContentProvider, ContentResolver, and ContentProviderClient all
implement that interface for consistency.
After this change lands, we can then safely relax existing APIs to
accept this new ContentInterface, offering a clean path to solving
the problem outlined above.
Bug: 117635768
Test: atest android.content.cts
Test: atest android.provider.cts
Change-Id: Ic5ae08107f7dd3dd23dcaec2df40c16543e0d86e
Exempted-From-Owner-Approval: keep tests working
Diffstat (limited to 'test-mock/src')
-rw-r--r-- | test-mock/src/android/test/mock/MockContentProvider.java | 10 | ||||
-rw-r--r-- | test-mock/src/android/test/mock/MockIContentProvider.java | 6 |
2 files changed, 8 insertions, 8 deletions
diff --git a/test-mock/src/android/test/mock/MockContentProvider.java b/test-mock/src/android/test/mock/MockContentProvider.java index b917fbd8a1fe..0ac35bc2628c 100644 --- a/test-mock/src/android/test/mock/MockContentProvider.java +++ b/test-mock/src/android/test/mock/MockContentProvider.java @@ -54,10 +54,10 @@ public class MockContentProvider extends ContentProvider { */ private class InversionIContentProvider implements IContentProvider { @Override - public ContentProviderResult[] applyBatch(String callingPackage, + public ContentProviderResult[] applyBatch(String callingPackage, String authority, ArrayList<ContentProviderOperation> operations) throws RemoteException, OperationApplicationException { - return MockContentProvider.this.applyBatch(operations); + return MockContentProvider.this.applyBatch(authority, operations); } @Override @@ -112,9 +112,9 @@ public class MockContentProvider extends ContentProvider { } @Override - public Bundle call(String callingPackage, String method, String request, Bundle args) - throws RemoteException { - return MockContentProvider.this.call(method, request, args); + public Bundle call(String callingPackage, String authority, String method, String request, + Bundle args) throws RemoteException { + return MockContentProvider.this.call(authority, method, request, args); } @Override diff --git a/test-mock/src/android/test/mock/MockIContentProvider.java b/test-mock/src/android/test/mock/MockIContentProvider.java index 112d7eef3dbe..fc2a4644b994 100644 --- a/test-mock/src/android/test/mock/MockIContentProvider.java +++ b/test-mock/src/android/test/mock/MockIContentProvider.java @@ -80,7 +80,7 @@ public class MockIContentProvider implements IContentProvider { } @Override - public ContentProviderResult[] applyBatch(String callingPackage, + public ContentProviderResult[] applyBatch(String callingPackage, String authority, ArrayList<ContentProviderOperation> operations) { throw new UnsupportedOperationException("unimplemented mock method"); } @@ -103,8 +103,8 @@ public class MockIContentProvider implements IContentProvider { } @Override - public Bundle call(String callingPackage, String method, String request, Bundle args) - throws RemoteException { + public Bundle call(String callingPackage, String authority, String method, String request, + Bundle args) throws RemoteException { throw new UnsupportedOperationException("unimplemented mock method"); } |