diff options
author | Ekin Oguz <ekinoguz@google.com> | 2016-11-28 15:34:02 -0800 |
---|---|---|
committer | Brinly Taylor <brinly@brinly.me> | 2017-03-13 04:51:22 +0000 |
commit | c37317867473d48f0f862a8d2c31afff98f36230 (patch) | |
tree | a141dd7af50bb19cfd9d4e4c128447a68051dcb0 /src | |
parent | df24ac21e4b3163f5d21b3801791b0184905fd94 (diff) | |
download | android_packages_apps_UnifiedEmail-c37317867473d48f0f862a8d2c31afff98f36230.tar.gz android_packages_apps_UnifiedEmail-c37317867473d48f0f862a8d2c31afff98f36230.tar.bz2 android_packages_apps_UnifiedEmail-c37317867473d48f0f862a8d2c31afff98f36230.zip |
Don't allow file attachment from /data through GET_CONTENT.
A custom picker can be used to attach files to Compose activity. With
this change, we are disallowing files belonging to file:///data/... to
be attached from custom pickers, in order not to expose internal
application data.
If the Intent Uri is a "file" and the file is in
`Environment.getDataDirectory()`, then throw a
AttachmentFailureException
which is caught immediately and shows a toast to the user.
Details b/31494146#comment13
Fix b/32615212
Change-Id: I037888b01fef1cdf5053602cdf9194286d5648df
(cherry picked from commit eace8b43e8d1512a205554715ca840324bfbe35f)
(cherry picked from commit 1de59f75ce361d86ada269a3bc5bf9078f1fd6d0)
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/mail/compose/ComposeActivity.java | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/com/android/mail/compose/ComposeActivity.java b/src/com/android/mail/compose/ComposeActivity.java index 2dfac99b9..5f125abe6 100644 --- a/src/com/android/mail/compose/ComposeActivity.java +++ b/src/com/android/mail/compose/ComposeActivity.java @@ -2018,19 +2018,15 @@ public class ComposeActivity extends ActionBarActivity if (contentUri == null) { return; } - try { - if (handleSpecialAttachmentUri(contentUri)) { - return; - } + if (handleSpecialAttachmentUri(contentUri)) { + return; + } - addAttachmentAndUpdateView(mAttachmentsView.generateLocalAttachment(contentUri)); - } catch (AttachmentFailureException e) { - LogUtils.e(LOG_TAG, e, "Error adding attachment"); - showErrorToast(getResources().getString( - e.getErrorRes(), - AttachmentUtils.convertToHumanReadableSize( - getApplicationContext(), mAccount.settings.getMaxAttachmentSize()))); + final long size = handleAttachmentUrisFromIntent(Arrays.asList(contentUri)); + if (size > 0) { + mAttachmentsChanged = true; + updateSaveUi(); } } |