diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/content/ClipData.java | 30 | ||||
-rw-r--r-- | core/java/android/content/ClipDescription.java | 20 | ||||
-rw-r--r-- | core/java/android/content/Intent.java | 13 |
3 files changed, 52 insertions, 11 deletions
diff --git a/core/java/android/content/ClipData.java b/core/java/android/content/ClipData.java index 0cafff8..c934e8d 100644 --- a/core/java/android/content/ClipData.java +++ b/core/java/android/content/ClipData.java @@ -609,6 +609,23 @@ public class ClipData implements Parcelable { b.append("NULL"); } } + + /** @hide */ + public void toShortSummaryString(StringBuilder b) { + if (mHtmlText != null) { + b.append("HTML"); + } else if (mText != null) { + b.append("TEXT"); + } else if (mUri != null) { + b.append("U:"); + b.append(mUri); + } else if (mIntent != null) { + b.append("I:"); + mIntent.toShortString(b, true, true, true, true); + } else { + b.append("NULL"); + } + } } /** @@ -884,6 +901,19 @@ public class ClipData implements Parcelable { } } + /** @hide */ + public void toShortStringShortItems(StringBuilder b, boolean first) { + if (mItems.size() > 0) { + if (!first) { + b.append(' '); + } + mItems.get(0).toShortString(b); + if (mItems.size() > 1) { + b.append(" ..."); + } + } + } + @Override public int describeContents() { return 0; diff --git a/core/java/android/content/ClipDescription.java b/core/java/android/content/ClipDescription.java index be35f08..e988516 100644 --- a/core/java/android/content/ClipDescription.java +++ b/core/java/android/content/ClipDescription.java @@ -201,22 +201,28 @@ public class ClipDescription implements Parcelable { /** @hide */ public boolean toShortString(StringBuilder b) { - boolean first = true; - for (int i=0; i<mMimeTypes.length; i++) { + boolean first = !toShortStringTypesOnly(b); + if (mLabel != null) { if (!first) { b.append(' '); } first = false; - b.append(mMimeTypes[i]); + b.append('"'); + b.append(mLabel); + b.append('"'); } - if (mLabel != null) { + return !first; + } + + /** @hide */ + public boolean toShortStringTypesOnly(StringBuilder b) { + boolean first = true; + for (int i=0; i<mMimeTypes.length; i++) { if (!first) { b.append(' '); } first = false; - b.append('"'); - b.append(mLabel); - b.append('"'); + b.append(mMimeTypes[i]); } return !first; } diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index ec443cd..87d52e4 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -7533,14 +7533,19 @@ public class Intent implements Parcelable, Cloneable { if (!first) { b.append(' '); } - first = false; + b.append("clip={"); if (clip) { - b.append("clip={"); mClipData.toShortString(b); - b.append('}'); } else { - b.append("(has clip)"); + if (mClipData.getDescription() != null) { + first = !mClipData.getDescription().toShortStringTypesOnly(b); + } else { + first = true; + } + mClipData.toShortStringShortItems(b, first); } + first = false; + b.append('}'); } if (extras && mExtras != null) { if (!first) { |