diff --git a/core/java/android/os/Bundle.java b/core/java/android/os/Bundle.java index f215325f6be22..92eb7a5d047ef 100644 --- a/core/java/android/os/Bundle.java +++ b/core/java/android/os/Bundle.java @@ -33,6 +33,9 @@ import java.util.List; /** * A mapping from String keys to various {@link Parcelable} values. * + *
Warning: Note that {@link Bundle} is a lazy container and as such it does NOT implement + * {@link #equals(Object)} or {@link #hashCode()}. + * * @see PersistableBundle */ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { @@ -1230,6 +1233,10 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable { maybePrefillHasFds(); } + /** + * Returns a string representation of the {@link Bundle} that may be suitable for debugging. It + * won't print the internal map if its content hasn't been unparcelled. + */ @Override public synchronized String toString() { if (mParcelledData != null) { diff --git a/core/java/android/os/PersistableBundle.java b/core/java/android/os/PersistableBundle.java index 76b88a3399d87..7b55e710caeb3 100644 --- a/core/java/android/os/PersistableBundle.java +++ b/core/java/android/os/PersistableBundle.java @@ -43,6 +43,9 @@ import java.util.ArrayList; * supported by this class is purposefully restricted to simple objects that can * safely be persisted to and restored from disk. * + *
Warning: Note that {@link PersistableBundle} is a lazy container and as such it does + * NOT implement {@link #equals(Object)} or {@link #hashCode()}. + * * @see Bundle */ public final class PersistableBundle extends BaseBundle implements Cloneable, Parcelable, @@ -324,8 +327,12 @@ public final class PersistableBundle extends BaseBundle implements Cloneable, Pa return new PersistableBundle(); // An empty mutable PersistableBundle } + /** + * Returns a string representation of the {@link PersistableBundle} that may be suitable for + * debugging. It won't print the internal map if its content hasn't been unparcelled. + */ @Override - synchronized public String toString() { + public synchronized String toString() { if (mParcelledData != null) { if (isEmptyParcel()) { return "PersistableBundle[EMPTY_PARCEL]";