Merge "BleAudioVolume: Fix calculation for the activated device" am: b1066b67d2 am: 8263df5297

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2226717

Change-Id: Ibb8646823a3ca41b2ffbfe7379fa0a2714d770a7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jakub Tyszkowski
2022-10-01 11:26:40 +00:00
committed by Automerger Merge Worker
2 changed files with 5 additions and 5 deletions

View File

@@ -377,7 +377,8 @@ public class AudioDeviceInventory {
makeLeAudioDeviceUnavailable(address, btInfo.mAudioSystemDevice); makeLeAudioDeviceUnavailable(address, btInfo.mAudioSystemDevice);
} else if (switchToAvailable) { } else if (switchToAvailable) {
makeLeAudioDeviceAvailable(address, BtHelper.getName(btInfo.mDevice), makeLeAudioDeviceAvailable(address, BtHelper.getName(btInfo.mDevice),
streamType, btInfo.mVolume, btInfo.mAudioSystemDevice, streamType, btInfo.mVolume == -1 ? -1 : btInfo.mVolume * 10,
btInfo.mAudioSystemDevice,
"onSetBtActiveDevice"); "onSetBtActiveDevice");
} }
break; break;

View File

@@ -3839,7 +3839,7 @@ public class AudioService extends IAudioService.Stub
} }
} }
private void setLeAudioVolumeOnModeUpdate(int mode) { private void setLeAudioVolumeOnModeUpdate(int mode, int streamType, int device) {
switch (mode) { switch (mode) {
case AudioSystem.MODE_IN_COMMUNICATION: case AudioSystem.MODE_IN_COMMUNICATION:
case AudioSystem.MODE_IN_CALL: case AudioSystem.MODE_IN_CALL:
@@ -3853,8 +3853,6 @@ public class AudioService extends IAudioService.Stub
return; return;
} }
int streamType = getBluetoothContextualVolumeStream(mode);
// Currently, DEVICE_OUT_BLE_HEADSET is the only output type for LE_AUDIO profile. // Currently, DEVICE_OUT_BLE_HEADSET is the only output type for LE_AUDIO profile.
// (See AudioDeviceBroker#createBtDeviceInfo()) // (See AudioDeviceBroker#createBtDeviceInfo())
int index = mStreamStates[streamType].getIndex(AudioSystem.DEVICE_OUT_BLE_HEADSET); int index = mStreamStates[streamType].getIndex(AudioSystem.DEVICE_OUT_BLE_HEADSET);
@@ -3865,6 +3863,7 @@ public class AudioService extends IAudioService.Stub
+ index + " maxIndex=" + maxIndex + " streamType=" + streamType); + index + " maxIndex=" + maxIndex + " streamType=" + streamType);
} }
mDeviceBroker.postSetLeAudioVolumeIndex(index, maxIndex, streamType); mDeviceBroker.postSetLeAudioVolumeIndex(index, maxIndex, streamType);
mDeviceBroker.postApplyVolumeOnDevice(streamType, device, "setLeAudioVolumeOnModeUpdate");
} }
private void setStreamVolume(int streamType, int index, int flags, String callingPackage, private void setStreamVolume(int streamType, int index, int flags, String callingPackage,
@@ -5241,7 +5240,7 @@ public class AudioService extends IAudioService.Stub
// Forcefully set LE audio volume as a workaround, since the value of 'device' // Forcefully set LE audio volume as a workaround, since the value of 'device'
// is not DEVICE_OUT_BLE_* even when BLE is connected. // is not DEVICE_OUT_BLE_* even when BLE is connected.
setLeAudioVolumeOnModeUpdate(mode); setLeAudioVolumeOnModeUpdate(mode, streamType, device);
// when entering RINGTONE, IN_CALL or IN_COMMUNICATION mode, clear all SCO // when entering RINGTONE, IN_CALL or IN_COMMUNICATION mode, clear all SCO
// connections not started by the application changing the mode when pid changes // connections not started by the application changing the mode when pid changes