Fix an exception caused by toast running on background thread
commit1f5c3284e19a242b55ca9a4501286277733a67a5
authorqinmin <qinmin@chromium.org>
Fri, 3 Apr 2015 17:42:21 +0000 (3 10:42 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 3 Apr 2015 17:46:54 +0000 (3 17:46 +0000)
treea2db9f8e7bcbae48294ca5cc8295ea8f5c84f4b6
parentbc4e5fe01f6fe19df173eba33b3f6f8159c9da71
Fix an exception caused by toast running on background thread

Chrome uses an AsyncTask to post the download notifications.
For completed downloads, Android DownloadManager will help us post the notification.
However, if DownloadManager failed to enqueue a download, an exception will be thrown to show a toast.
But toast cannot be run on a background thread, we need to use the UI thread to show a toast.
This change fixes the issue by using AsyncTask.onPostExecute to show the toast on.

BUG=469576

Review URL: https://codereview.chromium.org/1052313002

Cr-Commit-Position: refs/heads/master@{#323763}
chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotifier.java
chrome/android/java/src/org/chromium/chrome/browser/download/SystemDownloadNotifier.java
chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadManagerServiceTest.java