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

Commit 8b7a982d authored by Jeff Brown's avatar Jeff Brown
Browse files

Don't play a sound if a volume key press is canceled.

Change-Id: I8e45af20ec83a81565e10be3648b95686fa897af
parent 69206512
Loading
Loading
Loading
Loading
+14 −12
Original line number Original line Diff line number Diff line
@@ -1317,6 +1317,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
        switch (keyCode) {
        switch (keyCode) {
            case KeyEvent.KEYCODE_VOLUME_UP:
            case KeyEvent.KEYCODE_VOLUME_UP:
            case KeyEvent.KEYCODE_VOLUME_DOWN: {
            case KeyEvent.KEYCODE_VOLUME_DOWN: {
                if (!event.isCanceled()) {
                    AudioManager audioManager = (AudioManager) getContext().getSystemService(
                    AudioManager audioManager = (AudioManager) getContext().getSystemService(
                            Context.AUDIO_SERVICE);
                            Context.AUDIO_SERVICE);
                    if (audioManager != null) {
                    if (audioManager != null) {
@@ -1330,6 +1331,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
                                AudioManager.FLAG_PLAY_SOUND);
                                AudioManager.FLAG_PLAY_SOUND);
                        mVolumeKeyUpTime = SystemClock.uptimeMillis();
                        mVolumeKeyUpTime = SystemClock.uptimeMillis();
                    }
                    }
                }
                return true;
                return true;
            }
            }