Merge "Fix AsyncTask to handle exceptions in doInBackground" into nyc-mr1-dev
This commit is contained in:
@@ -298,12 +298,16 @@ public abstract class AsyncTask<Params, Progress, Result> {
|
|||||||
mWorker = new WorkerRunnable<Params, Result>() {
|
mWorker = new WorkerRunnable<Params, Result>() {
|
||||||
public Result call() throws Exception {
|
public Result call() throws Exception {
|
||||||
mTaskInvoked.set(true);
|
mTaskInvoked.set(true);
|
||||||
|
Result result = null;
|
||||||
|
try {
|
||||||
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
|
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
Result result = doInBackground(mParams);
|
result = doInBackground(mParams);
|
||||||
Binder.flushPendingCommands();
|
Binder.flushPendingCommands();
|
||||||
return postResult(result);
|
} finally {
|
||||||
|
postResult(result);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user