BLE audio: support assigning volume at BLE device connection

Add support for associating an initial volume with a BLE
connection:
- add volume info to BluetoothProfileConnectionInfo in a new
BLE output factory method
- when handling device connection for BLE, also check if
volume information from the connection information is available.

Bug: 233975367
Test: atest frameworks/base/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/BluetoothProfileConnectionInfoTest.java
Change-Id: Ib54267727bc4d47e6999f2b84eab805f23c4955a
This commit is contained in:
Jean-Michel Trivi
2022-07-10 18:42:50 +00:00
parent cdb26776bb
commit ff46cdd950
3 changed files with 66 additions and 4 deletions

View File

@@ -125,6 +125,21 @@ public final class BluetoothProfileConnectionInfo implements Parcelable {
-1, isLeOutput);
}
/**
* @hide
* Factory method for <code>BluetoothProfileConnectionInfo</code> for an LE output device
* @param suppressNoisyIntent if true the {@link AudioManager.ACTION_AUDIO_BECOMING_NOISY}
* intent will not be sent.
* @param volume the volume index of the device, -1 if unknown or to be ignored
* @return an instance of BluetoothProfileConnectionInfo for the BLE output device that reflects
* the given parameters
*/
public static @NonNull BluetoothProfileConnectionInfo createLeAudioOutputInfo(
boolean suppressNoisyIntent, int volume) {
return new BluetoothProfileConnectionInfo(BluetoothProfile.LE_AUDIO, suppressNoisyIntent,
volume, /*isLeOutput*/ true);
}
/**
* @return The profile connection
*/