Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0afcd8f4 authored by Charles Munger's avatar Charles Munger Committed by android-build-merger
Browse files

Merge "Deprecate AsyncTask" am: c26568d8

am: e6685335

Change-Id: Ie20907c3cab97732c77a4e448cf9686d4e26df91
parents 8c706849 e6685335
Loading
Loading
Loading
Loading
+25 −25
Original line number Diff line number Diff line
@@ -33984,31 +33984,31 @@ package android.opengl {
package android.os {
  public abstract class AsyncTask<Params, Progress, Result> {
    ctor public AsyncTask();
    method public final boolean cancel(boolean);
    method @WorkerThread protected abstract Result doInBackground(Params...);
    method @MainThread public final android.os.AsyncTask<Params,Progress,Result> execute(Params...);
    method @MainThread public static void execute(Runnable);
    method @MainThread public final android.os.AsyncTask<Params,Progress,Result> executeOnExecutor(java.util.concurrent.Executor, Params...);
    method public final Result get() throws java.util.concurrent.ExecutionException, java.lang.InterruptedException;
    method public final Result get(long, java.util.concurrent.TimeUnit) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, java.util.concurrent.TimeoutException;
    method public final android.os.AsyncTask.Status getStatus();
    method public final boolean isCancelled();
    method @MainThread protected void onCancelled(Result);
    method @MainThread protected void onCancelled();
    method @MainThread protected void onPostExecute(Result);
    method @MainThread protected void onPreExecute();
    method @MainThread protected void onProgressUpdate(Progress...);
    method @WorkerThread protected final void publishProgress(Progress...);
    field public static final java.util.concurrent.Executor SERIAL_EXECUTOR;
    field public static final java.util.concurrent.Executor THREAD_POOL_EXECUTOR;
  }
  public enum AsyncTask.Status {
    enum_constant public static final android.os.AsyncTask.Status FINISHED;
    enum_constant public static final android.os.AsyncTask.Status PENDING;
    enum_constant public static final android.os.AsyncTask.Status RUNNING;
  @Deprecated public abstract class AsyncTask<Params, Progress, Result> {
    ctor @Deprecated public AsyncTask();
    method @Deprecated public final boolean cancel(boolean);
    method @Deprecated @WorkerThread protected abstract Result doInBackground(Params...);
    method @Deprecated @MainThread public final android.os.AsyncTask<Params,Progress,Result> execute(Params...);
    method @Deprecated @MainThread public static void execute(Runnable);
    method @Deprecated @MainThread public final android.os.AsyncTask<Params,Progress,Result> executeOnExecutor(java.util.concurrent.Executor, Params...);
    method @Deprecated public final Result get() throws java.util.concurrent.ExecutionException, java.lang.InterruptedException;
    method @Deprecated public final Result get(long, java.util.concurrent.TimeUnit) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, java.util.concurrent.TimeoutException;
    method @Deprecated public final android.os.AsyncTask.Status getStatus();
    method @Deprecated public final boolean isCancelled();
    method @Deprecated @MainThread protected void onCancelled(Result);
    method @Deprecated @MainThread protected void onCancelled();
    method @Deprecated @MainThread protected void onPostExecute(Result);
    method @Deprecated @MainThread protected void onPreExecute();
    method @Deprecated @MainThread protected void onProgressUpdate(Progress...);
    method @Deprecated @WorkerThread protected final void publishProgress(Progress...);
    field @Deprecated public static final java.util.concurrent.Executor SERIAL_EXECUTOR;
    field @Deprecated public static final java.util.concurrent.Executor THREAD_POOL_EXECUTOR;
  }
  @Deprecated public enum AsyncTask.Status {
    enum_constant @Deprecated public static final android.os.AsyncTask.Status FINISHED;
    enum_constant @Deprecated public static final android.os.AsyncTask.Status PENDING;
    enum_constant @Deprecated public static final android.os.AsyncTask.Status RUNNING;
  }
  public class BadParcelableException extends android.util.AndroidRuntimeException {
+19 −3
Original line number Diff line number Diff line
@@ -38,9 +38,11 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * <p>AsyncTask enables proper and easy use of the UI thread. This class allows you
 * to perform background operations and publish results on the UI thread without
 * having to manipulate threads and/or handlers.</p>
 * <p>AsyncTask was intended to enable proper and easy use of the UI thread. However, the most
 * common use case was for integrating into UI, and that would cause Context leaks, missed
 * callbacks, or crashes on configuration changes. It also has inconsistent behavior on different
 * versions of the platform, swallows exceptions from {@code doInBackground}, and does not provide
 * much utility over using {@link Executor}s directly.</p>
 *
 * <p>AsyncTask is designed to be a helper class around {@link Thread} and {@link Handler}
 * and does not constitute a generic threading framework. AsyncTasks should ideally be
@@ -188,7 +190,12 @@ import java.util.concurrent.atomic.AtomicInteger;
 * <p>If you truly want parallel execution, you can invoke
 * {@link #executeOnExecutor(java.util.concurrent.Executor, Object[])} with
 * {@link #THREAD_POOL_EXECUTOR}.</p>
 *
 * @deprecated Use the standard <code>java.util.concurrent</code> or
 *   <a href="https://developer.android.com/topic/libraries/architecture/coroutines">
 *   Kotlin concurrency utilities</a> instead.
 */
@Deprecated
public abstract class AsyncTask<Params, Progress, Result> {
    private static final String LOG_TAG = "AsyncTask";

@@ -240,7 +247,13 @@ public abstract class AsyncTask<Params, Progress, Result> {

    /**
     * An {@link Executor} that can be used to execute tasks in parallel.
     *
     * @deprecated Using a single thread pool for a general purpose results in suboptimal behavior
     *   for different tasks. Small, CPU-bound tasks benefit from a bounded pool and queueing, and
     *   long-running blocking tasks, such as network operations, benefit from many threads. Use or
     *   create an {@link Executor} configured for your use case.
     */
    @Deprecated
    public static final Executor THREAD_POOL_EXECUTOR;

    static {
@@ -254,7 +267,10 @@ public abstract class AsyncTask<Params, Progress, Result> {
    /**
     * An {@link Executor} that executes tasks one at a time in serial
     * order.  This serialization is global to a particular process.
     *
     * @deprecated Globally serializing tasks results in excessive queuing for unrelated operations.
     */
    @Deprecated
    public static final Executor SERIAL_EXECUTOR = new SerialExecutor();

    private static final int MESSAGE_POST_RESULT = 0x1;