Add hashCode method to BrightnessReason
It implements equals, so it almost certainly should implement hashCode. Bug: 217923092 Test: manual Change-Id: I6acaea66d97231bd515df8128a7abd4aa067d599
This commit is contained in:
@@ -75,6 +75,7 @@ import com.android.server.display.whitebalance.DisplayWhiteBalanceSettings;
|
||||
import com.android.server.policy.WindowManagerPolicy;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Controls the power state of the display.
|
||||
@@ -2824,13 +2825,18 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null || !(obj instanceof BrightnessReason)) {
|
||||
if (!(obj instanceof BrightnessReason)) {
|
||||
return false;
|
||||
}
|
||||
BrightnessReason other = (BrightnessReason) obj;
|
||||
return other.reason == reason && other.modifier == modifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(reason, modifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return toString(0);
|
||||
|
||||
Reference in New Issue
Block a user