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

Commit a8728c99 authored by Eric Laurent's avatar Eric Laurent
Browse files

AudioService: suppress superfluous volume changed intents

Do not broadcast VOLUME_CHANGED_ACTION intent if the externally visible
volume index does not change: this can happen on aliased streams when
the internal volume index changes but the externally visible index
(divided by 10) does not change due to rounding.

Bug: 156835211
Test: verify intent broacasts in activity manager manually.
Change-Id: I98f25d175ada39fe1d2bc4f7d008f20a5d29ef16
parent 4fc10841
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -5855,12 +5855,14 @@ public class AudioService extends IAudioService.Stub
                            caller);
                }
                // fire changed intents for all streams
                if (index != oldIndex) {
                    mVolumeChanged.putExtra(AudioManager.EXTRA_VOLUME_STREAM_VALUE, index);
                    mVolumeChanged.putExtra(AudioManager.EXTRA_PREV_VOLUME_STREAM_VALUE, oldIndex);
                    mVolumeChanged.putExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE_ALIAS,
                            mStreamVolumeAlias[mStreamType]);
                    sendBroadcastToAll(mVolumeChanged);
                }
            }
            return changed;
        }