From 5b1e4a27052b0b38394de12a4184026da4d908c1 Mon Sep 17 00:00:00 2001 From: Pavlin Radoslavov Date: Fri, 24 Feb 2017 10:25:09 -0800 Subject: [PATCH] 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: I6e3144ff93bfc289fb25f4961fc00f39e8222290 (cherry picked from commit b0d8cdf8f81070dd2384f7ab756d0afdc1384107) --- .../settings/development/DevelopmentSettings.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/com/android/settings/development/DevelopmentSettings.java b/src/com/android/settings/development/DevelopmentSettings.java index 96e4ce0b6e5..2bfb60222cd 100644 --- a/src/com/android/settings/development/DevelopmentSettings.java +++ b/src/com/android/settings/development/DevelopmentSettings.java @@ -2055,6 +2055,20 @@ public class DevelopmentSettings extends RestrictedSettingsFragment codecTypeValue = BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC; codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST; break; + case 6: + synchronized (mBluetoothA2dpLock) { + if (mBluetoothA2dp != null) { + mBluetoothA2dp.enableOptionalCodecs(); + } + } + return; + case 7: + synchronized (mBluetoothA2dpLock) { + if (mBluetoothA2dp != null) { + mBluetoothA2dp.disableOptionalCodecs(); + } + } + return; default: break; }