diff options
author | Jessica Wagantall <jwagantall@cyngn.com> | 2016-04-05 12:31:42 -0700 |
---|---|---|
committer | Jessica Wagantall <jwagantall@cyngn.com> | 2016-04-05 12:31:42 -0700 |
commit | 15f55c2c3e6e83dda1de9c8ba363902875161f66 (patch) | |
tree | 66df277188a416694b5efb4ad46f53587ccb481d /src | |
parent | 3ae297540ae99c6f89aa34a266f65a09b0521ad5 (diff) | |
parent | 6ba21a0689ca3c2f697094d970cbab22c0e04fcc (diff) | |
download | android_packages_apps_UnifiedEmail-15f55c2c3e6e83dda1de9c8ba363902875161f66.tar.gz android_packages_apps_UnifiedEmail-15f55c2c3e6e83dda1de9c8ba363902875161f66.tar.bz2 android_packages_apps_UnifiedEmail-15f55c2c3e6e83dda1de9c8ba363902875161f66.zip |
Merge tag 'android-6.0.1_r24' into HEAD
Ticket: CYNGNOS-2213
Android 6.0.1 release 24
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/mail/compose/ComposeActivity.java | 40 |
1 files changed, 10 insertions, 30 deletions
diff --git a/src/com/android/mail/compose/ComposeActivity.java b/src/com/android/mail/compose/ComposeActivity.java index b7bab7546..36456bf03 100644 --- a/src/com/android/mail/compose/ComposeActivity.java +++ b/src/com/android/mail/compose/ComposeActivity.java @@ -191,6 +191,8 @@ public class ComposeActivity extends ActionBarActivity private static final String EXTRA_CC = "cc"; private static final String EXTRA_BCC = "bcc"; + public static final String ANALYTICS_CATEGORY_ERRORS = "compose_errors"; + /** * An optional extra containing a {@link ContentValues} of values to be added to * {@link SendOrSaveMessage#mValues}. @@ -275,9 +277,8 @@ public class ComposeActivity extends ActionBarActivity @VisibleForTesting public static final AtomicInteger PENDING_SEND_OR_SAVE_TASKS_NUM = new AtomicInteger(0); - // String representing the uri of the data directory (used for attachment uri checking). + /* Path of the data directory (used for attachment uri checking). */ private static final String DATA_DIRECTORY_ROOT; - private static final String ALTERNATE_DATA_DIRECTORY_ROOT; // Static initializations static { @@ -286,7 +287,6 @@ public class ComposeActivity extends ActionBarActivity SEND_SAVE_TASK_HANDLER = new Handler(handlerThread.getLooper()); DATA_DIRECTORY_ROOT = Environment.getDataDirectory().toString(); - ALTERNATE_DATA_DIRECTORY_ROOT = DATA_DIRECTORY_ROOT + DATA_DIRECTORY_ROOT; } private final Rect mRect = new Rect(); @@ -1143,7 +1143,8 @@ public class ComposeActivity extends ActionBarActivity TextUtils.isEmpty(htmlInPlainText)) { LogUtils.w(LOG_TAG, "FAILED HTML CONVERSION: from %d to %d", message.bodyText.length(), htmlInPlainText.length()); - Analytics.getInstance().sendEvent("errors", "failed_html_conversion", null, 0); + Analytics.getInstance().sendEvent(ANALYTICS_CATEGORY_ERRORS, + "failed_html_conversion", null, 0); message.bodyHtml = "<p>" + message.bodyText + "</p>"; } message.embedsExternalResources = false; @@ -1921,35 +1922,14 @@ public class ComposeActivity extends ActionBarActivity try { if (uri != null) { if ("file".equals(uri.getScheme())) { + // We must not allow files from /data, even from our process. final File f = new File(uri.getPath()); - // We should not be attaching any files from the data directory UNLESS - // the data directory is part of the calling process. final String filePath = f.getCanonicalPath(); if (filePath.startsWith(DATA_DIRECTORY_ROOT)) { - final String callingPackage = getCallingPackage(); - if (callingPackage == null) { - showErrorToast(getString(R.string.attachment_permission_denied)); - continue; - } - - // So it looks like the data directory are usually /data/data, but - // DATA_DIRECTORY_ROOT is only /data.. so let's check for both - final String pathWithoutRoot; - // We add 1 to the length for the additional / before the package name. - if (filePath.startsWith(ALTERNATE_DATA_DIRECTORY_ROOT)) { - pathWithoutRoot = filePath.substring( - ALTERNATE_DATA_DIRECTORY_ROOT.length() + 1); - } else { - pathWithoutRoot = filePath.substring( - DATA_DIRECTORY_ROOT.length() + 1); - } - - // If we are trying to access a data package that's not part of the - // calling package, show error toast and ignore this attachment. - if (!pathWithoutRoot.startsWith(callingPackage)) { - showErrorToast(getString(R.string.attachment_permission_denied)); - continue; - } + showErrorToast(getString(R.string.attachment_permission_denied)); + Analytics.getInstance().sendEvent(ANALYTICS_CATEGORY_ERRORS, + "send_intent_attachment", "data_dir", 0); + continue; } } if (!handleSpecialAttachmentUri(uri)) { |