[automerger] Disallow attaching files from our own EmailAttachmentProvider. am: 44a5db2dc0 am: ec59cd4c39 am: 7764908d8d am: 29f9af1b0a am: 1f74cbabba am: 9a7c825a34

Change-Id: Ia184943b340ad14666ec454cae52c0d87cfd8c84
diff --git a/src/com/android/mail/compose/ComposeActivity.java b/src/com/android/mail/compose/ComposeActivity.java
index 5f125ab..489f6d8 100644
--- a/src/com/android/mail/compose/ComposeActivity.java
+++ b/src/com/android/mail/compose/ComposeActivity.java
@@ -1922,6 +1922,15 @@
     }
 
     /**
+     * @return the authority of EmailAttachmentProvider for this app. should be overridden in
+     * concrete app implementations. can't be known here because this project doesn't know about
+     * that sort of thing.
+     */
+    protected String getEmailAttachmentProviderAuthority() {
+        throw new UnsupportedOperationException("unimplemented, EmailAttachmentProvider unknown");
+    }
+
+    /**
      * Helper function to handle a list of uris to attach.
      * @return the total size of all successfully attached files.
      */
@@ -1942,7 +1951,9 @@
                         }
                     } else if (ContentResolver.SCHEME_CONTENT.equals(uri.getScheme())) {
                         // disallow attachments from our own EmailProvider (b/27308057)
-                        if (getEmailProviderAuthority().equals(uri.getAuthority())) {
+                        if (getEmailProviderAuthority().equals(uri.getAuthority())
+                                || getEmailAttachmentProviderAuthority().equals(
+                                        uri.getAuthority())) {
                             showErrorToast(getString(R.string.attachment_permission_denied));
                             Analytics.getInstance().sendEvent(ANALYTICS_CATEGORY_ERRORS,
                                     "send_intent_attachment", "email_provider", 0);