Merge "Keep AACEncoder around for a bit longer to have more time fix issues related to video editor engine"
diff --git a/Android.mk b/Android.mk
index ace7b7c..5acfb86 100644
--- a/Android.mk
+++ b/Android.mk
@@ -94,7 +94,7 @@
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 \
diff --git a/CleanSpec.mk b/CleanSpec.mk
index fb334fc..d74d7b1 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -117,6 +117,8 @@
$(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
# ************************************************
diff --git a/api/current.txt b/api/current.txt
index 59bbb12..37b0328 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -4714,15 +4714,15 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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>);
diff --git a/core/java/android/content/CancelationSignal.java b/core/java/android/content/CancellationSignal.java
similarity index 69%
rename from core/java/android/content/CancelationSignal.java
rename to core/java/android/content/CancellationSignal.java
index 58cf59d..2dbbe54 100644
--- a/core/java/android/content/CancelationSignal.java
+++ b/core/java/android/content/CancellationSignal.java
@@ -21,15 +21,15 @@
/**
* 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 @@
}
/**
- * 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 @@
}
/**
- * 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 @@
*
* @hide
*/
- public void setRemote(ICancelationSignal remote) {
+ public void setRemote(ICancellationSignal remote) {
synchronized (this) {
mRemote = remote;
if (mIsCanceled && remote != null) {
@@ -118,47 +124,47 @@
/**
* 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();
}
}
}
diff --git a/core/java/android/content/ContentProvider.java b/core/java/android/content/ContentProvider.java
index adbeb6a..12e3ccf 100644
--- a/core/java/android/content/ContentProvider.java
+++ b/core/java/android/content/ContentProvider.java
@@ -178,10 +178,10 @@
@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 @@
}
@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 @@
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 @@
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 @@
* 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);
}
diff --git a/core/java/android/content/ContentProviderClient.java b/core/java/android/content/ContentProviderClient.java
index 9a1fa65..3ac5e07 100644
--- a/core/java/android/content/ContentProviderClient.java
+++ b/core/java/android/content/ContentProviderClient.java
@@ -52,15 +52,15 @@
/** 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} */
diff --git a/core/java/android/content/ContentProviderNative.java b/core/java/android/content/ContentProviderNative.java
index e0e277a..eb83dbc 100644
--- a/core/java/android/content/ContentProviderNative.java
+++ b/core/java/android/content/ContentProviderNative.java
@@ -105,11 +105,11 @@
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 @@
{
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 @@
}
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 @@
}
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 @@
}
}
- public ICancelationSignal createCancelationSignal() throws RemoteException {
+ public ICancellationSignal createCancellationSignal() throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
@@ -642,9 +642,9 @@
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();
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java
index e79475a..96a65da 100644
--- a/core/java/android/content/ContentResolver.java
+++ b/core/java/android/content/ContentResolver.java
@@ -335,7 +335,7 @@
* @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 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 @@
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;
diff --git a/core/java/android/content/CursorLoader.java b/core/java/android/content/CursorLoader.java
index e58fad7..aed3728 100644
--- a/core/java/android/content/CursorLoader.java
+++ b/core/java/android/content/CursorLoader.java
@@ -48,7 +48,7 @@
String mSortOrder;
Cursor mCursor;
- CancelationSignal mCancelationSignal;
+ CancellationSignal mCancellationSignal;
/* Runs on a worker thread */
@Override
@@ -57,11 +57,11 @@
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 @@
return cursor;
} finally {
synchronized (this) {
- mCancelationSignal = null;
+ mCancellationSignal = null;
}
}
}
@@ -80,8 +80,8 @@
super.cancelLoadInBackground();
synchronized (this) {
- if (mCancelationSignal != null) {
- mCancelationSignal.cancel();
+ if (mCancellationSignal != null) {
+ mCancellationSignal.cancel();
}
}
}
diff --git a/core/java/android/content/ICancelationSignal.aidl b/core/java/android/content/ICancellationSignal.aidl
similarity index 95%
rename from core/java/android/content/ICancelationSignal.aidl
rename to core/java/android/content/ICancellationSignal.aidl
index 3f5a24d..cf1c5d3 100644
--- a/core/java/android/content/ICancelationSignal.aidl
+++ b/core/java/android/content/ICancellationSignal.aidl
@@ -19,6 +19,6 @@
/**
* @hide
*/
-interface ICancelationSignal {
+interface ICancellationSignal {
oneway void cancel();
}
diff --git a/core/java/android/content/IContentProvider.java b/core/java/android/content/IContentProvider.java
index f52157f..16478b7 100644
--- a/core/java/android/content/IContentProvider.java
+++ b/core/java/android/content/IContentProvider.java
@@ -34,7 +34,7 @@
*/
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 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;
diff --git a/core/java/android/content/OperationCanceledException.java b/core/java/android/content/OperationCanceledException.java
index 24afcfa..d783a07 100644
--- a/core/java/android/content/OperationCanceledException.java
+++ b/core/java/android/content/OperationCanceledException.java
@@ -19,7 +19,7 @@
/**
* An exception type that is thrown when an operation in progress is canceled.
*
- * @see CancelationSignal
+ * @see CancellationSignal
*/
public class OperationCanceledException extends RuntimeException {
public OperationCanceledException() {
diff --git a/core/java/android/database/sqlite/SQLiteConnection.java b/core/java/android/database/sqlite/SQLiteConnection.java
index 710bd53..b5cef81 100644
--- a/core/java/android/database/sqlite/SQLiteConnection.java
+++ b/core/java/android/database/sqlite/SQLiteConnection.java
@@ -19,7 +19,7 @@
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 @@
*
* @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 @@
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 @@
*
* @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 @@
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 @@
*
* @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 @@
* @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 @@
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 @@
*
* @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 @@
* @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 @@
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 @@
*
* @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 @@
* @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 @@
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 @@
*
* @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 @@
* @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 @@
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 @@
*
* @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 @@
* @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 @@
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 @@
* 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 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 @@
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 @@
window.setStartPosition(actualPos);
return countedRows;
} finally {
- detachCancelationSignal(cancelationSignal);
+ detachCancellationSignal(cancellationSignal);
}
} finally {
releasePreparedStatement(statement);
@@ -751,40 +751,40 @@
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() {
diff --git a/core/java/android/database/sqlite/SQLiteConnectionPool.java b/core/java/android/database/sqlite/SQLiteConnectionPool.java
index d335738..236948e 100644
--- a/core/java/android/database/sqlite/SQLiteConnectionPool.java
+++ b/core/java/android/database/sqlite/SQLiteConnectionPool.java
@@ -18,7 +18,7 @@
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 @@
* @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 @@
* @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 @@
// 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 @@
throwIfClosedLocked();
// Abort if canceled.
- if (cancelationSignal != null) {
- cancelationSignal.throwIfCanceled();
+ if (cancellationSignal != null) {
+ cancellationSignal.throwIfCanceled();
}
// Try to acquire a connection.
@@ -550,9 +550,9 @@
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 @@
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) {
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index 7db7bfb..505f83e 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -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 @@
* 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 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 @@
* 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 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 @@
* @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 @@
* 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 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);
}
diff --git a/core/java/android/database/sqlite/SQLiteDirectCursorDriver.java b/core/java/android/database/sqlite/SQLiteDirectCursorDriver.java
index c490dc6..3375e74 100644
--- a/core/java/android/database/sqlite/SQLiteDirectCursorDriver.java
+++ b/core/java/android/database/sqlite/SQLiteDirectCursorDriver.java
@@ -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 @@
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);
diff --git a/core/java/android/database/sqlite/SQLiteProgram.java b/core/java/android/database/sqlite/SQLiteProgram.java
index f3da2a6..9f0edfb 100644
--- a/core/java/android/database/sqlite/SQLiteProgram.java
+++ b/core/java/android/database/sqlite/SQLiteProgram.java
@@ -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 @@
private final Object[] mBindArgs;
SQLiteProgram(SQLiteDatabase db, String sql, Object[] bindArgs,
- CancelationSignal cancelationSignalForPrepare) {
+ CancellationSignal cancellationSignalForPrepare) {
mDatabase = db;
mSql = sql.trim();
@@ -57,7 +57,7 @@
SQLiteStatementInfo info = new SQLiteStatementInfo();
db.getThreadSession().prepare(mSql,
db.getThreadDefaultConnectionFlags(assumeReadOnly),
- cancelationSignalForPrepare, info);
+ cancellationSignalForPrepare, info);
mReadOnly = info.readOnly;
mColumnNames = info.columnNames;
mNumParameters = info.numParameters;
diff --git a/core/java/android/database/sqlite/SQLiteQuery.java b/core/java/android/database/sqlite/SQLiteQuery.java
index df2e260..30e77b5 100644
--- a/core/java/android/database/sqlite/SQLiteQuery.java
+++ b/core/java/android/database/sqlite/SQLiteQuery.java
@@ -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 @@
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 @@
try {
int numRows = getSession().executeForCursorWindow(getSql(), getBindArgs(),
window, startPos, requiredPos, countAllRows, getConnectionFlags(),
- mCancelationSignal);
+ mCancellationSignal);
return numRows;
} catch (SQLiteDatabaseCorruptException ex) {
onCorruption();
diff --git a/core/java/android/database/sqlite/SQLiteQueryBuilder.java b/core/java/android/database/sqlite/SQLiteQueryBuilder.java
index 89469cb..6f84b5e 100644
--- a/core/java/android/database/sqlite/SQLiteQueryBuilder.java
+++ b/core/java/android/database/sqlite/SQLiteQueryBuilder.java
@@ -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 @@
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 @@
* 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 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 @@
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 @@
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 @@
* 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);
}
/**
diff --git a/core/java/android/database/sqlite/SQLiteSession.java b/core/java/android/database/sqlite/SQLiteSession.java
index b5a3e31..43efb03 100644
--- a/core/java/android/database/sqlite/SQLiteSession.java
+++ b/core/java/android/database/sqlite/SQLiteSession.java
@@ -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 @@
* @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 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 @@
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 @@
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 @@
* 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 @@
* @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 @@
} 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 @@
* @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 @@
* @see #endTransaction
*/
public boolean yieldTransaction(long sleepAfterYieldDelayMillis, boolean throwIfUnsafe,
- CancelationSignal cancelationSignal) {
+ CancellationSignal cancellationSignal) {
if (throwIfUnsafe) {
throwIfNoTransaction();
throwIfTransactionMarkedSuccessful();
@@ -518,13 +518,13 @@
}
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 @@
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 @@
}
beginTransactionUnchecked(transactionMode, listener, connectionFlags,
- cancelationSignal); // might throw
+ cancellationSignal); // might throw
return true;
}
@@ -566,24 +566,24 @@
* @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 @@
* @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 @@
* @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 @@
* @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 @@
* @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 @@
* @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 @@
* @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 @@
* @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 @@
* @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 @@
* @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 @@
* @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 @@
* @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 @@
* 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 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 @@
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 @@
* @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 @@
* @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;
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 4a42e92..dcddd47 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -367,12 +367,52 @@
private class WebViewInputConnection extends BaseInputConnection {
// Used for mapping characters to keys typed.
private KeyCharacterMap mKeyCharacterMap;
+ private boolean mIsKeySentByMe;
public WebViewInputConnection() {
super(WebView.this, true);
}
@Override
+ public boolean sendKeyEvent(KeyEvent event) {
+ // Latin IME occasionally sends delete codes directly using
+ // sendKeyEvents. WebViewInputConnection should treat this
+ // as a deleteSurroundingText.
+ if (!mIsKeySentByMe
+ && event.getKeyCode() == KeyEvent.KEYCODE_DEL) {
+ Editable editable = getEditable();
+ int selectionStart = Selection.getSelectionStart(editable);
+ int selectionEnd = Selection.getSelectionEnd(editable);
+ if (selectionEnd > 0 && (selectionStart == selectionEnd)) {
+ int action = event.getAction();
+ if (action == KeyEvent.ACTION_UP) {
+ return deleteSurroundingText(1, 0);
+ } else if (action == KeyEvent.ACTION_DOWN) {
+ return true; // the delete will happen in ACTION_UP
+ }
+ }
+ }
+ return super.sendKeyEvent(event);
+ }
+
+ public void setTextAndKeepSelection(CharSequence text) {
+ Editable editable = getEditable();
+ int selectionStart = Selection.getSelectionStart(editable);
+ int selectionEnd = Selection.getSelectionEnd(editable);
+ editable.replace(0, editable.length(), text);
+ InputMethodManager imm = InputMethodManager.peekInstance();
+ if (imm != null) {
+ // Since the text has changed, do not allow the IME to replace the
+ // existing text as though it were a completion.
+ imm.restartInput(WebView.this);
+ }
+ // Keep the previous selection.
+ selectionStart = Math.min(selectionStart, editable.length());
+ selectionEnd = Math.min(selectionEnd, editable.length());
+ setSelection(selectionStart, selectionEnd);
+ }
+
+ @Override
public boolean setComposingText(CharSequence text, int newCursorPosition) {
Editable editable = getEditable();
int start = getComposingSpanStart(editable);
@@ -393,7 +433,8 @@
@Override
public boolean commitText(CharSequence text, int newCursorPosition) {
setComposingText(text, newCursorPosition);
- finishComposingText();
+ int cursorPosition = Selection.getSelectionEnd(getEditable());
+ setComposingRegion(cursorPosition, cursorPosition);
return true;
}
@@ -417,6 +458,7 @@
* @param text The new text to replace the changed text.
*/
private void setNewText(int start, int end, CharSequence text) {
+ mIsKeySentByMe = true;
Editable editable = getEditable();
CharSequence original = editable.subSequence(start, end);
boolean isCharacterAdd = false;
@@ -434,10 +476,8 @@
}
if (isCharacterAdd) {
sendCharacter(text.charAt(textLength - 1));
- mTextGeneration++;
} else if (isCharacterDelete) {
sendDeleteKey();
- mTextGeneration++;
} else if (textLength != originalLength ||
!TextUtils.regionMatches(text, 0, original, 0,
textLength)) {
@@ -447,6 +487,7 @@
REPLACE_TEXT, start, end, text.toString());
mPrivateHandler.sendMessage(replaceMessage);
}
+ mIsKeySentByMe = false;
}
/**
@@ -509,7 +550,7 @@
private final RectF mVisibleContentRect = new RectF();
private boolean mGLViewportEmpty = false;
WebViewInputConnection mInputConnection = null;
-
+ private int mFieldPointer;
/**
* Transportation object for returning WebView across thread boundaries.
@@ -803,6 +844,7 @@
static final int HANDLE_ID_EXTENT = 3;
static boolean sDisableNavcache = false;
+ static boolean sEnableWebTextView = false;
// the color used to highlight the touch rectangles
static final int HIGHLIGHT_COLOR = 0x6633b5e5;
// the region indicating where the user touched on the screen
@@ -1424,7 +1466,6 @@
private void init() {
OnTrimMemoryListener.init(getContext());
sDisableNavcache = nativeDisableNavcache();
-
setWillNotDraw(false);
setFocusable(true);
setFocusableInTouchMode(true);
@@ -5091,6 +5132,9 @@
* multiline, and what text it contains. It also removes it if necessary.
*/
/* package */ void rebuildWebTextView() {
+ if (!sEnableWebTextView) {
+ return; // always use WebKit's text entry
+ }
// If the WebView does not have focus, do nothing until it gains focus.
if (!hasFocus() && (null == mWebTextView || !mWebTextView.hasFocus())) {
return;
@@ -8653,14 +8697,17 @@
case UPDATE_TEXTFIELD_TEXT_MSG_ID:
// Make sure that the textfield is currently focused
// and representing the same node as the pointer.
- if (inEditingMode() &&
- mWebTextView.isSameTextField(msg.arg1)) {
- if (msg.arg2 == mTextGeneration) {
- String text = (String) msg.obj;
- if (null == text) {
- text = "";
- }
+ if (msg.arg2 == mTextGeneration) {
+ String text = (String) msg.obj;
+ if (null == text) {
+ text = "";
+ }
+ if (inEditingMode() &&
+ mWebTextView.isSameTextField(msg.arg1)) {
mWebTextView.setTextAndKeepSelection(text);
+ } else if (mInputConnection != null &&
+ mFieldPointer == msg.arg1) {
+ mInputConnection.setTextAndKeepSelection(text);
}
}
break;
@@ -8951,15 +8998,8 @@
case INIT_EDIT_FIELD:
if (mInputConnection != null) {
mTextGeneration = 0;
- String text = (String)msg.obj;
- mInputConnection.beginBatchEdit();
- Editable editable = mInputConnection.getEditable();
- editable.replace(0, editable.length(), text);
- int start = msg.arg1;
- int end = msg.arg2;
- mInputConnection.setComposingRegion(end, end);
- mInputConnection.setSelection(start, end);
- mInputConnection.endBatchEdit();
+ mFieldPointer = msg.arg1;
+ mInputConnection.setTextAndKeepSelection((String) msg.obj);
}
break;
@@ -9102,7 +9142,7 @@
if (inEditingMode()
&& mWebTextView.isSameTextField(nodePointer)) {
mWebTextView.setSelectionFromWebKit(data.mStart, data.mEnd);
- } else if (mInputConnection != null){
+ } else if (mInputConnection != null && mFieldPointer == nodePointer) {
mInputConnection.setSelection(data.mStart, data.mEnd);
}
}
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 395a638..8582dbc 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -2746,12 +2746,16 @@
}
// called by JNI
- private void initEditField(String text, int start, int end) {
+ private void initEditField(int pointer, String text, int start, int end) {
if (mWebView == null) {
return;
}
Message.obtain(mWebView.mPrivateHandler,
- WebView.INIT_EDIT_FIELD, start, end, text).sendToTarget();
+ WebView.INIT_EDIT_FIELD, pointer, 0, text).sendToTarget();
+ Message.obtain(mWebView.mPrivateHandler,
+ WebView.REQUEST_KEYBOARD_WITH_SELECTION_MSG_ID, pointer,
+ 0, new TextSelectionData(start, end, 0))
+ .sendToTarget();
}
private native void nativeUpdateFrameCacheIfLoading(int nativeClass);
@@ -2789,17 +2793,6 @@
}
// called by JNI
- private void requestKeyboardWithSelection(int pointer, int selStart,
- int selEnd, int textGeneration) {
- if (mWebView != null) {
- Message.obtain(mWebView.mPrivateHandler,
- WebView.REQUEST_KEYBOARD_WITH_SELECTION_MSG_ID, pointer,
- textGeneration, new TextSelectionData(selStart, selEnd, 0))
- .sendToTarget();
- }
- }
-
- // called by JNI
private void requestKeyboard(boolean showKeyboard) {
if (mWebView != null) {
Message.obtain(mWebView.mPrivateHandler,
diff --git a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
index ebd355a..d51ced11 100644
--- a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
+++ b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
@@ -653,6 +653,7 @@
case MotionEvent.ACTION_CANCEL:
handleMove(event);
+ handleCancel(event);
handled = true;
break;
}
@@ -678,6 +679,12 @@
if (DEBUG && mDragging) Log.v(TAG, "** Handle RELEASE");
switchToState(STATE_FINISH, event.getX(), event.getY());
}
+
+ private void handleCancel(MotionEvent event) {
+ if (DEBUG && mDragging) Log.v(TAG, "** Handle CANCEL");
+ mActiveTarget = -1; // Drop the active target if canceled.
+ switchToState(STATE_FINISH, event.getX(), event.getY());
+ }
private void handleMove(MotionEvent event) {
if (!mDragging) {
diff --git a/core/jni/android_media_ToneGenerator.cpp b/core/jni/android_media_ToneGenerator.cpp
index 53a0501..26e82aa 100644
--- a/core/jni/android_media_ToneGenerator.cpp
+++ b/core/jni/android_media_ToneGenerator.cpp
@@ -48,7 +48,7 @@
return false;
}
- return lpToneGen->startTone(toneType, durationMs);
+ return lpToneGen->startTone((ToneGenerator::tone_type) toneType, durationMs);
}
static void android_media_ToneGenerator_stopTone(JNIEnv *env, jobject thiz) {
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index ad10832..03ad5ae 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -837,7 +837,7 @@
mRS.mErrorCallback.mErrorNum = subID;
mRS.mErrorCallback.run();
} else {
- //throw new RSRuntimeException("Received error num " + subID + ", details: " + e);
+ throw new RSRuntimeException("Received error num " + subID + ", details: " + e);
}
continue;
}
diff --git a/include/media/AudioEffect.h b/include/media/AudioEffect.h
index 1417416..7b0b443 100644
--- a/include/media/AudioEffect.h
+++ b/include/media/AudioEffect.h
@@ -226,8 +226,8 @@
AudioEffect(const effect_uuid_t *type,
const effect_uuid_t *uuid = NULL,
int32_t priority = 0,
- effect_callback_t cbf = 0,
- void* user = 0,
+ effect_callback_t cbf = NULL,
+ void* user = NULL,
int sessionId = 0,
audio_io_handle_t io = 0
);
@@ -238,8 +238,8 @@
AudioEffect(const char *typeStr,
const char *uuidStr = NULL,
int32_t priority = 0,
- effect_callback_t cbf = 0,
- void* user = 0,
+ effect_callback_t cbf = NULL,
+ void* user = NULL,
int sessionId = 0,
audio_io_handle_t io = 0
);
@@ -260,8 +260,8 @@
status_t set(const effect_uuid_t *type,
const effect_uuid_t *uuid = NULL,
int32_t priority = 0,
- effect_callback_t cbf = 0,
- void* user = 0,
+ effect_callback_t cbf = NULL,
+ void* user = NULL,
int sessionId = 0,
audio_io_handle_t io = 0
);
diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h
index 76ec3b1..c8c5dba 100644
--- a/include/media/AudioRecord.h
+++ b/include/media/AudioRecord.h
@@ -155,8 +155,8 @@
uint32_t channelMask = AUDIO_CHANNEL_IN_MONO,
int frameCount = 0,
uint32_t flags = 0,
- callback_t cbf = 0,
- void* user = 0,
+ callback_t cbf = NULL,
+ void* user = NULL,
int notificationFrames = 0,
int sessionId = 0);
@@ -181,8 +181,8 @@
uint32_t channelMask = AUDIO_CHANNEL_IN_MONO,
int frameCount = 0,
uint32_t flags = 0,
- callback_t cbf = 0,
- void* user = 0,
+ callback_t cbf = NULL,
+ void* user = NULL,
int notificationFrames = 0,
bool threadCanCallJava = false,
int sessionId = 0);
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h
index 98abfbd..02c85cd 100644
--- a/include/media/AudioTrack.h
+++ b/include/media/AudioTrack.h
@@ -148,8 +148,8 @@
int channelMask = 0,
int frameCount = 0,
uint32_t flags = 0,
- callback_t cbf = 0,
- void* user = 0,
+ callback_t cbf = NULL,
+ void* user = NULL,
int notificationFrames = 0,
int sessionId = 0);
@@ -180,8 +180,8 @@
int channelMask = 0,
const sp<IMemory>& sharedBuffer = 0,
uint32_t flags = 0,
- callback_t cbf = 0,
- void* user = 0,
+ callback_t cbf = NULL,
+ void* user = NULL,
int notificationFrames = 0,
int sessionId = 0);
@@ -204,8 +204,8 @@
int channelMask = 0,
int frameCount = 0,
uint32_t flags = 0,
- callback_t cbf = 0,
- void* user = 0,
+ callback_t cbf = NULL,
+ void* user = NULL,
int notificationFrames = 0,
const sp<IMemory>& sharedBuffer = 0,
bool threadCanCallJava = false,
diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h
index 7c0d886..760595c 100644
--- a/include/media/IAudioFlinger.h
+++ b/include/media/IAudioFlinger.h
@@ -126,7 +126,7 @@
uint32_t *pSamplingRate,
audio_format_t *pFormat,
uint32_t *pChannels,
- uint32_t acoustics) = 0;
+ audio_in_acoustics_t acoustics) = 0;
virtual status_t closeInput(int input) = 0;
virtual status_t setStreamOutput(audio_stream_type_t stream, int output) = 0;
diff --git a/include/media/ToneGenerator.h b/include/media/ToneGenerator.h
index 7d890bd..df0c97e 100644
--- a/include/media/ToneGenerator.h
+++ b/include/media/ToneGenerator.h
@@ -154,7 +154,7 @@
ToneGenerator(audio_stream_type_t streamType, float volume, bool threadCanCallJava = false);
~ToneGenerator();
- bool startTone(int toneType, int durationMs = -1);
+ bool startTone(tone_type toneType, int durationMs = -1);
void stopTone();
bool isInited() { return (mState == TONE_IDLE)?false:true;}
@@ -274,7 +274,7 @@
bool prepareWave();
unsigned int numWaves(unsigned int segmentIdx);
void clearWaveGens();
- int getToneForRegion(int toneType);
+ tone_type getToneForRegion(tone_type toneType);
// WaveGenerator generates a single sine wave
class WaveGenerator {
diff --git a/include/media/Visualizer.h b/include/media/Visualizer.h
index 1a4cbca..60fa15b 100644
--- a/include/media/Visualizer.h
+++ b/include/media/Visualizer.h
@@ -66,8 +66,8 @@
* See AudioEffect constructor for details on parameters.
*/
Visualizer(int32_t priority = 0,
- effect_callback_t cbf = 0,
- void* user = 0,
+ effect_callback_t cbf = NULL,
+ void* user = NULL,
int sessionId = 0);
~Visualizer();
diff --git a/include/private/media/AudioTrackShared.h b/include/private/media/AudioTrackShared.h
index ffc546e..dd97ce4 100644
--- a/include/private/media/AudioTrackShared.h
+++ b/include/private/media/AudioTrackShared.h
@@ -76,7 +76,9 @@
// Left channel is in [0:15], right channel is in [16:31].
// Always read and write the combined pair atomically.
// For AudioTrack only, not used by AudioRecord.
- uint32_t volumeLR;
+private:
+ uint32_t mVolumeLR;
+public:
uint32_t sampleRate;
// NOTE: audio_track_cblk_t::frameSize is not equal to AudioTrack::frameSize() for
@@ -116,6 +118,17 @@
uint16_t getSendLevel_U4_12() const {
return mSendLevel;
}
+
+ // for AudioTrack client only, caller must limit to 0 <= volumeLR <= 0x10001000
+ void setVolumeLR(uint32_t volumeLR) {
+ mVolumeLR = volumeLR;
+ }
+
+ // for AudioFlinger only; the return value must be validated by the caller
+ uint32_t getVolumeLR() const {
+ return mVolumeLR;
+ }
+
};
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp
index 929dd68..b4eb995 100644
--- a/libs/rs/rsScriptC.cpp
+++ b/libs/rs/rsScriptC.cpp
@@ -322,7 +322,7 @@
if (!s->runCompiler(rsc, resName, cacheDir, (uint8_t *)text, text_length)) {
// Error during compile, destroy s and return null.
- delete s;
+ ObjectBase::checkDelete(s);
return NULL;
}
diff --git a/media/libmedia/AudioEffect.cpp b/media/libmedia/AudioEffect.cpp
index 6639d06..a242846 100644
--- a/media/libmedia/AudioEffect.cpp
+++ b/media/libmedia/AudioEffect.cpp
@@ -342,7 +342,7 @@
{
ALOGW("IEffect died");
mStatus = NO_INIT;
- if (mCbf) {
+ if (mCbf != NULL) {
status_t status = DEAD_OBJECT;
mCbf(EVENT_ERROR, mUserData, &status);
}
@@ -363,7 +363,7 @@
mStatus = ALREADY_EXISTS;
}
}
- if (mCbf) {
+ if (mCbf != NULL) {
mCbf(EVENT_CONTROL_STATUS_CHANGED, mUserData, &controlGranted);
}
}
@@ -373,7 +373,7 @@
ALOGV("enableStatusChanged %p enabled %d mCbf %p", this, enabled, mCbf);
if (mStatus == ALREADY_EXISTS) {
mEnabled = enabled;
- if (mCbf) {
+ if (mCbf != NULL) {
mCbf(EVENT_ENABLE_STATUS_CHANGED, mUserData, &enabled);
}
}
@@ -389,7 +389,7 @@
return;
}
- if (mCbf && cmdCode == EFFECT_CMD_SET_PARAM) {
+ if (mCbf != NULL && cmdCode == EFFECT_CMD_SET_PARAM) {
effect_param_t *cmd = (effect_param_t *)cmdData;
cmd->status = *(int32_t *)replyData;
mCbf(EVENT_PARAMETER_CHANGED, mUserData, cmd);
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index 2b3ea38..c96bc76 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -206,7 +206,7 @@
return status;
}
- if (cbf != 0) {
+ if (cbf != NULL) {
mClientRecordThread = new ClientRecordThread(*this, threadCanCallJava);
}
@@ -387,7 +387,7 @@
status_t AudioRecord::setMarkerPosition(uint32_t marker)
{
- if (mCbf == 0) return INVALID_OPERATION;
+ if (mCbf == NULL) return INVALID_OPERATION;
mMarkerPosition = marker;
mMarkerReached = false;
@@ -397,7 +397,7 @@
status_t AudioRecord::getMarkerPosition(uint32_t *marker)
{
- if (marker == 0) return BAD_VALUE;
+ if (marker == NULL) return BAD_VALUE;
*marker = mMarkerPosition;
@@ -406,7 +406,7 @@
status_t AudioRecord::setPositionUpdatePeriod(uint32_t updatePeriod)
{
- if (mCbf == 0) return INVALID_OPERATION;
+ if (mCbf == NULL) return INVALID_OPERATION;
uint32_t curPosition;
getPosition(&curPosition);
@@ -418,7 +418,7 @@
status_t AudioRecord::getPositionUpdatePeriod(uint32_t *updatePeriod)
{
- if (updatePeriod == 0) return BAD_VALUE;
+ if (updatePeriod == NULL) return BAD_VALUE;
*updatePeriod = mUpdatePeriod;
@@ -427,7 +427,7 @@
status_t AudioRecord::getPosition(uint32_t *position)
{
- if (position == 0) return BAD_VALUE;
+ if (position == NULL) return BAD_VALUE;
AutoMutex lock(mLock);
*position = mCblk->user;
diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp
index df5017b..110a294 100644
--- a/media/libmedia/AudioSystem.cpp
+++ b/media/libmedia/AudioSystem.cpp
@@ -225,7 +225,7 @@
gLock.lock();
outputDesc = AudioSystem::gOutputs.valueFor(output);
- if (outputDesc == 0) {
+ if (outputDesc == NULL) {
ALOGV("getOutputSamplingRate() no output descriptor for output %d in gOutputs", output);
gLock.unlock();
const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
@@ -263,7 +263,7 @@
gLock.lock();
outputDesc = AudioSystem::gOutputs.valueFor(output);
- if (outputDesc == 0) {
+ if (outputDesc == NULL) {
gLock.unlock();
const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
if (af == 0) return PERMISSION_DENIED;
@@ -294,7 +294,7 @@
gLock.lock();
outputDesc = AudioSystem::gOutputs.valueFor(output);
- if (outputDesc == 0) {
+ if (outputDesc == NULL) {
gLock.unlock();
const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
if (af == 0) return PERMISSION_DENIED;
@@ -413,7 +413,7 @@
switch (event) {
case STREAM_CONFIG_CHANGED:
- if (param2 == 0) break;
+ if (param2 == NULL) break;
stream = *(audio_stream_type_t *)param2;
ALOGV("ioConfigChanged() STREAM_CONFIG_CHANGED stream %d, output %d", stream, ioHandle);
if (gStreamOutputMap.indexOfKey(stream) >= 0) {
@@ -425,7 +425,7 @@
ALOGV("ioConfigChanged() opening already existing output! %d", ioHandle);
break;
}
- if (param2 == 0) break;
+ if (param2 == NULL) break;
desc = (OutputDescriptor *)param2;
OutputDescriptor *outputDesc = new OutputDescriptor(*desc);
@@ -454,7 +454,7 @@
ALOGW("ioConfigChanged() modifying unknow output! %d", ioHandle);
break;
}
- if (param2 == 0) break;
+ if (param2 == NULL) break;
desc = (OutputDescriptor *)param2;
ALOGV("ioConfigChanged() new config for output %d samplingRate %d, format %d channels %d frameCount %d latency %d",
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 17e3d4b..8c33f41 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -257,7 +257,7 @@
return status;
}
- if (cbf != 0) {
+ if (cbf != NULL) {
mAudioTrackThread = new AudioTrackThread(*this, threadCanCallJava);
}
@@ -501,7 +501,7 @@
mVolume[LEFT] = left;
mVolume[RIGHT] = right;
- mCblk->volumeLR = (uint32_t(uint16_t(right * 0x1000)) << 16) | uint16_t(left * 0x1000);
+ mCblk->setVolumeLR((uint32_t(uint16_t(right * 0x1000)) << 16) | uint16_t(left * 0x1000));
return NO_ERROR;
}
@@ -604,13 +604,13 @@
status_t AudioTrack::getLoop(uint32_t *loopStart, uint32_t *loopEnd, int *loopCount)
{
AutoMutex lock(mLock);
- if (loopStart != 0) {
+ if (loopStart != NULL) {
*loopStart = mCblk->loopStart;
}
- if (loopEnd != 0) {
+ if (loopEnd != NULL) {
*loopEnd = mCblk->loopEnd;
}
- if (loopCount != 0) {
+ if (loopCount != NULL) {
if (mCblk->loopCount < 0) {
*loopCount = -1;
} else {
@@ -623,7 +623,7 @@
status_t AudioTrack::setMarkerPosition(uint32_t marker)
{
- if (mCbf == 0) return INVALID_OPERATION;
+ if (mCbf == NULL) return INVALID_OPERATION;
mMarkerPosition = marker;
mMarkerReached = false;
@@ -633,7 +633,7 @@
status_t AudioTrack::getMarkerPosition(uint32_t *marker)
{
- if (marker == 0) return BAD_VALUE;
+ if (marker == NULL) return BAD_VALUE;
*marker = mMarkerPosition;
@@ -642,7 +642,7 @@
status_t AudioTrack::setPositionUpdatePeriod(uint32_t updatePeriod)
{
- if (mCbf == 0) return INVALID_OPERATION;
+ if (mCbf == NULL) return INVALID_OPERATION;
uint32_t curPosition;
getPosition(&curPosition);
@@ -654,7 +654,7 @@
status_t AudioTrack::getPositionUpdatePeriod(uint32_t *updatePeriod)
{
- if (updatePeriod == 0) return BAD_VALUE;
+ if (updatePeriod == NULL) return BAD_VALUE;
*updatePeriod = mUpdatePeriod;
@@ -679,7 +679,7 @@
status_t AudioTrack::getPosition(uint32_t *position)
{
- if (position == 0) return BAD_VALUE;
+ if (position == NULL) return BAD_VALUE;
AutoMutex lock(mLock);
*position = mFlushed ? 0 : mCblk->server;
@@ -837,7 +837,7 @@
mCblk->stepUser(mCblk->frameCount);
}
- mCblk->volumeLR = (uint32_t(uint16_t(mVolume[RIGHT] * 0x1000)) << 16) | uint16_t(mVolume[LEFT] * 0x1000);
+ mCblk->setVolumeLR((uint32_t(uint16_t(mVolume[RIGHT] * 0x1000)) << 16) | uint16_t(mVolume[LEFT] * 0x1000));
mCblk->setSendLevel(mSendLevel);
mAudioTrack->attachAuxEffect(mAuxEffectId);
mCblk->bufferTimeoutMs = MAX_STARTUP_TIMEOUT_MS;
@@ -1319,8 +1319,8 @@
audio_track_cblk_t::audio_track_cblk_t()
: lock(Mutex::SHARED), cv(Condition::SHARED), user(0), server(0),
- userBase(0), serverBase(0), buffers(0), frameCount(0),
- loopStart(UINT_MAX), loopEnd(UINT_MAX), loopCount(0), volumeLR(0),
+ userBase(0), serverBase(0), buffers(NULL), frameCount(0),
+ loopStart(UINT_MAX), loopEnd(UINT_MAX), loopCount(0), mVolumeLR(0x10001000),
mSendLevel(0), flags(0)
{
}
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp
index 0d442ef..fc5520f 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libmedia/IAudioFlinger.cpp
@@ -432,7 +432,7 @@
uint32_t *pSamplingRate,
audio_format_t *pFormat,
uint32_t *pChannels,
- uint32_t acoustics)
+ audio_in_acoustics_t acoustics)
{
Parcel data, reply;
uint32_t devices = pDevices ? *pDevices : 0;
@@ -445,7 +445,7 @@
data.writeInt32(samplingRate);
data.writeInt32(format);
data.writeInt32(channels);
- data.writeInt32(acoustics);
+ data.writeInt32((int32_t) acoustics);
remote()->transact(OPEN_INPUT, data, &reply);
int input = reply.readInt32();
devices = reply.readInt32();
@@ -640,7 +640,7 @@
*id = tmp;
}
tmp = reply.readInt32();
- if (enabled) {
+ if (enabled != NULL) {
*enabled = tmp;
}
effect = interface_cast<IEffect>(reply.readStrongBinder());
@@ -881,13 +881,13 @@
uint32_t samplingRate = data.readInt32();
audio_format_t format = (audio_format_t) data.readInt32();
uint32_t channels = data.readInt32();
- uint32_t acoutics = data.readInt32();
+ audio_in_acoustics_t acoustics = (audio_in_acoustics_t) data.readInt32();
int input = openInput(&devices,
&samplingRate,
&format,
&channels,
- acoutics);
+ acoustics);
reply->writeInt32(input);
reply->writeInt32(devices);
reply->writeInt32(samplingRate);
diff --git a/media/libmedia/IAudioFlingerClient.cpp b/media/libmedia/IAudioFlingerClient.cpp
index 5a3f250..9458bc0 100644
--- a/media/libmedia/IAudioFlingerClient.cpp
+++ b/media/libmedia/IAudioFlingerClient.cpp
@@ -73,7 +73,7 @@
CHECK_INTERFACE(IAudioFlingerClient, data, reply);
int event = data.readInt32();
int ioHandle = data.readInt32();
- void *param2 = 0;
+ void *param2 = NULL;
AudioSystem::OutputDescriptor desc;
uint32_t stream;
if (event == AudioSystem::STREAM_CONFIG_CHANGED) {
diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp
index 5ceb912..e6e989d 100644
--- a/media/libmedia/ToneGenerator.cpp
+++ b/media/libmedia/ToneGenerator.cpp
@@ -751,7 +751,7 @@
// Used by ToneGenerator::getToneForRegion() to convert user specified supervisory tone type
// to actual tone for current region.
-const unsigned char ToneGenerator::sToneMappingTable[NUM_REGIONS-1][NUM_SUP_TONES] = {
+const unsigned char /*tone_type*/ ToneGenerator::sToneMappingTable[NUM_REGIONS-1][NUM_SUP_TONES] = {
{ // ANSI
TONE_ANSI_DIAL, // TONE_SUP_DIAL
TONE_ANSI_BUSY, // TONE_SUP_BUSY
@@ -811,9 +811,9 @@
mThreadCanCallJava = threadCanCallJava;
mStreamType = streamType;
mVolume = volume;
- mpAudioTrack = 0;
- mpToneDesc = 0;
- mpNewToneDesc = 0;
+ mpAudioTrack = NULL;
+ mpToneDesc = NULL;
+ mpNewToneDesc = NULL;
// Generate tone by chunks of 20 ms to keep cadencing precision
mProcessSize = (mSamplingRate * 20) / 1000;
@@ -855,7 +855,7 @@
ToneGenerator::~ToneGenerator() {
ALOGV("ToneGenerator destructor\n");
- if (mpAudioTrack) {
+ if (mpAudioTrack != NULL) {
stopTone();
ALOGV("Delete Track: %p\n", mpAudioTrack);
delete mpAudioTrack;
@@ -878,7 +878,7 @@
// none
//
////////////////////////////////////////////////////////////////////////////////
-bool ToneGenerator::startTone(int toneType, int durationMs) {
+bool ToneGenerator::startTone(tone_type toneType, int durationMs) {
bool lResult = false;
status_t lStatus;
@@ -1012,7 +1012,7 @@
if (mpAudioTrack) {
delete mpAudioTrack;
- mpAudioTrack = 0;
+ mpAudioTrack = NULL;
}
// Open audio track in mono, PCM 16bit, default sampling rate, default buffer size
@@ -1048,7 +1048,7 @@
if (mpAudioTrack) {
ALOGV("Delete Track I: %p\n", mpAudioTrack);
delete mpAudioTrack;
- mpAudioTrack = 0;
+ mpAudioTrack = NULL;
}
return false;
@@ -1317,7 +1317,7 @@
bool ToneGenerator::prepareWave() {
unsigned int segmentIdx = 0;
- if (!mpNewToneDesc) {
+ if (mpNewToneDesc == NULL) {
return false;
}
@@ -1434,13 +1434,13 @@
// none
//
////////////////////////////////////////////////////////////////////////////////
-int ToneGenerator::getToneForRegion(int toneType) {
- int regionTone;
+ToneGenerator::tone_type ToneGenerator::getToneForRegion(tone_type toneType) {
+ tone_type regionTone;
if (mRegion == CEPT || toneType < FIRST_SUP_TONE || toneType > LAST_SUP_TONE) {
regionTone = toneType;
} else {
- regionTone = sToneMappingTable[mRegion][toneType - FIRST_SUP_TONE];
+ regionTone = (tone_type) sToneMappingTable[mRegion][toneType - FIRST_SUP_TONE];
}
ALOGV("getToneForRegion, tone %d, region %d, regionTone %d", toneType, mRegion, regionTone);
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 0c44f3f..f71ba0a 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -160,7 +160,10 @@
AudioFlinger::AudioFlinger()
: BnAudioFlinger(),
- mPrimaryHardwareDev(NULL), mMasterVolume(1.0f), mMasterMute(false), mNextUniqueId(1),
+ mPrimaryHardwareDev(NULL),
+ mHardwareStatus(AUDIO_HW_IDLE), // see also onFirstRef()
+ mMasterVolume(1.0f), mMasterMute(false), mNextUniqueId(1),
+ mMode(AUDIO_MODE_INVALID),
mBtNrecIsOff(false)
{
}
@@ -172,7 +175,6 @@
Mutex::Autolock _l(mLock);
/* TODO: move all this work into an Init() function */
- mHardwareStatus = AUDIO_HW_IDLE;
for (size_t i = 0; i < ARRAY_SIZE(audio_interfaces); i++) {
const hw_module_t *mod;
@@ -265,13 +267,10 @@
result.append("Clients:\n");
for (size_t i = 0; i < mClients.size(); ++i) {
- wp<Client> wClient = mClients.valueAt(i);
- if (wClient != 0) {
- sp<Client> client = wClient.promote();
- if (client != 0) {
- snprintf(buffer, SIZE, " pid: %d\n", client->pid());
- result.append(buffer);
- }
+ sp<Client> client = mClients.valueAt(i).promote();
+ if (client != 0) {
+ snprintf(buffer, SIZE, " pid: %d\n", client->pid());
+ result.append(buffer);
}
}
@@ -971,7 +970,8 @@
{
size_t size = mNotificationClients.size();
for (size_t i = 0; i < size; i++) {
- mNotificationClients.valueAt(i)->client()->ioConfigChanged(event, ioHandle, param2);
+ mNotificationClients.valueAt(i)->audioFlingerClient()->ioConfigChanged(event, ioHandle,
+ param2);
}
}
@@ -985,13 +985,19 @@
// ----------------------------------------------------------------------------
-AudioFlinger::ThreadBase::ThreadBase(const sp<AudioFlinger>& audioFlinger, int id, uint32_t device)
+AudioFlinger::ThreadBase::ThreadBase(const sp<AudioFlinger>& audioFlinger, int id, uint32_t device,
+ type_t type)
: Thread(false),
- mAudioFlinger(audioFlinger), mSampleRate(0), mFrameCount(0), mChannelCount(0),
- mFrameSize(1), mFormat(AUDIO_FORMAT_INVALID), mStandby(false), mId(id), mExiting(false),
- mDevice(device)
+ mType(type),
+ mAudioFlinger(audioFlinger), mSampleRate(0), mFrameCount(0),
+ // mChannelMask
+ mChannelCount(0),
+ mFrameSize(1), mFormat(AUDIO_FORMAT_INVALID),
+ mParamStatus(NO_ERROR),
+ mStandby(false), mId(id), mExiting(false),
+ mDevice(device),
+ mDeathRecipient(new PMDeathRecipient(this))
{
- mDeathRecipient = new PMDeathRecipient(this);
}
AudioFlinger::ThreadBase::~ThreadBase()
@@ -1372,20 +1378,24 @@
AudioFlinger::PlaybackThread::PlaybackThread(const sp<AudioFlinger>& audioFlinger,
AudioStreamOut* output,
int id,
- uint32_t device)
- : ThreadBase(audioFlinger, id, device),
- mMixBuffer(NULL), mSuspended(0), mBytesWritten(0), mOutput(output),
+ uint32_t device,
+ type_t type)
+ : ThreadBase(audioFlinger, id, device, type),
+ mMixBuffer(NULL), mSuspended(0), mBytesWritten(0),
+ // Assumes constructor is called by AudioFlinger with it's mLock held,
+ // but it would be safer to explicitly pass initial masterMute as parameter
+ mMasterMute(audioFlinger->masterMute_l()),
+ // mStreamTypes[] initialized in constructor body
+ mOutput(output),
+ // Assumes constructor is called by AudioFlinger with it's mLock held,
+ // but it would be safer to explicitly pass initial masterVolume as parameter
+ mMasterVolume(audioFlinger->masterVolume_l()),
mLastWriteTime(0), mNumWrites(0), mNumDelayedWrites(0), mInWrite(false)
{
snprintf(mName, kNameLength, "AudioOut_%d", id);
readOutputParameters();
- // Assumes constructor is called by AudioFlinger with it's mLock held,
- // but it would be safer to explicitly pass these as parameters
- mMasterVolume = mAudioFlinger->masterVolume_l();
- mMasterMute = mAudioFlinger->masterMute_l();
-
// mStreamTypes[AUDIO_STREAM_CNT] is initialized by stream_type_t default constructor
// There is no AUDIO_STREAM_MIN, and ++ operator does not compile
for (audio_stream_type_t stream = (audio_stream_type_t) 0; stream < AUDIO_STREAM_CNT;
@@ -1431,13 +1441,10 @@
result.append(buffer);
result.append(" Name Clien Typ Fmt Chn mask Session Buf S M F SRate LeftV RighV Serv User Main buf Aux Buf\n");
for (size_t i = 0; i < mActiveTracks.size(); ++i) {
- wp<Track> wTrack = mActiveTracks[i];
- if (wTrack != 0) {
- sp<Track> track = wTrack.promote();
- if (track != 0) {
- track->dump(buffer, SIZE);
- result.append(buffer);
- }
+ sp<Track> track = mActiveTracks[i].promote();
+ if (track != 0) {
+ track->dump(buffer, SIZE);
+ result.append(buffer);
}
}
write(fd, result.string(), result.size());
@@ -1705,7 +1712,7 @@
// audioConfigChanged_l() must be called with AudioFlinger::mLock held
void AudioFlinger::PlaybackThread::audioConfigChanged_l(int event, int param) {
AudioSystem::OutputDescriptor desc;
- void *param2 = 0;
+ void *param2 = NULL;
ALOGV("PlaybackThread::audioConfigChanged_l, thread %p, event %d, param %d", this, event, param);
@@ -1758,7 +1765,7 @@
status_t AudioFlinger::PlaybackThread::getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames)
{
- if (halFrames == 0 || dspFrames == 0) {
+ if (halFrames == NULL || dspFrames == NULL) {
return BAD_VALUE;
}
Mutex::Autolock _l(mLock);
@@ -1845,13 +1852,12 @@
// ----------------------------------------------------------------------------
-AudioFlinger::MixerThread::MixerThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, int id, uint32_t device)
- : PlaybackThread(audioFlinger, output, id, device),
- mAudioMixer(NULL), mPrevMixerStatus(MIXER_IDLE)
+AudioFlinger::MixerThread::MixerThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output,
+ int id, uint32_t device, type_t type)
+ : PlaybackThread(audioFlinger, output, id, device, type),
+ mAudioMixer(new AudioMixer(mFrameCount, mSampleRate)),
+ mPrevMixerStatus(MIXER_IDLE)
{
- mType = ThreadBase::MIXER;
- mAudioMixer = new AudioMixer(mFrameCount, mSampleRate);
-
// FIXME - Current mixer implementation only supports stereo output
if (mChannelCount == 1) {
ALOGE("Invalid audio hardware channel count");
@@ -2193,7 +2199,7 @@
// read original volumes with volume control
float typeVolume = mStreamTypes[track->type()].volume;
float v = masterVolume * typeVolume;
- uint32_t vlr = cblk->volumeLR;
+ uint32_t vlr = cblk->getVolumeLR();
vl = vlr & 0xFFFF;
vr = vlr >> 16;
// track volumes come from shared memory, so can't be trusted and must be clamped
@@ -2515,9 +2521,10 @@
// ----------------------------------------------------------------------------
AudioFlinger::DirectOutputThread::DirectOutputThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, int id, uint32_t device)
- : PlaybackThread(audioFlinger, output, id, device)
+ : PlaybackThread(audioFlinger, output, id, device, DIRECT)
+ // mLeftVolFloat, mRightVolFloat
+ // mLeftVolShort, mRightVolShort
{
- mType = ThreadBase::DIRECT;
}
AudioFlinger::DirectOutputThread::~DirectOutputThread()
@@ -2731,7 +2738,7 @@
} else {
float typeVolume = mStreamTypes[track->type()].volume;
float v = mMasterVolume * typeVolume;
- uint32_t vlr = cblk->volumeLR;
+ uint32_t vlr = cblk->getVolumeLR();
float v_clamped = v * (vlr & 0xFFFF);
if (v_clamped > MAX_GAIN) v_clamped = MAX_GAIN;
left = v_clamped/MAX_GAIN;
@@ -2994,10 +3001,11 @@
// ----------------------------------------------------------------------------
-AudioFlinger::DuplicatingThread::DuplicatingThread(const sp<AudioFlinger>& audioFlinger, AudioFlinger::MixerThread* mainThread, int id)
- : MixerThread(audioFlinger, mainThread->getOutput(), id, mainThread->device()), mWaitTimeMs(UINT_MAX)
+AudioFlinger::DuplicatingThread::DuplicatingThread(const sp<AudioFlinger>& audioFlinger,
+ AudioFlinger::MixerThread* mainThread, int id)
+ : MixerThread(audioFlinger, mainThread->getOutput(), id, mainThread->device(), DUPLICATING),
+ mWaitTimeMs(UINT_MAX)
{
- mType = ThreadBase::DUPLICATING;
addOutputTrack(mainThread);
}
@@ -3246,13 +3254,17 @@
: RefBase(),
mThread(thread),
mClient(client),
- mCblk(0),
+ mCblk(NULL),
+ // mBuffer
+ // mBufferEnd
mFrameCount(0),
mState(IDLE),
mClientTid(-1),
mFormat(format),
mFlags(flags & ~SYSTEM_FLAGS_MASK),
mSessionId(sessionId)
+ // mChannelCount
+ // mChannelMask
{
ALOGV_IF(sharedBuffer != 0, "sharedBuffer: %p, size: %d", sharedBuffer->pointer(), sharedBuffer->size());
@@ -3268,7 +3280,7 @@
mCblkMemory = client->heap()->allocate(size);
if (mCblkMemory != 0) {
mCblk = static_cast<audio_track_cblk_t *>(mCblkMemory->pointer());
- if (mCblk) { // construct the shared structure in-place.
+ if (mCblk != NULL) { // construct the shared structure in-place.
new(mCblk) audio_track_cblk_t();
// clear all buffers
mCblk->frameCount = frameCount;
@@ -3311,7 +3323,7 @@
AudioFlinger::ThreadBase::TrackBase::~TrackBase()
{
- if (mCblk) {
+ if (mCblk != NULL) {
mCblk->~audio_track_cblk_t(); // destroy our shared-structure.
if (mClient == NULL) {
delete mCblk;
@@ -3319,6 +3331,7 @@
}
mCblkMemory.clear(); // and free the shared memory
if (mClient != NULL) {
+ // Client destructor must run with AudioFlinger mutex locked
Mutex::Autolock _l(mClient->audioFlinger()->mLock);
mClient.clear();
}
@@ -3385,7 +3398,7 @@
server %d, serverBase %d, user %d, userBase %d",
bufferStart, bufferEnd, mBuffer, mBufferEnd,
cblk->server, cblk->serverBase, cblk->user, cblk->userBase);
- return 0;
+ return NULL;
}
return bufferStart;
@@ -3470,7 +3483,7 @@
void AudioFlinger::PlaybackThread::Track::dump(char* buffer, size_t size)
{
- uint32_t vlr = mCblk->volumeLR;
+ uint32_t vlr = mCblk->getVolumeLR();
snprintf(buffer, size, " %05d %05d %03u %03u 0x%08x %05u %04u %1d %1d %1d %05u %05u %05u 0x%08x 0x%08x 0x%08x 0x%08x\n",
mName - AudioMixer::TRACK0,
(mClient == NULL) ? getpid() : mClient->pid(),
@@ -3829,7 +3842,6 @@
if (mCblk != NULL) {
mCblk->flags |= CBLK_DIRECTION_OUT;
mCblk->buffers = (char*)mCblk + sizeof(audio_track_cblk_t);
- mCblk->volumeLR = (MAX_GAIN_INT << 16) | MAX_GAIN_INT;
mOutBuffer.frameCount = 0;
playbackThread->mTracks.add(this);
ALOGV("OutputTrack constructor mCblk %p, mBuffer %p, mCblk->buffers %p, " \
@@ -4077,13 +4089,12 @@
AudioFlinger::NotificationClient::NotificationClient(const sp<AudioFlinger>& audioFlinger,
const sp<IAudioFlingerClient>& client,
pid_t pid)
- : mAudioFlinger(audioFlinger), mPid(pid), mClient(client)
+ : mAudioFlinger(audioFlinger), mPid(pid), mAudioFlingerClient(client)
{
}
AudioFlinger::NotificationClient::~NotificationClient()
{
- mClient.clear();
}
void AudioFlinger::NotificationClient::binderDied(const wp<IBinder>& who)
@@ -4268,15 +4279,16 @@
uint32_t channels,
int id,
uint32_t device) :
- ThreadBase(audioFlinger, id, device),
- mInput(input), mTrack(NULL), mResampler(NULL), mRsmpOutBuffer(NULL), mRsmpInBuffer(NULL)
+ ThreadBase(audioFlinger, id, device, RECORD),
+ mInput(input), mTrack(NULL), mResampler(NULL), mRsmpOutBuffer(NULL), mRsmpInBuffer(NULL),
+ // mRsmpInIndex and mInputBytes set by readInputParameters()
+ mReqChannelCount(popcount(channels)),
+ mReqSampleRate(sampleRate)
+ // mBytesRead is only meaningful while active, and so is cleared in start()
+ // (but might be better to also clear here for dump?)
{
- mType = ThreadBase::RECORD;
-
snprintf(mName, kNameLength, "AudioIn_%d", id);
- mReqChannelCount = popcount(channels);
- mReqSampleRate = sampleRate;
readInputParameters();
}
@@ -4807,7 +4819,7 @@
void AudioFlinger::RecordThread::audioConfigChanged_l(int event, int param) {
AudioSystem::OutputDescriptor desc;
- void *param2 = 0;
+ void *param2 = NULL;
switch (event) {
case AudioSystem::INPUT_OPENED:
@@ -4985,10 +4997,10 @@
}
mPlaybackThreads.add(id, thread);
- if (pSamplingRate) *pSamplingRate = samplingRate;
- if (pFormat) *pFormat = format;
- if (pChannels) *pChannels = channels;
- if (pLatencyMs) *pLatencyMs = thread->latency();
+ if (pSamplingRate != NULL) *pSamplingRate = samplingRate;
+ if (pFormat != NULL) *pFormat = format;
+ if (pChannels != NULL) *pChannels = channels;
+ if (pLatencyMs != NULL) *pLatencyMs = thread->latency();
// notify client processes of the new output creation
thread->audioConfigChanged_l(AudioSystem::OUTPUT_OPENED);
@@ -5040,7 +5052,7 @@
}
}
}
- void *param2 = 0;
+ void *param2 = NULL;
audioConfigChanged_l(AudioSystem::OUTPUT_CLOSED, output, param2);
mPlaybackThreads.removeItem(output);
}
@@ -5091,7 +5103,7 @@
uint32_t *pSamplingRate,
audio_format_t *pFormat,
uint32_t *pChannels,
- uint32_t acoustics)
+ audio_in_acoustics_t acoustics)
{
status_t status;
RecordThread *thread = NULL;
@@ -5116,7 +5128,7 @@
status = inHwDev->open_input_stream(inHwDev, *pDevices, &format,
&channels, &samplingRate,
- (audio_in_acoustics_t)acoustics,
+ acoustics,
&inStream);
ALOGV("openInput() openInputStream returned input %p, SamplingRate %d, Format %d, Channels %x, acoustics %x, status %d",
inStream,
@@ -5136,7 +5148,7 @@
ALOGV("openInput() reopening with proposed sampling rate and channels");
status = inHwDev->open_input_stream(inHwDev, *pDevices, &format,
&channels, &samplingRate,
- (audio_in_acoustics_t)acoustics,
+ acoustics,
&inStream);
}
@@ -5156,9 +5168,9 @@
device);
mRecordThreads.add(id, thread);
ALOGV("openInput() created record thread: ID %d thread %p", id, thread);
- if (pSamplingRate) *pSamplingRate = reqSamplingRate;
- if (pFormat) *pFormat = format;
- if (pChannels) *pChannels = reqChannels;
+ if (pSamplingRate != NULL) *pSamplingRate = reqSamplingRate;
+ if (pFormat != NULL) *pFormat = format;
+ if (pChannels != NULL) *pChannels = reqChannels;
input->stream->common.standby(&input->stream->common);
@@ -5183,7 +5195,7 @@
}
ALOGV("closeInput() %d", input);
- void *param2 = 0;
+ void *param2 = NULL;
audioConfigChanged_l(AudioSystem::INPUT_CLOSED, input, param2);
mRecordThreads.removeItem(input);
}
@@ -5245,12 +5257,8 @@
return;
}
}
- AudioSessionRef *ref = new AudioSessionRef();
- ref->sessionid = audioSession;
- ref->pid = caller;
- ref->cnt = 1;
- mAudioSessionRefs.push(ref);
- ALOGV(" added new entry for %d", ref->sessionid);
+ mAudioSessionRefs.push(new AudioSessionRef(audioSession, caller));
+ ALOGV(" added new entry for %d", audioSession);
}
void AudioFlinger::releaseAudioSessionId(int audioSession)
@@ -5794,7 +5802,7 @@
// create effect handle and connect it to effect module
handle = new EffectHandle(effect, client, effectClient, priority);
lStatus = effect->addHandle(handle);
- if (enabled) {
+ if (enabled != NULL) {
*enabled = (int)effect->isEnabled();
}
}
@@ -6228,7 +6236,7 @@
bool enabled = false;
EffectHandle *hdl = handle.unsafe_get();
- if (hdl) {
+ if (hdl != NULL) {
ALOGV("removeHandle() unsafe_get OK");
enabled = hdl->enabled();
}
@@ -6864,7 +6872,7 @@
if (mCblkMemory != 0) {
mCblk = static_cast<effect_param_cblk_t *>(mCblkMemory->pointer());
- if (mCblk) {
+ if (mCblk != NULL) {
new(mCblk) effect_param_cblk_t();
mBuffer = (uint8_t *)mCblk + bufOffset;
}
@@ -6961,7 +6969,7 @@
// release sp on module => module destructor can be called now
mEffect.clear();
if (mClient != 0) {
- if (mCblk) {
+ if (mCblk != NULL) {
mCblk->~effect_param_cblk_t(); // destroy our shared-structure.
}
mCblkMemory.clear(); // and free the shared memory
@@ -7091,7 +7099,7 @@
void AudioFlinger::EffectHandle::dump(char* buffer, size_t size)
{
- bool locked = mCblk ? tryLock(mCblk->lock) : false;
+ bool locked = mCblk != NULL && tryLock(mCblk->lock);
snprintf(buffer, size, "\t\t\t%05d %05d %01u %01u %05u %05u\n",
(mClient == NULL) ? getpid() : mClient->pid(),
@@ -7553,7 +7561,8 @@
ALOGV("setEffectSuspendedAll_l() add entry for 0");
}
if (desc->mRefCount++ == 0) {
- Vector< sp<EffectModule> > effects = getSuspendEligibleEffects();
+ Vector< sp<EffectModule> > effects;
+ getSuspendEligibleEffects(effects);
for (size_t i = 0; i < effects.size(); i++) {
setEffectSuspended_l(&effects[i]->desc().type, true);
}
@@ -7604,16 +7613,14 @@
return true;
}
-Vector< sp<AudioFlinger::EffectModule> > AudioFlinger::EffectChain::getSuspendEligibleEffects()
+void AudioFlinger::EffectChain::getSuspendEligibleEffects(Vector< sp<AudioFlinger::EffectModule> > &effects)
{
- Vector< sp<EffectModule> > effects;
+ effects.clear();
for (size_t i = 0; i < mEffects.size(); i++) {
- if (!isEffectEligibleForSuspend(mEffects[i]->desc())) {
- continue;
+ if (isEffectEligibleForSuspend(mEffects[i]->desc())) {
+ effects.add(mEffects[i]);
}
- effects.add(mEffects[i]);
}
- return effects;
}
sp<AudioFlinger::EffectModule> AudioFlinger::EffectChain::getEffectIfEnabled(
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index ece4ba2..3f3188c 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -131,7 +131,7 @@
uint32_t *pSamplingRate,
audio_format_t *pFormat,
uint32_t *pChannels,
- uint32_t acoustics);
+ audio_in_acoustics_t acoustics);
virtual status_t closeInput(int input);
@@ -233,9 +233,9 @@
private:
Client(const Client&);
Client& operator = (const Client&);
- sp<AudioFlinger> mAudioFlinger;
- sp<MemoryDealer> mMemoryDealer;
- pid_t mPid;
+ const sp<AudioFlinger> mAudioFlinger;
+ const sp<MemoryDealer> mMemoryDealer;
+ const pid_t mPid;
};
// --- Notification Client ---
@@ -246,7 +246,7 @@
pid_t pid);
virtual ~NotificationClient();
- sp<IAudioFlingerClient> client() { return mClient; }
+ sp<IAudioFlingerClient> audioFlingerClient() const { return mAudioFlingerClient; }
// IBinder::DeathRecipient
virtual void binderDied(const wp<IBinder>& who);
@@ -255,9 +255,9 @@
NotificationClient(const NotificationClient&);
NotificationClient& operator = (const NotificationClient&);
- sp<AudioFlinger> mAudioFlinger;
- pid_t mPid;
- sp<IAudioFlingerClient> mClient;
+ const sp<AudioFlinger> mAudioFlinger;
+ const pid_t mPid;
+ const sp<IAudioFlingerClient> mAudioFlingerClient;
};
class TrackHandle;
@@ -277,17 +277,17 @@
class ThreadBase : public Thread {
public:
- ThreadBase (const sp<AudioFlinger>& audioFlinger, int id, uint32_t device);
- virtual ~ThreadBase();
-
- enum type {
+ enum type_t {
MIXER, // Thread class is MixerThread
DIRECT, // Thread class is DirectOutputThread
DUPLICATING, // Thread class is DuplicatingThread
RECORD // Thread class is RecordThread
};
+ ThreadBase (const sp<AudioFlinger>& audioFlinger, int id, uint32_t device, type_t type);
+ virtual ~ThreadBase();
+
status_t dumpBase(int fd, const Vector<String16>& args);
status_t dumpEffectChains(int fd, const Vector<String16>& args);
@@ -367,8 +367,8 @@
bool step();
void reset();
- wp<ThreadBase> mThread;
- sp<Client> mClient;
+ const wp<ThreadBase> mThread;
+ /*const*/ sp<Client> mClient; // see explanation at ~TrackBase() why not const
sp<IMemory> mCblkMemory;
audio_track_cblk_t* mCblk;
void* mBuffer;
@@ -377,9 +377,9 @@
// we don't really need a lock for these
track_state mState;
int mClientTid;
- audio_format_t mFormat;
+ const audio_format_t mFormat;
uint32_t mFlags;
- int mSessionId;
+ const int mSessionId;
uint8_t mChannelCount;
uint32_t mChannelMask;
};
@@ -408,7 +408,7 @@
};
virtual status_t initCheck() const = 0;
- int type() const { return mType; }
+ type_t type() const { return mType; }
uint32_t sampleRate() const;
int channelCount() const;
audio_format_t format() const;
@@ -530,9 +530,9 @@
friend class RecordThread;
friend class RecordTrack;
- int mType;
+ const type_t mType;
Condition mWaitWorkCV;
- sp<AudioFlinger> mAudioFlinger;
+ const sp<AudioFlinger> mAudioFlinger;
uint32_t mSampleRate;
size_t mFrameCount;
uint32_t mChannelMask;
@@ -553,7 +553,7 @@
char mName[kNameLength];
sp<IPowerManager> mPowerManager;
sp<IBinder> mWakeLockToken;
- sp<PMDeathRecipient> mDeathRecipient;
+ const sp<PMDeathRecipient> mDeathRecipient;
// list of suspended effects per session and per type. The first vector is
// keyed by session ID, the second by type UUID timeLow field
KeyedVector< int, KeyedVector< int, sp<SuspendedSessionDesc> > > mSuspendedSessions;
@@ -671,7 +671,7 @@
bool write(int16_t* data, uint32_t frames);
bool bufferQueueEmpty() { return (mBufferQueue.size() == 0) ? true : false; }
bool isActive() { return mActive; }
- wp<ThreadBase>& thread() { return mThread; }
+ const wp<ThreadBase>& thread() { return mThread; }
private:
@@ -688,10 +688,11 @@
Vector < Buffer* > mBufferQueue;
AudioBufferProvider::Buffer mOutBuffer;
bool mActive;
- DuplicatingThread* mSourceThread;
+ DuplicatingThread* const mSourceThread; // for waitTimeMs() in write()
}; // end of OutputTrack
- PlaybackThread (const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, int id, uint32_t device);
+ PlaybackThread (const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, int id,
+ uint32_t device, type_t type);
virtual ~PlaybackThread();
virtual status_t dump(int fd, const Vector<String16>& args);
@@ -817,7 +818,8 @@
MixerThread (const sp<AudioFlinger>& audioFlinger,
AudioStreamOut* output,
int id,
- uint32_t device);
+ uint32_t device,
+ type_t type = MIXER);
virtual ~MixerThread();
// Thread virtuals
@@ -917,7 +919,7 @@
virtual status_t onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags);
private:
- sp<PlaybackThread::Track> mTrack;
+ const sp<PlaybackThread::Track> mTrack;
};
friend class Client;
@@ -1021,8 +1023,8 @@
int16_t *mRsmpInBuffer;
size_t mRsmpInIndex;
size_t mInputBytes;
- int mReqChannelCount;
- uint32_t mReqSampleRate;
+ const int mReqChannelCount;
+ const uint32_t mReqSampleRate;
ssize_t mBytesRead;
};
@@ -1036,7 +1038,7 @@
virtual status_t onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags);
private:
- sp<RecordThread::RecordTrack> mRecordTrack;
+ const sp<RecordThread::RecordTrack> mRecordTrack;
};
//--- Audio Effect Management
@@ -1105,7 +1107,7 @@
int16_t *outBuffer() { return mConfig.outputCfg.buffer.s16; }
void setChain(const wp<EffectChain>& chain) { mChain = chain; }
void setThread(const wp<ThreadBase>& thread) { mThread = thread; }
- wp<ThreadBase>& thread() { return mThread; }
+ const wp<ThreadBase>& thread() { return mThread; }
status_t addHandle(const sp<EffectHandle>& handle);
void disconnect(const wp<EffectHandle>& handle, bool unpiniflast);
@@ -1325,7 +1327,8 @@
// get a list of effect modules to suspend when an effect of the type
// passed is enabled.
- Vector< sp<EffectModule> > getSuspendEligibleEffects();
+ void getSuspendEligibleEffects(Vector< sp<EffectModule> > &effects);
+
// get an effect module if it is currently enable
sp<EffectModule> getEffectIfEnabled(const effect_uuid_t *type);
// true if the effect whose descriptor is passed can be suspended
@@ -1377,8 +1380,11 @@
};
struct AudioSessionRef {
- int sessionid;
- pid_t pid;
+ // FIXME rename parameter names when fields get "m" prefix
+ AudioSessionRef(int sessionid_, pid_t pid_) :
+ sessionid(sessionid_), pid(pid_), cnt(1) {}
+ const int sessionid;
+ const pid_t pid;
int cnt;
};
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp
index a01c6a8..0b9f8ba 100644
--- a/services/audioflinger/AudioMixer.cpp
+++ b/services/audioflinger/AudioMixer.cpp
@@ -48,9 +48,10 @@
mState.enabledTracks= 0;
mState.needsChanged = 0;
mState.frameCount = frameCount;
+ mState.hook = process__nop;
mState.outputTemp = NULL;
mState.resampleTemp = NULL;
- mState.hook = process__nop;
+ // mState.reserved
track_t* t = mState.tracks;
for (unsigned i=0 ; i < MAX_NUM_TRACKS ; i++) {
t->needs = 0;
@@ -70,12 +71,13 @@
t->enabled = 0;
t->format = 16;
t->channelMask = AUDIO_CHANNEL_OUT_STEREO;
- t->buffer.raw = 0;
t->bufferProvider = NULL;
+ t->buffer.raw = NULL;
+ // t->buffer.frameCount
t->hook = NULL;
+ t->in = NULL;
t->resampler = NULL;
t->sampleRate = mSampleRate;
- t->in = NULL;
t->mainBuffer = NULL;
t->auxBuffer = NULL;
t++;
@@ -123,7 +125,7 @@
track.enabled = 0;
invalidateState(1<<name);
}
- if (track.resampler) {
+ if (track.resampler != NULL) {
// delete the resampler
delete track.resampler;
track.resampler = NULL;
@@ -807,7 +809,7 @@
while (outFrames) {
t1.buffer.frameCount = outFrames;
t1.bufferProvider->getNextBuffer(&t1.buffer);
- if (!t1.buffer.raw) break;
+ if (t1.buffer.raw == NULL) break;
outFrames -= t1.buffer.frameCount;
t1.bufferProvider->releaseBuffer(&t1.buffer);
}
diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp
index 7695d2b..1dddbb3 100644
--- a/services/audioflinger/AudioPolicyService.cpp
+++ b/services/audioflinger/AudioPolicyService.cpp
@@ -144,9 +144,9 @@
}
mInputs.clear();
- if (mpAudioPolicy && mpAudioPolicyDev)
+ if (mpAudioPolicy != NULL && mpAudioPolicyDev != NULL)
mpAudioPolicyDev->destroy_audio_policy(mpAudioPolicyDev, mpAudioPolicy);
- if (mpAudioPolicyDev)
+ if (mpAudioPolicyDev != NULL)
audio_policy_dev_close(mpAudioPolicyDev);
}
@@ -789,7 +789,8 @@
return NO_ERROR;
}
-void AudioPolicyService::AudioCommandThread::startToneCommand(int type, audio_stream_type_t stream)
+void AudioPolicyService::AudioCommandThread::startToneCommand(ToneGenerator::tone_type type,
+ audio_stream_type_t stream)
{
AudioCommand *command = new AudioCommand();
command->mCommand = START_TONE;
@@ -1159,7 +1160,7 @@
if (param == NULL && value == NULL) {
// try to parse simple parameter form {int int}
param = root->first_child;
- if (param) {
+ if (param != NULL) {
// Note: that a pair of random strings is read as 0 0
int *ptr = (int *)fx_param->data;
int *ptr2 = (int *)((char *)param + sizeof(effect_param_t));
@@ -1418,7 +1419,7 @@
uint32_t *pSamplingRate,
audio_format_t *pFormat,
uint32_t *pChannels,
- uint32_t acoustics)
+ audio_in_acoustics_t acoustics)
{
sp<IAudioFlinger> af = AudioSystem::get_audio_flinger();
if (af == NULL) {
diff --git a/services/audioflinger/AudioPolicyService.h b/services/audioflinger/AudioPolicyService.h
index 3c0f5ed..62219e5 100644
--- a/services/audioflinger/AudioPolicyService.h
+++ b/services/audioflinger/AudioPolicyService.h
@@ -79,7 +79,7 @@
audio_format_t format = AUDIO_FORMAT_DEFAULT,
uint32_t channels = 0,
audio_in_acoustics_t acoustics =
- (audio_in_acoustics_t)0,
+ (audio_in_acoustics_t)0 /*AUDIO_IN_ACOUSTICS_NONE*/,
int audioSession = 0);
virtual status_t startInput(audio_io_handle_t input);
virtual status_t stopInput(audio_io_handle_t input);
@@ -171,7 +171,8 @@
virtual bool threadLoop();
void exit();
- void startToneCommand(int type = 0, audio_stream_type_t stream = AUDIO_STREAM_VOICE_CALL);
+ void startToneCommand(ToneGenerator::tone_type type,
+ audio_stream_type_t stream);
void stopToneCommand();
status_t volumeCommand(audio_stream_type_t stream, float volume, int output, int delayMs = 0);
status_t parametersCommand(int ioHandle, const char *keyValuePairs, int delayMs = 0);
@@ -198,7 +199,7 @@
class ToneData {
public:
- int mType; // tone type (START_TONE only)
+ ToneGenerator::tone_type mType; // tone type (START_TONE only)
audio_stream_type_t mStream; // stream type (START_TONE only)
};
diff --git a/services/java/com/android/server/NativeDaemonConnector.java b/services/java/com/android/server/NativeDaemonConnector.java
index f475dd6..308661f 100644
--- a/services/java/com/android/server/NativeDaemonConnector.java
+++ b/services/java/com/android/server/NativeDaemonConnector.java
@@ -153,6 +153,10 @@
start = i + 1;
}
}
+ if (start == 0) {
+ final String rawEvent = new String(buffer, start, count, Charsets.UTF_8);
+ log("RCV incomplete <- {" + rawEvent + "}");
+ }
// We should end at the amount we read. If not, compact then
// buffer and read again.
@@ -297,7 +301,11 @@
throws NativeDaemonConnectorException {
final ArrayList<NativeDaemonEvent> events = Lists.newArrayList();
- mResponseQueue.clear();
+ while (mResponseQueue.size() > 0) {
+ try {
+ log("ignoring {" + mResponseQueue.take() + "}");
+ } catch (Exception e) {}
+ }
final String sentCommand = sendCommandLocked(cmd, args);
diff --git a/test-runner/src/android/test/mock/MockContentProvider.java b/test-runner/src/android/test/mock/MockContentProvider.java
index 4ff943e..a8c388e 100644
--- a/test-runner/src/android/test/mock/MockContentProvider.java
+++ b/test-runner/src/android/test/mock/MockContentProvider.java
@@ -21,7 +21,7 @@
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 @@
@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 @@
}
@Override
- public ICancelationSignal createCancelationSignal() throws RemoteException {
+ public ICancellationSignal createCancellationSignal() throws RemoteException {
return null;
}
}
diff --git a/test-runner/src/android/test/mock/MockIContentProvider.java b/test-runner/src/android/test/mock/MockIContentProvider.java
index 41bc27d..1aa0448 100644
--- a/test-runner/src/android/test/mock/MockIContentProvider.java
+++ b/test-runner/src/android/test/mock/MockIContentProvider.java
@@ -21,7 +21,7 @@
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 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 @@
}
@Override
- public ICancelationSignal createCancelationSignal() throws RemoteException {
+ public ICancellationSignal createCancellationSignal() throws RemoteException {
throw new UnsupportedOperationException("unimplemented mock method");
}
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContentProvider.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContentProvider.java
index c64ab65..e28866e 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContentProvider.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContentProvider.java
@@ -19,7 +19,7 @@
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 @@
@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 @@
}
@Override
- public ICancelationSignal createCancelationSignal() throws RemoteException {
+ public ICancellationSignal createCancellationSignal() throws RemoteException {
// TODO Auto-generated method stub
return null;
}