Fix issue 5012047: silent mode mutes music
Always display notification volume seek bar and ignore "use ringtone volume for notifications" check box on non voice capable devices (tablets). Change-Id: I379eb6858594a271b9ee11a2359bfdc27153c5af
This commit is contained in:
@@ -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);
|
||||||
setNotificationVolumeVisibility(!mNotificationsUseRingVolumeCheckbox.isChecked());
|
// Notification volume always visible for non voice capable devices
|
||||||
|
if (Utils.isVoiceCapable(getContext())) {
|
||||||
|
setNotificationVolumeVisibility(!mNotificationsUseRingVolumeCheckbox.isChecked());
|
||||||
|
} else {
|
||||||
|
setNotificationVolumeVisibility(true);
|
||||||
|
}
|
||||||
disableSettingsThatNeedVoice(view);
|
disableSettingsThatNeedVoice(view);
|
||||||
|
|
||||||
// Register callbacks for mute/unmute buttons
|
// Register callbacks for mute/unmute buttons
|
||||||
@@ -240,16 +243,19 @@ public class RingerVolumePreference extends VolumePreference implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
setNotificationVolumeVisibility(!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.putInt(getContext().getContentResolver(),
|
||||||
Settings.System.NOTIFICATIONS_USE_RING_VOLUME, isChecked ? 1 : 0);
|
Settings.System.NOTIFICATIONS_USE_RING_VOLUME, isChecked ? 1 : 0);
|
||||||
|
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
// The user wants the notification to be same as ring, so do a
|
// The user wants the notification to be same as ring, so do a
|
||||||
// one-time sync right now
|
// one-time sync right now
|
||||||
mAudioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION,
|
mAudioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION,
|
||||||
mAudioManager.getStreamVolume(AudioManager.STREAM_RING), 0);
|
mAudioManager.getStreamVolume(AudioManager.STREAM_RING), 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user