diff options
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java')
-rw-r--r-- | framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java | 26 |
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 |