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

Commit fe3e10de authored by Jean-Michel Trivi's avatar Jean-Michel Trivi Committed by Android (Google) Code Review
Browse files

Merge "AudioAttributes: implement hashcode and equals methods" into lmp-dev

parents c19f8549 e9c19a5a
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import java.lang.annotation.RetentionPolicy;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Objects;
import java.util.Set;

/**
@@ -526,7 +527,26 @@ public final class AudioAttributes implements Parcelable {
        }
    };

    /** @hide */
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AudioAttributes that = (AudioAttributes) o;

        return ((mContentType == that.mContentType)
                && (mFlags == that.mFlags)
                && (mSource == that.mSource)
                && (mUsage == that.mUsage)
                //mFormattedTags is never null due to assignment in Builder or unmarshalling
                && (mFormattedTags.equals(that.mFormattedTags)));
    }

    @Override
    public int hashCode() {
        return Objects.hash(mContentType, mFlags, mSource, mUsage, mFormattedTags);
    }

    @Override
    public String toString () {
        return new String("AudioAttributes:"