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

Commit 9b35cd53 authored by Mike Kasick's avatar Mike Kasick Committed by Brian Beloshapka
Browse files

AudioService: Don't adjust volume when vol-downing to vibrate or silent

Pressing vol-down to vibrate or silent would (previously) still adjust the
stream volume, setting the last audible volume to 0, which is not allowed
for voice-capable devices.  Thus, the last audible volume would reset to
default on reboot if on vibrate/silent or the lowest volume setting.

By not adjusting volume when vol-downing to vibrate or silent on
voice-capable devices, the last audible volume is always preserved across
reboot.
parent 245b5e00
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2364,11 +2364,15 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
                    //   (step <= oldIndex < 2 * step) is equivalent to: (old UI index == 1)
                    if (step <= oldIndex && oldIndex < 2 * step) {
                        ringerMode = RINGER_MODE_VIBRATE;
                        if (mVoiceCapable)
                            adjustVolumeIndex = false;
                    }
                } else {
                    // (oldIndex < step) is equivalent to (old UI index == 0)
                    if ((oldIndex < step) && mPrevVolDirection != AudioManager.ADJUST_LOWER) {
                        ringerMode = RINGER_MODE_SILENT;
                        if (mVoiceCapable)
                            adjustVolumeIndex = false;
                    }
                }
            }