Avoid parceling redundant ApplicationInfo objects within PackageInfo
Two benefits:
1) marshaling one flattened ApplicationInfo as part of a PackageInfo parcel
rather than one per included ComponentInfo; and
2) producing one ApplicationInfo at unmarshaling time and sharing the
reference to it among all included ComponentInfo instances, rather
than the previous implementation that generated a separate
ApplicationInfo instance for each ComponentInfo.
In some cases there can be many hundreds of ComponentInfo objects embedded
in a single PackageInfo, so coalescing duplicates is a significant win
for both payload size and object pressure.
Bug 19519502
Bug 20453802
Change-Id: Ib888810dad4471084fab9ead1ebb5e0b932905f1
diff --git a/core/java/android/os/Parcelable.java b/core/java/android/os/Parcelable.java
index 448b591..13b5de9 100644
--- a/core/java/android/os/Parcelable.java
+++ b/core/java/android/os/Parcelable.java
@@ -62,7 +62,17 @@
* may want to release resources at this point.
*/
public static final int PARCELABLE_WRITE_RETURN_VALUE = 0x0001;
-
+
+ /**
+ * Flag for use with {@link #writeToParcel}: a parent object will take
+ * care of managing duplicate state/data that is nominally replicated
+ * across its inner data members. This flag instructs the inner data
+ * types to omit that data during marshaling. Exact behavior may vary
+ * on a case by case basis.
+ * @hide
+ */
+ public static final int PARCELABLE_ELIDE_DUPLICATES = 0x0002;
+
/**
* Bit masks for use with {@link #describeContents}: each bit represents a
* kind of object considered to have potential special significance when