Loading res/values/bools.xml +2 −0 Original line number Diff line number Diff line Loading @@ -18,4 +18,6 @@ <!-- Whether or not there is a notification led that is too intrusive to be pulsing constantly --> <bool name="has_intrusive_led">false</bool> <!-- Whether or not the dock settings are to be displayed for this device when docked --> <bool name="has_dock_settings">false</bool> </resources> res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -894,6 +894,8 @@ <string name="media_volume_title">Media volume</string> <!-- Sound settings screen, setting option summary text --> <string name="media_volume_summary">Set volume for music and videos</string> <!-- Sound settings screen, dock settings --> <string name="dock_settings_title">Dock settings</string> <!-- Sound settings screen, setting check box label --> <string name="dtmf_tone_enable_title">Audible touch tones</string> <!-- Sound settings screen, setting option summary text when check box is selected --> Loading res/xml/sound_and_display_settings.xml +25 −4 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ android:title="@string/silent_mode_title" android:summary="@string/silent_mode_summary" android:persistent="false" android:order="1" android:disableDependentsState="true" /> <com.android.settings.RingerVolumePreference Loading @@ -34,6 +35,7 @@ android:dialogTitle="@string/ring_volume_title" android:persistent="false" android:dependency="silent" android:order="2" android:streamType="ring" /> <VolumePreference Loading @@ -42,8 +44,19 @@ android:summary="@string/media_volume_summary" android:dialogTitle="@string/media_volume_title" android:persistent="false" android:order="3" android:streamType="music" /> <PreferenceScreen android:key="dock_settings" android:order="4" android:title="@string/dock_settings_title"> <intent android:action="android.intent.action.MAIN" android:targetPackage="com.android.settings" android:targetClass="com.android.settings.bluetooth.DockSettingsActivity" /> </PreferenceScreen> <com.android.settings.DefaultRingtonePreference android:key="ringtone" android:title="@string/ringtone_title" Loading @@ -51,12 +64,14 @@ android:dialogTitle="@string/ringtone_title" android:persistent="false" android:dependency="silent" android:order="5" android:ringtoneType="ringtone" /> <CheckBoxPreference android:key="vibrate" android:title="@string/vibrate_title" android:summary="@string/vibrate_summary" android:order="6" android:persistent="false" /> <com.android.settings.DefaultRingtonePreference Loading @@ -66,12 +81,14 @@ android:dialogTitle="@string/notification_sound_dialog_title" android:dependency="silent" android:persistent="false" android:order="7" android:ringtoneType="notification" /> <CheckBoxPreference android:key="notification_pulse" android:title="@string/notification_pulse_title" android:summary="@string/notification_pulse_summary" android:order="8" android:persistent="false" /> <CheckBoxPreference Loading @@ -80,6 +97,7 @@ android:summaryOn="@string/dtmf_tone_enable_summary_on" android:summaryOff="@string/dtmf_tone_enable_summary_off" android:dependency="silent" android:order="9" android:defaultValue="true" /> <CheckBoxPreference Loading @@ -88,6 +106,7 @@ android:summaryOn="@string/sound_effects_enable_summary_on" android:summaryOff="@string/sound_effects_enable_summary_off" android:dependency="silent" android:order="10" android:defaultValue="true" /> <CheckBoxPreference Loading @@ -96,6 +115,7 @@ android:summaryOn="@string/haptic_feedback_enable_summary_on" android:summaryOff="@string/haptic_feedback_enable_summary_off" android:dependency="silent" android:order="11" android:defaultValue="true" /> <CheckBoxPreference Loading @@ -104,6 +124,7 @@ android:summaryOn="@string/play_media_notification_sounds_enable_summary_on" android:summaryOff="@string/play_media_notification_sounds_enable_summary_off" android:dependency="silent" android:order="12" android:defaultValue="true" /> </PreferenceCategory> Loading src/com/android/settings/SoundAndDisplaySettings.java +48 −5 Original line number Diff line number Diff line Loading @@ -60,11 +60,15 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements private static final String KEY_EMERGENCY_TONE = "emergency_tone"; private static final String KEY_SOUND_SETTINGS = "sound_settings"; private static final String KEY_NOTIFICATION_PULSE = "notification_pulse"; private static final String KEY_DOCK_SETTINGS = "dock_settings"; private CheckBoxPreference mSilent; private CheckBoxPreference mPlayMediaNotificationSounds; private Preference mDockSettings; private boolean mHasDockSettings; private IMountService mMountService = null; /* Loading @@ -90,10 +94,16 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements private BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(AudioManager.RINGER_MODE_CHANGED_ACTION)) { updateState(false); } else if (intent.getAction().equals(Intent.ACTION_DOCK_EVENT)) { handleDockChange(intent); } } }; private PreferenceGroup mSoundSettings; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Loading Loading @@ -147,12 +157,12 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements emergencyTonePreference.setOnPreferenceChangeListener(this); } PreferenceGroup soundSettings = (PreferenceGroup) findPreference(KEY_SOUND_SETTINGS); mSoundSettings = (PreferenceGroup) findPreference(KEY_SOUND_SETTINGS); mNotificationPulse = (CheckBoxPreference) soundSettings.findPreference(KEY_NOTIFICATION_PULSE); if (mNotificationPulse != null && soundSettings != null && mSoundSettings.findPreference(KEY_NOTIFICATION_PULSE); if (mNotificationPulse != null && getResources().getBoolean(R.bool.has_intrusive_led) == false) { soundSettings.removePreference(mNotificationPulse); mSoundSettings.removePreference(mNotificationPulse); } else { try { mNotificationPulse.setChecked(Settings.System.getInt(resolver, Loading @@ -162,6 +172,8 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements Log.e(TAG, Settings.System.NOTIFICATION_LIGHT_PULSE + " not found"); } } initDockSettings(); } @Override Loading @@ -171,6 +183,12 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements updateState(true); IntentFilter filter = new IntentFilter(AudioManager.RINGER_MODE_CHANGED_ACTION); if (mHasDockSettings) { if (mDockSettings != null) { mSoundSettings.removePreference(mDockSettings); } filter.addAction(Intent.ACTION_DOCK_EVENT); } registerReceiver(mReceiver, filter); } Loading @@ -181,6 +199,31 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements unregisterReceiver(mReceiver); } private void initDockSettings() { mDockSettings = mSoundSettings.findPreference(KEY_DOCK_SETTINGS); mHasDockSettings = getResources().getBoolean(R.bool.has_dock_settings); if (mDockSettings != null) { mSoundSettings.removePreference(mDockSettings); // Don't care even if we dock if (getResources().getBoolean(R.bool.has_dock_settings) == false) { mDockSettings = null; } } } private void handleDockChange(Intent intent) { if (mHasDockSettings && mDockSettings != null) { int dockState = intent.getIntExtra(Intent.EXTRA_DOCK_STATE, 0); if (dockState != Intent.EXTRA_DOCK_STATE_UNDOCKED) { // Show dock settings item mSoundSettings.addPreference(mDockSettings); } else { // Remove dock settings item mSoundSettings.removePreference(mDockSettings); } } } private void updateState(boolean force) { final int ringerMode = mAudioManager.getRingerMode(); final boolean silentOrVibrateMode = Loading Loading
res/values/bools.xml +2 −0 Original line number Diff line number Diff line Loading @@ -18,4 +18,6 @@ <!-- Whether or not there is a notification led that is too intrusive to be pulsing constantly --> <bool name="has_intrusive_led">false</bool> <!-- Whether or not the dock settings are to be displayed for this device when docked --> <bool name="has_dock_settings">false</bool> </resources>
res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -894,6 +894,8 @@ <string name="media_volume_title">Media volume</string> <!-- Sound settings screen, setting option summary text --> <string name="media_volume_summary">Set volume for music and videos</string> <!-- Sound settings screen, dock settings --> <string name="dock_settings_title">Dock settings</string> <!-- Sound settings screen, setting check box label --> <string name="dtmf_tone_enable_title">Audible touch tones</string> <!-- Sound settings screen, setting option summary text when check box is selected --> Loading
res/xml/sound_and_display_settings.xml +25 −4 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ android:title="@string/silent_mode_title" android:summary="@string/silent_mode_summary" android:persistent="false" android:order="1" android:disableDependentsState="true" /> <com.android.settings.RingerVolumePreference Loading @@ -34,6 +35,7 @@ android:dialogTitle="@string/ring_volume_title" android:persistent="false" android:dependency="silent" android:order="2" android:streamType="ring" /> <VolumePreference Loading @@ -42,8 +44,19 @@ android:summary="@string/media_volume_summary" android:dialogTitle="@string/media_volume_title" android:persistent="false" android:order="3" android:streamType="music" /> <PreferenceScreen android:key="dock_settings" android:order="4" android:title="@string/dock_settings_title"> <intent android:action="android.intent.action.MAIN" android:targetPackage="com.android.settings" android:targetClass="com.android.settings.bluetooth.DockSettingsActivity" /> </PreferenceScreen> <com.android.settings.DefaultRingtonePreference android:key="ringtone" android:title="@string/ringtone_title" Loading @@ -51,12 +64,14 @@ android:dialogTitle="@string/ringtone_title" android:persistent="false" android:dependency="silent" android:order="5" android:ringtoneType="ringtone" /> <CheckBoxPreference android:key="vibrate" android:title="@string/vibrate_title" android:summary="@string/vibrate_summary" android:order="6" android:persistent="false" /> <com.android.settings.DefaultRingtonePreference Loading @@ -66,12 +81,14 @@ android:dialogTitle="@string/notification_sound_dialog_title" android:dependency="silent" android:persistent="false" android:order="7" android:ringtoneType="notification" /> <CheckBoxPreference android:key="notification_pulse" android:title="@string/notification_pulse_title" android:summary="@string/notification_pulse_summary" android:order="8" android:persistent="false" /> <CheckBoxPreference Loading @@ -80,6 +97,7 @@ android:summaryOn="@string/dtmf_tone_enable_summary_on" android:summaryOff="@string/dtmf_tone_enable_summary_off" android:dependency="silent" android:order="9" android:defaultValue="true" /> <CheckBoxPreference Loading @@ -88,6 +106,7 @@ android:summaryOn="@string/sound_effects_enable_summary_on" android:summaryOff="@string/sound_effects_enable_summary_off" android:dependency="silent" android:order="10" android:defaultValue="true" /> <CheckBoxPreference Loading @@ -96,6 +115,7 @@ android:summaryOn="@string/haptic_feedback_enable_summary_on" android:summaryOff="@string/haptic_feedback_enable_summary_off" android:dependency="silent" android:order="11" android:defaultValue="true" /> <CheckBoxPreference Loading @@ -104,6 +124,7 @@ android:summaryOn="@string/play_media_notification_sounds_enable_summary_on" android:summaryOff="@string/play_media_notification_sounds_enable_summary_off" android:dependency="silent" android:order="12" android:defaultValue="true" /> </PreferenceCategory> Loading
src/com/android/settings/SoundAndDisplaySettings.java +48 −5 Original line number Diff line number Diff line Loading @@ -60,11 +60,15 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements private static final String KEY_EMERGENCY_TONE = "emergency_tone"; private static final String KEY_SOUND_SETTINGS = "sound_settings"; private static final String KEY_NOTIFICATION_PULSE = "notification_pulse"; private static final String KEY_DOCK_SETTINGS = "dock_settings"; private CheckBoxPreference mSilent; private CheckBoxPreference mPlayMediaNotificationSounds; private Preference mDockSettings; private boolean mHasDockSettings; private IMountService mMountService = null; /* Loading @@ -90,10 +94,16 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements private BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(AudioManager.RINGER_MODE_CHANGED_ACTION)) { updateState(false); } else if (intent.getAction().equals(Intent.ACTION_DOCK_EVENT)) { handleDockChange(intent); } } }; private PreferenceGroup mSoundSettings; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Loading Loading @@ -147,12 +157,12 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements emergencyTonePreference.setOnPreferenceChangeListener(this); } PreferenceGroup soundSettings = (PreferenceGroup) findPreference(KEY_SOUND_SETTINGS); mSoundSettings = (PreferenceGroup) findPreference(KEY_SOUND_SETTINGS); mNotificationPulse = (CheckBoxPreference) soundSettings.findPreference(KEY_NOTIFICATION_PULSE); if (mNotificationPulse != null && soundSettings != null && mSoundSettings.findPreference(KEY_NOTIFICATION_PULSE); if (mNotificationPulse != null && getResources().getBoolean(R.bool.has_intrusive_led) == false) { soundSettings.removePreference(mNotificationPulse); mSoundSettings.removePreference(mNotificationPulse); } else { try { mNotificationPulse.setChecked(Settings.System.getInt(resolver, Loading @@ -162,6 +172,8 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements Log.e(TAG, Settings.System.NOTIFICATION_LIGHT_PULSE + " not found"); } } initDockSettings(); } @Override Loading @@ -171,6 +183,12 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements updateState(true); IntentFilter filter = new IntentFilter(AudioManager.RINGER_MODE_CHANGED_ACTION); if (mHasDockSettings) { if (mDockSettings != null) { mSoundSettings.removePreference(mDockSettings); } filter.addAction(Intent.ACTION_DOCK_EVENT); } registerReceiver(mReceiver, filter); } Loading @@ -181,6 +199,31 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements unregisterReceiver(mReceiver); } private void initDockSettings() { mDockSettings = mSoundSettings.findPreference(KEY_DOCK_SETTINGS); mHasDockSettings = getResources().getBoolean(R.bool.has_dock_settings); if (mDockSettings != null) { mSoundSettings.removePreference(mDockSettings); // Don't care even if we dock if (getResources().getBoolean(R.bool.has_dock_settings) == false) { mDockSettings = null; } } } private void handleDockChange(Intent intent) { if (mHasDockSettings && mDockSettings != null) { int dockState = intent.getIntExtra(Intent.EXTRA_DOCK_STATE, 0); if (dockState != Intent.EXTRA_DOCK_STATE_UNDOCKED) { // Show dock settings item mSoundSettings.addPreference(mDockSettings); } else { // Remove dock settings item mSoundSettings.removePreference(mDockSettings); } } } private void updateState(boolean force) { final int ringerMode = mAudioManager.getRingerMode(); final boolean silentOrVibrateMode = Loading