Fixed removal of Vibration settings when system does not have vibrator.

Change-Id: I696d65c1b123a7f396a1b8cc995fdd2f6e1748a3
Reviewed-on: http://git-master/r/357350
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Tuan Tran <tutran@nvidia.com>
Tested-by: Tuan Tran <tutran@nvidia.com>
Reviewed-by: Peter Zu <pzu@nvidia.com>
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 5cc3aa3..035baaf 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -46,6 +46,7 @@
 import android.preference.ListPreference;
 import android.preference.Preference;
 import android.preference.PreferenceActivity;
+import android.preference.PreferenceCategory;
 import android.preference.PreferenceGroup;
 import android.preference.PreferenceManager;
 import android.preference.PreferenceScreen;
@@ -174,6 +175,8 @@
     private static final String BUTTON_FDN_KEY   = "button_fdn_key";
     private static final String BUTTON_RESPOND_VIA_SMS_KEY   = "button_respond_via_sms_key";
 
+    private static final String BUTTON_RINGTONE_CATEGORY = "button_ringtone_category_key";
+
     private static final String BUTTON_RINGTONE_KEY    = "button_ringtone_key";
     private static final String BUTTON_VIBRATE_ON_RING = "button_vibrate_on_ring";
     private static final String BUTTON_PLAY_DTMF_TONE  = "button_play_dtmf_tone";
@@ -1539,7 +1542,8 @@
             if (vibrator != null && vibrator.hasVibrator()) {
                 mVibrateWhenRinging.setOnPreferenceChangeListener(this);
             } else {
-                prefSet.removePreference(mVibrateWhenRinging);
+                PreferenceCategory ringToneCategory = (PreferenceCategory)findPreference(BUTTON_RINGTONE_CATEGORY);
+                ringToneCategory.removePreference(mVibrateWhenRinging);
                 mVibrateWhenRinging = null;
             }
         }