diff options
author | Nicholas Ambur <nambur@google.com> | 2020-04-12 20:48:44 -0700 |
---|---|---|
committer | Nicholas Ambur <nambur@google.com> | 2020-05-18 10:11:02 -0700 |
commit | ba749f87d4f85e7d38ba78da7c6081277e72458f (patch) | |
tree | 7e3d9c6cd6bb5d0fefb9901410815419dbbc2299 | |
parent | e0a73b1bb6a9b7deef046cb21f3efd566ca8dc27 (diff) |
fix SoundTrigger.ModuleProperties equals
Bug: 152354427
Test: atest SoundTriggerTest
Change-Id: I715ecb51e78bcb45f4b3384c0551297289fe30f9
-rw-r--r-- | core/java/android/hardware/soundtrigger/SoundTrigger.java | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/core/java/android/hardware/soundtrigger/SoundTrigger.java b/core/java/android/hardware/soundtrigger/SoundTrigger.java index 4bed985489ef..f9ed2f851552 100644 --- a/core/java/android/hardware/soundtrigger/SoundTrigger.java +++ b/core/java/android/hardware/soundtrigger/SoundTrigger.java @@ -314,6 +314,92 @@ public class SoundTrigger { } @Override + public boolean equals(@Nullable Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof ModuleProperties)) { + return false; + } + ModuleProperties other = (ModuleProperties) obj; + if (mId != other.mId) { + return false; + } + if (!mImplementor.equals(other.mImplementor)) { + return false; + } + if (!mDescription.equals(other.mDescription)) { + return false; + } + if (!mUuid.equals(other.mUuid)) { + return false; + } + if (mVersion != other.mVersion) { + return false; + } + if (!mSupportedModelArch.equals(other.mSupportedModelArch)) { + return false; + } + if (mMaxSoundModels != other.mMaxSoundModels) { + return false; + } + if (mMaxKeyphrases != other.mMaxKeyphrases) { + return false; + } + if (mMaxUsers != other.mMaxUsers) { + return false; + } + if (mRecognitionModes != other.mRecognitionModes) { + return false; + } + if (mSupportsCaptureTransition != other.mSupportsCaptureTransition) { + return false; + } + if (mMaxBufferMillis != other.mMaxBufferMillis) { + return false; + } + if (mSupportsConcurrentCapture != other.mSupportsConcurrentCapture) { + return false; + } + if (mPowerConsumptionMw != other.mPowerConsumptionMw) { + return false; + } + if (mReturnsTriggerInEvent != other.mReturnsTriggerInEvent) { + return false; + } + if (mAudioCapabilities != other.mAudioCapabilities) { + return false; + } + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + mId; + result = prime * result + mImplementor.hashCode(); + result = prime * result + mDescription.hashCode(); + result = prime * result + mUuid.hashCode(); + result = prime * result + mVersion; + result = prime * result + mSupportedModelArch.hashCode(); + result = prime * result + mMaxSoundModels; + result = prime * result + mMaxKeyphrases; + result = prime * result + mMaxUsers; + result = prime * result + mRecognitionModes; + result = prime * result + (mSupportsCaptureTransition ? 1 : 0); + result = prime * result + mMaxBufferMillis; + result = prime * result + (mSupportsConcurrentCapture ? 1 : 0); + result = prime * result + mPowerConsumptionMw; + result = prime * result + (mReturnsTriggerInEvent ? 1 : 0); + result = prime * result + mAudioCapabilities; + return result; + } + + @Override public String toString() { return "ModuleProperties [id=" + getId() + ", implementor=" + getImplementor() + ", description=" + getDescription() + ", uuid=" + getUuid() |