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

Commit b82512bc authored by Jin Seok Park's avatar Jin Seok Park
Browse files

AML: Remove use of Bundle#setDefusable

Bundle#setDefusable no longer needs to be called since we are
removing the instance of unbundling MediaMetadata in
MediaSessionRecord.

Bug: 119789387
Test: mmm . (under frameworks/av/packages/MediaComponents)
Change-Id: If3cc95c06feaf61c187b4254a2cd7a601319210f
parent 980af763
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -422,9 +422,7 @@ public final class MediaMetadata implements Parcelable {
    }

    private MediaMetadata(Parcel in) {
        //TODO(b/119789387): Resolve hidden API usage: Bundle#setDefusable
        //mBundle = Bundle.setDefusable(in.readBundle(), true);
        mBundle = new Bundle();  //TODO:remove this.
        mBundle = in.readBundle();
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ interface ISession {
    void destroy();

    // These commands are for the TransportPerformer
    void setMetadata(in MediaMetadata metadata);
    void setMetadata(in MediaMetadata metadata, long duration, String metadataDescription);
    void setPlaybackState(in PlaybackState state);
    //TODO(b/119750807): Resolve hidden API usage ParceledListSlice.
    //void setQueue(in ParceledListSlice queue);
+12 −2
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.media.MediaDescription;
import android.media.MediaMetadata;
import android.media.Rating;
import android.media.VolumeProvider;
import android.media.session.MediaSessionManager.RemoteUserInfo;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
@@ -40,7 +41,6 @@ import android.os.Parcelable;
import android.os.RemoteException;
import android.os.ResultReceiver;
import android.os.UserHandle;
import android.media.session.MediaSessionManager.RemoteUserInfo;
import android.service.media.MediaBrowserService;
import android.text.TextUtils;
import android.util.Log;
@@ -439,11 +439,21 @@ public final class MediaSession {
     * @see android.media.MediaMetadata.Builder#putBitmap
     */
    public void setMetadata(@Nullable MediaMetadata metadata) {
        long duration = -1;
        int fields = 0;
        MediaDescription description = null;
        if (metadata != null) {
            metadata = (new MediaMetadata.Builder(metadata, mMaxBitmapSize)).build();
            if (metadata.containsKey(MediaMetadata.METADATA_KEY_DURATION)) {
                duration = metadata.getLong(MediaMetadata.METADATA_KEY_DURATION);
            }
            fields = metadata.size();
            description = metadata.getDescription();
        }
        String metadataDescription = "size=" + fields + ", description=" + description;

        try {
            mBinder.setMetadata(metadata);
            mBinder.setMetadata(metadata, duration, metadataDescription);
        } catch (RemoteException e) {
            Log.wtf(TAG, "Dead object in setPlaybackState.", e);
        }