diff options
| author | Hao Ke <haok@google.com> | 2021-12-02 15:39:44 +0000 |
|---|---|---|
| committer | Hao Ke <haok@google.com> | 2021-12-02 15:43:40 +0000 |
| commit | aa4e9dfda8174d604244a0aed408040d1adbf62c (patch) | |
| tree | 5b9f35f4baa871d31245b10472881aab7813b8a3 /core/java/android/os/Parcel.java | |
| parent | cc09b29e599b0bf965ec1c75ee4d9cee36c21aa0 (diff) | |
Deprecate unsafe readParcelableList API.
Deprecate unsafe parcel APIs and point to the safer ones that take the
expected type as parameter. Also mentioned the typed ones
that take the creator as argument since those are also more performant.
Test: Builds
Bug: 195622897
Bug: 199275680
Bug: 205985058
Change-Id: I77a1a925d8759fd122936780587e3488705d4c56
Diffstat (limited to 'core/java/android/os/Parcel.java')
| -rw-r--r-- | core/java/android/os/Parcel.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java index afd0ff747b93..36645155a472 100644 --- a/core/java/android/os/Parcel.java +++ b/core/java/android/os/Parcel.java @@ -3646,7 +3646,14 @@ public final class Parcel { * list was {@code null}, {@code list} is cleared. * * @see #writeParcelableList(List, int) + * + * @deprecated Use the type-safer version {@link #readParcelableList(List, ClassLoader, Class)} + * starting from Android {@link Build.VERSION_CODES#TIRAMISU}. Also consider changing the + * format to use {@link #readTypedList(List, 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 @NonNull public final <T extends Parcelable> List<T> readParcelableList(@NonNull List<T> list, @Nullable ClassLoader cl) { |
