diff options
author | Pavlin Radoslavov <pavlin@google.com> | 2017-02-24 10:19:14 -0800 |
---|---|---|
committer | Pavlin Radoslavov <pavlin@google.com> | 2017-03-29 10:58:48 -0700 |
commit | 6319d47c4fed4f35af17fb2e906e5d97c07b3bb6 (patch) | |
tree | 28388a6ecd6d4189afd46570d4aecfacc48fcdd6 /framework/java/android/bluetooth/BluetoothCodecConfig.java | |
parent | 1bafa47caf7b1f7584774ea7a479a21d1d79f197 (diff) |
Add new internal API: enableOptionalCodecs()/disableOptionalCodecs()
This API can be used to enable the optional codecs, or disable them
and use only the mandatory SBC.
Internally, it is implemented by raising the SBC priority to
highest (so SBC will be used/selected), or reducing the SBC priority
to its default value (lowest).
Test: A2DP streaming and enabling/disabling/selecting optional codecs
Bug: 35873828
Change-Id: Ia82036ac33590a3a402b1f5a36102264d47a9029
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothCodecConfig.java')
-rw-r--r-- | framework/java/android/bluetooth/BluetoothCodecConfig.java | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/framework/java/android/bluetooth/BluetoothCodecConfig.java b/framework/java/android/bluetooth/BluetoothCodecConfig.java index 176e48fb6e..d5e1429810 100644 --- a/framework/java/android/bluetooth/BluetoothCodecConfig.java +++ b/framework/java/android/bluetooth/BluetoothCodecConfig.java @@ -63,7 +63,7 @@ public final class BluetoothCodecConfig implements Parcelable { public static final int CHANNEL_MODE_STEREO = 0x1 << 1; private final int mCodecType; - private final int mCodecPriority; + private int mCodecPriority; private final int mSampleRate; private final int mBitsPerSample; private final int mChannelMode; @@ -280,6 +280,15 @@ public final class BluetoothCodecConfig implements Parcelable { } /** + * Checks whether the codec is mandatory. + * + * @return true if the codec is mandatory, otherwise false. + */ + public boolean isMandatoryCodec() { + return mCodecType == SOURCE_CODEC_TYPE_SBC; + } + + /** * Gets the codec selection priority. * The codec selection priority is relative to other codecs: larger value * means higher priority. If 0, reset to default. @@ -291,6 +300,17 @@ public final class BluetoothCodecConfig implements Parcelable { } /** + * Sets the codec selection priority. + * The codec selection priority is relative to other codecs: larger value + * means higher priority. If 0, reset to default. + * + * @param codecPriority the codec priority + */ + public void setCodecPriority(int codecPriority) { + mCodecPriority = codecPriority; + } + + /** * Gets the codec sample rate. The value can be a bitmask with all * supported sample rates: * {@link android.bluetooth.BluetoothCodecConfig#SAMPLE_RATE_NONE} or |