summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vlad Popa <pvlad@google.com> 2024-11-19 21:08:37 -0800
committer Vlad Popa <pvlad@google.com> 2024-11-20 11:07:28 -0800
commit01cec45f010b3385fb1d86a8ccd0d4a8ab6b3412 (patch)
treec7d1e39d4dab99e8ba03210b74af7123d3b3efd6
parentb3576b16065a534cdc8df655febff82746b319a9 (diff)
Apply the avrcp volume when switching stream context
Since we are applying the new volumes in the native side as well we need to make sure that the avrcp updates are sent out from AudioService Test: repro steps in bug Bug: 379009970 Flag: EXEMPT bugfix Change-Id: I3f26ff9069fe1c80146352d0d1fb57a31037d873
-rw-r--r--services/core/java/com/android/server/audio/AudioService.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 6e6bf80e8c09..e3c0655e4d2d 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -4951,6 +4951,15 @@ public class AudioService extends IAudioService.Stub
}
final Set<Integer> deviceTypes = getDeviceSetForStreamDirect(streamType);
+
+ final Set<Integer> a2dpDevices = AudioSystem.intersectionAudioDeviceTypes(
+ AudioSystem.DEVICE_OUT_ALL_A2DP_SET, deviceTypes);
+ if (!a2dpDevices.isEmpty()) {
+ int index = getStreamVolume(streamType,
+ a2dpDevices.toArray(new Integer[0])[0].intValue());
+ mDeviceBroker.postSetAvrcpAbsoluteVolumeIndex(index);
+ }
+
final Set<Integer> absVolumeMultiModeCaseDevices =
AudioSystem.intersectionAudioDeviceTypes(
mAbsVolumeMultiModeCaseDevices, deviceTypes);