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

Commit 834b5336 authored by liuxiaoyu7's avatar liuxiaoyu7
Browse files

audio:Suppress device volume to safe volume



If the device supports safe volume,
should lower the volume to a safe volume

Signed-off-by: default avatarliuxiaoyu7 <liuxiaoyu7@xiaomi.com>
Change-Id: Ib27aa56e5ecc9875f7515494a32571c30e178ef6
parent 6faddabe
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -6554,7 +6554,10 @@ public class AudioService extends IAudioService.Stub
    private void onSetVolumeIndexOnDevice(@NonNull DeviceVolumeUpdate update) {
        final VolumeStreamState streamState = mStreamStates[update.mStreamType];
        if (update.hasVolumeIndex()) {
            final int index = update.getVolumeIndex();
            int index = update.getVolumeIndex();
            if (!checkSafeMediaVolume(update.mStreamType, index, update.mDevice)) {
                index = safeMediaVolumeIndex(update.mDevice);
            }
            streamState.setIndex(index, update.mDevice, update.mCaller,
                    // trusted as index is always validated before message is posted
                    true /*hasModifyAudioSettings*/);