Loading core/java/android/os/AsyncTask.java +6 −4 Original line number Diff line number Diff line Loading @@ -195,6 +195,7 @@ public abstract class AsyncTask<Params, Progress, Result> { private volatile Status mStatus = Status.PENDING; private final AtomicBoolean mCancelled = new AtomicBoolean(); private final AtomicBoolean mTaskInvoked = new AtomicBoolean(); private static class SerialExecutor implements Executor { Loading Loading @@ -261,6 +262,7 @@ public abstract class AsyncTask<Params, Progress, Result> { mTaskInvoked.set(true); Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); //noinspection unchecked return postResult(doInBackground(mParams)); } }; Loading @@ -269,9 +271,7 @@ public abstract class AsyncTask<Params, Progress, Result> { @Override protected void done() { try { final Result result = get(); postResultIfNotInvoked(result); postResultIfNotInvoked(get()); } catch (InterruptedException e) { android.util.Log.w(LOG_TAG, e); } catch (ExecutionException e) { Loading @@ -295,6 +295,7 @@ public abstract class AsyncTask<Params, Progress, Result> { } private Result postResult(Result result) { @SuppressWarnings("unchecked") Message message = sHandler.obtainMessage(MESSAGE_POST_RESULT, new AsyncTaskResult<Result>(this, result)); message.sendToTarget(); Loading Loading @@ -411,7 +412,7 @@ public abstract class AsyncTask<Params, Progress, Result> { * @see #cancel(boolean) */ public final boolean isCancelled() { return mFuture.isCancelled(); return mCancelled.get(); } /** Loading Loading @@ -444,6 +445,7 @@ public abstract class AsyncTask<Params, Progress, Result> { * @see #onCancelled(Object) */ public final boolean cancel(boolean mayInterruptIfRunning) { mCancelled.set(true); return mFuture.cancel(mayInterruptIfRunning); } Loading Loading
core/java/android/os/AsyncTask.java +6 −4 Original line number Diff line number Diff line Loading @@ -195,6 +195,7 @@ public abstract class AsyncTask<Params, Progress, Result> { private volatile Status mStatus = Status.PENDING; private final AtomicBoolean mCancelled = new AtomicBoolean(); private final AtomicBoolean mTaskInvoked = new AtomicBoolean(); private static class SerialExecutor implements Executor { Loading Loading @@ -261,6 +262,7 @@ public abstract class AsyncTask<Params, Progress, Result> { mTaskInvoked.set(true); Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); //noinspection unchecked return postResult(doInBackground(mParams)); } }; Loading @@ -269,9 +271,7 @@ public abstract class AsyncTask<Params, Progress, Result> { @Override protected void done() { try { final Result result = get(); postResultIfNotInvoked(result); postResultIfNotInvoked(get()); } catch (InterruptedException e) { android.util.Log.w(LOG_TAG, e); } catch (ExecutionException e) { Loading @@ -295,6 +295,7 @@ public abstract class AsyncTask<Params, Progress, Result> { } private Result postResult(Result result) { @SuppressWarnings("unchecked") Message message = sHandler.obtainMessage(MESSAGE_POST_RESULT, new AsyncTaskResult<Result>(this, result)); message.sendToTarget(); Loading Loading @@ -411,7 +412,7 @@ public abstract class AsyncTask<Params, Progress, Result> { * @see #cancel(boolean) */ public final boolean isCancelled() { return mFuture.isCancelled(); return mCancelled.get(); } /** Loading Loading @@ -444,6 +445,7 @@ public abstract class AsyncTask<Params, Progress, Result> { * @see #onCancelled(Object) */ public final boolean cancel(boolean mayInterruptIfRunning) { mCancelled.set(true); return mFuture.cancel(mayInterruptIfRunning); } Loading