Created
August 27, 2020 08:32
-
-
Save luca020400/17c5fa3650a57d173d826d7367cad52b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From ae09825bef85f26a3d9c9b0c941d60142cce71bc Mon Sep 17 00:00:00 2001 | |
From: Luca Stefani <[email protected]> | |
Date: Thu, 27 Aug 2020 10:31:24 +0200 | |
Subject: [PATCH] Don't assign codecs to a size fixed array | |
Change-Id: I589d63c635e29ff3cef8b688acc85637d5f096c3 | |
--- | |
.../bluetooth/a2dp/A2dpCodecConfig.java | 58 +++++++------------ | |
1 file changed, 22 insertions(+), 36 deletions(-) | |
diff --git a/src/com/android/bluetooth/a2dp/A2dpCodecConfig.java b/src/com/android/bluetooth/a2dp/A2dpCodecConfig.java | |
index 6e0b1c022..16b5e3f65 100644 | |
--- a/src/com/android/bluetooth/a2dp/A2dpCodecConfig.java | |
+++ b/src/com/android/bluetooth/a2dp/A2dpCodecConfig.java | |
@@ -231,41 +231,27 @@ class A2dpCodecConfig { | |
mA2dpSourceCodecPriorityLdac = value; | |
} | |
- BluetoothCodecConfig codecConfig; | |
- BluetoothCodecConfig[] codecConfigArray = | |
- new BluetoothCodecConfig[BluetoothCodecConfig.SOURCE_CODEC_TYPE_MAX]; | |
- codecConfig = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC, | |
- mA2dpSourceCodecPrioritySbc, BluetoothCodecConfig.SAMPLE_RATE_NONE, | |
- BluetoothCodecConfig.BITS_PER_SAMPLE_NONE, BluetoothCodecConfig | |
- .CHANNEL_MODE_NONE, 0 /* codecSpecific1 */, | |
- 0 /* codecSpecific2 */, 0 /* codecSpecific3 */, 0 /* codecSpecific4 */); | |
- codecConfigArray[0] = codecConfig; | |
- codecConfig = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC, | |
- mA2dpSourceCodecPriorityAac, BluetoothCodecConfig.SAMPLE_RATE_NONE, | |
- BluetoothCodecConfig.BITS_PER_SAMPLE_NONE, BluetoothCodecConfig | |
- .CHANNEL_MODE_NONE, 0 /* codecSpecific1 */, | |
- 0 /* codecSpecific2 */, 0 /* codecSpecific3 */, 0 /* codecSpecific4 */); | |
- codecConfigArray[1] = codecConfig; | |
- codecConfig = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX, | |
- mA2dpSourceCodecPriorityAptx, BluetoothCodecConfig.SAMPLE_RATE_NONE, | |
- BluetoothCodecConfig.BITS_PER_SAMPLE_NONE, BluetoothCodecConfig | |
- .CHANNEL_MODE_NONE, 0 /* codecSpecific1 */, | |
- 0 /* codecSpecific2 */, 0 /* codecSpecific3 */, 0 /* codecSpecific4 */); | |
- codecConfigArray[2] = codecConfig; | |
- codecConfig = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD, | |
- mA2dpSourceCodecPriorityAptxHd, BluetoothCodecConfig.SAMPLE_RATE_NONE, | |
- BluetoothCodecConfig.BITS_PER_SAMPLE_NONE, BluetoothCodecConfig | |
- .CHANNEL_MODE_NONE, 0 /* codecSpecific1 */, | |
- 0 /* codecSpecific2 */, 0 /* codecSpecific3 */, 0 /* codecSpecific4 */); | |
- codecConfigArray[3] = codecConfig; | |
- codecConfig = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC, | |
- mA2dpSourceCodecPriorityLdac, BluetoothCodecConfig.SAMPLE_RATE_NONE, | |
- BluetoothCodecConfig.BITS_PER_SAMPLE_NONE, BluetoothCodecConfig | |
- .CHANNEL_MODE_NONE, 0 /* codecSpecific1 */, | |
- 0 /* codecSpecific2 */, 0 /* codecSpecific3 */, 0 /* codecSpecific4 */); | |
- codecConfigArray[4] = codecConfig; | |
- | |
- return codecConfigArray; | |
+ return new BluetoothCodecConfig[] { | |
+ new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC, mA2dpSourceCodecPrioritySbc, | |
+ BluetoothCodecConfig.SAMPLE_RATE_NONE, BluetoothCodecConfig.BITS_PER_SAMPLE_NONE, | |
+ BluetoothCodecConfig.CHANNEL_MODE_NONE, 0 /* codecSpecific1 */, 0 /* codecSpecific2 */, | |
+ 0 /* codecSpecific3 */, 0 /* codecSpecific4 */), | |
+ new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC, mA2dpSourceCodecPriorityAac, | |
+ BluetoothCodecConfig.SAMPLE_RATE_NONE, BluetoothCodecConfig.BITS_PER_SAMPLE_NONE, | |
+ BluetoothCodecConfig.CHANNEL_MODE_NONE, 0 /* codecSpecific1 */, 0 /* codecSpecific2 */, | |
+ 0 /* codecSpecific3 */, 0 /* codecSpecific4 */), | |
+ new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX, mA2dpSourceCodecPriorityAptx, | |
+ BluetoothCodecConfig.SAMPLE_RATE_NONE, BluetoothCodecConfig.BITS_PER_SAMPLE_NONE, | |
+ BluetoothCodecConfig.CHANNEL_MODE_NONE, 0 /* codecSpecific1 */, 0 /* codecSpecific2 */, | |
+ 0 /* codecSpecific3 */, 0 /* codecSpecific4 */), | |
+ new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD, mA2dpSourceCodecPriorityAptxHd, | |
+ BluetoothCodecConfig.SAMPLE_RATE_NONE, BluetoothCodecConfig.BITS_PER_SAMPLE_NONE, | |
+ BluetoothCodecConfig.CHANNEL_MODE_NONE, 0 /* codecSpecific1 */, 0 /* codecSpecific2 */, | |
+ 0 /* codecSpecific3 */, 0 /* codecSpecific4 */), | |
+ new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC, mA2dpSourceCodecPriorityLdac, | |
+ BluetoothCodecConfig.SAMPLE_RATE_NONE, BluetoothCodecConfig.BITS_PER_SAMPLE_NONE, | |
+ BluetoothCodecConfig.CHANNEL_MODE_NONE, 0 /* codecSpecific1 */, 0 /* codecSpecific2 */, | |
+ 0 /* codecSpecific3 */, 0 /* codecSpecific4 */) | |
+ }; | |
} | |
} | |
- | |
-- | |
2.28.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment