diff options
| author | 2023-05-19 12:27:30 +0000 | |
|---|---|---|
| committer | 2023-05-19 12:27:30 +0000 | |
| commit | 167d6bebd666b74fa7bb1db2b3fcfd733fcf2ede (patch) | |
| tree | e84ff778b9496270830f0c3a21ec6d0207e33b20 | |
| parent | ba585b20cd54b4cd300404af695af8caad5ebf71 (diff) | |
| parent | 99eda4e28ea9ce1ad45c037cb80efc46c652a5fd (diff) | |
Merge "AudioDeviceBroker: Fix not setting proper call volume for LE Headset" into udc-dev am: 0eeb400e76 am: 99eda4e28e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23258556
Change-Id: Ibebfd1da81a55c775e26372038cb958e35ad6126
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | services/core/java/com/android/server/audio/AudioDeviceBroker.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/audio/AudioDeviceBroker.java b/services/core/java/com/android/server/audio/AudioDeviceBroker.java index f4c9d05ee0ef..d7a5ee963449 100644 --- a/services/core/java/com/android/server/audio/AudioDeviceBroker.java +++ b/services/core/java/com/android/server/audio/AudioDeviceBroker.java @@ -420,6 +420,20 @@ import java.util.concurrent.atomic.AtomicBoolean; mBtHelper.stopBluetoothSco(eventSource); } + // In BT classic for communication, the device changes from a2dp to sco device, but for + // LE Audio it stays the same and we must trigger the proper stream volume alignment, if + // LE Audio communication device is activated after the audio system has already switched to + // MODE_IN_CALL mode. + if (isBluetoothLeAudioRequested()) { + final int streamType = mAudioService.getBluetoothContextualVolumeStream(); + final int leAudioVolIndex = getVssVolumeForDevice(streamType, device.getInternalType()); + final int leAudioMaxVolIndex = getMaxVssVolumeForStream(streamType); + if (AudioService.DEBUG_COMM_RTE) { + Log.v(TAG, "setCommunicationRouteForClient restoring LE Audio device volume lvl."); + } + postSetLeAudioVolumeIndex(leAudioVolIndex, leAudioMaxVolIndex, streamType); + } + updateCommunicationRoute(eventSource); } @@ -633,6 +647,16 @@ import java.util.concurrent.atomic.AtomicBoolean; } /** + * Helper method on top of isDeviceRequestedForCommunication() indicating if + * Bluetooth LE Audio communication device is currently requested or not. + * @return true if Bluetooth LE Audio device is requested, false otherwise. + */ + /*package*/ boolean isBluetoothLeAudioRequested() { + return isDeviceRequestedForCommunication(AudioDeviceInfo.TYPE_BLE_HEADSET) + || isDeviceRequestedForCommunication(AudioDeviceInfo.TYPE_BLE_SPEAKER); + } + + /** * Indicates if preferred route selection for communication is Bluetooth SCO. * @return true if Bluetooth SCO is preferred , false otherwise. */ |