package android.support.v4.media.session;

import android.media.session.MediaSession.QueueItem;
import android.os.Build.VERSION;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import android.support.v4.media.MediaDescriptionCompat;
import java.util.ArrayList;
import java.util.List;

public final class MediaSessionCompat$QueueItem implements Parcelable {
    public static final Creator<MediaSessionCompat$QueueItem> CREATOR = new 1();
    private final MediaDescriptionCompat Ig;
    private final long JD;
    private Object JE;

    private MediaSessionCompat$QueueItem(Object obj, MediaDescriptionCompat mediaDescriptionCompat, long j) {
        if (mediaDescriptionCompat == null) {
            throw new IllegalArgumentException("Description cannot be null.");
        } else if (j == -1) {
            throw new IllegalArgumentException("Id cannot be QueueItem.UNKNOWN_ID");
        } else {
            this.Ig = mediaDescriptionCompat;
            this.JD = j;
            this.JE = obj;
        }
    }

    MediaSessionCompat$QueueItem(Parcel parcel) {
        this.Ig = (MediaDescriptionCompat) MediaDescriptionCompat.CREATOR.createFromParcel(parcel);
        this.JD = parcel.readLong();
    }

    public final void writeToParcel(Parcel parcel, int i) {
        this.Ig.writeToParcel(parcel, i);
        parcel.writeLong(this.JD);
    }

    public final int describeContents() {
        return 0;
    }

    public static List<MediaSessionCompat$QueueItem> m(List<?> list) {
        if (list == null || VERSION.SDK_INT < 21) {
            return null;
        }
        ArrayList arrayList = new ArrayList();
        for (Object next : list) {
            Object obj;
            if (next == null || VERSION.SDK_INT < 21) {
                obj = null;
            } else {
                obj = new MediaSessionCompat$QueueItem(next, MediaDescriptionCompat.v(((QueueItem) next).getDescription()), ((QueueItem) next).getQueueId());
            }
            arrayList.add(obj);
        }
        return arrayList;
    }

    public final String toString() {
        return "MediaSession.QueueItem {Description=" + this.Ig + ", Id=" + this.JD + " }";
    }
}
