Merge "Fix ClipData JavaDoc and behavior that contradicts JavaDoc" into nyc-dev am: 221c6e6db7
am: 423c902258
* commit '423c9022582b2ae9397a4fb52b0293b313c785cf':
Fix ClipData JavaDoc and behavior that contradicts JavaDoc
Change-Id: Ib6c6dc2770ff6332fbcb6285e871db971e54b066
This commit is contained in:
@@ -18,13 +18,11 @@ package android.content;
|
|||||||
|
|
||||||
import static android.content.ContentProvider.maybeAddUserId;
|
import static android.content.ContentProvider.maybeAddUserId;
|
||||||
|
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.content.res.AssetFileDescriptor;
|
import android.content.res.AssetFileDescriptor;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.os.Process;
|
|
||||||
import android.os.StrictMode;
|
import android.os.StrictMode;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.Spannable;
|
import android.text.Spannable;
|
||||||
@@ -742,20 +740,15 @@ public class ClipData implements Parcelable {
|
|||||||
if ("content".equals(uri.getScheme())) {
|
if ("content".equals(uri.getScheme())) {
|
||||||
String realType = resolver.getType(uri);
|
String realType = resolver.getType(uri);
|
||||||
mimeTypes = resolver.getStreamTypes(uri, "*/*");
|
mimeTypes = resolver.getStreamTypes(uri, "*/*");
|
||||||
if (mimeTypes == null) {
|
if (realType != null) {
|
||||||
if (realType != null) {
|
if (mimeTypes == null) {
|
||||||
mimeTypes = new String[] { realType, ClipDescription.MIMETYPE_TEXT_URILIST };
|
mimeTypes = new String[] { realType };
|
||||||
}
|
} else {
|
||||||
} else {
|
String[] tmp = new String[mimeTypes.length + 1];
|
||||||
String[] tmp = new String[mimeTypes.length + (realType != null ? 2 : 1)];
|
|
||||||
int i = 0;
|
|
||||||
if (realType != null) {
|
|
||||||
tmp[0] = realType;
|
tmp[0] = realType;
|
||||||
i++;
|
System.arraycopy(mimeTypes, 0, tmp, 1, mimeTypes.length);
|
||||||
|
mimeTypes = tmp;
|
||||||
}
|
}
|
||||||
System.arraycopy(mimeTypes, 0, tmp, i, mimeTypes.length);
|
|
||||||
tmp[i + mimeTypes.length] = ClipDescription.MIMETYPE_TEXT_URILIST;
|
|
||||||
mimeTypes = tmp;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mimeTypes == null) {
|
if (mimeTypes == null) {
|
||||||
@@ -790,6 +783,11 @@ public class ClipData implements Parcelable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new Item to the overall ClipData container.
|
* Add a new Item to the overall ClipData container.
|
||||||
|
* <p> This method will <em>not</em> update the list of available MIME types in the
|
||||||
|
* {@link ClipDescription}. It should be used only when adding items which do not add new
|
||||||
|
* MIME types to this clip. If this is not the case, {@link #ClipData(CharSequence, String[],
|
||||||
|
* Item)} should be used with a complete list of MIME types.
|
||||||
|
* @param item Item to be added.
|
||||||
*/
|
*/
|
||||||
public void addItem(Item item) {
|
public void addItem(Item item) {
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user