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