Merge "Require calls to BluetoothA2dp#setBufferLengthMillis to pass a non-negative value" into sc-dev am: 7a3cb23bf9

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15404294

Change-Id: I5837fa60959952d8a8c1e418dfa2f504087df38c
This commit is contained in:
Rahul Sabnis
2021-07-30 00:41:40 +00:00
committed by Automerger Merge Worker

View File

@@ -1025,6 +1025,10 @@ public final class BluetoothA2dp implements BluetoothProfile {
public boolean setBufferLengthMillis(@BluetoothCodecConfig.SourceCodecType int codec, public boolean setBufferLengthMillis(@BluetoothCodecConfig.SourceCodecType int codec,
int value) { int value) {
if (VDBG) log("setBufferLengthMillis(" + codec + ", " + value + ")"); if (VDBG) log("setBufferLengthMillis(" + codec + ", " + value + ")");
if (value < 0) {
Log.e(TAG, "Trying to set audio buffer length to a negative value: " + value);
return false;
}
try { try {
final IBluetoothA2dp service = getService(); final IBluetoothA2dp service = getService();
if (service != null && isEnabled()) { if (service != null && isEnabled()) {