Catch exceptions when DownloadManager is disabled
b/14562210 Change-Id: If3f2da034e8492de049bc3bcac910a033c47d600
This commit is contained in:
parent
564a5343cc
commit
32471fc22e
@ -31,8 +31,6 @@ import android.webkit.MimeTypeMap;
|
||||
import com.android.emailcommon.Logging;
|
||||
import com.android.emailcommon.provider.EmailContent.Attachment;
|
||||
import com.android.emailcommon.provider.EmailContent.AttachmentColumns;
|
||||
import com.android.emailcommon.provider.EmailContent.Body;
|
||||
import com.android.emailcommon.provider.EmailContent.BodyColumns;
|
||||
import com.android.emailcommon.provider.EmailContent.Message;
|
||||
import com.android.emailcommon.provider.EmailContent.MessageColumns;
|
||||
import com.android.mail.providers.UIProvider;
|
||||
@ -431,6 +429,7 @@ public class AttachmentUtilities {
|
||||
MediaScannerConnection.scanFile(context, new String[] {absolutePath},
|
||||
null, null);
|
||||
|
||||
try {
|
||||
DownloadManager dm =
|
||||
(DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
long id = dm.addCompletedDownload(attachment.mFileName, attachment.mFileName,
|
||||
@ -438,7 +437,10 @@ public class AttachmentUtilities {
|
||||
attachment.mMimeType, absolutePath, size,
|
||||
true /* show notification */);
|
||||
contentUri = dm.getUriForDownloadedFile(id).toString();
|
||||
|
||||
} catch (final IllegalArgumentException e) {
|
||||
LogUtils.d(LogUtils.TAG, e, "IAE from DownloadManager while saving attachment");
|
||||
throw new IOException(e);
|
||||
}
|
||||
} else {
|
||||
LogUtils.w(Logging.LOG_TAG,
|
||||
"Trying to save an attachment without external storage?");
|
||||
|
Loading…
Reference in New Issue
Block a user