Commit 4c1241df authored by Jeff Brown's avatar Jeff Brown

Rename CancellationSignal using preferred spelling.

Bug: 5943637
Change-Id: I12a339f285f4db58e79acb5fd8ec2fc1acda5265
parent 8ca8a69d
......@@ -94,7 +94,7 @@ LOCAL_SRC_FILES += \
core/java/android/bluetooth/IBluetoothHealthCallback.aidl \
core/java/android/bluetooth/IBluetoothPbap.aidl \
core/java/android/bluetooth/IBluetoothStateChangeCallback.aidl \
core/java/android/content/ICancelationSignal.aidl \
core/java/android/content/ICancellationSignal.aidl \
core/java/android/content/IClipboard.aidl \
core/java/android/content/IContentService.aidl \
core/java/android/content/IIntentReceiver.aidl \
......
......@@ -117,6 +117,8 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/fonts/DroidSans*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/media/audio/)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/fonts/DroidSans*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/media/audio/)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/content)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/src/android/content)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
......@@ -4714,15 +4714,15 @@ package android.content {
method public final void setResultExtras(android.os.Bundle);
}
public final class CancelationSignal {
ctor public CancelationSignal();
public final class CancellationSignal {
ctor public CancellationSignal();
method public void cancel();
method public boolean isCanceled();
method public void setOnCancelListener(android.content.CancelationSignal.OnCancelListener);
method public void setOnCancelListener(android.content.CancellationSignal.OnCancelListener);
method public void throwIfCanceled();
}
public static abstract interface CancelationSignal.OnCancelListener {
public static abstract interface CancellationSignal.OnCancelListener {
method public abstract void onCancel();
}
......@@ -4845,7 +4845,7 @@ package android.content {
method public android.os.ParcelFileDescriptor openPipeHelper(android.net.Uri, java.lang.String, android.os.Bundle, T, android.content.ContentProvider.PipeDataWriter<T>) throws java.io.FileNotFoundException;
method public android.content.res.AssetFileDescriptor openTypedAssetFile(android.net.Uri, java.lang.String, android.os.Bundle) throws java.io.FileNotFoundException;
method public abstract android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String);
method public android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, android.content.CancelationSignal);
method public android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, android.content.CancellationSignal);
method protected final void setPathPermissions(android.content.pm.PathPermission[]);
method protected final void setReadPermission(java.lang.String);
method protected final void setWritePermission(java.lang.String);
......@@ -4869,7 +4869,7 @@ package android.content {
method public android.os.ParcelFileDescriptor openFile(android.net.Uri, java.lang.String) throws java.io.FileNotFoundException, android.os.RemoteException;
method public final android.content.res.AssetFileDescriptor openTypedAssetFileDescriptor(android.net.Uri, java.lang.String, android.os.Bundle) throws java.io.FileNotFoundException, android.os.RemoteException;
method public android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String) throws android.os.RemoteException;
method public android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, android.content.CancelationSignal) throws android.os.RemoteException;
method public android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, android.content.CancellationSignal) throws android.os.RemoteException;
method public boolean release();
method public int update(android.net.Uri, android.content.ContentValues, java.lang.String, java.lang.String[]) throws android.os.RemoteException;
}
......@@ -4956,7 +4956,7 @@ package android.content {
method public final java.io.OutputStream openOutputStream(android.net.Uri, java.lang.String) throws java.io.FileNotFoundException;
method public final android.content.res.AssetFileDescriptor openTypedAssetFileDescriptor(android.net.Uri, java.lang.String, android.os.Bundle) throws java.io.FileNotFoundException;
method public final android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String);
method public final android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, android.content.CancelationSignal);
method public final android.database.Cursor query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, android.content.CancellationSignal);
method public final void registerContentObserver(android.net.Uri, boolean, android.database.ContentObserver);
method public static void removePeriodicSync(android.accounts.Account, java.lang.String, android.os.Bundle);
method public static void removeStatusChangeListener(java.lang.Object);
......@@ -7268,15 +7268,15 @@ package android.database.sqlite {
method public static android.database.sqlite.SQLiteDatabase openOrCreateDatabase(java.lang.String, android.database.sqlite.SQLiteDatabase.CursorFactory);
method public static android.database.sqlite.SQLiteDatabase openOrCreateDatabase(java.lang.String, android.database.sqlite.SQLiteDatabase.CursorFactory, android.database.DatabaseErrorHandler);
method public android.database.Cursor query(boolean, java.lang.String, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String);
method public android.database.Cursor query(boolean, java.lang.String, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String, android.content.CancelationSignal);
method public android.database.Cursor query(boolean, java.lang.String, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String, android.content.CancellationSignal);
method public android.database.Cursor query(java.lang.String, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String);
method public android.database.Cursor query(java.lang.String, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String);
method public android.database.Cursor queryWithFactory(android.database.sqlite.SQLiteDatabase.CursorFactory, boolean, java.lang.String, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String);
method public android.database.Cursor queryWithFactory(android.database.sqlite.SQLiteDatabase.CursorFactory, boolean, java.lang.String, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String, android.content.CancelationSignal);
method public android.database.Cursor queryWithFactory(android.database.sqlite.SQLiteDatabase.CursorFactory, boolean, java.lang.String, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String, android.content.CancellationSignal);
method public android.database.Cursor rawQuery(java.lang.String, java.lang.String[]);
method public android.database.Cursor rawQuery(java.lang.String, java.lang.String[], android.content.CancelationSignal);
method public android.database.Cursor rawQuery(java.lang.String, java.lang.String[], android.content.CancellationSignal);
method public android.database.Cursor rawQueryWithFactory(android.database.sqlite.SQLiteDatabase.CursorFactory, java.lang.String, java.lang.String[], java.lang.String);
method public android.database.Cursor rawQueryWithFactory(android.database.sqlite.SQLiteDatabase.CursorFactory, java.lang.String, java.lang.String[], java.lang.String, android.content.CancelationSignal);
method public android.database.Cursor rawQueryWithFactory(android.database.sqlite.SQLiteDatabase.CursorFactory, java.lang.String, java.lang.String[], java.lang.String, android.content.CancellationSignal);
method public static int releaseMemory();
method public long replace(java.lang.String, java.lang.String, android.content.ContentValues);
method public long replaceOrThrow(java.lang.String, java.lang.String, android.content.ContentValues) throws android.database.SQLException;
......@@ -7398,7 +7398,7 @@ package android.database.sqlite {
method public java.lang.String getTables();
method public android.database.Cursor query(android.database.sqlite.SQLiteDatabase, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String);
method public android.database.Cursor query(android.database.sqlite.SQLiteDatabase, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String);
method public android.database.Cursor query(android.database.sqlite.SQLiteDatabase, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String, android.content.CancelationSignal);
method public android.database.Cursor query(android.database.sqlite.SQLiteDatabase, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String, android.content.CancellationSignal);
method public void setCursorFactory(android.database.sqlite.SQLiteDatabase.CursorFactory);
method public void setDistinct(boolean);
method public void setProjectionMap(java.util.Map<java.lang.String, java.lang.String>);
......@@ -21,15 +21,15 @@ import android.os.RemoteException;
/**
* Provides the ability to cancel an operation in progress.
*/
public final class CancelationSignal {
public final class CancellationSignal {
private boolean mIsCanceled;
private OnCancelListener mOnCancelListener;
private ICancelationSignal mRemote;
private ICancellationSignal mRemote;
/**
* Creates a cancelation signal, initially not canceled.
* Creates a cancellation signal, initially not canceled.
*/
public CancelationSignal() {
public CancellationSignal() {
}
/**
......@@ -55,7 +55,7 @@ public final class CancelationSignal {
}
/**
* Cancels the operation and signals the cancelation listener.
* Cancels the operation and signals the cancellation listener.
* If the operation has not yet started, then it will be canceled as soon as it does.
*/
public void cancel() {
......@@ -76,17 +76,23 @@ public final class CancelationSignal {
}
/**
* Sets the cancelation listener to be called when canceled.
* If {@link CancelationSignal#cancel} has already been called, then the provided
* Sets the cancellation listener to be called when canceled.
*
* This method is intended to be used by the recipient of a cancellation signal
* such as a database or a content provider to handle cancellation requests
* while performing a long-running operation. This method is not intended to be
* used by applications themselves.
*
* If {@link CancellationSignal#cancel} has already been called, then the provided
* listener is invoked immediately.
*
* The listener is called while holding the cancelation signal's lock which is
* The listener is called while holding the cancellation signal's lock which is
* also held while registering or unregistering the listener. Because of the lock,
* it is not possible for the listener to run after it has been unregistered.
* This design choice makes it easier for clients of {@link CancelationSignal} to
* This design choice makes it easier for clients of {@link CancellationSignal} to
* prevent race conditions related to listener registration and unregistration.
*
* @param listener The cancelation listener, or null to remove the current listener.
* @param listener The cancellation listener, or null to remove the current listener.
*/
public void setOnCancelListener(OnCancelListener listener) {
synchronized (this) {
......@@ -104,7 +110,7 @@ public final class CancelationSignal {
*
* @hide
*/
public void setRemote(ICancelationSignal remote) {
public void setRemote(ICancellationSignal remote) {
synchronized (this) {
mRemote = remote;
if (mIsCanceled && remote != null) {
......@@ -118,47 +124,47 @@ public final class CancelationSignal {
/**
* Creates a transport that can be returned back to the caller of
* a Binder function and subsequently used to dispatch a cancelation signal.
* a Binder function and subsequently used to dispatch a cancellation signal.
*
* @return The new cancelation signal transport.
* @return The new cancellation signal transport.
*
* @hide
*/
public static ICancelationSignal createTransport() {
public static ICancellationSignal createTransport() {
return new Transport();
}
/**
* Given a locally created transport, returns its associated cancelation signal.
* Given a locally created transport, returns its associated cancellation signal.
*
* @param transport The locally created transport, or null if none.
* @return The associated cancelation signal, or null if none.
* @return The associated cancellation signal, or null if none.
*
* @hide
*/
public static CancelationSignal fromTransport(ICancelationSignal transport) {
public static CancellationSignal fromTransport(ICancellationSignal transport) {
if (transport instanceof Transport) {
return ((Transport)transport).mCancelationSignal;
return ((Transport)transport).mCancellationSignal;
}
return null;
}
/**
* Listens for cancelation.
* Listens for cancellation.
*/
public interface OnCancelListener {
/**
* Called when {@link CancelationSignal#cancel} is invoked.
* Called when {@link CancellationSignal#cancel} is invoked.
*/
void onCancel();
}
private static final class Transport extends ICancelationSignal.Stub {
final CancelationSignal mCancelationSignal = new CancelationSignal();
private static final class Transport extends ICancellationSignal.Stub {
final CancellationSignal mCancellationSignal = new CancellationSignal();
@Override
public void cancel() throws RemoteException {
mCancelationSignal.cancel();
mCancellationSignal.cancel();
}
}
}
......@@ -178,10 +178,10 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
@Override
public Cursor query(Uri uri, String[] projection,
String selection, String[] selectionArgs, String sortOrder,
ICancelationSignal cancelationSignal) {
ICancellationSignal cancellationSignal) {
enforceReadPermission(uri);
return ContentProvider.this.query(uri, projection, selection, selectionArgs, sortOrder,
CancelationSignal.fromTransport(cancelationSignal));
CancellationSignal.fromTransport(cancellationSignal));
}
@Override
......@@ -263,8 +263,8 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
}
@Override
public ICancelationSignal createCancelationSignal() throws RemoteException {
return CancelationSignal.createTransport();
public ICancellationSignal createCancellationSignal() throws RemoteException {
return CancellationSignal.createTransport();
}
private void enforceReadPermission(Uri uri) {
......@@ -557,7 +557,7 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
String selection, String[] selectionArgs, String sortOrder);
/**
* Implement this to handle query requests from clients with support for cancelation.
* Implement this to handle query requests from clients with support for cancellation.
* This method can be called from multiple threads, as described in
* <a href="{@docRoot}guide/topics/fundamentals/processes-and-threads.html#Threads">Processes
* and Threads</a>.
......@@ -597,9 +597,9 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
return c;</pre>
* <p>
* If you implement this method then you must also implement the version of
* {@link #query(Uri, String[], String, String[], String)} that does not take a cancelation
* provider to ensure correct operation on older versions of the Android Framework in
* which the cancelation signal overload was not available.
* {@link #query(Uri, String[], String, String[], String)} that does not take a cancellation
* signal to ensure correct operation on older versions of the Android Framework in
* which the cancellation signal overload was not available.
*
* @param uri The URI to query. This will be the full URI sent by the client;
* if the client is requesting a specific record, the URI will end in a record number
......@@ -614,14 +614,14 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
* The values will be bound as Strings.
* @param sortOrder How the rows in the cursor should be sorted.
* If null then the provider is free to define the sort order.
* @param cancelationSignal A signal to cancel the operation in progress, or null if none.
* @param cancellationSignal A signal to cancel the operation in progress, or null if none.
* If the operation is canceled, then {@link OperationCanceledException} will be thrown
* when the query is executed.
* @return a Cursor or null.
*/
public Cursor query(Uri uri, String[] projection,
String selection, String[] selectionArgs, String sortOrder,
CancelationSignal cancelationSignal) {
CancellationSignal cancellationSignal) {
return query(uri, projection, selection, selectionArgs, sortOrder);
}
......
......@@ -52,15 +52,15 @@ public class ContentProviderClient {
/** See {@link ContentProvider#query ContentProvider.query} */
public Cursor query(Uri url, String[] projection, String selection,
String[] selectionArgs, String sortOrder, CancelationSignal cancelationSignal)
String[] selectionArgs, String sortOrder, CancellationSignal cancellationSignal)
throws RemoteException {
ICancelationSignal remoteCancelationSignal = null;
if (cancelationSignal != null) {
remoteCancelationSignal = mContentProvider.createCancelationSignal();
cancelationSignal.setRemote(remoteCancelationSignal);
ICancellationSignal remoteCancellationSignal = null;
if (cancellationSignal != null) {
remoteCancellationSignal = mContentProvider.createCancellationSignal();
cancellationSignal.setRemote(remoteCancellationSignal);
}
return mContentProvider.query(url, projection, selection, selectionArgs, sortOrder,
remoteCancelationSignal);
remoteCancellationSignal);
}
/** See {@link ContentProvider#getType ContentProvider.getType} */
......
......@@ -105,11 +105,11 @@ abstract public class ContentProviderNative extends Binder implements IContentPr
String sortOrder = data.readString();
IContentObserver observer = IContentObserver.Stub.asInterface(
data.readStrongBinder());
ICancelationSignal cancelationSignal = ICancelationSignal.Stub.asInterface(
ICancellationSignal cancellationSignal = ICancellationSignal.Stub.asInterface(
data.readStrongBinder());
Cursor cursor = query(url, projection, selection, selectionArgs, sortOrder,
cancelationSignal);
cancellationSignal);
if (cursor != null) {
CursorToBulkCursorAdaptor adaptor = new CursorToBulkCursorAdaptor(
cursor, observer, getProviderName());
......@@ -300,9 +300,9 @@ abstract public class ContentProviderNative extends Binder implements IContentPr
{
data.enforceInterface(IContentProvider.descriptor);
ICancelationSignal cancelationSignal = createCancelationSignal();
ICancellationSignal cancellationSignal = createCancellationSignal();
reply.writeNoException();
reply.writeStrongBinder(cancelationSignal.asBinder());
reply.writeStrongBinder(cancellationSignal.asBinder());
return true;
}
}
......@@ -334,7 +334,7 @@ final class ContentProviderProxy implements IContentProvider
}
public Cursor query(Uri url, String[] projection, String selection,
String[] selectionArgs, String sortOrder, ICancelationSignal cancelationSignal)
String[] selectionArgs, String sortOrder, ICancellationSignal cancellationSignal)
throws RemoteException {
BulkCursorToCursorAdaptor adaptor = new BulkCursorToCursorAdaptor();
Parcel data = Parcel.obtain();
......@@ -363,7 +363,7 @@ final class ContentProviderProxy implements IContentProvider
}
data.writeString(sortOrder);
data.writeStrongBinder(adaptor.getObserver().asBinder());
data.writeStrongBinder(cancelationSignal != null ? cancelationSignal.asBinder() : null);
data.writeStrongBinder(cancellationSignal != null ? cancellationSignal.asBinder() : null);
mRemote.transact(IContentProvider.QUERY_TRANSACTION, data, reply, 0);
......@@ -632,7 +632,7 @@ final class ContentProviderProxy implements IContentProvider
}
}
public ICancelationSignal createCancelationSignal() throws RemoteException {
public ICancellationSignal createCancellationSignal() throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
......@@ -642,9 +642,9 @@ final class ContentProviderProxy implements IContentProvider
data, reply, 0);
DatabaseUtils.readExceptionFromParcel(reply);
ICancelationSignal cancelationSignal = ICancelationSignal.Stub.asInterface(
ICancellationSignal cancellationSignal = ICancellationSignal.Stub.asInterface(
reply.readStrongBinder());
return cancelationSignal;
return cancellationSignal;
} finally {
data.recycle();
reply.recycle();
......
......@@ -335,7 +335,7 @@ public abstract class ContentResolver {
* @param sortOrder How to order the rows, formatted as an SQL ORDER BY
* clause (excluding the ORDER BY itself). Passing null will use the
* default sort order, which may be unordered.
* @param cancelationSignal A signal to cancel the operation in progress, or null if none.
* @param cancellationSignal A signal to cancel the operation in progress, or null if none.
* If the operation is canceled, then {@link OperationCanceledException} will be thrown
* when the query is executed.
* @return A Cursor object, which is positioned before the first entry, or null
......@@ -343,7 +343,7 @@ public abstract class ContentResolver {
*/
public final Cursor query(final Uri uri, String[] projection,
String selection, String[] selectionArgs, String sortOrder,
CancelationSignal cancelationSignal) {
CancellationSignal cancellationSignal) {
IContentProvider provider = acquireProvider(uri);
if (provider == null) {
return null;
......@@ -351,14 +351,14 @@ public abstract class ContentResolver {
try {
long startTime = SystemClock.uptimeMillis();
ICancelationSignal remoteCancelationSignal = null;
if (cancelationSignal != null) {
cancelationSignal.throwIfCanceled();
remoteCancelationSignal = provider.createCancelationSignal();
cancelationSignal.setRemote(remoteCancelationSignal);
ICancellationSignal remoteCancellationSignal = null;
if (cancellationSignal != null) {
cancellationSignal.throwIfCanceled();
remoteCancellationSignal = provider.createCancellationSignal();
cancellationSignal.setRemote(remoteCancellationSignal);
}
Cursor qCursor = provider.query(uri, projection,
selection, selectionArgs, sortOrder, remoteCancelationSignal);
selection, selectionArgs, sortOrder, remoteCancellationSignal);
if (qCursor == null) {
releaseProvider(provider);
return null;
......
......@@ -48,7 +48,7 @@ public class CursorLoader extends AsyncTaskLoader<Cursor> {
String mSortOrder;
Cursor mCursor;
CancelationSignal mCancelationSignal;
CancellationSignal mCancellationSignal;
/* Runs on a worker thread */
@Override
......@@ -57,11 +57,11 @@ public class CursorLoader extends AsyncTaskLoader<Cursor> {
if (isLoadInBackgroundCanceled()) {
throw new OperationCanceledException();
}
mCancelationSignal = new CancelationSignal();
mCancellationSignal = new CancellationSignal();
}
try {
Cursor cursor = getContext().getContentResolver().query(mUri, mProjection, mSelection,
mSelectionArgs, mSortOrder, mCancelationSignal);
mSelectionArgs, mSortOrder, mCancellationSignal);
if (cursor != null) {
// Ensure the cursor window is filled
cursor.getCount();
......@@ -70,7 +70,7 @@ public class CursorLoader extends AsyncTaskLoader<Cursor> {
return cursor;
} finally {
synchronized (this) {
mCancelationSignal = null;
mCancellationSignal = null;
}
}
}
......@@ -80,8 +80,8 @@ public class CursorLoader extends AsyncTaskLoader<Cursor> {
super.cancelLoadInBackground();
synchronized (this) {
if (mCancelationSignal != null) {
mCancelationSignal.cancel();
if (mCancellationSignal != null) {
mCancellationSignal.cancel();
}
}
}
......
......@@ -19,6 +19,6 @@ package android.content;
/**
* @hide
*/
interface ICancelationSignal {
interface ICancellationSignal {
oneway void cancel();
}
......@@ -34,7 +34,7 @@ import java.util.ArrayList;
*/
public interface IContentProvider extends IInterface {
public Cursor query(Uri url, String[] projection, String selection,
String[] selectionArgs, String sortOrder, ICancelationSignal cancelationSignal)
String[] selectionArgs, String sortOrder, ICancellationSignal cancellationSignal)
throws RemoteException;
public String getType(Uri url) throws RemoteException;
public Uri insert(Uri url, ContentValues initialValues)
......@@ -51,7 +51,7 @@ public interface IContentProvider extends IInterface {
public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations)
throws RemoteException, OperationApplicationException;
public Bundle call(String method, String arg, Bundle extras) throws RemoteException;
public ICancelationSignal createCancelationSignal() throws RemoteException;
public ICancellationSignal createCancellationSignal() throws RemoteException;
// Data interchange.
public String[] getStreamTypes(Uri url, String mimeTypeFilter) throws RemoteException;
......
......@@ -19,7 +19,7 @@ package android.content;
/**
* An exception type that is thrown when an operation in progress is canceled.
*
* @see CancelationSignal
* @see CancellationSignal
*/
public class OperationCanceledException extends RuntimeException {
public OperationCanceledException() {
......
......@@ -18,7 +18,7 @@ package android.database.sqlite;
import dalvik.system.CloseGuard;
import android.content.CancelationSignal;
import android.content.CancellationSignal;
import android.content.OperationCanceledException;
import android.database.sqlite.SQLiteDebug.DbStats;
import android.os.SystemClock;
......@@ -284,7 +284,7 @@ public final class SQLiteConnectionPool implements Closeable {
* @param sql If not null, try to find a connection that already has
* the specified SQL statement in its prepared statement cache.
* @param connectionFlags The connection request flags.
* @param cancelationSignal A signal to cancel the operation in progress, or null if none.
* @param cancellationSignal A signal to cancel the operation in progress, or null if none.
* @return The connection that was acquired, never null.
*
* @throws IllegalStateException if the pool has been closed.
......@@ -292,8 +292,8 @@ public final class SQLiteConnectionPool implements Closeable {
* @throws OperationCanceledException if the operation was canceled.
*/
public SQLiteConnection acquireConnection(String sql, int connectionFlags,
CancelationSignal cancelationSignal) {
return waitForConnection(sql, connectionFlags, cancelationSignal);
CancellationSignal cancellationSignal) {
return waitForConnection(sql, connectionFlags, cancellationSignal);
}
/**
......@@ -503,7 +503,7 @@ public final class SQLiteConnectionPool implements Closeable {
// Might throw.
private SQLiteConnection waitForConnection(String sql, int connectionFlags,
CancelationSignal cancelationSignal) {
CancellationSignal cancellationSignal) {
final boolean wantPrimaryConnection =
(connectionFlags & CONNECTION_FLAG_PRIMARY_CONNECTION_AFFINITY) != 0;
......@@ -512,8 +512,8 @@ public final class SQLiteConnectionPool implements Closeable {
throwIfClosedLocked();
// Abort if canceled.
if (cancelationSignal != null) {
cancelationSignal.throwIfCanceled();
if (cancellationSignal != null) {
cancellationSignal.throwIfCanceled();
}
// Try to acquire a connection.
......@@ -550,9 +550,9 @@ public final class SQLiteConnectionPool implements Closeable {
mConnectionWaiterQueue = waiter;
}
if (cancelationSignal != null) {
if (cancellationSignal != null) {
final int nonce = waiter.mNonce;
cancelationSignal.setOnCancelListener(new CancelationSignal.OnCancelListener() {
cancellationSignal.setOnCancelListener(new CancellationSignal.OnCancelListener() {
@Override
public void onCancel() {
synchronized (mLock) {
......@@ -588,8 +588,8 @@ public final class SQLiteConnectionPool implements Closeable {
final SQLiteConnection connection = waiter.mAssignedConnection;
final RuntimeException ex = waiter.mException;
if (connection != null || ex != null) {
if (cancelationSignal != null) {
cancelationSignal.setOnCancelListener(null);
if (cancellationSignal != null) {
cancellationSignal.setOnCancelListener(null);
}
recycleConnectionWaiterLocked(waiter);
if (connection != null) {
......
......@@ -16,7 +16,7 @@
package android.database.sqlite;
import android.content.CancelationSignal;
import android.content.CancellationSignal;
import android.content.ContentValues;
import android.content.OperationCanceledException;
import android.content.res.Resources;
......@@ -967,7 +967,7 @@ public class SQLiteDatabase extends SQLiteClosable {
* default sort order, which may be unordered.
* @param limit Limits the number of rows returned by the query,
* formatted as LIMIT clause. Passing null denotes no LIMIT clause.
* @param cancelationSignal A signal to cancel the operation in progress, or null if none.
* @param cancellationSignal A signal to cancel the operation in progress, or null if none.
* If the operation is canceled, then {@link OperationCanceledException} will be thrown
* when the query is executed.
* @return A {@link Cursor} object, which is positioned before the first entry. Note that
......@@ -976,9 +976,9 @@ public class SQLiteDatabase extends SQLiteClosable {
*/
public Cursor query(boolean distinct, String table, String[] columns,
String selection, String[] selectionArgs, String groupBy,
String having, String orderBy, String limit, CancelationSignal cancelationSignal) {
String having, String orderBy, String limit, CancellationSignal cancellationSignal) {
return queryWithFactory(null, distinct, table, columns, selection, selectionArgs,
groupBy, having, orderBy, limit, cancelationSignal);
groupBy, having, orderBy, limit, cancellationSignal);
}
/**
......@@ -1049,7 +1049,7 @@ public class SQLiteDatabase extends SQLiteClosable {
* default sort order, which may be unordered.
* @param limit Limits the number of rows returned by the query,
* formatted as LIMIT clause. Passing null denotes no LIMIT clause.
* @param cancelationSignal A signal to cancel the operation in progress, or null if none.
* @param cancellationSignal A signal to cancel the operation in progress, or null if none.
* If the operation is canceled, then {@link OperationCanceledException} will be thrown
* when the query is executed.
* @return A {@link Cursor} object, which is positioned before the first entry. Note that
......@@ -1059,13 +1059,13 @@ public class SQLiteDatabase extends SQLiteClosable {
public Cursor queryWithFactory(CursorFactory cursorFactory,
boolean distinct, String table, String[] columns,
String selection, String[] selectionArgs, String groupBy,
String having, String orderBy, String limit, CancelationSignal cancelationSignal) {
String having, String orderBy, String limit, CancellationSignal cancellationSignal) {
throwIfNotOpen(); // fail fast
String sql = SQLiteQueryBuilder.buildQueryString(
distinct, table, columns, selection, groupBy, having, orderBy, limit);
return rawQueryWithFactory(cursorFactory, sql, selectionArgs,
findEditTable(table), cancelationSignal);
findEditTable(table), cancellationSignal);
}
/**
......@@ -1163,15 +1163,15 @@ public class SQLiteDatabase extends SQLiteClosable {
* @param selectionArgs You may include ?s in where clause in the query,
* which will be replaced by the values from selectionArgs. The
* values will be bound as Strings.
* @param cancelationSignal A signal to cancel the operation in progress, or null if none.
* @param cancellationSignal A signal to cancel the operation in progress, or null if none.
* If the operation is canceled, then {@link OperationCanceledException} will be thrown
* when the query is executed.
* @return A {@link Cursor} object, which is positioned before the first entry. Note that
* {@link Cursor}s are not synchronized, see the documentation for more details.
*/
public Cursor rawQuery(String sql, String[] selectionArgs,
CancelationSignal cancelationSignal) {
return rawQueryWithFactory(null, sql, selectionArgs, null, cancelationSignal);
CancellationSignal cancellationSignal) {
return rawQueryWithFactory(null, sql, selectionArgs, null, cancellationSignal);
}
/**
......@@ -1201,7 +1201,7 @@ public class SQLiteDatabase extends SQLiteClosable {
* which will be replaced by the values from selectionArgs. The
* values will be bound as Strings.
* @param editTable the name of the first table, which is editable
* @param cancelationSignal A signal to cancel the operation in progress, or null if none.
* @param cancellationSignal A signal to cancel the operation in progress, or null if none.
* If the operation is canceled, then {@link OperationCanceledException} will be thrown
* when the query is executed.
* @return A {@link Cursor} object, which is positioned before the first entry. Note that
......@@ -1209,11 +1209,11 @@ public class SQLiteDatabase extends SQLiteClosable {
*/
public Cursor rawQueryWithFactory(
CursorFactory cursorFactory, String sql, String[] selectionArgs,
String editTable, CancelationSignal cancelationSignal) {
String editTable, CancellationSignal cancellationSignal) {
throwIfNotOpen(); // fail fast
SQLiteCursorDriver driver = new SQLiteDirectCursorDriver(this, sql, editTable,
cancelationSignal);
cancellationSignal);
return driver.query(cursorFactory != null ? cursorFactory : mCursorFactory,
selectionArgs);
}
......
......@@ -16,7 +16,7 @@
package android.database.sqlite;
import android.content.CancelationSignal;
import android.content.CancellationSignal;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
......@@ -29,19 +29,19 @@ public class SQLiteDirectCursorDriver implements SQLiteCursorDriver {
private final SQLiteDatabase mDatabase;
private final String mEditTable;
private final String mSql;
private final CancelationSignal mCancelationSignal;
private final CancellationSignal mCancellationSignal;
private SQLiteQuery mQuery;
public SQLiteDirectCursorDriver(SQLiteDatabase db, String sql, String editTable,
CancelationSignal cancelationSignal) {
CancellationSignal cancellationSignal) {
mDatabase = db;
mEditTable = editTable;
mSql = sql;
mCancelationSignal = cancelationSignal;
mCancellationSignal = cancellationSignal;
}
public Cursor query(CursorFactory factory, String[] selectionArgs) {
final SQLiteQuery query = new SQLiteQuery(mDatabase, mSql, mCancelationSignal);
final SQLiteQuery query = new SQLiteQuery(mDatabase, mSql, mCancellationSignal);
final Cursor cursor;
try {
query.bindAllArgsAsStrings(selectionArgs);
......
......@@ -16,7 +16,7 @@
package android.database.sqlite;
import android.content.CancelationSignal;
import android.content.CancellationSignal;
import android.database.DatabaseUtils;
import java.util.Arrays;
......@@ -38,7 +38,7 @@ public abstract class SQLiteProgram extends SQLiteClosable {
private final Object[] mBindArgs;
SQLiteProgram(SQLiteDatabase db, String sql, Object[] bindArgs,
CancelationSignal cancelationSignalForPrepare) {
CancellationSignal cancellationSignalForPrepare) {
mDatabase = db;
mSql = sql.trim();
......@@ -57,7 +57,7 @@ public abstract class SQLiteProgram extends SQLiteClosable {
SQLiteStatementInfo info = new SQLiteStatementInfo();
db.getThreadSession().prepare(mSql,
db.getThreadDefaultConnectionFlags(assumeReadOnly),
cancelationSignalForPrepare, info);
cancellationSignalForPrepare, info);
mReadOnly = info.readOnly;
mColumnNames = info.columnNames;
mNumParameters = inf