Merge branch 'readonly-p4-master'

This commit is contained in:
Patrick Scott
2009-04-13 09:59:09 -07:00
committed by The Android Open Source Project
6 changed files with 85 additions and 16 deletions

View File

@@ -31,8 +31,9 @@ import android.util.Log;
* The chosen ringtone's URI will be persisted as a string.
* <p>
* If the user chooses the "Default" item, the saved string will be one of
* {@link System#DEFAULT_RINGTONE_URI} or
* {@link System#DEFAULT_NOTIFICATION_URI}. If the user chooses the "Silent"
* {@link System#DEFAULT_RINGTONE_URI},
* {@link System#DEFAULT_NOTIFICATION_URI}, or
* {@link System#DEFAULT_ALARM_ALERT_URI}. If the user chooses the "Silent"
* item, the saved string will be an empty string.
*
* @attr ref android.R.styleable#RingtonePreference_ringtoneType

View File

@@ -22,6 +22,7 @@ import android.database.ContentObserver;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.provider.Settings;
@@ -147,10 +148,16 @@ public class VolumePreference extends SeekBarPreference implements
System.getUriFor(System.VOLUME_SETTINGS[mStreamType]),
false, mVolumeObserver);
mRingtone = RingtoneManager.getRingtone(mContext,
mStreamType == AudioManager.STREAM_NOTIFICATION
? Settings.System.DEFAULT_NOTIFICATION_URI
: Settings.System.DEFAULT_RINGTONE_URI);
Uri defaultUri = null;
if (mStreamType == AudioManager.STREAM_RING) {
defaultUri = Settings.System.DEFAULT_RINGTONE_URI;
} else if (mStreamType == AudioManager.STREAM_NOTIFICATION) {
defaultUri = Settings.System.DEFAULT_NOTIFICATION_URI;
} else {
defaultUri = Settings.System.DEFAULT_ALARM_ALERT_URI;
}
mRingtone = RingtoneManager.getRingtone(mContext, defaultUri);
mRingtone.setStreamType(mStreamType);
}

View File

@@ -1181,6 +1181,22 @@ public final class Settings {
*/
public static final Uri DEFAULT_NOTIFICATION_URI = getUriFor(NOTIFICATION_SOUND);
/**
* Persistent store for the system-wide default alarm alert.
*
* @see #RINGTONE
* @see #DEFAULT_ALARM_ALERT_URI
*/
public static final String ALARM_ALERT = "alarm_alert";
/**
* A {@link Uri} that will point to the current default alarm alert at
* any given time.
*
* @see #DEFAULT_ALARM_ALERT_URI
*/
public static final Uri DEFAULT_ALARM_ALERT_URI = getUriFor(ALARM_ALERT);
/**
* Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off
*/