summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/SoundSettings.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/settings/SoundSettings.java')
-rw-r--r--src/com/android/settings/SoundSettings.java38
1 files changed, 25 insertions, 13 deletions
diff --git a/src/com/android/settings/SoundSettings.java b/src/com/android/settings/SoundSettings.java
index a735268b1..8582f171f 100644
--- a/src/com/android/settings/SoundSettings.java
+++ b/src/com/android/settings/SoundSettings.java
@@ -23,26 +23,21 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.media.AudioManager;
import android.os.Bundle;
-import android.os.RemoteException;
-import android.os.ServiceManager;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
-import android.preference.PreferenceActivity;
import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.telephony.TelephonyManager;
import android.util.Log;
-import android.view.IWindowManager;
-public class SoundSettings extends PreferenceActivity implements
+public class SoundSettings extends SettingsPreferenceFragment implements
Preference.OnPreferenceChangeListener {
private static final String TAG = "SoundAndDisplaysSettings";
/** If there is no setting in the provider, use this. */
- private static final int FALLBACK_SCREEN_TIMEOUT_VALUE = 30000;
private static final int FALLBACK_EMERGENCY_TONE_VALUE = 0;
private static final String KEY_SILENT = "silent";
@@ -54,12 +49,21 @@ public class SoundSettings extends PreferenceActivity implements
private static final String KEY_SOUND_SETTINGS = "sound_settings";
private static final String KEY_NOTIFICATION_PULSE = "notification_pulse";
private static final String KEY_LOCK_SOUNDS = "lock_sounds";
+ private static final String KEY_RINGTONE = "ringtone";
+ private static final String KEY_NOTIFICATION_SOUND = "notification_sound";
+ private static final String KEY_CATEGORY_CALLS = "category_calls";
+ private static final String KEY_CATEGORY_NOTIFICATION = "category_notification";
private static final String VALUE_VIBRATE_NEVER = "never";
private static final String VALUE_VIBRATE_ALWAYS = "always";
private static final String VALUE_VIBRATE_ONLY_SILENT = "silent";
private static final String VALUE_VIBRATE_UNLESS_SILENT = "notsilent";
+ private static final String[] NEED_VOICE_CAPABILITY = {
+ KEY_RINGTONE, KEY_DTMF_TONE, KEY_CATEGORY_CALLS,
+ KEY_EMERGENCY_TONE
+ };
+
private CheckBoxPreference mSilent;
/*
@@ -90,7 +94,7 @@ public class SoundSettings extends PreferenceActivity implements
private PreferenceGroup mSoundSettings;
@Override
- protected void onCreate(Bundle savedInstanceState) {
+ public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ContentResolver resolver = getContentResolver();
int activePhoneType = TelephonyManager.getDefault().getPhoneType();
@@ -137,8 +141,8 @@ public class SoundSettings extends PreferenceActivity implements
mSoundSettings = (PreferenceGroup) findPreference(KEY_SOUND_SETTINGS);
mNotificationPulse = (CheckBoxPreference)
mSoundSettings.findPreference(KEY_NOTIFICATION_PULSE);
- if (mNotificationPulse != null &&
- getResources().getBoolean(R.bool.has_intrusive_led) == false) {
+ if (mNotificationPulse != null
+ && getResources().getBoolean(R.bool.has_intrusive_led) == false) {
mSoundSettings.removePreference(mNotificationPulse);
} else {
try {
@@ -150,23 +154,31 @@ public class SoundSettings extends PreferenceActivity implements
}
}
+ if (!Utils.isVoiceCapable(getActivity())) {
+ for (String prefKey : NEED_VOICE_CAPABILITY) {
+ Preference pref = findPreference(prefKey);
+ if (pref != null) {
+ getPreferenceScreen().removePreference(pref);
+ }
+ }
+ }
}
@Override
- protected void onResume() {
+ public void onResume() {
super.onResume();
updateState(true);
IntentFilter filter = new IntentFilter(AudioManager.RINGER_MODE_CHANGED_ACTION);
- registerReceiver(mReceiver, filter);
+ getActivity().registerReceiver(mReceiver, filter);
}
@Override
- protected void onPause() {
+ public void onPause() {
super.onPause();
- unregisterReceiver(mReceiver);
+ getActivity().unregisterReceiver(mReceiver);
}
private String getPhoneVibrateSettingValue() {