am dfe80441: Merge "Audio policy: setting explicit non-zero volume unmutes the stream." into mnc-dev

* commit 'dfe804416014c713df270d94f9c1c0f345eabb84':
  Audio policy: setting explicit non-zero volume unmutes the stream.
This commit is contained in:
John Spurlock
2015-06-03 17:40:47 +00:00
committed by Android Git Automerger
2 changed files with 5 additions and 17 deletions

View File

@@ -726,11 +726,6 @@ public class VolumeDialog {
}
row.slider.setProgress(newProgress);
}
if (mAutomute && mShowing) {
if (vlevel == 0 && !row.ss.muted && row.stream == AudioManager.STREAM_MUSIC) {
mController.setStreamMute(row.stream, true);
}
}
}
}
@@ -934,16 +929,6 @@ public class VolumeDialog {
final int userLevel = getImpliedLevel(seekBar, progress);
if (mRow.ss.level != userLevel || mRow.ss.muted && userLevel > 0) {
mRow.userAttempt = SystemClock.uptimeMillis();
if (mAutomute) {
if (mRow.stream != AudioManager.STREAM_RING) {
if (userLevel > 0 && mRow.ss.muted) {
mController.setStreamMute(mRow.stream, false);
}
if (userLevel == 0 && mRow.ss.muteSupported && !mRow.ss.muted) {
mController.setStreamMute(mRow.stream, true);
}
}
}
if (mRow.requestedLevel != userLevel) {
mController.setStreamVolume(mRow.stream, userLevel);
mRow.requestedLevel = userLevel;

View File

@@ -1368,10 +1368,11 @@ public class AudioService extends IAudioService.Stub {
private void onSetStreamVolume(int streamType, int index, int flags, int device,
String caller) {
setStreamVolumeInt(mStreamVolumeAlias[streamType], index, device, false, caller);
final int stream = mStreamVolumeAlias[streamType];
setStreamVolumeInt(stream, index, device, false, caller);
// setting volume on ui sounds stream type also controls silent mode
if (((flags & AudioManager.FLAG_ALLOW_RINGER_MODES) != 0) ||
(mStreamVolumeAlias[streamType] == getUiSoundsStreamType())) {
(stream == getUiSoundsStreamType())) {
int newRingerMode;
if (index == 0) {
newRingerMode = mHasVibrator ? AudioManager.RINGER_MODE_VIBRATE
@@ -1382,6 +1383,8 @@ public class AudioService extends IAudioService.Stub {
}
setRingerMode(newRingerMode, TAG + ".onSetStreamVolume", false /*external*/);
}
// setting non-zero volume for a muted stream unmutes the stream and vice versa
mStreamStates[stream].mute(index == 0);
}
/** @see AudioManager#setStreamVolume(int, int, int) */