diff options
author | Dmitri Plotnikov <dplotnikov@google.com> | 2020-02-20 17:42:52 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-02-20 17:42:52 +0000 |
commit | 23132a29ebc18c261546bcaa1cf32ce57235f55c (patch) | |
tree | 8592e964348ff7cc25d482e1d17cf69b96b332d1 /test-mock/src/android | |
parent | 11d8a6ef8702349b93a27cd689376e3a6f64f839 (diff) | |
parent | 7a223fbcf1a56a67931afb13eaf2445fb71dec43 (diff) |
Merge "Add async version of "canonicalize""
Diffstat (limited to 'test-mock/src/android')
-rw-r--r-- | test-mock/src/android/test/mock/MockContentProvider.java | 18 | ||||
-rw-r--r-- | test-mock/src/android/test/mock/MockIContentProvider.java | 15 |
2 files changed, 31 insertions, 2 deletions
diff --git a/test-mock/src/android/test/mock/MockContentProvider.java b/test-mock/src/android/test/mock/MockContentProvider.java index f7ec11c79476..d1d64d39b688 100644 --- a/test-mock/src/android/test/mock/MockContentProvider.java +++ b/test-mock/src/android/test/mock/MockContentProvider.java @@ -156,6 +156,12 @@ public class MockContentProvider extends ContentProvider { } @Override + public void canonicalizeAsync(String callingPkg, String featureId, Uri uri, + RemoteCallback callback) { + MockContentProvider.this.canonicalizeAsync(uri, callback); + } + + @Override public Uri uncanonicalize(String callingPkg, @Nullable String featureId, Uri uri) throws RemoteException { return MockContentProvider.this.uncanonicalize(uri); @@ -292,6 +298,18 @@ public class MockContentProvider extends ContentProvider { /** * @hide */ + @SuppressWarnings("deprecation") + public void canonicalizeAsync(Uri uri, RemoteCallback callback) { + AsyncTask.SERIAL_EXECUTOR.execute(() -> { + final Bundle bundle = new Bundle(); + bundle.putParcelable(ContentResolver.REMOTE_CALLBACK_RESULT, canonicalize(uri)); + callback.sendResult(bundle); + }); + } + + /** + * @hide + */ public boolean refresh(Uri url, Bundle args) { throw new UnsupportedOperationException("unimplemented mock method call"); } diff --git a/test-mock/src/android/test/mock/MockIContentProvider.java b/test-mock/src/android/test/mock/MockIContentProvider.java index 1831bcdf9df7..223bcc59039d 100644 --- a/test-mock/src/android/test/mock/MockIContentProvider.java +++ b/test-mock/src/android/test/mock/MockIContentProvider.java @@ -145,12 +145,23 @@ public class MockIContentProvider implements IContentProvider { } @Override - public Uri canonicalize(String callingPkg, @Nullable String featureId, Uri uri) - throws RemoteException { + public Uri canonicalize(String callingPkg, @Nullable String featureId, Uri uri) { throw new UnsupportedOperationException("unimplemented mock method"); } @Override + @SuppressWarnings("deprecation") + public void canonicalizeAsync(String callingPkg, String featureId, Uri uri, + RemoteCallback remoteCallback) { + AsyncTask.SERIAL_EXECUTOR.execute(() -> { + final Bundle bundle = new Bundle(); + bundle.putParcelable(ContentResolver.REMOTE_CALLBACK_RESULT, + canonicalize(callingPkg, featureId, uri)); + remoteCallback.sendResult(bundle); + }); + } + + @Override public Uri uncanonicalize(String callingPkg, @Nullable String featureId, Uri uri) throws RemoteException { throw new UnsupportedOperationException("unimplemented mock method"); |