Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 858102a5 authored by Ryan Shih's avatar Ryan Shih Committed by Dorin Drimus
Browse files

Remove redundant broadcasts when adjusting volume on single volume devices

Bug: b/165476835
Bug: b/249452979
Bug: b/289987890

Test: Adjust volume while playing Netflix stream

Merged-In: Iedbd02e28786c5585836de1e706d72e36d8a1bbb
Change-Id: Iedbd02e28786c5585836de1e706d72e36d8a1bbb
parent 02b833c2
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -8672,8 +8672,12 @@ public class AudioService extends IAudioService.Stub
                // fire changed intents for all streams, but only when the device it changed on
                //  is the current device
                if ((index != oldIndex) && isCurrentDevice) {
                    // for single volume devices, only send the volume change broadcast
                    // on the alias stream
                    if (!mIsSingleVolume || (mStreamVolumeAlias[mStreamType] == mStreamType)) {
                        mVolumeChanged.putExtra(AudioManager.EXTRA_VOLUME_STREAM_VALUE, index);
                    mVolumeChanged.putExtra(AudioManager.EXTRA_PREV_VOLUME_STREAM_VALUE, oldIndex);
                        mVolumeChanged.putExtra(AudioManager.EXTRA_PREV_VOLUME_STREAM_VALUE,
                                oldIndex);
                        mVolumeChanged.putExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE_ALIAS,
                                mStreamVolumeAlias[mStreamType]);
                        AudioService.sVolumeLogger.enqueue(new VolChangedBroadcastEvent(
@@ -8681,6 +8685,7 @@ public class AudioService extends IAudioService.Stub
                        sendBroadcastToAll(mVolumeChanged, mVolumeChangedOptions);
                    }
                }
            }
            return changed;
        }