summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java
diff options
context:
space:
mode:
authorDeyao Ren <deyaoren@google.com>2022-03-07 19:26:56 +0000
committerDeyao Ren <deyaoren@google.com>2022-03-07 19:39:27 +0000
commita26bda4d37221f2f7ef750b413502091e3bcddd4 (patch)
tree3b525e14dd767931b5f004e6b694a83ced2dc28d /framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java
parent813ac5fee4ed39e947e041c9a161f60f9ace49b0 (diff)
parent260f34b984915be6f8bea511be1f0bbd22c933d9 (diff)
Merge TP1A.220209.001
Change-Id: Id0e2895d3220831d2c617a243047e8229af8acc9
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java')
-rw-r--r--framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java b/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java
index 8456259581..e3f691a66a 100644
--- a/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java
+++ b/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java
@@ -23,6 +23,7 @@ import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import java.util.Objects;
/**
* Represents the codec configuration for a Bluetooth LE Audio source device.
@@ -346,6 +347,31 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
return mOctetsPerFrame;
}
+ @Override
+ public boolean equals(@NonNull Object o) {
+ if (o instanceof BluetoothLeAudioCodecConfig) {
+ BluetoothLeAudioCodecConfig other = (BluetoothLeAudioCodecConfig) o;
+ return (other.getCodecType() == mCodecType
+ && other.getCodecPriority() == mCodecPriority
+ && other.getSampleRate() == mSampleRate
+ && other.getBitsPerSample() == mBitsPerSample
+ && other.getChannelMode() == mChannelMode
+ && other.getFrameDuration() == mFrameDuration
+ && other.getOctetsPerFrame() == mOctetsPerFrame);
+ }
+ return false;
+ }
+
+ /**
+ * Returns a hash representation of this BluetoothLeAudioCodecConfig
+ * based on all the config values.
+ */
+ @Override
+ public int hashCode() {
+ return Objects.hash(mCodecType, mCodecPriority, mSampleRate,
+ mBitsPerSample, mChannelMode, mFrameDuration, mOctetsPerFrame);
+ }
+
/**
* Builder for {@link BluetoothLeAudioCodecConfig}.
* <p> By default, the codec type will be set to