summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java
diff options
context:
space:
mode:
authorSatheesh Kumar Pallemoni <quic_spallemo@quicinc.com>2022-04-29 19:48:17 +0530
committerSatish Kumar Kodishala <quic_skodisha@quicinc.com>2022-05-10 22:17:53 +0530
commit714d4f9ec1dbca90e7094f0ab50c678dcdd2e11f (patch)
tree522043fe5c0385efc34b5b6ee87b2ffee59ea2d2 /framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java
parentf457d2c55bb2242df7f23935e30d6c1715dd06f8 (diff)
BT: Adding CS params and new entires in BT framework.
- Adding CS params and new entires in BT framework - Enabled framework logs for Le Audio. CRs-Fixed: 3187056 Change-Id: I3cbd67961f331cd47969e0b281af81cf6cd8de2e
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java')
-rw-r--r--framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java167
1 files changed, 158 insertions, 9 deletions
diff --git a/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java b/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java
index c91d13ffe0..314bb3d1ca 100644
--- a/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java
+++ b/framework/java/android/bluetooth/BluetoothLeAudioCodecConfig.java
@@ -39,12 +39,18 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
/** @hide */
@IntDef(prefix = "SOURCE_CODEC_TYPE_", value = {
SOURCE_CODEC_TYPE_LC3,
+ SOURCE_CODEC_TYPE_APTX_ADAPTIVE_LE,
SOURCE_CODEC_TYPE_INVALID
})
@Retention(RetentionPolicy.SOURCE)
public @interface SourceCodecType {};
public static final int SOURCE_CODEC_TYPE_LC3 = 0;
+ /**
+ * AptX Adaptive LEA Codec.
+ * @hide
+ */
+ public static final int SOURCE_CODEC_TYPE_APTX_ADAPTIVE_LE = 1;
public static final int SOURCE_CODEC_TYPE_INVALID = 1000 * 1000;
/** @hide */
@@ -74,7 +80,7 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
/** @hide */
@IntDef(flag = true, prefix = "SAMPLE_RATE_",
value = {SAMPLE_RATE_NONE, SAMPLE_RATE_8000, SAMPLE_RATE_16000, SAMPLE_RATE_24000,
- SAMPLE_RATE_32000, SAMPLE_RATE_44100, SAMPLE_RATE_48000})
+ SAMPLE_RATE_32000, SAMPLE_RATE_44100, SAMPLE_RATE_48000, SAMPLE_RATE_96000})
@Retention(RetentionPolicy.SOURCE)
public @interface SampleRate {}
@@ -118,6 +124,12 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
*/
public static final int SAMPLE_RATE_48000 = 0x01 << 7;
+ /**
+ * Codec sample rate 96000 Hz.
+ * @hide
+ */
+ public static final int SAMPLE_RATE_96000 = 0x01 << 9;
+
/** @hide */
@IntDef(flag = true, prefix = "BITS_PER_SAMPLE_",
value = {BITS_PER_SAMPLE_NONE, BITS_PER_SAMPLE_16, BITS_PER_SAMPLE_24,
@@ -178,9 +190,11 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
* Bluetooth Assigned Numbers, Generic Audio,
* Supported_Frame_Durations table
*
+ * Vendor Specific frame duration starting from bit 16
* @hide */
@IntDef(flag = true, prefix = "FRAME_DURATION_",
- value = {FRAME_DURATION_NONE, FRAME_DURATION_7500, FRAME_DURATION_10000})
+ value = {FRAME_DURATION_NONE, FRAME_DURATION_7500,
+ FRAME_DURATION_10000, FRAME_DURATION_15000})
@Retention(RetentionPolicy.SOURCE)
public @interface FrameDuration {}
@@ -199,6 +213,13 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
*/
public static final int FRAME_DURATION_10000 = 0x01 << 1;
+ /**
+ * Frame duration 15000 us.
+ * @hide
+ */
+ public static final int FRAME_DURATION_15000 = 0x01 << 16;
+
+
private final @SourceCodecType int mCodecType;
private final @CodecPriority int mCodecPriority;
private final @SampleRate int mSampleRate;
@@ -208,7 +229,10 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
private final int mOctetsPerFrame;
private final int mMinOctetsPerFrame;
private final int mMaxOctetsPerFrame;
-
+ private final long mCodecSpecific1;
+ private final long mCodecSpecific2;
+ private final long mCodecSpecific3;
+ private final long mCodecSpecific4;
/**
* Creates a new BluetoothLeAudioCodecConfig.
@@ -222,12 +246,17 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
* @param octetsPerFrame the octets per frame of this codec
* @param minOctetsPerFrame the minimum octets per frame of this codec
* @param maxOctetsPerFrame the maximum octets per frame of this codec
+ * @param codecSpecific1 the specific value 1
+ * @param codecSpecific2 the specific value 2
+ * @param codecSpecific3 the specific value 3
+ * @param codecSpecific4 the specific value 4
*/
private BluetoothLeAudioCodecConfig(@SourceCodecType int codecType,
@CodecPriority int codecPriority, @SampleRate int sampleRate,
@BitsPerSample int bitsPerSample, @ChannelCount int channelCount,
@FrameDuration int frameDuration, int octetsPerFrame,
- int minOctetsPerFrame, int maxOctetsPerFrame) {
+ int minOctetsPerFrame, int maxOctetsPerFrame, long codecSpecific1,
+ long codecSpecific2, long codecSpecific3, long codecSpecific4) {
mCodecType = codecType;
mCodecPriority = codecPriority;
mSampleRate = sampleRate;
@@ -237,6 +266,10 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
mOctetsPerFrame = octetsPerFrame;
mMinOctetsPerFrame = minOctetsPerFrame;
mMaxOctetsPerFrame = maxOctetsPerFrame;
+ mCodecSpecific1 = codecSpecific1;
+ mCodecSpecific2 = codecSpecific2;
+ mCodecSpecific3 = codecSpecific3;
+ mCodecSpecific4 = codecSpecific4;
}
@Override
@@ -260,9 +293,14 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
int octetsPerFrame = in.readInt();
int minOctetsPerFrame = in.readInt();
int maxOctetsPerFrame = in.readInt();
+ long codecSpecific1 = in.readLong();
+ long codecSpecific2 = in.readLong();
+ long codecSpecific3 = in.readLong();
+ long codecSpecific4 = in.readLong();
return new BluetoothLeAudioCodecConfig(codecType, codecPriority, sampleRate,
bitsPerSample, channelCount, frameDuration, octetsPerFrame,
- minOctetsPerFrame, maxOctetsPerFrame);
+ minOctetsPerFrame, maxOctetsPerFrame, codecSpecific1, codecSpecific2,
+ codecSpecific3, codecSpecific4);
}
public BluetoothLeAudioCodecConfig[] newArray(int size) {
@@ -281,6 +319,10 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
out.writeInt(mOctetsPerFrame);
out.writeInt(mMinOctetsPerFrame);
out.writeInt(mMaxOctetsPerFrame);
+ out.writeLong(mCodecSpecific1);
+ out.writeLong(mCodecSpecific2);
+ out.writeLong(mCodecSpecific3);
+ out.writeLong(mCodecSpecific4);
}
@Override
@@ -290,7 +332,10 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
+ ",mBitsPerSample:" + mBitsPerSample + ",mChannelCount:" + mChannelCount
+ ",mFrameDuration:" + mFrameDuration + ",mOctetsPerFrame:" + mOctetsPerFrame
+ ",mMinOctetsPerFrame:" + mMinOctetsPerFrame
- + ",mMaxOctetsPerFrame:" + mMaxOctetsPerFrame + "}";
+ + ",mMaxOctetsPerFrame:" + mMaxOctetsPerFrame
+ + ",mCodecSpecific1:" + mCodecSpecific1 + ",mCodecSpecific2:" + mCodecSpecific2
+ + ",mCodecSpecific3:" + mCodecSpecific3 + ",mCodecSpecific4:" + mCodecSpecific4
+ + "}";
}
/**
@@ -311,6 +356,8 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
switch (mCodecType) {
case SOURCE_CODEC_TYPE_LC3:
return "LC3";
+ case SOURCE_CODEC_TYPE_APTX_ADAPTIVE_LE:
+ return "APTX_ADAPTIVE_LEA";
case SOURCE_CODEC_TYPE_INVALID:
return "INVALID CODEC";
default:
@@ -377,6 +424,46 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
return mMaxOctetsPerFrame;
}
+ /**
+ * Returns the codec specific value1.
+ * As the value and usage differ for each codec, please refer to the concerned
+ * codec specification to obtain the codec specific information.
+ * @hide
+ */
+ public long getCodecSpecific1() {
+ return mCodecSpecific1;
+ }
+
+ /**
+ * Returns the codec specific value2.
+ * As the value and usage differ for each codec, please refer to the concerned
+ * codec specification to obtain the codec specific information.
+ * @hide
+ */
+ public long getCodecSpecific2() {
+ return mCodecSpecific2;
+ }
+
+ /**
+ * Returns the codec specific value3.
+ * As the value and usage differ for each codec, please refer to the concerned
+ * codec specification to obtain the codec specific information.
+ * @hide
+ */
+ public long getCodecSpecific3() {
+ return mCodecSpecific3;
+ }
+
+ /**
+ * Returns the codec specific value4.
+ * As the value and usage differ for each codec, please refer to the concerned
+ * codec specification to obtain the codec specific information.
+ * @hide
+ */
+ public long getCodecSpecific4() {
+ return mCodecSpecific4;
+ }
+
@Override
public boolean equals(@NonNull Object o) {
if (o instanceof BluetoothLeAudioCodecConfig) {
@@ -389,7 +476,11 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
&& other.getFrameDuration() == mFrameDuration
&& other.getOctetsPerFrame() == mOctetsPerFrame
&& other.getMinOctetsPerFrame() == mMinOctetsPerFrame
- && other.getMaxOctetsPerFrame() == mMaxOctetsPerFrame);
+ && other.getMaxOctetsPerFrame() == mMaxOctetsPerFrame
+ && other.mCodecSpecific1 == mCodecSpecific1
+ && other.mCodecSpecific2 == mCodecSpecific2
+ && other.mCodecSpecific3 == mCodecSpecific3
+ && other.mCodecSpecific4 == mCodecSpecific4);
}
return false;
}
@@ -402,7 +493,8 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
public int hashCode() {
return Objects.hash(mCodecType, mCodecPriority, mSampleRate,
mBitsPerSample, mChannelCount, mFrameDuration, mOctetsPerFrame,
- mMinOctetsPerFrame, mMaxOctetsPerFrame);
+ mMinOctetsPerFrame, mMaxOctetsPerFrame, mCodecSpecific1,
+ mCodecSpecific2, mCodecSpecific3, mCodecSpecific4);
}
/**
@@ -420,6 +512,10 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
private int mOctetsPerFrame = 0;
private int mMinOctetsPerFrame = 0;
private int mMaxOctetsPerFrame = 0;
+ private long mCodecSpecific1 = 0;
+ private long mCodecSpecific2 = 0;
+ private long mCodecSpecific3 = 0;
+ private long mCodecSpecific4 = 0;
public Builder() {}
@@ -433,6 +529,10 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
mOctetsPerFrame = config.getOctetsPerFrame();
mMinOctetsPerFrame = config.getMinOctetsPerFrame();
mMaxOctetsPerFrame = config.getMaxOctetsPerFrame();
+ mCodecSpecific1 = config.getCodecSpecific1();
+ mCodecSpecific2 = config.getCodecSpecific2();
+ mCodecSpecific3 = config.getCodecSpecific3();
+ mCodecSpecific4 = config.getCodecSpecific4();
}
/**
@@ -535,13 +635,62 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
}
/**
+ * Set the codecspecific1 for Bluetooth LE audio codec config.
+ *
+ * @param codecspecific1 of this codec
+ * @return the same Builder instance
+ * @hide
+ */
+ public @NonNull Builder setCodecSpecific1(long codecSpecific1) {
+ mCodecSpecific1 = codecSpecific1;
+ return this;
+ }
+
+ /**
+ * Set the codecspecific2 for Bluetooth LE audio codec config.
+ *
+ * @param codecspecific2 of this codec
+ * @return the same Builder instance
+ * @hide
+ */
+ public @NonNull Builder setCodecSpecific2(long codecSpecific2) {
+ mCodecSpecific2 = codecSpecific2;
+ return this;
+ }
+
+ /**
+ * Set the codecspecific3 for Bluetooth LE audio codec config.
+ *
+ * @param codecspecific3 of this codec
+ * @return the same Builder instance
+ * @hide
+ */
+ public @NonNull Builder setCodecSpecific3(long codecSpecific3) {
+ mCodecSpecific3 = codecSpecific3;
+ return this;
+ }
+
+ /**
+ * Set the codecspecific4 for Bluetooth LE audio codec config.
+ *
+ * @param codecspecific4 of this codec
+ * @return the same Builder instance
+ * @hide
+ */
+ public @NonNull Builder setCodecSpecific4(long codecSpecific4) {
+ mCodecSpecific4 = codecSpecific4;
+ return this;
+ }
+
+ /**
* Build {@link BluetoothLeAudioCodecConfig}.
* @return new BluetoothLeAudioCodecConfig built
*/
public @NonNull BluetoothLeAudioCodecConfig build() {
return new BluetoothLeAudioCodecConfig(mCodecType, mCodecPriority, mSampleRate,
mBitsPerSample, mChannelCount, mFrameDuration, mOctetsPerFrame,
- mMinOctetsPerFrame, mMaxOctetsPerFrame);
+ mMinOctetsPerFrame, mMaxOctetsPerFrame, mCodecSpecific1,
+ mCodecSpecific2, mCodecSpecific3, mCodecSpecific4);
}
}
}