Use TrackGroup.equals when determining equality of BaseTrackSelection

PiperOrigin-RevId: 558150684
This commit is contained in:
tianyifeng 2023-08-18 16:16:38 +01:00 committed by Julia Bibik
parent 271bf7a56e
commit 7f1ee0b390

View File

@ -201,9 +201,7 @@ public abstract class BaseTrackSelection implements ExoTrackSelection {
return hashCode; return hashCode;
} }
// Track groups are compared by identity not value, as distinct groups may have the same value.
@Override @Override
@SuppressWarnings({"ReferenceEquality", "EqualsGetClass"})
public boolean equals(@Nullable Object obj) { public boolean equals(@Nullable Object obj) {
if (this == obj) { if (this == obj) {
return true; return true;
@ -212,6 +210,6 @@ public abstract class BaseTrackSelection implements ExoTrackSelection {
return false; return false;
} }
BaseTrackSelection other = (BaseTrackSelection) obj; BaseTrackSelection other = (BaseTrackSelection) obj;
return group == other.group && Arrays.equals(tracks, other.tracks); return group.equals(other.group) && Arrays.equals(tracks, other.tracks);
} }
} }