No more silent-mode tristate in Sound Settings.
Delete delete delete. Bug: 6036529 Change-Id: Ia1ec2a1740c3010ec4373bed18ce72bedcb9211b
This commit is contained in:
@@ -548,20 +548,6 @@
|
|||||||
<item>auto</item>
|
<item>auto</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<!-- Silent mode options. -->
|
|
||||||
<string-array name="silent_mode_entries">
|
|
||||||
<item>Off</item>
|
|
||||||
<item>Vibrate</item>
|
|
||||||
<item>Mute</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<!-- Values for Silent mode. Do not translate. -->
|
|
||||||
<string-array name="silent_mode_values" translatable="false">
|
|
||||||
<item>off</item>
|
|
||||||
<item>vibrate</item>
|
|
||||||
<item>mute</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<!-- Titles for the list of long press timeout options. -->
|
<!-- Titles for the list of long press timeout options. -->
|
||||||
<string-array name="long_press_timeout_selector_titles">
|
<string-array name="long_press_timeout_selector_titles">
|
||||||
<!-- A title for the option for short long-press timeout [CHAR LIMIT=25] -->
|
<!-- A title for the option for short long-press timeout [CHAR LIMIT=25] -->
|
||||||
|
@@ -1534,8 +1534,6 @@
|
|||||||
<string name="display_settings_title">Display</string>
|
<string name="display_settings_title">Display</string>
|
||||||
<!-- Sound settings screen heading -->
|
<!-- Sound settings screen heading -->
|
||||||
<string name="sound_settings">Sound</string>
|
<string name="sound_settings">Sound</string>
|
||||||
<!-- Sound settings screen, setting option name checkbox -->
|
|
||||||
<string name="silent_mode_title">Silent mode</string>
|
|
||||||
<!-- Sound settings screen, setting option name to pick ringtone (a list dialog comes up)-->
|
<!-- Sound settings screen, setting option name to pick ringtone (a list dialog comes up)-->
|
||||||
<string name="ringtone_title">Phone ringtone</string>
|
<string name="ringtone_title">Phone ringtone</string>
|
||||||
<!-- Sound settings screen, setting option summary text -->
|
<!-- Sound settings screen, setting option summary text -->
|
||||||
|
@@ -26,12 +26,6 @@
|
|||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:streamType="ring" />
|
android:streamType="ring" />
|
||||||
|
|
||||||
<ListPreference
|
|
||||||
android:key="silent_mode"
|
|
||||||
android:title="@string/silent_mode_title"
|
|
||||||
android:entries="@array/silent_mode_entries"
|
|
||||||
android:entryValues="@array/silent_mode_values" />
|
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="musicfx"
|
android:key="musicfx"
|
||||||
android:title="@string/musicfx_title">
|
android:title="@string/musicfx_title">
|
||||||
|
@@ -16,17 +16,14 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.sqlite.SQLiteException;
|
import android.database.sqlite.SQLiteException;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.media.Ringtone;
|
|
||||||
import android.media.RingtoneManager;
|
import android.media.RingtoneManager;
|
||||||
import android.media.audiofx.AudioEffect;
|
import android.media.audiofx.AudioEffect;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@@ -41,8 +38,6 @@ import android.preference.PreferenceGroup;
|
|||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.provider.MediaStore.Images.Media;
|
|
||||||
import android.provider.Settings.SettingNotFoundException;
|
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
@@ -55,7 +50,6 @@ public class SoundSettings extends SettingsPreferenceFragment implements
|
|||||||
/** If there is no setting in the provider, use this. */
|
/** If there is no setting in the provider, use this. */
|
||||||
private static final int FALLBACK_EMERGENCY_TONE_VALUE = 0;
|
private static final int FALLBACK_EMERGENCY_TONE_VALUE = 0;
|
||||||
|
|
||||||
private static final String KEY_SILENT_MODE = "silent_mode";
|
|
||||||
private static final String KEY_VIBRATE = "vibrate_when_ringing";
|
private static final String KEY_VIBRATE = "vibrate_when_ringing";
|
||||||
private static final String KEY_RING_VOLUME = "ring_volume";
|
private static final String KEY_RING_VOLUME = "ring_volume";
|
||||||
private static final String KEY_MUSICFX = "musicfx";
|
private static final String KEY_MUSICFX = "musicfx";
|
||||||
@@ -69,10 +63,6 @@ public class SoundSettings extends SettingsPreferenceFragment implements
|
|||||||
private static final String KEY_NOTIFICATION_SOUND = "notification_sound";
|
private static final String KEY_NOTIFICATION_SOUND = "notification_sound";
|
||||||
private static final String KEY_CATEGORY_CALLS = "category_calls_and_notification";
|
private static final String KEY_CATEGORY_CALLS = "category_calls_and_notification";
|
||||||
|
|
||||||
private static final String SILENT_MODE_OFF = "off";
|
|
||||||
private static final String SILENT_MODE_VIBRATE = "vibrate";
|
|
||||||
private static final String SILENT_MODE_MUTE = "mute";
|
|
||||||
|
|
||||||
private static final String[] NEED_VOICE_CAPABILITY = {
|
private static final String[] NEED_VOICE_CAPABILITY = {
|
||||||
KEY_RINGTONE, KEY_DTMF_TONE, KEY_CATEGORY_CALLS,
|
KEY_RINGTONE, KEY_DTMF_TONE, KEY_CATEGORY_CALLS,
|
||||||
KEY_EMERGENCY_TONE
|
KEY_EMERGENCY_TONE
|
||||||
@@ -82,7 +72,6 @@ public class SoundSettings extends SettingsPreferenceFragment implements
|
|||||||
private static final int MSG_UPDATE_NOTIFICATION_SUMMARY = 2;
|
private static final int MSG_UPDATE_NOTIFICATION_SUMMARY = 2;
|
||||||
|
|
||||||
private CheckBoxPreference mVibrateWhenRinging;
|
private CheckBoxPreference mVibrateWhenRinging;
|
||||||
private ListPreference mSilentMode;
|
|
||||||
private CheckBoxPreference mDtmfTone;
|
private CheckBoxPreference mDtmfTone;
|
||||||
private CheckBoxPreference mSoundEffects;
|
private CheckBoxPreference mSoundEffects;
|
||||||
private CheckBoxPreference mHapticFeedback;
|
private CheckBoxPreference mHapticFeedback;
|
||||||
@@ -95,15 +84,6 @@ public class SoundSettings extends SettingsPreferenceFragment implements
|
|||||||
|
|
||||||
private AudioManager mAudioManager;
|
private AudioManager mAudioManager;
|
||||||
|
|
||||||
private BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
if (intent.getAction().equals(AudioManager.RINGER_MODE_CHANGED_ACTION)) {
|
|
||||||
updateState(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private Handler mHandler = new Handler() {
|
private Handler mHandler = new Handler() {
|
||||||
public void handleMessage(Message msg) {
|
public void handleMessage(Message msg) {
|
||||||
switch (msg.what) {
|
switch (msg.what) {
|
||||||
@@ -134,12 +114,8 @@ public class SoundSettings extends SettingsPreferenceFragment implements
|
|||||||
getPreferenceScreen().removePreference(findPreference(KEY_EMERGENCY_TONE));
|
getPreferenceScreen().removePreference(findPreference(KEY_EMERGENCY_TONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
mSilentMode = (ListPreference) findPreference(KEY_SILENT_MODE);
|
|
||||||
if (!getResources().getBoolean(R.bool.has_silent_mode)) {
|
if (!getResources().getBoolean(R.bool.has_silent_mode)) {
|
||||||
getPreferenceScreen().removePreference(mSilentMode);
|
|
||||||
findPreference(KEY_RING_VOLUME).setDependency(null);
|
findPreference(KEY_RING_VOLUME).setDependency(null);
|
||||||
} else {
|
|
||||||
mSilentMode.setOnPreferenceChangeListener(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mVibrateWhenRinging = (CheckBoxPreference) findPreference(KEY_VIBRATE);
|
mVibrateWhenRinging = (CheckBoxPreference) findPreference(KEY_VIBRATE);
|
||||||
@@ -223,50 +199,7 @@ public class SoundSettings extends SettingsPreferenceFragment implements
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
updateState(true);
|
|
||||||
lookupRingtoneNames();
|
lookupRingtoneNames();
|
||||||
|
|
||||||
IntentFilter filter = new IntentFilter(AudioManager.RINGER_MODE_CHANGED_ACTION);
|
|
||||||
getActivity().registerReceiver(mReceiver, filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPause() {
|
|
||||||
super.onPause();
|
|
||||||
|
|
||||||
getActivity().unregisterReceiver(mReceiver);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setPhoneSilentSettingValue(String value) {
|
|
||||||
int ringerMode = AudioManager.RINGER_MODE_NORMAL;
|
|
||||||
if (value.equals(SILENT_MODE_MUTE)) {
|
|
||||||
ringerMode = AudioManager.RINGER_MODE_SILENT;
|
|
||||||
} else if (value.equals(SILENT_MODE_VIBRATE)) {
|
|
||||||
ringerMode = AudioManager.RINGER_MODE_VIBRATE;
|
|
||||||
}
|
|
||||||
mAudioManager.setRingerMode(ringerMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getPhoneSilentModeSettingValue() {
|
|
||||||
switch (mAudioManager.getRingerMode()) {
|
|
||||||
case AudioManager.RINGER_MODE_NORMAL:
|
|
||||||
return SILENT_MODE_OFF;
|
|
||||||
case AudioManager.RINGER_MODE_VIBRATE:
|
|
||||||
return SILENT_MODE_VIBRATE;
|
|
||||||
case AudioManager.RINGER_MODE_SILENT:
|
|
||||||
return SILENT_MODE_MUTE;
|
|
||||||
}
|
|
||||||
// Shouldn't happen
|
|
||||||
return SILENT_MODE_OFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
// updateState in fact updates the UI to reflect the system state
|
|
||||||
private void updateState(boolean force) {
|
|
||||||
if (getActivity() == null) return;
|
|
||||||
|
|
||||||
mSilentMode.setValue(getPhoneSilentModeSettingValue());
|
|
||||||
|
|
||||||
mSilentMode.setSummary(mSilentMode.getEntry());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateRingtoneName(int type, Preference preference, int msg) {
|
private void updateRingtoneName(int type, Preference preference, int msg) {
|
||||||
@@ -344,8 +277,6 @@ public class SoundSettings extends SettingsPreferenceFragment implements
|
|||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Log.e(TAG, "could not persist emergency tone setting", e);
|
Log.e(TAG, "could not persist emergency tone setting", e);
|
||||||
}
|
}
|
||||||
} else if (preference == mSilentMode) {
|
|
||||||
setPhoneSilentSettingValue(objValue.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user