diff options
| author | 2024-10-28 16:16:44 -0700 | |
|---|---|---|
| committer | 2024-10-28 18:43:21 -0700 | |
| commit | bf5bb3d44fd07a4896f09042ede8bb8aad2486fe (patch) | |
| tree | 04e2f1aacb6568543303a49bb26adc37bbb9f340 | |
| parent | 296c5c2e12b0a0a9b7df06a01b335815a046c12c (diff) | |
Initialize absolute volume state onReinitVolume
APM could trigger a reinit volume command if the curves are not
initialized properly. In this case it can happen since the
AUDIO_STREAM_BLUETOOTH_SCO curves min/max are not initialized due to the
missing STREAM_BT_SCO on the service side.
Test: manual
Flag: EXEMPT bugfix
Bug: 362594705
Change-Id: I3e3936412842211d34ef72f2f2f0041fc8b9c213
| -rw-r--r-- | services/core/java/com/android/server/audio/AudioService.java | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index 353cfbe773dc..3dbe48a2e540 100644 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -2070,22 +2070,6 @@ public class AudioService extends IAudioService.Stub onIndicateSystemReady(); - synchronized (mCachedAbsVolDrivingStreamsLock) { - mCachedAbsVolDrivingStreams.forEach((dev, stream) -> { - boolean enabled = true; - if (dev == AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP) { - enabled = mAvrcpAbsVolSupported; - } - final int result = mAudioSystem.setDeviceAbsoluteVolumeEnabled(dev, /*address=*/"", - enabled, stream); - if (result != AudioSystem.AUDIO_STATUS_OK) { - sVolumeLogger.enqueueAndSlog( - new VolumeEvent(VolumeEvent.VOL_ABS_DEVICE_ENABLED_ERROR, - result, dev, enabled, stream).eventToString(), ALOGE, TAG); - } - }); - } - // indicate the end of reconfiguration phase to audio HAL AudioSystem.setParameters("restarting=false"); @@ -2200,6 +2184,22 @@ public class AudioService extends IAudioService.Stub return; } + synchronized (mCachedAbsVolDrivingStreamsLock) { + mCachedAbsVolDrivingStreams.forEach((dev, stream) -> { + boolean enabled = true; + if (dev == AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP) { + enabled = mAvrcpAbsVolSupported; + } + final int result = mAudioSystem.setDeviceAbsoluteVolumeEnabled(dev, /*address=*/"", + enabled, stream); + if (result != AudioSystem.AUDIO_STATUS_OK) { + sVolumeLogger.enqueueAndSlog( + new VolumeEvent(VolumeEvent.VOL_ABS_DEVICE_ENABLED_ERROR, + result, dev, enabled, stream).eventToString(), ALOGE, TAG); + } + }); + } + // did it work? check based on min/max values of some basic streams if (!checkVolumeRangeInitialization(caller)) { return; |