diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java index f2aea08a91ec1..8d035b738a725 100644 --- a/core/java/android/os/Parcel.java +++ b/core/java/android/os/Parcel.java @@ -61,12 +61,12 @@ import dalvik.system.VMRuntime; * appropriate to place any Parcel data in to persistent storage: changes * in the underlying implementation of any of the data in the Parcel can * render older data unreadable.
- * + * *The bulk of the Parcel API revolves around reading and writing data * of various types. There are six major classes of such functions available.
- * + * *The most basic data functions are for writing and reading primitive * data types: {@link #writeByte}, {@link #readByte}, {@link #writeDouble}, * {@link #readDouble}, {@link #writeFloat}, {@link #readFloat}, {@link #writeInt}, @@ -74,15 +74,15 @@ import dalvik.system.VMRuntime; * {@link #writeString}, {@link #readString}. Most other * data operations are built on top of these. The given data is written and * read using the endianess of the host CPU.
- * + * *There are a variety of methods for reading and writing raw arrays * of primitive objects, which generally result in writing a 4-byte length * followed by the primitive data items. The methods for reading can either * read the data into an existing array, or create and return a new array. * These available types are:
- * + * *The {@link Parcelable} protocol provides an extremely efficient (but * low-level) protocol for objects to write and read themselves from Parcels. * You can use the direct methods {@link #writeParcelable(Parcelable, int)} @@ -116,7 +116,7 @@ import dalvik.system.VMRuntime; * methods write both the class type and its data to the Parcel, allowing * that class to be reconstructed from the appropriate class loader when * later reading.
- * + * *There are also some methods that provide a more efficient way to work * with Parcelables: {@link #writeTypedObject}, {@link #writeTypedArray}, * {@link #writeTypedList}, {@link #readTypedObject}, @@ -129,9 +129,9 @@ import dalvik.system.VMRuntime; * call {@link Parcelable#writeToParcel Parcelable.writeToParcel} and * {@link Parcelable.Creator#createFromParcel Parcelable.Creator.createFromParcel} * yourself.)
- * + * *A special type-safe container, called {@link Bundle}, is available * for key/value maps of heterogeneous values. This has many optimizations * for improved performance when reading and writing data, and its type-safe @@ -139,16 +139,16 @@ import dalvik.system.VMRuntime; * data contents into a Parcel. The methods to use are * {@link #writeBundle(Bundle)}, {@link #readBundle()}, and * {@link #readBundle(ClassLoader)}. - * + * *
An unusual feature of Parcel is the ability to read and write active * objects. For these objects the actual contents of the object is not * written, rather a special token referencing the object is written. When * reading the object back from the Parcel, you do not get a new instance of * the object, but rather a handle that operates on the exact same object that * was originally written. There are two forms of active objects available.
- * + * *{@link Binder} objects are a core facility of Android's general cross-process * communication system. The {@link IBinder} interface describes an abstract * protocol with a Binder object. Any such interface can be written in to @@ -161,7 +161,7 @@ import dalvik.system.VMRuntime; * {@link #createBinderArray()}, * {@link #writeBinderList(List)}, {@link #readBinderList(List)}, * {@link #createBinderArrayList()}.
- * + * *FileDescriptor objects, representing raw Linux file descriptor identifiers, * can be written and {@link ParcelFileDescriptor} objects returned to operate * on the original file descriptor. The returned file descriptor is a dup @@ -169,9 +169,9 @@ import dalvik.system.VMRuntime; * operating on the same underlying file stream, with the same position, etc. * The methods to use are {@link #writeFileDescriptor(FileDescriptor)}, * {@link #readFileDescriptor()}. - * + * *
A final class of methods are for writing and reading standard Java * containers of arbitrary types. These all revolve around the * {@link #writeValue(Object)} and {@link #readValue(ClassLoader)} methods @@ -233,6 +233,7 @@ public final class Parcel { private static final int VAL_PERSISTABLEBUNDLE = 25; private static final int VAL_SIZE = 26; private static final int VAL_SIZEF = 27; + private static final int VAL_DOUBLEARRAY = 28; // The initial int32 in a Binder call's reply Parcel header: private static final int EX_SECURITY = -1; @@ -663,7 +664,7 @@ public final class Parcel { * growing dataCapacity() if needed. The Map keys must be String objects. * The Map values are written using {@link #writeValue} and must follow * the specification there. - * + * *
It is strongly recommended to use {@link #writeBundle} instead of * this method, since the Bundle class provides a type-safe API that * allows you to avoid mysterious type errors at the point of marshalling. @@ -1429,6 +1430,9 @@ public final class Parcel { } else if (v instanceof SizeF) { writeInt(VAL_SIZEF); writeSizeF((SizeF) v); + } else if (v instanceof double[]) { + writeInt(VAL_DOUBLEARRAY); + writeDoubleArray((double[]) v); } else { Class> clazz = v.getClass(); if (clazz.isArray() && clazz.getComponentType() == Object.class) { @@ -1504,7 +1508,7 @@ public final class Parcel { * exception will be re-thrown by this function as a RuntimeException * (to be caught by the system's last-resort exception handling when * dispatching a transaction). - * + * *
The supported exception types are: *