Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa4e9dfd authored by Hao Ke's avatar Hao Ke
Browse files

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
parent cc09b29e
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -31513,7 +31513,7 @@ package android.os {
    method @Nullable public <T> T[] readParcelableArray(@Nullable ClassLoader, @NonNull Class<T>);
    method @Nullable public <T> T[] readParcelableArray(@Nullable ClassLoader, @NonNull Class<T>);
    method @Deprecated @Nullable public android.os.Parcelable.Creator<?> readParcelableCreator(@Nullable ClassLoader);
    method @Deprecated @Nullable public android.os.Parcelable.Creator<?> readParcelableCreator(@Nullable ClassLoader);
    method @Nullable public <T> android.os.Parcelable.Creator<T> readParcelableCreator(@Nullable ClassLoader, @NonNull Class<T>);
    method @Nullable public <T> android.os.Parcelable.Creator<T> readParcelableCreator(@Nullable ClassLoader, @NonNull Class<T>);
    method @NonNull public <T extends android.os.Parcelable> java.util.List<T> readParcelableList(@NonNull java.util.List<T>, @Nullable ClassLoader);
    method @Deprecated @NonNull public <T extends android.os.Parcelable> java.util.List<T> readParcelableList(@NonNull java.util.List<T>, @Nullable ClassLoader);
    method @NonNull public <T> java.util.List<T> readParcelableList(@NonNull java.util.List<T>, @Nullable ClassLoader, @NonNull Class<T>);
    method @NonNull public <T> java.util.List<T> readParcelableList(@NonNull java.util.List<T>, @Nullable ClassLoader, @NonNull Class<T>);
    method @Nullable public android.os.PersistableBundle readPersistableBundle();
    method @Nullable public android.os.PersistableBundle readPersistableBundle();
    method @Nullable public android.os.PersistableBundle readPersistableBundle(@Nullable ClassLoader);
    method @Nullable public android.os.PersistableBundle readPersistableBundle(@Nullable ClassLoader);
+7 −0
Original line number Original line Diff line number Diff line
@@ -3646,7 +3646,14 @@ public final class Parcel {
     * list was {@code null}, {@code list} is cleared.
     * list was {@code null}, {@code list} is cleared.
     *
     *
     * @see #writeParcelableList(List, int)
     * @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
    @NonNull
    public final <T extends Parcelable> List<T> readParcelableList(@NonNull List<T> list,
    public final <T extends Parcelable> List<T> readParcelableList(@NonNull List<T> list,
            @Nullable ClassLoader cl) {
            @Nullable ClassLoader cl) {