diff options
author | Rahul Sabnis <rahulsabnis@google.com> | 2021-07-27 15:49:04 -0700 |
---|---|---|
committer | Rahul Sabnis <rahulsabnis@google.com> | 2021-07-27 15:49:04 -0700 |
commit | 063511f1584840e30d6cb62c2e1f7ac3b59cc9a5 (patch) | |
tree | 93a82d0176b80ad079884c6e9d4eae72cdbe3442 /framework/java/android/bluetooth/BluetoothA2dp.java | |
parent | fe3d6da465f03900006100efa8618502d16334ff (diff) |
Require calls to BluetoothA2dp#setBufferLengthMillis to pass a
non-negative value
Tag: #feature
Bug: 194837771
Test: Manual
Change-Id: I3c1d2da1d28a494d8b393c4502521b3f0699adf6
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothA2dp.java')
-rw-r--r-- | framework/java/android/bluetooth/BluetoothA2dp.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/framework/java/android/bluetooth/BluetoothA2dp.java b/framework/java/android/bluetooth/BluetoothA2dp.java index 65cdca9eb7..1dd32fec25 100644 --- a/framework/java/android/bluetooth/BluetoothA2dp.java +++ b/framework/java/android/bluetooth/BluetoothA2dp.java @@ -1025,6 +1025,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()) { |