Skip to content

Commit

Permalink
Revert "SystemUI: VolumeDialog: add support for unlinked ringer streams"
Browse files Browse the repository at this point in the history
This reverts commit 898b7f1.
  • Loading branch information
basamaryan committed Aug 10, 2023
1 parent f62826a commit 6656b15
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 84 deletions.
34 changes: 0 additions & 34 deletions packages/SystemUI/res/drawable/ic_volume_ringer_mute_unlinked.xml

This file was deleted.

26 changes: 0 additions & 26 deletions packages/SystemUI/res/drawable/ic_volume_ringer_unlinked.xml

This file was deleted.

Expand Up @@ -796,13 +796,11 @@ public void onViewDetachedFromWindow(View v) {
R.drawable.ic_volume_media, R.drawable.ic_volume_media_mute, true, true);
if (!AudioSystem.isSingleVolume(mContext)) {
if (mSeparateNotification) {
addRow(AudioManager.STREAM_RING, R.drawable.ic_volume_ringer_unlinked,
R.drawable.ic_volume_ringer_mute_unlinked, true, false);
addRow(AudioManager.STREAM_NOTIFICATION, R.drawable.ic_volume_ringer,
R.drawable.ic_volume_ringer_mute, true, false);
addRow(AudioManager.STREAM_RING, R.drawable.ic_ring_volume,
R.drawable.ic_ring_volume_off, true, false);
} else {
addRow(AudioManager.STREAM_RING, R.drawable.ic_volume_ringer,
R.drawable.ic_volume_ringer_mute, true, false);
R.drawable.ic_volume_ringer, true, false);
}

addRow(STREAM_ALARM,
Expand Down Expand Up @@ -1806,7 +1804,6 @@ private boolean showActiveStreamOnly() {
private boolean isExpandableRowH(VolumeRow row) {
return row != null && row != mDefaultRow && !row.defaultStream
&& (row.stream == STREAM_RING
|| row.stream == STREAM_NOTIFICATION
|| row.stream == STREAM_ALARM
|| row.stream == STREAM_MUSIC);
}
Expand Down Expand Up @@ -2196,29 +2193,21 @@ private void updateVolumeRowH(VolumeRow row) {
final boolean isVoiceCallStream = row.stream == AudioManager.STREAM_VOICE_CALL;
final boolean isA11yStream = row.stream == STREAM_ACCESSIBILITY;
final boolean isRingStream = row.stream == AudioManager.STREAM_RING;
final boolean isNotificationStream = row.stream == STREAM_NOTIFICATION;
final boolean isSystemStream = row.stream == AudioManager.STREAM_SYSTEM;
final boolean isAlarmStream = row.stream == STREAM_ALARM;
final boolean isMusicStream = row.stream == AudioManager.STREAM_MUSIC;
final boolean isRingVibrate = isRingStream
&& mState.ringerModeInternal == AudioManager.RINGER_MODE_VIBRATE;
final boolean isNotificationVibrate = isNotificationStream
&& mState.ringerModeInternal == AudioManager.RINGER_MODE_VIBRATE;
final boolean isRingSilent = isRingStream
&& mState.ringerModeInternal == AudioManager.RINGER_MODE_SILENT;
final boolean isNotificationSilentByPolicy = isNotificationStream
&& mState.ringerModeInternal == AudioManager.RINGER_MODE_SILENT;
final boolean isZenPriorityOnly = mState.zenMode == Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS;
final boolean isZenAlarms = mState.zenMode == Global.ZEN_MODE_ALARMS;
final boolean isZenNone = mState.zenMode == Global.ZEN_MODE_NO_INTERRUPTIONS;
final boolean zenMuted = isZenAlarms ? (isRingStream || isNotificationStream
|| isSystemStream)
: isZenNone ? (isRingStream || isNotificationStream || isSystemStream
|| isAlarmStream || isMusicStream)
final boolean zenMuted = isZenAlarms ? (isRingStream || isSystemStream)
: isZenNone ? (isRingStream || isSystemStream || isAlarmStream || isMusicStream)
: isZenPriorityOnly ? ((isAlarmStream && mState.disallowAlarms) ||
(isMusicStream && mState.disallowMedia) ||
(isRingStream && mState.disallowRinger) ||
(isNotificationStream && mState.disallowRinger) ||
(isSystemStream && mState.disallowSystem))
: false;

Expand All @@ -2241,10 +2230,9 @@ private void updateVolumeRowH(VolumeRow row) {
// update icon
final boolean iconEnabled = (mAutomute || ss.muteSupported) && !zenMuted;
final int iconRes;
if (isRingVibrate || isNotificationVibrate) {
if (isRingVibrate) {
iconRes = R.drawable.ic_volume_ringer_vibrate;
} else if (isRingSilent || isNotificationSilentByPolicy
|| isNotificationStream && isStreamMuted(ss) || zenMuted) {
} else if (isRingSilent || zenMuted) {
iconRes = row.iconMuteRes;
} else if (ss.routedToBluetooth) {
if (isVoiceCallStream) {
Expand Down Expand Up @@ -2312,16 +2300,15 @@ private void updateVolumeRowH(VolumeRow row) {
}
}

// ensure tracking is disabled if zenMuted or the ringer mode was set to silent/vibrate
if (zenMuted || isNotificationVibrate || isNotificationSilentByPolicy) {
// ensure tracking is disabled if zenMuted
if (zenMuted) {
row.tracking = false;
}
enableVolumeRowViewsH(row, !zenMuted);

// update slider
final boolean enableSlider =
!zenMuted && !isNotificationVibrate && !isNotificationSilentByPolicy;
final int vlevel = row.ss.muted && (!isRingStream && !isNotificationStream && !zenMuted) ? 0
final boolean enableSlider = !zenMuted;
final int vlevel = row.ss.muted && (!isRingStream && !zenMuted) ? 0
: row.ss.level;
Trace.beginSection("VolumeDialogImpl#updateVolumeRowSliderH");
updateVolumeRowSliderH(row, enableSlider, vlevel);
Expand Down

0 comments on commit 6656b15

Please sign in to comment.