diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
index 5c54427..fd7aac4 100644
--- a/java/res/values/strings.xml
+++ b/java/res/values/strings.xml
@@ -376,4 +376,7 @@
     <string name="prefs_keypress_vibration_duration_settings">Keypress vibration duration settings</string>
     <!-- Title of the settings for keypress sound volume -->
     <string name="prefs_keypress_sound_volume_settings">Keypress sound volume settings</string>
+
+    <!-- Title of the button to revert to the default value of the device in the settings dialog [CHAR LIMIT=15] -->
+    <string name="button_default">Default</string>
 </resources>
diff --git a/java/src/com/android/inputmethod/latin/SeekBarDialog.java b/java/src/com/android/inputmethod/latin/SeekBarDialog.java
index e576c09..c736d1b 100644
--- a/java/src/com/android/inputmethod/latin/SeekBarDialog.java
+++ b/java/src/com/android/inputmethod/latin/SeekBarDialog.java
@@ -30,6 +30,8 @@
     public interface Listener {
         public void onPositiveButtonClick(final SeekBarDialog dialog);
         public void onNegativeButtonClick(final SeekBarDialog dialog);
+        public void onNeutralButtonClick(final SeekBarDialog dialog);
+        public void onDismiss(final SeekBarDialog dialog);
         public void onProgressChanged(final SeekBarDialog dialog);
         public void onStartTrackingTouch(final SeekBarDialog dialog);
         public void onStopTrackingTouch(final SeekBarDialog dialog);
@@ -39,7 +41,11 @@
         @Override
         public void onPositiveButtonClick(final SeekBarDialog dialog) {}
         @Override
-        public void onNegativeButtonClick(final SeekBarDialog dialog) { dialog.dismiss(); }
+        public void onNegativeButtonClick(final SeekBarDialog dialog) {}
+        @Override
+        public void onNeutralButtonClick(final SeekBarDialog dialog) {}
+        @Override
+        public void onDismiss(final SeekBarDialog dialog) {}
         @Override
         public void onProgressChanged(final SeekBarDialog dialog) {}
         @Override
@@ -63,6 +69,9 @@
         dialogBuilder.setView(builder.mView);
         dialogBuilder.setPositiveButton(android.R.string.ok, this);
         dialogBuilder.setNegativeButton(android.R.string.cancel, this);
+        if (builder.mNeutralButtonTextResId != 0) {
+            dialogBuilder.setNeutralButton(builder.mNeutralButtonTextResId, this);
+        }
         mDialog = dialogBuilder.create();
         mListener = (builder.mListener == null) ? EMPTY_ADAPTER : builder.mListener;
         mValueView = (TextView)builder.mView.findViewById(R.id.seek_bar_dialog_value);
@@ -101,15 +110,21 @@
     }
 
     @Override
-    public void onClick(final DialogInterface dialog, int which) {
-        if (which == DialogInterface.BUTTON_POSITIVE) {
+    public void onClick(final DialogInterface dialog, final int which) {
+        switch (which) {
+        case DialogInterface.BUTTON_POSITIVE:
             mListener.onPositiveButtonClick(this);
-            return;
-        }
-        if (which == DialogInterface.BUTTON_NEGATIVE) {
+            break;
+        case DialogInterface.BUTTON_NEGATIVE:
             mListener.onNegativeButtonClick(this);
+            break;
+        case DialogInterface.BUTTON_NEUTRAL:
+            mListener.onNeutralButtonClick(this);
+            break;
+        default:
             return;
         }
+        mListener.onDismiss(this);
     }
 
     @Override
@@ -135,6 +150,7 @@
         final AlertDialog.Builder mDialogBuilder;
         final View mView;
 
+        int mNeutralButtonTextResId;
         int mMaxValue;
         int mValueFormatResId;
         int mValue;
@@ -150,8 +166,14 @@
             return this;
         }
 
+        public Builder setNeutralButtonText(final int resId) {
+            mNeutralButtonTextResId = resId;
+            return this;
+        }
+
         public Builder setMaxValue(final int max) {
             mMaxValue = max;
+            mValue = Math.min(mValue, max);
             return this;
         }
 
@@ -161,7 +183,7 @@
         }
 
         public Builder setValue(final int value) {
-            mValue = value;
+            mValue = Math.min(value, mMaxValue);
             return this;
         }
 
diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java
index c5930a9..866bef0 100644
--- a/java/src/com/android/inputmethod/latin/Settings.java
+++ b/java/src/com/android/inputmethod/latin/Settings.java
@@ -167,19 +167,21 @@
     public static float readKeypressSoundVolume(final SharedPreferences prefs,
             final Resources res) {
         final float volume = prefs.getFloat(PREF_KEYPRESS_SOUND_VOLUME, -1.0f);
-        if (volume >= 0) {
-            return volume;
-        }
+        return (volume >= 0) ? volume : readDefaultKeypressSoundVolume(res);
+    }
+
+    public static float readDefaultKeypressSoundVolume(final Resources res) {
         return Float.parseFloat(
                 ResourceUtils.getDeviceOverrideValue(res, R.array.keypress_volumes));
     }
 
-    public static int readVibrationDuration(final SharedPreferences prefs,
+    public static int readKeypressVibrationDuration(final SharedPreferences prefs,
             final Resources res) {
         final int ms = prefs.getInt(PREF_VIBRATION_DURATION_SETTINGS, -1);
-        if (ms >= 0) {
-            return ms;
-        }
+        return (ms >= 0) ? ms : readDefaultKeypressVibrationDuration(res);
+    }
+
+    public static int readDefaultKeypressVibrationDuration(final Resources res) {
         return Integer.parseInt(
                 ResourceUtils.getDeviceOverrideValue(res, R.array.keypress_vibration_durations));
     }
diff --git a/java/src/com/android/inputmethod/latin/SettingsFragment.java b/java/src/com/android/inputmethod/latin/SettingsFragment.java
index 507a37b..6a43718 100644
--- a/java/src/com/android/inputmethod/latin/SettingsFragment.java
+++ b/java/src/com/android/inputmethod/latin/SettingsFragment.java
@@ -180,7 +180,7 @@
                     });
             mKeypressVibrationDurationSettingsPref.setSummary(
                     res.getString(R.string.settings_keypress_vibration_duration,
-                            Settings.readVibrationDuration(prefs, res)));
+                            Settings.readKeypressVibrationDuration(prefs, res)));
         }
 
         mKeypressSoundVolumeSettingsPref =
@@ -308,10 +308,29 @@
         final Context context = getActivity();
         final PreferenceScreen settingsPref = mKeypressVibrationDurationSettingsPref;
         final SeekBarDialog.Listener listener = new SeekBarDialog.Adapter() {
+            private void writePreference(final SharedPreferences sp, final int value) {
+                sp.edit().putInt(Settings.PREF_VIBRATION_DURATION_SETTINGS, value).apply();
+            }
+
+            private void feedbackSettingsValue(final int value) {
+                AudioAndHapticFeedbackManager.getInstance().vibrate(value);
+            }
+
             @Override
             public void onPositiveButtonClick(final SeekBarDialog dialog) {
-                final int ms = dialog.getValue();
-                sp.edit().putInt(Settings.PREF_VIBRATION_DURATION_SETTINGS, ms).apply();
+                writePreference(sp, dialog.getValue());
+            }
+
+            @Override
+            public void onNeutralButtonClick(final SeekBarDialog dialog) {
+                final int defaultValue =
+                        Settings.readDefaultKeypressVibrationDuration(context.getResources());
+                dialog.setValue(defaultValue, false /* fromUser */);
+                writePreference(sp, defaultValue);
+            }
+
+            @Override
+            public void onDismiss(final SeekBarDialog dialog) {
                 if (settingsPref != null) {
                     settingsPref.setSummary(dialog.getValueText());
                 }
@@ -319,13 +338,13 @@
 
             @Override
             public void onStopTrackingTouch(final SeekBarDialog dialog) {
-                final int ms = dialog.getValue();
-                AudioAndHapticFeedbackManager.getInstance().vibrate(ms);
+                feedbackSettingsValue(dialog.getValue());
             }
         };
-        final int currentMs = Settings.readVibrationDuration(sp, getResources());
+        final int currentMs = Settings.readKeypressVibrationDuration(sp, getResources());
         final SeekBarDialog.Builder builder = new SeekBarDialog.Builder(context);
         builder.setTitle(R.string.prefs_keypress_vibration_duration_settings)
+                .setNeutralButtonText(R.string.button_default)
                 .setListener(listener)
                 .setMaxValue(AudioAndHapticFeedbackManager.MAX_KEYPRESS_VIBRATION_DURATION)
                 .setValueFromat(R.string.settings_keypress_vibration_duration)
@@ -348,10 +367,29 @@
         final AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
         final PreferenceScreen settingsPref = mKeypressSoundVolumeSettingsPref;
         final SeekBarDialog.Listener listener = new SeekBarDialog.Adapter() {
+            private void writePreference(final SharedPreferences sp, final float value) {
+                sp.edit().putFloat(Settings.PREF_KEYPRESS_SOUND_VOLUME, value).apply();
+            }
+
+            private void feedbackSettingsValue(final float value) {
+                am.playSoundEffect(AudioManager.FX_KEYPRESS_STANDARD, value);
+            }
+
             @Override
             public void onPositiveButtonClick(final SeekBarDialog dialog) {
-                final float volume = dialog.getValue() / PERCENT_FLOAT;
-                sp.edit().putFloat(Settings.PREF_KEYPRESS_SOUND_VOLUME, volume).apply();
+                writePreference(sp, dialog.getValue() / PERCENT_FLOAT);
+            }
+
+            @Override
+            public void onNeutralButtonClick(final SeekBarDialog dialog) {
+                final float defaultValue =
+                        Settings.readDefaultKeypressSoundVolume(context.getResources());
+                dialog.setValue((int)(defaultValue * PERCENT_INT), false /* fromUser */);
+                writePreference(sp, defaultValue);
+            }
+
+            @Override
+            public void onDismiss(final SeekBarDialog dialog) {
                 if (settingsPref != null) {
                     settingsPref.setSummary(dialog.getValueText());
                 }
@@ -359,13 +397,13 @@
 
             @Override
             public void onStopTrackingTouch(final SeekBarDialog dialog) {
-                final float volume = dialog.getValue() / PERCENT_FLOAT;
-                am.playSoundEffect(AudioManager.FX_KEYPRESS_STANDARD, volume);
+                feedbackSettingsValue(dialog.getValue() / PERCENT_FLOAT);
             }
         };
         final SeekBarDialog.Builder builder = new SeekBarDialog.Builder(context);
         final int currentVolumeInt = getCurrentKeyPressSoundVolumePercent(sp, getResources());
         builder.setTitle(R.string.prefs_keypress_sound_volume_settings)
+                .setNeutralButtonText(R.string.button_default)
                 .setListener(listener)
                 .setMaxValue(PERCENT_INT)
                 .setValue(currentVolumeInt)
diff --git a/java/src/com/android/inputmethod/latin/SettingsValues.java b/java/src/com/android/inputmethod/latin/SettingsValues.java
index 93d8fb4..1e3bdf0 100644
--- a/java/src/com/android/inputmethod/latin/SettingsValues.java
+++ b/java/src/com/android/inputmethod/latin/SettingsValues.java
@@ -121,7 +121,7 @@
         mBigramPredictionEnabled = readBigramPredictionEnabled(prefs, res);
 
         // Compute other readable settings
-        mKeypressVibrationDuration = Settings.readVibrationDuration(prefs, res);
+        mKeypressVibrationDuration = Settings.readKeypressVibrationDuration(prefs, res);
         mKeypressSoundVolume = Settings.readKeypressSoundVolume(prefs, res);
         mKeyPreviewPopupDismissDelay = Settings.readKeyPreviewPopupDismissDelay(prefs, res);
         mAutoCorrectionThreshold = readAutoCorrectionThreshold(res,
