Commit 00dda049 by gyumin Committed by Ian Baker

Fix FlagSet.equals on API levels below 24

#minor-release

PiperOrigin-RevId: 395004645
parent 9991f146
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
`ForwardingPlayer`. `ForwardingPlayer`.
* Remove `ExoPlayerLibraryInfo.GL_ASSERTIONS_ENABLED`. Use * Remove `ExoPlayerLibraryInfo.GL_ASSERTIONS_ENABLED`. Use
`GlUtil.glAssertionsEnabled` instead. `GlUtil.glAssertionsEnabled` instead.
* Fix `FlagSet#equals` on API levels below 24.
* Extractors: * Extractors:
* Support TS packets without PTS flag * Support TS packets without PTS flag
([#9294](https://github.com/google/ExoPlayer/issues/9294)). ([#9294](https://github.com/google/ExoPlayer/issues/9294)).
......
...@@ -211,11 +211,33 @@ public final class FlagSet { ...@@ -211,11 +211,33 @@ public final class FlagSet {
return false; return false;
} }
FlagSet that = (FlagSet) o; FlagSet that = (FlagSet) o;
if (Util.SDK_INT < 24) {
// SparseBooleanArray.equals() is not implemented on API levels below 24.
if (size() != that.size()) {
return false;
}
for (int i = 0; i < size(); i++) {
if (get(i) != that.get(i)) {
return false;
}
}
return true;
} else {
return flags.equals(that.flags); return flags.equals(that.flags);
} }
}
@Override @Override
public int hashCode() { public int hashCode() {
if (Util.SDK_INT < 24) {
// SparseBooleanArray.hashCode() is not implemented on API levels below 24.
int hashCode = size();
for (int i = 0; i < size(); i++) {
hashCode = 31 * hashCode + get(i);
}
return hashCode;
} else {
return flags.hashCode(); return flags.hashCode();
} }
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment