Merge "Fix issue 5012047: silent mode mutes music"

This commit is contained in:
Eric Laurent
2011-07-20 11:04:31 -07:00
committed by Android (Google) Code Review

View File

@@ -171,12 +171,15 @@ public class RingerVolumePreference extends VolumePreference implements
mNotificationsUseRingVolumeCheckbox = mNotificationsUseRingVolumeCheckbox =
(CheckBox) view.findViewById(R.id.same_notification_volume); (CheckBox) view.findViewById(R.id.same_notification_volume);
mNotificationsUseRingVolumeCheckbox.setOnCheckedChangeListener(this); mNotificationsUseRingVolumeCheckbox.setOnCheckedChangeListener(this);
mNotificationsUseRingVolumeCheckbox.setChecked( mNotificationsUseRingVolumeCheckbox.setChecked(Settings.System.getInt(
Utils.isVoiceCapable(getContext())
&& Settings.System.getInt(
getContext().getContentResolver(), getContext().getContentResolver(),
Settings.System.NOTIFICATIONS_USE_RING_VOLUME, 1) == 1); Settings.System.NOTIFICATIONS_USE_RING_VOLUME, 1) == 1);
// Notification volume always visible for non voice capable devices
if (Utils.isVoiceCapable(getContext())) {
setNotificationVolumeVisibility(!mNotificationsUseRingVolumeCheckbox.isChecked()); setNotificationVolumeVisibility(!mNotificationsUseRingVolumeCheckbox.isChecked());
} else {
setNotificationVolumeVisibility(true);
}
disableSettingsThatNeedVoice(view); disableSettingsThatNeedVoice(view);
// Register callbacks for mute/unmute buttons // Register callbacks for mute/unmute buttons
@@ -240,6 +243,8 @@ public class RingerVolumePreference extends VolumePreference implements
} }
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { 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); setNotificationVolumeVisibility(!isChecked);
Settings.System.putInt(getContext().getContentResolver(), Settings.System.putInt(getContext().getContentResolver(),
@@ -252,6 +257,7 @@ public class RingerVolumePreference extends VolumePreference implements
mAudioManager.getStreamVolume(AudioManager.STREAM_RING), 0); mAudioManager.getStreamVolume(AudioManager.STREAM_RING), 0);
} }
} }
}
@Override @Override
public boolean onKey(View v, int keyCode, KeyEvent event) { public boolean onKey(View v, int keyCode, KeyEvent event) {