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 b0d8cdf8f8)
This commit is contained in:
Pavlin Radoslavov
2017-02-24 10:25:09 -08:00
parent 231ed14e46
commit 5b1e4a2705

View File

@@ -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;
}