Use Arrays.equals when comparing arrays.

Objects.equals uses reference equality, we actually want the equality of
the contents.

Bug: 217923092
Test: errorprone build
Change-Id: Idd9f515c23c6fa322b1e24101a390923993bc3dc
This commit is contained in:
Michael Wright
2022-02-04 21:05:45 +00:00
parent 573d22a90c
commit 3cc84d0caa
3 changed files with 3 additions and 2 deletions

View File

@@ -23,6 +23,7 @@ java_defaults {
"-Xep:FormatString:ERROR",
"-Xep:ArrayHashCode:ERROR",
"-Xep:SelfAssignment:ERROR",
"-Xep:ArrayEquals:ERROR",
// NOTE: only enable to generate local patchfiles
// "-XepPatchChecks:refaster:frameworks/base/errorprone/refaster/EfficientXml.java.refaster",
// "-XepPatchLocation:/tmp/refaster/",

View File

@@ -418,7 +418,7 @@ final class DisplayDeviceInfo {
|| !Objects.equals(deviceProductInfo, other.deviceProductInfo)
|| ownerUid != other.ownerUid
|| !Objects.equals(ownerPackageName, other.ownerPackageName)
|| !Objects.equals(frameRateOverrides, other.frameRateOverrides)
|| !Arrays.equals(frameRateOverrides, other.frameRateOverrides)
|| !BrightnessSynchronizer.floatEquals(brightnessMinimum, other.brightnessMinimum)
|| !BrightnessSynchronizer.floatEquals(brightnessMaximum, other.brightnessMaximum)
|| !BrightnessSynchronizer.floatEquals(brightnessDefault,

View File

@@ -997,7 +997,7 @@ final class LocalDisplayAdapter extends DisplayAdapter {
public boolean updateFrameRateOverridesLocked(
DisplayEventReceiver.FrameRateOverride[] overrides) {
if (overrides.equals(mFrameRateOverrides)) {
if (Arrays.equals(overrides, mFrameRateOverrides)) {
return false;
}