Merge "Require calls to BluetoothA2dp#setBufferLengthMillis to pass a non-negative value"

This commit is contained in:
Treehugger Robot
2021-08-11 04:44:53 +00:00
committed by Gerrit Code Review

View File

@@ -946,6 +946,10 @@ public final class BluetoothA2dp implements BluetoothProfile {
public boolean setBufferLengthMillis(@BluetoothCodecConfig.SourceCodecType int codec,
int 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 {
final IBluetoothA2dp service = getService();
if (service != null && isEnabled()) {