diff options
author | Jeff Brown <jeffbrown@google.com> | 2012-01-25 19:37:13 -0800 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2012-01-27 17:33:21 -0800 |
commit | 75ea64fc54f328d37b115cfb1ded1e45c30380ed (patch) | |
tree | 4254a5d2d0662de8b606b38fea6987da17c130e3 /test-runner | |
parent | ebc016c01ea9d5707287cfc19ccc59b21a486c00 (diff) | |
download | frameworks_base-75ea64fc54f328d37b115cfb1ded1e45c30380ed.zip frameworks_base-75ea64fc54f328d37b115cfb1ded1e45c30380ed.tar.gz frameworks_base-75ea64fc54f328d37b115cfb1ded1e45c30380ed.tar.bz2 |
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
Diffstat (limited to 'test-runner')
-rw-r--r-- | test-runner/src/android/test/mock/MockContentProvider.java | 8 | ||||
-rw-r--r-- | test-runner/src/android/test/mock/MockIContentProvider.java | 8 |
2 files changed, 14 insertions, 2 deletions
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"); + } } |