Actually compare supported color modes.
Also, provide an equals implemenation for HdrCapabilities.
Bug: 30311415
Bug: 30367543
Change-Id: Ib8b9c9283519ae9baa48ecfecb8035848a9b29f0
diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java
index 899ae49..85a4bf9 100644
--- a/core/java/android/view/Display.java
+++ b/core/java/android/view/Display.java
@@ -1227,6 +1227,33 @@
return mMinLuminance;
}
+ @Override
+ public boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ }
+
+ if (!(other instanceof HdrCapabilities)) {
+ return false;
+ }
+ HdrCapabilities that = (HdrCapabilities) other;
+
+ return Arrays.equals(mSupportedHdrTypes, that.mSupportedHdrTypes)
+ && mMaxLuminance == that.mMaxLuminance
+ && mMaxAverageLuminance == that.mMaxAverageLuminance
+ && mMinLuminance == that.mMinLuminance;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 23;
+ hash = hash * 17 + Arrays.hashCode(mSupportedHdrTypes);
+ hash = hash * 17 + Float.floatToIntBits(mMaxLuminance);
+ hash = hash * 17 + Float.floatToIntBits(mMaxAverageLuminance);
+ hash = hash * 17 + Float.floatToIntBits(mMinLuminance);
+ return hash;
+ }
+
public static final Creator<HdrCapabilities> CREATOR = new Creator<HdrCapabilities>() {
@Override
public HdrCapabilities createFromParcel(Parcel source) {
diff --git a/core/java/android/view/DisplayInfo.java b/core/java/android/view/DisplayInfo.java
index 49c3c46..bc40849 100644
--- a/core/java/android/view/DisplayInfo.java
+++ b/core/java/android/view/DisplayInfo.java
@@ -289,7 +289,7 @@
&& modeId == other.modeId
&& defaultModeId == other.defaultModeId
&& colorMode == other.colorMode
- && Objects.equal(supportedColorModes, other.supportedColorModes)
+ && Arrays.equals(supportedColorModes, other.supportedColorModes)
&& Objects.equal(hdrCapabilities, other.hdrCapabilities)
&& logicalDensityDpi == other.logicalDensityDpi
&& physicalXDpi == other.physicalXDpi