diff options
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothDevice.java')
| -rw-r--r-- | framework/java/android/bluetooth/BluetoothDevice.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/framework/java/android/bluetooth/BluetoothDevice.java b/framework/java/android/bluetooth/BluetoothDevice.java index 1edf5cc96b..70971a0c22 100644 --- a/framework/java/android/bluetooth/BluetoothDevice.java +++ b/framework/java/android/bluetooth/BluetoothDevice.java @@ -2828,4 +2828,34 @@ public final class BluetoothDevice implements Parcelable, Attributable { public static @MetadataKey int getMaxMetadataKey() { return METADATA_UNTETHERED_CASE_LOW_BATTERY_THRESHOLD; } + + /** + * Enable or disable audio low latency for this {@link BluetoothDevice}. + * + * @param allowed true if low latency is allowed, false if low latency is disallowed. + * @return true if the value is successfully set, + * false if there is a error when setting the value. + * @hide + */ + @SystemApi + @RequiresBluetoothConnectPermission + @RequiresPermission(allOf = { + android.Manifest.permission.BLUETOOTH_CONNECT, + android.Manifest.permission.BLUETOOTH_PRIVILEGED, + }) + public boolean setLowLatencyAudioAllowed(boolean allowed) { + final IBluetooth service = sService; + Log.i(TAG, "Allowing bluetooth audio low latency: " + allowed); + if (service == null) { + Log.e(TAG, "Bluetooth is not enabled. Cannot allow low latency"); + return false; + } + try { + service.allowLowLatencyAudio(allowed, this); + } catch (RemoteException e) { + Log.e(TAG, "allowLowLatencyAudio fail ", e); + e.rethrowFromSystemServer(); + } + return true; + } } |
