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

Commit 619503b2 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add equal overloads to some MediaDescription and MediaQueue objects (2/3)" into oc-mr1-dev

parents 30c565d3 6edb68be
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -219,6 +219,33 @@ public class MediaDescription implements Parcelable {
        dest.writeParcelable(mMediaUri, flags);
    }

    @Override
    public boolean equals(Object o) {
        if (o == null) {
            return false;
        }

        if (!(o instanceof MediaDescription)){
            return false;
        }

        final MediaDescription d = (MediaDescription) o;

        if (!String.valueOf(mTitle).equals(String.valueOf(d.mTitle))) {
            return false;
        }

        if (!String.valueOf(mSubtitle).equals(String.valueOf(d.mSubtitle))) {
            return false;
        }

        if (!String.valueOf(mDescription).equals(String.valueOf(d.mDescription))) {
            return false;
        }

        return true;
    }

    @Override
    public String toString() {
        return mTitle + ", " + mSubtitle + ", " + mDescription;
+23 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.ref.WeakReference;
import java.util.List;
import java.util.Objects;

/**
 * Allows interaction with media controllers, volume keys, media buttons, and
@@ -1291,6 +1292,28 @@ public final class MediaSession {
                    "Description=" + mDescription +
                    ", Id=" + mId + " }";
        }

        @Override
        public boolean equals(Object o) {
            if (o == null) {
                return false;
            }

            if (!(o instanceof QueueItem)) {
                return false;
            }

            final QueueItem item = (QueueItem) o;
            if (mId != item.mId) {
                return false;
            }

            if (!Objects.equals(mDescription, item.mDescription)) {
                return false;
            }

            return true;
        }
    }

    private static final class Command {