diff options
author | Tor Norbye <tnorbye@google.com> | 2015-03-10 20:55:31 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2015-04-23 22:14:19 +0000 |
commit | 83c6896cbf402623ef7d97f13ed65098df63429f (patch) | |
tree | 9899a08246c75218b957bfdd2263654abfe1a405 | |
parent | ed191db3a3bc2c18c8f21d9043343b2baad112fd (diff) | |
download | frameworks_base-83c6896cbf402623ef7d97f13ed65098df63429f.zip frameworks_base-83c6896cbf402623ef7d97f13ed65098df63429f.tar.gz frameworks_base-83c6896cbf402623ef7d97f13ed65098df63429f.tar.bz2 |
Annotate some APIs with threading annotations
Change-Id: I24bda29261cdecbe78b2529866624b9313ca5c03
-rw-r--r-- | core/java/android/app/Activity.java | 2 | ||||
-rw-r--r-- | core/java/android/app/IntentService.java | 2 | ||||
-rw-r--r-- | core/java/android/bluetooth/BluetoothHealthCallback.java | 3 | ||||
-rw-r--r-- | core/java/android/os/AsyncTask.java | 13 | ||||
-rw-r--r-- | core/java/android/view/View.java | 2 | ||||
-rw-r--r-- | core/java/android/view/ViewGroup.java | 2 | ||||
-rw-r--r-- | core/java/android/widget/CursorAdapter.java | 2 |
7 files changed, 26 insertions, 0 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 69cba78..f70f07b 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -21,6 +21,7 @@ import android.annotation.DrawableRes; import android.annotation.IdRes; import android.annotation.IntDef; import android.annotation.LayoutRes; +import android.annotation.MainThread; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.StyleRes; @@ -927,6 +928,7 @@ public class Activity extends ContextThemeWrapper * @see #onRestoreInstanceState * @see #onPostCreate */ + @MainThread @CallSuper protected void onCreate(@Nullable Bundle savedInstanceState) { if (DEBUG_LIFECYCLE) Slog.v(TAG, "onCreate " + this + ": " + savedInstanceState); diff --git a/core/java/android/app/IntentService.java b/core/java/android/app/IntentService.java index 96767ae..3cda973 100644 --- a/core/java/android/app/IntentService.java +++ b/core/java/android/app/IntentService.java @@ -16,6 +16,7 @@ package android.app; +import android.annotation.WorkerThread; import android.content.Intent; import android.os.Handler; import android.os.HandlerThread; @@ -158,5 +159,6 @@ public abstract class IntentService extends Service { * @param intent The value passed to {@link * android.content.Context#startService(Intent)}. */ + @WorkerThread protected abstract void onHandleIntent(Intent intent); } diff --git a/core/java/android/bluetooth/BluetoothHealthCallback.java b/core/java/android/bluetooth/BluetoothHealthCallback.java index baf2ade..128376f 100644 --- a/core/java/android/bluetooth/BluetoothHealthCallback.java +++ b/core/java/android/bluetooth/BluetoothHealthCallback.java @@ -17,6 +17,7 @@ package android.bluetooth; +import android.annotation.BinderThread; import android.os.ParcelFileDescriptor; import android.util.Log; @@ -39,6 +40,7 @@ public abstract class BluetoothHealthCallback { * {@link BluetoothHealth#APP_CONFIG_UNREGISTRATION_SUCCESS} or * {@link BluetoothHealth#APP_CONFIG_UNREGISTRATION_FAILURE} */ + @BinderThread public void onHealthAppConfigurationStatusChange(BluetoothHealthAppConfiguration config, int status) { Log.d(TAG, "onHealthAppConfigurationStatusChange: " + config + "Status: " + status); @@ -58,6 +60,7 @@ public abstract class BluetoothHealthCallback { * @param channelId The id associated with the channel. This id will be used * in future calls like when disconnecting the channel. */ + @BinderThread public void onHealthChannelStateChange(BluetoothHealthAppConfiguration config, BluetoothDevice device, int prevState, int newState, ParcelFileDescriptor fd, int channelId) { diff --git a/core/java/android/os/AsyncTask.java b/core/java/android/os/AsyncTask.java index 47e8e69..243ddf7 100644 --- a/core/java/android/os/AsyncTask.java +++ b/core/java/android/os/AsyncTask.java @@ -16,6 +16,9 @@ package android.os; +import android.annotation.MainThread; +import android.annotation.WorkerThread; + import java.util.ArrayDeque; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Callable; @@ -350,6 +353,7 @@ public abstract class AsyncTask<Params, Progress, Result> { * @see #onPostExecute * @see #publishProgress */ + @WorkerThread protected abstract Result doInBackground(Params... params); /** @@ -358,6 +362,7 @@ public abstract class AsyncTask<Params, Progress, Result> { * @see #onPostExecute * @see #doInBackground */ + @MainThread protected void onPreExecute() { } @@ -374,6 +379,7 @@ public abstract class AsyncTask<Params, Progress, Result> { * @see #onCancelled(Object) */ @SuppressWarnings({"UnusedDeclaration"}) + @MainThread protected void onPostExecute(Result result) { } @@ -387,6 +393,7 @@ public abstract class AsyncTask<Params, Progress, Result> { * @see #doInBackground */ @SuppressWarnings({"UnusedDeclaration"}) + @MainThread protected void onProgressUpdate(Progress... values) { } @@ -405,6 +412,7 @@ public abstract class AsyncTask<Params, Progress, Result> { * @see #isCancelled() */ @SuppressWarnings({"UnusedParameters"}) + @MainThread protected void onCancelled(Result result) { onCancelled(); } @@ -421,6 +429,7 @@ public abstract class AsyncTask<Params, Progress, Result> { * @see #cancel(boolean) * @see #isCancelled() */ + @MainThread protected void onCancelled() { } @@ -535,6 +544,7 @@ public abstract class AsyncTask<Params, Progress, Result> { * @see #executeOnExecutor(java.util.concurrent.Executor, Object[]) * @see #execute(Runnable) */ + @MainThread public final AsyncTask<Params, Progress, Result> execute(Params... params) { return executeOnExecutor(sDefaultExecutor, params); } @@ -572,6 +582,7 @@ public abstract class AsyncTask<Params, Progress, Result> { * * @see #execute(Object[]) */ + @MainThread public final AsyncTask<Params, Progress, Result> executeOnExecutor(Executor exec, Params... params) { if (mStatus != Status.PENDING) { @@ -604,6 +615,7 @@ public abstract class AsyncTask<Params, Progress, Result> { * @see #execute(Object[]) * @see #executeOnExecutor(java.util.concurrent.Executor, Object[]) */ + @MainThread public static void execute(Runnable runnable) { sDefaultExecutor.execute(runnable); } @@ -622,6 +634,7 @@ public abstract class AsyncTask<Params, Progress, Result> { * @see #onProgressUpdate * @see #doInBackground */ + @WorkerThread protected final void publishProgress(Progress... values) { if (!isCancelled()) { getHandler().obtainMessage(MESSAGE_POST_PROGRESS, diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 5c6ce76..9b70e72 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -28,6 +28,7 @@ import android.annotation.LayoutRes; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Size; +import android.annotation.UiThread; import android.content.ClipData; import android.content.Context; import android.content.Intent; @@ -699,6 +700,7 @@ import java.util.concurrent.atomic.AtomicInteger; * * @see android.view.ViewGroup */ +@UiThread public class View implements Drawable.Callback, KeyEvent.Callback, AccessibilityEventSource { private static final boolean DBG = false; diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 4324e75..4cd99c8 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -18,6 +18,7 @@ package android.view; import android.animation.LayoutTransition; import android.annotation.IdRes; +import android.annotation.UiThread; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; @@ -105,6 +106,7 @@ import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1; * @attr ref android.R.styleable#ViewGroup_splitMotionEvents * @attr ref android.R.styleable#ViewGroup_layoutMode */ +@UiThread public abstract class ViewGroup extends View implements ViewParent, ViewManager { private static final String TAG = "ViewGroup"; diff --git a/core/java/android/widget/CursorAdapter.java b/core/java/android/widget/CursorAdapter.java index 30c74c0..d8ce60c 100644 --- a/core/java/android/widget/CursorAdapter.java +++ b/core/java/android/widget/CursorAdapter.java @@ -16,6 +16,7 @@ package android.widget; +import android.annotation.WorkerThread; import android.content.Context; import android.content.res.Resources; import android.database.ContentObserver; @@ -425,6 +426,7 @@ public abstract class CursorAdapter extends BaseAdapter implements Filterable, * @see #getFilterQueryProvider() * @see #setFilterQueryProvider(android.widget.FilterQueryProvider) */ + @WorkerThread public Cursor runQueryOnBackgroundThread(CharSequence constraint) { if (mFilterQueryProvider != null) { return mFilterQueryProvider.runQuery(constraint); |