Merge "Conditional remove "haptic" settings if there's no vibrator"
This commit is contained in:
committed by
Android (Google) Code Review
commit
7eb31c76a3
@@ -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();
|
||||
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user