From 8cff29b8ea88bc320544cb60c44c9bd0fa7a43b7 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Fri, 27 May 2022 18:33:52 +0900 Subject: [PATCH] Unhide Parcel.writeTypedList() with additional flag The flag should be propagated to Parcelable.writeToParcel(). But since it was hidden, we were not able to pass the flag to elements of the list. Bug: 215654054 Test: atest android.os.cts.ParcelTest Change-Id: I72d419caa74c62d979c5102ebd8eba4338ec3e3b --- core/api/current.txt | 1 + core/java/android/os/Parcel.java | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/core/api/current.txt b/core/api/current.txt index 2e0e6e571b87b..dc1949693802c 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -30355,6 +30355,7 @@ package android.os { method public void writeTypedArray(@Nullable T[], int); method public void writeTypedArrayMap(@Nullable android.util.ArrayMap, int); method public void writeTypedList(@Nullable java.util.List); + method public void writeTypedList(@Nullable java.util.List, int); method public void writeTypedObject(@Nullable T, int); method public void writeTypedSparseArray(@Nullable android.util.SparseArray, int); method public void writeValue(@Nullable Object); diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java index 08ab73b9dd923..dd81826359410 100644 --- a/core/java/android/os/Parcel.java +++ b/core/java/android/os/Parcel.java @@ -1990,7 +1990,20 @@ public final class Parcel { } /** - * @hide + * Flatten a List containing a particular object type into the parcel, at + * the current dataPosition() and growing dataCapacity() if needed. The + * type of the objects in the list must be one that implements Parcelable. + * Unlike the generic writeList() method, however, only the raw data of the + * objects is written and not their type, so you must use the corresponding + * readTypedList() to unmarshall them. + * + * @param val The list of objects to be written. + * @param parcelableFlags Contextual flags as per + * {@link Parcelable#writeToParcel(Parcel, int) Parcelable.writeToParcel()}. + * + * @see #createTypedArrayList + * @see #readTypedList + * @see Parcelable */ public void writeTypedList(@Nullable List val, int parcelableFlags) { if (val == null) {