summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tomasz Wasilczyk <twasilczyk@google.com> 2018-04-19 14:04:08 -0700
committer Tomasz Wasilczyk <twasilczyk@google.com> 2018-04-19 14:23:54 -0700
commit71791f95c6f2fd1f06e174ce7ca6cc0b58ea3f9d (patch)
treed555d1375cd1100aa686fc5eaf66a4eb86dee192
parentd688e7b15dd3ee56da34b146ba5ee0271a2cb6cb (diff)
Don't check program selector's type for equality.
As the comments of the whole class says, primary ID is the field used for checking for equality of the selectors. Current implementation also checks program type, which is a deprecated field that can be inferred from primary ID. Test: open car.Media, add AM station to favorites Bug: 78296701 Change-Id: I0423f831c2fdca2d1d126ed8a3b8fe40f28022ac
-rw-r--r--core/java/android/hardware/radio/ProgramSelector.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/java/android/hardware/radio/ProgramSelector.java b/core/java/android/hardware/radio/ProgramSelector.java
index 435bcb020a91..90d407ca3a96 100644
--- a/core/java/android/hardware/radio/ProgramSelector.java
+++ b/core/java/android/hardware/radio/ProgramSelector.java
@@ -498,7 +498,7 @@ public final class ProgramSelector implements Parcelable {
@Override
public int hashCode() {
// secondaryIds and vendorIds are ignored for equality/hashing
- return Objects.hash(mProgramType, mPrimaryId);
+ return mPrimaryId.hashCode();
}
@Override
@@ -507,7 +507,8 @@ public final class ProgramSelector implements Parcelable {
if (!(obj instanceof ProgramSelector)) return false;
ProgramSelector other = (ProgramSelector) obj;
// secondaryIds and vendorIds are ignored for equality/hashing
- return other.getProgramType() == mProgramType && mPrimaryId.equals(other.getPrimaryId());
+ // programType can be inferred from primaryId, thus not checked
+ return mPrimaryId.equals(other.getPrimaryId());
}
private ProgramSelector(Parcel in) {