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

Commit c26568d8 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Deprecate AsyncTask"

parents c29a5cf1 0a96c3b9
Loading
Loading
Loading
Loading
+25 −25
Original line number Original line Diff line number Diff line
@@ -33984,31 +33984,31 @@ package android.opengl {
package android.os {
package android.os {
  public abstract class AsyncTask<Params, Progress, Result> {
  @Deprecated public abstract class AsyncTask<Params, Progress, Result> {
    ctor public AsyncTask();
    ctor @Deprecated public AsyncTask();
    method public final boolean cancel(boolean);
    method @Deprecated public final boolean cancel(boolean);
    method @WorkerThread protected abstract Result doInBackground(Params...);
    method @Deprecated @WorkerThread protected abstract Result doInBackground(Params...);
    method @MainThread public final android.os.AsyncTask<Params,Progress,Result> execute(Params...);
    method @Deprecated @MainThread public final android.os.AsyncTask<Params,Progress,Result> execute(Params...);
    method @MainThread public static void execute(Runnable);
    method @Deprecated @MainThread public static void execute(Runnable);
    method @MainThread public final android.os.AsyncTask<Params,Progress,Result> executeOnExecutor(java.util.concurrent.Executor, Params...);
    method @Deprecated @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 @Deprecated 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 @Deprecated 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 @Deprecated public final android.os.AsyncTask.Status getStatus();
    method public final boolean isCancelled();
    method @Deprecated public final boolean isCancelled();
    method @MainThread protected void onCancelled(Result);
    method @Deprecated @MainThread protected void onCancelled(Result);
    method @MainThread protected void onCancelled();
    method @Deprecated @MainThread protected void onCancelled();
    method @MainThread protected void onPostExecute(Result);
    method @Deprecated @MainThread protected void onPostExecute(Result);
    method @MainThread protected void onPreExecute();
    method @Deprecated @MainThread protected void onPreExecute();
    method @MainThread protected void onProgressUpdate(Progress...);
    method @Deprecated @MainThread protected void onProgressUpdate(Progress...);
    method @WorkerThread protected final void publishProgress(Progress...);
    method @Deprecated @WorkerThread protected final void publishProgress(Progress...);
    field public static final java.util.concurrent.Executor SERIAL_EXECUTOR;
    field @Deprecated public static final java.util.concurrent.Executor SERIAL_EXECUTOR;
    field public static final java.util.concurrent.Executor THREAD_POOL_EXECUTOR;
    field @Deprecated public static final java.util.concurrent.Executor THREAD_POOL_EXECUTOR;
  }
  }
  public enum AsyncTask.Status {
  @Deprecated public enum AsyncTask.Status {
    enum_constant public static final android.os.AsyncTask.Status FINISHED;
    enum_constant @Deprecated public static final android.os.AsyncTask.Status FINISHED;
    enum_constant public static final android.os.AsyncTask.Status PENDING;
    enum_constant @Deprecated public static final android.os.AsyncTask.Status PENDING;
    enum_constant public static final android.os.AsyncTask.Status RUNNING;
    enum_constant @Deprecated public static final android.os.AsyncTask.Status RUNNING;
  }
  }
  public class BadParcelableException extends android.util.AndroidRuntimeException {
  public class BadParcelableException extends android.util.AndroidRuntimeException {
+19 −3
Original line number Original line Diff line number Diff line
@@ -38,9 +38,11 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicInteger;


/**
/**
 * <p>AsyncTask enables proper and easy use of the UI thread. This class allows you
 * <p>AsyncTask was intended to enable proper and easy use of the UI thread. However, the most
 * to perform background operations and publish results on the UI thread without
 * common use case was for integrating into UI, and that would cause Context leaks, missed
 * having to manipulate threads and/or handlers.</p>
 * 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}
 * <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
 * 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
 * <p>If you truly want parallel execution, you can invoke
 * {@link #executeOnExecutor(java.util.concurrent.Executor, Object[])} with
 * {@link #executeOnExecutor(java.util.concurrent.Executor, Object[])} with
 * {@link #THREAD_POOL_EXECUTOR}.</p>
 * {@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> {
public abstract class AsyncTask<Params, Progress, Result> {
    private static final String LOG_TAG = "AsyncTask";
    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.
     * 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;
    public static final Executor THREAD_POOL_EXECUTOR;


    static {
    static {
@@ -254,7 +267,10 @@ public abstract class AsyncTask<Params, Progress, Result> {
    /**
    /**
     * An {@link Executor} that executes tasks one at a time in serial
     * An {@link Executor} that executes tasks one at a time in serial
     * order.  This serialization is global to a particular process.
     * 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();
    public static final Executor SERIAL_EXECUTOR = new SerialExecutor();


    private static final int MESSAGE_POST_RESULT = 0x1;
    private static final int MESSAGE_POST_RESULT = 0x1;