summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2010-11-17 14:48:51 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-11-17 14:48:51 -0800
commit7eb31c76a399a320ec3fbfd6ecbcb2185b9abf08 (patch)
treed840fdf918095bf553afd1d5f70f5eaa88bedc0c
parent3b046f575906f7c311b7964bd1ef7db8e05b61f7 (diff)
parentedac9af662f01026fd2b4acf263e1b5d1dfdeaa9 (diff)
downloadpackages_apps_settings-7eb31c76a399a320ec3fbfd6ecbcb2185b9abf08.zip
packages_apps_settings-7eb31c76a399a320ec3fbfd6ecbcb2185b9abf08.tar.gz
packages_apps_settings-7eb31c76a399a320ec3fbfd6ecbcb2185b9abf08.tar.bz2
Merge "Conditional remove "haptic" settings if there's no vibrator"
-rw-r--r--src/com/android/settings/SecuritySettings.java9
-rw-r--r--src/com/android/settings/SoundSettings.java9
2 files changed, 14 insertions, 4 deletions
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index dd51295..9236013 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -33,6 +33,7 @@ import android.database.Cursor;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.SystemProperties;
+import android.os.Vibrator;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
@@ -68,6 +69,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
private static final String KEY_LOCK_ENABLED = "lockenabled";
private static final String KEY_VISIBLE_PATTERN = "visiblepattern";
private static final String KEY_TACTILE_FEEDBACK_ENABLED = "unlock_tactile_feedback";
+ private static final String KEY_SECURITY_CATEGORY = "security_category";
// Encrypted File Systems constants
private static final String PROPERTY_EFS_ENABLED = "persist.security.efs.enabled";
@@ -208,6 +210,13 @@ public class SecuritySettings extends SettingsPreferenceFragment
// tactile feedback. Should be common to all unlock preference screens.
mTactileFeedback = (CheckBoxPreference) pm.findPreference(KEY_TACTILE_FEEDBACK_ENABLED);
+ if (!((Vibrator) getSystemService(Context.VIBRATOR_SERVICE)).hasVibrator()) {
+ PreferenceGroup securityCategory = (PreferenceGroup)
+ pm.findPreference(KEY_SECURITY_CATEGORY);
+ if (securityCategory != null && mTactileFeedback != null) {
+ securityCategory.removePreference(mTactileFeedback);
+ }
+ }
int activePhoneType = TelephonyManager.getDefault().getPhoneType();
diff --git a/src/com/android/settings/SoundSettings.java b/src/com/android/settings/SoundSettings.java
index 686dbe2..4c5fadf 100644
--- a/src/com/android/settings/SoundSettings.java
+++ b/src/com/android/settings/SoundSettings.java
@@ -114,10 +114,6 @@ public class SoundSettings extends SettingsPreferenceFragment implements
mVibrate = (ListPreference) findPreference(KEY_VIBRATE);
mVibrate.setOnPreferenceChangeListener(this);
- if (!((Vibrator)getSystemService(Context.VIBRATOR_SERVICE)).hasVibrator()) {
- getPreferenceScreen().removePreference(mVibrate);
- }
-
mDtmfTone = (CheckBoxPreference) findPreference(KEY_DTMF_TONE);
mDtmfTone.setPersistent(false);
mDtmfTone.setChecked(Settings.System.getInt(resolver,
@@ -135,6 +131,11 @@ public class SoundSettings extends SettingsPreferenceFragment implements
mLockSounds.setChecked(Settings.System.getInt(resolver,
Settings.System.LOCKSCREEN_SOUNDS_ENABLED, 1) != 0);
+ if (!((Vibrator) getSystemService(Context.VIBRATOR_SERVICE)).hasVibrator()) {
+ getPreferenceScreen().removePreference(mVibrate);
+ getPreferenceScreen().removePreference(mHapticFeedback);
+ }
+
if (TelephonyManager.PHONE_TYPE_CDMA == activePhoneType) {
ListPreference emergencyTonePreference =
(ListPreference) findPreference(KEY_EMERGENCY_TONE);