From 75ea64fc54f328d37b115cfb1ded1e45c30380ed Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Wed, 25 Jan 2012 19:37:13 -0800 Subject: Implement a cancelation mechanism for queries. Added new API to enable cancelation of SQLite and content provider queries by means of a CancelationSignal object. The application creates a CancelationSignal object and passes it as an argument to the query. The cancelation signal can then be used to cancel the query while it is executing. If the cancelation signal is raised before the query is executed, then it is immediately terminated. Change-Id: If2c76e9a7e56ea5e98768b6d4f225f0a1ca61c61 --- test-runner/src/android/test/mock/MockContentProvider.java | 8 +++++++- test-runner/src/android/test/mock/MockIContentProvider.java | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'test-runner') diff --git a/test-runner/src/android/test/mock/MockContentProvider.java b/test-runner/src/android/test/mock/MockContentProvider.java index e0ce322..4ff943e 100644 --- a/test-runner/src/android/test/mock/MockContentProvider.java +++ b/test-runner/src/android/test/mock/MockContentProvider.java @@ -21,6 +21,7 @@ import android.content.ContentProviderOperation; import android.content.ContentProviderResult; import android.content.ContentValues; import android.content.Context; +import android.content.ICancelationSignal; import android.content.IContentProvider; import android.content.OperationApplicationException; import android.content.pm.PathPermission; @@ -92,7 +93,7 @@ public class MockContentProvider extends ContentProvider { @Override public Cursor query(Uri url, String[] projection, String selection, String[] selectionArgs, - String sortOrder) throws RemoteException { + String sortOrder, ICancelationSignal cancelationSignal) throws RemoteException { return MockContentProvider.this.query(url, projection, selection, selectionArgs, sortOrder); } @@ -124,6 +125,11 @@ public class MockContentProvider extends ContentProvider { throws RemoteException, FileNotFoundException { return MockContentProvider.this.openTypedAssetFile(url, mimeType, opts); } + + @Override + public ICancelationSignal createCancelationSignal() throws RemoteException { + return null; + } } private final InversionIContentProvider mIContentProvider = new InversionIContentProvider(); diff --git a/test-runner/src/android/test/mock/MockIContentProvider.java b/test-runner/src/android/test/mock/MockIContentProvider.java index b7733a4..41bc27d 100644 --- a/test-runner/src/android/test/mock/MockIContentProvider.java +++ b/test-runner/src/android/test/mock/MockIContentProvider.java @@ -21,6 +21,7 @@ import android.content.ContentProviderResult; import android.content.ContentValues; import android.content.EntityIterator; import android.content.IContentProvider; +import android.content.ICancelationSignal; import android.content.res.AssetFileDescriptor; import android.database.Cursor; import android.net.Uri; @@ -72,7 +73,7 @@ public class MockIContentProvider implements IContentProvider { } public Cursor query(Uri url, String[] projection, String selection, String[] selectionArgs, - String sortOrder) { + String sortOrder, ICancelationSignal cancelationSignal) { throw new UnsupportedOperationException("unimplemented mock method"); } @@ -103,4 +104,9 @@ public class MockIContentProvider implements IContentProvider { throws RemoteException, FileNotFoundException { throw new UnsupportedOperationException("unimplemented mock method"); } + + @Override + public ICancelationSignal createCancelationSignal() throws RemoteException { + throw new UnsupportedOperationException("unimplemented mock method"); + } } -- cgit v1.1