diff options
author | Jessica Wagantall <jwagantall@cyngn.com> | 2016-10-06 11:50:32 -0700 |
---|---|---|
committer | Jessica Wagantall <jwagantall@cyngn.com> | 2016-10-06 11:50:32 -0700 |
commit | de1a09698082225ae9af6515a6fd3f699ba3d573 (patch) | |
tree | 8fca5ad5a350db3858ef32380ee6e0a77db66768 | |
parent | 6e0da11acfb6e2ae99bacf7d6a6d78d1123f94d6 (diff) | |
parent | a549245b2f1e6510c6a87a1f381437bae30ee51b (diff) | |
download | android_packages_apps_Email-de1a09698082225ae9af6515a6fd3f699ba3d573.tar.gz android_packages_apps_Email-de1a09698082225ae9af6515a6fd3f699ba3d573.tar.bz2 android_packages_apps_Email-de1a09698082225ae9af6515a6fd3f699ba3d573.zip |
Merge tag 'android-6.0.1_r72' into HEAD
Android 6.0.1 Release 72 (M4B30X)
# gpg: Signature made Tue 04 Oct 2016 09:47:44 AM PDT using DSA key ID 9AB10E78
# gpg: Can't check signature: public key not found
-rw-r--r-- | provider_src/com/android/email/provider/AttachmentProvider.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/provider_src/com/android/email/provider/AttachmentProvider.java b/provider_src/com/android/email/provider/AttachmentProvider.java index c64fb4e4c..0abed9712 100644 --- a/provider_src/com/android/email/provider/AttachmentProvider.java +++ b/provider_src/com/android/email/provider/AttachmentProvider.java @@ -166,8 +166,8 @@ public class AttachmentProvider extends ContentProvider { long callingId = Binder.clearCallingIdentity(); try { List<String> segments = uri.getPathSegments(); - String accountId = segments.get(0); - String id = segments.get(1); + final long accountId = Long.parseLong(segments.get(0)); + final long id = Long.parseLong(segments.get(1)); String format = segments.get(2); if (AttachmentUtilities.FORMAT_THUMBNAIL.equals(format)) { int width = Integer.parseInt(segments.get(3)); @@ -176,8 +176,7 @@ public class AttachmentProvider extends ContentProvider { File dir = getContext().getCacheDir(); File file = new File(dir, filename); if (!file.exists()) { - Uri attachmentUri = AttachmentUtilities. - getAttachmentUri(Long.parseLong(accountId), Long.parseLong(id)); + Uri attachmentUri = AttachmentUtilities.getAttachmentUri(accountId, id); Cursor c = query(attachmentUri, new String[] { Columns.DATA }, null, null, null); if (c != null) { @@ -218,9 +217,14 @@ public class AttachmentProvider extends ContentProvider { } else { return ParcelFileDescriptor.open( - new File(getContext().getDatabasePath(accountId + ".db_att"), id), + new File(getContext().getDatabasePath(accountId + ".db_att"), + String.valueOf(id)), ParcelFileDescriptor.MODE_READ_ONLY); } + } catch (NumberFormatException e) { + LogUtils.e(Logging.LOG_TAG, + "AttachmentProvider.openFile: Failed to open as id is not a long"); + return null; } finally { Binder.restoreCallingIdentity(callingId); } |