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

Commit b4dbc2d4 authored by Hyundo Moon's avatar Hyundo Moon
Browse files

Replace hidden Parcel.(read|write)CharSequence usages

This CL replaces above hidden API usages with below:
 - read: TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel
 - write: TextUtils.writeToParcel

The hidden APIs actually call those replacements, so this is safe to do.

Bug: 119783509
Test: mmm . (under frameworks/av/packages/MediaComponents)
Change-Id: Ifb3b432bee7ee072bbd544cb067749f073e5917a
parent c9f262d6
Loading
Loading
Loading
Loading
+7 −10
Original line number Original line Diff line number Diff line
@@ -7,6 +7,7 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable;
import android.text.TextUtils;


/**
/**
 * A simple set of metadata for a media item suitable for display. This can be
 * A simple set of metadata for a media item suitable for display. This can be
@@ -122,10 +123,9 @@ public class MediaDescription implements Parcelable {


    private MediaDescription(Parcel in) {
    private MediaDescription(Parcel in) {
        mMediaId = in.readString();
        mMediaId = in.readString();
        //TODO(b/119783509): Resolve hidden API Usage. Parcel#{read,write}CharSequence
        mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
        mTitle = "";  //in.readCharSequence();
        mSubtitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
        mSubtitle = "";  //in.readCharSequence();
        mDescription = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
        mDescription = "";  //in.readCharSequence();
        mIcon = in.readParcelable(null);
        mIcon = in.readParcelable(null);
        mIconUri = in.readParcelable(null);
        mIconUri = in.readParcelable(null);
        mExtras = in.readBundle();
        mExtras = in.readBundle();
@@ -211,12 +211,9 @@ public class MediaDescription implements Parcelable {
    @Override
    @Override
    public void writeToParcel(Parcel dest, int flags) {
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(mMediaId);
        dest.writeString(mMediaId);
        //TODO(b/119783509): Resolve hidden API Usage. Parcel#{read,write}CharSequence
        TextUtils.writeToParcel(mTitle, dest, 0);
        /*
        TextUtils.writeToParcel(mSubtitle, dest, 0);
        dest.writeCharSequence(mTitle);
        TextUtils.writeToParcel(mDescription, dest, 0);
        dest.writeCharSequence(mSubtitle);
        dest.writeCharSequence(mDescription);
        */
        dest.writeParcelable(mIcon, flags);
        dest.writeParcelable(mIcon, flags);
        dest.writeParcelable(mIconUri, flags);
        dest.writeParcelable(mIconUri, flags);
        dest.writeBundle(mExtras);
        dest.writeBundle(mExtras);
+2 −5
Original line number Original line Diff line number Diff line
@@ -318,9 +318,7 @@ public final class PlaybackState implements Parcelable {
        mActions = in.readLong();
        mActions = in.readLong();
        mCustomActions = in.createTypedArrayList(CustomAction.CREATOR);
        mCustomActions = in.createTypedArrayList(CustomAction.CREATOR);
        mActiveItemId = in.readLong();
        mActiveItemId = in.readLong();
        //TODO(b/119783509): Resolve hidden API Usage. Parcel#{read,write}CharSequence
        mErrorMessage = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
        //mErrorMessage = in.readCharSequence();
        mErrorMessage = "";  //TODO: remove this.
        mExtras = in.readBundle();
        mExtras = in.readBundle();
    }
    }


@@ -355,8 +353,7 @@ public final class PlaybackState implements Parcelable {
        dest.writeLong(mActions);
        dest.writeLong(mActions);
        dest.writeTypedList(mCustomActions);
        dest.writeTypedList(mCustomActions);
        dest.writeLong(mActiveItemId);
        dest.writeLong(mActiveItemId);
        //TODO(b/119783509): Resolve hidden API Usage. Parcel#{read,write}CharSequence
        TextUtils.writeToParcel(mErrorMessage, dest, 0);
        //dest.writeCharSequence(mErrorMessage);
        dest.writeBundle(mExtras);
        dest.writeBundle(mExtras);
    }
    }