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

Commit b37fe88e authored by StevenHarperUK's avatar StevenHarperUK Committed by Steve Kondik
Browse files

Feature : Volume adjust sound preference 1/2

This patch allows the users to choose if they want the audible tone when adjusting the volume

The new preference is in
Settings | Sound
    Volume adjust sound
        Play sound when adjusting volume with hard keys
The Checkbox is defaulted to ON (1 in defaults.xml)

Look for 2/2 for the Settings, Sound Panel Change

[mikeioannina]: Update for L

Change-Id: I705c23065706317760ba60efc1a71f3ba6082bbd
parent 96203c85
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2100,6 +2100,13 @@ public final class Settings {
        @Deprecated
        public static final String ALWAYS_FINISH_ACTIVITIES = Global.ALWAYS_FINISH_ACTIVITIES;

        /**
         * Volume Adjust Sounds Enable, This is the noise made when using volume hard buttons
         * Defaults to 1 - sounds enabled
         * @hide
         */
        public static final String VOLUME_ADJUST_SOUNDS_ENABLED = "volume_adjust_sounds_enabled";

        /**
         * Determines which streams are affected by ringer mode changes. The
         * stream type's bit should be set to 1 if it should be muted when going
+7 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import android.os.Debug;
import android.os.Handler;
import android.os.Message;
import android.os.Vibrator;
import android.provider.Settings;
import android.util.Log;
import android.util.SparseArray;
import android.view.KeyEvent;
@@ -1148,6 +1149,12 @@ public class VolumePanel extends Handler {

    protected void onPlaySound(int streamType, int flags) {

        // If preference is no sound - just exit here
        if (Settings.System.getInt(mContext.getContentResolver(),
                Settings.System.VOLUME_ADJUST_SOUNDS_ENABLED, 1) == 0) {
            return;
        }

        if (hasMessages(MSG_STOP_SOUNDS)) {
            removeMessages(MSG_STOP_SOUNDS);
            // Force stop right now