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

Commit f3252be2 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Priority only DND updates

- Changing ringer mode should put the device into
priority only mode, not alarms only mode

- The volume dialog will reflect the external ringer
mode instead of the internal ringer mode to better
represent what will happen to notification and other
sounds

Bug: 63096355
Test: manual, toggle ringer button in various dnd states
Change-Id: Iae09f50ece8e089752614d1c856ce9a118747048
parent d67e50eb
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -368,16 +368,16 @@ public class VolumeDialogImpl implements VolumeDialog {
                mController.setActiveStream(row.stream);
                if (row.stream == AudioManager.STREAM_RING) {
                    final boolean hasVibrator = mController.hasVibrator();
                    if (mState.ringerModeInternal == AudioManager.RINGER_MODE_NORMAL) {
                    if (mState.ringerModeExternal == AudioManager.RINGER_MODE_NORMAL) {
                        if (hasVibrator) {
                            mController.setRingerMode(AudioManager.RINGER_MODE_VIBRATE, false);
                            mController.setRingerMode(AudioManager.RINGER_MODE_VIBRATE, true);
                        } else {
                            final boolean wasZero = row.ss.level == 0;
                            mController.setStreamVolume(stream,
                                    wasZero ? row.lastAudibleLevel : 0);
                        }
                    } else {
                        mController.setRingerMode(AudioManager.RINGER_MODE_NORMAL, false);
                        mController.setRingerMode(AudioManager.RINGER_MODE_NORMAL, true);
                        if (row.ss.level == 0) {
                            mController.setStreamVolume(stream, 1);
                        }
@@ -403,15 +403,15 @@ public class VolumeDialogImpl implements VolumeDialog {
                return;
            }
            final boolean hasVibrator = mController.hasVibrator();
            if (mState.ringerModeInternal == AudioManager.RINGER_MODE_NORMAL) {
            if (mState.ringerModeExternal == AudioManager.RINGER_MODE_NORMAL) {
                if (hasVibrator) {
                    mController.setRingerMode(AudioManager.RINGER_MODE_VIBRATE, false);
                    mController.setRingerMode(AudioManager.RINGER_MODE_VIBRATE, true);
                } else {
                    final boolean wasZero = ss.level == 0;
                    mController.setStreamVolume(AudioManager.STREAM_RING, wasZero ? 1 : 0);
                }
            } else {
                mController.setRingerMode(AudioManager.RINGER_MODE_NORMAL, false);
                mController.setRingerMode(AudioManager.RINGER_MODE_NORMAL, true);
                if (ss.level == 0) {
                    mController.setStreamVolume(AudioManager.STREAM_RING, 1);
                }
@@ -552,7 +552,7 @@ public class VolumeDialogImpl implements VolumeDialog {
            if (ss == null) {
                return;
            }
            switch (mState.ringerModeInternal) {
            switch (mState.ringerModeExternal) {
                case AudioManager.RINGER_MODE_VIBRATE:
                    mRingerStatus.setText(R.string.volume_ringer_status_vibrate);
                    mRingerIcon.setImageResource(R.drawable.ic_volume_ringer_vibrate);
@@ -653,9 +653,9 @@ public class VolumeDialogImpl implements VolumeDialog {
        final boolean isAlarmStream = row.stream == AudioManager.STREAM_ALARM;
        final boolean isMusicStream = row.stream == AudioManager.STREAM_MUSIC;
        final boolean isRingVibrate = isRingStream
                && mState.ringerModeInternal == AudioManager.RINGER_MODE_VIBRATE;
                && mState.ringerModeExternal == AudioManager.RINGER_MODE_VIBRATE;
        final boolean isRingSilent = isRingStream
                && mState.ringerModeInternal == AudioManager.RINGER_MODE_SILENT;
                && mState.ringerModeExternal == AudioManager.RINGER_MODE_SILENT;
        final boolean isZenAlarms = mState.zenMode == Global.ZEN_MODE_ALARMS;
        final boolean isZenNone = mState.zenMode == Global.ZEN_MODE_NO_INTERRUPTIONS;
        final boolean zenMuted = isZenAlarms ? (isRingStream || isSystemStream)
+2 −2
Original line number Diff line number Diff line
@@ -1002,7 +1002,7 @@ public class ZenModeHelper {
                    if (isChange && policy.doNotDisturbWhenSilent) {
                        if (mZenMode != Global.ZEN_MODE_NO_INTERRUPTIONS
                                && mZenMode != Global.ZEN_MODE_ALARMS) {
                            newZen = Global.ZEN_MODE_ALARMS;
                            newZen = Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS;
                        }
                        setPreviousRingerModeSetting(ringerModeOld);
                    }
@@ -1042,7 +1042,7 @@ public class ZenModeHelper {
                case AudioManager.RINGER_MODE_SILENT:
                    if (isChange) {
                        if (mZenMode == Global.ZEN_MODE_OFF) {
                            newZen = Global.ZEN_MODE_ALARMS;
                            newZen = Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS;
                        }
                        ringerModeInternalOut = isVibrate ? AudioManager.RINGER_MODE_VIBRATE
                                : AudioManager.RINGER_MODE_SILENT;