diff options
author | Patty <plhuang@google.com> | 2022-01-25 19:58:37 +0800 |
---|---|---|
committer | Jack He <siyuanh@google.com> | 2022-02-02 15:17:34 -0800 |
commit | 5aa4bd22ff59c9a3910fc60e6f4876b8bbad571d (patch) | |
tree | f89851acb542ccaf05f1295246b982de97a6d0af /framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java | |
parent | 14c9fcd9e9047314c8ea7d95fe9cf8cc087c1447 (diff) |
Add API to set the codec preference for specific device
Add the APIs that would use in developer optin for setting
the codec config preference and getiting the codec status.
Expose the APIs first, some of the implementations
will be done later.
Add equals function to BluetoothLeAudioCodecConfig for
comparison usage
Tag: #feature
Bug: 216276721
Bug: 150670922
Test: atest BluetoothInstrumentationTests
Change-Id: Iaa9b7b1278f06228b7a22a1c61668b879b6f3dc9
Merged-In: Iaa9b7b1278f06228b7a22a1c61668b879b6f3dc9
(cherry picked from commit 7cf686a443eb2a1d036ba89c874a328fa24bb425)
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 |