Implement CodecProfileLevel.{equals|hashCode}
Bug: 74435947
Test: atest CtsMediaTestCases:MediaCodecListTest
Change-Id: Ia77182538c5a151bb561f7d273f7cbaa29671a4c
diff --git a/media/java/android/media/MediaCodecInfo.java b/media/java/android/media/MediaCodecInfo.java
index 44d9099..e6a8d01 100644
--- a/media/java/android/media/MediaCodecInfo.java
+++ b/media/java/android/media/MediaCodecInfo.java
@@ -3078,6 +3078,23 @@
* {@link VideoCapabilities} to determine the codec capabilities.
*/
public int level;
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (obj instanceof CodecProfileLevel) {
+ CodecProfileLevel other = (CodecProfileLevel)obj;
+ return other.profile == profile && other.level == level;
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return Long.hashCode(((long)profile << Integer.SIZE) | level);
+ }
};
/**