Merge "Rename CancellationSignal using preferred spelling."
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -19,7 +19,7 @@ package android.database.sqlite;
|
||||
import dalvik.system.BlockGuard;
|
||||
import dalvik.system.CloseGuard;
|
||||
|
||||
import android.content.CancelationSignal;
|
||||
import android.content.CancellationSignal;
|
||||
import android.content.OperationCanceledException;
|
||||
import android.database.Cursor;
|
||||
import android.database.CursorWindow;
|
||||
@@ -84,7 +84,7 @@ import java.util.regex.Pattern;
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public final class SQLiteConnection implements CancelationSignal.OnCancelListener {
|
||||
public final class SQLiteConnection implements CancellationSignal.OnCancelListener {
|
||||
private static final String TAG = "SQLiteConnection";
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
@@ -110,11 +110,11 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
|
||||
private boolean mOnlyAllowReadOnlyOperations;
|
||||
|
||||
// The number of times attachCancelationSignal has been called.
|
||||
// The number of times attachCancellationSignal has been called.
|
||||
// Because SQLite statement execution can be re-entrant, we keep track of how many
|
||||
// times we have attempted to attach a cancelation signal to the connection so that
|
||||
// times we have attempted to attach a cancellation signal to the connection so that
|
||||
// we can ensure that we detach the signal at the right time.
|
||||
private int mCancelationSignalAttachCount;
|
||||
private int mCancellationSignalAttachCount;
|
||||
|
||||
private static native int nativeOpen(String path, int openFlags, String label,
|
||||
boolean enableTrace, boolean enableProfile);
|
||||
@@ -355,14 +355,14 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
*
|
||||
* @param sql The SQL statement to execute.
|
||||
* @param bindArgs The arguments to bind, or null if none.
|
||||
* @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.
|
||||
*
|
||||
* @throws SQLiteException if an error occurs, such as a syntax error
|
||||
* or invalid number of bind arguments.
|
||||
* @throws OperationCanceledException if the operation was canceled.
|
||||
*/
|
||||
public void execute(String sql, Object[] bindArgs,
|
||||
CancelationSignal cancelationSignal) {
|
||||
CancellationSignal cancellationSignal) {
|
||||
if (sql == null) {
|
||||
throw new IllegalArgumentException("sql must not be null.");
|
||||
}
|
||||
@@ -374,11 +374,11 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
throwIfStatementForbidden(statement);
|
||||
bindArguments(statement, bindArgs);
|
||||
applyBlockGuardPolicy(statement);
|
||||
attachCancelationSignal(cancelationSignal);
|
||||
attachCancellationSignal(cancellationSignal);
|
||||
try {
|
||||
nativeExecute(mConnectionPtr, statement.mStatementPtr);
|
||||
} finally {
|
||||
detachCancelationSignal(cancelationSignal);
|
||||
detachCancellationSignal(cancellationSignal);
|
||||
}
|
||||
} finally {
|
||||
releasePreparedStatement(statement);
|
||||
@@ -396,7 +396,7 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
*
|
||||
* @param sql The SQL statement to execute.
|
||||
* @param bindArgs The arguments to bind, or null if none.
|
||||
* @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 value of the first column in the first row of the result set
|
||||
* as a <code>long</code>, or zero if none.
|
||||
*
|
||||
@@ -405,7 +405,7 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
* @throws OperationCanceledException if the operation was canceled.
|
||||
*/
|
||||
public long executeForLong(String sql, Object[] bindArgs,
|
||||
CancelationSignal cancelationSignal) {
|
||||
CancellationSignal cancellationSignal) {
|
||||
if (sql == null) {
|
||||
throw new IllegalArgumentException("sql must not be null.");
|
||||
}
|
||||
@@ -417,11 +417,11 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
throwIfStatementForbidden(statement);
|
||||
bindArguments(statement, bindArgs);
|
||||
applyBlockGuardPolicy(statement);
|
||||
attachCancelationSignal(cancelationSignal);
|
||||
attachCancellationSignal(cancellationSignal);
|
||||
try {
|
||||
return nativeExecuteForLong(mConnectionPtr, statement.mStatementPtr);
|
||||
} finally {
|
||||
detachCancelationSignal(cancelationSignal);
|
||||
detachCancellationSignal(cancellationSignal);
|
||||
}
|
||||
} finally {
|
||||
releasePreparedStatement(statement);
|
||||
@@ -439,7 +439,7 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
*
|
||||
* @param sql The SQL statement to execute.
|
||||
* @param bindArgs The arguments to bind, or null if none.
|
||||
* @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 value of the first column in the first row of the result set
|
||||
* as a <code>String</code>, or null if none.
|
||||
*
|
||||
@@ -448,7 +448,7 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
* @throws OperationCanceledException if the operation was canceled.
|
||||
*/
|
||||
public String executeForString(String sql, Object[] bindArgs,
|
||||
CancelationSignal cancelationSignal) {
|
||||
CancellationSignal cancellationSignal) {
|
||||
if (sql == null) {
|
||||
throw new IllegalArgumentException("sql must not be null.");
|
||||
}
|
||||
@@ -460,11 +460,11 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
throwIfStatementForbidden(statement);
|
||||
bindArguments(statement, bindArgs);
|
||||
applyBlockGuardPolicy(statement);
|
||||
attachCancelationSignal(cancelationSignal);
|
||||
attachCancellationSignal(cancellationSignal);
|
||||
try {
|
||||
return nativeExecuteForString(mConnectionPtr, statement.mStatementPtr);
|
||||
} finally {
|
||||
detachCancelationSignal(cancelationSignal);
|
||||
detachCancellationSignal(cancellationSignal);
|
||||
}
|
||||
} finally {
|
||||
releasePreparedStatement(statement);
|
||||
@@ -483,7 +483,7 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
*
|
||||
* @param sql The SQL statement to execute.
|
||||
* @param bindArgs The arguments to bind, or null if none.
|
||||
* @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 file descriptor for a shared memory region that contains
|
||||
* the value of the first column in the first row of the result set as a BLOB,
|
||||
* or null if none.
|
||||
@@ -493,7 +493,7 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
* @throws OperationCanceledException if the operation was canceled.
|
||||
*/
|
||||
public ParcelFileDescriptor executeForBlobFileDescriptor(String sql, Object[] bindArgs,
|
||||
CancelationSignal cancelationSignal) {
|
||||
CancellationSignal cancellationSignal) {
|
||||
if (sql == null) {
|
||||
throw new IllegalArgumentException("sql must not be null.");
|
||||
}
|
||||
@@ -506,13 +506,13 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
throwIfStatementForbidden(statement);
|
||||
bindArguments(statement, bindArgs);
|
||||
applyBlockGuardPolicy(statement);
|
||||
attachCancelationSignal(cancelationSignal);
|
||||
attachCancellationSignal(cancellationSignal);
|
||||
try {
|
||||
int fd = nativeExecuteForBlobFileDescriptor(
|
||||
mConnectionPtr, statement.mStatementPtr);
|
||||
return fd >= 0 ? ParcelFileDescriptor.adoptFd(fd) : null;
|
||||
} finally {
|
||||
detachCancelationSignal(cancelationSignal);
|
||||
detachCancellationSignal(cancellationSignal);
|
||||
}
|
||||
} finally {
|
||||
releasePreparedStatement(statement);
|
||||
@@ -531,7 +531,7 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
*
|
||||
* @param sql The SQL statement to execute.
|
||||
* @param bindArgs The arguments to bind, or null if none.
|
||||
* @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 number of rows that were changed.
|
||||
*
|
||||
* @throws SQLiteException if an error occurs, such as a syntax error
|
||||
@@ -539,7 +539,7 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
* @throws OperationCanceledException if the operation was canceled.
|
||||
*/
|
||||
public int executeForChangedRowCount(String sql, Object[] bindArgs,
|
||||
CancelationSignal cancelationSignal) {
|
||||
CancellationSignal cancellationSignal) {
|
||||
if (sql == null) {
|
||||
throw new IllegalArgumentException("sql must not be null.");
|
||||
}
|
||||
@@ -552,12 +552,12 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
throwIfStatementForbidden(statement);
|
||||
bindArguments(statement, bindArgs);
|
||||
applyBlockGuardPolicy(statement);
|
||||
attachCancelationSignal(cancelationSignal);
|
||||
attachCancellationSignal(cancellationSignal);
|
||||
try {
|
||||
return nativeExecuteForChangedRowCount(
|
||||
mConnectionPtr, statement.mStatementPtr);
|
||||
} finally {
|
||||
detachCancelationSignal(cancelationSignal);
|
||||
detachCancellationSignal(cancellationSignal);
|
||||
}
|
||||
} finally {
|
||||
releasePreparedStatement(statement);
|
||||
@@ -576,7 +576,7 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
*
|
||||
* @param sql The SQL statement to execute.
|
||||
* @param bindArgs The arguments to bind, or null if none.
|
||||
* @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 row id of the last row that was inserted, or 0 if none.
|
||||
*
|
||||
* @throws SQLiteException if an error occurs, such as a syntax error
|
||||
@@ -584,7 +584,7 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
* @throws OperationCanceledException if the operation was canceled.
|
||||
*/
|
||||
public long executeForLastInsertedRowId(String sql, Object[] bindArgs,
|
||||
CancelationSignal cancelationSignal) {
|
||||
CancellationSignal cancellationSignal) {
|
||||
if (sql == null) {
|
||||
throw new IllegalArgumentException("sql must not be null.");
|
||||
}
|
||||
@@ -597,12 +597,12 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
throwIfStatementForbidden(statement);
|
||||
bindArguments(statement, bindArgs);
|
||||
applyBlockGuardPolicy(statement);
|
||||
attachCancelationSignal(cancelationSignal);
|
||||
attachCancellationSignal(cancellationSignal);
|
||||
try {
|
||||
return nativeExecuteForLastInsertedRowId(
|
||||
mConnectionPtr, statement.mStatementPtr);
|
||||
} finally {
|
||||
detachCancelationSignal(cancelationSignal);
|
||||
detachCancellationSignal(cancellationSignal);
|
||||
}
|
||||
} finally {
|
||||
releasePreparedStatement(statement);
|
||||
@@ -629,7 +629,7 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
* so that it does. Must be greater than or equal to <code>startPos</code>.
|
||||
* @param countAllRows True to count all rows that the query would return
|
||||
* regagless of whether they fit in the window.
|
||||
* @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 number of rows that were counted during query execution. Might
|
||||
* not be all rows in the result set unless <code>countAllRows</code> is true.
|
||||
*
|
||||
@@ -639,7 +639,7 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
*/
|
||||
public int executeForCursorWindow(String sql, Object[] bindArgs,
|
||||
CursorWindow window, int startPos, int requiredPos, boolean countAllRows,
|
||||
CancelationSignal cancelationSignal) {
|
||||
CancellationSignal cancellationSignal) {
|
||||
if (sql == null) {
|
||||
throw new IllegalArgumentException("sql must not be null.");
|
||||
}
|
||||
@@ -658,7 +658,7 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
throwIfStatementForbidden(statement);
|
||||
bindArguments(statement, bindArgs);
|
||||
applyBlockGuardPolicy(statement);
|
||||
attachCancelationSignal(cancelationSignal);
|
||||
attachCancellationSignal(cancellationSignal);
|
||||
try {
|
||||
final long result = nativeExecuteForCursorWindow(
|
||||
mConnectionPtr, statement.mStatementPtr, window.mWindowPtr,
|
||||
@@ -669,7 +669,7 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
window.setStartPosition(actualPos);
|
||||
return countedRows;
|
||||
} finally {
|
||||
detachCancelationSignal(cancelationSignal);
|
||||
detachCancellationSignal(cancellationSignal);
|
||||
}
|
||||
} finally {
|
||||
releasePreparedStatement(statement);
|
||||
@@ -751,40 +751,40 @@ public final class SQLiteConnection implements CancelationSignal.OnCancelListene
|
||||
recyclePreparedStatement(statement);
|
||||
}
|
||||
|
||||
private void attachCancelationSignal(CancelationSignal cancelationSignal) {
|
||||
if (cancelationSignal != null) {
|
||||
cancelationSignal.throwIfCanceled();
|
||||
private void attachCancellationSignal(CancellationSignal cancellationSignal) {
|
||||
if (cancellationSignal != null) {
|
||||
cancellationSignal.throwIfCanceled();
|
||||
|
||||
mCancelationSignalAttachCount += 1;
|
||||
if (mCancelationSignalAttachCount == 1) {
|
||||
// Reset cancelation flag before executing the statement.
|
||||
mCancellationSignalAttachCount += 1;
|
||||
if (mCancellationSignalAttachCount == 1) {
|
||||
// Reset cancellation flag before executing the statement.
|
||||
nativeResetCancel(mConnectionPtr, true /*cancelable*/);
|
||||
|
||||
// After this point, onCancel() may be called concurrently.
|
||||
cancelationSignal.setOnCancelListener(this);
|
||||
cancellationSignal.setOnCancelListener(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void detachCancelationSignal(CancelationSignal cancelationSignal) {
|
||||
if (cancelationSignal != null) {
|
||||
assert mCancelationSignalAttachCount > 0;
|
||||
private void detachCancellationSignal(CancellationSignal cancellationSignal) {
|
||||
if (cancellationSignal != null) {
|
||||
assert mCancellationSignalAttachCount > 0;
|
||||
|
||||
mCancelationSignalAttachCount -= 1;
|
||||
if (mCancelationSignalAttachCount == 0) {
|
||||
mCancellationSignalAttachCount -= 1;
|
||||
if (mCancellationSignalAttachCount == 0) {
|
||||
// After this point, onCancel() cannot be called concurrently.
|
||||
cancelationSignal.setOnCancelListener(null);
|
||||
cancellationSignal.setOnCancelListener(null);
|
||||
|
||||
// Reset cancelation flag after executing the statement.
|
||||
// Reset cancellation flag after executing the statement.
|
||||
nativeResetCancel(mConnectionPtr, false /*cancelable*/);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CancelationSignal.OnCancelationListener callback.
|
||||
// CancellationSignal.OnCancelListener callback.
|
||||
// This method may be called on a different thread than the executing statement.
|
||||
// However, it will only be called between calls to attachCancelationSignal and
|
||||
// detachCancelationSignal, while a statement is executing. We can safely assume
|
||||
// However, it will only be called between calls to attachCancellationSignal and
|
||||
// detachCancellationSignal, while a statement is executing. We can safely assume
|
||||
// that the SQLite connection is still alive.
|
||||
@Override
|
||||
public void onCancel() {
|
||||
|
||||
@@ -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 = info.numParameters;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package android.database.sqlite;
|
||||
|
||||
import android.content.CancelationSignal;
|
||||
import android.content.CancellationSignal;
|
||||
import android.content.OperationCanceledException;
|
||||
import android.database.CursorWindow;
|
||||
import android.util.Log;
|
||||
@@ -31,12 +31,12 @@ import android.util.Log;
|
||||
public final class SQLiteQuery extends SQLiteProgram {
|
||||
private static final String TAG = "SQLiteQuery";
|
||||
|
||||
private final CancelationSignal mCancelationSignal;
|
||||
private final CancellationSignal mCancellationSignal;
|
||||
|
||||
SQLiteQuery(SQLiteDatabase db, String query, CancelationSignal cancelationSignal) {
|
||||
super(db, query, null, cancelationSignal);
|
||||
SQLiteQuery(SQLiteDatabase db, String query, CancellationSignal cancellationSignal) {
|
||||
super(db, query, null, cancellationSignal);
|
||||
|
||||
mCancelationSignal = cancelationSignal;
|
||||
mCancellationSignal = cancellationSignal;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,7 +61,7 @@ public final class SQLiteQuery extends SQLiteProgram {
|
||||
try {
|
||||
int numRows = getSession().executeForCursorWindow(getSql(), getBindArgs(),
|
||||
window, startPos, requiredPos, countAllRows, getConnectionFlags(),
|
||||
mCancelationSignal);
|
||||
mCancellationSignal);
|
||||
return numRows;
|
||||
} catch (SQLiteDatabaseCorruptException ex) {
|
||||
onCorruption();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package android.database.sqlite;
|
||||
|
||||
import android.content.CancelationSignal;
|
||||
import android.content.CancellationSignal;
|
||||
import android.content.OperationCanceledException;
|
||||
import android.database.Cursor;
|
||||
import android.database.DatabaseUtils;
|
||||
@@ -292,7 +292,7 @@ public class SQLiteQueryBuilder
|
||||
String selection, String[] selectionArgs, String groupBy,
|
||||
String having, String sortOrder) {
|
||||
return query(db, projectionIn, selection, selectionArgs, groupBy, having, sortOrder,
|
||||
null /* limit */, null /* cancelationSignal */);
|
||||
null /* limit */, null /* cancellationSignal */);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -362,7 +362,7 @@ public class SQLiteQueryBuilder
|
||||
* will use the 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 cursor over the result set
|
||||
@@ -371,7 +371,7 @@ public class SQLiteQueryBuilder
|
||||
*/
|
||||
public Cursor query(SQLiteDatabase db, String[] projectionIn,
|
||||
String selection, String[] selectionArgs, String groupBy,
|
||||
String having, String sortOrder, String limit, CancelationSignal cancelationSignal) {
|
||||
String having, String sortOrder, String limit, CancellationSignal cancellationSignal) {
|
||||
if (mTables == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -387,7 +387,7 @@ public class SQLiteQueryBuilder
|
||||
String sqlForValidation = buildQuery(projectionIn, "(" + selection + ")", groupBy,
|
||||
having, sortOrder, limit);
|
||||
validateQuerySql(db, sqlForValidation,
|
||||
cancelationSignal); // will throw if query is invalid
|
||||
cancellationSignal); // will throw if query is invalid
|
||||
}
|
||||
|
||||
String sql = buildQuery(
|
||||
@@ -400,7 +400,7 @@ public class SQLiteQueryBuilder
|
||||
return db.rawQueryWithFactory(
|
||||
mFactory, sql, selectionArgs,
|
||||
SQLiteDatabase.findEditTable(mTables),
|
||||
cancelationSignal); // will throw if query is invalid
|
||||
cancellationSignal); // will throw if query is invalid
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -408,9 +408,9 @@ public class SQLiteQueryBuilder
|
||||
* If the SQL statement is not valid, this method will throw a {@link SQLiteException}.
|
||||
*/
|
||||
private void validateQuerySql(SQLiteDatabase db, String sql,
|
||||
CancelationSignal cancelationSignal) {
|
||||
CancellationSignal cancellationSignal) {
|
||||
db.getThreadSession().prepare(sql,
|
||||
db.getThreadDefaultConnectionFlags(true /*readOnly*/), cancelationSignal, null);
|
||||
db.getThreadDefaultConnectionFlags(true /*readOnly*/), cancellationSignal, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package android.database.sqlite;
|
||||
|
||||
import android.content.CancelationSignal;
|
||||
import android.content.CancellationSignal;
|
||||
import android.content.OperationCanceledException;
|
||||
import android.database.CursorWindow;
|
||||
import android.database.DatabaseUtils;
|
||||
@@ -280,7 +280,7 @@ public final class SQLiteSession {
|
||||
* @param transactionListener The transaction listener, or null if none.
|
||||
* @param connectionFlags The connection flags to use if a connection must be
|
||||
* acquired by this operation. Refer to {@link SQLiteConnectionPool}.
|
||||
* @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.
|
||||
*
|
||||
* @throws IllegalStateException if {@link #setTransactionSuccessful} has already been
|
||||
* called for the current transaction.
|
||||
@@ -293,21 +293,21 @@ public final class SQLiteSession {
|
||||
*/
|
||||
public void beginTransaction(int transactionMode,
|
||||
SQLiteTransactionListener transactionListener, int connectionFlags,
|
||||
CancelationSignal cancelationSignal) {
|
||||
CancellationSignal cancellationSignal) {
|
||||
throwIfTransactionMarkedSuccessful();
|
||||
beginTransactionUnchecked(transactionMode, transactionListener, connectionFlags,
|
||||
cancelationSignal);
|
||||
cancellationSignal);
|
||||
}
|
||||
|
||||
private void beginTransactionUnchecked(int transactionMode,
|
||||
SQLiteTransactionListener transactionListener, int connectionFlags,
|
||||
CancelationSignal cancelationSignal) {
|
||||
if (cancelationSignal != null) {
|
||||
cancelationSignal.throwIfCanceled();
|
||||
CancellationSignal cancellationSignal) {
|
||||
if (cancellationSignal != null) {
|
||||
cancellationSignal.throwIfCanceled();
|
||||
}
|
||||
|
||||
if (mTransactionStack == null) {
|
||||
acquireConnection(null, connectionFlags, cancelationSignal); // might throw
|
||||
acquireConnection(null, connectionFlags, cancellationSignal); // might throw
|
||||
}
|
||||
try {
|
||||
// Set up the transaction such that we can back out safely
|
||||
@@ -317,14 +317,14 @@ public final class SQLiteSession {
|
||||
switch (transactionMode) {
|
||||
case TRANSACTION_MODE_IMMEDIATE:
|
||||
mConnection.execute("BEGIN IMMEDIATE;", null,
|
||||
cancelationSignal); // might throw
|
||||
cancellationSignal); // might throw
|
||||
break;
|
||||
case TRANSACTION_MODE_EXCLUSIVE:
|
||||
mConnection.execute("BEGIN EXCLUSIVE;", null,
|
||||
cancelationSignal); // might throw
|
||||
cancellationSignal); // might throw
|
||||
break;
|
||||
default:
|
||||
mConnection.execute("BEGIN;", null, cancelationSignal); // might throw
|
||||
mConnection.execute("BEGIN;", null, cancellationSignal); // might throw
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -335,7 +335,7 @@ public final class SQLiteSession {
|
||||
transactionListener.onBegin(); // might throw
|
||||
} catch (RuntimeException ex) {
|
||||
if (mTransactionStack == null) {
|
||||
mConnection.execute("ROLLBACK;", null, cancelationSignal); // might throw
|
||||
mConnection.execute("ROLLBACK;", null, cancellationSignal); // might throw
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
@@ -384,7 +384,7 @@ public final class SQLiteSession {
|
||||
* This method must be called exactly once for each call to {@link #beginTransaction}.
|
||||
* </p>
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @throws IllegalStateException if there is no current transaction.
|
||||
* @throws SQLiteException if an error occurs.
|
||||
@@ -394,16 +394,16 @@ public final class SQLiteSession {
|
||||
* @see #setTransactionSuccessful
|
||||
* @see #yieldTransaction
|
||||
*/
|
||||
public void endTransaction(CancelationSignal cancelationSignal) {
|
||||
public void endTransaction(CancellationSignal cancellationSignal) {
|
||||
throwIfNoTransaction();
|
||||
assert mConnection != null;
|
||||
|
||||
endTransactionUnchecked(cancelationSignal);
|
||||
endTransactionUnchecked(cancellationSignal);
|
||||
}
|
||||
|
||||
private void endTransactionUnchecked(CancelationSignal cancelationSignal) {
|
||||
if (cancelationSignal != null) {
|
||||
cancelationSignal.throwIfCanceled();
|
||||
private void endTransactionUnchecked(CancellationSignal cancellationSignal) {
|
||||
if (cancellationSignal != null) {
|
||||
cancellationSignal.throwIfCanceled();
|
||||
}
|
||||
|
||||
final Transaction top = mTransactionStack;
|
||||
@@ -434,9 +434,9 @@ public final class SQLiteSession {
|
||||
} else {
|
||||
try {
|
||||
if (successful) {
|
||||
mConnection.execute("COMMIT;", null, cancelationSignal); // might throw
|
||||
mConnection.execute("COMMIT;", null, cancellationSignal); // might throw
|
||||
} else {
|
||||
mConnection.execute("ROLLBACK;", null, cancelationSignal); // might throw
|
||||
mConnection.execute("ROLLBACK;", null, cancellationSignal); // might throw
|
||||
}
|
||||
} finally {
|
||||
releaseConnection(); // might throw
|
||||
@@ -487,7 +487,7 @@ public final class SQLiteSession {
|
||||
* @param throwIfUnsafe If true, then instead of returning false when no
|
||||
* transaction is in progress, a nested transaction is in progress, or when
|
||||
* the transaction has already been marked successful, throws {@link IllegalStateException}.
|
||||
* @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 True if the transaction was actually yielded.
|
||||
*
|
||||
* @throws IllegalStateException if <code>throwIfNested</code> is true and
|
||||
@@ -500,7 +500,7 @@ public final class SQLiteSession {
|
||||
* @see #endTransaction
|
||||
*/
|
||||
public boolean yieldTransaction(long sleepAfterYieldDelayMillis, boolean throwIfUnsafe,
|
||||
CancelationSignal cancelationSignal) {
|
||||
CancellationSignal cancellationSignal) {
|
||||
if (throwIfUnsafe) {
|
||||
throwIfNoTransaction();
|
||||
throwIfTransactionMarkedSuccessful();
|
||||
@@ -518,13 +518,13 @@ public final class SQLiteSession {
|
||||
}
|
||||
|
||||
return yieldTransactionUnchecked(sleepAfterYieldDelayMillis,
|
||||
cancelationSignal); // might throw
|
||||
cancellationSignal); // might throw
|
||||
}
|
||||
|
||||
private boolean yieldTransactionUnchecked(long sleepAfterYieldDelayMillis,
|
||||
CancelationSignal cancelationSignal) {
|
||||
if (cancelationSignal != null) {
|
||||
cancelationSignal.throwIfCanceled();
|
||||
CancellationSignal cancellationSignal) {
|
||||
if (cancellationSignal != null) {
|
||||
cancellationSignal.throwIfCanceled();
|
||||
}
|
||||
|
||||
if (!mConnectionPool.shouldYieldConnection(mConnection, mConnectionFlags)) {
|
||||
@@ -534,7 +534,7 @@ public final class SQLiteSession {
|
||||
final int transactionMode = mTransactionStack.mMode;
|
||||
final SQLiteTransactionListener listener = mTransactionStack.mListener;
|
||||
final int connectionFlags = mConnectionFlags;
|
||||
endTransactionUnchecked(cancelationSignal); // might throw
|
||||
endTransactionUnchecked(cancellationSignal); // might throw
|
||||
|
||||
if (sleepAfterYieldDelayMillis > 0) {
|
||||
try {
|
||||
@@ -545,7 +545,7 @@ public final class SQLiteSession {
|
||||
}
|
||||
|
||||
beginTransactionUnchecked(transactionMode, listener, connectionFlags,
|
||||
cancelationSignal); // might throw
|
||||
cancellationSignal); // might throw
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -566,24 +566,24 @@ public final class SQLiteSession {
|
||||
* @param sql The SQL statement to prepare.
|
||||
* @param connectionFlags The connection flags to use if a connection must be
|
||||
* acquired by this operation. Refer to {@link SQLiteConnectionPool}.
|
||||
* @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.
|
||||
* @param outStatementInfo The {@link SQLiteStatementInfo} object to populate
|
||||
* with information about the statement, or null if none.
|
||||
*
|
||||
* @throws SQLiteException if an error occurs, such as a syntax error.
|
||||
* @throws OperationCanceledException if the operation was canceled.
|
||||
*/
|
||||
public void prepare(String sql, int connectionFlags, CancelationSignal cancelationSignal,
|
||||
public void prepare(String sql, int connectionFlags, CancellationSignal cancellationSignal,
|
||||
SQLiteStatementInfo outStatementInfo) {
|
||||
if (sql == null) {
|
||||
throw new IllegalArgumentException("sql must not be null.");
|
||||
}
|
||||
|
||||
if (cancelationSignal != null) {
|
||||
cancelationSignal.throwIfCanceled();
|
||||
if (cancellationSignal != null) {
|
||||
cancellationSignal.throwIfCanceled();
|
||||
}
|
||||
|
||||
acquireConnection(sql, connectionFlags, cancelationSignal); // might throw
|
||||
acquireConnection(sql, connectionFlags, cancellationSignal); // might throw
|
||||
try {
|
||||
mConnection.prepare(sql, outStatementInfo); // might throw
|
||||
} finally {
|
||||
@@ -598,25 +598,25 @@ public final class SQLiteSession {
|
||||
* @param bindArgs The arguments to bind, or null if none.
|
||||
* @param connectionFlags The connection flags to use if a connection must be
|
||||
* acquired by this operation. Refer to {@link SQLiteConnectionPool}.
|
||||
* @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.
|
||||
*
|
||||
* @throws SQLiteException if an error occurs, such as a syntax error
|
||||
* or invalid number of bind arguments.
|
||||
* @throws OperationCanceledException if the operation was canceled.
|
||||
*/
|
||||
public void execute(String sql, Object[] bindArgs, int connectionFlags,
|
||||
CancelationSignal cancelationSignal) {
|
||||
CancellationSignal cancellationSignal) {
|
||||
if (sql == null) {
|
||||
throw new IllegalArgumentException("sql must not be null.");
|
||||
}
|
||||
|
||||
if (executeSpecial(sql, bindArgs, connectionFlags, cancelationSignal)) {
|
||||
if (executeSpecial(sql, bindArgs, connectionFlags, cancellationSignal)) {
|
||||
return;
|
||||
}
|
||||
|
||||
acquireConnection(sql, connectionFlags, cancelationSignal); // might throw
|
||||
acquireConnection(sql, connectionFlags, cancellationSignal); // might throw
|
||||
try {
|
||||
mConnection.execute(sql, bindArgs, cancelationSignal); // might throw
|
||||
mConnection.execute(sql, bindArgs, cancellationSignal); // might throw
|
||||
} finally {
|
||||
releaseConnection(); // might throw
|
||||
}
|
||||
@@ -629,7 +629,7 @@ public final class SQLiteSession {
|
||||
* @param bindArgs The arguments to bind, or null if none.
|
||||
* @param connectionFlags The connection flags to use if a connection must be
|
||||
* acquired by this operation. Refer to {@link SQLiteConnectionPool}.
|
||||
* @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 value of the first column in the first row of the result set
|
||||
* as a <code>long</code>, or zero if none.
|
||||
*
|
||||
@@ -638,18 +638,18 @@ public final class SQLiteSession {
|
||||
* @throws OperationCanceledException if the operation was canceled.
|
||||
*/
|
||||
public long executeForLong(String sql, Object[] bindArgs, int connectionFlags,
|
||||
CancelationSignal cancelationSignal) {
|
||||
CancellationSignal cancellationSignal) {
|
||||
if (sql == null) {
|
||||
throw new IllegalArgumentException("sql must not be null.");
|
||||
}
|
||||
|
||||
if (executeSpecial(sql, bindArgs, connectionFlags, cancelationSignal)) {
|
||||
if (executeSpecial(sql, bindArgs, connectionFlags, cancellationSignal)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
acquireConnection(sql, connectionFlags, cancelationSignal); // might throw
|
||||
acquireConnection(sql, connectionFlags, cancellationSignal); // might throw
|
||||
try {
|
||||
return mConnection.executeForLong(sql, bindArgs, cancelationSignal); // might throw
|
||||
return mConnection.executeForLong(sql, bindArgs, cancellationSignal); // might throw
|
||||
} finally {
|
||||
releaseConnection(); // might throw
|
||||
}
|
||||
@@ -662,7 +662,7 @@ public final class SQLiteSession {
|
||||
* @param bindArgs The arguments to bind, or null if none.
|
||||
* @param connectionFlags The connection flags to use if a connection must be
|
||||
* acquired by this operation. Refer to {@link SQLiteConnectionPool}.
|
||||
* @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 value of the first column in the first row of the result set
|
||||
* as a <code>String</code>, or null if none.
|
||||
*
|
||||
@@ -671,18 +671,18 @@ public final class SQLiteSession {
|
||||
* @throws OperationCanceledException if the operation was canceled.
|
||||
*/
|
||||
public String executeForString(String sql, Object[] bindArgs, int connectionFlags,
|
||||
CancelationSignal cancelationSignal) {
|
||||
CancellationSignal cancellationSignal) {
|
||||
if (sql == null) {
|
||||
throw new IllegalArgumentException("sql must not be null.");
|
||||
}
|
||||
|
||||
if (executeSpecial(sql, bindArgs, connectionFlags, cancelationSignal)) {
|
||||
if (executeSpecial(sql, bindArgs, connectionFlags, cancellationSignal)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
acquireConnection(sql, connectionFlags, cancelationSignal); // might throw
|
||||
acquireConnection(sql, connectionFlags, cancellationSignal); // might throw
|
||||
try {
|
||||
return mConnection.executeForString(sql, bindArgs, cancelationSignal); // might throw
|
||||
return mConnection.executeForString(sql, bindArgs, cancellationSignal); // might throw
|
||||
} finally {
|
||||
releaseConnection(); // might throw
|
||||
}
|
||||
@@ -696,7 +696,7 @@ public final class SQLiteSession {
|
||||
* @param bindArgs The arguments to bind, or null if none.
|
||||
* @param connectionFlags The connection flags to use if a connection must be
|
||||
* acquired by this operation. Refer to {@link SQLiteConnectionPool}.
|
||||
* @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 file descriptor for a shared memory region that contains
|
||||
* the value of the first column in the first row of the result set as a BLOB,
|
||||
* or null if none.
|
||||
@@ -706,19 +706,19 @@ public final class SQLiteSession {
|
||||
* @throws OperationCanceledException if the operation was canceled.
|
||||
*/
|
||||
public ParcelFileDescriptor executeForBlobFileDescriptor(String sql, Object[] bindArgs,
|
||||
int connectionFlags, CancelationSignal cancelationSignal) {
|
||||
int connectionFlags, CancellationSignal cancellationSignal) {
|
||||
if (sql == null) {
|
||||
throw new IllegalArgumentException("sql must not be null.");
|
||||
}
|
||||
|
||||
if (executeSpecial(sql, bindArgs, connectionFlags, cancelationSignal)) {
|
||||
if (executeSpecial(sql, bindArgs, connectionFlags, cancellationSignal)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
acquireConnection(sql, connectionFlags, cancelationSignal); // might throw
|
||||
acquireConnection(sql, connectionFlags, cancellationSignal); // might throw
|
||||
try {
|
||||
return mConnection.executeForBlobFileDescriptor(sql, bindArgs,
|
||||
cancelationSignal); // might throw
|
||||
cancellationSignal); // might throw
|
||||
} finally {
|
||||
releaseConnection(); // might throw
|
||||
}
|
||||
@@ -732,7 +732,7 @@ public final class SQLiteSession {
|
||||
* @param bindArgs The arguments to bind, or null if none.
|
||||
* @param connectionFlags The connection flags to use if a connection must be
|
||||
* acquired by this operation. Refer to {@link SQLiteConnectionPool}.
|
||||
* @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 number of rows that were changed.
|
||||
*
|
||||
* @throws SQLiteException if an error occurs, such as a syntax error
|
||||
@@ -740,19 +740,19 @@ public final class SQLiteSession {
|
||||
* @throws OperationCanceledException if the operation was canceled.
|
||||
*/
|
||||
public int executeForChangedRowCount(String sql, Object[] bindArgs, int connectionFlags,
|
||||
CancelationSignal cancelationSignal) {
|
||||
CancellationSignal cancellationSignal) {
|
||||
if (sql == null) {
|
||||
throw new IllegalArgumentException("sql must not be null.");
|
||||
}
|
||||
|
||||
if (executeSpecial(sql, bindArgs, connectionFlags, cancelationSignal)) {
|
||||
if (executeSpecial(sql, bindArgs, connectionFlags, cancellationSignal)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
acquireConnection(sql, connectionFlags, cancelationSignal); // might throw
|
||||
acquireConnection(sql, connectionFlags, cancellationSignal); // might throw
|
||||
try {
|
||||
return mConnection.executeForChangedRowCount(sql, bindArgs,
|
||||
cancelationSignal); // might throw
|
||||
cancellationSignal); // might throw
|
||||
} finally {
|
||||
releaseConnection(); // might throw
|
||||
}
|
||||
@@ -766,7 +766,7 @@ public final class SQLiteSession {
|
||||
* @param bindArgs The arguments to bind, or null if none.
|
||||
* @param connectionFlags The connection flags to use if a connection must be
|
||||
* acquired by this operation. Refer to {@link SQLiteConnectionPool}.
|
||||
* @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 row id of the last row that was inserted, or 0 if none.
|
||||
*
|
||||
* @throws SQLiteException if an error occurs, such as a syntax error
|
||||
@@ -774,19 +774,19 @@ public final class SQLiteSession {
|
||||
* @throws OperationCanceledException if the operation was canceled.
|
||||
*/
|
||||
public long executeForLastInsertedRowId(String sql, Object[] bindArgs, int connectionFlags,
|
||||
CancelationSignal cancelationSignal) {
|
||||
CancellationSignal cancellationSignal) {
|
||||
if (sql == null) {
|
||||
throw new IllegalArgumentException("sql must not be null.");
|
||||
}
|
||||
|
||||
if (executeSpecial(sql, bindArgs, connectionFlags, cancelationSignal)) {
|
||||
if (executeSpecial(sql, bindArgs, connectionFlags, cancellationSignal)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
acquireConnection(sql, connectionFlags, cancelationSignal); // might throw
|
||||
acquireConnection(sql, connectionFlags, cancellationSignal); // might throw
|
||||
try {
|
||||
return mConnection.executeForLastInsertedRowId(sql, bindArgs,
|
||||
cancelationSignal); // might throw
|
||||
cancellationSignal); // might throw
|
||||
} finally {
|
||||
releaseConnection(); // might throw
|
||||
}
|
||||
@@ -808,7 +808,7 @@ public final class SQLiteSession {
|
||||
* regagless of whether they fit in the window.
|
||||
* @param connectionFlags The connection flags to use if a connection must be
|
||||
* acquired by this operation. Refer to {@link SQLiteConnectionPool}.
|
||||
* @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 number of rows that were counted during query execution. Might
|
||||
* not be all rows in the result set unless <code>countAllRows</code> is true.
|
||||
*
|
||||
@@ -818,7 +818,7 @@ public final class SQLiteSession {
|
||||
*/
|
||||
public int executeForCursorWindow(String sql, Object[] bindArgs,
|
||||
CursorWindow window, int startPos, int requiredPos, boolean countAllRows,
|
||||
int connectionFlags, CancelationSignal cancelationSignal) {
|
||||
int connectionFlags, CancellationSignal cancellationSignal) {
|
||||
if (sql == null) {
|
||||
throw new IllegalArgumentException("sql must not be null.");
|
||||
}
|
||||
@@ -826,16 +826,16 @@ public final class SQLiteSession {
|
||||
throw new IllegalArgumentException("window must not be null.");
|
||||
}
|
||||
|
||||
if (executeSpecial(sql, bindArgs, connectionFlags, cancelationSignal)) {
|
||||
if (executeSpecial(sql, bindArgs, connectionFlags, cancellationSignal)) {
|
||||
window.clear();
|
||||
return 0;
|
||||
}
|
||||
|
||||
acquireConnection(sql, connectionFlags, cancelationSignal); // might throw
|
||||
acquireConnection(sql, connectionFlags, cancellationSignal); // might throw
|
||||
try {
|
||||
return mConnection.executeForCursorWindow(sql, bindArgs,
|
||||
window, startPos, requiredPos, countAllRows,
|
||||
cancelationSignal); // might throw
|
||||
cancellationSignal); // might throw
|
||||
} finally {
|
||||
releaseConnection(); // might throw
|
||||
}
|
||||
@@ -854,7 +854,7 @@ public final class SQLiteSession {
|
||||
* @param bindArgs The arguments to bind, or null if none.
|
||||
* @param connectionFlags The connection flags to use if a connection must be
|
||||
* acquired by this operation. Refer to {@link SQLiteConnectionPool}.
|
||||
* @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 True if the statement was of a special form that was handled here,
|
||||
* false otherwise.
|
||||
*
|
||||
@@ -863,36 +863,36 @@ public final class SQLiteSession {
|
||||
* @throws OperationCanceledException if the operation was canceled.
|
||||
*/
|
||||
private boolean executeSpecial(String sql, Object[] bindArgs, int connectionFlags,
|
||||
CancelationSignal cancelationSignal) {
|
||||
if (cancelationSignal != null) {
|
||||
cancelationSignal.throwIfCanceled();
|
||||
CancellationSignal cancellationSignal) {
|
||||
if (cancellationSignal != null) {
|
||||
cancellationSignal.throwIfCanceled();
|
||||
}
|
||||
|
||||
final int type = DatabaseUtils.getSqlStatementType(sql);
|
||||
switch (type) {
|
||||
case DatabaseUtils.STATEMENT_BEGIN:
|
||||
beginTransaction(TRANSACTION_MODE_EXCLUSIVE, null, connectionFlags,
|
||||
cancelationSignal);
|
||||
cancellationSignal);
|
||||
return true;
|
||||
|
||||
case DatabaseUtils.STATEMENT_COMMIT:
|
||||
setTransactionSuccessful();
|
||||
endTransaction(cancelationSignal);
|
||||
endTransaction(cancellationSignal);
|
||||
return true;
|
||||
|
||||
case DatabaseUtils.STATEMENT_ABORT:
|
||||
endTransaction(cancelationSignal);
|
||||
endTransaction(cancellationSignal);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void acquireConnection(String sql, int connectionFlags,
|
||||
CancelationSignal cancelationSignal) {
|
||||
CancellationSignal cancellationSignal) {
|
||||
if (mConnection == null) {
|
||||
assert mConnectionUseCount == 0;
|
||||
mConnection = mConnectionPool.acquireConnection(sql, connectionFlags,
|
||||
cancelationSignal); // might throw
|
||||
cancellationSignal); // might throw
|
||||
mConnectionFlags = connectionFlags;
|
||||
}
|
||||
mConnectionUseCount += 1;
|
||||
|
||||
@@ -21,7 +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.ICancellationSignal;
|
||||
import android.content.IContentProvider;
|
||||
import android.content.OperationApplicationException;
|
||||
import android.content.pm.PathPermission;
|
||||
@@ -93,7 +93,7 @@ public class MockContentProvider extends ContentProvider {
|
||||
|
||||
@Override
|
||||
public Cursor query(Uri url, String[] projection, String selection, String[] selectionArgs,
|
||||
String sortOrder, ICancelationSignal cancelationSignal) throws RemoteException {
|
||||
String sortOrder, ICancellationSignal cancellationSignal) throws RemoteException {
|
||||
return MockContentProvider.this.query(url, projection, selection,
|
||||
selectionArgs, sortOrder);
|
||||
}
|
||||
@@ -127,7 +127,7 @@ public class MockContentProvider extends ContentProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICancelationSignal createCancelationSignal() throws RemoteException {
|
||||
public ICancellationSignal createCancellationSignal() throws RemoteException {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +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.ICancellationSignal;
|
||||
import android.content.res.AssetFileDescriptor;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
@@ -73,7 +73,7 @@ public class MockIContentProvider implements IContentProvider {
|
||||
}
|
||||
|
||||
public Cursor query(Uri url, String[] projection, String selection, String[] selectionArgs,
|
||||
String sortOrder, ICancelationSignal cancelationSignal) {
|
||||
String sortOrder, ICancellationSignal cancellationSignal) {
|
||||
throw new UnsupportedOperationException("unimplemented mock method");
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ public class MockIContentProvider implements IContentProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICancelationSignal createCancelationSignal() throws RemoteException {
|
||||
public ICancellationSignal createCancellationSignal() throws RemoteException {
|
||||
throw new UnsupportedOperationException("unimplemented mock method");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package com.android.layoutlib.bridge.android;
|
||||
import android.content.ContentProviderOperation;
|
||||
import android.content.ContentProviderResult;
|
||||
import android.content.ContentValues;
|
||||
import android.content.ICancelationSignal;
|
||||
import android.content.ICancellationSignal;
|
||||
import android.content.IContentProvider;
|
||||
import android.content.OperationApplicationException;
|
||||
import android.content.res.AssetFileDescriptor;
|
||||
@@ -92,7 +92,7 @@ public final class BridgeContentProvider implements IContentProvider {
|
||||
|
||||
@Override
|
||||
public Cursor query(Uri arg0, String[] arg1, String arg2, String[] arg3, String arg4,
|
||||
ICancelationSignal arg5) throws RemoteException {
|
||||
ICancellationSignal arg5) throws RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
@@ -124,7 +124,7 @@ public final class BridgeContentProvider implements IContentProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICancelationSignal createCancelationSignal() throws RemoteException {
|
||||
public ICancellationSignal createCancellationSignal() throws RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user