summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorBernardo Rufino <brufino@google.com>2021-12-09 11:17:09 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-12-09 11:17:09 +0000
commit017bfa357af58d430758aecb643725475bcdaa8d (patch)
tree9bbe654832ab2a3f7d0245571ed5785e6cdf0548 /core/java/android
parentfd779286da031c4d6b40ea2bb9b82b07aba7dd7d (diff)
parent91e53b04aa16a2ee16e1f67693d3b959387f7469 (diff)
Merge "Deprecate unsafe Parcel.readParcelableArray(ClassLoader)" am: 2ee662c767 am: 91e53b04aa
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1910046 Change-Id: Id17598162b99da239a2a68dfcc338b036c3a8a31
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/os/Parcel.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java
index 8894c85fa7b4..4d5f97c59907 100644
--- a/core/java/android/os/Parcel.java
+++ b/core/java/android/os/Parcel.java
@@ -4388,9 +4388,16 @@ public final class Parcel {
* The given class loader will be used to load any enclosed
* Parcelables.
* @return the Parcelable array, or null if the array is null
+ *
+ * @deprecated Use the type-safer version {@link #readParcelableArray(ClassLoader, Class)}
+ * starting from Android {@link Build.VERSION_CODES#TIRAMISU}. Also consider changing the
+ * format to use {@link #createTypedArray(Parcelable.Creator)} if possible (eg. if the
+ * items' class is final) since this is also more performant. Note that changing to the
+ * latter also requires changing the writes.
*/
+ @Deprecated
@Nullable
- public final Parcelable[] readParcelableArray(@Nullable ClassLoader loader) {
+ public Parcelable[] readParcelableArray(@Nullable ClassLoader loader) {
int N = readInt();
if (N < 0) {
return null;