diff --git a/res/layout/preference_dialog_ringervolume.xml b/res/layout/preference_dialog_ringervolume.xml
index 5aebedceb64..4944f91b94b 100644
--- a/res/layout/preference_dialog_ringervolume.xml
+++ b/res/layout/preference_dialog_ringervolume.xml
@@ -32,34 +32,36 @@
android:paddingTop="20dip"
android:visibility="gone"/>
-
-
-
-
+
+ android:layout_weight="1"
+ android:visibility="gone" />
+
+
-
+ android:layout_height="wrap_content"
+ android:padding="8dip"
+ android:background="?android:attr/selectableItemBackground"
+ />
-
-
+
+ android:orientation="vertical">
-
+
+
+
+
+
+
+
+
+
+
+ android:orientation="vertical">
-
+
+
+
+
+
+
+
+
-
-
+
-
-
+
@@ -132,4 +192,4 @@
-
\ No newline at end of file
+
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 2302dcb9970..a750bd99bb2 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1399,38 +1399,24 @@
Sound
Silent mode
-
- Silence all sounds except media & alarms
-
- All sounds except media are silenced
- Incoming call ringtone
+ Phone ringtone
""
- Volume
+ Volumes
Music Effects
Ringer volume
-
- ""
Vibrate when silent
-
- Allow vibration feedback in silent mode
Vibrate
-
- Vibration feedback for calls and notifications
- Notification ringtone
-
- ""
+ Default notification
Pulse notification light
-
- Pulse trackball light repeatedly for new notifications
Ringtone
@@ -1449,33 +1435,23 @@
Audio settings for the attached dock
- Audible touch tones
-
- Play tones when using dial pad
-
- Play tones when using dial pad
+ Dial pad touch tones
- Audible selection
-
- Play sound when making screen selection
-
- Play sound when making screen selection
+ Touch sounds
- Screen lock sounds
-
- Play sounds when locking and unlocking the screen
-
- Play sounds when locking and unlocking the screen
+ Screen lock sound
- Haptic feedback
-
- Vibrate when pressing soft keys and on certain UI interactions
-
- Vibrate when pressing soft keys and on certain UI interactions
+ Vibrate on touch
Noise cancellation
-
- Suppress background noise when speaking or recording.
+
+ Music, video, games & other media
+
+ Ringtone & notifications
+
+ Notifications
+
+ Alarms
Dock
@@ -3126,9 +3102,9 @@ found in the list of installed applications.
Untitled
General
- Incoming calls
+ Ringtone & notifications
Notifications
- Feedback
+ System
diff --git a/res/xml/sound_settings.xml b/res/xml/sound_settings.xml
index ecc4af200af..c0bca2ecc40 100644
--- a/res/xml/sound_settings.xml
+++ b/res/xml/sound_settings.xml
@@ -19,15 +19,13 @@
android:key="sound_settings"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
-
-
-
+ android:streamType="ring" />
-
+ android:disableDependentsState="true" />
+ android:key="category_calls_and_notification"
+ android:title="@string/sound_category_calls_and_notification_title"/>
+
-
-
-
-
@@ -81,7 +69,6 @@
diff --git a/src/com/android/settings/RingerVolumePreference.java b/src/com/android/settings/RingerVolumePreference.java
index f850b084007..129edee386c 100644
--- a/src/com/android/settings/RingerVolumePreference.java
+++ b/src/com/android/settings/RingerVolumePreference.java
@@ -51,49 +51,46 @@ import android.widget.TextView;
* Special preference type that allows configuration of both the ring volume and
* notification volume.
*/
-public class RingerVolumePreference extends VolumePreference implements
- CheckBox.OnCheckedChangeListener, OnClickListener {
+public class RingerVolumePreference extends VolumePreference implements OnClickListener {
private static final String TAG = "RingerVolumePreference";
private static final int MSG_RINGER_MODE_CHANGED = 101;
- private CheckBox mNotificationsUseRingVolumeCheckbox;
private SeekBarVolumizer [] mSeekBarVolumizer;
private boolean mIgnoreVolumeKeys;
// These arrays must all match in length and order
private static final int[] SEEKBAR_ID = new int[] {
- R.id.notification_volume_seekbar,
R.id.media_volume_seekbar,
+ R.id.ringer_volume_seekbar,
+ R.id.notification_volume_seekbar,
R.id.alarm_volume_seekbar
};
- private static final int[] NEED_VOICE_CAPABILITY_ID = new int[] {
- R.id.ringtone_label,
- com.android.internal.R.id.seekbar,
- R.id.same_notification_volume
- };
-
private static final int[] SEEKBAR_TYPE = new int[] {
- AudioManager.STREAM_NOTIFICATION,
AudioManager.STREAM_MUSIC,
+ AudioManager.STREAM_RING,
+ AudioManager.STREAM_NOTIFICATION,
AudioManager.STREAM_ALARM
};
private static final int[] CHECKBOX_VIEW_ID = new int[] {
+ R.id.media_mute_button,
+ R.id.ringer_mute_button,
R.id.notification_mute_button,
- R.id.volume_mute_button,
R.id.alarm_mute_button
};
private static final int[] SEEKBAR_MUTED_RES_ID = new int[] {
- com.android.internal.R.drawable.ic_audio_notification_mute,
com.android.internal.R.drawable.ic_audio_vol_mute,
+ com.android.internal.R.drawable.ic_audio_ring_notif_mute,
+ com.android.internal.R.drawable.ic_audio_notification_mute,
com.android.internal.R.drawable.ic_audio_alarm_mute
};
private static final int[] SEEKBAR_UNMUTED_RES_ID = new int[] {
- com.android.internal.R.drawable.ic_audio_notification,
com.android.internal.R.drawable.ic_audio_vol,
+ com.android.internal.R.drawable.ic_audio_ring_notif,
+ com.android.internal.R.drawable.ic_audio_notification,
com.android.internal.R.drawable.ic_audio_alarm
};
@@ -167,21 +164,6 @@ public class RingerVolumePreference extends VolumePreference implements
}
}
- //mNotificationVolumeTitle = (TextView) view.findViewById(R.id.notification_volume_title);
- mNotificationsUseRingVolumeCheckbox =
- (CheckBox) view.findViewById(R.id.same_notification_volume);
- mNotificationsUseRingVolumeCheckbox.setOnCheckedChangeListener(this);
- mNotificationsUseRingVolumeCheckbox.setChecked(Settings.System.getInt(
- getContext().getContentResolver(),
- Settings.System.NOTIFICATIONS_USE_RING_VOLUME, 1) == 1);
- // Notification volume always visible for non voice capable devices
- if (Utils.isVoiceCapable(getContext())) {
- setNotificationVolumeVisibility(!mNotificationsUseRingVolumeCheckbox.isChecked());
- } else {
- setNotificationVolumeVisibility(true);
- }
- disableSettingsThatNeedVoice(view);
-
// Register callbacks for mute/unmute buttons
for (int i = 0; i < mCheckBoxes.length; i++) {
ImageView checkbox = (ImageView) view.findViewById(CHECKBOX_VIEW_ID[i]);
@@ -207,6 +189,16 @@ public class RingerVolumePreference extends VolumePreference implements
};
getContext().registerReceiver(mRingModeChangedReceiver, filter);
}
+
+ // Disable either ringer+notifications or notifications
+ int id;
+ if (!Utils.isVoiceCapable(getContext())) {
+ id = R.id.ringer_section;
+ } else {
+ id = R.id.notification_section;
+ }
+ View hideSection = view.findViewById(id);
+ hideSection.setVisibility(View.GONE);
}
private Uri getMediaVolumeUri(Context context) {
@@ -215,15 +207,6 @@ public class RingerVolumePreference extends VolumePreference implements
+ "/" + R.raw.media_volume);
}
- private void disableSettingsThatNeedVoice(View parent) {
- final boolean voiceCapable = Utils.isVoiceCapable(getContext());
- if (!voiceCapable) {
- for (int id : NEED_VOICE_CAPABILITY_ID) {
- parent.findViewById(id).setVisibility(View.GONE);
- }
- }
- }
-
@Override
protected void onDialogClosed(boolean positiveResult) {
super.onDialogClosed(positiveResult);
@@ -242,23 +225,6 @@ public class RingerVolumePreference extends VolumePreference implements
cleanup();
}
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- // ignore R.id.same_notification_volume checkbox for non voice capable devices
- if (Utils.isVoiceCapable(getContext())) {
- setNotificationVolumeVisibility(!isChecked);
-
- Settings.System.putInt(getContext().getContentResolver(),
- Settings.System.NOTIFICATIONS_USE_RING_VOLUME, isChecked ? 1 : 0);
-
- if (isChecked) {
- // The user wants the notification to be same as ring, so do a
- // one-time sync right now
- mAudioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION,
- mAudioManager.getStreamVolume(AudioManager.STREAM_RING), 0);
- }
- }
- }
-
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
boolean isdown = (event.getAction() == KeyEvent.ACTION_DOWN);
@@ -284,14 +250,6 @@ public class RingerVolumePreference extends VolumePreference implements
}
}
- private void setNotificationVolumeVisibility(boolean visible) {
- if (mSeekBarVolumizer[0] != null) {
- mSeekBarVolumizer[0].getSeekBar().setVisibility(
- visible ? View.VISIBLE : View.GONE);
- }
- // mNotificationVolumeTitle.setVisibility(visible ? View.VISIBLE : View.GONE);
- }
-
private void cleanup() {
for (int i = 0; i < SEEKBAR_ID.length; i++) {
if (mSeekBarVolumizer[i] != null) {
diff --git a/src/com/android/settings/SoundSettings.java b/src/com/android/settings/SoundSettings.java
index f6090c2bb66..d1f82478482 100644
--- a/src/com/android/settings/SoundSettings.java
+++ b/src/com/android/settings/SoundSettings.java
@@ -23,16 +23,25 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteException;
import android.media.AudioManager;
+import android.media.Ringtone;
+import android.media.RingtoneManager;
import android.media.audiofx.AudioEffect;
+import android.net.Uri;
import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
import android.os.Vibrator;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
+import android.provider.MediaStore;
import android.provider.Settings;
+import android.provider.MediaStore.Images.Media;
import android.provider.Settings.SettingNotFoundException;
import android.telephony.TelephonyManager;
import android.util.Log;
@@ -41,7 +50,7 @@ import java.util.List;
public class SoundSettings extends SettingsPreferenceFragment implements
Preference.OnPreferenceChangeListener {
- private static final String TAG = "SoundAndDisplaysSettings";
+ private static final String TAG = "SoundSettings";
/** If there is no setting in the provider, use this. */
private static final int FALLBACK_EMERGENCY_TONE_VALUE = 0;
@@ -60,7 +69,6 @@ public class SoundSettings extends SettingsPreferenceFragment implements
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";
@@ -72,6 +80,9 @@ public class SoundSettings extends SettingsPreferenceFragment implements
KEY_EMERGENCY_TONE
};
+ private static final int MSG_UPDATE_RINGTONE_SUMMARY = 1;
+ private static final int MSG_UPDATE_NOTIFICATION_SUMMARY = 2;
+
private CheckBoxPreference mSilent;
/*
@@ -88,6 +99,10 @@ public class SoundSettings extends SettingsPreferenceFragment implements
private CheckBoxPreference mNotificationPulse;
private Preference mMusicFx;
private CheckBoxPreference mLockSounds;
+ private Preference mRingtonePreference;
+ private Preference mNotificationPreference;
+
+ private Runnable mRingtoneLookupRunnable;
private AudioManager mAudioManager;
@@ -100,6 +115,19 @@ public class SoundSettings extends SettingsPreferenceFragment implements
}
};
+ private Handler mHandler = new Handler() {
+ public void handleMessage(Message msg) {
+ switch (msg.what) {
+ case MSG_UPDATE_RINGTONE_SUMMARY:
+ mRingtonePreference.setSummary((CharSequence) msg.obj);
+ break;
+ case MSG_UPDATE_NOTIFICATION_SUMMARY:
+ mNotificationPreference.setSummary((CharSequence) msg.obj);
+ break;
+ }
+ }
+ };
+
private PreferenceGroup mSoundSettings;
@Override
@@ -133,16 +161,19 @@ public class SoundSettings extends SettingsPreferenceFragment implements
mSoundEffects = (CheckBoxPreference) findPreference(KEY_SOUND_EFFECTS);
mSoundEffects.setPersistent(false);
mSoundEffects.setChecked(Settings.System.getInt(resolver,
- Settings.System.SOUND_EFFECTS_ENABLED, 0) != 0);
+ Settings.System.SOUND_EFFECTS_ENABLED, 1) != 0);
mHapticFeedback = (CheckBoxPreference) findPreference(KEY_HAPTIC_FEEDBACK);
mHapticFeedback.setPersistent(false);
mHapticFeedback.setChecked(Settings.System.getInt(resolver,
- Settings.System.HAPTIC_FEEDBACK_ENABLED, 0) != 0);
+ Settings.System.HAPTIC_FEEDBACK_ENABLED, 1) != 0);
mLockSounds = (CheckBoxPreference) findPreference(KEY_LOCK_SOUNDS);
mLockSounds.setPersistent(false);
mLockSounds.setChecked(Settings.System.getInt(resolver,
Settings.System.LOCKSCREEN_SOUNDS_ENABLED, 1) != 0);
+ mRingtonePreference = findPreference(KEY_RINGTONE);
+ mNotificationPreference = findPreference(KEY_NOTIFICATION_SOUND);
+
if (!((Vibrator) getSystemService(Context.VIBRATOR_SERVICE)).hasVibrator()) {
getPreferenceScreen().removePreference(mVibrate);
getPreferenceScreen().removePreference(mHapticFeedback);
@@ -193,6 +224,19 @@ public class SoundSettings extends SettingsPreferenceFragment implements
}
}
}
+
+ mRingtoneLookupRunnable = new Runnable() {
+ public void run() {
+ if (mRingtonePreference != null) {
+ updateRingtoneName(RingtoneManager.TYPE_RINGTONE, mRingtonePreference,
+ MSG_UPDATE_RINGTONE_SUMMARY);
+ }
+ if (mNotificationPreference != null) {
+ updateRingtoneName(RingtoneManager.TYPE_NOTIFICATION, mNotificationPreference,
+ MSG_UPDATE_NOTIFICATION_SUMMARY);
+ }
+ }
+ };
}
@Override
@@ -200,6 +244,7 @@ public class SoundSettings extends SettingsPreferenceFragment implements
super.onResume();
updateState(true);
+ lookupRingtoneNames();
IntentFilter filter = new IntentFilter(AudioManager.RINGER_MODE_CHANGED_ACTION);
getActivity().registerReceiver(mReceiver, filter);
@@ -306,13 +351,34 @@ public class SoundSettings extends SettingsPreferenceFragment implements
mVibrate.setValue(phoneVibrateSetting);
}
mVibrate.setSummary(mVibrate.getEntry());
+ }
- int silentModeStreams = Settings.System.getInt(getContentResolver(),
- Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0);
- boolean isAlarmInclSilentMode = (silentModeStreams & (1 << AudioManager.STREAM_ALARM)) != 0;
- mSilent.setSummary(isAlarmInclSilentMode ?
- R.string.silent_mode_incl_alarm_summary :
- R.string.silent_mode_summary);
+ private void updateRingtoneName(int type, Preference preference, int msg) {
+ if (preference == null) return;
+ Context context = getActivity();
+ if (context == null) return;
+ Uri ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(context, type);
+ CharSequence summary = context.getString(com.android.internal.R.string.ringtone_unknown);
+ // Is it a silent ringtone?
+ if (ringtoneUri == null) {
+ summary = context.getString(com.android.internal.R.string.ringtone_silent);
+ } else {
+ // Fetch the ringtone title from the media provider
+ try {
+ Cursor cursor = context.getContentResolver().query(ringtoneUri,
+ new String[] { MediaStore.Audio.Media.TITLE }, null, null, null);
+ if (cursor.moveToFirst()) {
+ summary = cursor.getString(0);
+ }
+ } catch (SQLiteException sqle) {
+ // Unknown title for the ringtone
+ }
+ }
+ mHandler.sendMessage(mHandler.obtainMessage(msg, summary));
+ }
+
+ private void lookupRingtoneNames() {
+ new Thread(mRingtoneLookupRunnable).start();
}
@Override