commit | 465f4894301d2f0c357324e7696c99991517e0b2 | [log] [tgz] |
---|---|---|
author | Rahul Sabnis <rahulsabnis@google.com> | Tue Jul 27 15:49:04 2021 -0700 |
committer | Rahul Sabnis <rahulsabnis@google.com> | Tue Aug 10 13:57:57 2021 -0700 |
tree | 59e9c63c80ba53f58da2acf06b34d2d76c557443 | |
parent | 483a604f27ba31a02159dbf6e55088627c6b8c7b [diff] |
Require calls to BluetoothA2dp#setBufferLengthMillis to pass a non-negative value Tag: #feature Bug: 194837771 Test: Manual Merged-In: I3c1d2da1d28a494d8b393c4502521b3f0699adf6 Change-Id: I3c1d2da1d28a494d8b393c4502521b3f0699adf6
diff --git a/core/java/android/bluetooth/BluetoothA2dp.java b/core/java/android/bluetooth/BluetoothA2dp.java index 16413e1..4dcb3dc 100644 --- a/core/java/android/bluetooth/BluetoothA2dp.java +++ b/core/java/android/bluetooth/BluetoothA2dp.java
@@ -946,6 +946,10 @@ 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()) {