Per spec, allow all attachments to be added via INTENT.
* Change manifest intent-filter to */* * Split incoming whitelist into send_ui and send_intent versions Bugs: 2097457 (general) & 2138790 (.vcf) Change-Id: Id4a2bb3a75808811578c643a7b841de9491efce4
This commit is contained in:
parent
e6a8d98e9e
commit
92a1ff9b77
|
@ -162,9 +162,7 @@
|
|||
</intent-filter>
|
||||
<intent-filter android:label="@string/app_name">
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
<data android:mimeType="text/plain" />
|
||||
<data android:mimeType="image/*" />
|
||||
<data android:mimeType="video/*" />
|
||||
<data android:mimeType="*/*" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter android:label="@string/app_name">
|
||||
|
|
|
@ -67,15 +67,21 @@ public class Email extends Application {
|
|||
public static final boolean LOGD = false;
|
||||
|
||||
/**
|
||||
* The MIME type(s) of attachments we're willing to send. At the moment it is not possible
|
||||
* to open a chooser with a list of filter types, so the chooser is only opened with the first
|
||||
* item in the list. The entire list will be used to filter down attachments that are added
|
||||
* with Intent.ACTION_SEND.
|
||||
* The MIME type(s) of attachments we're willing to send via attachments.
|
||||
*
|
||||
* TODO: It should be legal to send anything requested by another app. This would provide
|
||||
* parity with Gmail's behavior.
|
||||
* Any attachments may be added via Intents with Intent.ACTION_SEND or ACTION_SEND_MULTIPLE.
|
||||
*/
|
||||
public static final String[] ACCEPTABLE_ATTACHMENT_SEND_TYPES = new String[] {
|
||||
public static final String[] ACCEPTABLE_ATTACHMENT_SEND_INTENT_TYPES = new String[] {
|
||||
"*/*",
|
||||
};
|
||||
|
||||
/**
|
||||
* The MIME type(s) of attachments we're willing to send from the internal UI.
|
||||
*
|
||||
* NOTE: At the moment it is not possible to open a chooser with a list of filter types, so
|
||||
* the chooser is only opened with the first item in the list.
|
||||
*/
|
||||
public static final String[] ACCEPTABLE_ATTACHMENT_SEND_UI_TYPES = new String[] {
|
||||
"image/*",
|
||||
"video/*",
|
||||
};
|
||||
|
|
|
@ -884,7 +884,7 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
|
|||
private void onAddAttachment() {
|
||||
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
i.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
i.setType(Email.ACCEPTABLE_ATTACHMENT_SEND_TYPES[0]);
|
||||
i.setType(Email.ACCEPTABLE_ATTACHMENT_SEND_UI_TYPES[0]);
|
||||
startActivityForResult(
|
||||
Intent.createChooser(i, getString(R.string.choose_attachment_dialog_title)),
|
||||
ACTIVITY_REQUEST_PICK_ATTACHMENT);
|
||||
|
@ -1110,7 +1110,8 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
|
|||
String type = intent.getType();
|
||||
Uri stream = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
||||
if (stream != null && type != null) {
|
||||
if (MimeUtility.mimeTypeMatches(type, Email.ACCEPTABLE_ATTACHMENT_SEND_TYPES)) {
|
||||
if (MimeUtility.mimeTypeMatches(type,
|
||||
Email.ACCEPTABLE_ATTACHMENT_SEND_INTENT_TYPES)) {
|
||||
addAttachment(stream);
|
||||
}
|
||||
}
|
||||
|
@ -1124,8 +1125,8 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
|
|||
Uri uri = (Uri) parcelable;
|
||||
if (uri != null) {
|
||||
Attachment attachment = loadAttachmentInfo(uri);
|
||||
if (MimeUtility.mimeTypeMatches(attachment.mMimeType,
|
||||
Email.ACCEPTABLE_ATTACHMENT_SEND_TYPES)) {
|
||||
if (MimeUtility.mimeTypeMatches(attachment.mMimeType,
|
||||
Email.ACCEPTABLE_ATTACHMENT_SEND_INTENT_TYPES)) {
|
||||
addAttachment(attachment);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue