Permalink
Browse files

Ported: Volume adjust sound preference 1/2

Author:    StevenHarperUK <StevenHarperUK@gmail.com>

Feature : Volume adjust sound preference 1/2

Adjusting the volume makes a nice "boing" sound
Personally I find this annoying
This patch makes this a preference 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

Change-Id: Iad89a0c49288094e21824aa9c9e1bf98c29cfec3
  • Loading branch information...
1 parent 9a1596d commit 0a686542789fd8b9317319d5face87a013b39aa3 @StevenHarperUK StevenHarperUK committed with Gerrit Code Review Dec 12, 2012
@@ -2606,6 +2606,13 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
public static final String ENABLE_VOLUME_OPTIONS = "enable_volume_options";
/**
+ * 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";
+
+ /**
* Setting to Link Ringtone and Notification.
*
* @hide
@@ -770,6 +770,11 @@ protected void onShowVolumeChanged(int streamType, int flags) {
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
@@ -79,6 +79,7 @@
<bool name="def_lockscreen_disabled">false</bool>
<bool name="def_device_provisioned">false</bool>
+ <integer name="def_volume_adjust_sounds_enabled">1</integer>
<!-- Notifications use ringer volume -->
<bool name="def_notifications_use_ring_volume">true</bool>
@@ -1981,7 +1981,8 @@ private void loadUISoundEffectsSettings(SQLiteStatement stmt) {
R.bool.def_sound_effects_enabled);
loadBooleanSetting(stmt, Settings.System.HAPTIC_FEEDBACK_ENABLED,
R.bool.def_haptic_feedback);
-
+ loadIntegerSetting(stmt, Settings.System.VOLUME_ADJUST_SOUNDS_ENABLED,
+ R.integer.def_volume_adjust_sounds_enabled);
loadIntegerSetting(stmt, Settings.System.LOCKSCREEN_SOUNDS_ENABLED,
R.integer.def_lockscreen_sounds_enabled);
}

0 comments on commit 0a68654

Please sign in to comment.