From b0d8cdf8f81070dd2384f7ab756d0afdc1384107 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 --- src/com/android/settings/DevelopmentSettings.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java index 7a5cb3ca0f6..6c40051203e 100644 --- a/src/com/android/settings/DevelopmentSettings.java +++ b/src/com/android/settings/DevelopmentSettings.java @@ -2049,6 +2049,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; }