diff options
author | kaiyiz <kaiyiz@codeaurora.org> | 2014-04-05 15:02:26 +0800 |
---|---|---|
committer | Adnan <adnan@cyngn.com> | 2014-09-03 15:41:22 -0700 |
commit | 1b1dd3af5e9fdefbb10cd3e3333aaf0108ae5ec9 (patch) | |
tree | 211dd663e5929fb3c66e708c39bec515b66fc4cb | |
parent | 50c99ad4996a23d1c45fd3631abe2f6e18df296a (diff) | |
download | android_packages_apps_UnifiedEmail-1b1dd3af5e9fdefbb10cd3e3333aaf0108ae5ec9.tar.gz android_packages_apps_UnifiedEmail-1b1dd3af5e9fdefbb10cd3e3333aaf0108ae5ec9.tar.bz2 android_packages_apps_UnifiedEmail-1b1dd3af5e9fdefbb10cd3e3333aaf0108ae5ec9.zip |
UnifiedEmail: Save the copied size as the file size
The downloadedSize of the attachment is the uiDownloadSize record in
the database, and it is not the size of the stored file.
Use the copied bytes count as the size of the saved attachment.
CRs-Fixed: 642897
Change-Id: Iff25c6181e07ec5d8dcafe3fee0e6168a4b6cfb4
-rw-r--r-- | src/com/android/mail/browse/AttachmentActionHandler.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/com/android/mail/browse/AttachmentActionHandler.java b/src/com/android/mail/browse/AttachmentActionHandler.java index fda1f85f9..639e37c72 100644 --- a/src/com/android/mail/browse/AttachmentActionHandler.java +++ b/src/com/android/mail/browse/AttachmentActionHandler.java @@ -290,7 +290,7 @@ public class AttachmentActionHandler { Uri contentUri = attachment.contentUri; InputStream in = mContext.getContentResolver().openInputStream(contentUri); OutputStream out = new FileOutputStream(file); - IOUtils.copy(in, out); + int size = IOUtils.copy(in, out); out.flush(); out.close(); in.close(); @@ -301,7 +301,7 @@ public class AttachmentActionHandler { (DownloadManager) mContext.getSystemService(Context.DOWNLOAD_SERVICE); dm.addCompletedDownload(attachment.getName(), attachment.getName(), false /* do not use media scanner */, - attachment.getContentType(), absolutePath, attachment.downloadedSize, + attachment.getContentType(), absolutePath, size, true /* show notification */); return file; |