Skip to content
Snippets Groups Projects
Commit e770738e authored by Tom Taylor's avatar Tom Taylor Committed by Android Git Automerger
Browse files

am 4e927d1b: Merge "Added vibrator detection logic to remove vibrate setting."

* commit '4e927d1b':
  Added vibrator detection logic to remove vibrate setting.
parents b32b2bc1 4e927d1b
No related branches found
Tags v3.2.4
No related merge requests found
......@@ -30,6 +30,7 @@ import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Vibrator;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
......@@ -195,6 +196,11 @@ public class MessagingPreferenceActivity extends PreferenceActivity
mEnableNotificationsPref = (CheckBoxPreference) findPreference(NOTIFICATION_ENABLED);
mMmsAutoRetrievialPref = (CheckBoxPreference) findPreference(AUTO_RETRIEVAL);
mVibratePref = (CheckBoxPreference) findPreference(NOTIFICATION_VIBRATE);
Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
if (mVibratePref != null && (vibrator == null || !vibrator.hasVibrator())) {
mNotificationPrefCategory.removePreference(mVibratePref);
mVibratePref = null;
}
mRingtonePref = (RingtonePreference) findPreference(NOTIFICATION_RINGTONE);
setMessagePreferences();
......@@ -252,7 +258,7 @@ public class MessagingPreferenceActivity extends PreferenceActivity
// If needed, migrate vibration setting from the previous tri-state setting stored in
// NOTIFICATION_VIBRATE_WHEN to the boolean setting stored in NOTIFICATION_VIBRATE.
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
if (sharedPreferences.contains(NOTIFICATION_VIBRATE_WHEN)) {
if (mVibratePref != null && sharedPreferences.contains(NOTIFICATION_VIBRATE_WHEN)) {
String vibrateWhen = sharedPreferences.
getString(MessagingPreferenceActivity.NOTIFICATION_VIBRATE_WHEN, null);
boolean vibrate = "always".equals(vibrateWhen);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment