Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75ae23c0 authored by John Spurlock's avatar John Spurlock
Browse files

Audio policy: setting explicit non-zero volume unmutes the stream.

And vice versa.

Bug: 21584884
Change-Id: I2cd6a84ab40edba4c6fc2b219693e0d4f0527d8d
parent a58b9a2c
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -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;
+5 −2
Original line number Diff line number Diff line
@@ -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) */