From aa37865c19bdf36a89278246ff6275ab4db7c80e Mon Sep 17 00:00:00 2001 From: David Duarte Date: Wed, 29 Mar 2023 17:25:21 +0000 Subject: Update Opus over A2DP to use BluetoothCodecConfig api Bug: 240635097 Test: sink device using bds-dev Ignore-AOSP-First: TM QPR1 Feature (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:572b8b9301a6654f8f34128427b1a0ca3f12be59) Merged-In: I113bc8b9f7a2bc17ae483929a2d7574f200e405f Change-Id: I113bc8b9f7a2bc17ae483929a2d7574f200e405f --- framework/api/current.txt | 1 + framework/java/android/bluetooth/BluetoothCodecConfig.java | 4 ++-- .../unit/src/android/bluetooth/BluetoothCodecConfigTest.java | 8 ++------ 3 files changed, 5 insertions(+), 8 deletions(-) (limited to 'framework') diff --git a/framework/api/current.txt b/framework/api/current.txt index 18f4b4dc33..629717530f 100644 --- a/framework/api/current.txt +++ b/framework/api/current.txt @@ -457,6 +457,7 @@ package android.bluetooth { field public static final int SOURCE_CODEC_TYPE_INVALID = 1000000; // 0xf4240 field public static final int SOURCE_CODEC_TYPE_LC3 = 5; // 0x5 field public static final int SOURCE_CODEC_TYPE_LDAC = 4; // 0x4 + field public static final int SOURCE_CODEC_TYPE_OPUS = 6; // 0x6 field public static final int SOURCE_CODEC_TYPE_SBC = 0; // 0x0 } diff --git a/framework/java/android/bluetooth/BluetoothCodecConfig.java b/framework/java/android/bluetooth/BluetoothCodecConfig.java index 21d5b33b17..e0ea232c35 100644 --- a/framework/java/android/bluetooth/BluetoothCodecConfig.java +++ b/framework/java/android/bluetooth/BluetoothCodecConfig.java @@ -41,7 +41,7 @@ public final class BluetoothCodecConfig implements Parcelable { @IntDef(prefix = "SOURCE_CODEC_TYPE_", value = {SOURCE_CODEC_TYPE_SBC, SOURCE_CODEC_TYPE_AAC, SOURCE_CODEC_TYPE_APTX, SOURCE_CODEC_TYPE_APTX_HD, SOURCE_CODEC_TYPE_LDAC, SOURCE_CODEC_TYPE_LC3, - SOURCE_CODEC_TYPE_INVALID}) + SOURCE_CODEC_TYPE_OPUS, SOURCE_CODEC_TYPE_INVALID}) @Retention(RetentionPolicy.SOURCE) public @interface SourceCodecType {} @@ -79,7 +79,7 @@ public final class BluetoothCodecConfig implements Parcelable { /** * Source codec type Opus. */ - private static final int SOURCE_CODEC_TYPE_OPUS = 6; + public static final int SOURCE_CODEC_TYPE_OPUS = 6; /** * Source codec type invalid. This is the default value used for codec diff --git a/framework/tests/unit/src/android/bluetooth/BluetoothCodecConfigTest.java b/framework/tests/unit/src/android/bluetooth/BluetoothCodecConfigTest.java index 19bd3f09c4..23588be2a1 100644 --- a/framework/tests/unit/src/android/bluetooth/BluetoothCodecConfigTest.java +++ b/framework/tests/unit/src/android/bluetooth/BluetoothCodecConfigTest.java @@ -24,16 +24,13 @@ import junit.framework.TestCase; * Unit test cases for {@link BluetoothCodecConfig}. */ public class BluetoothCodecConfigTest extends TestCase { - // TODO(b/240635097): remove in U - private static final int SOURCE_CODEC_TYPE_OPUS = 6; - private static final int[] sCodecTypeArray = new int[] { BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC, BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC, BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX, BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD, BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC, - SOURCE_CODEC_TYPE_OPUS, // TODO(b/240635097): update in U + BluetoothCodecConfig.SOURCE_CODEC_TYPE_OPUS, BluetoothCodecConfig.SOURCE_CODEC_TYPE_INVALID, }; private static final int[] sCodecPriorityArray = new int[] { @@ -216,8 +213,7 @@ public class BluetoothCodecConfigTest extends TestCase { if (codec_type == BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC) { assertEquals("LDAC", BluetoothCodecConfig.getCodecName(codec_type)); } - // TODO(b/240635097): update in U - if (codec_type == SOURCE_CODEC_TYPE_OPUS) { + if (codec_type == BluetoothCodecConfig.SOURCE_CODEC_TYPE_OPUS) { assertEquals("Opus", BluetoothCodecConfig.getCodecName(codec_type)); } if (codec_type == BluetoothCodecConfig.SOURCE_CODEC_TYPE_INVALID) { -- cgit v1.2.3-59-g8ed1b