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

Commit f7353da8 authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Do not invoke onProgressUpdate if the task is canceled. Bug #2734382"

parents 627eca9b 4aaf8ec9
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -402,15 +402,20 @@ public abstract class AsyncTask<Params, Progress, Result> {
     * still running. Each call to this method will trigger the execution of
     * {@link #onProgressUpdate} on the UI thread.
     * 
     * {@link #onProgressUpdate} will note be called if the task has been
     * canceled.
     *
     * @param values The progress values to update the UI with.
     *
     * @see #onProgressUpdate
     * @see #doInBackground
     */
    protected final void publishProgress(Progress... values) {
        if (!isCancelled()) {
            sHandler.obtainMessage(MESSAGE_POST_PROGRESS,
                    new AsyncTaskResult<Progress>(this, values)).sendToTarget();
        }
    }

    private void finish(Result result) {
        if (isCancelled()) result = null;