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

Commit 7697ba26 authored by Tony Mantler's avatar Tony Mantler Committed by android-build-merger
Browse files

Fix AsyncTask to handle exceptions in doInBackground

am: 78a8e9d2

Change-Id: Ie56e95882f0aa1224a4eb03ac25374bb08454d2c
parents f286d846 78a8e9d2
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -298,12 +298,16 @@ public abstract class AsyncTask<Params, Progress, Result> {
        mWorker = new WorkerRunnable<Params, Result>() {
            public Result call() throws Exception {
                mTaskInvoked.set(true);

                Result result = null;
                try {
                    Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
                    //noinspection unchecked
                Result result = doInBackground(mParams);
                    result = doInBackground(mParams);
                    Binder.flushPendingCommands();
                return postResult(result);
                } finally {
                    postResult(result);
                }
                return result;
            }
        };